Skip to content

Commit

Permalink
Merge branch 'larry' into devel. Closes #62.
Browse files Browse the repository at this point in the history
  • Loading branch information
Quintus committed Jun 13, 2014
2 parents 0c43a5a + 89ce9bb commit ed3fdf2
Show file tree
Hide file tree
Showing 46 changed files with 4,624 additions and 113 deletions.
1,713 changes: 1,713 additions & 0 deletions drafts/game/mrvertigo27/level/enemies/Larry_w_Export.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,128 changes: 1,128 additions & 0 deletions drafts/game/mrvertigo27/level/enemies/larry.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,049 changes: 1,049 additions & 0 deletions drafts/game/mrvertigo27/level/enemies/larry_plain.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions smc/data/editor/level_items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,18 @@
<property name="color" value="grey" />
<property name="direction" value="right" />
</item>
<item>
<property name="object_name" value="enemy" />
<property name="object_tags" value="level;enemy" />
<property name="type" value="larry" />
<property name="direction" value="left" />
</item>
<item>
<property name="object_name" value="enemy" />
<property name="object_tags" value="level;enemy" />
<property name="type" value="larry" />
<property name="direction" value="right" />
</item>
<item>
<property name="object_name" value="enemy" />
<property name="object_tags" value="level;enemy" />
Expand Down
Binary file added smc/data/pixmaps/enemy/larry/grey/action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/action.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
Binary file added smc/data/pixmaps/enemy/larry/grey/active_turn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/active_turn.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/active_walk_1.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/active_walk_2.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/active_walk_3.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/active_walk_4.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
Binary file added smc/data/pixmaps/enemy/larry/grey/plain_turn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/plain_turn.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/plain_walk_1.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/plain_walk_2.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/plain_walk_3.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions smc/data/pixmaps/enemy/larry/grey/plain_walk_4.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
width 70
height 70
col_rect 10 30 40 40
author mrvertigo27
41 changes: 15 additions & 26 deletions smc/src/core/errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ using namespace SMC;

SMCError::SMCError()
{
//
m_smc_errmsg = "Unknown SMC exception.";
}


SMCError::SMCError(std::string message)
{
m_smc_errmsg = message;
}

SMCError::~SMCError() throw()
Expand All @@ -14,24 +20,20 @@ SMCError::~SMCError() throw()

const char* SMCError::what() const throw()
{
return "Unknown SMC exception.\n";
return m_smc_errmsg.c_str();
}

ConfigurationError::ConfigurationError(std::string msg)
: SMCError(msg)
{
m_message = msg;
//
}

ConfigurationError::~ConfigurationError() throw()
{
//
}

const char* ConfigurationError::what() const throw()
{
return m_message.c_str();
}

XmlKeyDoesNotExist::XmlKeyDoesNotExist(std::string key)
{
m_key = key;
Expand All @@ -54,35 +56,26 @@ const char* XmlKeyDoesNotExist::what() const throw()
}

NotImplementedError::NotImplementedError(std::string message)
: SMCError(message)
{
m_message = message;
}

NotImplementedError::~NotImplementedError() throw()
{
//
}

const char* NotImplementedError::what() const throw()
{
return m_message.c_str();
}

InvalidLevelError::InvalidLevelError(std::string message)
: SMCError(message)
{
m_message = message;
//
}

InvalidLevelError::~InvalidLevelError() throw()
{
//
}

const char* InvalidLevelError::what() const throw()
{
return m_message.c_str();
}

RestartedXmlParserError::RestartedXmlParserError()
{
//
Expand Down Expand Up @@ -116,20 +109,16 @@ const char* InvalidMovingStateError::what() const throw()
}

EditorError::EditorError(std::string msg)
: SMCError(msg)
{
m_msg = msg;
//
}

EditorError::~EditorError() throw()
{
//
}

const char* EditorError::what() const throw()
{
return m_msg.c_str();
}

