Changes for the new webpage and bug fixes since 0.2.9.6

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@36 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
gerstrong
2009-07-04 11:46:12 +00:00
parent 5a050591f5
commit 6d115861b7
39 changed files with 357 additions and 202 deletions

View File

@@ -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 20-06-2009
- Intro has been replaced and now is part of the About CG Option - Intro has been replaced and now is part of the About CG Option
- The original Intro screen is now included in the interpreter - The original Intro screen is now included in the interpreter

View File

@@ -4,6 +4,8 @@ Here are the features that I still want to implement:
until 0.3: until 0.3:
- Write a instruction keys manual in the readme file - Write a instruction keys manual in the readme file
- tie up the code - tie up the code
- New Resolutions system
- Add 1920x1200, 1280x800, 1600x1200
until 0.4: until 0.4:
- User folder detection and save the files there! - User folder detection and save the files there!

View File

@@ -10,7 +10,7 @@
* (c)2003-2005 Caitlin Shaw * * (c)2003-2005 Caitlin Shaw *
* Released under GNU/GPL * * Released under GNU/GPL *
* * * *
* Beta v0.2.9.5 * * Beta v0.2.9.6 *
* * * *
************************************* *************************************

View File

@@ -54,7 +54,6 @@ short CGame::runCycle(stCloneKeenPlus *pCKP)
{ {
CIntro Intro; CIntro Intro;
Intro.Render(pCKP); Intro.Render(pCKP);
//if (intro(pCKP)){ pCKP->shutdown=SHUTDOWN_EXIT; return 0; }
pCKP->Control.skipstarting=0; pCKP->Control.skipstarting=0;
} }
@@ -147,16 +146,7 @@ short CGame::runCycle(stCloneKeenPlus *pCKP)
break; break;
case MAINMNU_NEW_GAME: case MAINMNU_NEW_GAME:
if(loadStartMenu(pCKP) == 1) pCKP->shutdown = SHUTDOWN_NEW_GAME;
{
pCKP->shutdown = SHUTDOWN_EXIT;
break;
}
//loadResourcesforGame(pCKP);
loadResources(pCKP->Control.levelcontrol.episode, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
pCKP->shutdown = SHUTDOWN_RESTART;
break; break;
case MAINMNU_ABOUT: case MAINMNU_ABOUT:
@@ -210,6 +200,9 @@ short CGame::runCycle(stCloneKeenPlus *pCKP)
default: break; default: break;
} }
if(pCKP->shutdown == SHUTDOWN_NEW_GAME) return 0;
g_pLogFile->ftextOut("bottom of game control loop opt=%d crashflag=%d<br>", opt, crashflag); g_pLogFile->ftextOut("bottom of game control loop opt=%d crashflag=%d<br>", opt, crashflag);
if(pCKP->shutdown == SHUTDOWN_EXIT) break; if(pCKP->shutdown == SHUTDOWN_EXIT) break;
} while(opt != MAINMNU_QUIT && opt != MAINMNU_NEW_GAME && !crashflag); } while(opt != MAINMNU_QUIT && opt != MAINMNU_NEW_GAME && !crashflag);

View File

