Commit 350fc827 authored by Gerhard Stein's avatar Gerhard Stein

Reorganisation of the codeo

parent 0616245e
......@@ -466,7 +466,7 @@ int CSpriteObject::checkSolidD( int x1, int x2, int y2, const bool push_mode )
}
if( ( (y2>>STC) != ((y2>>CSF)<<TILE_S) ) && !push_mode )
return false;
return 0;
// Check for down from the object
if(solid)
......@@ -512,7 +512,7 @@ int CSpriteObject::checkSolidD( int x1, int x2, int y2, const bool push_mode )
return 1;
}
return false;
return 0;
}
/* Special slope function for galaxy
......
......@@ -139,7 +139,7 @@ void CPlayer::setupforLevelPlay()
keyprocstate = 0; // KPROC_IDLE
pjustjumped = pjustfell = true;
pfireframetimer = 0;
psupportingobject = lastsupportingobject = 0;
psupportingobject = 0;
object_chosen = false;
lastpogo = false;
hintused = false;
......
......@@ -16,7 +16,6 @@ int CSpriteObject::m_number_of_objects = 0; // The current number of total objec
// Initialization Routine
///
CSpriteObject::CSpriteObject(CMap *pmap, Uint32 x, Uint32 y) :
m_index(m_number_of_objects),
mHealthPoints(1),
sprite(BLANKSPRITE),
mp_Map(pmap),
......@@ -41,7 +40,6 @@ transluceny(0)
hasbeenonscreen = false;
honorPriority = true;
dontdraw = false;
touchPlayer = touchedBy = 0;
cansupportplayer = false;
dying = false;
m_ActionBaseOffset = 0x0;
......
......@@ -71,7 +71,6 @@ class CSpriteObject
public:
CSpriteObject(CMap *pmap, Uint32 x, Uint32 y);
unsigned int m_index; // Like an ID for some objects that need this implementation
char mHealthPoints; // episode 1 style four-shots-to-kill
bool exists;
bool onscreen; // true=(scrx,scry) position is visible onscreen
......@@ -96,19 +95,14 @@ public:
bool inhibitfall; // if true common_enemy_ai will not do falling
bool cansupportplayer;
//std::vector<CSpriteObject*> *mp_object;
bool blockedl, blockedr, blockedu, blockedd;
bool onslope;
bool falling;
signed int xinertia, yinertia;
unsigned char xinertiatimer;
unsigned int psupportingobject, lastsupportingobject;
unsigned int psupportingobject;
bool supportedbyobject;
unsigned char touchPlayer; // 1=hit detection with player
unsigned char touchedBy; // which player was hit
bool dead, dying;
bool m_canturnaround;
......
......@@ -23,11 +23,11 @@ CPlayerBase::CPlayerBase(
CGalaxySpriteObject(pmap, x, y),
m_Inventory(l_Inventory),
m_camera(pmap,x,y,this),
mPlayerNum(0),
m_ObjectPtrs(ObjectPtrs),
m_Cheatmode(Cheatmode),
mp_processState(NULL)
{
m_index = 0;
m_walktimer = 0;
m_timer = 0;
m_dying = false;
......@@ -62,45 +62,45 @@ void CPlayerBase::processInput()
m_playcontrol[PA_X] = 0;
m_playcontrol[PA_Y] = 0;
if(g_pInput->getHoldedCommand(m_index, IC_LEFT))
if(g_pInput->getHoldedCommand(mPlayerNum, IC_LEFT))
m_playcontrol[PA_X] -= 100;
else if(g_pInput->getHoldedCommand(m_index, IC_RIGHT))
else if(g_pInput->getHoldedCommand(mPlayerNum, IC_RIGHT))
m_playcontrol[PA_X] += 100;
if(g_pInput->getHoldedCommand(m_index, IC_DOWN))
if(g_pInput->getHoldedCommand(mPlayerNum, IC_DOWN))
m_playcontrol[PA_Y] += 100;
else if(g_pInput->getHoldedCommand(m_index, IC_UP))
else if(g_pInput->getHoldedCommand(mPlayerNum, IC_UP))
m_playcontrol[PA_Y] -= 100;
if(g_pInput->getHoldedCommand(m_index, IC_UPPERLEFT))
if(g_pInput->getHoldedCommand(mPlayerNum, IC_UPPERLEFT))
{
m_playcontrol[PA_X] -= 100;
m_playcontrol[PA_Y] -= 100;
}
else if(g_pInput->getHoldedCommand(m_index, IC_UPPERRIGHT))
else if(g_pInput->getHoldedCommand(mPlayerNum, IC_UPPERRIGHT))
{
m_playcontrol[PA_X] += 100;
m_playcontrol[PA_Y] -= 100;
}
else if(g_pInput->getHoldedCommand(m_index, IC_LOWERLEFT))
else if(g_pInput->getHoldedCommand(mPlayerNum, IC_LOWERLEFT))
{
m_playcontrol[PA_X] -= 100;
m_playcontrol[PA_Y] += 100;
}
else if(g_pInput->getHoldedCommand(m_index, IC_LOWERRIGHT))
else if(g_pInput->getHoldedCommand(mPlayerNum, IC_LOWERRIGHT))
{
m_playcontrol[PA_X] += 100;
m_playcontrol[PA_Y] += 100;
}
m_playcontrol[PA_JUMP] = g_pInput->getHoldedCommand(m_index, IC_JUMP) ? 1 : 0;
m_playcontrol[PA_POGO] = g_pInput->getHoldedCommand(m_index, IC_POGO) ? 1 : 0;
m_playcontrol[PA_JUMP] = g_pInput->getHoldedCommand(mPlayerNum, IC_JUMP) ? 1 : 0;
m_playcontrol[PA_POGO] = g_pInput->getHoldedCommand(mPlayerNum, IC_POGO) ? 1 : 0;
// The possibility to charge jumps. This is mainly used for the pogo. it is limited to 50
if( m_playcontrol[PA_JUMP] > 50) m_playcontrol[PA_JUMP] = 50;
// Two button firing process
if(g_pInput->getTwoButtonFiring(m_index))
if(g_pInput->getTwoButtonFiring(mPlayerNum))
{
if(m_playcontrol[PA_JUMP] && m_playcontrol[PA_POGO])
{
......@@ -121,7 +121,7 @@ void CPlayerBase::processInput()
}
else
{
m_playcontrol[PA_FIRE] = g_pInput->getHoldedCommand(m_index, IC_FIRE) ? 1 : 0;
m_playcontrol[PA_FIRE] = g_pInput->getHoldedCommand(mPlayerNum, IC_FIRE) ? 1 : 0;
}
}
......
......@@ -92,6 +92,8 @@ protected:
bool checkMapBoundaryR(const int x2);
bool checkMapBoundaryU(const int y1);
unsigned short mPlayerNum;
std::vector<CSpriteObject*>& m_ObjectPtrs;
Sint16 m_playcontrol[PA_MAX_ACTIONS];
......
......@@ -20,7 +20,6 @@ CSpriteItem::CSpriteItem(CMap *pmap, Uint32 x, Uint32 y,
CGalaxySpriteObject(pmap, x, y),
m_ObjectPtrs(ObjectPtrs)
{
m_index = sprite;
m_basesprite = sprite;
m_timer = (y*256+x)%MAX_ANIMATION_TIMER;
this->sprite = (m_timer%2 == 0) ? m_basesprite : m_basesprite+1;
......
......@@ -11,7 +11,10 @@
CVorticonSpriteObject::CVorticonSpriteObject(CMap *pmap, Uint32 x, Uint32 y, object_t type) :
CSpriteObject(pmap, x, y),
m_type(type)
m_index(m_number_of_objects),
m_type(type),
touchPlayer(0),
touchedBy(0)
{
if(m_type != OBJ_NONE )
{
......
......@@ -20,8 +20,12 @@ public:
bool calcVisibility();
unsigned int m_index; // Like an ID for some objects that need this implementation
object_t m_type; // yorp, vorticon, etc.
unsigned char touchPlayer; // 1=hit detection with player
unsigned char touchedBy; // which player was hit
};
#endif /* CVORTICONSPRITEOBJECT_H_ */
......@@ -164,7 +164,7 @@ struct OldSaveGameFormatV5
char pdie, pdieframe, pdietimer;
int pdietillfly;
signed int pdie_xvect;
int psupportingtile, psupportingobject, lastsupportingobject;
int psupportingtile, psupportingobject;
char psliding;
char psemisliding;
bool ppogostick;
......@@ -337,7 +337,7 @@ struct OldSaveGameFormatV4
char pdie, pdieframe, pdietimer;
int pdietillfly;
signed int pdie_xvect;
int psupportingtile, psupportingobject, lastsupportingobject;
int psupportingtile, psupportingobject;
char psliding;
char psemisliding;
bool ppogostick;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment