- improved animatedtiles function especially for hint message boxes
- tile animation bugs in some levels of ep2 have been fixed git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@196 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -125,34 +125,38 @@ bool CTileLoader::load()
|
||||
}
|
||||
|
||||
int value;
|
||||
|
||||
for( j=0 ; j < numtiles ; j++ )
|
||||
for( j=0 ; j < numtiles ;)
|
||||
{
|
||||
value = TileProperty[j][0];
|
||||
|
||||
// stuff for animated tiles
|
||||
if(value == 1)
|
||||
{
|
||||
tiles[j].animOffset = 0; // starting offset from the base frame
|
||||
tiles[j++].animOffset = 0; // starting offset from the base frame
|
||||
}
|
||||
else if( value == 2 )
|
||||
{
|
||||
tiles[j++].animOffset = 0; // starting offset from the base frame
|
||||
tiles[j].animOffset = 1; // starting offset from the base frame
|
||||
tiles[j++].animOffset = 1; // starting offset from the base frame
|
||||
}
|
||||
else
|
||||
{
|
||||
tiles[j++].animOffset = 0; // starting offset from the base frame
|
||||
tiles[j++].animOffset = 1; // starting offset from the base frame
|
||||
tiles[j++].animOffset = 2; // starting offset from the base frame
|
||||
tiles[j].animOffset = 3; // starting offset from the base frame
|
||||
tiles[j++].animOffset = 3; // starting offset from the base frame
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0 ; i<numtiles ; i++)
|
||||
{
|
||||
printf("tile %d: %d\n",i,TileProperty[i][0]);
|
||||
}
|
||||
|
||||
// This function assigns the correct tiles that have to be changed
|
||||
assignChangeTileAttribute(tiles);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CTileLoader::assignChangeTileAttribute(stTile *tile)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
// gamedo.c
|
||||
int gamedo_ScrollTriggers(int theplayer);
|
||||
void gamedo_AnimatedTiles(void);
|
||||
void gamedo_AnimatedTiles(bool animate_hinttiles = false);
|
||||
|
||||
void gamedo_render_eraseobjects(void);
|
||||
void gamedo_render_drawdebug(void);
|
||||
|
||||
14
src/game.cpp
14
src/game.cpp
@@ -39,13 +39,7 @@ void gameloop(stCloneKeenPlus *pCKP)
|
||||
|
||||
int enter,lastquit;
|
||||
|
||||
// Enable the yorp/garg statues elders switches animations
|
||||
for(int i=0 ; i<numtiles ; i++)
|
||||
if(TileProperty[i][BEHAVIOR] == 22)
|
||||
TileProperty[i][ANIMATION] = 4;
|
||||
|
||||
if (player[0].x==0 || player[0].y==0)
|
||||
|
||||
{
|
||||
crashflag=1;
|
||||
crashflag2 = pCKP->Control.levelcontrol.curlevel;
|
||||
@@ -143,7 +137,7 @@ void gameloop(stCloneKeenPlus *pCKP)
|
||||
}
|
||||
}
|
||||
|
||||
gamedo_AnimatedTiles();
|
||||
gamedo_AnimatedTiles(!pCKP->Control.levelcontrol.usedhintmb);
|
||||
gamedo_enemyai(pCKP);
|
||||
|
||||
gamedo_HandleFKeys(pCKP);
|
||||
@@ -1315,7 +1309,11 @@ void procgoodie(int t, int mpx, int mpy, int theplayer, stCloneKeenPlus *pCKP)
|
||||
break;
|
||||
|
||||
case 22: // Game info block (Youseein your mind or vorticon elder...)
|
||||
showGameHint(mpx, mpy, pCKP->Control.levelcontrol.episode, pCKP->Control.levelcontrol.curlevel);
|
||||
if(!pCKP->Control.levelcontrol.usedhintmb)
|
||||
{
|
||||
showGameHint(mpx, mpy, pCKP->Control.levelcontrol.episode, pCKP->Control.levelcontrol.curlevel);
|
||||
pCKP->Control.levelcontrol.usedhintmb = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 27:
|
||||
|
||||
@@ -186,21 +186,25 @@ int scrollchanged;
|
||||
}
|
||||
|
||||
// animates animated tiles
|
||||
void gamedo_AnimatedTiles(void)
|
||||
void gamedo_AnimatedTiles(bool animate_hinttiles)
|
||||
{
|
||||
int i;
|
||||
/* animate animated tiles */
|
||||
if (animtiletimer>ANIM_TILE_TIME)
|
||||
{
|
||||
/* advance to next frame */
|
||||
curanimtileframe = (curanimtileframe+1)&7;
|
||||
/* re-draw all animated tiles */
|
||||
curanimtileframe = (curanimtileframe+1)&7;
|
||||
|
||||
/* re-draw all animated tiles */
|
||||
for(i=1;i<MAX_ANIMTILES-1;i++)
|
||||
{
|
||||
if (animtiles[i].slotinuse)
|
||||
{
|
||||
g_pGraphics->drawTile(animtiles[i].x, animtiles[i].y, animtiles[i].baseframe+((animtiles[i].offset+curanimtileframe)%TileProperty[animtiles[i].baseframe][ANIMATION]));
|
||||
}
|
||||
if (animtiles[i].slotinuse)
|
||||
{
|
||||
if( TileProperty[animtiles[i].baseframe][BEHAVIOR] != 22 || animate_hinttiles ) // If the tile is a hint mb, then, only animate if it hasn't been triggered yet!
|
||||
{
|
||||
g_pGraphics->drawTile(animtiles[i].x, animtiles[i].y, animtiles[i].baseframe+((animtiles[i].offset+curanimtileframe)%TileProperty[animtiles[i].baseframe][ANIMATION]));
|
||||
}
|
||||
}
|
||||
}
|
||||
animtiletimer = 0;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ struct stLevelControl
|
||||
|
||||
int episode; // which episode we're playing (1-3)
|
||||
bool hardmode;
|
||||
bool usedhintmb; // Has the message box been used?
|
||||
|
||||
// array of which levels have been completed (have "Done" tiles over them
|
||||
// on the world map)
|
||||
|
||||
@@ -378,6 +378,7 @@ void playgame_levelmanager(stCloneKeenPlus *pCKP)
|
||||
p_levelcontrol->command = LVLC_NOCOMMAND;
|
||||
|
||||
p_levelcontrol->dark = 0;
|
||||
p_levelcontrol->usedhintmb = false;
|
||||
if (loadinggame)
|
||||
{
|
||||
sprintf(SaveGameFileName, "ep%csave%c.dat", p_levelcontrol->episode+'0', loadslot+'0');
|
||||
|
||||
@@ -238,7 +238,7 @@ int i;
|
||||
px = ((mapxstripepos+((x-mapx)<<4))&511);
|
||||
py = ((mapystripepos+((y-mapy)<<4))&511);
|
||||
|
||||
TileProperty[map.mapdata[x][y]][ANIMATION] = 1;
|
||||
//TileProperty[map.mapdata[x][y]][ANIMATION] = 1;
|
||||
|
||||
// find it!
|
||||
for(i=1;i<MAX_ANIMTILES-1;i++)
|
||||
|
||||
81
src/misc.cpp
81
src/misc.cpp
@@ -159,10 +159,6 @@ void showGameHint(int mpx, int mpy, int episode, int level)
|
||||
{
|
||||
std::string strname;
|
||||
|
||||
// First check, if the item has really been activated
|
||||
if(!map_isanimated(mpx, mpy+(episode==2) ))
|
||||
return;
|
||||
|
||||
if(episode == 1)
|
||||
{
|
||||
if(map.mapdata[mpx][mpy] >= 435 && map.mapdata[mpx][mpy] <= 438)
|
||||
@@ -189,9 +185,6 @@ void showGameHint(int mpx, int mpy, int episode, int level)
|
||||
break;
|
||||
}
|
||||
}
|
||||
map_deanimate(mpx, mpy+(episode==2));
|
||||
|
||||
// In Episode 2 the floor must be deanimated, instead of the player, the player is at.?
|
||||
|
||||
CWindow *InfoTextWindow = new CWindow(0.2, 0.2, 0.6, 0.6);
|
||||
InfoTextWindow->addTextBox(0.0f, 0.0f, 1.0f, 0.8f, getstring(strname), true);
|
||||
@@ -209,80 +202,6 @@ void showGameHint(int mpx, int mpy, int episode, int level)
|
||||
delete InfoTextWindow;
|
||||
}
|
||||
|
||||
void VorticonElder(int mpx, int mpy, stCloneKeenPlus *pCKP)
|
||||
{
|
||||
CWindow *ElderTextWindow;
|
||||
|
||||
/*
|
||||
int twirlframe, twirltimer;
|
||||
int dlgX,dlgY,dlgW,dlgH,twirlX,twirlY;
|
||||
const int twirl_speed = 100;*/
|
||||
const char *strName="";
|
||||
|
||||
// TODO: Pause the game, because CWindow won't do that
|
||||
|
||||
g_pInput->flushAll();
|
||||
|
||||
g_pSound->pauseSound();
|
||||
|
||||
ElderTextWindow = new CWindow(0.2, 0.2, 0.6, 0.6);
|
||||
|
||||
switch(pCKP->Control.levelcontrol.curlevel)
|
||||
{
|
||||
case 8:
|
||||
strName = "EP2_VE_NOJUMPINDARK";
|
||||
break;
|
||||
case 10:
|
||||
strName = "EP2_VE_EVILBELTS";
|
||||
break;
|
||||
|
||||
default:
|
||||
crashflag = 1;
|
||||
why_term_ptr = "VE box: Illegal level #.";
|
||||
break;
|
||||
}
|
||||
|
||||
/*dlgX = GetStringAttribute(strName, "LEFT");
|
||||
dlgY = GetStringAttribute(strName, "TOP");
|
||||
dlgW = GetStringAttribute(strName, "WIDTH");
|
||||
dlgH = GetStringAttribute(strName, "HEIGHT");
|
||||
twirlX = GetStringAttribute(strName, "TWIRLX");
|
||||
twirlY = GetStringAttribute(strName, "TWIRLY");*/
|
||||
|
||||
//dialogbox(dlgX, dlgY, dlgW, dlgH);
|
||||
//g_pGraphics->drawFont( getstring(strName), (dlgX+1)<<3, (dlgY+1)<<3,0);
|
||||
// For what was pGraphics->drawFont
|
||||
|
||||
//twirlframe = 0;
|
||||
//twirltimer = twirl_speed+1;
|
||||
// wait for enter
|
||||
do
|
||||
{
|
||||
/*if (twirltimer>twirl_speed)
|
||||
{
|
||||
g_pGraphics->drawCharacter((dlgX+twirlX)<<3, (dlgY+twirlY)<<3, 9+twirlframe);
|
||||
g_pVideoDriver->update_screen();
|
||||
twirlframe++;
|
||||
if (twirlframe>5) twirlframe=0;
|
||||
twirltimer=0;
|
||||
} else twirltimer++;*/
|
||||
|
||||
g_pInput->pollEvents();
|
||||
g_pTimer->SpeedThrottle();
|
||||
ElderTextWindow->render();
|
||||
g_pVideoDriver->update_screen();
|
||||
} while(!g_pInput->getPressedKey(KENTER) );
|
||||
|
||||
// make the switch stop glowing
|
||||
// There may be a bug. Be careful
|
||||
map_chgtile(mpx, mpy+1, 432);
|
||||
|
||||
map_deanimate(mpx, mpy+1);
|
||||
|
||||
g_pSound->resumeSounds();
|
||||
}
|
||||
|
||||
|
||||
void inventory_draw_ep1(int p)
|
||||
{
|
||||
int x,t,i,j;
|
||||
|
||||
Reference in New Issue
Block a user