Commit accb23d1 authored by Gerhard Stein's avatar Gerhard Stein

some object bug fixes and overlay tiles in galaxy now work

parent c2d4d774
......@@ -113,6 +113,7 @@ AUX_SOURCE_DIRECTORY(src/common/Menu MENU_S)
AUX_SOURCE_DIRECTORY(src/dialog DIALOG_S)
AUX_SOURCE_DIRECTORY(src/engine ENGINE_S)
AUX_SOURCE_DIRECTORY(src/engine/galaxy GALAXY_S)
AUX_SOURCE_DIRECTORY(src/engine/galaxy/ai GALAXY_AI_S)
AUX_SOURCE_DIRECTORY(src/engine/infoscenes INFOSCENES_S)
AUX_SOURCE_DIRECTORY(src/engine/playgame PLAYGAME_S)
AUX_SOURCE_DIRECTORY(src/engine/vorticon VORTICON_S)
......@@ -133,7 +134,7 @@ AUX_SOURCE_DIRECTORY(src/vorbis VORBIS_S)
IF(BUILD_TYPE STREQUAL WIN32)
SET(ALL_SRCS ${COMMON_S} ${MENU_S} ${DIALOG_S} ${ENGINE_S}
${AI_S} ${GALAXY_S} ${INFOSCENES_S} ${PLAYGAME_S} ${VORTICON_S} ${FINALE_S} ${VPLAYGAME_S} ${FILEIO_S}
${AI_S} ${GALAXY_S} ${GALAXY_AI_S} ${INFOSCENES_S} ${PLAYGAME_S} ${VORTICON_S} ${FINALE_S} ${VPLAYGAME_S} ${FILEIO_S}
${COMPRESSION_S} ${GRAPHICS_S} ${EFFECTS_S} ${HQP_S} ${SCALE2X_S} ${SDL_S} ${SDLSOUND_S} ${SDLSYS_S}
${SDLVIDEO_S} ${ROOT_S} src/CGLogo.o)
ELSE(BUILD_TYPE STREQUAL WIN32)
......
......@@ -432,6 +432,63 @@ void CMap::drawVstripe(unsigned int x, unsigned int mpx)
}
}
/**
* This function is used for drawing in case a sprite
*/
void CMap::drawMaskonSprite( SDL_Surface *dst, int mx, int my, Uint8 spritewidth, Uint8 spriteheight, bool objdead )
{
Uint16 tl,xsize,ysize;
// get the xsize/ysize of this sprite--round up to the nearest 16
xsize = ((spritewidth>>4)<<4);
if (xsize != spritewidth) xsize+=16;
ysize = ((spriteheight>>4)<<4);
if (ysize != spriteheight) ysize+=16;
tl = at(mx,my);
mx<<=4;
my<<=4;
// now redraw any priority/masked tiles that we covered up
// with the sprite
if(m_Background)
{
for(Uint16 ya=0;ya<=ysize;ya+=16)
{
for(Uint16 xa=0;xa<=xsize;xa+=16)
{
tl = at((mx+xa)>>4,(my+ya)>>4);
CTileProperties &TileProperties = g_pBehaviorEngine->getTileProperties(1).at(tl);
if(TileProperties.behaviour == -128)
drawAnimatedTile(dst, mx+xa-m_scrollx, my+ya-m_scrolly, tl);
}
}
}
else
{
for(Uint16 ya=0;ya<=ysize;ya+=16)
{
for(Uint16 xa=0;xa<=xsize;xa+=16)
{
tl = at((mx+xa)>>4,(my+ya)>>4);
CTileProperties &TileProperties = g_pBehaviorEngine->getTileProperties(1).at(tl);
bool completeblock = TileProperties.bleft && TileProperties.bright &&
TileProperties.bup && TileProperties.bdown && objdead;
if(TileProperties.behaviour == -2) // case when when has a masked graphic
drawAnimatedTile(dst, mx+xa-m_scrollx, my+ya-m_scrolly, tl+1);
else if (TileProperties.behaviour == -1 || completeblock) // case when tile is just foreground
drawAnimatedTile(dst, mx+xa-m_scrollx, my+ya-m_scrolly, tl);
}
}
}
}
/////////////////////////
// Animation functions //
/////////////////////////
......
......@@ -45,6 +45,7 @@ public:
void drawAll();
void drawHstripe( unsigned int y, unsigned int mpy );
void drawVstripe( unsigned int x, unsigned int mpx );
void drawMaskonSprite( SDL_Surface *dst, int mx, int my, Uint8 spritewidth, Uint8 spriteheight, bool objdead );
Uint16 at(Uint16 x, Uint16 y, Uint16 t=1);
Uint16 getObjectat(Uint16 x, Uint16 y);
......@@ -62,7 +63,7 @@ public:
unsigned int getlevelat(unsigned int x, unsigned int y) {
return m_objectlayer[x>>4][y>>4]; }
Uint16 getPlaneDataAt(char plane, unsigned int x, unsigned int y){
Uint16 getPlaneDataAt(int plane, unsigned int x, unsigned int y){
return m_Plane[plane].getMapDataAt(x>>CSF, y>>CSF);
}
......
......@@ -196,7 +196,7 @@ bool CObject::checkforScenario()
{
if ( !exists || m_type==OBJ_PLAYER ) return false;
if( m_type==OBJ_EXPLOSION || m_type==OBJ_EARTHCHUNK ) return true;
if( m_type==OBJ_EXPLOSION || m_type==OBJ_EARTHCHUNK || m_type == OBJ_NONE ) return true;
// Check if enemy is near enough. If he isn't, don't make him perform. Exception is on the map
if(!mp_Map->m_worldmap)
......@@ -205,7 +205,7 @@ bool CObject::checkforScenario()
onscreen = true;
if (hasbeenonscreen ||
m_type==OBJ_RAY || m_type==OBJ_ROPE ||
m_type==OBJ_RAY || m_type==OBJ_ROPE || m_type==OBJ_ICECANNON ||
m_type==OBJ_ICECHUNK || m_type==OBJ_PLATFORM ||
m_type==OBJ_PLATVERT || m_type==OBJ_YORP ||
m_type==OBJ_FOOB || m_type==OBJ_SCRUB)
......@@ -904,40 +904,7 @@ void CObject::draw()
// or priority tile!
void CObject::drawMask(SDL_Surface *dst, CSprite &Sprite, int mx, int my)
{
int tl,xsize,ysize;
int xa,ya;
// get the xsize/ysize of this sprite--round up to the nearest 16
xsize = ((Sprite.getWidth()>>4)<<4);
if (xsize != Sprite.getWidth()) xsize+=16;
ysize = ((Sprite.getHeight()>>4)<<4);
if (ysize != Sprite.getHeight()) ysize+=16;
tl = mp_Map->at(mx,my);
mx<<=4;
my<<=4;
// now redraw any priority/masked tiles that we covered up
// with the sprite
//SDL_Rect sfc_rect;
//sfc_rect.w = sfc_rect.h = 16;
for(ya=0;ya<=ysize;ya+=16)
{
for(xa=0;xa<=xsize;xa+=16)
{
tl = mp_Map->at((mx+xa)>>4,(my+ya)>>4);
CTileProperties &TileProperties = g_pBehaviorEngine->getTileProperties().at(tl);
bool completeblock = TileProperties.bleft && TileProperties.bright &&
TileProperties.bup && TileProperties.bdown && dead;
if(TileProperties.behaviour == -2) // case when when has a masked graphic
mp_Map->drawAnimatedTile(dst, mx+xa-mp_Map->m_scrollx, my+ya-mp_Map->m_scrolly, tl+1);
else if (TileProperties.behaviour == -1 || completeblock) // case when tile is just foreground
mp_Map->drawAnimatedTile(dst, mx+xa-mp_Map->m_scrollx, my+ya-mp_Map->m_scrolly, tl);
}
}
mp_Map->drawMaskonSprite( dst, mx, my, Sprite.getWidth(), Sprite.getHeight(), dead );
}
......
......@@ -138,6 +138,7 @@ void CPlayer::kill(bool force)
{
if (godmode) return;
if (ankhtime) return;
if (pfrozentime) return;
}
if (!pdie)
{
......
......@@ -14,9 +14,10 @@
#include "../../../common/CMapLoader.h"
#include "../../../common/Playerdefines.h"
CEndingEp1::CEndingEp1(CMap &map, std::vector<CPlayer> &Player) :
CEndingEp1::CEndingEp1(CMap &map, std::vector<CPlayer> &Player, bool &hideobjects) :
CFinale(map),
m_Player(Player)
m_Player(Player),
m_hideobjects(hideobjects)
{
m_Episode = 1;
m_step = 0;
......@@ -144,6 +145,7 @@ void CEndingEp1::BackAtHome()
if(m_mustsetup)
{
//Initialization
m_hideobjects = true;
m_Map.gotoPos(0,0);
m_Map.resetScrolls(); // The Scrollsurface must be (0,0) so the bitmap is correctly drawn
m_Map.m_animation_enabled = false; // Needed, because the other map is still loaded
......@@ -186,6 +188,7 @@ void CEndingEp1::ShipFlyEarthToMShip()
if(m_mustsetup)
{ //Initialization
int x, y;
m_hideobjects = false;
std::string path = m_Map.m_gamepath;
CMapLoader MapLoader(&m_Map, &m_Player);
MapLoader.load(1, 81, path);
......
......@@ -17,7 +17,7 @@
class CEndingEp1 : public CFinale {
public:
CEndingEp1(CMap &map, std::vector<CPlayer> &Player);
CEndingEp1(CMap &map, std::vector<CPlayer> &Player, bool &hideobjects);
void process();
void ReturnsToShip();
......@@ -36,6 +36,8 @@ private:
CShipFlySys *mp_ShipFlySys;
CFinaleStaticScene *mp_FinaleStaticScene;
CMessageBox *mp_Textbox;
bool &m_hideobjects;
};
#endif /* CENDINGEP1_H_ */
......@@ -522,7 +522,7 @@ void CPlayGameVorticon::createFinale()
{
if(m_Episode == 1)
{
mp_Finale = new CEndingEp1(m_Map, m_Player);
mp_Finale = new CEndingEp1(m_Map, m_Player, m_hideobjects);
}
else if(m_Episode == 2)
{
......
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