- added more AI and other functions of CK 8.4
- distributed the source code to more files - reduced some lines of source code git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@214 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -44,20 +44,13 @@ short CGame::runCycle(stCloneKeenPlus *pCKP)
|
|||||||
{
|
{
|
||||||
int opt = MAINMNU_1PLAYER;
|
int opt = MAINMNU_1PLAYER;
|
||||||
int retval;
|
int retval;
|
||||||
int eseq = 0;
|
|
||||||
int defaultopt = 0;
|
int defaultopt = 0;
|
||||||
|
|
||||||
initgamefirsttime(pCKP, EGAGraphics->getNumSprites());
|
initgamefirsttime(pCKP, EGAGraphics->getNumSprites());
|
||||||
initgame(pCKP);
|
initgame( &(pCKP->Control.levelcontrol) );
|
||||||
|
|
||||||
g_pLogFile->ftextOut("Game starting...<br>");
|
g_pLogFile->ftextOut("Game starting...<br>");
|
||||||
|
|
||||||
if (eseq)
|
|
||||||
{
|
|
||||||
endsequence(pCKP);
|
|
||||||
closeCKP(pCKP);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!pCKP->Control.skipstarting)
|
if(!pCKP->Control.skipstarting)
|
||||||
{
|
{
|
||||||
CIntro Intro;
|
CIntro Intro;
|
||||||
|
|||||||
@@ -12,6 +12,12 @@
|
|||||||
#include "vorticon/CEGAGraphics.h"
|
#include "vorticon/CEGAGraphics.h"
|
||||||
#include "vorticon/CMessages.h"
|
#include "vorticon/CMessages.h"
|
||||||
|
|
||||||
|
// references to cinematics/CommonEnding
|
||||||
|
int endsequence(stCloneKeenPlus *pCKP);
|
||||||
|
|
||||||
|
// Reference from game.cpp
|
||||||
|
void initgame(stLevelControl *p_levelcontrol);
|
||||||
|
|
||||||
class CGame {
|
class CGame {
|
||||||
public:
|
public:
|
||||||
CGame();
|
CGame();
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
char garg_CanWalkLeft(int o);
|
char garg_CanWalkLeft(int o);
|
||||||
char garg_CanWalkRight(int o);
|
char garg_CanWalkRight(int o);
|
||||||
|
|
||||||
void garg_ai(int o, stCloneKeenPlus *pCKP)
|
void garg_ai(int o, bool hardmode)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ unsigned int i;
|
|||||||
|
|
||||||
if (garg_CanWalkLeft(o))
|
if (garg_CanWalkLeft(o))
|
||||||
{
|
{
|
||||||
if (pCKP->Control.levelcontrol.hardmode)
|
if (hardmode)
|
||||||
objects[o].x -= GARG_WALK_SPEED_FAST;
|
objects[o].x -= GARG_WALK_SPEED_FAST;
|
||||||
else
|
else
|
||||||
objects[o].x -= GARG_WALK_SPEED;
|
objects[o].x -= GARG_WALK_SPEED;
|
||||||
@@ -223,7 +223,7 @@ unsigned int i;
|
|||||||
objects[o].sprite = GARG_WALK_RIGHT + objects[o].ai.garg.walkframe;
|
objects[o].sprite = GARG_WALK_RIGHT + objects[o].ai.garg.walkframe;
|
||||||
if (garg_CanWalkRight(o))
|
if (garg_CanWalkRight(o))
|
||||||
{
|
{
|
||||||
if (pCKP->Control.levelcontrol.hardmode)
|
if (hardmode)
|
||||||
objects[o].x += GARG_WALK_SPEED_FAST;
|
objects[o].x += GARG_WALK_SPEED_FAST;
|
||||||
else
|
else
|
||||||
objects[o].x += GARG_WALK_SPEED;
|
objects[o].x += GARG_WALK_SPEED;
|
||||||
@@ -238,8 +238,8 @@ unsigned int i;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* walk animation */
|
/* walk animation */
|
||||||
if (objects[o].ai.garg.timer > GARG_WALK_ANIM_TIME || \
|
if (objects[o].ai.garg.timer > GARG_WALK_ANIM_TIME ||
|
||||||
(objects[o].ai.garg.timer > GARG_WALK_ANIM_TIME && pCKP->Control.levelcontrol.hardmode))
|
(objects[o].ai.garg.timer > GARG_WALK_ANIM_TIME && hardmode))
|
||||||
{
|
{
|
||||||
objects[o].ai.garg.walkframe ^= 1;
|
objects[o].ai.garg.walkframe ^= 1;
|
||||||
objects[o].ai.garg.timer = 0;
|
objects[o].ai.garg.timer = 0;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#define NINJA_DYING_FRAME 83
|
#define NINJA_DYING_FRAME 83
|
||||||
#define NINJA_DEAD_FRAME 84
|
#define NINJA_DEAD_FRAME 84
|
||||||
|
|
||||||
void ninja_ai(int o, stCloneKeenPlus *pCKP)
|
void ninja_ai(int o, bool hardmode)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int onsamelevel;
|
int onsamelevel;
|
||||||
@@ -35,7 +35,7 @@ int onsamelevel;
|
|||||||
{
|
{
|
||||||
objects[o].ai.ninja.state = NINJA_STAND;
|
objects[o].ai.ninja.state = NINJA_STAND;
|
||||||
objects[o].ai.ninja.timetillkick = (rand()%(NINJA_MAX_TIME_TILL_KICK-NINJA_MIN_TIME_TILL_KICK))+NINJA_MIN_TIME_TILL_KICK;
|
objects[o].ai.ninja.timetillkick = (rand()%(NINJA_MAX_TIME_TILL_KICK-NINJA_MIN_TIME_TILL_KICK))+NINJA_MIN_TIME_TILL_KICK;
|
||||||
if (pCKP->Control.levelcontrol.hardmode) objects[o].ai.ninja.timetillkick /= 3;
|
if (hardmode) objects[o].ai.ninja.timetillkick /= 3;
|
||||||
|
|
||||||
if (player[primaryplayer].x < objects[o].x)
|
if (player[primaryplayer].x < objects[o].x)
|
||||||
{ objects[o].ai.ninja.dir = LEFT; }
|
{ objects[o].ai.ninja.dir = LEFT; }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
// raygun blast, shot by keen, and by the tank robots in ep1&2.
|
// raygun blast, shot by keen, and by the tank robots in ep1&2.
|
||||||
#include "ray.h"
|
#include "ray.h"
|
||||||
|
|
||||||
void ray_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol)
|
void ray_ai(int o, int episode)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int hitlethal;
|
int hitlethal;
|
||||||
@@ -69,8 +69,7 @@ int hitlethal;
|
|||||||
// check if ray hit keen. if canpk=0, only enemy rays can hurt keen
|
// check if ray hit keen. if canpk=0, only enemy rays can hurt keen
|
||||||
if (objects[o].touchPlayer)
|
if (objects[o].touchPlayer)
|
||||||
{
|
{
|
||||||
if (player[objects[o].touchedBy].pfrozentime > PFROZEN_THAW && \
|
if (player[objects[o].touchedBy].pfrozentime > PFROZEN_THAW && episode==1)
|
||||||
levelcontrol.episode==1)
|
|
||||||
{
|
{
|
||||||
// shot a frozen player--melt the ice
|
// shot a frozen player--melt the ice
|
||||||
player[objects[o].touchedBy].pfrozentime = PFROZEN_THAW;
|
player[objects[o].touchedBy].pfrozentime = PFROZEN_THAW;
|
||||||
@@ -135,14 +134,14 @@ int hitlethal;
|
|||||||
objects[o].ai.ray.state = RAY_STATE_ZAPZOT;
|
objects[o].ai.ray.state = RAY_STATE_ZAPZOT;
|
||||||
objects[o].ai.ray.zapzottimer = RAY_ZAPZOT_TIME;
|
objects[o].ai.ray.zapzottimer = RAY_ZAPZOT_TIME;
|
||||||
|
|
||||||
if (levelcontrol.episode==1)
|
if (episode==1)
|
||||||
{
|
{
|
||||||
if (rand()&1)
|
if (rand()&1)
|
||||||
{ objects[o].sprite = RAY_FRAME_ZAP_EP1; }
|
{ objects[o].sprite = RAY_FRAME_ZAP_EP1; }
|
||||||
else
|
else
|
||||||
{ objects[o].sprite = RAY_FRAME_ZOT_EP1; }
|
{ objects[o].sprite = RAY_FRAME_ZOT_EP1; }
|
||||||
}
|
}
|
||||||
else if (levelcontrol.episode==2)
|
else if (episode==2)
|
||||||
{
|
{
|
||||||
if (rand()&1)
|
if (rand()&1)
|
||||||
{ objects[o].sprite = RAY_FRAME_ZAP_EP2; }
|
{ objects[o].sprite = RAY_FRAME_ZAP_EP2; }
|
||||||
|
|||||||
@@ -19,9 +19,7 @@
|
|||||||
#define STONE_DROP_RATE 100
|
#define STONE_DROP_RATE 100
|
||||||
|
|
||||||
void delete_object(int o);
|
void delete_object(int o);
|
||||||
|
|
||||||
void static rope_movestone(int o);
|
void static rope_movestone(int o);
|
||||||
|
|
||||||
void kill_all_intersecting_tile(int mpx, int mpy);
|
void kill_all_intersecting_tile(int mpx, int mpy);
|
||||||
|
|
||||||
void rope_ai(int o)
|
void rope_ai(int o)
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
#include "../sdl/sound/CSound.h"
|
|
||||||
#include "../keen.h"
|
#include "../keen.h"
|
||||||
|
|
||||||
#include "ray.h"
|
#include "ray.h"
|
||||||
#include "se.h"
|
#include "se.h"
|
||||||
#include "../include/game.h"
|
|
||||||
|
|
||||||
|
#include "../include/game.h"
|
||||||
#include "../include/enemyai.h"
|
#include "../include/enemyai.h"
|
||||||
|
|
||||||
|
#include "../sdl/sound/CSound.h"
|
||||||
#include "../CLogFile.h"
|
#include "../CLogFile.h"
|
||||||
|
|
||||||
char PlatExtending=0;
|
char PlatExtending=0;
|
||||||
@@ -21,20 +23,20 @@ char PlatExtending=0;
|
|||||||
void set_mortimer_surprised(int yes);
|
void set_mortimer_surprised(int yes);
|
||||||
int mortimer_surprisedcount = 0;
|
int mortimer_surprisedcount = 0;
|
||||||
|
|
||||||
void se_ai(int o, stCloneKeenPlus *pCKP)
|
void se_ai(int o, stLevelControl *p_levelcontrol)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch(objects[o].ai.se.type)
|
switch(objects[o].ai.se.type)
|
||||||
{
|
{
|
||||||
case SE_EXTEND_PLATFORM: se_extend_plat(o, &(pCKP->Control.levelcontrol.PlatExtending) ); break;
|
case SE_EXTEND_PLATFORM: se_extend_plat(o, &(p_levelcontrol->PlatExtending) ); break;
|
||||||
case SE_RETRACT_PLATFORM: se_retract_plat(o, &(pCKP->Control.levelcontrol.PlatExtending) ); break;
|
case SE_RETRACT_PLATFORM: se_retract_plat(o, &(p_levelcontrol->PlatExtending) ); break;
|
||||||
case SE_ANKHSHIELD: se_ankhshield(o, pCKP->Control.levelcontrol.episode); break;
|
case SE_ANKHSHIELD: se_ankhshield(o, p_levelcontrol->episode); break;
|
||||||
case SE_MORTIMER_ARM: se_mortimer_arm(o); break;
|
case SE_MORTIMER_ARM: se_mortimer_arm(o); break;
|
||||||
case SE_MORTIMER_LEG_LEFT: se_mortimer_leg_left(o); break;
|
case SE_MORTIMER_LEG_LEFT: se_mortimer_leg_left(o); break;
|
||||||
case SE_MORTIMER_LEG_RIGHT: se_mortimer_leg_right(o); break;
|
case SE_MORTIMER_LEG_RIGHT: se_mortimer_leg_right(o); break;
|
||||||
case SE_MORTIMER_SPARK: se_mortimer_spark(o, &(pCKP->Control.levelcontrol) ); break;
|
case SE_MORTIMER_SPARK: se_mortimer_spark(o, p_levelcontrol ); break;
|
||||||
case SE_MORTIMER_HEART: se_mortimer_heart(o, &(pCKP->Control.levelcontrol) ); break;
|
case SE_MORTIMER_HEART: se_mortimer_heart(o, p_levelcontrol ); break;
|
||||||
case SE_MORTIMER_ZAPSUP: se_mortimer_zapsup(o, &(pCKP->Control.levelcontrol) ); break;
|
case SE_MORTIMER_ZAPSUP: se_mortimer_zapsup(o, p_levelcontrol ); break;
|
||||||
case SE_MORTIMER_RANDOMZAPS: se_mortimer_randomzaps(o); break;
|
case SE_MORTIMER_RANDOMZAPS: se_mortimer_randomzaps(o); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
17
src/ai/se.h
17
src/ai/se.h
@@ -8,9 +8,9 @@
|
|||||||
#ifndef SE_H_
|
#ifndef SE_H_
|
||||||
#define SE_H_
|
#define SE_H_
|
||||||
|
|
||||||
/* located in game.c */
|
void se_extend_plat(int o, bool *p_PlatExtending);
|
||||||
|
|
||||||
//----------------------[referenced from ai/se.c]--------------------//
|
/* located in game.c */
|
||||||
void kill_all_intersecting_tile(int mpx, int mpy);
|
void kill_all_intersecting_tile(int mpx, int mpy);
|
||||||
void delete_object(int o);
|
void delete_object(int o);
|
||||||
void killplayer(int theplayer);
|
void killplayer(int theplayer);
|
||||||
@@ -19,30 +19,23 @@ unsigned char spawn_object(int x, int y, int otype);
|
|||||||
|
|
||||||
/* located in map.c */
|
/* located in map.c */
|
||||||
|
|
||||||
//----------------------[referenced from ai/se.c]--------------------//
|
//----------------------[referenced from ai/se.cpp]--------------------//
|
||||||
unsigned int getmaptileat(unsigned int x, unsigned int y);
|
unsigned int getmaptileat(unsigned int x, unsigned int y);
|
||||||
void map_chgtile(unsigned int x,unsigned int y, int newtile);
|
void map_chgtile(unsigned int x,unsigned int y, int newtile);
|
||||||
void map_deanimate(int x, int y);
|
void map_deanimate(int x, int y);
|
||||||
|
|
||||||
//----------------------[referenced from ai/se.c]--------------------//
|
|
||||||
//void fade(uchar type, uchar rate);
|
|
||||||
|
|
||||||
|
|
||||||
/* located in misc.c */
|
/* located in misc.c */
|
||||||
|
unsigned int rnd(void);
|
||||||
//----------------------[referenced from ai/se.c]--------------------//
|
|
||||||
uint rnd(void);
|
|
||||||
|
|
||||||
/* located in cinematics/blowupworld.c */
|
/* located in cinematics/blowupworld.c */
|
||||||
|
|
||||||
//----------------------[referenced from ai/se.c]--------------------//
|
|
||||||
void SetVibrateTime(int vibetime, char pausegame, stLevelControl *levelcontrol);
|
void SetVibrateTime(int vibetime, char pausegame, stLevelControl *levelcontrol);
|
||||||
|
|
||||||
|
|
||||||
/* located in ai/se.c */
|
|
||||||
|
|
||||||
//----------------------[referenced from ai/se.c]--------------------//
|
//----------------------[referenced from ai/se.c]--------------------//
|
||||||
void se_ai(int o);
|
void se_ai(int o, stLevelControl *p_levelcontrol);
|
||||||
void se_extend_plat(int o, bool *p_PlatExtending);
|
void se_extend_plat(int o, bool *p_PlatExtending);
|
||||||
void se_retract_plat(int o, bool *p_PlatExtending);
|
void se_retract_plat(int o, bool *p_PlatExtending);
|
||||||
void spark_ai(int o, int *p_sparks_left);
|
void spark_ai(int o, int *p_sparks_left);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#define SNDWAVE_OFFSCREEN_KILL_TIME 100
|
#define SNDWAVE_OFFSCREEN_KILL_TIME 100
|
||||||
|
|
||||||
void sndwave_ai(int o, stCloneKeenPlus *pCKP)
|
void sndwave_ai(int o, bool hardmode)
|
||||||
{
|
{
|
||||||
//int i;
|
//int i;
|
||||||
if (objects[o].needinit)
|
if (objects[o].needinit)
|
||||||
@@ -57,7 +57,7 @@ void sndwave_ai(int o, stCloneKeenPlus *pCKP)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pCKP->Control.levelcontrol.hardmode)
|
if (hardmode)
|
||||||
objects[o].x += SNDWAVE_SPEED_FAST;
|
objects[o].x += SNDWAVE_SPEED_FAST;
|
||||||
else
|
else
|
||||||
objects[o].x += SNDWAVE_SPEED;
|
objects[o].x += SNDWAVE_SPEED;
|
||||||
@@ -72,7 +72,7 @@ void sndwave_ai(int o, stCloneKeenPlus *pCKP)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pCKP->Control.levelcontrol.hardmode)
|
if (hardmode)
|
||||||
objects[o].x -= SNDWAVE_SPEED_FAST;
|
objects[o].x -= SNDWAVE_SPEED_FAST;
|
||||||
else
|
else
|
||||||
objects[o].x -= SNDWAVE_SPEED;
|
objects[o].x -= SNDWAVE_SPEED;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#define TANK2_TIME_BEFORE_FIRE_WHEN_SEE 100
|
#define TANK2_TIME_BEFORE_FIRE_WHEN_SEE 100
|
||||||
#define TANK2_TIME_BETWEEN_FIRE_CAUSE_LEVEL 400
|
#define TANK2_TIME_BETWEEN_FIRE_CAUSE_LEVEL 400
|
||||||
|
|
||||||
void tankep2_ai(int o, stCloneKeenPlus *pCKP)
|
void tankep2_ai(int o, bool hardmode)
|
||||||
{
|
{
|
||||||
int newobject;
|
int newobject;
|
||||||
//int not_about_to_fall;
|
//int not_about_to_fall;
|
||||||
@@ -141,7 +141,7 @@ unsigned int i;
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no we're not facing him, on hard difficulty turn around
|
// no we're not facing him, on hard difficulty turn around
|
||||||
if (pCKP->Control.levelcontrol.hardmode)
|
if (hardmode)
|
||||||
{
|
{
|
||||||
objects[o].ai.tank.frame = 0;
|
objects[o].ai.tank.frame = 0;
|
||||||
objects[o].ai.tank.timer = 0;
|
objects[o].ai.tank.timer = 0;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
void vort_initiatejump(int o);
|
void vort_initiatejump(int o);
|
||||||
|
|
||||||
void vort_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol)
|
void vort_ai(int o, stLevelControl *p_levelcontrol)
|
||||||
{
|
{
|
||||||
int bonk,kill;
|
int bonk,kill;
|
||||||
if (objects[o].needinit)
|
if (objects[o].needinit)
|
||||||
@@ -44,14 +44,14 @@ int bonk,kill;
|
|||||||
objects[o].canbezapped = 1;
|
objects[o].canbezapped = 1;
|
||||||
objects[o].needinit = 0;
|
objects[o].needinit = 0;
|
||||||
|
|
||||||
if (pCKP->Control.levelcontrol.hardmode)
|
if (p_levelcontrol->hardmode)
|
||||||
{
|
{
|
||||||
objects[o].ai.vort.ep1style = 1;
|
objects[o].ai.vort.ep1style = 1;
|
||||||
}
|
}
|
||||||
else objects[o].ai.vort.ep1style = 0;
|
else objects[o].ai.vort.ep1style = 0;
|
||||||
|
|
||||||
// copy in animation frame indexes for the current ep
|
// copy in animation frame indexes for the current ep
|
||||||
if (levelcontrol.episode==1)
|
if (p_levelcontrol->episode==1)
|
||||||
{
|
{
|
||||||
objects[o].ai.vort.WalkLeftFrame = VORT1_WALK_LEFT_FRAME;
|
objects[o].ai.vort.WalkLeftFrame = VORT1_WALK_LEFT_FRAME;
|
||||||
objects[o].ai.vort.WalkRightFrame = VORT1_WALK_RIGHT_FRAME;
|
objects[o].ai.vort.WalkRightFrame = VORT1_WALK_RIGHT_FRAME;
|
||||||
@@ -61,7 +61,7 @@ int bonk,kill;
|
|||||||
objects[o].ai.vort.DyingFrame = VORT1_DYING_FRAME;
|
objects[o].ai.vort.DyingFrame = VORT1_DYING_FRAME;
|
||||||
objects[o].ai.vort.ep1style = 1;
|
objects[o].ai.vort.ep1style = 1;
|
||||||
}
|
}
|
||||||
else if (levelcontrol.episode==2)
|
else if (p_levelcontrol->episode==2)
|
||||||
{
|
{
|
||||||
objects[o].ai.vort.WalkLeftFrame = VORT2_WALK_LEFT_FRAME;
|
objects[o].ai.vort.WalkLeftFrame = VORT2_WALK_LEFT_FRAME;
|
||||||
objects[o].ai.vort.WalkRightFrame = VORT2_WALK_RIGHT_FRAME;
|
objects[o].ai.vort.WalkRightFrame = VORT2_WALK_RIGHT_FRAME;
|
||||||
@@ -71,7 +71,7 @@ int bonk,kill;
|
|||||||
objects[o].ai.vort.DyingFrame = VORT2_DYING_FRAME;
|
objects[o].ai.vort.DyingFrame = VORT2_DYING_FRAME;
|
||||||
objects[o].ai.vort.DeadFrame = VORT2_DEAD_FRAME;
|
objects[o].ai.vort.DeadFrame = VORT2_DEAD_FRAME;
|
||||||
}
|
}
|
||||||
else if (levelcontrol.episode==3)
|
else if (p_levelcontrol->episode==3)
|
||||||
{
|
{
|
||||||
objects[o].ai.vort.WalkLeftFrame = VORT3_WALK_LEFT_FRAME;
|
objects[o].ai.vort.WalkLeftFrame = VORT3_WALK_LEFT_FRAME;
|
||||||
objects[o].ai.vort.WalkRightFrame = VORT3_WALK_RIGHT_FRAME;
|
objects[o].ai.vort.WalkRightFrame = VORT3_WALK_RIGHT_FRAME;
|
||||||
@@ -89,10 +89,10 @@ int bonk,kill;
|
|||||||
kill = 0;
|
kill = 0;
|
||||||
// if we touch a glowcell, we die!
|
// if we touch a glowcell, we die!
|
||||||
|
|
||||||
if (objects[o].zapped >= VORT_HP && !levelcontrol.isfinallevel) kill = 1;
|
if (objects[o].zapped >= VORT_HP && !p_levelcontrol->isfinallevel) kill = 1;
|
||||||
else if (objects[o].zapped >= VORT_COMMANDER_HP && levelcontrol.isfinallevel) kill = 1;
|
else if (objects[o].zapped >= VORT_COMMANDER_HP && p_levelcontrol->isfinallevel) kill = 1;
|
||||||
else if (objects[o].zapped && !objects[o].ai.vort.ep1style) kill = 1;
|
else if (objects[o].zapped && !objects[o].ai.vort.ep1style) kill = 1;
|
||||||
else if (levelcontrol.episode==2 && getmaptileat((objects[o].x>>CSF)+12, (objects[o].y>>CSF)+16)==TILE_GLOWCELL)
|
else if (p_levelcontrol->episode==2 && getmaptileat((objects[o].x>>CSF)+12, (objects[o].y>>CSF)+16)==TILE_GLOWCELL)
|
||||||
{
|
{
|
||||||
kill = 1;
|
kill = 1;
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ int bonk,kill;
|
|||||||
objects[o].ai.vort.frame = 0;
|
objects[o].ai.vort.frame = 0;
|
||||||
objects[o].ai.vort.palflashtimer = VORT_PALETTE_FLASH_TIME + 1;
|
objects[o].ai.vort.palflashtimer = VORT_PALETTE_FLASH_TIME + 1;
|
||||||
objects[o].ai.vort.palflashamt = 255;
|
objects[o].ai.vort.palflashamt = 255;
|
||||||
if (levelcontrol.episode == 1)
|
if (p_levelcontrol->episode == 1)
|
||||||
{
|
{
|
||||||
objects[o].ai.vort.state = VORT_DYING;
|
objects[o].ai.vort.state = VORT_DYING;
|
||||||
//pal_set(BORDER_COLOR, 255, objects[o].ai.vort.palflashamt, objects[o].ai.vort.palflashamt);
|
//pal_set(BORDER_COLOR, 255, objects[o].ai.vort.palflashamt, objects[o].ai.vort.palflashamt);
|
||||||
@@ -118,7 +118,7 @@ int bonk,kill;
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
objects[o].ai.vort.state = VORT2_DYING;
|
objects[o].ai.vort.state = VORT2_DYING;
|
||||||
if (pCKP->Control.levelcontrol.hardmode)
|
if (p_levelcontrol->hardmode)
|
||||||
{
|
{
|
||||||
fade.mode = FADE_GO;
|
fade.mode = FADE_GO;
|
||||||
fade.dir = FADE_IN;
|
fade.dir = FADE_IN;
|
||||||
@@ -214,7 +214,7 @@ vort_reprocess: ;
|
|||||||
|
|
||||||
if (rand()%VORT_JUMP_PROB == (VORT_JUMP_PROB/2))
|
if (rand()%VORT_JUMP_PROB == (VORT_JUMP_PROB/2))
|
||||||
{ // let's jump.
|
{ // let's jump.
|
||||||
if (!levelcontrol.dark && !objects[o].blockedu)
|
if (!p_levelcontrol->dark && !objects[o].blockedu)
|
||||||
{
|
{
|
||||||
vort_initiatejump(o);
|
vort_initiatejump(o);
|
||||||
goto vort_reprocess;
|
goto vort_reprocess;
|
||||||
@@ -237,7 +237,7 @@ vort_reprocess: ;
|
|||||||
// if we only traveled a tiny amount before hitting a wall, we've
|
// if we only traveled a tiny amount before hitting a wall, we've
|
||||||
// probably fallen into a small narrow area, and we need to try
|
// probably fallen into a small narrow area, and we need to try
|
||||||
// to jump out of it
|
// to jump out of it
|
||||||
if (objects[o].ai.vort.dist_traveled < VORT_TRAPPED_DIST && !levelcontrol.dark && objects[o].blockedd && !objects[o].blockedu)
|
if (objects[o].ai.vort.dist_traveled < VORT_TRAPPED_DIST && !p_levelcontrol->dark && objects[o].blockedd && !objects[o].blockedu)
|
||||||
{
|
{
|
||||||
vort_initiatejump(o);
|
vort_initiatejump(o);
|
||||||
if (rand()&1)
|
if (rand()&1)
|
||||||
@@ -267,7 +267,7 @@ vort_reprocess: ;
|
|||||||
objects[o].ai.vort.animtimer = 0;
|
objects[o].ai.vort.animtimer = 0;
|
||||||
objects[o].ai.vort.state = VORT_LOOK;
|
objects[o].ai.vort.state = VORT_LOOK;
|
||||||
|
|
||||||
if (objects[o].ai.vort.dist_traveled < VORT_TRAPPED_DIST && !levelcontrol.dark && objects[o].blockedd && !objects[o].blockedu)
|
if (objects[o].ai.vort.dist_traveled < VORT_TRAPPED_DIST && !p_levelcontrol->dark && objects[o].blockedd && !objects[o].blockedu)
|
||||||
{
|
{
|
||||||
vort_initiatejump(o);
|
vort_initiatejump(o);
|
||||||
if (rand()&1)
|
if (rand()&1)
|
||||||
@@ -294,15 +294,15 @@ vort_reprocess: ;
|
|||||||
case VORT_DYING:
|
case VORT_DYING:
|
||||||
objects[o].sprite = objects[o].ai.vort.DyingFrame + objects[o].ai.vort.frame;
|
objects[o].sprite = objects[o].ai.vort.DyingFrame + objects[o].ai.vort.frame;
|
||||||
|
|
||||||
if (levelcontrol.isfinallevel&&levelcontrol.episode==1)
|
if (p_levelcontrol->isfinallevel && p_levelcontrol->episode==1)
|
||||||
{
|
{
|
||||||
pCKP->Control.levelcontrol.canexit = 1;
|
p_levelcontrol->canexit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objects[o].ai.vort.animtimer > VORT_DIE_ANIM_TIME)
|
if (objects[o].ai.vort.animtimer > VORT_DIE_ANIM_TIME)
|
||||||
{
|
{
|
||||||
objects[o].ai.vort.palflashamt -= PAL_FLASH_DEC_AMT;
|
objects[o].ai.vort.palflashamt -= PAL_FLASH_DEC_AMT;
|
||||||
if (levelcontrol.episode!=2)
|
if (p_levelcontrol->episode != 2)
|
||||||
{
|
{
|
||||||
// pal_set(BORDER_COLOR, 212, objects[o].ai.vort.palflashamt, objects[o].ai.vort.palflashamt);
|
// pal_set(BORDER_COLOR, 212, objects[o].ai.vort.palflashamt, objects[o].ai.vort.palflashamt);
|
||||||
// pal_apply();
|
// pal_apply();
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ void walker_ai(int o, stLevelControl levelcontrol)
|
|||||||
{
|
{
|
||||||
unsigned int p;
|
unsigned int p;
|
||||||
unsigned int i=0;
|
unsigned int i=0;
|
||||||
//int supportingsomebody;
|
|
||||||
int nopush;
|
int nopush;
|
||||||
int /*til,*/floor;
|
int /*til,*/floor;
|
||||||
|
|
||||||
@@ -263,10 +262,8 @@ int /*til,*/floor;
|
|||||||
// of the walker a bit)
|
// of the walker a bit)
|
||||||
floor = 0;
|
floor = 0;
|
||||||
if (!TileProperty[getmaptileat((player[i].x>>CSF)+4, (player[i].y>>CSF)+sprites[0].ysize)][BUP])
|
if (!TileProperty[getmaptileat((player[i].x>>CSF)+4, (player[i].y>>CSF)+sprites[0].ysize)][BUP])
|
||||||
//if (!tiles[getmaptileat((player[i].x>>CSF)+4, (player[i].y>>CSF)+sprites[0].ysize)].solidfall)
|
|
||||||
{ // lower-left isn't solid
|
{ // lower-left isn't solid
|
||||||
if (TileProperty[getmaptileat((player[i].x>>CSF)+12, (player[i].y>>CSF)+sprites[0].ysize)][BUP])
|
if (TileProperty[getmaptileat((player[i].x>>CSF)+12, (player[i].y>>CSF)+sprites[0].ysize)][BUP])
|
||||||
//if (tiles[getmaptileat((player[i].x>>CSF)+12, (player[i].y>>CSF)+sprites[0].ysize)].solidfall)
|
|
||||||
{
|
{
|
||||||
floor = 1;
|
floor = 1;
|
||||||
}
|
}
|
||||||
@@ -324,7 +321,6 @@ int /*til,*/floor;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*anim: ;*/
|
|
||||||
|
|
||||||
// walk animation
|
// walk animation
|
||||||
if (objects[o].ai.walker.animtimer > WALKER_WALK_ANIM_TIME)
|
if (objects[o].ai.walker.animtimer > WALKER_WALK_ANIM_TIME)
|
||||||
|
|||||||
146
src/cinematics/CommonEnding.cpp
Normal file
146
src/cinematics/CommonEnding.cpp
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
/*
|
||||||
|
* commonending.cpp
|
||||||
|
*
|
||||||
|
* Created on: 07.08.2009
|
||||||
|
* Author: gerstrong
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../keen.h"
|
||||||
|
#include "CommonEnding.h"
|
||||||
|
|
||||||
|
#include "../CGraphics.h"
|
||||||
|
#include "../sdl/CInput.h"
|
||||||
|
#include "../sdl/CTimer.h"
|
||||||
|
|
||||||
|
#define LETTER_SHOW_SPD 30
|
||||||
|
|
||||||
|
#define HEADFOREARTH_WAIT_TIME 600
|
||||||
|
|
||||||
|
|
||||||
|
int endsequence(stCloneKeenPlus *pCKP)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (pCKP->Control.levelcontrol.episode==1)
|
||||||
|
{
|
||||||
|
if (eseq1_ReturnsToShip(pCKP)) return 0;
|
||||||
|
if (eseq1_ShipFlys(pCKP)) return 0;
|
||||||
|
eseq1_BackAtHome(pCKP);
|
||||||
|
}
|
||||||
|
else if (pCKP->Control.levelcontrol.episode==2)
|
||||||
|
{
|
||||||
|
if (eseq2_HeadsForEarth(pCKP)) return 0;
|
||||||
|
if (eseq2_LimpsHome(pCKP)) return 0;
|
||||||
|
if (eseq2_SnowedOutside(pCKP)) return 0;
|
||||||
|
}
|
||||||
|
else if (pCKP->Control.levelcontrol.episode==3)
|
||||||
|
{
|
||||||
|
if (eseq3_AwardBigV(pCKP)) return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Just show a message like type writing. Maybe this one will be replaced by the new Dialog system
|
||||||
|
void eseq_showmsg(const std::string& text, int boxleft, int boxtop,
|
||||||
|
int boxwidth, int boxheight, bool autodismiss)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string tempbuf;
|
||||||
|
char textline, showtimer;
|
||||||
|
unsigned int amountshown;
|
||||||
|
int waittimer;
|
||||||
|
int cancel, lastcancelstate;
|
||||||
|
|
||||||
|
textline = 0;
|
||||||
|
amountshown = 0;
|
||||||
|
showtimer = 0;
|
||||||
|
lastcancelstate = 1;
|
||||||
|
waittimer = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
gamedo_fades();
|
||||||
|
gamedo_AnimatedTiles();
|
||||||
|
gamedo_render_drawobjects();
|
||||||
|
|
||||||
|
cancel = (g_pInput->getPressedCommand(KENTER) || g_pInput->getPressedCommand(KCTRL) || g_pInput->getPressedCommand(KALT));
|
||||||
|
|
||||||
|
// draw the text up to the amount currently shown
|
||||||
|
tempbuf = text;
|
||||||
|
if(amountshown < tempbuf.size())
|
||||||
|
tempbuf.erase(amountshown);
|
||||||
|
sb_dialogbox(boxleft,boxtop,boxwidth,boxheight);
|
||||||
|
g_pGraphics->sb_font_draw( tempbuf, (boxleft+1)*8, (boxtop+1+textline)*8);
|
||||||
|
|
||||||
|
gamedo_frameskipping_blitonly();
|
||||||
|
gamedo_render_eraseobjects();
|
||||||
|
|
||||||
|
if (showtimer > LETTER_SHOW_SPD)
|
||||||
|
{ // it's time to show a new letter
|
||||||
|
if (amountshown < text.size())
|
||||||
|
{
|
||||||
|
amountshown++;
|
||||||
|
}
|
||||||
|
showtimer = 0;
|
||||||
|
} else showtimer++;
|
||||||
|
|
||||||
|
// user pressed enter or some other key
|
||||||
|
if (cancel && !lastcancelstate)
|
||||||
|
{
|
||||||
|
if (amountshown < text.size())
|
||||||
|
{
|
||||||
|
amountshown = text.size();
|
||||||
|
}
|
||||||
|
else return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// when all text is shown wait a sec then return
|
||||||
|
if (autodismiss)
|
||||||
|
{
|
||||||
|
if (amountshown >= text.size())
|
||||||
|
{
|
||||||
|
if (waittimer > HEADFOREARTH_WAIT_TIME) return;
|
||||||
|
waittimer++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
lastcancelstate = cancel;
|
||||||
|
|
||||||
|
g_pInput->pollEvents();
|
||||||
|
g_pTimer->SpeedThrottle();
|
||||||
|
} while(!g_pInput->getPressedCommand(KQUIT));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void eseq_ToBeContinued()
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
std::string text;
|
||||||
|
int dlgX, dlgY, dlgW, dlgH;
|
||||||
|
|
||||||
|
// remove all objects because eseq_showmsg will call drawobjects
|
||||||
|
for(i=0;i<MAX_OBJECTS;i++)
|
||||||
|
objects[i].exists = 0;
|
||||||
|
|
||||||
|
text = getstring("TO_BE_CONTINUED");
|
||||||
|
dlgX = GetStringAttribute("TO_BE_CONTINUED", "LEFT");
|
||||||
|
dlgY = GetStringAttribute("TO_BE_CONTINUED", "TOP");
|
||||||
|
dlgW = GetStringAttribute("TO_BE_CONTINUED", "WIDTH");
|
||||||
|
dlgH = GetStringAttribute("TO_BE_CONTINUED", "HEIGHT");
|
||||||
|
eseq_showmsg(text, dlgX, dlgY, dlgW, dlgH, 0);
|
||||||
|
|
||||||
|
fade.dir = FADE_OUT;
|
||||||
|
fade.curamt = PAL_FADE_SHADES;
|
||||||
|
fade.fadetimer = 0;
|
||||||
|
fade.rate = FADE_NORM;
|
||||||
|
fade.mode = FADE_GO;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
gamedo_fades();
|
||||||
|
if (g_pInput->getPressedKey(KQUIT)) return;
|
||||||
|
g_pInput->pollEvents();
|
||||||
|
g_pTimer->SpeedThrottle();
|
||||||
|
} while(fade.mode == FADE_GO);
|
||||||
|
}
|
||||||
|
|
||||||
28
src/cinematics/CommonEnding.h
Normal file
28
src/cinematics/CommonEnding.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* commonending.h
|
||||||
|
*
|
||||||
|
* Created on: 07.08.2009
|
||||||
|
* Author: gerstrong
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COMMONENDING_H_
|
||||||
|
#define COMMONENDING_H_
|
||||||
|
|
||||||
|
// For Episode 1
|
||||||
|
int eseq1_ShipFlys(stCloneKeenPlus *pCKP);
|
||||||
|
int eseq1_ReturnsToShip(stCloneKeenPlus *pCKP);
|
||||||
|
int eseq1_BackAtHome(stCloneKeenPlus *pCKP);
|
||||||
|
|
||||||
|
// For Episode 2
|
||||||
|
int eseq2_HeadsForEarth(stCloneKeenPlus *pCKP);
|
||||||
|
int eseq2_LimpsHome(stCloneKeenPlus *pCKP);
|
||||||
|
int eseq2_SnowedOutside(stCloneKeenPlus *pCKP);
|
||||||
|
|
||||||
|
// For Episode 3
|
||||||
|
char eseq3_AwardBigV(stCloneKeenPlus *pCKP);
|
||||||
|
|
||||||
|
// Reference to ../gamedo.cpp
|
||||||
|
void gamedo_render_drawobjects();
|
||||||
|
void gamedo_frameskipping_blitonly();
|
||||||
|
|
||||||
|
#endif /* COMMONENDING_H_ */
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
Ending sequence for Episode 1.
|
Ending sequence for Episode 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "keen.h"
|
#include "../keen.h"
|
||||||
#include "include/game.h"
|
#include "../include/game.h"
|
||||||
#include "include/gamedo.h"
|
#include "../include/gamedo.h"
|
||||||
#include "include/gamepdo.h"
|
#include "../include/gamepdo.h"
|
||||||
#include "sdl/CInput.h"
|
#include "../sdl/CInput.h"
|
||||||
#include "sdl/CTimer.h"
|
#include "../sdl/CTimer.h"
|
||||||
#include "include/eseq_ep1.h"
|
#include "../include/menu.h"
|
||||||
#include "include/eseq_ep2.h"
|
#include "../CGraphics.h"
|
||||||
#include "include/menu.h"
|
#include "../StringUtils.h"
|
||||||
#include "CGraphics.h"
|
|
||||||
#include "StringUtils.h"
|
#include "EndingSequenceEp1.h"
|
||||||
|
|
||||||
#define CMD_MOVE 0
|
#define CMD_MOVE 0
|
||||||
#define CMD_WAIT 1
|
#define CMD_WAIT 1
|
||||||
@@ -43,6 +43,9 @@
|
|||||||
|
|
||||||
#define BACKHOME_SHORT_WAIT_TIME 250
|
#define BACKHOME_SHORT_WAIT_TIME 250
|
||||||
|
|
||||||
|
#define MARK_SPR_NUM 2
|
||||||
|
|
||||||
|
|
||||||
int eseq1_ReturnsToShip(stCloneKeenPlus *pCKP)
|
int eseq1_ReturnsToShip(stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -50,7 +53,7 @@ int i;
|
|||||||
for(i=0;i<MAX_LEVELS;i++)
|
for(i=0;i<MAX_LEVELS;i++)
|
||||||
pCKP->Control.levelcontrol.levels_completed[i] = 0;
|
pCKP->Control.levelcontrol.levels_completed[i] = 0;
|
||||||
|
|
||||||
showmapatpos(80, WM_X, WM_Y, 0, pCKP);
|
showmapatpos(80, WM_X, WM_Y, pCKP);
|
||||||
|
|
||||||
// draw keen next to his ship
|
// draw keen next to his ship
|
||||||
g_pGraphics->drawSprite(168, 85, PMAPLEFTFRAME, 0);
|
g_pGraphics->drawSprite(168, 85, PMAPLEFTFRAME, 0);
|
||||||
@@ -68,7 +71,7 @@ int i;
|
|||||||
fade.fadetimer = 0;
|
fade.fadetimer = 0;
|
||||||
fade.rate = FADE_NORM;
|
fade.rate = FADE_NORM;
|
||||||
|
|
||||||
eseq_showmsg(getstring("EP1_ESEQ_PART1"),1,18,37,6,1, pCKP);
|
eseq_showmsg(getstring("EP1_ESEQ_PART1"),1,18,37,6,1);
|
||||||
|
|
||||||
// fade out
|
// fade out
|
||||||
fade.mode = FADE_GO;
|
fade.mode = FADE_GO;
|
||||||
@@ -104,9 +107,7 @@ int x, y;
|
|||||||
int scrollingon;
|
int scrollingon;
|
||||||
|
|
||||||
scrollingon = 1;
|
scrollingon = 1;
|
||||||
|
initgame( &(pCKP->Control.levelcontrol) );
|
||||||
#define MARK_SPR_NUM 2
|
|
||||||
initgame(pCKP);
|
|
||||||
|
|
||||||
// set up the ship's route
|
// set up the ship's route
|
||||||
ShipQueuePtr = 0;
|
ShipQueuePtr = 0;
|
||||||
@@ -135,7 +136,7 @@ int scrollingon;
|
|||||||
addshipqueue(CMD_MOVE, 100, DDOWN);
|
addshipqueue(CMD_MOVE, 100, DDOWN);
|
||||||
addshipqueue(CMD_ENDOFQUEUE, 0, 0);
|
addshipqueue(CMD_ENDOFQUEUE, 0, 0);
|
||||||
|
|
||||||
showmapatpos(81, SHIPFLY_X, SHIPFLY_Y, 0, pCKP);
|
showmapatpos(81, SHIPFLY_X, SHIPFLY_Y, pCKP);
|
||||||
|
|
||||||
objects[MARK_SPR_NUM].type = OBJ_YORP; // doesn't matter
|
objects[MARK_SPR_NUM].type = OBJ_YORP; // doesn't matter
|
||||||
objects[MARK_SPR_NUM].exists = 0;
|
objects[MARK_SPR_NUM].exists = 0;
|
||||||
@@ -268,7 +269,7 @@ int scrollingon;
|
|||||||
gamedo_fades();
|
gamedo_fades();
|
||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
|
|
||||||
gamedo_frameskipping(pCKP);
|
gamedo_frameskipping();
|
||||||
if (scrollingon) gamedo_ScrollTriggers(0);
|
if (scrollingon) gamedo_ScrollTriggers(0);
|
||||||
|
|
||||||
g_pInput->pollEvents();
|
g_pInput->pollEvents();
|
||||||
@@ -408,37 +409,6 @@ int dlgX, dlgY, dlgW, dlgH;
|
|||||||
} while(1);
|
} while(1);
|
||||||
|
|
||||||
finale_draw("finale.ck1", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
finale_draw("finale.ck1", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
||||||
eseq_ToBeContinued(pCKP);
|
eseq_ToBeContinued();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void eseq_ToBeContinued(stCloneKeenPlus *pCKP)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
std::string text;
|
|
||||||
int dlgX, dlgY, dlgW, dlgH;
|
|
||||||
|
|
||||||
// remove all objects because eseq_showmsg will call drawobjects
|
|
||||||
for(i=0;i<MAX_OBJECTS;i++)
|
|
||||||
objects[i].exists = 0;
|
|
||||||
|
|
||||||
text = getstring("TO_BE_CONTINUED");
|
|
||||||
dlgX = GetStringAttribute("TO_BE_CONTINUED", "LEFT");
|
|
||||||
dlgY = GetStringAttribute("TO_BE_CONTINUED", "TOP");
|
|
||||||
dlgW = GetStringAttribute("TO_BE_CONTINUED", "WIDTH");
|
|
||||||
dlgH = GetStringAttribute("TO_BE_CONTINUED", "HEIGHT");
|
|
||||||
eseq_showmsg(text, dlgX, dlgY, dlgW, dlgH, 0, pCKP);
|
|
||||||
|
|
||||||
fade.dir = FADE_OUT;
|
|
||||||
fade.curamt = PAL_FADE_SHADES;
|
|
||||||
fade.fadetimer = 0;
|
|
||||||
fade.rate = FADE_NORM;
|
|
||||||
fade.mode = FADE_GO;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
gamedo_fades();
|
|
||||||
if (g_pInput->getPressedKey(KQUIT)) return;
|
|
||||||
g_pInput->pollEvents();
|
|
||||||
g_pTimer->SpeedThrottle();
|
|
||||||
} while(fade.mode == FADE_GO);
|
|
||||||
}
|
|
||||||
16
src/cinematics/EndingSequenceEp1.h
Normal file
16
src/cinematics/EndingSequenceEp1.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* EndingSequenceEp1.h
|
||||||
|
*
|
||||||
|
* Created on: 08.08.2009
|
||||||
|
* Author: gerstrong
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ENDINGSEQUENCEEP1_H_
|
||||||
|
#define ENDINGSEQUENCEEP1_H_
|
||||||
|
|
||||||
|
void eseq_ToBeContinued();
|
||||||
|
void eseq_showmsg(const std::string& text, int boxleft, int boxtop,
|
||||||
|
int boxwidth, int boxheight, bool autodismiss);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ENDINGSEQUENCEEP1_H_ */
|
||||||
@@ -2,19 +2,19 @@
|
|||||||
Ending sequence for Episode 2.
|
Ending sequence for Episode 2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "keen.h"
|
#include "../keen.h"
|
||||||
#include "include/game.h"
|
/*#include "include/game.h"
|
||||||
#include "include/gamedo.h"
|
#include "include/gamedo.h"
|
||||||
#include "include/gamepdo.h"
|
#include "include/gamepdo.h"*/
|
||||||
#include "sdl/CTimer.h"
|
#include "../sdl/CTimer.h"
|
||||||
#include "sdl/CInput.h"
|
#include "../sdl/CInput.h"
|
||||||
#include "sdl/sound/CSound.h"
|
#include "../sdl/sound/CSound.h"
|
||||||
#include "include/eseq_ep2.h"
|
#include "../include/menu.h"
|
||||||
#include "include/eseq_ep1.h"
|
#include "../include/enemyai.h"
|
||||||
#include "include/menu.h"
|
#include "EndingSequenceEp2.h"
|
||||||
#include "include/enemyai.h"
|
#include "CommonEnding.h"
|
||||||
#include "CGraphics.h"
|
#include "../CGraphics.h"
|
||||||
#include "StringUtils.h"
|
#include "../StringUtils.h"
|
||||||
|
|
||||||
|
|
||||||
#define CMD_MOVE 0
|
#define CMD_MOVE 0
|
||||||
@@ -29,8 +29,6 @@
|
|||||||
stShipQueue shipqueue[32];
|
stShipQueue shipqueue[32];
|
||||||
int ShipQueuePtr;
|
int ShipQueuePtr;
|
||||||
|
|
||||||
#define LETTER_SHOW_SPD 30
|
|
||||||
|
|
||||||
// start x,y map scroll position for eseq2_TantalusRay()
|
// start x,y map scroll position for eseq2_TantalusRay()
|
||||||
#define TANTALUS_X 0
|
#define TANTALUS_X 0
|
||||||
#define TANTALUS_Y 0
|
#define TANTALUS_Y 0
|
||||||
@@ -76,10 +74,10 @@ int state, timer, spawnedcount=0;
|
|||||||
pCKP->Control.levelcontrol.dark = 0;
|
pCKP->Control.levelcontrol.dark = 0;
|
||||||
g_pGraphics->initPalette(pCKP->Control.levelcontrol.dark);
|
g_pGraphics->initPalette(pCKP->Control.levelcontrol.dark);
|
||||||
|
|
||||||
initgame(pCKP);
|
initgame( &(pCKP->Control.levelcontrol) );
|
||||||
state = TAN_STATE_WAITBEFOREFIRE;
|
state = TAN_STATE_WAITBEFOREFIRE;
|
||||||
|
|
||||||
showmapatpos(81,TANTALUS_X, TANTALUS_Y, 0, pCKP);
|
showmapatpos(81,TANTALUS_X, TANTALUS_Y, pCKP);
|
||||||
|
|
||||||
AllPlayersInvisible();
|
AllPlayersInvisible();
|
||||||
numplayers = 1;
|
numplayers = 1;
|
||||||
@@ -202,8 +200,8 @@ int state, timer, spawnedcount=0;
|
|||||||
case 32:
|
case 32:
|
||||||
state = TAN_STATE_GAMEOVER;
|
state = TAN_STATE_GAMEOVER;
|
||||||
g_pSound->playSound(SOUND_GAME_OVER, PLAY_NOW);
|
g_pSound->playSound(SOUND_GAME_OVER, PLAY_NOW);
|
||||||
SetGameOver(pCKP);
|
pCKP->Control.levelcontrol.gameovermode = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spawnedcount++;
|
spawnedcount++;
|
||||||
timer = 60;
|
timer = 60;
|
||||||
@@ -236,8 +234,8 @@ int state, timer, spawnedcount=0;
|
|||||||
gamedo_fades();
|
gamedo_fades();
|
||||||
if (state!=TAN_STATE_GAMEOVER) gamedo_AnimatedTiles();
|
if (state!=TAN_STATE_GAMEOVER) gamedo_AnimatedTiles();
|
||||||
|
|
||||||
gamedo_frameskipping(pCKP);
|
gamedo_frameskipping();
|
||||||
gamedo_enemyai(pCKP);
|
gamedo_enemyai( &(pCKP->Control.levelcontrol) );
|
||||||
|
|
||||||
if(((player[0].x>>CSF)-scroll_x) > 160-16) map_scroll_right();
|
if(((player[0].x>>CSF)-scroll_x) > 160-16) map_scroll_right();
|
||||||
if (((player[0].y>>CSF)-scroll_y) > 100)
|
if (((player[0].y>>CSF)-scroll_y) > 100)
|
||||||
@@ -251,7 +249,7 @@ int state, timer, spawnedcount=0;
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void eseq2_vibrate(stCloneKeenPlus *pCKP)
|
void eseq2_vibrate()
|
||||||
{
|
{
|
||||||
int xamt, yamt;
|
int xamt, yamt;
|
||||||
int xdir, ydir;
|
int xdir, ydir;
|
||||||
@@ -325,7 +323,7 @@ int x,y,w,h;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// show the frame
|
// show the frame
|
||||||
gamedo_frameskipping(pCKP);
|
gamedo_frameskipping();
|
||||||
vibratetimes++;
|
vibratetimes++;
|
||||||
|
|
||||||
g_pInput->pollEvents();
|
g_pInput->pollEvents();
|
||||||
@@ -338,15 +336,13 @@ int x,y,w,h;
|
|||||||
w = GetStringAttribute("EP2_AfterVibrateString", "WIDTH");
|
w = GetStringAttribute("EP2_AfterVibrateString", "WIDTH");
|
||||||
h = GetStringAttribute("EP2_AfterVibrateString", "HEIGHT");
|
h = GetStringAttribute("EP2_AfterVibrateString", "HEIGHT");
|
||||||
|
|
||||||
eseq_showmsg(getstring("EP2_AfterVibrateString"),x,y,w,h,1, pCKP);
|
eseq_showmsg(getstring("EP2_AfterVibrateString"),x,y,w,h,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define HEADFOREARTH_X 0
|
#define HEADFOREARTH_X 0
|
||||||
#define HEADFOREARTH_Y 0
|
#define HEADFOREARTH_Y 0
|
||||||
|
|
||||||
#define HEADFOREARTH_WAIT_TIME 600
|
|
||||||
|
|
||||||
#define SPR_SHIP_RIGHT_EP2 132
|
#define SPR_SHIP_RIGHT_EP2 132
|
||||||
#define SPR_SHIP_LEFT_EP2 133
|
#define SPR_SHIP_LEFT_EP2 133
|
||||||
#define SPR_VORTICON_MOTHERSHIP 72
|
#define SPR_VORTICON_MOTHERSHIP 72
|
||||||
@@ -356,79 +352,6 @@ int x,y,w,h;
|
|||||||
#define HEADSFOREARTH_W 33
|
#define HEADSFOREARTH_W 33
|
||||||
#define HEADSFOREARTH_H 8
|
#define HEADSFOREARTH_H 8
|
||||||
|
|
||||||
void eseq_showmsg(const std::string& text, int boxleft, int boxtop, int boxwidth, int boxheight, char autodismiss, stCloneKeenPlus *pCKP)
|
|
||||||
{
|
|
||||||
//int draw;
|
|
||||||
//int i;
|
|
||||||
|
|
||||||
std::string tempbuf;
|
|
||||||
char textline, showtimer;
|
|
||||||
unsigned int amountshown;
|
|
||||||
int waittimer;
|
|
||||||
int cancel, lastcancelstate;
|
|
||||||
|
|
||||||
textline = 0;
|
|
||||||
amountshown = 0;
|
|
||||||
showtimer = 0;
|
|
||||||
lastcancelstate = 1;
|
|
||||||
waittimer = 0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
gamedo_fades();
|
|
||||||
gamedo_AnimatedTiles();
|
|
||||||
gamedo_render_drawobjects(pCKP);
|
|
||||||
|
|
||||||
cancel = (g_pInput->getPressedCommand(KENTER) || g_pInput->getPressedCommand(KCTRL) || g_pInput->getPressedCommand(KALT));
|
|
||||||
|
|
||||||
// draw the text up to the amount currently shown
|
|
||||||
tempbuf = text;
|
|
||||||
if(amountshown < tempbuf.size())
|
|
||||||
tempbuf.erase(amountshown);
|
|
||||||
sb_dialogbox(boxleft,boxtop,boxwidth,boxheight);
|
|
||||||
g_pGraphics->sb_font_draw( tempbuf, (boxleft+1)*8, (boxtop+1+textline)*8);
|
|
||||||
|
|
||||||
gamedo_frameskipping_blitonly();
|
|
||||||
gamedo_render_eraseobjects();
|
|
||||||
|
|
||||||
if (showtimer > LETTER_SHOW_SPD)
|
|
||||||
{ // it's time to show a new letter
|
|
||||||
if (amountshown < text.size())
|
|
||||||
{
|
|
||||||
amountshown++;
|
|
||||||
}
|
|
||||||
showtimer = 0;
|
|
||||||
} else showtimer++;
|
|
||||||
|
|
||||||
// user pressed enter or some other key
|
|
||||||
if (cancel && !lastcancelstate)
|
|
||||||
{
|
|
||||||
if (amountshown < text.size())
|
|
||||||
{
|
|
||||||
amountshown = text.size();
|
|
||||||
}
|
|
||||||
else return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// when all text is shown wait a sec then return
|
|
||||||
if (autodismiss)
|
|
||||||
{
|
|
||||||
if (amountshown >= text.size())
|
|
||||||
{
|
|
||||||
if (waittimer > HEADFOREARTH_WAIT_TIME) return;
|
|
||||||
waittimer++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
lastcancelstate = cancel;
|
|
||||||
|
|
||||||
g_pInput->pollEvents();
|
|
||||||
g_pTimer->SpeedThrottle();
|
|
||||||
} while(!g_pInput->getPressedCommand(KQUIT));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int eseq2_HeadsForEarth(stCloneKeenPlus *pCKP)
|
int eseq2_HeadsForEarth(stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
char enter,lastenterstate;
|
char enter,lastenterstate;
|
||||||
@@ -436,7 +359,7 @@ int x, y;
|
|||||||
int downtimer;
|
int downtimer;
|
||||||
int afterfadewaittimer;
|
int afterfadewaittimer;
|
||||||
|
|
||||||
initgame(pCKP);
|
initgame( &(pCKP->Control.levelcontrol) );
|
||||||
|
|
||||||
// set up the ship's route
|
// set up the ship's route
|
||||||
ShipQueuePtr = 0;
|
ShipQueuePtr = 0;
|
||||||
@@ -444,7 +367,7 @@ int afterfadewaittimer;
|
|||||||
addshipqueue(CMD_MOVE, 2360, DDOWNRIGHT);
|
addshipqueue(CMD_MOVE, 2360, DDOWNRIGHT);
|
||||||
addshipqueue(CMD_FADEOUT, 0, 0);
|
addshipqueue(CMD_FADEOUT, 0, 0);
|
||||||
|
|
||||||
showmapatpos(81, HEADFOREARTH_X, HEADFOREARTH_Y, 0, pCKP);
|
showmapatpos(81, HEADFOREARTH_X, HEADFOREARTH_Y, pCKP);
|
||||||
|
|
||||||
numplayers = 1;
|
numplayers = 1;
|
||||||
// place the player near the vorticon mothership
|
// place the player near the vorticon mothership
|
||||||
@@ -470,7 +393,7 @@ int afterfadewaittimer;
|
|||||||
fade.dir = FADE_IN;
|
fade.dir = FADE_IN;
|
||||||
fade.curamt = 0;
|
fade.curamt = 0;
|
||||||
fade.fadetimer = 0;
|
fade.fadetimer = 0;
|
||||||
eseq_showmsg(getstring("EP2_ESEQ_PART1"),HEADSFOREARTH_X,HEADSFOREARTH_Y,HEADSFOREARTH_W,HEADSFOREARTH_H,1, pCKP);
|
eseq_showmsg(getstring("EP2_ESEQ_PART1"),HEADSFOREARTH_X,HEADSFOREARTH_Y,HEADSFOREARTH_W,HEADSFOREARTH_H, true);
|
||||||
|
|
||||||
// erase the message dialog
|
// erase the message dialog
|
||||||
map_redraw();
|
map_redraw();
|
||||||
@@ -550,7 +473,7 @@ int afterfadewaittimer;
|
|||||||
gamedo_fades();
|
gamedo_fades();
|
||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
|
|
||||||
gamedo_frameskipping(pCKP);
|
gamedo_frameskipping();
|
||||||
gamedo_ScrollTriggers(0);
|
gamedo_ScrollTriggers(0);
|
||||||
|
|
||||||
g_pInput->pollEvents();
|
g_pInput->pollEvents();
|
||||||
@@ -569,7 +492,7 @@ char enter,lastenterstate;
|
|||||||
int downtimer;
|
int downtimer;
|
||||||
int afterfadewaittimer = 0;
|
int afterfadewaittimer = 0;
|
||||||
|
|
||||||
initgame(pCKP);
|
initgame( &(pCKP->Control.levelcontrol) );
|
||||||
|
|
||||||
// set up the ship's route
|
// set up the ship's route
|
||||||
ShipQueuePtr = 0;
|
ShipQueuePtr = 0;
|
||||||
@@ -577,7 +500,7 @@ int afterfadewaittimer = 0;
|
|||||||
addshipqueue(CMD_MOVE, 1600, DUPLEFT);
|
addshipqueue(CMD_MOVE, 1600, DUPLEFT);
|
||||||
addshipqueue(CMD_FADEOUT, 0, 0);
|
addshipqueue(CMD_FADEOUT, 0, 0);
|
||||||
|
|
||||||
showmapatpos(81, LIMPSHOME_X, LIMPSHOME_Y, 0, pCKP);
|
showmapatpos(81, LIMPSHOME_X, LIMPSHOME_Y, pCKP);
|
||||||
|
|
||||||
numplayers = 1;
|
numplayers = 1;
|
||||||
player[0].x = (10 <<4<<CSF);
|
player[0].x = (10 <<4<<CSF);
|
||||||
@@ -592,7 +515,7 @@ int afterfadewaittimer = 0;
|
|||||||
fade.dir = FADE_IN;
|
fade.dir = FADE_IN;
|
||||||
fade.curamt = 0;
|
fade.curamt = 0;
|
||||||
fade.fadetimer = 0;
|
fade.fadetimer = 0;
|
||||||
eseq_showmsg(getstring("EP2_ESEQ_PART2"),HEADSFOREARTH_X,HEADSFOREARTH_Y,HEADSFOREARTH_W,HEADSFOREARTH_H-1,1, pCKP);
|
eseq_showmsg(getstring("EP2_ESEQ_PART2"),HEADSFOREARTH_X,HEADSFOREARTH_Y,HEADSFOREARTH_W,HEADSFOREARTH_H-1,1);
|
||||||
|
|
||||||
// erase the message dialog
|
// erase the message dialog
|
||||||
map_redraw();
|
map_redraw();
|
||||||
@@ -662,7 +585,7 @@ int afterfadewaittimer = 0;
|
|||||||
gamedo_fades();
|
gamedo_fades();
|
||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
|
|
||||||
gamedo_frameskipping(pCKP);
|
gamedo_frameskipping();
|
||||||
|
|
||||||
g_pInput->pollEvents();
|
g_pInput->pollEvents();
|
||||||
g_pTimer->SpeedThrottle();
|
g_pTimer->SpeedThrottle();
|
||||||
@@ -704,14 +627,14 @@ int dlgX, dlgY, dlgW, dlgH;
|
|||||||
dlgH = GetStringAttribute(tempstr, "HEIGHT");
|
dlgH = GetStringAttribute(tempstr, "HEIGHT");
|
||||||
lastpage = GetStringAttribute(tempstr, "LASTPAGE");
|
lastpage = GetStringAttribute(tempstr, "LASTPAGE");
|
||||||
|
|
||||||
eseq_showmsg(text, dlgX, dlgY, dlgW, dlgH, 1, pCKP);
|
eseq_showmsg(text, dlgX, dlgY, dlgW, dlgH, 1);
|
||||||
if (lastpage==1) break;
|
if (lastpage==1) break;
|
||||||
|
|
||||||
curpage++;
|
curpage++;
|
||||||
} while(!g_pInput->getPressedCommand(KQUIT));
|
} while(!g_pInput->getPressedCommand(KQUIT));
|
||||||
|
|
||||||
finale_draw("finale.ck2", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
finale_draw("finale.ck2", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
||||||
eseq_ToBeContinued(pCKP);
|
eseq_ToBeContinued();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
20
src/cinematics/EndingSequenceEp2.h
Normal file
20
src/cinematics/EndingSequenceEp2.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* EndingSequenceEp2.h
|
||||||
|
*
|
||||||
|
* Created on: 08.08.2009
|
||||||
|
* Author: gerstrong
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ENDINGSEQUENCEEP2_H_
|
||||||
|
#define ENDINGSEQUENCEEP2_H_
|
||||||
|
|
||||||
|
// references to CommonEnding.cpp
|
||||||
|
void eseq_ToBeContinued();
|
||||||
|
void eseq_showmsg(const std::string& text, int boxleft, int boxtop,
|
||||||
|
int boxwidth, int boxheight, bool autodismiss);
|
||||||
|
|
||||||
|
// references to ../gamedo.cpp
|
||||||
|
void gamedo_frameskipping();
|
||||||
|
void gamedo_enemyai(stLevelControl *p_levelcontrol);
|
||||||
|
|
||||||
|
#endif /* ENDINGSEQUENCEEP2_H_ */
|
||||||
@@ -4,17 +4,20 @@
|
|||||||
the Vorticon's camera flashes and stuff aren't implemented.
|
the Vorticon's camera flashes and stuff aren't implemented.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "keen.h"
|
#include "../keen.h"
|
||||||
#include "include/game.h"
|
|
||||||
#include "include/gamedo.h"
|
|
||||||
#include "sdl/CTimer.h"
|
|
||||||
#include "sdl/CInput.h"
|
|
||||||
#include "sdl/sound/CSound.h"
|
|
||||||
#include "include/eseq_ep3.h"
|
|
||||||
#include "include/eseq_ep2.h"
|
|
||||||
#include "include/menu.h"
|
|
||||||
|
|
||||||
void eseq3_Mortimer(stCloneKeenPlus *pCKP)
|
#include "../include/game.h"
|
||||||
|
#include "../include/gamedo.h"
|
||||||
|
#include "../include/menu.h"
|
||||||
|
|
||||||
|
#include "../sdl/CTimer.h"
|
||||||
|
#include "../sdl/CInput.h"
|
||||||
|
#include "../sdl/sound/CSound.h"
|
||||||
|
|
||||||
|
#include "EndingSequenceEp3.h"
|
||||||
|
|
||||||
|
|
||||||
|
void eseq3_Mortimer()
|
||||||
{
|
{
|
||||||
int x,y,w,h;
|
int x,y,w,h;
|
||||||
g_pSound->playSound(SOUND_MORTIMER, PLAY_FORCE);
|
g_pSound->playSound(SOUND_MORTIMER, PLAY_FORCE);
|
||||||
@@ -24,11 +27,11 @@ int x,y,w,h;
|
|||||||
w = GetStringAttribute("EP3_MORTIMER", "WIDTH");
|
w = GetStringAttribute("EP3_MORTIMER", "WIDTH");
|
||||||
h = GetStringAttribute("EP3_MORTIMER", "HEIGHT");
|
h = GetStringAttribute("EP3_MORTIMER", "HEIGHT");
|
||||||
|
|
||||||
eseq_showmsg(getstring("EP3_MORTIMER"),x,y,w,h,0, pCKP);
|
eseq_showmsg(getstring("EP3_MORTIMER"),x,y,w,h, false);
|
||||||
eseq_showmsg(getstring("EP3_MORTIMER2"),x,y,w,h,0, pCKP);
|
eseq_showmsg(getstring("EP3_MORTIMER2"),x,y,w,h, false);
|
||||||
eseq_showmsg(getstring("EP3_MORTIMER3"),x,y,w,h,0, pCKP);
|
eseq_showmsg(getstring("EP3_MORTIMER3"),x,y,w,h, false);
|
||||||
eseq_showmsg(getstring("EP3_MORTIMER4"),x,y,w,h,0, pCKP);
|
eseq_showmsg(getstring("EP3_MORTIMER4"),x,y,w,h, false);
|
||||||
eseq_showmsg(getstring("EP3_MORTIMER5"),x,y,w,h,0, pCKP);
|
eseq_showmsg(getstring("EP3_MORTIMER5"),x,y,w,h, false);
|
||||||
|
|
||||||
map_redraw();
|
map_redraw();
|
||||||
g_pSound->playSound(SOUND_FOOTSLAM, PLAY_NOW);
|
g_pSound->playSound(SOUND_FOOTSLAM, PLAY_NOW);
|
||||||
@@ -38,9 +41,9 @@ char eseq3_AwardBigV(stCloneKeenPlus *pCKP)
|
|||||||
{
|
{
|
||||||
int x,y,w,h;
|
int x,y,w,h;
|
||||||
int c;
|
int c;
|
||||||
initgame(pCKP);
|
initgame( &(pCKP->Control.levelcontrol) );
|
||||||
|
|
||||||
showmapatpos(81, 32, 32, 0, pCKP);
|
showmapatpos(81, 32, 32, pCKP);
|
||||||
|
|
||||||
numplayers = 1;
|
numplayers = 1;
|
||||||
player[0].x = 244<<CSF;
|
player[0].x = 244<<CSF;
|
||||||
@@ -58,10 +61,10 @@ char eseq3_AwardBigV(stCloneKeenPlus *pCKP)
|
|||||||
w = GetStringAttribute("EP3_ESEQ_PAGE1", "WIDTH");
|
w = GetStringAttribute("EP3_ESEQ_PAGE1", "WIDTH");
|
||||||
h = GetStringAttribute("EP3_ESEQ_PAGE1", "HEIGHT");
|
h = GetStringAttribute("EP3_ESEQ_PAGE1", "HEIGHT");
|
||||||
|
|
||||||
eseq_showmsg(getstring("EP3_ESEQ_PAGE1"),x,y,w,h,1, pCKP);
|
eseq_showmsg(getstring("EP3_ESEQ_PAGE1"),x,y,w,h, true);
|
||||||
eseq_showmsg(getstring("EP3_ESEQ_PAGE2"),x,y,w,h,1, pCKP);
|
eseq_showmsg(getstring("EP3_ESEQ_PAGE2"),x,y,w,h, true);
|
||||||
eseq_showmsg(getstring("EP3_ESEQ_PAGE3"),x,y,w,h,1, pCKP);
|
eseq_showmsg(getstring("EP3_ESEQ_PAGE3"),x,y,w,h, true);
|
||||||
eseq_showmsg(getstring("EP3_ESEQ_PAGE4"),x,y,w,h,1, pCKP);
|
eseq_showmsg(getstring("EP3_ESEQ_PAGE4"),x,y,w,h, true);
|
||||||
|
|
||||||
finale_draw("finale.ck3", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
finale_draw("finale.ck3", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
|
||||||
scrollx_buf = scrolly_buf = 0;
|
scrollx_buf = scrolly_buf = 0;
|
||||||
@@ -90,7 +93,7 @@ char eseq3_AwardBigV(stCloneKeenPlus *pCKP)
|
|||||||
w = GetStringAttribute("THE_END", "WIDTH");
|
w = GetStringAttribute("THE_END", "WIDTH");
|
||||||
h = GetStringAttribute("THE_END", "HEIGHT");
|
h = GetStringAttribute("THE_END", "HEIGHT");
|
||||||
|
|
||||||
eseq_showmsg(getstring("THE_END"),x,y,w,h,0, pCKP);
|
eseq_showmsg(getstring("THE_END"),x,y,w,h, false);
|
||||||
|
|
||||||
// wait for enter pressed
|
// wait for enter pressed
|
||||||
c = 0;
|
c = 0;
|
||||||
21
src/cinematics/EndingSequenceEp3.h
Normal file
21
src/cinematics/EndingSequenceEp3.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* EndingSequenceEp3.h
|
||||||
|
*
|
||||||
|
* Created on: 08.08.2009
|
||||||
|
* Author: gerstrong
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ENDINGSEQUENCEEP3_H_
|
||||||
|
#define ENDINGSEQUENCEEP3_H_
|
||||||
|
|
||||||
|
// Reference to ../map.cpp
|
||||||
|
void map_redraw(void);
|
||||||
|
|
||||||
|
// Reference to ../fileio.cpp
|
||||||
|
int GetStringAttribute(const std::string& stringName, const char *attrName);
|
||||||
|
|
||||||
|
// Reference to CommonEnding.cpp
|
||||||
|
void eseq_showmsg(const std::string& text, int boxleft, int boxtop,
|
||||||
|
int boxwidth, int boxheight, bool autodismiss);
|
||||||
|
|
||||||
|
#endif /* ENDINGSEQUENCEEP3_H_ */
|
||||||
112
src/fileio.cpp
112
src/fileio.cpp
@@ -109,7 +109,7 @@ short checkConsistencyofGameData(stGameData *p_GameData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char NessieAlreadySpawned;
|
char NessieAlreadySpawned;
|
||||||
void addobjectlayertile(unsigned int t, stCloneKeenPlus *pCKP)
|
void addobjectlayertile(unsigned int t, int episode, int *levels_completed)
|
||||||
{
|
{
|
||||||
int o;
|
int o;
|
||||||
switch(t)
|
switch(t)
|
||||||
@@ -117,14 +117,12 @@ int o;
|
|||||||
case 0: break; // blank
|
case 0: break; // blank
|
||||||
case 255: // player start
|
case 255: // player start
|
||||||
|
|
||||||
//Player[0].setCoord(curmapx << 4 << CSF, curmapy << 4 << CSF);
|
|
||||||
|
|
||||||
player[0].x = curmapx << 4 << CSF;
|
player[0].x = curmapx << 4 << CSF;
|
||||||
player[0].y = curmapy << 4 << CSF;
|
player[0].y = curmapy << 4 << CSF;
|
||||||
map.objectlayer[curmapx][curmapy] = 0;
|
map.objectlayer[curmapx][curmapy] = 0;
|
||||||
break;
|
break;
|
||||||
case NESSIE_PATH: // spawn nessie at first occurance of her path
|
case NESSIE_PATH: // spawn nessie at first occurance of her path
|
||||||
if (pCKP->Control.levelcontrol.episode==3)
|
if (episode==3)
|
||||||
{
|
{
|
||||||
if (!NessieAlreadySpawned)
|
if (!NessieAlreadySpawned)
|
||||||
{
|
{
|
||||||
@@ -138,7 +136,7 @@ int o;
|
|||||||
break;
|
break;
|
||||||
default: // level marker
|
default: // level marker
|
||||||
levelmarker: ;
|
levelmarker: ;
|
||||||
if ((t&0x7fff) < 256 && pCKP->Control.levelcontrol.levels_completed[t&0x00ff])
|
if ((t&0x7fff) < 256 && levels_completed[t&0x00ff])
|
||||||
{
|
{
|
||||||
if(!options[OPT_LVLREPLAYABILITY].value)
|
if(!options[OPT_LVLREPLAYABILITY].value)
|
||||||
map.objectlayer[curmapx][curmapy] = 0;
|
map.objectlayer[curmapx][curmapy] = 0;
|
||||||
@@ -148,7 +146,7 @@ levelmarker: ;
|
|||||||
int newtile = tiles[map.mapdata[curmapx][curmapy]].chgtile;
|
int newtile = tiles[map.mapdata[curmapx][curmapy]].chgtile;
|
||||||
|
|
||||||
// Consistency check! Some Mods have issues with that.
|
// Consistency check! Some Mods have issues with that.
|
||||||
if(pCKP->Control.levelcontrol.episode == 1 || pCKP->Control.levelcontrol.episode == 2)
|
if(episode == 1 || episode == 2)
|
||||||
{
|
{
|
||||||
if(newtile<77 || newtile>81)
|
if(newtile<77 || newtile>81)
|
||||||
// something went wrong. Use default tile
|
// something went wrong. Use default tile
|
||||||
@@ -165,7 +163,7 @@ levelmarker: ;
|
|||||||
newtile = 81; // br. this one
|
newtile = 81; // br. this one
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(pCKP->Control.levelcontrol.episode == 3)
|
else if(episode == 3)
|
||||||
{
|
{
|
||||||
if(newtile<52 || newtile>56)
|
if(newtile<52 || newtile>56)
|
||||||
// something went wrong. Use default tile
|
// something went wrong. Use default tile
|
||||||
@@ -201,7 +199,8 @@ levelmarker: ;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addenemytile(unsigned int t, stCloneKeenPlus *pCKP)
|
void addenemytile(unsigned int t, int episode,
|
||||||
|
int chglevelto, bool *canexit)
|
||||||
{
|
{
|
||||||
int o,x;
|
int o,x;
|
||||||
map.objectlayer[curmapx][curmapy] = t;
|
map.objectlayer[curmapx][curmapy] = t;
|
||||||
@@ -216,8 +215,6 @@ int o,x;
|
|||||||
if(curmapy >= map.ysize-2) // Edge bug. Keen would fall in some levels without this.
|
if(curmapy >= map.ysize-2) // Edge bug. Keen would fall in some levels without this.
|
||||||
curmapx = 4;
|
curmapx = 4;
|
||||||
|
|
||||||
//Player[0].setCoord(curmapx << 4 << CSF, ((curmapy << 4) + 8) << CSF);
|
|
||||||
|
|
||||||
player[0].x = curmapx << 4 << CSF;
|
player[0].x = curmapx << 4 << CSF;
|
||||||
player[0].y = ((curmapy << 4) + 8) << CSF;
|
player[0].y = ((curmapy << 4) + 8) << CSF;
|
||||||
}
|
}
|
||||||
@@ -228,7 +225,7 @@ int o,x;
|
|||||||
case 0: break;
|
case 0: break;
|
||||||
case -1: break;
|
case -1: break;
|
||||||
case 1: // yorp (ep1) vort (ep2&3)
|
case 1: // yorp (ep1) vort (ep2&3)
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (episode==1)
|
||||||
{
|
{
|
||||||
x = curmapx;
|
x = curmapx;
|
||||||
|
|
||||||
@@ -250,13 +247,13 @@ int o,x;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // garg (ep1) baby vorticon (ep2&3)
|
case 2: // garg (ep1) baby vorticon (ep2&3)
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (episode==1)
|
||||||
{
|
{
|
||||||
// those bastards. sometimes embedding garg's in the floor in
|
// those bastards. sometimes embedding garg's in the floor in
|
||||||
// the original maps.
|
// the original maps.
|
||||||
if(TileProperty[map.mapdata[curmapx+1][curmapy+1]][BLEFT])
|
if(TileProperty[map.mapdata[curmapx+1][curmapy+1]][BLEFT])
|
||||||
{
|
{
|
||||||
if (pCKP->Control.levelcontrol.chglevelto==7)
|
if (chglevelto==7)
|
||||||
{
|
{
|
||||||
spawn_object(curmapx<<4<<CSF, (curmapy-1)<<4<<CSF, OBJ_GARG);
|
spawn_object(curmapx<<4<<CSF, (curmapy-1)<<4<<CSF, OBJ_GARG);
|
||||||
}
|
}
|
||||||
@@ -276,40 +273,40 @@ int o,x;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: // vorticon (ep1) bear (ep2)
|
case 3: // vorticon (ep1) bear (ep2)
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (episode==1)
|
||||||
{
|
{
|
||||||
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_VORT);
|
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_VORT);
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==2)
|
else if (episode==2)
|
||||||
{
|
{
|
||||||
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_VORTELITE);
|
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_VORTELITE);
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==3)
|
else if (episode==3)
|
||||||
{
|
{
|
||||||
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_MOTHER);
|
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_MOTHER);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // butler (ep1) OR walker (ep2) OR meep (ep3)
|
case 4: // butler (ep1) OR walker (ep2) OR meep (ep3)
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (episode==1)
|
||||||
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_BUTLER);
|
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_BUTLER);
|
||||||
else if (pCKP->Control.levelcontrol.episode==2)
|
else if (episode==2)
|
||||||
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_WALKER);
|
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_WALKER);
|
||||||
else if (pCKP->Control.levelcontrol.episode==3)
|
else if (episode==3)
|
||||||
spawn_object(curmapx<<4<<CSF, ((curmapy<<4)+8)<<CSF, OBJ_MEEP);
|
spawn_object(curmapx<<4<<CSF, ((curmapy<<4)+8)<<CSF, OBJ_MEEP);
|
||||||
break;
|
break;
|
||||||
case 5: // tank robot (ep1&2) karate bear (ep3)
|
case 5: // tank robot (ep1&2) karate bear (ep3)
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (episode==1)
|
||||||
{
|
{
|
||||||
o = spawn_object(curmapx<<4<<CSF, ((curmapy<<4)+8)<<CSF, OBJ_TANK);
|
o = spawn_object(curmapx<<4<<CSF, ((curmapy<<4)+8)<<CSF, OBJ_TANK);
|
||||||
// set tank robot guarding bonus level to be active at startup
|
// set tank robot guarding bonus level to be active at startup
|
||||||
if (pCKP->Control.levelcontrol.chglevelto==13)
|
if (chglevelto==13)
|
||||||
{
|
{
|
||||||
objects[o].hasbeenonscreen = 1;
|
objects[o].hasbeenonscreen = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==2)
|
else if (episode==2)
|
||||||
spawn_object(curmapx<<4<<CSF, ((curmapy<<4)+0)<<CSF, OBJ_TANKEP2);
|
spawn_object(curmapx<<4<<CSF, ((curmapy<<4)+0)<<CSF, OBJ_TANKEP2);
|
||||||
else if (pCKP->Control.levelcontrol.episode==3)
|
else if (episode==3)
|
||||||
{
|
{
|
||||||
if(TileProperty[map.mapdata[curmapx][curmapy+1]][BLEFT])
|
if(TileProperty[map.mapdata[curmapx][curmapy+1]][BLEFT])
|
||||||
{
|
{
|
||||||
@@ -323,65 +320,65 @@ int o,x;
|
|||||||
break;
|
break;
|
||||||
case 6: // up-right-flying ice chunk (ep1) horiz platform (ep2)
|
case 6: // up-right-flying ice chunk (ep1) horiz platform (ep2)
|
||||||
// foob (ep3)
|
// foob (ep3)
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (episode==1)
|
||||||
{
|
{
|
||||||
o = spawn_object((((curmapx+1)<<4)+4)<<CSF, ((curmapy<<4)-4)<<CSF, OBJ_ICECANNON);
|
o = spawn_object((((curmapx+1)<<4)+4)<<CSF, ((curmapy<<4)-4)<<CSF, OBJ_ICECANNON);
|
||||||
objects[o].ai.icechunk.vector_x = 1;
|
objects[o].ai.icechunk.vector_x = 1;
|
||||||
objects[o].ai.icechunk.vector_y = -1;
|
objects[o].ai.icechunk.vector_y = -1;
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==2)
|
else if (episode==2)
|
||||||
{
|
{
|
||||||
o = spawn_object(curmapx<<4<<CSF, ((curmapy<<4)-3)<<CSF, OBJ_PLATFORM);
|
o = spawn_object(curmapx<<4<<CSF, ((curmapy<<4)-3)<<CSF, OBJ_PLATFORM);
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==3)
|
else if (episode==3)
|
||||||
{
|
{
|
||||||
o = spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_FOOB);
|
o = spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_FOOB);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7: // spark (ep2) ball (ep3)
|
case 7: // spark (ep2) ball (ep3)
|
||||||
if (pCKP->Control.levelcontrol.episode==2)
|
if (episode==2)
|
||||||
{
|
{
|
||||||
o = spawn_object(curmapx<<4<<CSF,curmapy<<4<<CSF,OBJ_SPARK);
|
o = spawn_object(curmapx<<4<<CSF,curmapy<<4<<CSF,OBJ_SPARK);
|
||||||
pCKP->Control.levelcontrol.canexit = 0; // can't exit till spark is shot
|
*canexit = false; // can't exit till spark is shot
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==3)
|
else if (episode==3)
|
||||||
{
|
{
|
||||||
o = spawn_object(curmapx<<4<<CSF,curmapy<<4<<CSF,OBJ_BALL);
|
o = spawn_object(curmapx<<4<<CSF,curmapy<<4<<CSF,OBJ_BALL);
|
||||||
objects[o].hasbeenonscreen = 1;
|
objects[o].hasbeenonscreen = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8: // jack (ep3)
|
case 8: // jack (ep3)
|
||||||
if (pCKP->Control.levelcontrol.episode==3)
|
if (episode==3)
|
||||||
{
|
{
|
||||||
o = spawn_object(curmapx<<4<<CSF,curmapy<<4<<CSF,OBJ_JACK);
|
o = spawn_object(curmapx<<4<<CSF,curmapy<<4<<CSF,OBJ_JACK);
|
||||||
objects[o].hasbeenonscreen = 1;
|
objects[o].hasbeenonscreen = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9: // up-left-flying ice chunk (ep1) horiz platform (ep3)
|
case 9: // up-left-flying ice chunk (ep1) horiz platform (ep3)
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (episode==1)
|
||||||
{
|
{
|
||||||
o = spawn_object(((curmapx<<4)-4)<<CSF, ((curmapy<<4)-4)<<CSF, OBJ_ICECANNON);
|
o = spawn_object(((curmapx<<4)-4)<<CSF, ((curmapy<<4)-4)<<CSF, OBJ_ICECANNON);
|
||||||
objects[o].ai.icechunk.vector_x = -1;
|
objects[o].ai.icechunk.vector_x = -1;
|
||||||
objects[o].ai.icechunk.vector_y = -1;
|
objects[o].ai.icechunk.vector_y = -1;
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==3)
|
else if (episode==3)
|
||||||
{
|
{
|
||||||
o = spawn_object(curmapx<<4<<CSF, (((curmapy)<<4)-4)<<CSF, OBJ_PLATFORM);
|
o = spawn_object(curmapx<<4<<CSF, (((curmapy)<<4)-4)<<CSF, OBJ_PLATFORM);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 10: // rope holding the stone above the final vorticon (ep1)
|
case 10: // rope holding the stone above the final vorticon (ep1)
|
||||||
// vert platform (ep3)
|
// vert platform (ep3)
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (episode==1)
|
||||||
{
|
{
|
||||||
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_ROPE);
|
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_ROPE);
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==3)
|
else if (episode==3)
|
||||||
{
|
{
|
||||||
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_PLATVERT);
|
spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_PLATVERT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 11: // jumping vorticon (ep3)
|
case 11: // jumping vorticon (ep3)
|
||||||
if (pCKP->Control.levelcontrol.episode==3)
|
if (episode==3)
|
||||||
{
|
{
|
||||||
spawn_object(curmapx<<4<<CSF, ((curmapy<<4)-8)<<CSF, OBJ_VORT);
|
spawn_object(curmapx<<4<<CSF, ((curmapy<<4)-8)<<CSF, OBJ_VORT);
|
||||||
}
|
}
|
||||||
@@ -397,7 +394,7 @@ int o,x;
|
|||||||
objects[o].hasbeenonscreen = 1;
|
objects[o].hasbeenonscreen = 1;
|
||||||
break;
|
break;
|
||||||
case 14: // right-pointing raygun (ep3)
|
case 14: // right-pointing raygun (ep3)
|
||||||
if (pCKP->Control.levelcontrol.episode==3)
|
if (episode==3)
|
||||||
{
|
{
|
||||||
o = spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_SECTOREFFECTOR);
|
o = spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_SECTOREFFECTOR);
|
||||||
//objects[o].ai.se.type = SE_GUN_RIGHT;
|
//objects[o].ai.se.type = SE_GUN_RIGHT;
|
||||||
@@ -405,7 +402,7 @@ int o,x;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 15: // vertical raygun (ep3)
|
case 15: // vertical raygun (ep3)
|
||||||
if (pCKP->Control.levelcontrol.episode==3)
|
if (episode==3)
|
||||||
{
|
{
|
||||||
o = spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_SECTOREFFECTOR);
|
o = spawn_object(curmapx<<4<<CSF, curmapy<<4<<CSF, OBJ_SECTOREFFECTOR);
|
||||||
//objects[o].ai.se.type = SE_GUN_VERT;
|
//objects[o].ai.se.type = SE_GUN_VERT;
|
||||||
@@ -461,24 +458,31 @@ unsigned int temp1, temp2, temp3, temp4;
|
|||||||
return (temp4<<24) | (temp3<<16) | (temp2<<8) | temp1;
|
return (temp4<<24) | (temp3<<16) | (temp2<<8) | temp1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int loadmap(const std::string& filename, const std::string& path, int lvlnum, int isworldmap, stCloneKeenPlus *pCKP)
|
unsigned int loadmap(const std::string& filename, const std::string& path,
|
||||||
|
int lvlnum,stLevelControl* p_levelcontrol)
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO: Tie that one up in convert stuff in C++
|
// TODO: Tie that one up in converting stuff into C++
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int t;
|
int t;
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
int numruns = 0;
|
int numruns = 0;
|
||||||
int resetcnt, resetpt;
|
int resetcnt, resetpt;
|
||||||
unsigned int planesize = 0;
|
unsigned int planesize = 0;
|
||||||
|
|
||||||
NessieAlreadySpawned = 0;
|
int episode = p_levelcontrol->episode;
|
||||||
map.isworldmap = isworldmap;
|
int chglevelto = p_levelcontrol->chglevelto;
|
||||||
|
int *levels_completed = p_levelcontrol->levels_completed;
|
||||||
|
bool *p_canexit = &(p_levelcontrol->canexit);
|
||||||
|
|
||||||
|
|
||||||
|
NessieAlreadySpawned = 0;
|
||||||
|
map.isworldmap = (lvlnum == 80);
|
||||||
|
|
||||||
std::string buffer = formatPathString(path);
|
std::string buffer = formatPathString(path);
|
||||||
std::string fname = buffer + filename;
|
std::string fname = buffer + filename;
|
||||||
fp = OpenGameFile(fname.c_str(), "rb");
|
fp = OpenGameFile(fname.c_str(), "rb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
// only record this error message on build platforms that log errors
|
// only record this error message on build platforms that log errors
|
||||||
@@ -547,7 +551,9 @@ unsigned int planesize = 0;
|
|||||||
{
|
{
|
||||||
t = filebuf[c];
|
t = filebuf[c];
|
||||||
|
|
||||||
if (map.isworldmap) addobjectlayertile(t, pCKP); else addenemytile(t, pCKP);
|
if (map.isworldmap) addobjectlayertile(t, episode, levels_completed);
|
||||||
|
else addenemytile(t, episode, chglevelto, p_canexit);
|
||||||
|
|
||||||
if (++resetcnt==resetpt) curmapx=curmapy=0;
|
if (++resetcnt==resetpt) curmapx=curmapy=0;
|
||||||
|
|
||||||
c++;
|
c++;
|
||||||
@@ -597,7 +603,7 @@ unsigned int planesize = 0;
|
|||||||
// Didn't it work? Don't matter. HQP is optional, so continue
|
// Didn't it work? Don't matter. HQP is optional, so continue
|
||||||
|
|
||||||
// install enemy stoppoints as needed
|
// install enemy stoppoints as needed
|
||||||
if (pCKP->Control.levelcontrol.episode==1 && lvlnum==13)
|
if (episode==1 && lvlnum==13)
|
||||||
{
|
{
|
||||||
map.objectlayer[94][13] = GARG_STOPPOINT;
|
map.objectlayer[94][13] = GARG_STOPPOINT;
|
||||||
map.objectlayer[113][13] = GARG_STOPPOINT;
|
map.objectlayer[113][13] = GARG_STOPPOINT;
|
||||||
@@ -606,17 +612,17 @@ unsigned int planesize = 0;
|
|||||||
map.objectlayer[87][5] = GARG_STOPPOINT;
|
map.objectlayer[87][5] = GARG_STOPPOINT;
|
||||||
map.objectlayer[39][18] = GARG_STOPPOINT;
|
map.objectlayer[39][18] = GARG_STOPPOINT;
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==3 && lvlnum==6)
|
else if (episode==3 && lvlnum==6)
|
||||||
{
|
{
|
||||||
map.objectlayer[40][7] = BALL_NOPASSPOINT;
|
map.objectlayer[40][7] = BALL_NOPASSPOINT;
|
||||||
map.objectlayer[50][7] = BALL_NOPASSPOINT;
|
map.objectlayer[50][7] = BALL_NOPASSPOINT;
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==3 && lvlnum==9)
|
else if (episode==3 && lvlnum==9)
|
||||||
{
|
{
|
||||||
map.objectlayer[45][106] = BALL_NOPASSPOINT;
|
map.objectlayer[45][106] = BALL_NOPASSPOINT;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==3 && lvlnum==4)
|
else if (episode==3 && lvlnum==4)
|
||||||
{
|
{
|
||||||
map.objectlayer[94][17] = BALL_NOPASSPOINT;
|
map.objectlayer[94][17] = BALL_NOPASSPOINT;
|
||||||
}
|
}
|
||||||
|
|||||||
80
src/game.cpp
80
src/game.cpp
@@ -12,11 +12,10 @@
|
|||||||
#include "include/gamedo.h"
|
#include "include/gamedo.h"
|
||||||
#include "include/gamepdo.h"
|
#include "include/gamepdo.h"
|
||||||
#include "include/gm_pdowm.h"
|
#include "include/gm_pdowm.h"
|
||||||
#include "include/eseq_ep3.h"
|
|
||||||
#include "sdl/CTimer.h"
|
#include "sdl/CTimer.h"
|
||||||
#include "sdl/CInput.h"
|
#include "sdl/CInput.h"
|
||||||
#include "sdl/sound/CSound.h"
|
#include "sdl/sound/CSound.h"
|
||||||
#include "include/enemyai.h"
|
//#include "include/enemyai.h"
|
||||||
#include "hqp/CMusic.h"
|
#include "hqp/CMusic.h"
|
||||||
#include "vorticon/CHighScores.h"
|
#include "vorticon/CHighScores.h"
|
||||||
#include "hqp/CHQBitmap.h"
|
#include "hqp/CHQBitmap.h"
|
||||||
@@ -43,12 +42,13 @@ void gameloop(stCloneKeenPlus *pCKP)
|
|||||||
crashflag=1;
|
crashflag=1;
|
||||||
crashflag2 = pCKP->Control.levelcontrol.curlevel;
|
crashflag2 = pCKP->Control.levelcontrol.curlevel;
|
||||||
crashflag3 = pCKP->Control.levelcontrol.episode;
|
crashflag3 = pCKP->Control.levelcontrol.episode;
|
||||||
why_term_ptr = "No player start position! (flag2=pCKP->Control.levelcontrol.curlevel, flag3=pCKP->Control.levelcontrol.episode)";
|
why_term_ptr = "No player start position! (flag2=levelcontrol.curlevel, flag3=levelcontrol.episode)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!loadinggame)
|
if (!loadinggame)
|
||||||
{
|
{
|
||||||
gameloop_initialize(pCKP);
|
gameloop_initialize(pCKP->Control.levelcontrol.episode, pCKP->Control.levelcontrol.dokeensleft);
|
||||||
|
pCKP->Control.levelcontrol.dokeensleft = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -78,10 +78,10 @@ void gameloop(stCloneKeenPlus *pCKP)
|
|||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
g_pInput->pollEvents();
|
g_pInput->pollEvents();
|
||||||
g_pTimer->SpeedThrottle();
|
g_pTimer->SpeedThrottle();
|
||||||
gamedo_RenderScreen(pCKP);
|
gamedo_RenderScreen();
|
||||||
} while(fade.mode!=FADE_COMPLETE /*&& !immediate_keytable[KQUIT]*/);
|
} while(fade.mode!=FADE_COMPLETE /*&& !immediate_keytable[KQUIT]*/);
|
||||||
|
|
||||||
eseq3_Mortimer(pCKP);
|
eseq3_Mortimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
lastquit = 1;
|
lastquit = 1;
|
||||||
@@ -106,7 +106,7 @@ void gameloop(stCloneKeenPlus *pCKP)
|
|||||||
else gunfiretimer++;
|
else gunfiretimer++;
|
||||||
|
|
||||||
// gather input and copy to player[].keytable[] structures
|
// gather input and copy to player[].keytable[] structures
|
||||||
gamedo_getInput(pCKP);
|
gamedo_getInput( &(pCKP->Control.levelcontrol) );
|
||||||
|
|
||||||
// run the player behaviour for each player in the game
|
// run the player behaviour for each player in the game
|
||||||
if (!map.isworldmap)
|
if (!map.isworldmap)
|
||||||
@@ -125,7 +125,7 @@ void gameloop(stCloneKeenPlus *pCKP)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gamedo_AnimatedTiles(!pCKP->Control.levelcontrol.usedhintmb);
|
gamedo_AnimatedTiles(!pCKP->Control.levelcontrol.usedhintmb);
|
||||||
gamedo_enemyai(pCKP);
|
gamedo_enemyai( &(pCKP->Control.levelcontrol) );
|
||||||
|
|
||||||
gamedo_HandleFKeys(pCKP);
|
gamedo_HandleFKeys(pCKP);
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ void gameloop(stCloneKeenPlus *pCKP)
|
|||||||
|
|
||||||
|
|
||||||
// do frameskipping, and render/blit the screen if it's time
|
// do frameskipping, and render/blit the screen if it's time
|
||||||
gamedo_frameskipping(pCKP);
|
gamedo_frameskipping();
|
||||||
|
|
||||||
// when we complete a fade out flag to exit the game loop
|
// when we complete a fade out flag to exit the game loop
|
||||||
if (fade.mode==FADE_COMPLETE)
|
if (fade.mode==FADE_COMPLETE)
|
||||||
@@ -248,7 +248,7 @@ void gameloop(stCloneKeenPlus *pCKP)
|
|||||||
|
|
||||||
if (g_pInput->getPressedKey(KQUIT))
|
if (g_pInput->getPressedKey(KQUIT))
|
||||||
{
|
{
|
||||||
VerifyQuit(pCKP);
|
VerifyQuit();
|
||||||
}
|
}
|
||||||
if (QuitState != NO_QUIT) return;
|
if (QuitState != NO_QUIT) return;
|
||||||
|
|
||||||
@@ -394,8 +394,7 @@ int mpx,mpy,t;
|
|||||||
//if (tiles[t].isAnimated) map_deanimate(mpx, mpy);
|
//if (tiles[t].isAnimated) map_deanimate(mpx, mpy);
|
||||||
if (TileProperty[t][ANIMATION] != 1) map_deanimate(mpx, mpy);
|
if (TileProperty[t][ANIMATION] != 1) map_deanimate(mpx, mpy);
|
||||||
}
|
}
|
||||||
else if (TileProperty[t][BEHAVIOR] == 1)
|
else if (TileProperty[t][BEHAVIOR] == 1) // Lethal (Deadly) Behavoir
|
||||||
//else if (tiles[t].lethal)
|
|
||||||
{ // whoah, this "goodie" isn't so good...
|
{ // whoah, this "goodie" isn't so good...
|
||||||
killplayer(theplayer);
|
killplayer(theplayer);
|
||||||
return;
|
return;
|
||||||
@@ -405,7 +404,7 @@ int mpx,mpy,t;
|
|||||||
procgoodie(t, mpx, mpy, theplayer, pCKP);
|
procgoodie(t, mpx, mpy, theplayer, pCKP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initgame(stCloneKeenPlus *pCKP)
|
void initgame(stLevelControl *p_levelcontrol)
|
||||||
{
|
{
|
||||||
int x,y;
|
int x,y;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -423,7 +422,7 @@ unsigned int i;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set gun/ice cannon fire freq
|
// set gun/ice cannon fire freq
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (p_levelcontrol->episode==1)
|
||||||
{
|
{
|
||||||
gunfirefreq = ICECANNON_FIRE_FREQ;
|
gunfirefreq = ICECANNON_FIRE_FREQ;
|
||||||
}
|
}
|
||||||
@@ -438,8 +437,8 @@ unsigned int i;
|
|||||||
sprites[DOOR_GREEN_SPRITE].ysize = 32;
|
sprites[DOOR_GREEN_SPRITE].ysize = 32;
|
||||||
sprites[DOOR_BLUE_SPRITE].ysize = 32;
|
sprites[DOOR_BLUE_SPRITE].ysize = 32;
|
||||||
|
|
||||||
pCKP->Control.levelcontrol.level_done_timer = 0;
|
p_levelcontrol->level_done_timer = 0;
|
||||||
pCKP->Control.levelcontrol.gameovermode = 0;
|
p_levelcontrol->gameovermode = 0;
|
||||||
|
|
||||||
// all objects -> not exist
|
// all objects -> not exist
|
||||||
for(i=1;i<MAX_OBJECTS-1;i++) objects[i].exists = 0;
|
for(i=1;i<MAX_OBJECTS-1;i++) objects[i].exists = 0;
|
||||||
@@ -456,7 +455,7 @@ unsigned int i;
|
|||||||
|
|
||||||
// initilize default sprites for objects
|
// initilize default sprites for objects
|
||||||
memset(objdefsprites, 0, sizeof(objdefsprites));
|
memset(objdefsprites, 0, sizeof(objdefsprites));
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (p_levelcontrol->episode==1)
|
||||||
{
|
{
|
||||||
objdefsprites[OBJ_YORP] = OBJ_YORP_DEFSPRITE;
|
objdefsprites[OBJ_YORP] = OBJ_YORP_DEFSPRITE;
|
||||||
objdefsprites[OBJ_GARG] = OBJ_GARG_DEFSPRITE;
|
objdefsprites[OBJ_GARG] = OBJ_GARG_DEFSPRITE;
|
||||||
@@ -469,7 +468,7 @@ unsigned int i;
|
|||||||
objdefsprites[OBJ_RAY] = OBJ_RAY_DEFSPRITE_EP1;
|
objdefsprites[OBJ_RAY] = OBJ_RAY_DEFSPRITE_EP1;
|
||||||
objdefsprites[OBJ_VORT] = OBJ_VORT_DEFSPRITE_EP1;
|
objdefsprites[OBJ_VORT] = OBJ_VORT_DEFSPRITE_EP1;
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==2)
|
else if (p_levelcontrol->episode==2)
|
||||||
{
|
{
|
||||||
objdefsprites[OBJ_WALKER] = OBJ_WALKER_DEFSPRITE;
|
objdefsprites[OBJ_WALKER] = OBJ_WALKER_DEFSPRITE;
|
||||||
objdefsprites[OBJ_TANKEP2] = OBJ_TANKEP2_DEFSPRITE;
|
objdefsprites[OBJ_TANKEP2] = OBJ_TANKEP2_DEFSPRITE;
|
||||||
@@ -480,7 +479,7 @@ unsigned int i;
|
|||||||
objdefsprites[OBJ_PLATFORM] = OBJ_PLATFORM_DEFSPRITE_EP2;
|
objdefsprites[OBJ_PLATFORM] = OBJ_PLATFORM_DEFSPRITE_EP2;
|
||||||
objdefsprites[OBJ_BABY] = OBJ_BABY_DEFSPRITE_EP2;
|
objdefsprites[OBJ_BABY] = OBJ_BABY_DEFSPRITE_EP2;
|
||||||
}
|
}
|
||||||
else if (pCKP->Control.levelcontrol.episode==3)
|
else if (p_levelcontrol->episode==3)
|
||||||
{
|
{
|
||||||
objdefsprites[OBJ_FOOB] = OBJ_FOOB_DEFSPRITE;
|
objdefsprites[OBJ_FOOB] = OBJ_FOOB_DEFSPRITE;
|
||||||
objdefsprites[OBJ_NINJA] = OBJ_NINJA_DEFSPRITE;
|
objdefsprites[OBJ_NINJA] = OBJ_NINJA_DEFSPRITE;
|
||||||
@@ -501,7 +500,7 @@ unsigned int i;
|
|||||||
objdefsprites[OBJ_SECTOREFFECTOR] = BlankSprite;
|
objdefsprites[OBJ_SECTOREFFECTOR] = BlankSprite;
|
||||||
|
|
||||||
// initilize game variables
|
// initilize game variables
|
||||||
pCKP->Control.levelcontrol.level_done = LEVEL_NOT_DONE;
|
p_levelcontrol->level_done = LEVEL_NOT_DONE;
|
||||||
animtiletimer = curanimtileframe = 0;
|
animtiletimer = curanimtileframe = 0;
|
||||||
DemoObjectHandle = 0;
|
DemoObjectHandle = 0;
|
||||||
|
|
||||||
@@ -699,23 +698,14 @@ void killobject(int o)
|
|||||||
// anything (players/enemies) occupying the map tile at [mpx,mpy] is killed
|
// anything (players/enemies) occupying the map tile at [mpx,mpy] is killed
|
||||||
void kill_all_intersecting_tile(int mpx, int mpy)
|
void kill_all_intersecting_tile(int mpx, int mpy)
|
||||||
{
|
{
|
||||||
unsigned int xpix,ypix;
|
unsigned int xpix,ypix;
|
||||||
int i;
|
|
||||||
xpix = mpx<<TILE_S<<CSF;
|
xpix = mpx<<TILE_S<<CSF;
|
||||||
ypix = mpy<<TILE_S<<CSF;
|
ypix = mpy<<TILE_S<<CSF;
|
||||||
for(i=0;i<highest_objslot;i++)
|
for(int i=0 ; i<highest_objslot ; i++)
|
||||||
{
|
|
||||||
if (objects[i].exists)
|
if (objects[i].exists)
|
||||||
{
|
|
||||||
if (xpix <= objects[i].x && xpix+(16<<CSF) >= objects[i].x)
|
if (xpix <= objects[i].x && xpix+(16<<CSF) >= objects[i].x)
|
||||||
{
|
|
||||||
if (ypix <= objects[i].y && ypix+(16<<CSF) >= objects[i].y)
|
if (ypix <= objects[i].y && ypix+(16<<CSF) >= objects[i].y)
|
||||||
{
|
|
||||||
killobject(i);
|
killobject(i);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns whether pix position x,y is a stop point for object o.
|
// returns whether pix position x,y is a stop point for object o.
|
||||||
@@ -874,17 +864,6 @@ void endlevel(int reason_for_leaving, stLevelControl *levelcontrol)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetGameOver(stCloneKeenPlus *pCKP)
|
|
||||||
{
|
|
||||||
/*int x,y,bmnum;*/
|
|
||||||
if (!pCKP->Control.levelcontrol.gameovermode)
|
|
||||||
{
|
|
||||||
pCKP->Control.levelcontrol.gameovermode = 1;
|
|
||||||
g_pSound->playSound(SOUND_GAME_OVER, PLAY_NOW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// this is so objects can block the player,
|
// this is so objects can block the player,
|
||||||
// player can stand on them, etc.
|
// player can stand on them, etc.
|
||||||
// x and y are the CSFed coordinates to check (e.g. playx and playy)
|
// x and y are the CSFed coordinates to check (e.g. playx and playy)
|
||||||
@@ -1345,12 +1324,12 @@ int o;
|
|||||||
gamepdo_ankh(cp);
|
gamepdo_ankh(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gameloop_initialize(stCloneKeenPlus *pCKP)
|
void gameloop_initialize(int episode, bool show_keensleft = false)
|
||||||
{
|
{
|
||||||
unsigned int x,y,i/*,tl*/;
|
unsigned int x,y,i/*,tl*/;
|
||||||
int timeout;
|
int timeout;
|
||||||
|
|
||||||
if (pCKP->Control.levelcontrol.episode == 3)
|
if (episode == 3)
|
||||||
{
|
{
|
||||||
// coat the top of the map ("oh no!" border) with a non-solid tile
|
// coat the top of the map ("oh no!" border) with a non-solid tile
|
||||||
// so keen can jump partially off the top of the screen
|
// so keen can jump partially off the top of the screen
|
||||||
@@ -1371,7 +1350,7 @@ int timeout;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
if (episode==1)
|
||||||
{
|
{
|
||||||
// coat the bottom of the map below the border.
|
// coat the bottom of the map below the border.
|
||||||
// since the border has solidceil=1 this provides
|
// since the border has solidceil=1 this provides
|
||||||
@@ -1394,7 +1373,7 @@ int timeout;
|
|||||||
x = player[0].x;
|
x = player[0].x;
|
||||||
for(i=1;i<numplayers;i++)
|
for(i=1;i<numplayers;i++)
|
||||||
{
|
{
|
||||||
if (player[0].x>>CSF>>4 < (map.xsize/2) || pCKP->Control.levelcontrol.episode==1)
|
if (player[0].x>>CSF>>4 < (map.xsize/2) || episode==1)
|
||||||
{
|
{
|
||||||
x += (18<<CSF);
|
x += (18<<CSF);
|
||||||
}
|
}
|
||||||
@@ -1420,7 +1399,7 @@ int timeout;
|
|||||||
player[i].pdir = player[i].pshowdir = DOWN;
|
player[i].pdir = player[i].pshowdir = DOWN;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (player[i].x>>CSF>>4 < (map.xsize/2) || pCKP->Control.levelcontrol.episode==1)
|
if (player[i].x>>CSF>>4 < (map.xsize/2) || episode==1)
|
||||||
player[i].pdir = player[i].pshowdir = RIGHT;
|
player[i].pdir = player[i].pshowdir = RIGHT;
|
||||||
else
|
else
|
||||||
player[i].pdir = player[i].pshowdir = LEFT;
|
player[i].pdir = player[i].pshowdir = LEFT;
|
||||||
@@ -1451,10 +1430,7 @@ int timeout;
|
|||||||
fade.fadetimer = 0;
|
fade.fadetimer = 0;
|
||||||
|
|
||||||
// "keens left" when returning to world map after dying
|
// "keens left" when returning to world map after dying
|
||||||
if (pCKP->Control.levelcontrol.dokeensleft)
|
if (show_keensleft)
|
||||||
{
|
keensleft(episode);
|
||||||
keensleft(pCKP);
|
|
||||||
pCKP->Control.levelcontrol.dokeensleft = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
110
src/gamedo.cpp
110
src/gamedo.cpp
@@ -38,14 +38,14 @@ unsigned char oldupkey = 5;
|
|||||||
unsigned char olddownkey = 5;
|
unsigned char olddownkey = 5;
|
||||||
unsigned char oldctrlkey = 5;
|
unsigned char oldctrlkey = 5;
|
||||||
unsigned char oldaltkey = 5;
|
unsigned char oldaltkey = 5;
|
||||||
void gamedo_getInput(stCloneKeenPlus *pCKP)
|
void gamedo_getInput(stLevelControl *p_levelcontrol)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
int byt;
|
int byt;
|
||||||
unsigned int msb, lsb;
|
unsigned int msb, lsb;
|
||||||
|
|
||||||
|
|
||||||
if (pCKP->Control.levelcontrol.demomode==DEMO_PLAYBACK)
|
if (p_levelcontrol->demomode==DEMO_PLAYBACK)
|
||||||
{
|
{
|
||||||
// time to get a new key block?
|
// time to get a new key block?
|
||||||
if (!demo_RLERunLen)
|
if (!demo_RLERunLen)
|
||||||
@@ -70,7 +70,7 @@ unsigned int msb, lsb;
|
|||||||
if (byt & 32)player[0].playcontrol[PA_STATUS] = 1;
|
if (byt & 32)player[0].playcontrol[PA_STATUS] = 1;
|
||||||
if (byt & 64)
|
if (byt & 64)
|
||||||
{ // demo STOP command
|
{ // demo STOP command
|
||||||
if (fade.mode!=FADE_GO) endlevel(1, &(pCKP->Control.levelcontrol) );
|
if (fade.mode!=FADE_GO) endlevel(1, p_levelcontrol );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -84,12 +84,12 @@ unsigned int msb, lsb;
|
|||||||
{
|
{
|
||||||
if (g_pInput->getPressedKey(i))
|
if (g_pInput->getPressedKey(i))
|
||||||
{
|
{
|
||||||
if (fade.mode!=FADE_GO) endlevel(0, &(pCKP->Control.levelcontrol) );
|
if (fade.mode!=FADE_GO) endlevel( 0, p_levelcontrol );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (g_pInput->getPressedCommand(IC_STATUS))
|
if (g_pInput->getPressedCommand(IC_STATUS))
|
||||||
{
|
{
|
||||||
if (fade.mode!=FADE_GO) endlevel(0, &(pCKP->Control.levelcontrol) );
|
if (fade.mode!=FADE_GO) endlevel( 0, p_levelcontrol );
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -122,7 +122,7 @@ unsigned int msb, lsb;
|
|||||||
if(g_pInput->getHoldedCommand(p, IC_STATUS))
|
if(g_pInput->getHoldedCommand(p, IC_STATUS))
|
||||||
player[p].playcontrol[PA_STATUS] = 1;
|
player[p].playcontrol[PA_STATUS] = 1;
|
||||||
|
|
||||||
if (pCKP->Control.levelcontrol.demomode==DEMO_RECORD)
|
if (p_levelcontrol->demomode==DEMO_RECORD)
|
||||||
{
|
{
|
||||||
if(i) player[p].playcontrol[PA_X] += 100;
|
if(i) player[p].playcontrol[PA_X] += 100;
|
||||||
fputc(i, demofile);
|
fputc(i, demofile);
|
||||||
@@ -149,9 +149,6 @@ int scrollchanged;
|
|||||||
|
|
||||||
if (player[theplayer].pdie) return 0;
|
if (player[theplayer].pdie) return 0;
|
||||||
|
|
||||||
//px = (Player[theplayer].getCoordX()>>CSF)-scroll_x;
|
|
||||||
//py = (Player[theplayer].getCoordY()>>CSF)-scroll_y;
|
|
||||||
|
|
||||||
px = (player[theplayer].x>>CSF)-scroll_x;
|
px = (player[theplayer].x>>CSF)-scroll_x;
|
||||||
py = (player[theplayer].y>>CSF)-scroll_y;
|
py = (player[theplayer].y>>CSF)-scroll_y;
|
||||||
|
|
||||||
@@ -211,7 +208,7 @@ int i;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do object and enemy AI
|
// do object and enemy AI
|
||||||
void gamedo_enemyai(stCloneKeenPlus *pCKP)
|
void gamedo_enemyai(stLevelControl *p_levelcontrol)
|
||||||
{
|
{
|
||||||
int i, topobj;
|
int i, topobj;
|
||||||
// handle objects and do enemy AI
|
// handle objects and do enemy AI
|
||||||
@@ -256,36 +253,36 @@ int i, topobj;
|
|||||||
switch(objects[i].type)
|
switch(objects[i].type)
|
||||||
{
|
{
|
||||||
//KEEN1
|
//KEEN1
|
||||||
case OBJ_YORP: yorp_ai(i, pCKP->Control.levelcontrol); break;
|
case OBJ_YORP: yorp_ai(i, *p_levelcontrol); break;
|
||||||
case OBJ_GARG: garg_ai(i, pCKP); break;
|
case OBJ_GARG: garg_ai(i, p_levelcontrol->hardmode); break;
|
||||||
case OBJ_VORT: vort_ai(i, pCKP, pCKP->Control.levelcontrol); break;
|
case OBJ_VORT: vort_ai(i, p_levelcontrol ); break;
|
||||||
case OBJ_BUTLER: butler_ai(i, pCKP->Control.levelcontrol.hardmode); break;
|
case OBJ_BUTLER: butler_ai(i, p_levelcontrol->hardmode); break;
|
||||||
case OBJ_TANK: tank_ai(i, pCKP->Control.levelcontrol.hardmode); break;
|
case OBJ_TANK: tank_ai(i, p_levelcontrol->hardmode); break;
|
||||||
case OBJ_RAY: ray_ai(i, pCKP, pCKP->Control.levelcontrol); break;
|
case OBJ_RAY: ray_ai(i, p_levelcontrol->episode); break;
|
||||||
case OBJ_DOOR: door_ai(i, pCKP->Control.levelcontrol.cepvars.DoorOpenDir); break;
|
case OBJ_DOOR: door_ai(i, p_levelcontrol->cepvars.DoorOpenDir); break;
|
||||||
case OBJ_ICECANNON: icecannon_ai(i); break;
|
case OBJ_ICECANNON: icecannon_ai(i); break;
|
||||||
case OBJ_ICECHUNK: icechunk_ai(i); break;
|
case OBJ_ICECHUNK: icechunk_ai(i); break;
|
||||||
case OBJ_ICEBIT: icebit_ai(i); break;
|
case OBJ_ICEBIT: icebit_ai(i); break;
|
||||||
case OBJ_TELEPORTER: teleporter_ai(i, pCKP->Control.levelcontrol); break;
|
case OBJ_TELEPORTER: teleporter_ai(i, *p_levelcontrol); break;
|
||||||
case OBJ_ROPE: rope_ai(i); break;
|
case OBJ_ROPE: rope_ai(i); break;
|
||||||
//KEEN2
|
//KEEN2
|
||||||
case OBJ_WALKER: walker_ai(i, pCKP->Control.levelcontrol); break;
|
case OBJ_WALKER: walker_ai(i, *p_levelcontrol); break;
|
||||||
case OBJ_TANKEP2: tankep2_ai(i, pCKP); break;
|
case OBJ_TANKEP2: tankep2_ai(i, p_levelcontrol->hardmode); break;
|
||||||
case OBJ_PLATFORM: platform_ai(i, pCKP->Control.levelcontrol); break;
|
case OBJ_PLATFORM: platform_ai(i, *p_levelcontrol); break;
|
||||||
case OBJ_VORTELITE: vortelite_ai(i, pCKP->Control.levelcontrol.dark); break;
|
case OBJ_VORTELITE: vortelite_ai(i, p_levelcontrol->dark); break;
|
||||||
case OBJ_SECTOREFFECTOR: se_ai(i, pCKP); break;
|
case OBJ_SECTOREFFECTOR: se_ai(i, p_levelcontrol ); break;
|
||||||
case OBJ_BABY: baby_ai(i, pCKP->Control.levelcontrol.episode,
|
case OBJ_BABY: baby_ai(i, p_levelcontrol->episode,
|
||||||
pCKP->Control.levelcontrol.hardmode); break;
|
p_levelcontrol->hardmode); break;
|
||||||
case OBJ_EXPLOSION: explosion_ai(i); break;
|
case OBJ_EXPLOSION: explosion_ai(i); break;
|
||||||
case OBJ_EARTHCHUNK: earthchunk_ai(i); break;
|
case OBJ_EARTHCHUNK: earthchunk_ai(i); break;
|
||||||
case OBJ_SPARK: spark_ai(i, &(pCKP->Control.levelcontrol.sparks_left) ); break;
|
case OBJ_SPARK: spark_ai(i, &(p_levelcontrol->sparks_left) ); break;
|
||||||
//KEEN3
|
//KEEN3
|
||||||
case OBJ_FOOB: foob_ai(i, pCKP); break;
|
case OBJ_FOOB: foob_ai(i, p_levelcontrol->hardmode); break;
|
||||||
case OBJ_NINJA: ninja_ai(i, pCKP); break;
|
case OBJ_NINJA: ninja_ai(i, p_levelcontrol->hardmode); break;
|
||||||
case OBJ_MEEP: meep_ai(i, pCKP->Control.levelcontrol); break;
|
case OBJ_MEEP: meep_ai(i, *p_levelcontrol); break;
|
||||||
case OBJ_SNDWAVE: sndwave_ai(i, pCKP); break;
|
case OBJ_SNDWAVE: sndwave_ai(i, p_levelcontrol->hardmode); break;
|
||||||
case OBJ_MOTHER: mother_ai(i, pCKP->Control.levelcontrol); break;
|
case OBJ_MOTHER: mother_ai(i, *p_levelcontrol); break;
|
||||||
case OBJ_FIREBALL: fireball_ai(i, pCKP->Control.levelcontrol.hardmode); break;
|
case OBJ_FIREBALL: fireball_ai(i, p_levelcontrol->hardmode); break;
|
||||||
case OBJ_BALL: ballandjack_ai(i); break;
|
case OBJ_BALL: ballandjack_ai(i); break;
|
||||||
case OBJ_JACK: ballandjack_ai(i); break;
|
case OBJ_JACK: ballandjack_ai(i); break;
|
||||||
case OBJ_PLATVERT: platvert_ai(i); break;
|
case OBJ_PLATVERT: platvert_ai(i); break;
|
||||||
@@ -296,7 +293,6 @@ int i, topobj;
|
|||||||
|
|
||||||
case OBJ_DEMOMSG: break;
|
case OBJ_DEMOMSG: break;
|
||||||
default:
|
default:
|
||||||
//crash("gamedo_enemy_ai: Object %d is of invalid type %d\n", i, objects[i].type);
|
|
||||||
g_pLogFile->ftextOut("gamedo_enemy_ai: Object %d is of invalid type %d\n", i, objects[i].type);
|
g_pLogFile->ftextOut("gamedo_enemy_ai: Object %d is of invalid type %d\n", i, objects[i].type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -466,7 +462,7 @@ int cplayer;
|
|||||||
|
|
||||||
int savew, saveh;
|
int savew, saveh;
|
||||||
|
|
||||||
void gamedo_render_drawobjects(stCloneKeenPlus *pCKP)
|
void gamedo_render_drawobjects()
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int x,y,o,tl,xsize,ysize;
|
int x,y,o,tl,xsize,ysize;
|
||||||
@@ -479,14 +475,11 @@ int xa,ya;
|
|||||||
o = player[i].useObject;
|
o = player[i].useObject;
|
||||||
|
|
||||||
if (!player[i].hideplayer)
|
if (!player[i].hideplayer)
|
||||||
{
|
|
||||||
objects[o].sprite = player[i].playframe + playerbaseframes[i];
|
objects[o].sprite = player[i].playframe + playerbaseframes[i];
|
||||||
}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
objects[o].sprite = BlankSprite;
|
objects[o].sprite = BlankSprite;
|
||||||
}
|
|
||||||
objects[o].x = player[i].x;
|
objects[o].x = player[i].x;
|
||||||
objects[o].y = player[i].y;
|
objects[o].y = player[i].y;
|
||||||
objects[o].scrx = (player[i].x>>CSF)-scroll_x;
|
objects[o].scrx = (player[i].x>>CSF)-scroll_x;
|
||||||
@@ -496,7 +489,9 @@ int xa,ya;
|
|||||||
|
|
||||||
// if we're playing a demo keep the "DEMO" message on the screen
|
// if we're playing a demo keep the "DEMO" message on the screen
|
||||||
// as an object
|
// as an object
|
||||||
if (pCKP->Control.levelcontrol.demomode==DEMO_PLAYBACK)
|
// TODO: It would be better to add this demo message as on object, like the other stuff that is shown
|
||||||
|
// This still must be done...
|
||||||
|
/*if (show_demo_title)
|
||||||
{
|
{
|
||||||
#define DEMO_X_POS 137
|
#define DEMO_X_POS 137
|
||||||
#define DEMO_Y_POS 6
|
#define DEMO_Y_POS 6
|
||||||
@@ -508,7 +503,7 @@ int xa,ya;
|
|||||||
objects[DemoObjectHandle].y = (DEMO_Y_POS+scroll_y)<<CSF;
|
objects[DemoObjectHandle].y = (DEMO_Y_POS+scroll_y)<<CSF;
|
||||||
objects[DemoObjectHandle].honorPriority = 0;
|
objects[DemoObjectHandle].honorPriority = 0;
|
||||||
}
|
}
|
||||||
else objects[DemoObjectHandle].exists = 0;
|
else objects[DemoObjectHandle].exists = 0;*/
|
||||||
|
|
||||||
// draw all objects. drawn in reverse order because the player sprites
|
// draw all objects. drawn in reverse order because the player sprites
|
||||||
// are in the first few indexes and we want them to come out on top.
|
// are in the first few indexes and we want them to come out on top.
|
||||||
@@ -668,34 +663,33 @@ extern int NumConsoleMessages;
|
|||||||
// draws sprites, players, and debug messages (if debug mode is on),
|
// draws sprites, players, and debug messages (if debug mode is on),
|
||||||
// performs frameskipping and blits the display as needed,
|
// performs frameskipping and blits the display as needed,
|
||||||
// at end of functions erases all drawn objects from the scrollbuf.
|
// at end of functions erases all drawn objects from the scrollbuf.
|
||||||
void gamedo_RenderScreen(stCloneKeenPlus *pCKP)
|
|
||||||
|
void gamedo_RenderScreen()
|
||||||
{
|
{
|
||||||
int x,y,bmnum;
|
//int x,y, bmnum;
|
||||||
|
|
||||||
g_pGraphics->renderHQBitmap();
|
g_pGraphics->renderHQBitmap();
|
||||||
|
|
||||||
if(pCKP != NULL)
|
//if(pCKP != NULL)
|
||||||
{
|
//{
|
||||||
gamedo_render_drawobjects(pCKP);
|
gamedo_render_drawobjects();
|
||||||
|
|
||||||
if (pCKP->Control.levelcontrol.gameovermode)
|
//if (pCKP->Control.levelcontrol.gameovermode)
|
||||||
|
// TODO: make this Bitmap also a object or tile to be added.
|
||||||
|
/*if (special_bitmap == GAMEOVER_BITMAP)
|
||||||
{
|
{
|
||||||
// figure out where to center the gameover bitmap and draw it
|
// figure out where to center the gameover bitmap and draw it
|
||||||
bmnum = g_pGraphics->getBitmapNumberFromName("GAMEOVER");
|
bmnum = g_pGraphics->getBitmapNumberFromName("GAMEOVER");
|
||||||
x = (320/2)-(bitmaps[bmnum].xsize/2);
|
x = (320/2)-(bitmaps[bmnum].xsize/2);
|
||||||
y = (200/2)-(bitmaps[bmnum].ysize/2);
|
y = (200/2)-(bitmaps[bmnum].ysize/2);
|
||||||
g_pGraphics->drawBitmap(x, y, bmnum);
|
g_pGraphics->drawBitmap(x, y, bmnum);
|
||||||
}
|
}*/
|
||||||
}
|
//}
|
||||||
|
|
||||||
g_pVideoDriver->sb_blit(); // blit scrollbuffer to display
|
g_pVideoDriver->sb_blit(); // blit scrollbuffer to display
|
||||||
|
|
||||||
|
gamedo_render_erasedebug();
|
||||||
if(pCKP != NULL)
|
gamedo_render_eraseobjects();
|
||||||
{
|
|
||||||
gamedo_render_erasedebug();
|
|
||||||
gamedo_render_eraseobjects();
|
|
||||||
}
|
|
||||||
|
|
||||||
curfps++;
|
curfps++;
|
||||||
}
|
}
|
||||||
@@ -884,17 +878,17 @@ void gamedo_fades(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gamedo_frameskipping(stCloneKeenPlus *pCKP)
|
void gamedo_frameskipping()
|
||||||
{
|
{
|
||||||
if (framebyframe)
|
if (framebyframe)
|
||||||
{
|
{
|
||||||
gamedo_RenderScreen(pCKP);
|
gamedo_RenderScreen();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frameskiptimer >= g_pVideoDriver->getFrameskip())
|
if (frameskiptimer >= g_pVideoDriver->getFrameskip())
|
||||||
{
|
{
|
||||||
gamedo_RenderScreen(pCKP);
|
gamedo_RenderScreen();
|
||||||
frameskiptimer = 0;
|
frameskiptimer = 0;
|
||||||
} else frameskiptimer++;
|
} else frameskiptimer++;
|
||||||
|
|
||||||
@@ -902,7 +896,7 @@ void gamedo_frameskipping(stCloneKeenPlus *pCKP)
|
|||||||
|
|
||||||
// same as above but only does a sb_blit, not the full RenderScreen.
|
// same as above but only does a sb_blit, not the full RenderScreen.
|
||||||
// used for intros etc.
|
// used for intros etc.
|
||||||
void gamedo_frameskipping_blitonly(void)
|
void gamedo_frameskipping_blitonly()
|
||||||
{
|
{
|
||||||
if (framebyframe)
|
if (framebyframe)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ void gamepdo_dieanim(int cp, stCloneKeenPlus *pCKP)
|
|||||||
player[cp].pdie = PDIE_DEAD;
|
player[cp].pdie = PDIE_DEAD;
|
||||||
if (player[cp].inventory.lives<0)
|
if (player[cp].inventory.lives<0)
|
||||||
{
|
{
|
||||||
SetGameOver(pCKP);
|
pCKP->Control.levelcontrol.gameovermode = true;
|
||||||
|
g_pSound->playSound(SOUND_GAME_OVER, PLAY_NOW);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -284,7 +285,7 @@ void gamepdo_ProcessInput(unsigned int cp, stCloneKeenPlus *pCKP)
|
|||||||
g_pTimer->SpeedThrottle();
|
g_pTimer->SpeedThrottle();
|
||||||
gamedo_fades();
|
gamedo_fades();
|
||||||
|
|
||||||
gamedo_render_drawobjects(pCKP);
|
gamedo_render_drawobjects();
|
||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
PauseDialog->renderDialog();
|
PauseDialog->renderDialog();
|
||||||
gamedo_frameskipping_blitonly();
|
gamedo_frameskipping_blitonly();
|
||||||
|
|||||||
@@ -49,14 +49,14 @@ void gamepdo_wm_HandlePlayer(int cp, stCloneKeenPlus *pCKP)
|
|||||||
AllowMountUnmountNessie(cp);
|
AllowMountUnmountNessie(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
gamepdo_wm_SelectFrame(cp, pCKP);
|
gamepdo_wm_SelectFrame(cp);
|
||||||
|
|
||||||
// copy player's keytable to lastkeytable
|
// copy player's keytable to lastkeytable
|
||||||
memcpy(&player[cp].lastkeytable, &player[cp].keytable, sizeof(player[cp].lastkeytable));
|
memcpy(&player[cp].lastkeytable, &player[cp].keytable, sizeof(player[cp].lastkeytable));
|
||||||
}
|
}
|
||||||
|
|
||||||
// select the appropriate player frame based on what he's doing
|
// select the appropriate player frame based on what he's doing
|
||||||
void gamepdo_wm_SelectFrame(int cp, stCloneKeenPlus *pCKP)
|
void gamepdo_wm_SelectFrame(int cp)
|
||||||
{
|
{
|
||||||
// select base frame for current direction
|
// select base frame for current direction
|
||||||
if (player[cp].pshowdir==RIGHT) player[cp].playframe = PMAPRIGHTFRAME;
|
if (player[cp].pshowdir==RIGHT) player[cp].playframe = PMAPRIGHTFRAME;
|
||||||
@@ -64,9 +64,6 @@ void gamepdo_wm_SelectFrame(int cp, stCloneKeenPlus *pCKP)
|
|||||||
else if (player[cp].pshowdir==UP) player[cp].playframe = PMAPUPFRAME;
|
else if (player[cp].pshowdir==UP) player[cp].playframe = PMAPUPFRAME;
|
||||||
else if (player[cp].pshowdir==DOWN) player[cp].playframe = PMAPDOWNFRAME;
|
else if (player[cp].pshowdir==DOWN) player[cp].playframe = PMAPDOWNFRAME;
|
||||||
|
|
||||||
// episode 3 map frames start at 31, ep1&2 at 32
|
|
||||||
if (pCKP->Control.levelcontrol.episode==3) player[cp].playframe--;
|
|
||||||
|
|
||||||
// no walking animation if we're fading
|
// no walking animation if we're fading
|
||||||
if (fade.mode != NO_FADE) return;
|
if (fade.mode != NO_FADE) return;
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ struct stLevelControl
|
|||||||
int curlevel; // number of current level
|
int curlevel; // number of current level
|
||||||
char success; // 1 if level was finished, 0 if he died
|
char success; // 1 if level was finished, 0 if he died
|
||||||
char isfinallevel; // 1 if this is the final level
|
char isfinallevel; // 1 if this is the final level
|
||||||
char canexit; // 1 if player is allowed to use the exit door
|
bool canexit; // true if player is allowed to use the exit door
|
||||||
char gameovermode; // 1 if "Game Over" is displayed
|
char gameovermode; // 1 if "Game Over" is displayed
|
||||||
char dokeensleft; // 1 if we need to do the "Keens Left"
|
bool dokeensleft; // 1 if we need to do the "Keens Left"
|
||||||
bool dark; // true if level is currently dark (lights are out)
|
bool dark; // true if level is currently dark (lights are out)
|
||||||
|
|
||||||
int episode; // which episode we're playing (1-3)
|
int episode; // which episode we're playing (1-3)
|
||||||
@@ -69,7 +69,7 @@ struct stLevelControl
|
|||||||
int sparks_left;
|
int sparks_left;
|
||||||
|
|
||||||
|
|
||||||
// if 1, a moving platform is currently extending/retracting (ep2)
|
// if true, a moving platform is currently extending/retracting (ep2)
|
||||||
bool PlatExtending;
|
bool PlatExtending;
|
||||||
|
|
||||||
// if > 0, the screen will shake and it will decrement each frame.
|
// if > 0, the screen will shake and it will decrement each frame.
|
||||||
|
|||||||
@@ -8,35 +8,35 @@
|
|||||||
// .ai functions
|
// .ai functions
|
||||||
// ep1
|
// ep1
|
||||||
void yorp_ai(int o, stLevelControl levelcontrol);
|
void yorp_ai(int o, stLevelControl levelcontrol);
|
||||||
void garg_ai(int o, stCloneKeenPlus *pCKP);
|
void garg_ai(int o, bool hardmode);
|
||||||
void vort_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol);
|
void vort_ai(int o, stLevelControl *p_levelcontrol);
|
||||||
void butler_ai(int o, bool hardmode);
|
void butler_ai(int o, bool hardmode);
|
||||||
void tank_ai(int o, bool hardmode);
|
void tank_ai(int o, bool hardmode);
|
||||||
void ray_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol);
|
void ray_ai(int o, int episode);
|
||||||
void icechunk_ai(int o);
|
void icechunk_ai(int o);
|
||||||
void icebit_ai(int o);
|
void icebit_ai(int o);
|
||||||
void icecannon_ai(int o);
|
void icecannon_ai(int o);
|
||||||
void door_ai(int o, char DoorOpenDir);
|
void door_ai(int o, char DoorOpenDir);
|
||||||
void teleporter_ai(int o, stLevelControl levelcontrol);
|
void teleporter_ai(int o, stLevelControl levelcontrol);
|
||||||
void rope_ai(int o);
|
void rope_ai(int o);
|
||||||
|
|
||||||
// ep2
|
// ep2
|
||||||
void walker_ai(int o, stLevelControl levelcontrol);
|
void walker_ai(int o, stLevelControl levelcontrol);
|
||||||
void tankep2_ai(int o, stCloneKeenPlus *pCKP);
|
void tankep2_ai(int o, bool hardmode);
|
||||||
void platform_ai(int o, stLevelControl levelcontrol);
|
void platform_ai(int o, stLevelControl levelcontrol);
|
||||||
void vortelite_ai(int o, bool darkness);
|
void vortelite_ai(int o, bool darkness);
|
||||||
void se_ai(int o, stCloneKeenPlus *pCKP);
|
void se_ai(int o, stLevelControl *p_levelcontrol);
|
||||||
void explosion_ai(int o);
|
void explosion_ai(int o);
|
||||||
void earthchunk_ai(int o);
|
void earthchunk_ai(int o);
|
||||||
void spark_ai(int o, int *p_sparks_left);
|
void spark_ai(int o, int *p_sparks_left);
|
||||||
|
|
||||||
// ep3
|
// ep3
|
||||||
void foob_ai(int o, bool hardmode);
|
void foob_ai(int o, bool hardmode);
|
||||||
void ninja_ai(int o, stCloneKeenPlus *pCKP);
|
void ninja_ai(int o, bool hardmode);
|
||||||
void meep_ai(int o, stLevelControl levelcontrol);
|
void meep_ai(int o, stLevelControl levelcontrol);
|
||||||
void sndwave_ai(int o, stCloneKeenPlus *pCKP);
|
void sndwave_ai(int o, bool hardmode);
|
||||||
void mother_ai(int o, stLevelControl levelcontrol);
|
void mother_ai(int o, stLevelControl levelcontrol);
|
||||||
void fireball_ai(int o, bool hard);
|
void fireball_ai(int o, bool hard);
|
||||||
void ballandjack_ai(int o);
|
void ballandjack_ai(int o);
|
||||||
void platvert_ai(int o);
|
void platvert_ai(int o);
|
||||||
void nessie_ai(int o);
|
void nessie_ai(int o);
|
||||||
|
|
||||||
void gamedo_enemyai(stCloneKeenPlus *pCKP);
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
/*
|
|
||||||
* eseq_ep1.h
|
|
||||||
*
|
|
||||||
* Created on: 02.01.2009
|
|
||||||
* Author: gerstrong
|
|
||||||
*/
|
|
||||||
|
|
||||||
int eseq1_ShipFlys(stCloneKeenPlus *pCKP);
|
|
||||||
void eseq_ToBeContinued(stCloneKeenPlus *pCKP);
|
|
||||||
int eseq1_ReturnsToShip(stCloneKeenPlus *pCKP);
|
|
||||||
int eseq1_BackAtHome(stCloneKeenPlus *pCKP);
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* eseq_ep2.h
|
|
||||||
*
|
|
||||||
* Created on: 02.01.2009
|
|
||||||
* Author: gerstrong
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CG_ESEQ_EP2_H__
|
|
||||||
#define __CG_ESEQ_EP2_H__
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
struct stCloneKeenPlus;
|
|
||||||
|
|
||||||
int eseq2_LimpsHome(stCloneKeenPlus *pCKP);
|
|
||||||
int eseq2_TantalusRay(stCloneKeenPlus *pCKP);
|
|
||||||
void eseq2_vibrate(stCloneKeenPlus *pCKP);
|
|
||||||
int eseq2_HeadsForEarth(stCloneKeenPlus *pCKP);
|
|
||||||
int eseq2_SnowedOutside(stCloneKeenPlus *pCKP);
|
|
||||||
void eseq_showmsg(const std::string& text, int boxleft, int boxtop, int boxwidth, int boxheight, char autodismiss, stCloneKeenPlus *pCKP);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
/*
|
|
||||||
* eseq_ep3.h
|
|
||||||
*
|
|
||||||
* Created on: 02.01.2009
|
|
||||||
* Author: gerstrong
|
|
||||||
*/
|
|
||||||
|
|
||||||
void eseq3_Mortimer(stCloneKeenPlus *pCKP);
|
|
||||||
char eseq3_AwardBigV(stCloneKeenPlus *pCKP);
|
|
||||||
@@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
unsigned int loadmap(const std::string& filename, const std::string& path, int lvlnum, int isworldmap, stCloneKeenPlus *pCKP);
|
unsigned int loadmap(const std::string& filename, const std::string& path,
|
||||||
|
int lvlnum, stLevelControl* p_levelcontrol);
|
||||||
void addmaptile(unsigned int t);
|
void addmaptile(unsigned int t);
|
||||||
void addenemytile(unsigned int t, stCloneKeenPlus *pCKP);
|
void addenemytile(unsigned int t, stCloneKeenPlus *pCKP);
|
||||||
short checkConsistencyofGameData(stGameData *p_GameData);
|
short checkConsistencyofGameData(stGameData *p_GameData);
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ DOWN
|
|||||||
#define PSUPPORTEDBYOBJECT 0
|
#define PSUPPORTEDBYOBJECT 0
|
||||||
|
|
||||||
void gameloop(stCloneKeenPlus *pCKP);
|
void gameloop(stCloneKeenPlus *pCKP);
|
||||||
void gameloop_initialize(stCloneKeenPlus *pCKP);
|
void gameloop_initialize(int episode, bool show_keensleft);
|
||||||
void initsprites(stCloneKeenPlus *pCKP, int s);
|
void initsprites(stCloneKeenPlus *pCKP, int s);
|
||||||
void keen_get_goodie(int px, int py, int theplayer, stCloneKeenPlus *pCKP);
|
void keen_get_goodie(int px, int py, int theplayer, stCloneKeenPlus *pCKP);
|
||||||
void procgoodie(int t, int mpx, int mpy, int theplayer, stCloneKeenPlus *pCKP);
|
void procgoodie(int t, int mpx, int mpy, int theplayer, stCloneKeenPlus *pCKP);
|
||||||
@@ -255,7 +255,6 @@ void procgoodie(int t, int mpx, int mpy, int theplayer, stCloneKeenPlus *pCKP);
|
|||||||
void recalc_highest_objslot(void);
|
void recalc_highest_objslot(void);
|
||||||
char IsStopPoint(int x, int y, int o);
|
char IsStopPoint(int x, int y, int o);
|
||||||
|
|
||||||
void initgame(stCloneKeenPlus *pCKP);
|
|
||||||
int initgamefirsttime(stCloneKeenPlus *pCKP, int s);
|
int initgamefirsttime(stCloneKeenPlus *pCKP, int s);
|
||||||
|
|
||||||
void open_door(int doortile, int doorsprite, int mpx, int mpy, int cp, stCloneKeenPlus *pCKP);
|
void open_door(int doortile, int doorsprite, int mpx, int mpy, int cp, stCloneKeenPlus *pCKP);
|
||||||
@@ -264,7 +263,11 @@ void PlayerTouchedExit(int theplayer, stCloneKeenPlus *pCKP);
|
|||||||
|
|
||||||
void endlevel(int reason_for_leaving, stLevelControl *levelcontrol);
|
void endlevel(int reason_for_leaving, stLevelControl *levelcontrol);
|
||||||
|
|
||||||
void SetGameOver(stCloneKeenPlus *pCKP);
|
|
||||||
char checkissolidl(int x, int y, int cp, stCloneKeenPlus *pCKP);
|
char checkissolidl(int x, int y, int cp, stCloneKeenPlus *pCKP);
|
||||||
char checkissolidr(int x, int y, int cp, stCloneKeenPlus *pCKP);
|
char checkissolidr(int x, int y, int cp, stCloneKeenPlus *pCKP);
|
||||||
|
|
||||||
|
void gamedo_enemyai(stLevelControl *p_levelcontrol);
|
||||||
|
|
||||||
|
// Referenzed from cinematics/EndingSequenceEp3.cpp
|
||||||
|
void eseq3_Mortimer();
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
|
void gamedo_RenderScreen();
|
||||||
|
|
||||||
void gamedo_RenderScreen(stCloneKeenPlus *pCKP);
|
|
||||||
void gamedo_frameskipping(stCloneKeenPlus *pCKP);
|
void gamedo_frameskipping();
|
||||||
void gamedo_HandleFKeys(stCloneKeenPlus *pCKP);
|
void gamedo_HandleFKeys(stCloneKeenPlus *pCKP);
|
||||||
void gamedo_frameskipping_blitonly(void);
|
void gamedo_frameskipping_blitonly();
|
||||||
void gamedo_getInput(stCloneKeenPlus *pCKP);
|
void gamedo_getInput(stLevelControl *p_levelcontrol);
|
||||||
void gamedo_render_drawobjects(stCloneKeenPlus *pCKP);
|
|
||||||
|
void gamedo_render_drawobjects();
|
||||||
|
|
||||||
// Enemies AI Functions used in gamepdo.cpp
|
// Enemies AI Functions used in gamepdo.cpp
|
||||||
void baby_ai(int o, int episode, bool hard);
|
void baby_ai(int o, int episode, bool hard);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ void gamepdo_wm_HandlePlayer(int cp, stCloneKeenPlus *pCKP);
|
|||||||
void gamepdo_InertiaAndFriction_Y(int cp, stCloneKeenPlus *pCKP);
|
void gamepdo_InertiaAndFriction_Y(int cp, stCloneKeenPlus *pCKP);
|
||||||
void gamepdo_InertiaAndFriction_X(unsigned int cp, stCloneKeenPlus *pCKP);
|
void gamepdo_InertiaAndFriction_X(unsigned int cp, stCloneKeenPlus *pCKP);
|
||||||
void gamepdo_wm_AllowEnterLevel(int cp, stCloneKeenPlus *pCKP);
|
void gamepdo_wm_AllowEnterLevel(int cp, stCloneKeenPlus *pCKP);
|
||||||
void gamepdo_wm_SelectFrame(int cp, stCloneKeenPlus *pCKP);
|
void gamepdo_wm_SelectFrame(int cp);
|
||||||
void gamepdo_wm_setblockedlrud(int cp, stCloneKeenPlus *pCKP);
|
void gamepdo_wm_setblockedlrud(int cp, stCloneKeenPlus *pCKP);
|
||||||
void gamepdo_wm_setdir(int cp, stCloneKeenPlus *pCKP);
|
void gamepdo_wm_setdir(int cp, stCloneKeenPlus *pCKP);
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ char controlsmenu(stCloneKeenPlus *pCKP);
|
|||||||
int mainmenu(stCloneKeenPlus *pCKP,int defaultopt);
|
int mainmenu(stCloneKeenPlus *pCKP,int defaultopt);
|
||||||
char configmenu(stCloneKeenPlus *pCKP);
|
char configmenu(stCloneKeenPlus *pCKP);
|
||||||
bool loadStartMenu(stCloneKeenPlus *pCKP);
|
bool loadStartMenu(stCloneKeenPlus *pCKP);
|
||||||
void keensleft(stCloneKeenPlus *pCKP);
|
void keensleft(int episode);
|
||||||
void showmapatpos(int level, int xoff, int yoff, int wm, stCloneKeenPlus *pCKP);
|
void showmapatpos(int level, int xoff, int yoff, stCloneKeenPlus *pCKP);
|
||||||
short loadResourcesforStartMenu(stCloneKeenPlus *pCKP, CGame *Game);
|
short loadResourcesforStartMenu(stCloneKeenPlus *pCKP, CGame *Game);
|
||||||
int getDifficulty(stCloneKeenPlus *pCKP);
|
int getDifficulty(stCloneKeenPlus *pCKP);
|
||||||
void showPage(const std::string& str_text, stCloneKeenPlus *pCKP, int textsize);
|
void showPage(const std::string& str_text, stCloneKeenPlus *pCKP, int textsize);
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
|
// Reference from game.cpp
|
||||||
|
void initgame(stLevelControl *p_levelcontrol);
|
||||||
|
|
||||||
void cleanup(stCloneKeenPlus *CKP);
|
void cleanup(stCloneKeenPlus *CKP);
|
||||||
void showinventory(int p, stCloneKeenPlus *pCKP);
|
void showinventory(int p, stCloneKeenPlus *pCKP);
|
||||||
void YourShipNeedsTheseParts(stCloneKeenPlus *pCKP);
|
void YourShipNeedsTheseParts(stCloneKeenPlus *pCKP);
|
||||||
void ShipEp3(stCloneKeenPlus *pCKP);
|
void ShipEp3(stCloneKeenPlus *pCKP);
|
||||||
int endsequence(stCloneKeenPlus *pCKP);
|
|
||||||
void youseeinyourmind(int mpx, int mpy, stCloneKeenPlus *pCKP);
|
void youseeinyourmind(int mpx, int mpy, stCloneKeenPlus *pCKP);
|
||||||
void VorticonElder(int mpx, int mpy, stCloneKeenPlus *pCKP);
|
void VorticonElder(int mpx, int mpy, stCloneKeenPlus *pCKP);
|
||||||
char save_slot_box(int issave, stCloneKeenPlus *pCKP);
|
char save_slot_box(int issave, stCloneKeenPlus *pCKP);
|
||||||
void game_save_interface(stCloneKeenPlus *pCKP);
|
void game_save_interface(stCloneKeenPlus *pCKP);
|
||||||
int VerifyQuit(stCloneKeenPlus *pCKP);
|
int VerifyQuit();
|
||||||
char gameiswon(stCloneKeenPlus *pCKP);
|
char gameiswon(stCloneKeenPlus *pCKP);
|
||||||
void game_save(char *fname, stCloneKeenPlus *pCKP);
|
void game_save(char *fname, stCloneKeenPlus *pCKP);
|
||||||
int game_load(char *fname, stCloneKeenPlus *pCKP);
|
int game_load(char *fname, stCloneKeenPlus *pCKP);
|
||||||
@@ -16,3 +17,5 @@ void showTextMB(int lines, char **text, stCloneKeenPlus *pCKP);
|
|||||||
void showGameHint(int mpx, int mpy, int episode, int level);
|
void showGameHint(int mpx, int mpy, int episode, int level);
|
||||||
|
|
||||||
unsigned int rnd(void);
|
unsigned int rnd(void);
|
||||||
|
|
||||||
|
void endsequence_start(int episode);
|
||||||
|
|||||||
@@ -104,12 +104,12 @@ typedef struct stFade
|
|||||||
typedef struct stMap
|
typedef struct stMap
|
||||||
{
|
{
|
||||||
unsigned int xsize, ysize; // size of the map
|
unsigned int xsize, ysize; // size of the map
|
||||||
unsigned char isworldmap; // if 1, this is the world map
|
bool isworldmap; // if 1, this is the world map
|
||||||
unsigned int mapdata[256][256]; // the map data
|
unsigned int mapdata[256][256]; // the map data
|
||||||
// in-game, contains monsters and special object tags like for switches
|
// in-game, contains monsters and special object tags like for switches
|
||||||
// on world map contains level numbers and flags for things like teleporters
|
// on world map contains level numbers and flags for things like teleporters
|
||||||
unsigned int objectlayer[256][256];
|
unsigned int objectlayer[256][256];
|
||||||
char firsttime; // used when generating multiplayer positions on world map
|
bool firsttime; // used when generating multiplayer positions on world map
|
||||||
} stMap;
|
} stMap;
|
||||||
|
|
||||||
struct stBitmap
|
struct stBitmap
|
||||||
|
|||||||
19
src/main.cpp
19
src/main.cpp
@@ -36,7 +36,6 @@
|
|||||||
#include "include/menu.h"
|
#include "include/menu.h"
|
||||||
#include "sdl/CVideoDriver.h"
|
#include "sdl/CVideoDriver.h"
|
||||||
#include "include/game.h"
|
#include "include/game.h"
|
||||||
#include "include/eseq_ep2.h"
|
|
||||||
#include "include/fileio.h"
|
#include "include/fileio.h"
|
||||||
#include "include/fileio/story.h"
|
#include "include/fileio/story.h"
|
||||||
#include "include/main.h"
|
#include "include/main.h"
|
||||||
@@ -289,6 +288,11 @@ short closeCKP(stCloneKeenPlus *pCKP)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prototypes needed for playgame_levelmanager
|
||||||
|
int eseq2_TantalusRay(stCloneKeenPlus *pCKP);
|
||||||
|
void eseq2_vibrate();
|
||||||
|
|
||||||
|
|
||||||
void playgame_levelmanager(stCloneKeenPlus *pCKP)
|
void playgame_levelmanager(stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
int i, o, wm, firsttime = 1;
|
int i, o, wm, firsttime = 1;
|
||||||
@@ -313,7 +317,7 @@ void playgame_levelmanager(stCloneKeenPlus *pCKP)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
initgame(pCKP);
|
initgame( &(pCKP->Control.levelcontrol) );
|
||||||
|
|
||||||
newlevel = p_levelcontrol->chglevelto;
|
newlevel = p_levelcontrol->chglevelto;
|
||||||
if (p_levelcontrol->episode==1 && p_levelcontrol->hardmode)
|
if (p_levelcontrol->episode==1 && p_levelcontrol->hardmode)
|
||||||
@@ -337,7 +341,8 @@ void playgame_levelmanager(stCloneKeenPlus *pCKP)
|
|||||||
wm = 0;
|
wm = 0;
|
||||||
}
|
}
|
||||||
p_levelcontrol->canexit = 1; // assume can exit before loading map
|
p_levelcontrol->canexit = 1; // assume can exit before loading map
|
||||||
if (loadmap(levelname, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory, p_levelcontrol->chglevelto, wm, pCKP))
|
|
||||||
|
if (loadmap(levelname, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory, newlevel, p_levelcontrol))
|
||||||
{
|
{
|
||||||
crashflag = 1;
|
crashflag = 1;
|
||||||
crashflag2 = p_levelcontrol->chglevelto;
|
crashflag2 = p_levelcontrol->chglevelto;
|
||||||
@@ -487,7 +492,7 @@ void playgame_levelmanager(stCloneKeenPlus *pCKP)
|
|||||||
}
|
}
|
||||||
else if (p_levelcontrol->command==LVLC_TANTALUS_RAY)
|
else if (p_levelcontrol->command==LVLC_TANTALUS_RAY)
|
||||||
{
|
{
|
||||||
eseq2_vibrate(pCKP);
|
eseq2_vibrate();
|
||||||
eseq2_TantalusRay(pCKP);
|
eseq2_TantalusRay(pCKP);
|
||||||
IntroCanceled = 1; // popup main menu immediately
|
IntroCanceled = 1; // popup main menu immediately
|
||||||
}
|
}
|
||||||
@@ -548,12 +553,12 @@ gotEOF: ;
|
|||||||
p_levelcontrol->command = LVLC_NOCOMMAND;
|
p_levelcontrol->command = LVLC_NOCOMMAND;
|
||||||
|
|
||||||
initgamefirsttime(pCKP, s);
|
initgamefirsttime(pCKP, s);
|
||||||
initgame(pCKP);
|
initgame( &(pCKP->Control.levelcontrol) );
|
||||||
|
|
||||||
// now load the map and play the level
|
// now load the map and play the level
|
||||||
sprintf(filename, "level%02d.ck%d", p_levelcontrol->curlevel, p_levelcontrol->episode);
|
sprintf(filename, "level%02d.ck%d", p_levelcontrol->curlevel, p_levelcontrol->episode);
|
||||||
if (loadmap(filename, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory,
|
if ( loadmap(filename, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory,
|
||||||
p_levelcontrol->curlevel, 0, pCKP)) return DEMO_RESULT_FILE_BAD;
|
p_levelcontrol->curlevel, &(pCKP->Control.levelcontrol)) ) return DEMO_RESULT_FILE_BAD;
|
||||||
|
|
||||||
for(i=0;i<NUM_OPTIONS;i++) SaveOptions[i] = p_option[i].value;
|
for(i=0;i<NUM_OPTIONS;i++) SaveOptions[i] = p_option[i].value;
|
||||||
// SetDefaultOptions();
|
// SetDefaultOptions();
|
||||||
|
|||||||
50
src/menu.cpp
50
src/menu.cpp
@@ -11,7 +11,6 @@
|
|||||||
#include "include/gamedo.h"
|
#include "include/gamedo.h"
|
||||||
#include "sdl/CTimer.h"
|
#include "sdl/CTimer.h"
|
||||||
#include "sdl/sound/CSound.h"
|
#include "sdl/sound/CSound.h"
|
||||||
#include "include/eseq_ep2.h"
|
|
||||||
#include "include/fileio.h"
|
#include "include/fileio.h"
|
||||||
#include "include/gm_pdowm.h"
|
#include "include/gm_pdowm.h"
|
||||||
#include "include/gamedo.h"
|
#include "include/gamedo.h"
|
||||||
@@ -34,15 +33,15 @@
|
|||||||
|
|
||||||
short openDlgStruct(stDlgStruct *pDlgStruct, stCloneKeenPlus *pCKP);
|
short openDlgStruct(stDlgStruct *pDlgStruct, stCloneKeenPlus *pCKP);
|
||||||
|
|
||||||
void showmapatpos(int level, int xoff, int yoff, int wm, stCloneKeenPlus *pCKP)
|
void showmapatpos(int level, int xoff, int yoff, stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
std::string levelname;
|
std::string levelname;
|
||||||
g_pLogFile->ftextOut("showmapatpos(%d, %d, %d, %d);<br>",level,xoff,yoff,wm);
|
g_pLogFile->ftextOut("showmapatpos(%d, %d, %d);<br>",level,xoff,yoff);
|
||||||
pCKP->Control.levelcontrol.dark = 0;
|
pCKP->Control.levelcontrol.dark = 0;
|
||||||
g_pGraphics->initPalette(pCKP->Control.levelcontrol.dark);
|
g_pGraphics->initPalette(pCKP->Control.levelcontrol.dark);
|
||||||
|
|
||||||
initgame(pCKP); // reset scroll
|
initgame( &(pCKP->Control.levelcontrol) ); // reset scroll
|
||||||
levelname = "level" + FixedWidthStr_LeftFill(itoa(level), 2, '0') + ".ck" + itoa(pCKP->Control.levelcontrol.episode);
|
levelname = "level" + FixedWidthStr_LeftFill(itoa(level), 2, '0') + ".ck" + itoa(pCKP->Control.levelcontrol.episode);
|
||||||
|
|
||||||
short numsel;
|
short numsel;
|
||||||
@@ -51,7 +50,7 @@ void showmapatpos(int level, int xoff, int yoff, int wm, stCloneKeenPlus *pCKP)
|
|||||||
else
|
else
|
||||||
numsel = pCKP->Resources.GameSelected-1;
|
numsel = pCKP->Resources.GameSelected-1;
|
||||||
|
|
||||||
if(loadmap(levelname, pCKP->GameData[numsel].DataDirectory, level, wm, pCKP) != 0)
|
if(loadmap(levelname, pCKP->GameData[numsel].DataDirectory, level, &(pCKP->Control.levelcontrol) ) != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
drawmap();
|
drawmap();
|
||||||
@@ -136,7 +135,7 @@ short loadResourcesforStartMenu(stCloneKeenPlus *pCKP, CGame *Game)
|
|||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
initgame(pCKP);
|
initgame( &(pCKP->Control.levelcontrol) );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -155,7 +154,7 @@ bool loadStartMenu(stCloneKeenPlus *pCKP)
|
|||||||
fade.dir = FADE_IN;
|
fade.dir = FADE_IN;
|
||||||
fade.curamt = 0;
|
fade.curamt = 0;
|
||||||
fade.fadetimer = 0;
|
fade.fadetimer = 0;
|
||||||
showmapatpos(90, (104 << 2)+256+256+80, 32-4, 0, pCKP);
|
showmapatpos(90, (104 << 2)+256+256+80, 32-4, pCKP);
|
||||||
|
|
||||||
// Prepare the Games Menu
|
// Prepare the Games Menu
|
||||||
GamesMenu = new CDialog();
|
GamesMenu = new CDialog();
|
||||||
@@ -235,7 +234,7 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
|
|||||||
fade.dir = FADE_IN;
|
fade.dir = FADE_IN;
|
||||||
fade.curamt = 0;
|
fade.curamt = 0;
|
||||||
fade.fadetimer = 0;
|
fade.fadetimer = 0;
|
||||||
showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP);
|
showmapatpos(90, MAINMENU_X, MENUS_Y, pCKP);
|
||||||
|
|
||||||
// Prepare the Games Menu
|
// Prepare the Games Menu
|
||||||
MainMenu = new CDialog();
|
MainMenu = new CDialog();
|
||||||
@@ -374,7 +373,7 @@ int getDifficulty(stCloneKeenPlus *pCKP)
|
|||||||
fade.curamt = 0;
|
fade.curamt = 0;
|
||||||
fade.fadetimer = 0;
|
fade.fadetimer = 0;
|
||||||
|
|
||||||
showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP);
|
showmapatpos(90, MAINMENU_X, MENUS_Y, pCKP);
|
||||||
|
|
||||||
// Load the Title Bitmap
|
// Load the Title Bitmap
|
||||||
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
||||||
@@ -440,7 +439,7 @@ int AudioDlg(stCloneKeenPlus *pCKP)
|
|||||||
int rate=0;
|
int rate=0;
|
||||||
short mode=0;
|
short mode=0;
|
||||||
|
|
||||||
showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP);
|
showmapatpos(90, MAINMENU_X, MENUS_Y, pCKP);
|
||||||
|
|
||||||
// Load the Title Bitmap
|
// Load the Title Bitmap
|
||||||
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
||||||
@@ -549,7 +548,7 @@ void OptionsDlg(stCloneKeenPlus *pCKP)
|
|||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP);
|
showmapatpos(90, MAINMENU_X, MENUS_Y, pCKP);
|
||||||
|
|
||||||
// Load the Title Bitmap
|
// Load the Title Bitmap
|
||||||
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
||||||
@@ -651,7 +650,7 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
|
|||||||
unsigned char autoframeskip = 0;
|
unsigned char autoframeskip = 0;
|
||||||
bool aspect;
|
bool aspect;
|
||||||
|
|
||||||
showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP);
|
showmapatpos(90, MAINMENU_X, MENUS_Y, pCKP);
|
||||||
|
|
||||||
// Load the Title Bitmap
|
// Load the Title Bitmap
|
||||||
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
||||||
@@ -898,7 +897,7 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
|
|||||||
Settings->saveDrvCfg();
|
Settings->saveDrvCfg();
|
||||||
delete Settings; Settings = NULL;
|
delete Settings; Settings = NULL;
|
||||||
|
|
||||||
showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP);
|
showmapatpos(90, MAINMENU_X, MENUS_Y, pCKP);
|
||||||
|
|
||||||
fade.mode = FADE_GO;
|
fade.mode = FADE_GO;
|
||||||
fade.dir = FADE_IN;
|
fade.dir = FADE_IN;
|
||||||
@@ -948,7 +947,7 @@ void showPage(const std::string& str_text, stCloneKeenPlus *pCKP, int textsize)
|
|||||||
|
|
||||||
memcpy(text,str_text.c_str(),textsize);
|
memcpy(text,str_text.c_str(),textsize);
|
||||||
|
|
||||||
showmapatpos(90, STORYBOARD_X, STORYBOARD_Y, 0, pCKP);
|
showmapatpos(90, STORYBOARD_X, STORYBOARD_Y, pCKP);
|
||||||
|
|
||||||
fade.mode = FADE_GO;
|
fade.mode = FADE_GO;
|
||||||
fade.rate = FADE_NORM;
|
fade.rate = FADE_NORM;
|
||||||
@@ -1075,7 +1074,7 @@ void showPage(const std::string& str_text, stCloneKeenPlus *pCKP, int textsize)
|
|||||||
fade.mode = FADE_GO;
|
fade.mode = FADE_GO;
|
||||||
}
|
}
|
||||||
|
|
||||||
gamedo_frameskipping(pCKP);
|
gamedo_frameskipping();
|
||||||
|
|
||||||
g_pInput->pollEvents();
|
g_pInput->pollEvents();
|
||||||
g_pTimer->SpeedThrottle();
|
g_pTimer->SpeedThrottle();
|
||||||
@@ -1096,7 +1095,7 @@ char configmenu(stCloneKeenPlus *pCKP)
|
|||||||
int selection;
|
int selection;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP);
|
showmapatpos(90, MAINMENU_X, MENUS_Y, pCKP);
|
||||||
|
|
||||||
// Load the Title Bitmap
|
// Load the Title Bitmap
|
||||||
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
||||||
@@ -1186,7 +1185,7 @@ char controlsmenu(stCloneKeenPlus *pCKP)
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
char buf2[256];
|
char buf2[256];
|
||||||
|
|
||||||
showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP);
|
showmapatpos(90, MAINMENU_X, MENUS_Y, pCKP);
|
||||||
|
|
||||||
// Load the Title Bitmap
|
// Load the Title Bitmap
|
||||||
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
|
||||||
@@ -1369,7 +1368,7 @@ char controlsmenu(stCloneKeenPlus *pCKP)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void keensleft(stCloneKeenPlus *pCKP)
|
void keensleft(int episode)
|
||||||
{
|
{
|
||||||
int enter, lastenterstate;
|
int enter, lastenterstate;
|
||||||
unsigned int p;
|
unsigned int p;
|
||||||
@@ -1377,24 +1376,17 @@ int x,y,i;
|
|||||||
int boxY, boxH;
|
int boxY, boxH;
|
||||||
int boxtimer;
|
int boxtimer;
|
||||||
|
|
||||||
stLevelControl *p_levelcontrol = &pCKP->Control.levelcontrol;
|
|
||||||
|
|
||||||
// on episode 3 we have to subtract one from the map tiles
|
|
||||||
// because the tiles start at 31, not 32 like on the other eps
|
|
||||||
int ep3 = 0;
|
|
||||||
if (p_levelcontrol->episode==3) ep3 = 1;
|
|
||||||
|
|
||||||
#define KEENSLEFT_TIME 400
|
#define KEENSLEFT_TIME 400
|
||||||
|
|
||||||
for(i=0;i<MAX_PLAYERS;i++)
|
for(i=0;i<MAX_PLAYERS;i++)
|
||||||
{
|
{
|
||||||
if (player[i].isPlaying)
|
if (player[i].isPlaying)
|
||||||
{
|
{
|
||||||
gamepdo_wm_SelectFrame(i, pCKP);
|
gamepdo_wm_SelectFrame(i);
|
||||||
player[i].hideplayer = 0;
|
player[i].hideplayer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gamedo_RenderScreen(pCKP);
|
gamedo_RenderScreen();
|
||||||
|
|
||||||
#define KEENSLEFT_X 7
|
#define KEENSLEFT_X 7
|
||||||
#define KEENSLEFT_Y 11
|
#define KEENSLEFT_Y 11
|
||||||
@@ -1414,7 +1406,9 @@ stLevelControl *p_levelcontrol = &pCKP->Control.levelcontrol;
|
|||||||
x = ((KEENSLEFT_X+1)*8)+4;
|
x = ((KEENSLEFT_X+1)*8)+4;
|
||||||
for(i=0;i<player[p].inventory.lives&&i<=10;i++)
|
for(i=0;i<player[p].inventory.lives&&i<=10;i++)
|
||||||
{
|
{
|
||||||
g_pGraphics->drawSprite_direct(x, y, PMAPDOWNFRAME+playerbaseframes[p]-ep3);
|
g_pGraphics->drawSprite_direct(x, y, PMAPDOWNFRAME+playerbaseframes[p]-
|
||||||
|
(episode==3));
|
||||||
|
// (episode==3) TODO: Check whether this is necessary
|
||||||
x+=16;
|
x+=16;
|
||||||
}
|
}
|
||||||
y+=18;
|
y+=18;
|
||||||
|
|||||||
79
src/misc.cpp
79
src/misc.cpp
@@ -18,9 +18,6 @@
|
|||||||
|
|
||||||
#include "include/misc.h"
|
#include "include/misc.h"
|
||||||
#include "include/game.h"
|
#include "include/game.h"
|
||||||
#include "include/eseq_ep1.h"
|
|
||||||
#include "include/eseq_ep2.h"
|
|
||||||
#include "include/eseq_ep3.h"
|
|
||||||
#include "include/gamedo.h"
|
#include "include/gamedo.h"
|
||||||
#include "CLogFile.h"
|
#include "CLogFile.h"
|
||||||
#include "CGraphics.h"
|
#include "CGraphics.h"
|
||||||
@@ -692,47 +689,6 @@ int i;
|
|||||||
if (i=='W') return 1; else return 0;
|
if (i=='W') return 1; else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
int game_load(char *fname)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
long i;
|
|
||||||
unsigned long scrx;
|
|
||||||
int scry;
|
|
||||||
|
|
||||||
fp = OpenGameFile(fname, "rb");
|
|
||||||
if (!fp) return 1;
|
|
||||||
|
|
||||||
// do the header and version check
|
|
||||||
if (fgetc(fp) != 'S') { fclose(fp); return 1; }
|
|
||||||
if (fgetc(fp) != SAVEGAMEVERSION) { fclose(fp); return 1; }
|
|
||||||
fgetc(fp); // iswm flag--not needed here
|
|
||||||
|
|
||||||
// save all necessary structures to the file
|
|
||||||
fread(&numplayers, sizeof(numplayers), 1, fp);
|
|
||||||
fread(&levelcontrol, sizeof(levelcontrol), 1, fp);
|
|
||||||
fread(&scrx, sizeof(scrx), 1, fp);
|
|
||||||
fread(&scry, sizeof(scry), 1, fp);
|
|
||||||
fread(&max_scroll_x, sizeof(max_scroll_x), 1, fp);
|
|
||||||
fread(&max_scroll_y, sizeof(max_scroll_y), 1, fp);
|
|
||||||
fread(&map, sizeof(map), 1, fp);
|
|
||||||
|
|
||||||
initgame(); // reset scroll
|
|
||||||
drawmap();
|
|
||||||
for(i=0;i<scrx;i++) map_scroll_right();
|
|
||||||
for(i=0;i<scry;i++) map_scroll_down();
|
|
||||||
|
|
||||||
fread(&player[0], sizeof(player[0]), numplayers, fp);
|
|
||||||
fread(&objects[0], sizeof(objects), 1, fp);
|
|
||||||
fread(&tiles[0], sizeof(tiles), 1, fp);
|
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
debugmode = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
int game_load(char *fname, stCloneKeenPlus *pCKP)
|
int game_load(char *fname, stCloneKeenPlus *pCKP)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -761,7 +717,7 @@ p_levelcontrol = &(pCKP->Control.levelcontrol);
|
|||||||
sgrle_decompress(fp, (unsigned char *)&max_scroll_y, sizeof(max_scroll_y));
|
sgrle_decompress(fp, (unsigned char *)&max_scroll_y, sizeof(max_scroll_y));
|
||||||
sgrle_decompress(fp, (unsigned char *)&map, sizeof(map));
|
sgrle_decompress(fp, (unsigned char *)&map, sizeof(map));
|
||||||
|
|
||||||
initgame(pCKP); // reset scroll
|
initgame( &(pCKP->Control.levelcontrol) ); // reset scroll
|
||||||
drawmap();
|
drawmap();
|
||||||
for(i=0;i<scrx;i++) map_scroll_right();
|
for(i=0;i<scrx;i++) map_scroll_right();
|
||||||
for(i=0;i<scry;i++) map_scroll_down();
|
for(i=0;i<scry;i++) map_scroll_down();
|
||||||
@@ -818,7 +774,7 @@ top: ;
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
||||||
gamedo_render_drawobjects(pCKP);
|
gamedo_render_drawobjects();
|
||||||
|
|
||||||
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
if (issave)
|
if (issave)
|
||||||
@@ -884,7 +840,7 @@ top: ;
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
||||||
gamedo_render_drawobjects(pCKP);
|
gamedo_render_drawobjects();
|
||||||
|
|
||||||
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
if (issave)
|
if (issave)
|
||||||
@@ -951,7 +907,7 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
waittimer++;
|
waittimer++;
|
||||||
if (waittimer > 5000) break;
|
if (waittimer > 5000) break;
|
||||||
|
|
||||||
gamedo_render_drawobjects(pCKP);
|
gamedo_render_drawobjects();
|
||||||
|
|
||||||
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
sb_dialogbox(dlgX,dlgY,dlgW,dlgH);
|
||||||
g_pGraphics->sb_font_draw( getstring("GameSaveSuccess"),(dlgX+1)<<3,(dlgY+1)<<3);
|
g_pGraphics->sb_font_draw( getstring("GameSaveSuccess"),(dlgX+1)<<3,(dlgY+1)<<3);
|
||||||
@@ -966,7 +922,7 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
map_redraw();
|
map_redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
int VerifyQuit(stCloneKeenPlus *pCKP)
|
int VerifyQuit()
|
||||||
{
|
{
|
||||||
int dlgX,dlgY,dlgW,dlgH;
|
int dlgX,dlgY,dlgW,dlgH;
|
||||||
std::string text;
|
std::string text;
|
||||||
@@ -983,7 +939,7 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
// loading a game that doesn't exist.
|
// loading a game that doesn't exist.
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
gamedo_render_drawobjects(pCKP);
|
gamedo_render_drawobjects();
|
||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
|
|
||||||
sb_dialogbox(dlgX, dlgY, dlgW, dlgH);
|
sb_dialogbox(dlgX, dlgY, dlgW, dlgH);
|
||||||
@@ -1015,29 +971,6 @@ int dlgX,dlgY,dlgW,dlgH;
|
|||||||
} while(1);
|
} while(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int endsequence(stCloneKeenPlus *pCKP)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (pCKP->Control.levelcontrol.episode==1)
|
|
||||||
{
|
|
||||||
if (eseq1_ReturnsToShip(pCKP)) return 0;
|
|
||||||
if (eseq1_ShipFlys(pCKP)) return 0;
|
|
||||||
eseq1_BackAtHome(pCKP);
|
|
||||||
}
|
|
||||||
else if (pCKP->Control.levelcontrol.episode==2)
|
|
||||||
{
|
|
||||||
if (eseq2_HeadsForEarth(pCKP)) return 0;
|
|
||||||
if (eseq2_LimpsHome(pCKP)) return 0;
|
|
||||||
if (eseq2_SnowedOutside(pCKP)) return 0;
|
|
||||||
}
|
|
||||||
else if (pCKP->Control.levelcontrol.episode==3)
|
|
||||||
{
|
|
||||||
if (eseq3_AwardBigV(pCKP)) return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AllPlayersInvisible(void)
|
void AllPlayersInvisible(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void CCredits::Render(stCloneKeenPlus *pCKP)
|
|||||||
fade.curamt = 0;
|
fade.curamt = 0;
|
||||||
fade.fadetimer = 0;
|
fade.fadetimer = 0;
|
||||||
|
|
||||||
showmapatpos(90, 104<<4, 32, 0, pCKP);
|
showmapatpos(90, 104<<4, 32, pCKP);
|
||||||
|
|
||||||
memset(scrolltext,0,51*80);
|
memset(scrolltext,0,51*80);
|
||||||
|
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ void CDialog::renderOpenDialogAnimation(int x,int y, int w, int h)
|
|||||||
drawDialogbox(mx,my,mw,mh);
|
drawDialogbox(mx,my,mw,mh);
|
||||||
|
|
||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
gamedo_frameskipping(NULL);
|
gamedo_frameskipping();
|
||||||
g_pTimer->SpeedThrottle();
|
g_pTimer->SpeedThrottle();
|
||||||
|
|
||||||
timer++;
|
timer++;
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ char CHighScores::showHighScore(void)
|
|||||||
loadHighScoreTable();
|
loadHighScoreTable();
|
||||||
|
|
||||||
// show High-score Frame
|
// show High-score Frame
|
||||||
showmapatpos(90, HIGHSCORETABLE_X, HIGHSCORETABLE_Y, 0, pCKP);
|
showmapatpos(90, HIGHSCORETABLE_X, HIGHSCORETABLE_Y, pCKP);
|
||||||
|
|
||||||
// Prepare some extra items if available (Ep1 + 2)
|
// Prepare some extra items if available (Ep1 + 2)
|
||||||
memset(ItemTiles,0,4*sizeof(int));
|
memset(ItemTiles,0,4*sizeof(int));
|
||||||
@@ -161,7 +161,7 @@ char CHighScores::showHighScore(void)
|
|||||||
|
|
||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
|
|
||||||
gamedo_frameskipping(pCKP);
|
gamedo_frameskipping();
|
||||||
|
|
||||||
g_pInput->pollEvents();
|
g_pInput->pollEvents();
|
||||||
g_pTimer->SpeedThrottle();
|
g_pTimer->SpeedThrottle();
|
||||||
@@ -189,7 +189,7 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
|
|||||||
loadHighScoreTable();
|
loadHighScoreTable();
|
||||||
|
|
||||||
// show High-score Frame
|
// show High-score Frame
|
||||||
showmapatpos(90, HIGHSCORETABLE_X, HIGHSCORETABLE_Y, 0, pCKP);
|
showmapatpos(90, HIGHSCORETABLE_X, HIGHSCORETABLE_Y, pCKP);
|
||||||
|
|
||||||
place=6;
|
place=6;
|
||||||
sscanf(Score[place],"%d",&num);
|
sscanf(Score[place],"%d",&num);
|
||||||
@@ -352,7 +352,7 @@ char CHighScores::writeHighScore(int points, bool *extras, int cities)
|
|||||||
|
|
||||||
gamedo_AnimatedTiles();
|
gamedo_AnimatedTiles();
|
||||||
|
|
||||||
gamedo_frameskipping(pCKP);
|
gamedo_frameskipping();
|
||||||
|
|
||||||
g_pInput->pollEvents();
|
g_pInput->pollEvents();
|
||||||
g_pTimer->SpeedThrottle();
|
g_pTimer->SpeedThrottle();
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void CIntro::Render(stCloneKeenPlus *pCKP)
|
|||||||
fade.curamt = 0;
|
fade.curamt = 0;
|
||||||
fade.fadetimer = 0;
|
fade.fadetimer = 0;
|
||||||
|
|
||||||
showmapatpos(90, 104<<4, 32, 0, pCKP);
|
showmapatpos(90, 104<<4, 32, pCKP);
|
||||||
|
|
||||||
// Load the Title Bitmap
|
// Load the Title Bitmap
|
||||||
bmnum[0] = g_pGraphics->getBitmapNumberFromName("AN");
|
bmnum[0] = g_pGraphics->getBitmapNumberFromName("AN");
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void COrderingInfo::Render(stCloneKeenPlus *pCKP)
|
|||||||
fade.curamt = 0;
|
fade.curamt = 0;
|
||||||
fade.fadetimer = 0;
|
fade.fadetimer = 0;
|
||||||
|
|
||||||
showmapatpos(90, 22<<4, 32, 0, pCKP);
|
showmapatpos(90, 22<<4, 32, pCKP);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user