EditorSpriteCopyFailedError::EditorSpriteCopyFailedError(cSprite* p_sprite)
: EditorError(std::string("Editor sprite '") + p_sprite->Create_Name() + "' copy failed!")
{
Expand Down
16 changes: 3 additions & 13 deletions smc/src/core/errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ namespace SMC {
{
public:
SMCError();
SMCError(std::string message);
virtual ~SMCError() throw();

virtual const char* what() const throw();
protected:
std::string m_smc_errmsg;
};

class ConfigurationError: public SMCError
{
public:
ConfigurationError(std::string message);
virtual ~ConfigurationError() throw();
virtual const char* what() const throw();
protected:
std::string m_message;
};

/**
Expand All @@ -50,20 +50,13 @@ namespace SMC {
public:
NotImplementedError(std::string message);
virtual ~NotImplementedError() throw();

virtual const char* what() const throw();
protected:
std::string m_message;
};

class InvalidLevelError: public SMCError
{
public:
InvalidLevelError(std::string message);
virtual ~InvalidLevelError() throw();
virtual const char* what() const throw();
protected:
std::string m_message;
};

class RestartedXmlParserError: public SMCError
Expand All @@ -89,9 +82,6 @@ namespace SMC {
public:
EditorError(std::string msg);
virtual ~EditorError() throw();
virtual const char* what() const throw();
protected:
std::string m_msg;
};

class EditorSpriteCopyFailedError: public EditorError
Expand Down
1 change: 1 addition & 0 deletions smc/src/core/global_game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ enum SpriteType
TYPE_BEETLE_BARRAGE = 68,
TYPE_BEETLE = 69,
TYPE_SHELL = 70,
TYPE_LARRY = 72,
// items
TYPE_POWERUP = 23,
TYPE_MUSHROOM_DEFAULT = 25,
Expand Down
4 changes: 2 additions & 2 deletions smc/src/core/math/circle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

using namespace SMC;

bool GL_Circle::Intersects(const GL_Circle& c)
bool GL_Circle::Intersects(const GL_Circle& c) const
{
return Col_Circle(m_x, m_y, m_radius, c.Get_X(), c.Get_Y(), c.Get_Radius());
}

bool GL_Circle::Intersects(const GL_rect& r)
bool GL_Circle::Intersects(const GL_rect& r) const
{
return Col_Circle(*this, r);
}
Expand Down
4 changes: 2 additions & 2 deletions smc/src/core/math/circle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ namespace SMC {

inline void Clear(){ m_x = m_y = m_radius = 0; }

bool Intersects(const GL_Circle& c);
bool Intersects(const GL_rect& r);
bool Intersects(const GL_Circle& c) const;
bool Intersects(const GL_rect& r) const;
// bool Intersects(const GL_point& p); // TODO

private:
Expand Down
32 changes: 32 additions & 0 deletions smc/src/core/sprite_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,38 @@ void cSprite_Manager :: Get_Colliding_Objects( cSprite_List &col_objects, const
}
}

void cSprite_Manager :: Get_Colliding_Objects( cSprite_List &col_objects, const GL_Circle &circle, bool with_player /* = 0 */, const cSprite *exclude_sprite /* = NULL */ ) const
{
// Check objects
for( cSprite_List::const_iterator itr = objects.begin(); itr != objects.end(); ++itr )
{
// get object pointer
cSprite *obj = (*itr);

// if destroyed object
if( obj == exclude_sprite || obj->m_auto_destroy )
{
continue;
}

// if circles don't touch
if( !circle.Intersects( obj->m_col_rect ) )
{
continue;
}

col_objects.push_back( obj );
}

if( with_player && pActive_Player != exclude_sprite )
{
if( circle.Intersects( pActive_Player->m_col_rect ) )
{
col_objects.push_back( pActive_Player );
}
}
}

void cSprite_Manager :: Handle_Collision_Items( void )
{
for( cSprite_List::iterator itr = objects.begin(); itr != objects.end(); ++itr )
Expand Down
3 changes: 2 additions & 1 deletion smc/src/core/sprite_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ class cSprite_Manager : public cObject_Manager<cSprite>
* with_player : include player
*/
void Get_Objects_sorted( cSprite_List &new_objects, bool editor_sort = 0, bool with_player = 0 ) const;
/* Get objects colliding with the given rectangle
/* Get objects colliding with the given rectangle/circle
* with_player : include player in check
* exclude_sprite : exclude the given sprite from check
*/
void Get_Colliding_Objects( cSprite_List &col_objects, const GL_rect &rect, bool with_player = 0, const cSprite *exclude_sprite = NULL ) const;
void Get_Colliding_Objects( cSprite_List &col_objects, const GL_Circle &circle, bool with_player = 0, const cSprite *exclude_sprite = NULL ) const;

// Update items drawing validation
inline void Update_Items_Valid_Draw( void )
Expand Down
Loading

0 comments on commit ed3fdf2

Please sign in to comment.