diff --git a/changelog.txt b/changelog.txt index c76718869..4fd0030c7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,12 @@ -Commander Genius v0.2.9.5 Beta (CloneKeenPlus): +Commander Genius v0.2.9.6 Beta (CloneKeenPlus): ----------------------------------------------- +21-06-2009 +- Crash of scale4x and hi-resolutions has been fixed! (Iv4n) +- Added scale4x in software rendering mode (Iv4n) +- Fixed Crash when loading keen2 or 3 fixed! (Iv4n) +- Cixed some issues (Thanks to Iv4n!) + 20-06-2009 - Intro has been replaced and now is part of the About CG Option - The original Intro screen is now included in the interpreter diff --git a/future.txt b/future.txt index d23134dcf..5835afbda 100644 --- a/future.txt +++ b/future.txt @@ -4,6 +4,8 @@ Here are the features that I still want to implement: until 0.3: - Write a instruction keys manual in the readme file - tie up the code +- New Resolutions system +- Add 1920x1200, 1280x800, 1600x1200 until 0.4: - User folder detection and save the files there! diff --git a/readme.txt b/readme.txt index a14cac008..4a3624df2 100644 --- a/readme.txt +++ b/readme.txt @@ -10,7 +10,7 @@ * (c)2003-2005 Caitlin Shaw * * Released under GNU/GPL * * * -* Beta v0.2.9.5 * +* Beta v0.2.9.6 * * * ************************************* diff --git a/src/CGame.cpp b/src/CGame.cpp index da0b303fc..880221369 100644 --- a/src/CGame.cpp +++ b/src/CGame.cpp @@ -54,7 +54,6 @@ short CGame::runCycle(stCloneKeenPlus *pCKP) { CIntro Intro; Intro.Render(pCKP); - //if (intro(pCKP)){ pCKP->shutdown=SHUTDOWN_EXIT; return 0; } pCKP->Control.skipstarting=0; } @@ -147,16 +146,7 @@ short CGame::runCycle(stCloneKeenPlus *pCKP) break; case MAINMNU_NEW_GAME: - if(loadStartMenu(pCKP) == 1) - { - pCKP->shutdown = SHUTDOWN_EXIT; - break; - } - //loadResourcesforGame(pCKP); - loadResources(pCKP->Control.levelcontrol.episode, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory); - - - pCKP->shutdown = SHUTDOWN_RESTART; + pCKP->shutdown = SHUTDOWN_NEW_GAME; break; case MAINMNU_ABOUT: @@ -210,6 +200,9 @@ short CGame::runCycle(stCloneKeenPlus *pCKP) default: break; } + + if(pCKP->shutdown == SHUTDOWN_NEW_GAME) return 0; + g_pLogFile->ftextOut("bottom of game control loop opt=%d crashflag=%d
", opt, crashflag); if(pCKP->shutdown == SHUTDOWN_EXIT) break; } while(opt != MAINMNU_QUIT && opt != MAINMNU_NEW_GAME && !crashflag); diff --git a/src/CGraphics.cpp b/src/CGraphics.cpp index 5315d9b36..723888d92 100644 --- a/src/CGraphics.cpp +++ b/src/CGraphics.cpp @@ -529,6 +529,27 @@ unsigned char *bmdataptr; } } +void CGraphics::drawBitmap2FG(int xa, int ya, int b) +{ +int x,y; +unsigned char *bmdataptr; + + // for "b" arguments passed from GetBitmapNumberFromName(), + // in case the specified name was not found + if (b==-1) return; + + bmdataptr = bitmaps[b].bmptr; + for(y=0;ysetpixel((x+xa+scrollx_buf-130)&511,(y+ya+scrolly_buf-30)&511,*bmdataptr); + bmdataptr++; + } + } +} + + int CGraphics::getBitmapNumberFromName(const char *bmname) { diff --git a/src/CGraphics.h b/src/CGraphics.h index 84571d305..f4f99a5dd 100644 --- a/src/CGraphics.h +++ b/src/CGraphics.h @@ -41,6 +41,7 @@ public: void initPalette(int dark); void fadePalette(int fadeamt); void drawBitmap(int xa, int ya, int b); + void drawBitmap2FG(int xa, int ya, int b); int getBitmapNumberFromName(const char *bmname); void sb_drawCharacterinverse(int x, int y, int f); void drawFont(unsigned char *text, int xoff, int yoff, int highlight); diff --git a/src/CLogFile.h b/src/CLogFile.h index a663e7587..9a41ccf63 100644 --- a/src/CLogFile.h +++ b/src/CLogFile.h @@ -8,7 +8,7 @@ #ifndef CLOGFILE_H_ #define CLOGFILE_H_ -#define REVISION "CloneKeenPlus Beta v0.2.9.5 (Commander Genius)" +#define REVISION "CloneKeenPlus Beta v0.2.9.7 (Commander Genius)" #include #include "CSingleton.h" diff --git a/src/ai/baby.cpp b/src/ai/baby.cpp index bbc835d86..fd36e1eea 100644 --- a/src/ai/baby.cpp +++ b/src/ai/baby.cpp @@ -96,7 +96,7 @@ unsigned int ep3; // got hit? if (objects[o].zapped) { - if (objects[o].zapped > 1 || !options[OPT_MEAN].value) + if (objects[o].zapped > 1 || !levelcontrol.hardmode) { // we're fried!! if (objects[o].ai.baby.state != BABY_DYING) { diff --git a/src/ai/butler.cpp b/src/ai/butler.cpp index 9e211da01..696d47e8c 100644 --- a/src/ai/butler.cpp +++ b/src/ai/butler.cpp @@ -30,7 +30,7 @@ #define BUTLER_TURNLEFT_FRAME 96 #define BUTLER_TURNRIGHT_FRAME 97 -void butler_ai(int o) +void butler_ai(int o, bool hardmode) { char not_about_to_fall; if (objects[o].needinit) @@ -58,14 +58,14 @@ char not_about_to_fall; if (player[primaryplayer].x < objects[o].x) { player[objects[o].touchedBy].playpushed_x = -butlerpushamount; - if (options[OPT_MEAN].value) player[objects[o].touchedBy].playpushed_x -= BUTLERPUSHAMOUNTFAST; + if (hardmode) player[objects[o].touchedBy].playpushed_x -= BUTLERPUSHAMOUNTFAST; player[objects[o].touchedBy].playpushed_decreasetimer = 0; player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = LEFT; } else { player[objects[o].touchedBy].playpushed_x = butlerpushamount; - if (options[OPT_MEAN].value) player[objects[o].touchedBy].playpushed_x += BUTLERPUSHAMOUNTFAST; + if (hardmode) player[objects[o].touchedBy].playpushed_x += BUTLERPUSHAMOUNTFAST; player[objects[o].touchedBy].playpushed_decreasetimer = 0; player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = RIGHT; } @@ -91,7 +91,7 @@ char not_about_to_fall; objects[o].sprite = BUTLER_WALK_LEFT_FRAME + objects[o].ai.butler.frame; if (!objects[o].blockedl && not_about_to_fall) { - if (options[OPT_MEAN].value) + if (hardmode) objects[o].x -= BUTLER_WALK_SPEED_FAST; else objects[o].x -= BUTLER_WALK_SPEED; @@ -113,7 +113,7 @@ char not_about_to_fall; objects[o].sprite = BUTLER_WALK_RIGHT_FRAME + objects[o].ai.butler.frame; if (!objects[o].blockedr && not_about_to_fall) { - if (options[OPT_MEAN].value) + if (hardmode) objects[o].x += BUTLER_WALK_SPEED_FAST; else objects[o].x += BUTLER_WALK_SPEED; @@ -129,7 +129,7 @@ char not_about_to_fall; } // walk animation if (objects[o].ai.butler.animtimer > BUTLER_WALK_ANIM_TIME || \ - (objects[o].ai.butler.animtimer > BUTLER_WALK_ANIM_TIME_FAST && options[OPT_MEAN].value)) + (objects[o].ai.butler.animtimer > BUTLER_WALK_ANIM_TIME_FAST && hardmode)) { if (objects[o].ai.butler.frame>=3) objects[o].ai.butler.frame=0; else objects[o].ai.butler.frame++; diff --git a/src/ai/foob.cpp b/src/ai/foob.cpp index 9f0d3d07c..a48617816 100644 --- a/src/ai/foob.cpp +++ b/src/ai/foob.cpp @@ -54,7 +54,7 @@ unsigned int i; objects[o].ai.foob.state = FOOB_EXPLODE; objects[o].canbezapped = 0; if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_YORP_DIE, PLAY_NOW, objects[o].scrx); - if (options[OPT_MEAN].value && objects[o].touchPlayer) + if (pCKP->Control.levelcontrol.hardmode && objects[o].touchPlayer) { killplayer(objects[o].touchedBy, pCKP); } diff --git a/src/ai/garg.cpp b/src/ai/garg.cpp index a2a028230..e0c8e5483 100644 --- a/src/ai/garg.cpp +++ b/src/ai/garg.cpp @@ -205,7 +205,7 @@ unsigned int i; if (garg_CanWalkLeft(o)) { - if (options[OPT_MEAN].value) + if (pCKP->Control.levelcontrol.hardmode) objects[o].x -= GARG_WALK_SPEED_FAST; else objects[o].x -= GARG_WALK_SPEED; @@ -223,7 +223,7 @@ unsigned int i; objects[o].sprite = GARG_WALK_RIGHT + objects[o].ai.garg.walkframe; if (garg_CanWalkRight(o)) { - if (options[OPT_MEAN].value) + if (pCKP->Control.levelcontrol.hardmode) objects[o].x += GARG_WALK_SPEED_FAST; else objects[o].x += GARG_WALK_SPEED; @@ -239,7 +239,7 @@ unsigned int i; /* walk animation */ if (objects[o].ai.garg.timer > GARG_WALK_ANIM_TIME || \ - (objects[o].ai.garg.timer > GARG_WALK_ANIM_TIME && options[OPT_MEAN].value)) + (objects[o].ai.garg.timer > GARG_WALK_ANIM_TIME && pCKP->Control.levelcontrol.hardmode)) { objects[o].ai.garg.walkframe ^= 1; objects[o].ai.garg.timer = 0; diff --git a/src/ai/mother.cpp b/src/ai/mother.cpp index 5576fffd4..5b74915d8 100644 --- a/src/ai/mother.cpp +++ b/src/ai/mother.cpp @@ -11,8 +11,8 @@ #define MOTHER_HURT 2 #define MOTHER_DEAD 3 -#define MOTHER_WALK_ANIM_RATE 70 -#define MOTHER_WALK_SPD 1 +#define MOTHER_WALK_ANIM_RATE 40 +#define MOTHER_WALK_SPD 4 #define MOTHER_SPIT_PROB 1000 #define MOTHER_SPIT_SHOW_TIME 100 diff --git a/src/ai/ninja.cpp b/src/ai/ninja.cpp index a4266a3af..36b807bb3 100644 --- a/src/ai/ninja.cpp +++ b/src/ai/ninja.cpp @@ -35,7 +35,7 @@ int onsamelevel; { 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; - if (options[OPT_MEAN].value) objects[o].ai.ninja.timetillkick /= 3; + if (pCKP->Control.levelcontrol.hardmode) objects[o].ai.ninja.timetillkick /= 3; if (player[primaryplayer].x < objects[o].x) { objects[o].ai.ninja.dir = LEFT; } diff --git a/src/ai/sndwave.cpp b/src/ai/sndwave.cpp index 31190f4a8..01ec4c0f0 100644 --- a/src/ai/sndwave.cpp +++ b/src/ai/sndwave.cpp @@ -57,7 +57,7 @@ void sndwave_ai(int o, stCloneKeenPlus *pCKP) } else { - if (options[OPT_MEAN].value) + if (pCKP->Control.levelcontrol.hardmode) objects[o].x += SNDWAVE_SPEED_FAST; else objects[o].x += SNDWAVE_SPEED; @@ -72,7 +72,7 @@ void sndwave_ai(int o, stCloneKeenPlus *pCKP) } else { - if (options[OPT_MEAN].value) + if (pCKP->Control.levelcontrol.hardmode) objects[o].x -= SNDWAVE_SPEED_FAST; else objects[o].x -= SNDWAVE_SPEED; diff --git a/src/ai/tank.cpp b/src/ai/tank.cpp index 437af0146..890891f15 100644 --- a/src/ai/tank.cpp +++ b/src/ai/tank.cpp @@ -38,7 +38,7 @@ char tank_CanMoveLeft(int o); char tank_CanMoveRight(int o); -void tank_ai(int o) +void tank_ai(int o, bool hardmode) { int newobject; unsigned int i; @@ -150,11 +150,11 @@ unsigned int i; if (objects[o].ai.tank.detectedPlayer) { objects[o].ai.tank.ponsameleveltime++; - if (objects[o].ai.tank.ponsameleveltime > TANK_SAME_LEVEL_TIME_FAST && options[OPT_MEAN].value) + if (objects[o].ai.tank.ponsameleveltime > TANK_SAME_LEVEL_TIME_FAST && hardmode) { // keen would be a good target now. (hard mode) if (!objects[o].ai.tank.alreadyfiredcauseonsamelevel ||\ objects[o].ai.tank.ponsameleveltime > TANK_REPEAT_FIRE_TIME || \ - (objects[o].ai.tank.ponsameleveltime > TANK_REPEAT_FIRE_TIME_FAST && options[OPT_MEAN].value)) + (objects[o].ai.tank.ponsameleveltime > TANK_REPEAT_FIRE_TIME_FAST && hardmode)) { // facing keen? objects[o].ai.tank.alreadyfiredcauseonsamelevel = 1; @@ -232,7 +232,7 @@ unsigned int i; break; case TANK_FIRE: if (objects[o].ai.tank.timer > TANK_PREPAREFIRE_TIME || \ - (objects[o].ai.tank.timer > TANK_PREPAREFIRE_TIME_FAST && options[OPT_MEAN].value)) + (objects[o].ai.tank.timer > TANK_PREPAREFIRE_TIME_FAST && hardmode)) { if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_TANK_FIRE, PLAY_NOW, objects[o].scrx); if (objects[o].ai.tank.movedir==RIGHT) diff --git a/src/ai/tankep2.cpp b/src/ai/tankep2.cpp index e39be1937..a3f9818d5 100644 --- a/src/ai/tankep2.cpp +++ b/src/ai/tankep2.cpp @@ -141,7 +141,7 @@ unsigned int i; else { // no we're not facing him, on hard difficulty turn around - if (options[OPT_MEAN].value) + if (pCKP->Control.levelcontrol.hardmode) { objects[o].ai.tank.frame = 0; objects[o].ai.tank.timer = 0; diff --git a/src/ai/vort.cpp b/src/ai/vort.cpp index 139927ccf..63ab34c34 100644 --- a/src/ai/vort.cpp +++ b/src/ai/vort.cpp @@ -44,7 +44,7 @@ int bonk,kill; objects[o].canbezapped = 1; objects[o].needinit = 0; - if (options[OPT_MEAN].value) + if (pCKP->Control.levelcontrol.hardmode) { objects[o].ai.vort.ep1style = 1; } @@ -118,7 +118,7 @@ int bonk,kill; else { objects[o].ai.vort.state = VORT2_DYING; - if (options[OPT_MEAN].value) + if (pCKP->Control.levelcontrol.hardmode) { fade.mode = FADE_GO; fade.dir = FADE_IN; diff --git a/src/ai/yorp.cpp b/src/ai/yorp.cpp index 63d39a9a9..b3ddb1c09 100644 --- a/src/ai/yorp.cpp +++ b/src/ai/yorp.cpp @@ -126,7 +126,7 @@ char numlooks; { bump_left: ; player[objects[o].touchedBy].playpushed_x = -pushamt; - if (options[OPT_MEAN].value) player[objects[o].touchedBy].playpushed_x -= YORPPUSHAMOUNT_FAST; + if (levelcontrol.hardmode) player[objects[o].touchedBy].playpushed_x -= YORPPUSHAMOUNT_FAST; player[objects[o].touchedBy].playpushed_decreasetimer = 0; if (!player[objects[o].touchedBy].pjumping) { @@ -137,7 +137,7 @@ char numlooks; { bump_right: ; player[objects[o].touchedBy].playpushed_x = pushamt; - if (options[OPT_MEAN].value) player[objects[o].touchedBy].playpushed_x += YORPPUSHAMOUNT_FAST; + if (levelcontrol.hardmode) player[objects[o].touchedBy].playpushed_x += YORPPUSHAMOUNT_FAST; player[objects[o].touchedBy].playpushed_decreasetimer = 0; if (!player[objects[o].touchedBy].pjumping) { @@ -185,7 +185,7 @@ char numlooks; } break; case YORP_LOOK: - if (options[OPT_MEAN].value) numlooks = YORP_NUM_LOOKS_FAST; else numlooks = YORP_NUM_LOOKS; + if (levelcontrol.hardmode) numlooks = YORP_NUM_LOOKS_FAST; else numlooks = YORP_NUM_LOOKS; if (objects[o].ai.yorp.looktimes>numlooks &&\ objects[o].ai.yorp.timer==YORP_LOOK_TIME-(YORP_LOOK_TIME/4)) { @@ -251,7 +251,7 @@ char numlooks; objects[o].sprite = YORP_WALK_LEFT + objects[o].ai.yorp.walkframe; if (!objects[o].blockedl) { - if (options[OPT_MEAN].value) + if (levelcontrol.hardmode) objects[o].x -= YORP_WALK_SPEED_FAST; else objects[o].x -= YORP_WALK_SPEED; @@ -271,7 +271,7 @@ char numlooks; objects[o].sprite = YORP_WALK_RIGHT + objects[o].ai.yorp.walkframe; if (!objects[o].blockedr) { - if (options[OPT_MEAN].value) + if (levelcontrol.hardmode) objects[o].x += YORP_WALK_SPEED_FAST; else objects[o].x += YORP_WALK_SPEED; @@ -287,7 +287,7 @@ char numlooks; } // walk animation if (objects[o].ai.yorp.timer > YORP_WALK_ANIM_TIME || \ - (objects[o].ai.yorp.timer > YORP_WALK_ANIM_TIME_FAST && options[OPT_MEAN].value)) + (objects[o].ai.yorp.timer > YORP_WALK_ANIM_TIME_FAST && levelcontrol.hardmode)) { objects[o].ai.yorp.walkframe ^= 1; objects[o].ai.yorp.timer = 0; @@ -297,7 +297,7 @@ char numlooks; objects[o].sprite = YORP_STUNFRAME + objects[o].ai.yorp.walkframe; if (objects[o].ai.yorp.timer > YORP_STUN_ANIM_TIME) { - if (options[OPT_MEAN].value) numlooks = YORP_STUNTIME_FAST; else numlooks = YORP_STUNTIME; + if (levelcontrol.hardmode) numlooks = YORP_STUNTIME_FAST; else numlooks = YORP_STUNTIME; if (objects[o].ai.yorp.looktimes>numlooks) { objects[o].ai.yorp.looktimes = 0; diff --git a/src/fileio.cpp b/src/fileio.cpp index 7f2ca2d0d..475e399af 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -1064,7 +1064,7 @@ g_pLogFile->ftextOut("loadstrings(): Opening string file '%s'.
", fname); // into it. We'll need room for both the name and the string, plus // null-terminators for each. RAMSize = strlen( (char*) stName) + strlen((char*)stString) + 2; - RAMPtr = (char*) malloc(RAMSize); + RAMPtr = (char*) malloc(RAMSize); if (!RAMPtr) { g_pLogFile->ftextOut(RED,"loadstrings(): Could not allocate memory for string '%s'
", stName); diff --git a/src/fileio/story.cpp b/src/fileio/story.cpp index 357eb3a25..41324761f 100644 --- a/src/fileio/story.cpp +++ b/src/fileio/story.cpp @@ -71,7 +71,7 @@ int readStoryText(char **ptext, int episode, char *path) } else { - *ptext = (char*) malloc((endflag-startflag)*sizeof(char)); + *ptext = (char*) malloc((endflag-startflag+10)*sizeof(char)); strncpy((*ptext),(char*)filebuf+startflag,(endflag-startflag)*sizeof(char)); } @@ -94,7 +94,7 @@ int readStoryText(char **ptext, int episode, char *path) pos = 0; - *ptext = (char*) malloc(filesize*sizeof(char)); + *ptext = (char*) malloc((filesize+10)*sizeof(char)); while(!feof(fp)) { diff --git a/src/gamedo.cpp b/src/gamedo.cpp index 6e020aa99..e760b2a6e 100644 --- a/src/gamedo.cpp +++ b/src/gamedo.cpp @@ -253,8 +253,8 @@ int i; case OBJ_YORP: yorp_ai(i, pCKP->Control.levelcontrol); break; case OBJ_GARG: garg_ai(i, pCKP); break; case OBJ_VORT: vort_ai(i, pCKP, pCKP->Control.levelcontrol); break; - case OBJ_BUTLER: butler_ai(i); break; - case OBJ_TANK: tank_ai(i); break; + case OBJ_BUTLER: butler_ai(i, pCKP->Control.levelcontrol.hardmode); break; + case OBJ_TANK: tank_ai(i, pCKP->Control.levelcontrol.hardmode); break; case OBJ_RAY: ray_ai(i, pCKP, pCKP->Control.levelcontrol); break; case OBJ_DOOR: door_ai(i); break; case OBJ_ICECHUNK: icechunk_ai(i); break; diff --git a/src/gamepdo.cpp b/src/gamepdo.cpp index 1fd7bce1c..62ce91d7b 100644 --- a/src/gamepdo.cpp +++ b/src/gamepdo.cpp @@ -409,7 +409,7 @@ void gamepdo_setblockedlru(unsigned int cp, stCloneKeenPlus *pCKP) for( i=2 ; i < PLAYERHEIGHT ; i++ ) { - if (checkissolidl((player[cp].x>>CSF)+PLAYERWIDTH, (player[cp].y>>CSF)+i,cp, pCKP)) + if (checkissolidl((player[cp].x>>CSF)+PLAYERWIDTH+1, (player[cp].y>>CSF)+i,cp, pCKP)) { player[cp].blockedr = 1; player[cp].widejump = false; @@ -419,7 +419,7 @@ void gamepdo_setblockedlru(unsigned int cp, stCloneKeenPlus *pCKP) for( i=2 ; i < PLAYERHEIGHT ; i++ ) { - if (checkissolidr((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+i,cp, pCKP)) + if (checkissolidr((player[cp].x>>CSF)+2, (player[cp].y>>CSF)+i,cp, pCKP)) { player[cp].blockedl = 1; player[cp].widejump = false; @@ -1645,7 +1645,6 @@ void gamepdo_walking(int cp, stCloneKeenPlus *pCKP) } else if (player[cp].playcontrol[PA_X] < 0) { - // quickly reach PFASTINCMAXSPEED if (player[cp].pwalkincreasetimer>=cur_pfastincrate && player[cp].pinertia_x>-PFASTINCMAXSPEED) { diff --git a/src/include/declarations.h b/src/include/declarations.h index ae20f355b..3cf912e15 100644 --- a/src/include/declarations.h +++ b/src/include/declarations.h @@ -41,6 +41,7 @@ typedef struct stLevelControl char dark; // 1 if level is currently dark (lights are out) int episode; // which episode we're playing (1-3) + bool hardmode; // array of which levels have been completed (have "Done" tiles over them // on the world map) diff --git a/src/include/enemyai.h b/src/include/enemyai.h index a023df6da..1ce7fbc35 100644 --- a/src/include/enemyai.h +++ b/src/include/enemyai.h @@ -10,8 +10,8 @@ void yorp_ai(int o, stLevelControl levelcontrol); void garg_ai(int o, stCloneKeenPlus *pCKP); void vort_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol); -void butler_ai(int o); -void tank_ai(int o); +void butler_ai(int o, bool hardmode); +void tank_ai(int o, bool hardmode); void ray_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol); void door_ai(int o); void icechunk_ai(int o); diff --git a/src/include/game.h b/src/include/game.h index 8e6f14d70..741df3331 100644 --- a/src/include/game.h +++ b/src/include/game.h @@ -45,7 +45,7 @@ // PFASTINCMAXSPEED. keen can, at a slower rate, // reach up to PMAXSPEED (increased every walk anim frame) #define PFASTINCMAXSPEED 9 -#define PMAXSPEED 13 +#define PMAXSPEED 14 #define PJUMPINERTIA 30 // The higher, the value, the more difficult it is to jump or pogo #define PFASTINCRATE 16 // accel delay rate up to PFASTINCMAXSPEED #define PFASTINCRATE_POGO 50 // rate when pogo stick is out diff --git a/src/keen.h b/src/keen.h index 054bb14d2..a5d24de80 100644 --- a/src/keen.h +++ b/src/keen.h @@ -838,7 +838,8 @@ typedef struct stShipQueue #define SHUTDOWN_NO_ERRORS 0 #define SHUTDOWN_BOOTUP 1 #define SHUTDOWN_RESTART 2 -#define SHUTDOWN_EXIT 3 +#define SHUTDOWN_NEW_GAME 3 +#define SHUTDOWN_EXIT 4 // Video Modes diff --git a/src/main.cpp b/src/main.cpp index acbdb9a9b..686ca44f8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -191,6 +191,22 @@ int main(int argc, char *argv[]) { CKP.shutdown = SHUTDOWN_NONE; // Game is runnning Game->runCycle(&CKP); + + if(CKP.shutdown == SHUTDOWN_NEW_GAME) + { + if(loadStartMenu(&CKP) == 1) + { + CKP.shutdown = SHUTDOWN_EXIT; + break; + } + else + { + //loadResourcesforGame(pCKP); + Game->loadResources(CKP.Control.levelcontrol.episode, CKP.GameData[CKP.Resources.GameSelected-1].DataDirectory); + + CKP.shutdown = SHUTDOWN_RESTART; + } + } } } @@ -293,7 +309,7 @@ void playgame_levelmanager(stCloneKeenPlus *pCKP) initgame(pCKP); newlevel = p_levelcontrol->chglevelto; - if (p_levelcontrol->episode==1 && p_option[OPT_MEAN].value) + if (p_levelcontrol->episode==1 && p_levelcontrol->hardmode) { // in high-difficulity mode switch levels 5 & 9 so // you can't get the pogo stick until you make it @@ -610,7 +626,7 @@ short readCommandLine(int argc, char *argv[], stCloneKeenPlus *pCKP) } else if (strcmp(tempbuf, "-mean")==0) // increase difficulty { - pCKP->Option[OPT_MEAN].value = 1; + pCKP->Control.levelcontrol.hardmode = true; } else if (strcmp(tempbuf, "-cheat")==0) // enable cheat codes { diff --git a/src/menu.cpp b/src/menu.cpp index 05cf8cba2..f46132a9a 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -159,7 +159,7 @@ short loadStartMenu(stCloneKeenPlus *pCKP) // Prepare the Games Menu GamesMenu = new CDialog(); - GamesMenu->setDimensions(2,2,36,5); + GamesMenu->setDimensions(2,2,36,15); // Show me the games you detected! for( i=0 ; i < pCKP->numGames ; i++ ) @@ -182,10 +182,9 @@ short loadStartMenu(stCloneKeenPlus *pCKP) gamedo_AnimatedTiles(); // Check the Input - if(g_pInput->getPressedCommand(0, IC_DOWN)) + if(g_pInput->getPulsedCommand(IC_DOWN, 80)) GamesMenu->setNextSelection(); - - if(g_pInput->getPressedCommand(0, IC_UP)) + if(g_pInput->getPulsedCommand(IC_UP, 80)) GamesMenu->setPrevSelection(); if(g_pInput->getPressedCommand(0, IC_STATUS)) @@ -220,6 +219,12 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt) int x; int selection; + for(unsigned int cp=0 ; cpgetPressedCommand(IC_DOWN)) + if(g_pInput->getPulsedCommand(IC_DOWN, 80)) MainMenu->setNextSelection(); - - if(g_pInput->getPressedCommand(IC_UP)) + if(g_pInput->getPulsedCommand(IC_UP, 80)) MainMenu->setPrevSelection(); if(g_pInput->getPressedCommand(IC_STATUS)) @@ -286,7 +290,10 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt) gamedo_frameskipping_blitonly(); if(g_pInput->getExitEvent()) + { + delete MainMenu; return MAINMNU_QUIT; + } } while(1); @@ -299,7 +306,7 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt) return BACK2MAINMENU; } - options[OPT_MEAN].value = diff; + pCKP->Control.levelcontrol.hardmode = (diff == 1) ? true : false; loadslot = save_slot_box(0, pCKP); if (loadslot) @@ -325,15 +332,16 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt) { if(selection==MAINMNU_1PLAYER || selection==MAINMNU_2PLAYER) { + int diff; diff = getDifficulty(pCKP); + if(diff>2) { delete MainMenu; return BACK2MAINMENU; } - - options[OPT_MEAN].value = diff; + pCKP->Control.levelcontrol.hardmode = (diff == 1) ? true : false; } fade.dir = FADE_OUT; @@ -400,10 +408,9 @@ int getDifficulty(stCloneKeenPlus *pCKP) gamedo_AnimatedTiles(); // Check the Input - if(g_pInput->getPressedCommand(IC_DOWN)) + if(g_pInput->getPulsedCommand(IC_DOWN, 80)) DifficultyMenu->setNextSelection(); - - if(g_pInput->getPressedCommand(IC_UP)) + if(g_pInput->getPulsedCommand(IC_UP, 80)) DifficultyMenu->setPrevSelection(); if(g_pInput->getPressedCommand(IC_STATUS)) @@ -473,10 +480,9 @@ int AudioDlg(stCloneKeenPlus *pCKP) gamedo_AnimatedTiles(); // Check the Input - if(g_pInput->getPressedCommand(IC_DOWN)) + if(g_pInput->getPulsedCommand(IC_DOWN, 80)) AudioMenu->setNextSelection(); - - if(g_pInput->getPressedCommand(IC_UP)) + if(g_pInput->getPulsedCommand(IC_UP, 80)) AudioMenu->setPrevSelection(); if(g_pInput->getPressedCommand(IC_STATUS)) @@ -584,9 +590,9 @@ void OptionsDlg(stCloneKeenPlus *pCKP) gamedo_AnimatedTiles(); // Check the Input - if(g_pInput->getPressedCommand(IC_DOWN)) + if(g_pInput->getPulsedCommand(IC_DOWN, 80)) OptionsMenu->setNextSelection(); - if(g_pInput->getPressedCommand(IC_UP)) + if(g_pInput->getPulsedCommand(IC_UP, 80)) OptionsMenu->setPrevSelection(); if(g_pInput->getPressedCommand(IC_STATUS)) @@ -737,9 +743,9 @@ short GraphicsDlg(stCloneKeenPlus *pCKP) aspect = g_pVideoDriver->getAspectCorrection(); if(aspect) - DisplayMenu->addOptionText("Aspect Ratio Enabled"); + DisplayMenu->addOptionText("OGL Aspect Ratio Enabled"); else - DisplayMenu->addOptionText("Aspect Ratio Disabled"); + DisplayMenu->addOptionText("OGL Aspect Ratio Disabled"); DisplayMenu->addSeparator(); DisplayMenu->addOptionText("Save and return"); @@ -755,9 +761,9 @@ short GraphicsDlg(stCloneKeenPlus *pCKP) gamedo_AnimatedTiles(); // Check the Input - if(g_pInput->getPressedCommand(IC_DOWN)) + if(g_pInput->getPulsedCommand(IC_DOWN, 80)) DisplayMenu->setNextSelection(); - if(g_pInput->getPressedCommand(IC_UP)) + if(g_pInput->getPulsedCommand(IC_UP, 80)) DisplayMenu->setPrevSelection(); if(g_pInput->getPressedCommand(IC_STATUS)) @@ -821,7 +827,7 @@ short GraphicsDlg(stCloneKeenPlus *pCKP) } else { - if(zoom >= 3) + if(zoom >= 4) zoom = 1; else zoom++; @@ -849,7 +855,7 @@ short GraphicsDlg(stCloneKeenPlus *pCKP) else if(filter == 2) DisplayMenu->setOptionText(3,"Scale3x Filter"); else if(filter == 3) - DisplayMenu->setOptionText(3,"Scale4x Filter (OpenGL)"); + DisplayMenu->setOptionText(3,"Scale4x Filter"); } else if(selection == 4) { @@ -890,9 +896,9 @@ short GraphicsDlg(stCloneKeenPlus *pCKP) aspect = !aspect; if(aspect) - DisplayMenu->setOptionText(7,"Aspect Ratio Enabled"); + DisplayMenu->setOptionText(7,"OGL Aspect Ratio Enabled"); else - DisplayMenu->setOptionText(7,"Aspect Ratio Disabled"); + DisplayMenu->setOptionText(7,"OGL Aspect Ratio Disabled"); } else if(selection == 9) @@ -1147,10 +1153,9 @@ char configmenu(stCloneKeenPlus *pCKP) gamedo_AnimatedTiles(); // Check the Input - if(g_pInput->getPressedCommand(IC_DOWN)) + if(g_pInput->getPulsedCommand(IC_DOWN, 80)) OptionsMenu->setNextSelection(); - - if(g_pInput->getPressedCommand(IC_UP)) + if(g_pInput->getPulsedCommand(IC_UP, 80)) OptionsMenu->setPrevSelection(); if(g_pInput->getPressedCommand(IC_STATUS)) @@ -1282,9 +1287,9 @@ char controlsmenu(stCloneKeenPlus *pCKP) gamedo_AnimatedTiles(); // Check the Input - if(g_pInput->getPressedCommand(IC_DOWN)) + if(g_pInput->getPulsedCommand(IC_DOWN, 80)) ControlsMenu->setNextSelection(); - if(g_pInput->getPressedCommand(IC_UP)) + if(g_pInput->getPulsedCommand(IC_UP, 80)) ControlsMenu->setPrevSelection(); if(g_pInput->getPressedCommand(IC_STATUS)) diff --git a/src/sdl/CInput.cpp b/src/sdl/CInput.cpp index a8cb88b3c..c932e0500 100644 --- a/src/sdl/CInput.cpp +++ b/src/sdl/CInput.cpp @@ -11,6 +11,7 @@ #include "CInput.h" #include "../CLogFile.h" #include "CVideoDriver.h" +#include "CTimer.h" #ifdef WIZ #include "gp2x.h" @@ -21,6 +22,8 @@ CInput::CInput() { Uint8 i; m_exit = false; + m_cmdpulse = 0; + m_joydeadzone = 6400; memset(immediate_keytable,false,KEYTABLE_SIZE); memset(last_immediate_keytable,false,KEYTABLE_SIZE); @@ -40,7 +43,7 @@ CInput::CInput() { InputCommand[i][IC_DOWN].keysym = SDLK_DOWN; InputCommand[i][IC_JUMP].keysym = SDLK_RCTRL; - InputCommand[i][IC_POGO].keysym = SDLK_MODE; + InputCommand[i][IC_POGO].keysym = SDLK_RALT; InputCommand[i][IC_FIRE].keysym = SDLK_SPACE; InputCommand[i][IC_STATUS].keysym = SDLK_RETURN; @@ -254,8 +257,8 @@ void CInput::processJoystickAxis(void) if(Event.jaxis.axis == InputCommand[j][i].joyaxis && Event.jaxis.which == InputCommand[j][i].which ) { // Deadzone - if((Event.jaxis.value > 3200 && InputCommand[0][i].joyvalue > 0) || - (Event.jaxis.value < -3200 && InputCommand[0][i].joyvalue < 0)) + if((Event.jaxis.value > m_joydeadzone && InputCommand[0][i].joyvalue > 0) || + (Event.jaxis.value < -m_joydeadzone && InputCommand[0][i].joyvalue < 0)) InputCommand[j][i].active = true; else InputCommand[j][i].active = false; @@ -314,7 +317,7 @@ void CInput::processKeys(int value) case SDLK_RETURN:immediate_keytable[KENTER] = value; break; case SDLK_RCTRL:immediate_keytable[KCTRL] = value; break; case SDLK_SPACE:immediate_keytable[KSPACE] = value; break; - case SDLK_MODE:immediate_keytable[KALT] = value; break; + case SDLK_RALT:immediate_keytable[KALT] = value; break; case SDLK_TAB:immediate_keytable[KTAB] = value; break; case SDLK_LSHIFT:immediate_keytable[KLSHIFT] = value; break; case SDLK_ESCAPE:immediate_keytable[KQUIT] = value; break; @@ -392,6 +395,7 @@ bool CInput::getPressedKey(int key) return false; } + bool CInput::getPressedAnyKey(void) { int i; @@ -438,6 +442,33 @@ bool CInput::getPressedCommand(Uint8 player, int command) return false; } +bool CInput::getPulsedCommand(int command, int msec) +{ + bool retval = false; + for(Uint8 player=0; playerpixels, (Depth>>3)); + } + else if(Filtermode == 1) + { + scale(2, VRAMPtr, Width*(Depth>>3), BlitSurface->pixels, + GAME_STD_WIDTH*(Depth>>3), (Depth>>3), GAME_STD_WIDTH, GAME_STD_HEIGHT); + } + else if(Filtermode == 2) + { + scale(3, VRAMPtr, Width*(Depth>>3), BlitSurface->pixels, + GAME_STD_WIDTH*(Depth>>3), (Depth>>3), GAME_STD_WIDTH, GAME_STD_HEIGHT); + } + else if(Filtermode == 3) + { + scale(4, VRAMPtr, Width*(Depth>>3), BlitSurface->pixels, + GAME_STD_WIDTH*(Depth>>3), (Depth>>3), GAME_STD_WIDTH, GAME_STD_HEIGHT); + } + else + { + g_pLogFile->textOut(PURPLE,"Sorry, but this filter doesn't work at that zoom mode
"); + g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter
"); + Filtermode = 0; + } + SDL_UnlockSurface(screen); + SDL_UnlockSurface(BlitSurface); + } SDL_Flip(screen); //SDL_UpdateRect(screen, screenrect.x, screenrect.y, screenrect.w, screenrect.h); @@ -569,10 +606,44 @@ void CVideoDriver::scale3xnofilter(char *dest, char *src, short bbp) } } +void CVideoDriver::scale4xnofilter(char *dest, char *src, short bbp) +{ + // workaround for copying correctly stuff to the screen, so the screen is scaled normally + // to 2x (without filter). This applies to 16 and 32-bit colour depth. + // use bit shifting method for faster blit! + bbp >>= 1; + + char *srctemp; + char *desttemp; + int size; + + int i,j; + for(i=0 ; i < GAME_STD_HEIGHT ; i++) + { + for(j = 0; j < GAME_STD_WIDTH ; j++) + { + // j*4 = (j<<2) + srctemp = src+((j+(i*GAME_STD_WIDTH))< Width || y > Height ) + if( x >= GAME_STD_WIDTH || y >= GAME_STD_HEIGHT ) // out of Bonds!!! return; diff --git a/src/sdl/CVideoDriver.h b/src/sdl/CVideoDriver.h index 0d98a5a95..ac1cb1850 100644 --- a/src/sdl/CVideoDriver.h +++ b/src/sdl/CVideoDriver.h @@ -42,6 +42,7 @@ public: void noscale(char *dest, char *src, short bbp); void scale2xnofilter(char *dest, char *src, short bbp); void scale3xnofilter(char *dest, char *src, short bbp); + void scale4xnofilter(char *dest, char *src, short bbp); void setpixel(unsigned int x, unsigned int y, unsigned char c); unsigned char getpixel(int x, int y); @@ -69,9 +70,9 @@ public: void setFrameskip(unsigned short value); void setFilter(short value); void setZoom(short vale); + bool initOpenGL(); #ifdef USE_OPENGL void enableOpenGL(bool value) { m_opengl = value; } - bool initOpenGL(); void setOGLFilter(unsigned char value) { m_opengl_filter = (value==1) ? GL_LINEAR : GL_NEAREST ; } #else void enableOpenGL(bool value) { m_opengl = false; } diff --git a/src/sdl/sound/CSound.cpp b/src/sdl/sound/CSound.cpp index 5ab61c2d9..b20ebcde5 100644 --- a/src/sdl/sound/CSound.cpp +++ b/src/sdl/sound/CSound.cpp @@ -27,7 +27,6 @@ void CCallback(void *unused, Uint8 *stream, int len) CSound::CSound() { m_active = false; - m_volume = 0; m_mixing_channels = 0; m_soundchannel = NULL; m_soundslot = NULL; @@ -46,33 +45,40 @@ CSound::~CSound() { bool CSound::init(void) { char name[MAX_STRING_LENGTH]; + SDL_AudioSpec *desired, *obtained; + + desired = &AudioSpec; + obtained = new SDL_AudioSpec; // now start up the SDL sound system AudioSpec.silence = 0; - AudioSpec.samples = 1024; + + switch (AudioSpec.freq) + { + case 11000: AudioSpec.samples = 256; break; + case 22000: AudioSpec.samples = 512; break; + default: AudioSpec.samples = 1024; break; + + } + AudioSpec.callback = CCallback; AudioSpec.userdata = NULL; - /* Initialize fillerup() variables */ - if( SDL_OpenAudio(&AudioSpec, NULL) < 0 ) + /* Initialize variables */ + if( SDL_OpenAudio(desired, obtained) < 0 ) { - g_pLogFile->ftextOut("SoundDrv_Start(): The Sound settings don't work! Going into Failsafemode!
"); - - AudioSpec.channels = 1; - AudioSpec.freq = 11000; - - if( SDL_OpenAudio(&AudioSpec, NULL) < 0 ) - { - g_pLogFile->ftextOut("SoundDrv_Start(): Couldn't open audio: %s
", SDL_GetError()); - g_pLogFile->ftextOut("Sound will be disabled.
"); - AudioSpec.channels = 0; - AudioSpec.format = 0; - AudioSpec.freq = 0; - m_active = false; - return false; - } + g_pLogFile->ftextOut("SoundDrv_Start(): Couldn't open audio: %s
", SDL_GetError()); + g_pLogFile->ftextOut("Sound will be disabled.
"); + AudioSpec.channels = 0; + AudioSpec.format = 0; + AudioSpec.freq = 0; + m_active = false; + return false; } + memcpy(&AudioSpec,obtained,sizeof(SDL_AudioSpec)); + delete obtained; + m_MixedForm = new Uint8[AudioSpec.size]; g_pLogFile->ftextOut("SDL_AudioSpec:
"); @@ -83,16 +89,6 @@ bool CSound::init(void) m_mixing_channels = 7; - switch(m_mixing_channels) - { - case 15: m_mixing_channels_base = 4; break; - case 7: m_mixing_channels_base = 3; break; - case 3: m_mixing_channels_base = 2; - default: break; - } - - m_volume = 2; // Max Value!; - if(m_soundchannel) delete[] m_soundchannel; m_soundchannel = NULL; m_soundchannel = new CSoundChannel[m_mixing_channels]; @@ -502,7 +498,7 @@ char CSound::extractOfExeFile(char *inputpath, int episode) if (get_bit(&bit_count, &fin)) { unsigned char tmp[2]; - if(fread(tmp, 1, 2, fin)) + if(!fread(tmp, 1, 2, fin)) { g_pLogFile->ftextOut(RED,"Read-Error!"); return 1; diff --git a/src/sdl/sound/CSound.h b/src/sdl/sound/CSound.h index 23e59e0e3..8ab64171d 100644 --- a/src/sdl/sound/CSound.h +++ b/src/sdl/sound/CSound.h @@ -52,10 +52,8 @@ private: SDL_AudioSpec AudioSpec; - unsigned short m_volume; bool m_active; unsigned short m_mixing_channels; - unsigned short m_mixing_channels_base; Uint8 *m_MixedForm; // Mainly used by the callback function. Declared once and allocated }; diff --git a/src/vorticon/CCredits.cpp b/src/vorticon/CCredits.cpp index 2851dd3c4..d395d99e8 100644 --- a/src/vorticon/CCredits.cpp +++ b/src/vorticon/CCredits.cpp @@ -24,14 +24,11 @@ CCredits::~CCredits() { void CCredits::Render(stCloneKeenPlus *pCKP) { - // TODO: Now that the new intro function works, the old one must become - // a credits class - - int mid[7]; - char scrolltext[7][80]; + int mid[51]; + char scrolltext[51][80]; unsigned char pagenumber = 0; int timer = 8; - int scrolly = 0; + int scrolly = -51*8; bool cancel = false; fade.mode = FADE_GO; @@ -42,7 +39,7 @@ void CCredits::Render(stCloneKeenPlus *pCKP) showmapatpos(90, 104<<4, 32, 0, pCKP); - memset(scrolltext,0,7*80); + memset(scrolltext,0,51*80); do { @@ -61,11 +58,10 @@ void CCredits::Render(stCloneKeenPlus *pCKP) else { timer=0; - if(scrolly>-7*8) scrolly--; + if(scrolly>-51*8) scrolly--; else { scrolly = 200; - memset(scrolltext,0,7*80); switch(pagenumber) { @@ -74,71 +70,67 @@ void CCredits::Render(stCloneKeenPlus *pCKP) strcpy(scrolltext[1],"Interpreter of"); strcpy(scrolltext[2],"Commander Keen 1-3"); strcpy(scrolltext[3],"Credits"); - break; - case 1: - strcpy(scrolltext[0],"based on the engine of"); - strcpy(scrolltext[1],"CloneKeen by Shaw"); - strcpy(scrolltext[2],"and"); - strcpy(scrolltext[3],"CloneKeenPlus by Gerstrong"); - break; - - case 2: - strcpy(scrolltext[0],"Developers"); - strcpy(scrolltext[1],"of"); - strcpy(scrolltext[2],"Commander Genius"); - strcpy(scrolltext[3],""); - strcpy(scrolltext[4],"Aka CloneKeenPlus"); - break; - - case 3: - strcpy(scrolltext[0],"Main Developer:"); - strcpy(scrolltext[1]," Gerstrong"); - strcpy(scrolltext[2],"Handheld Devices (Wiz):"); - strcpy(scrolltext[3]," Pickle"); - strcpy(scrolltext[4],"Resources:"); - strcpy(scrolltext[5]," Tulip"); - break; - - case 4: - strcpy(scrolltext[0],"Thanks to ID Software"); - strcpy(scrolltext[1],"for the wonderful"); - strcpy(scrolltext[2],"\"Commander Keen\" series."); - strcpy(scrolltext[3],""); - strcpy(scrolltext[4],"\"As a child, I spent way too"); - strcpy(scrolltext[5],"much time playing these games."); - break; - - - case 5: - strcpy(scrolltext[0],"And now I have spent way"); - strcpy(scrolltext[1],"too much time programming"); - strcpy(scrolltext[2],"this game."); - strcpy(scrolltext[3],""); - strcpy(scrolltext[4],"..."); - strcpy(scrolltext[5],"Hmmm... Does history repeat itself?"); - strcpy(scrolltext[6],":)"); - break; - - case 6: - strcpy(scrolltext[0],"This is my tribute to"); - strcpy(scrolltext[1],"the \"Keen legacy\"."); - strcpy(scrolltext[2],""); - strcpy(scrolltext[3],"Enjoy the Game.\""); strcpy(scrolltext[4],""); - strcpy(scrolltext[5]," -Katy"); + strcpy(scrolltext[5],""); + strcpy(scrolltext[6],""); + strcpy(scrolltext[7],""); + strcpy(scrolltext[8],"based on the engine of"); + strcpy(scrolltext[9],"CloneKeen by Shaw"); + strcpy(scrolltext[10],"and"); + strcpy(scrolltext[11],"CloneKeenPlus by Gerstrong"); + strcpy(scrolltext[12],""); + strcpy(scrolltext[13],""); + strcpy(scrolltext[14],""); + strcpy(scrolltext[15],""); + strcpy(scrolltext[16],"Developers"); + strcpy(scrolltext[17],"of"); + strcpy(scrolltext[18],"Commander Genius"); + strcpy(scrolltext[19],""); + strcpy(scrolltext[20],"Aka CloneKeenPlus"); + strcpy(scrolltext[21],""); + strcpy(scrolltext[22],"Main Developer:"); + strcpy(scrolltext[23]," Gerstrong"); + strcpy(scrolltext[24],"Handheld Devices (Wiz):"); + strcpy(scrolltext[25]," Pickle"); + strcpy(scrolltext[26],"Resources:"); + strcpy(scrolltext[27]," Tulip"); + strcpy(scrolltext[28],""); + strcpy(scrolltext[29],""); + strcpy(scrolltext[30],""); + strcpy(scrolltext[31],""); + strcpy(scrolltext[32],"\"As a child, I spent way too"); + strcpy(scrolltext[33],"much time playing these games."); + strcpy(scrolltext[34],"Thanks to ID Software"); + strcpy(scrolltext[35],"for the wonderful"); + strcpy(scrolltext[36],"\"Commander Keen\" series."); + strcpy(scrolltext[37],""); + strcpy(scrolltext[38],"And now I have spent way"); + strcpy(scrolltext[39],"too much time programming"); + strcpy(scrolltext[40],"this game."); + strcpy(scrolltext[41],""); + strcpy(scrolltext[42],"..."); + strcpy(scrolltext[43],"Hmmm... Does history repeat itself?"); + strcpy(scrolltext[44],":)"); + strcpy(scrolltext[45],""); + strcpy(scrolltext[46],"This is my tribute to"); + strcpy(scrolltext[47],"the \"Keen legacy\"."); + strcpy(scrolltext[48],""); + strcpy(scrolltext[49],"Enjoy the Game.\""); + strcpy(scrolltext[50]," -Katy"); break; default: cancel = true; break; } - for(int j=0 ; j<7 ; j++) + for(int j=0 ; j<51 ; j++) mid[j] = (320-(strlen(scrolltext[j])<<3))>>1; pagenumber++; } } - for(int j=0 ; j<7 ; j++) - g_pGraphics->sb_font_draw_inverse( (unsigned char*) scrolltext[j], mid[j], scrolly+(j<<3)); + for(int j=0 ; j<51 ; j++) + if(scrolly+(j<<3) > -8 && scrolly+(j<<3) < 200) + g_pGraphics->sb_font_draw_inverse( (unsigned char*) scrolltext[j], mid[j], scrolly+(j<<3)); if( g_pInput->getPressedAnyCommand() ) { diff --git a/src/vorticon/CDialog.cpp b/src/vorticon/CDialog.cpp index b4672247f..e99685a88 100644 --- a/src/vorticon/CDialog.cpp +++ b/src/vorticon/CDialog.cpp @@ -332,6 +332,8 @@ bool CDialog::setNextSelection() selection += i; } + else if(selection >= number_of_options-1) + selection = -1; return setSelection(selection+1); } @@ -346,6 +348,8 @@ bool CDialog::setPrevSelection() selection -= i; } + else if(selection-1 < 0) + selection = number_of_options; return setSelection(selection-1); } diff --git a/src/vorticon/CIntro.cpp b/src/vorticon/CIntro.cpp index bbde4021d..e3de30d01 100644 --- a/src/vorticon/CIntro.cpp +++ b/src/vorticon/CIntro.cpp @@ -54,6 +54,8 @@ void CIntro::Render(stCloneKeenPlus *pCKP) for(int j=0 ; j<7 ; j++) mid[j] = (320/2)-(bitmaps[bmnum[j]].xsize/2); + g_pInput->flushAll(); + do { // do fades @@ -63,13 +65,13 @@ void CIntro::Render(stCloneKeenPlus *pCKP) // blit the scrollbuffer to the display gamedo_frameskipping_blitonly(); - g_pGraphics->drawBitmap(mid[0], scrolly, bmnum[0]); - g_pGraphics->drawBitmap(mid[1], scrolly+9, bmnum[1]); - g_pGraphics->drawBitmap(mid[2], scrolly+43, bmnum[2]); - g_pGraphics->drawBitmap(mid[3], scrolly+56, bmnum[3]); - g_pGraphics->drawBitmap(mid[4], scrolly+77, bmnum[4]); - g_pGraphics->drawBitmap(mid[5], scrolly+87, bmnum[5]); - g_pGraphics->drawBitmap(mid[6], scrolly+120, bmnum[6]); + g_pGraphics->drawBitmap2FG(mid[0], scrolly, bmnum[0]); + g_pGraphics->drawBitmap2FG(mid[1], scrolly+9, bmnum[1]); + g_pGraphics->drawBitmap2FG(mid[2], scrolly+43, bmnum[2]); + g_pGraphics->drawBitmap2FG(mid[3], scrolly+56, bmnum[3]); + g_pGraphics->drawBitmap2FG(mid[4], scrolly+77, bmnum[4]); + g_pGraphics->drawBitmap2FG(mid[5], scrolly+87, bmnum[5]); + g_pGraphics->drawBitmap2FG(mid[6], scrolly+120, bmnum[6]); gamedo_AnimatedTiles(); @@ -83,7 +85,7 @@ void CIntro::Render(stCloneKeenPlus *pCKP) if(scrolly>35) scrolly--; } - if( g_pInput->getPressedAnyCommand() ) + if( g_pInput->getPressedAnyKey() || g_pInput->getPressedAnyCommand() ) { cancel = true; fade.dir = FADE_OUT;