@@ -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;y<bitmaps[b].ysize;y++)
{
for(x=0;x<bitmaps[b].xsize;x++)
{
g_pVideoDriver->setpixel((x+xa+scrollx_buf-130)&511,(y+ya+scrolly_buf-30)&511,*bmdataptr);
bmdataptr++;
}
}
}
int CGraphics::getBitmapNumberFromName(const char *bmname) int CGraphics::getBitmapNumberFromName(const char *bmname)
{ {

View File

@@ -41,6 +41,7 @@ public:
void initPalette(int dark); void initPalette(int dark);
void fadePalette(int fadeamt); void fadePalette(int fadeamt);
void drawBitmap(int xa, int ya, int b); void drawBitmap(int xa, int ya, int b);
void drawBitmap2FG(int xa, int ya, int b);
int getBitmapNumberFromName(const char *bmname); int getBitmapNumberFromName(const char *bmname);
void sb_drawCharacterinverse(int x, int y, int f); void sb_drawCharacterinverse(int x, int y, int f);
void drawFont(unsigned char *text, int xoff, int yoff, int highlight); void drawFont(unsigned char *text, int xoff, int yoff, int highlight);

View File

@@ -8,7 +8,7 @@
#ifndef CLOGFILE_H_ #ifndef CLOGFILE_H_
#define 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 <stdio.h> #include <stdio.h>
#include "CSingleton.h" #include "CSingleton.h"

View File

@@ -96,7 +96,7 @@ unsigned int ep3;
// got hit? // got hit?
if (objects[o].zapped) if (objects[o].zapped)
{ {
if (objects[o].zapped > 1 || !options[OPT_MEAN].value) if (objects[o].zapped > 1 || !levelcontrol.hardmode)
{ // we're fried!! { // we're fried!!
if (objects[o].ai.baby.state != BABY_DYING) if (objects[o].ai.baby.state != BABY_DYING)
{ {

View File

@@ -30,7 +30,7 @@
#define BUTLER_TURNLEFT_FRAME 96 #define BUTLER_TURNLEFT_FRAME 96
#define BUTLER_TURNRIGHT_FRAME 97 #define BUTLER_TURNRIGHT_FRAME 97
void butler_ai(int o) void butler_ai(int o, bool hardmode)
{ {
char not_about_to_fall; char not_about_to_fall;
if (objects[o].needinit) if (objects[o].needinit)
@@ -58,14 +58,14 @@ char not_about_to_fall;
if (player[primaryplayer].x < objects[o].x) if (player[primaryplayer].x < objects[o].x)
{ {
player[objects[o].touchedBy].playpushed_x = -butlerpushamount; 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].playpushed_decreasetimer = 0;
player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = LEFT; player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = LEFT;
} }
else else
{ {
player[objects[o].touchedBy].playpushed_x = butlerpushamount; 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].playpushed_decreasetimer = 0;
player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = RIGHT; 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; objects[o].sprite = BUTLER_WALK_LEFT_FRAME + objects[o].ai.butler.frame;
if (!objects[o].blockedl && not_about_to_fall) if (!objects[o].blockedl && not_about_to_fall)
{ {
if (options[OPT_MEAN].value) if (hardmode)
objects[o].x -= BUTLER_WALK_SPEED_FAST; objects[o].x -= BUTLER_WALK_SPEED_FAST;
else else
objects[o].x -= BUTLER_WALK_SPEED; 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; objects[o].sprite = BUTLER_WALK_RIGHT_FRAME + objects[o].ai.butler.frame;
if (!objects[o].blockedr && not_about_to_fall) if (!objects[o].blockedr && not_about_to_fall)
{ {
if (options[OPT_MEAN].value) if (hardmode)
objects[o].x += BUTLER_WALK_SPEED_FAST; objects[o].x += BUTLER_WALK_SPEED_FAST;
else else
objects[o].x += BUTLER_WALK_SPEED; objects[o].x += BUTLER_WALK_SPEED;
@@ -129,7 +129,7 @@ char not_about_to_fall;
} }
// walk animation // walk animation
if (objects[o].ai.butler.animtimer > BUTLER_WALK_ANIM_TIME || \ 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; if (objects[o].ai.butler.frame>=3) objects[o].ai.butler.frame=0;
else objects[o].ai.butler.frame++; else objects[o].ai.butler.frame++;

View File

@@ -54,7 +54,7 @@ unsigned int i;
objects[o].ai.foob.state = FOOB_EXPLODE; objects[o].ai.foob.state = FOOB_EXPLODE;
objects[o].canbezapped = 0; objects[o].canbezapped = 0;
if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_YORP_DIE, PLAY_NOW, objects[o].scrx); 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); killplayer(objects[o].touchedBy, pCKP);
} }

View File

@@ -205,7 +205,7 @@ unsigned int i;
if (garg_CanWalkLeft(o)) if (garg_CanWalkLeft(o))
{ {
if (options[OPT_MEAN].value) if (pCKP->Control.levelcontrol.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 (options[OPT_MEAN].value) if (pCKP->Control.levelcontrol.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;
@@ -239,7 +239,7 @@ 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 && 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.walkframe ^= 1;
objects[o].ai.garg.timer = 0; objects[o].ai.garg.timer = 0;

View File

@@ -11,8 +11,8 @@
#define MOTHER_HURT 2 #define MOTHER_HURT 2
#define MOTHER_DEAD 3 #define MOTHER_DEAD 3
#define MOTHER_WALK_ANIM_RATE 70 #define MOTHER_WALK_ANIM_RATE 40
#define MOTHER_WALK_SPD 1 #define MOTHER_WALK_SPD 4
#define MOTHER_SPIT_PROB 1000 #define MOTHER_SPIT_PROB 1000
#define MOTHER_SPIT_SHOW_TIME 100 #define MOTHER_SPIT_SHOW_TIME 100

View File

@@ -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 (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) if (player[primaryplayer].x < objects[o].x)
{ objects[o].ai.ninja.dir = LEFT; } { objects[o].ai.ninja.dir = LEFT; }

View File

@@ -57,7 +57,7 @@ void sndwave_ai(int o, stCloneKeenPlus *pCKP)
} }
else else
{ {
if (options[OPT_MEAN].value) if (pCKP->Control.levelcontrol.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 (options[OPT_MEAN].value) if (pCKP->Control.levelcontrol.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;

View File

@@ -38,7 +38,7 @@
char tank_CanMoveLeft(int o); char tank_CanMoveLeft(int o);
char tank_CanMoveRight(int o); char tank_CanMoveRight(int o);
void tank_ai(int o) void tank_ai(int o, bool hardmode)
{ {
int newobject; int newobject;
unsigned int i; unsigned int i;
@@ -150,11 +150,11 @@ unsigned int i;
if (objects[o].ai.tank.detectedPlayer) if (objects[o].ai.tank.detectedPlayer)
{ {
objects[o].ai.tank.ponsameleveltime++; 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) { // keen would be a good target now. (hard mode)
if (!objects[o].ai.tank.alreadyfiredcauseonsamelevel ||\ if (!objects[o].ai.tank.alreadyfiredcauseonsamelevel ||\
objects[o].ai.tank.ponsameleveltime > TANK_REPEAT_FIRE_TIME || \ 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? // facing keen?
objects[o].ai.tank.alreadyfiredcauseonsamelevel = 1; objects[o].ai.tank.alreadyfiredcauseonsamelevel = 1;
@@ -232,7 +232,7 @@ unsigned int i;
break; break;
case TANK_FIRE: case TANK_FIRE:
if (objects[o].ai.tank.timer > TANK_PREPAREFIRE_TIME || \ 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].onscreen) g_pSound->playStereofromCoord(SOUND_TANK_FIRE, PLAY_NOW, objects[o].scrx);
if (objects[o].ai.tank.movedir==RIGHT) if (objects[o].ai.tank.movedir==RIGHT)

View File

@@ -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 (options[OPT_MEAN].value) if (pCKP->Control.levelcontrol.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;

View File

@@ -44,7 +44,7 @@ int bonk,kill;
objects[o].canbezapped = 1; objects[o].canbezapped = 1;
objects[o].needinit = 0; objects[o].needinit = 0;
if (options[OPT_MEAN].value) if (pCKP->Control.levelcontrol.hardmode)
{ {
objects[o].ai.vort.ep1style = 1; objects[o].ai.vort.ep1style = 1;
} }
@@ -118,7 +118,7 @@ int bonk,kill;
else else
{ {
objects[o].ai.vort.state = VORT2_DYING; objects[o].ai.vort.state = VORT2_DYING;
if (options[OPT_MEAN].value) if (pCKP->Control.levelcontrol.hardmode)
{ {
fade.mode = FADE_GO; fade.mode = FADE_GO;
fade.dir = FADE_IN; fade.dir = FADE_IN;

View File

@@ -126,7 +126,7 @@ char numlooks;
{ {
bump_left: ; bump_left: ;
player[objects[o].touchedBy].playpushed_x = -pushamt; 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; player[objects[o].touchedBy].playpushed_decreasetimer = 0;
if (!player[objects[o].touchedBy].pjumping) if (!player[objects[o].touchedBy].pjumping)
{ {
@@ -137,7 +137,7 @@ char numlooks;
{ {
bump_right: ; bump_right: ;
player[objects[o].touchedBy].playpushed_x = pushamt; 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; player[objects[o].touchedBy].playpushed_decreasetimer = 0;
if (!player[objects[o].touchedBy].pjumping) if (!player[objects[o].touchedBy].pjumping)
{ {
@@ -185,7 +185,7 @@ char numlooks;
} }
break; break;
case YORP_LOOK: 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 &&\ if (objects[o].ai.yorp.looktimes>numlooks &&\
objects[o].ai.yorp.timer==YORP_LOOK_TIME-(YORP_LOOK_TIME/4)) 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; objects[o].sprite = YORP_WALK_LEFT + objects[o].ai.yorp.walkframe;
if (!objects[o].blockedl) if (!objects[o].blockedl)
{ {
if (options[OPT_MEAN].value) if (levelcontrol.hardmode)
objects[o].x -= YORP_WALK_SPEED_FAST; objects[o].x -= YORP_WALK_SPEED_FAST;
else else
objects[o].x -= YORP_WALK_SPEED; objects[o].x -= YORP_WALK_SPEED;
@@ -271,7 +271,7 @@ char numlooks;
objects[o].sprite = YORP_WALK_RIGHT + objects[o].ai.yorp.walkframe; objects[o].sprite = YORP_WALK_RIGHT + objects[o].ai.yorp.walkframe;
if (!objects[o].blockedr) if (!objects[o].blockedr)
{ {
if (options[OPT_MEAN].value) if (levelcontrol.hardmode)
objects[o].x += YORP_WALK_SPEED_FAST; objects[o].x += YORP_WALK_SPEED_FAST;
else else
objects[o].x += YORP_WALK_SPEED; objects[o].x += YORP_WALK_SPEED;
@@ -287,7 +287,7 @@ char numlooks;
} }
// walk animation // walk animation
if (objects[o].ai.yorp.timer > YORP_WALK_ANIM_TIME || \ 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.walkframe ^= 1;
objects[o].ai.yorp.timer = 0; objects[o].ai.yorp.timer = 0;
@@ -297,7 +297,7 @@ char numlooks;
objects[o].sprite = YORP_STUNFRAME + objects[o].ai.yorp.walkframe; objects[o].sprite = YORP_STUNFRAME + objects[o].ai.yorp.walkframe;
if (objects[o].ai.yorp.timer > YORP_STUN_ANIM_TIME) 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) if (objects[o].ai.yorp.looktimes>numlooks)
{ {
objects[o].ai.yorp.looktimes = 0; objects[o].ai.yorp.looktimes = 0;

View File

@@ -1064,7 +1064,7 @@ g_pLogFile->ftextOut("loadstrings(): Opening string file '%s'.<br>", fname);
// into it. We'll need room for both the name and the string, plus // into it. We'll need room for both the name and the string, plus
// null-terminators for each. // null-terminators for each.
RAMSize = strlen( (char*) stName) + strlen((char*)stString) + 2; RAMSize = strlen( (char*) stName) + strlen((char*)stString) + 2;
RAMPtr = (char*) malloc(RAMSize); RAMPtr = (char*) malloc(RAMSize);
if (!RAMPtr) if (!RAMPtr)
{ {
g_pLogFile->ftextOut(RED,"loadstrings(): Could not allocate memory for string '%s'<br>", stName); g_pLogFile->ftextOut(RED,"loadstrings(): Could not allocate memory for string '%s'<br>", stName);

View File

@@ -71,7 +71,7 @@ int readStoryText(char **ptext, int episode, char *path)
} }
else 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)); strncpy((*ptext),(char*)filebuf+startflag,(endflag-startflag)*sizeof(char));
} }
@@ -94,7 +94,7 @@ int readStoryText(char **ptext, int episode, char *path)
pos = 0; pos = 0;
*ptext = (char*) malloc(filesize*sizeof(char)); *ptext = (char*) malloc((filesize+10)*sizeof(char));
while(!feof(fp)) while(!feof(fp))
{ {

View File

@@ -253,8 +253,8 @@ int i;
case OBJ_YORP: yorp_ai(i, pCKP->Control.levelcontrol); break; case OBJ_YORP: yorp_ai(i, pCKP->Control.levelcontrol); break;
case OBJ_GARG: garg_ai(i, pCKP); break; case OBJ_GARG: garg_ai(i, pCKP); break;
case OBJ_VORT: vort_ai(i, pCKP, pCKP->Control.levelcontrol); break; case OBJ_VORT: vort_ai(i, pCKP, pCKP->Control.levelcontrol); break;
case OBJ_BUTLER: butler_ai(i); break; case OBJ_BUTLER: butler_ai(i, pCKP->Control.levelcontrol.hardmode); break;
case OBJ_TANK: tank_ai(i); 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_RAY: ray_ai(i, pCKP, pCKP->Control.levelcontrol); break;
case OBJ_DOOR: door_ai(i); break; case OBJ_DOOR: door_ai(i); break;
case OBJ_ICECHUNK: icechunk_ai(i); break; case OBJ_ICECHUNK: icechunk_ai(i); break;

View File

@@ -409,7 +409,7 @@ void gamepdo_setblockedlru(unsigned int cp, stCloneKeenPlus *pCKP)
for( i=2 ; i < PLAYERHEIGHT ; i++ ) 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].blockedr = 1;
player[cp].widejump = false; player[cp].widejump = false;
@@ -419,7 +419,7 @@ void gamepdo_setblockedlru(unsigned int cp, stCloneKeenPlus *pCKP)
for( i=2 ; i < PLAYERHEIGHT ; i++ ) 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].blockedl = 1;
player[cp].widejump = false; player[cp].widejump = false;
@@ -1645,7 +1645,6 @@ void gamepdo_walking(int cp, stCloneKeenPlus *pCKP)
} }
else if (player[cp].playcontrol[PA_X] < 0) else if (player[cp].playcontrol[PA_X] < 0)
{ {
// quickly reach PFASTINCMAXSPEED // quickly reach PFASTINCMAXSPEED
if (player[cp].pwalkincreasetimer>=cur_pfastincrate && player[cp].pinertia_x>-PFASTINCMAXSPEED) if (player[cp].pwalkincreasetimer>=cur_pfastincrate && player[cp].pinertia_x>-PFASTINCMAXSPEED)
{ {

View File

@@ -41,6 +41,7 @@ typedef struct stLevelControl
char dark; // 1 if level is currently dark (lights are out) char dark; // 1 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)
bool hardmode;
// array of which levels have been completed (have "Done" tiles over them // array of which levels have been completed (have "Done" tiles over them
// on the world map) // on the world map)

View File

@@ -10,8 +10,8 @@
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, stCloneKeenPlus *pCKP);
void vort_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol); void vort_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol);
void butler_ai(int o); void butler_ai(int o, bool hardmode);
void tank_ai(int o); void tank_ai(int o, bool hardmode);
void ray_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol); void ray_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol);
void door_ai(int o); void door_ai(int o);
void icechunk_ai(int o); void icechunk_ai(int o);

View File

@@ -45,7 +45,7 @@
// PFASTINCMAXSPEED. keen can, at a slower rate, // PFASTINCMAXSPEED. keen can, at a slower rate,
// reach up to PMAXSPEED (increased every walk anim frame) // reach up to PMAXSPEED (increased every walk anim frame)
#define PFASTINCMAXSPEED 9 #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 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 16 // accel delay rate up to PFASTINCMAXSPEED
#define PFASTINCRATE_POGO 50 // rate when pogo stick is out #define PFASTINCRATE_POGO 50 // rate when pogo stick is out

View File

@@ -838,7 +838,8 @@ typedef struct stShipQueue
#define SHUTDOWN_NO_ERRORS 0 #define SHUTDOWN_NO_ERRORS 0
#define SHUTDOWN_BOOTUP 1 #define SHUTDOWN_BOOTUP 1
#define SHUTDOWN_RESTART 2 #define SHUTDOWN_RESTART 2
#define SHUTDOWN_EXIT 3 #define SHUTDOWN_NEW_GAME 3
#define SHUTDOWN_EXIT 4
// Video Modes // Video Modes

View File

@@ -191,6 +191,22 @@ int main(int argc, char *argv[])
{ {
CKP.shutdown = SHUTDOWN_NONE; // Game is runnning CKP.shutdown = SHUTDOWN_NONE; // Game is runnning
Game->runCycle(&CKP); 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); initgame(pCKP);
newlevel = p_levelcontrol->chglevelto; 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 // in high-difficulity mode switch levels 5 & 9 so
// you can't get the pogo stick until you make it // 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 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 else if (strcmp(tempbuf, "-cheat")==0) // enable cheat codes
{ {

View File

@@ -159,7 +159,7 @@ short loadStartMenu(stCloneKeenPlus *pCKP)
// Prepare the Games Menu // Prepare the Games Menu
GamesMenu = new CDialog(); GamesMenu = new CDialog();
GamesMenu->setDimensions(2,2,36,5); GamesMenu->setDimensions(2,2,36,15);
// Show me the games you detected! // Show me the games you detected!
for( i=0 ; i < pCKP->numGames ; i++ ) for( i=0 ; i < pCKP->numGames ; i++ )
@@ -182,10 +182,9 @@ short loadStartMenu(stCloneKeenPlus *pCKP)
gamedo_AnimatedTiles(); gamedo_AnimatedTiles();
// Check the Input // Check the Input
if(g_pInput->getPressedCommand(0, IC_DOWN)) if(g_pInput->getPulsedCommand(IC_DOWN, 80))
GamesMenu->setNextSelection(); GamesMenu->setNextSelection();
if(g_pInput->getPulsedCommand(IC_UP, 80))
if(g_pInput->getPressedCommand(0, IC_UP))
GamesMenu->setPrevSelection(); GamesMenu->setPrevSelection();
if(g_pInput->getPressedCommand(0, IC_STATUS)) if(g_pInput->getPressedCommand(0, IC_STATUS))
@@ -220,6 +219,12 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
int x; int x;
int selection; int selection;
for(unsigned int cp=0 ; cp<numplayers ; cp++) // in some situations. the player is shown for a short time.
{
player[cp].x = 0;
player[cp].y = 0;
}
fade.mode = FADE_GO; fade.mode = FADE_GO;
fade.rate = FADE_NORM; fade.rate = FADE_NORM;
fade.dir = FADE_IN; fade.dir = FADE_IN;
@@ -266,10 +271,9 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
gamedo_AnimatedTiles(); gamedo_AnimatedTiles();
// Check the Input // Check the Input
if(g_pInput->getPressedCommand(IC_DOWN)) if(g_pInput->getPulsedCommand(IC_DOWN, 80))
MainMenu->setNextSelection(); MainMenu->setNextSelection();
if(g_pInput->getPulsedCommand(IC_UP, 80))
if(g_pInput->getPressedCommand(IC_UP))
MainMenu->setPrevSelection(); MainMenu->setPrevSelection();
if(g_pInput->getPressedCommand(IC_STATUS)) if(g_pInput->getPressedCommand(IC_STATUS))
@@ -286,7 +290,10 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
gamedo_frameskipping_blitonly(); gamedo_frameskipping_blitonly();
if(g_pInput->getExitEvent()) if(g_pInput->getExitEvent())
{
delete MainMenu;
return MAINMNU_QUIT; return MAINMNU_QUIT;
}
} while(1); } while(1);
@@ -299,7 +306,7 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
return BACK2MAINMENU; return BACK2MAINMENU;
} }
options[OPT_MEAN].value = diff; pCKP->Control.levelcontrol.hardmode = (diff == 1) ? true : false;
loadslot = save_slot_box(0, pCKP); loadslot = save_slot_box(0, pCKP);
if (loadslot) if (loadslot)
@@ -325,15 +332,16 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
{ {
if(selection==MAINMNU_1PLAYER || selection==MAINMNU_2PLAYER) if(selection==MAINMNU_1PLAYER || selection==MAINMNU_2PLAYER)
{ {
int diff; int diff;
diff = getDifficulty(pCKP); diff = getDifficulty(pCKP);
if(diff>2) if(diff>2)
{ {
delete MainMenu; delete MainMenu;
return BACK2MAINMENU; return BACK2MAINMENU;
} }
pCKP->Control.levelcontrol.hardmode = (diff == 1) ? true : false;
options[OPT_MEAN].value = diff;
} }
fade.dir = FADE_OUT; fade.dir = FADE_OUT;
@@ -400,10 +408,9 @@ int getDifficulty(stCloneKeenPlus *pCKP)
gamedo_AnimatedTiles(); gamedo_AnimatedTiles();
// Check the Input // Check the Input
if(g_pInput->getPressedCommand(IC_DOWN)) if(g_pInput->getPulsedCommand(IC_DOWN, 80))
DifficultyMenu->setNextSelection(); DifficultyMenu->setNextSelection();
if(g_pInput->getPulsedCommand(IC_UP, 80))
if(g_pInput->getPressedCommand(IC_UP))
DifficultyMenu->setPrevSelection(); DifficultyMenu->setPrevSelection();
if(g_pInput->getPressedCommand(IC_STATUS)) if(g_pInput->getPressedCommand(IC_STATUS))
@@ -473,10 +480,9 @@ int AudioDlg(stCloneKeenPlus *pCKP)
gamedo_AnimatedTiles(); gamedo_AnimatedTiles();
// Check the Input // Check the Input
if(g_pInput->getPressedCommand(IC_DOWN)) if(g_pInput->getPulsedCommand(IC_DOWN, 80))
AudioMenu->setNextSelection(); AudioMenu->setNextSelection();
if(g_pInput->getPulsedCommand(IC_UP, 80))
if(g_pInput->getPressedCommand(IC_UP))
AudioMenu->setPrevSelection(); AudioMenu->setPrevSelection();
if(g_pInput->getPressedCommand(IC_STATUS)) if(g_pInput->getPressedCommand(IC_STATUS))
@@ -584,9 +590,9 @@ void OptionsDlg(stCloneKeenPlus *pCKP)
gamedo_AnimatedTiles(); gamedo_AnimatedTiles();
// Check the Input // Check the Input
if(g_pInput->getPressedCommand(IC_DOWN)) if(g_pInput->getPulsedCommand(IC_DOWN, 80))
OptionsMenu->setNextSelection(); OptionsMenu->setNextSelection();
if(g_pInput->getPressedCommand(IC_UP)) if(g_pInput->getPulsedCommand(IC_UP, 80))
OptionsMenu->setPrevSelection(); OptionsMenu->setPrevSelection();
if(g_pInput->getPressedCommand(IC_STATUS)) if(g_pInput->getPressedCommand(IC_STATUS))
@@ -737,9 +743,9 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
aspect = g_pVideoDriver->getAspectCorrection(); aspect = g_pVideoDriver->getAspectCorrection();
if(aspect) if(aspect)
DisplayMenu->addOptionText("Aspect Ratio Enabled"); DisplayMenu->addOptionText("OGL Aspect Ratio Enabled");
else else
DisplayMenu->addOptionText("Aspect Ratio Disabled"); DisplayMenu->addOptionText("OGL Aspect Ratio Disabled");
DisplayMenu->addSeparator(); DisplayMenu->addSeparator();
DisplayMenu->addOptionText("Save and return"); DisplayMenu->addOptionText("Save and return");
@@ -755,9 +761,9 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
gamedo_AnimatedTiles(); gamedo_AnimatedTiles();
// Check the Input // Check the Input
if(g_pInput->getPressedCommand(IC_DOWN)) if(g_pInput->getPulsedCommand(IC_DOWN, 80))
DisplayMenu->setNextSelection(); DisplayMenu->setNextSelection();
if(g_pInput->getPressedCommand(IC_UP)) if(g_pInput->getPulsedCommand(IC_UP, 80))
DisplayMenu->setPrevSelection(); DisplayMenu->setPrevSelection();
if(g_pInput->getPressedCommand(IC_STATUS)) if(g_pInput->getPressedCommand(IC_STATUS))
@@ -821,7 +827,7 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
} }
else else
{ {
if(zoom >= 3) if(zoom >= 4)
zoom = 1; zoom = 1;
else else
zoom++; zoom++;
@@ -849,7 +855,7 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
else if(filter == 2) else if(filter == 2)
DisplayMenu->setOptionText(3,"Scale3x Filter"); DisplayMenu->setOptionText(3,"Scale3x Filter");
else if(filter == 3) else if(filter == 3)
DisplayMenu->setOptionText(3,"Scale4x Filter (OpenGL)"); DisplayMenu->setOptionText(3,"Scale4x Filter");
} }
else if(selection == 4) else if(selection == 4)
{ {
@@ -890,9 +896,9 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
aspect = !aspect; aspect = !aspect;
if(aspect) if(aspect)
DisplayMenu->setOptionText(7,"Aspect Ratio Enabled"); DisplayMenu->setOptionText(7,"OGL Aspect Ratio Enabled");
else else
DisplayMenu->setOptionText(7,"Aspect Ratio Disabled"); DisplayMenu->setOptionText(7,"OGL Aspect Ratio Disabled");
} }
else if(selection == 9) else if(selection == 9)
@@ -1147,10 +1153,9 @@ char configmenu(stCloneKeenPlus *pCKP)
gamedo_AnimatedTiles(); gamedo_AnimatedTiles();
// Check the Input // Check the Input
if(g_pInput->getPressedCommand(IC_DOWN)) if(g_pInput->getPulsedCommand(IC_DOWN, 80))
OptionsMenu->setNextSelection(); OptionsMenu->setNextSelection();
if(g_pInput->getPulsedCommand(IC_UP, 80))
if(g_pInput->getPressedCommand(IC_UP))
OptionsMenu->setPrevSelection(); OptionsMenu->setPrevSelection();
if(g_pInput->getPressedCommand(IC_STATUS)) if(g_pInput->getPressedCommand(IC_STATUS))
@@ -1282,9 +1287,9 @@ char controlsmenu(stCloneKeenPlus *pCKP)
gamedo_AnimatedTiles(); gamedo_AnimatedTiles();
// Check the Input // Check the Input
if(g_pInput->getPressedCommand(IC_DOWN)) if(g_pInput->getPulsedCommand(IC_DOWN, 80))
ControlsMenu->setNextSelection(); ControlsMenu->setNextSelection();
if(g_pInput->getPressedCommand(IC_UP)) if(g_pInput->getPulsedCommand(IC_UP, 80))
ControlsMenu->setPrevSelection(); ControlsMenu->setPrevSelection();
if(g_pInput->getPressedCommand(IC_STATUS)) if(g_pInput->getPressedCommand(IC_STATUS))

View File

@@ -11,6 +11,7 @@
#include "CInput.h" #include "CInput.h"
#include "../CLogFile.h" #include "../CLogFile.h"
#include "CVideoDriver.h" #include "CVideoDriver.h"
#include "CTimer.h"
#ifdef WIZ #ifdef WIZ
#include "gp2x.h" #include "gp2x.h"
@@ -21,6 +22,8 @@ CInput::CInput() {
Uint8 i; Uint8 i;
m_exit = false; m_exit = false;
m_cmdpulse = 0;
m_joydeadzone = 6400;
memset(immediate_keytable,false,KEYTABLE_SIZE); memset(immediate_keytable,false,KEYTABLE_SIZE);
memset(last_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_DOWN].keysym = SDLK_DOWN;
InputCommand[i][IC_JUMP].keysym = SDLK_RCTRL; 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_FIRE].keysym = SDLK_SPACE;
InputCommand[i][IC_STATUS].keysym = SDLK_RETURN; 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 ) if(Event.jaxis.axis == InputCommand[j][i].joyaxis && Event.jaxis.which == InputCommand[j][i].which )
{ {
// Deadzone // Deadzone
if((Event.jaxis.value > 3200 && InputCommand[0][i].joyvalue > 0) || if((Event.jaxis.value > m_joydeadzone && InputCommand[0][i].joyvalue > 0) ||
(Event.jaxis.value < -3200 && InputCommand[0][i].joyvalue < 0)) (Event.jaxis.value < -m_joydeadzone && InputCommand[0][i].joyvalue < 0))
InputCommand[j][i].active = true; InputCommand[j][i].active = true;
else else
InputCommand[j][i].active = false; InputCommand[j][i].active = false;
@@ -314,7 +317,7 @@ void CInput::processKeys(int value)
case SDLK_RETURN:immediate_keytable[KENTER] = value; break; case SDLK_RETURN:immediate_keytable[KENTER] = value; break;
case SDLK_RCTRL:immediate_keytable[KCTRL] = value; break; case SDLK_RCTRL:immediate_keytable[KCTRL] = value; break;
case SDLK_SPACE:immediate_keytable[KSPACE] = 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_TAB:immediate_keytable[KTAB] = value; break;
case SDLK_LSHIFT:immediate_keytable[KLSHIFT] = value; break; case SDLK_LSHIFT:immediate_keytable[KLSHIFT] = value; break;
case SDLK_ESCAPE:immediate_keytable[KQUIT] = value; break; case SDLK_ESCAPE:immediate_keytable[KQUIT] = value; break;
@@ -392,6 +395,7 @@ bool CInput::getPressedKey(int key)
return false; return false;
} }
bool CInput::getPressedAnyKey(void) bool CInput::getPressedAnyKey(void)
{ {
int i; int i;
@@ -438,6 +442,33 @@ bool CInput::getPressedCommand(Uint8 player, int command)
return false; return false;
} }
bool CInput::getPulsedCommand(int command, int msec)
{
bool retval = false;
for(Uint8 player=0; player<NUM_INPUTS ; player++ )
retval |= getPulsedCommand(player, command, msec);
return retval;
}
bool CInput::getPulsedCommand(Uint8 player, int command, int msec)
{
if(InputCommand[player][command].active)
{
bool value = true;
if(m_cmdpulse % msec != 0)
{
value = false;
}
m_cmdpulse++;
return value;
}
if(!InputCommand[player][command].active && InputCommand[player][command].lastactive )
m_cmdpulse = 0;
return false;
}
bool CInput::getPressedAnyCommand() bool CInput::getPressedAnyCommand()
{ {
bool retval = true; bool retval = true;
@@ -457,11 +488,19 @@ bool CInput::getPressedAnyCommand(Uint8 player)
return false; return false;
} }
void CInput::flushCommands(void)
{
for(int i=0 ; i<NUM_INPUTS ; i++)
for(int j=0 ; j<NUMBER_OF_COMMANDS ; j++)
InputCommand[i][j].active = InputCommand[i][j].lastactive = false;
}
void CInput::flushKeys(void) void CInput::flushKeys(void)
{ {
memset(immediate_keytable,false,KEYTABLE_SIZE); memset(immediate_keytable,false,KEYTABLE_SIZE);
memset(last_immediate_keytable,false,KEYTABLE_SIZE); memset(last_immediate_keytable,false,KEYTABLE_SIZE);
} }
void CInput::flushAll(void){ flushKeys(); flushCommands(); }
#ifdef WIZ #ifdef WIZ
void CInput::WIZ_EmuKeyboard( int button, int value ) void CInput::WIZ_EmuKeyboard( int button, int value )

View File

@@ -149,10 +149,12 @@ public:
bool getPressedAnyKey(void); bool getPressedAnyKey(void);
void sendKey(int key); void sendKey(int key);
bool getPressedAnyCommand();
bool getPulsedCommand(int command, int msec);
bool getPulsedCommand(Uint8 player, int command, int msec);
bool getHoldedCommand(Uint8 player, int command);
bool getHoldedCommand(int command); bool getHoldedCommand(int command);
bool getPressedCommand(int command); bool getPressedCommand(int command);
bool getPressedAnyCommand();
bool getHoldedCommand(Uint8 player, int command);
bool getPressedCommand(Uint8 player, int command); bool getPressedCommand(Uint8 player, int command);
bool getPressedAnyCommand(Uint8 player); bool getPressedAnyCommand(Uint8 player);
bool getExitEvent(void); bool getExitEvent(void);
@@ -165,11 +167,15 @@ public:
short saveControlconfig(void); short saveControlconfig(void);
void flushKeys(void); void flushKeys(void);
void flushCommands(void);
void flushAll(void);
private: private:
SDL_Event Event; SDL_Event Event;
stInputCommand InputCommand[NUM_INPUTS][NUMBER_OF_COMMANDS]; stInputCommand InputCommand[NUM_INPUTS][NUMBER_OF_COMMANDS];
bool m_exit; bool m_exit;
int m_cmdpulse;
short m_joydeadzone;
bool immediate_keytable[KEYTABLE_SIZE]; bool immediate_keytable[KEYTABLE_SIZE];
bool last_immediate_keytable[KEYTABLE_SIZE]; bool last_immediate_keytable[KEYTABLE_SIZE];

View File

@@ -15,9 +15,8 @@
#define OPT_TWOBUTTON 4 #define OPT_TWOBUTTON 4
#define OPT_KEYCARDSTACK 5 #define OPT_KEYCARDSTACK 5
#define OPT_ANALOGJOYSTICK 6 #define OPT_ANALOGJOYSTICK 6
#define OPT_MEAN 7
#define NUM_OPTIONS 8 #define NUM_OPTIONS 7
typedef struct stOption typedef struct stOption
{ {

View File

@@ -43,6 +43,8 @@ public:
uint8 getFrameskip(void){ return m_frameskip; } uint8 getFrameskip(void){ return m_frameskip; }
void setFrameskip(uint8 frameskip){ m_frameskip = frameskip; } void setFrameskip(uint8 frameskip){ m_frameskip = frameskip; }
uint64 getTime(void) { return ltime; }
private: private:
uint64 ttime; uint64 ttime;

View File

@@ -154,14 +154,18 @@ bool CVideoDriver::initOpenGL()
bool CVideoDriver::applyMode(void) bool CVideoDriver::applyMode(void)
{ {
// Check if some zoom/filter modes are illogical // Check if some zoom/filter modes are illogical
// TODO: Make this call clearer to understand
if( (Zoom == 3 && Filtermode == 1) && !m_opengl ) if( (Zoom == 3 && Filtermode == 1) && !m_opengl )
Zoom = 2; Zoom = 2;
// Grab a surface on the screen // Grab a surface on the screen
Mode = SDL_HWPALETTE; Mode = SDL_HWPALETTE;
#ifndef WIZ
// Support for doublebuffering // Support for doublebuffering
Mode |= SDL_DOUBLEBUF; Mode |= SDL_DOUBLEBUF;
#endif
// Enable OpenGL // Enable OpenGL
#ifdef USE_OPENGL #ifdef USE_OPENGL
@@ -506,6 +510,39 @@ void CVideoDriver::update_screen(void)
SDL_UnlockSurface(screen); SDL_UnlockSurface(screen);
SDL_UnlockSurface(BlitSurface); SDL_UnlockSurface(BlitSurface);
} }
else if (Zoom == 4)
{
SDL_LockSurface(BlitSurface);
SDL_LockSurface(screen);
if(Filtermode == 0)
{
scale4xnofilter((char*)VRAMPtr, (char*)BlitSurface->pixels, (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<br>");
g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter<br>");
Filtermode = 0;
}
SDL_UnlockSurface(screen);
SDL_UnlockSurface(BlitSurface);
}
SDL_Flip(screen); SDL_Flip(screen);
//SDL_UpdateRect(screen, screenrect.x, screenrect.y, screenrect.w, screenrect.h); //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))<<bbp);
desttemp = dest+((4*(j+(i*Width)))<<bbp);
memcpy(desttemp,srctemp,bbp<<1);
memcpy(desttemp+(1<<bbp),srctemp,bbp<<1);
memcpy(desttemp+(2<<bbp),srctemp,bbp<<1);
memcpy(desttemp+(3<<bbp),srctemp,bbp<<1);
}
srctemp = dest+(((i<<2)*Width)<<bbp);
desttemp = dest+((((i<<2)+1)*Width)<<bbp);
size = GAME_STD_WIDTH*(bbp<<1<<2);
memcpy(desttemp,srctemp,size);
memcpy(desttemp+(Width<<bbp),srctemp,size);
memcpy(desttemp+((Width<<bbp)<<1),srctemp,size);
}
}
// functions to directly set and retrieve pixels from the VGA display // functions to directly set and retrieve pixels from the VGA display
void CVideoDriver::setpixel(unsigned int x, unsigned int y, unsigned char c) void CVideoDriver::setpixel(unsigned int x, unsigned int y, unsigned char c)
{ {
if( x > Width || y > Height ) if( x >= GAME_STD_WIDTH || y >= GAME_STD_HEIGHT ) // out of Bonds!!!
return; return;

View File

@@ -42,6 +42,7 @@ public:
void noscale(char *dest, char *src, short bbp); void noscale(char *dest, char *src, short bbp);
void scale2xnofilter(char *dest, char *src, short bbp); void scale2xnofilter(char *dest, char *src, short bbp);
void scale3xnofilter(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); void setpixel(unsigned int x, unsigned int y, unsigned char c);
unsigned char getpixel(int x, int y); unsigned char getpixel(int x, int y);
@@ -69,9 +70,9 @@ public:
void setFrameskip(unsigned short value); void setFrameskip(unsigned short value);
void setFilter(short value); void setFilter(short value);
void setZoom(short vale); void setZoom(short vale);
bool initOpenGL();
#ifdef USE_OPENGL #ifdef USE_OPENGL
void enableOpenGL(bool value) { m_opengl = value; } void enableOpenGL(bool value) { m_opengl = value; }
bool initOpenGL();
void setOGLFilter(unsigned char value) { m_opengl_filter = (value==1) ? GL_LINEAR : GL_NEAREST ; } void setOGLFilter(unsigned char value) { m_opengl_filter = (value==1) ? GL_LINEAR : GL_NEAREST ; }
#else #else
void enableOpenGL(bool value) { m_opengl = false; } void enableOpenGL(bool value) { m_opengl = false; }

View File

@@ -27,7 +27,6 @@ void CCallback(void *unused, Uint8 *stream, int len)
CSound::CSound() { CSound::CSound() {
m_active = false; m_active = false;
m_volume = 0;
m_mixing_channels = 0; m_mixing_channels = 0;
m_soundchannel = NULL; m_soundchannel = NULL;
m_soundslot = NULL; m_soundslot = NULL;
@@ -46,33 +45,40 @@ CSound::~CSound() {
bool CSound::init(void) bool CSound::init(void)
{ {
char name[MAX_STRING_LENGTH]; char name[MAX_STRING_LENGTH];
SDL_AudioSpec *desired, *obtained;
desired = &AudioSpec;
obtained = new SDL_AudioSpec;
// now start up the SDL sound system // now start up the SDL sound system
AudioSpec.silence = 0; 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.callback = CCallback;
AudioSpec.userdata = NULL; AudioSpec.userdata = NULL;
/* Initialize fillerup() variables */ /* Initialize variables */
if( SDL_OpenAudio(&AudioSpec, NULL) < 0 ) if( SDL_OpenAudio(desired, obtained) < 0 )
{ {
g_pLogFile->ftextOut("SoundDrv_Start(): The Sound settings don't work! Going into Failsafemode!<br>"); g_pLogFile->ftextOut("SoundDrv_Start(): Couldn't open audio: %s<br>", SDL_GetError());
g_pLogFile->ftextOut("Sound will be disabled.<br>");
AudioSpec.channels = 1; AudioSpec.channels = 0;
AudioSpec.freq = 11000; AudioSpec.format = 0;
AudioSpec.freq = 0;
if( SDL_OpenAudio(&AudioSpec, NULL) < 0 ) m_active = false;
{ return false;
g_pLogFile->ftextOut("SoundDrv_Start(): Couldn't open audio: %s<br>", SDL_GetError());
g_pLogFile->ftextOut("Sound will be disabled.<br>");
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]; m_MixedForm = new Uint8[AudioSpec.size];
g_pLogFile->ftextOut("SDL_AudioSpec:<br>"); g_pLogFile->ftextOut("SDL_AudioSpec:<br>");
@@ -83,16 +89,6 @@ bool CSound::init(void)
m_mixing_channels = 7; 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; if(m_soundchannel) delete[] m_soundchannel; m_soundchannel = NULL;
m_soundchannel = new CSoundChannel[m_mixing_channels]; m_soundchannel = new CSoundChannel[m_mixing_channels];
@@ -502,7 +498,7 @@ char CSound::extractOfExeFile(char *inputpath, int episode)
if (get_bit(&bit_count, &fin)) if (get_bit(&bit_count, &fin))
{ {
unsigned char tmp[2]; unsigned char tmp[2];
if(fread(tmp, 1, 2, fin)) if(!fread(tmp, 1, 2, fin))
{ {
g_pLogFile->ftextOut(RED,"Read-Error!"); g_pLogFile->ftextOut(RED,"Read-Error!");
return 1; return 1;

View File

@@ -52,10 +52,8 @@ private:
SDL_AudioSpec AudioSpec; SDL_AudioSpec AudioSpec;
unsigned short m_volume;
bool m_active; bool m_active;
unsigned short m_mixing_channels; unsigned short m_mixing_channels;
unsigned short m_mixing_channels_base;
Uint8 *m_MixedForm; // Mainly used by the callback function. Declared once and allocated Uint8 *m_MixedForm; // Mainly used by the callback function. Declared once and allocated
}; };

View File

@@ -24,14 +24,11 @@ CCredits::~CCredits() {
void CCredits::Render(stCloneKeenPlus *pCKP) void CCredits::Render(stCloneKeenPlus *pCKP)
{ {
// TODO: Now that the new intro function works, the old one must become int mid[51];
// a credits class char scrolltext[51][80];
int mid[7];
char scrolltext[7][80];
unsigned char pagenumber = 0; unsigned char pagenumber = 0;
int timer = 8; int timer = 8;
int scrolly = 0; int scrolly = -51*8;
bool cancel = false; bool cancel = false;
fade.mode = FADE_GO; fade.mode = FADE_GO;
@@ -42,7 +39,7 @@ void CCredits::Render(stCloneKeenPlus *pCKP)
showmapatpos(90, 104<<4, 32, 0, pCKP); showmapatpos(90, 104<<4, 32, 0, pCKP);
memset(scrolltext,0,7*80); memset(scrolltext,0,51*80);
do do
{ {
@@ -61,11 +58,10 @@ void CCredits::Render(stCloneKeenPlus *pCKP)
else else
{ {
timer=0; timer=0;
if(scrolly>-7*8) scrolly--; if(scrolly>-51*8) scrolly--;
else else
{ {
scrolly = 200; scrolly = 200;
memset(scrolltext,0,7*80);
switch(pagenumber) switch(pagenumber)
{ {
@@ -74,71 +70,67 @@ void CCredits::Render(stCloneKeenPlus *pCKP)
strcpy(scrolltext[1],"Interpreter of"); strcpy(scrolltext[1],"Interpreter of");
strcpy(scrolltext[2],"Commander Keen 1-3"); strcpy(scrolltext[2],"Commander Keen 1-3");
strcpy(scrolltext[3],"Credits"); 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[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; break;
default: cancel = true; 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; mid[j] = (320-(strlen(scrolltext[j])<<3))>>1;
pagenumber++; pagenumber++;
} }
} }
for(int j=0 ; j<7 ; j++) for(int j=0 ; j<51 ; j++)
g_pGraphics->sb_font_draw_inverse( (unsigned char*) scrolltext[j], mid[j], scrolly+(j<<3)); 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() ) if( g_pInput->getPressedAnyCommand() )
{ {

View File

@@ -332,6 +332,8 @@ bool CDialog::setNextSelection()
selection += i; selection += i;
} }
else if(selection >= number_of_options-1)
selection = -1;
return setSelection(selection+1); return setSelection(selection+1);
} }
@@ -346,6 +348,8 @@ bool CDialog::setPrevSelection()
selection -= i; selection -= i;
} }
else if(selection-1 < 0)
selection = number_of_options;
return setSelection(selection-1); return setSelection(selection-1);
} }

View File

@@ -54,6 +54,8 @@ void CIntro::Render(stCloneKeenPlus *pCKP)
for(int j=0 ; j<7 ; j++) for(int j=0 ; j<7 ; j++)
mid[j] = (320/2)-(bitmaps[bmnum[j]].xsize/2); mid[j] = (320/2)-(bitmaps[bmnum[j]].xsize/2);
g_pInput->flushAll();
do do
{ {
// do fades // do fades
@@ -63,13 +65,13 @@ void CIntro::Render(stCloneKeenPlus *pCKP)
// blit the scrollbuffer to the display // blit the scrollbuffer to the display
gamedo_frameskipping_blitonly(); gamedo_frameskipping_blitonly();
g_pGraphics->drawBitmap(mid[0], scrolly, bmnum[0]); g_pGraphics->drawBitmap2FG(mid[0], scrolly, bmnum[0]);
g_pGraphics->drawBitmap(mid[1], scrolly+9, bmnum[1]); g_pGraphics->drawBitmap2FG(mid[1], scrolly+9, bmnum[1]);
g_pGraphics->drawBitmap(mid[2], scrolly+43, bmnum[2]); g_pGraphics->drawBitmap2FG(mid[2], scrolly+43, bmnum[2]);
g_pGraphics->drawBitmap(mid[3], scrolly+56, bmnum[3]); g_pGraphics->drawBitmap2FG(mid[3], scrolly+56, bmnum[3]);
g_pGraphics->drawBitmap(mid[4], scrolly+77, bmnum[4]); g_pGraphics->drawBitmap2FG(mid[4], scrolly+77, bmnum[4]);
g_pGraphics->drawBitmap(mid[5], scrolly+87, bmnum[5]); g_pGraphics->drawBitmap2FG(mid[5], scrolly+87, bmnum[5]);
g_pGraphics->drawBitmap(mid[6], scrolly+120, bmnum[6]); g_pGraphics->drawBitmap2FG(mid[6], scrolly+120, bmnum[6]);
gamedo_AnimatedTiles(); gamedo_AnimatedTiles();
@@ -83,7 +85,7 @@ void CIntro::Render(stCloneKeenPlus *pCKP)
if(scrolly>35) scrolly--; if(scrolly>35) scrolly--;
} }
if( g_pInput->getPressedAnyCommand() ) if( g_pInput->getPressedAnyKey() || g_pInput->getPressedAnyCommand() )
{ {
cancel = true; cancel = true;
fade.dir = FADE_OUT; fade.dir = FADE_OUT;