Removed profiling

This commit is contained in:
Rob Pearce 2008-10-27 05:12:02 +00:00
parent da87a44e2c
commit 334ed03c27
2 changed files with 57 additions and 13 deletions

View File

@ -1,7 +1,7 @@
all: rc edit
rc: rc.c shared.c rc.h shared.h globals.h defs.h
gcc -pg -Wall -o rc -g rc.c shared.c `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf -lSDL_mixer
gcc -Wall -o rc -g rc.c shared.c `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf -lSDL_mixer
edit: edit.c shared.c edit.h shared.h globals.h defs.h
gcc -D__EDITOR -Wall -o edit -g edit.c shared.c `sdl-config --cflags --libs` -I/usr/local/include -L/usr/local/lib -lSDLmain -lSDL -lSDL_image -lSDL_gfx -lSDL_ttf

68
rc.c
View File

@ -71,6 +71,9 @@ int paused;
int wantframerate = B_FALSE;
int fps;
int fpscount;
int titlemode;
int blinkspeed;
int credits = 0;
@ -672,19 +675,23 @@ int main (int argc, char **argv) {
player->powerup = B_FALSE;
}
} else if (player->powerup == PW_SPRAYUP) { // green overlay for fly spray
SDL_SetAlpha(greenbox, SDL_SRCALPHA, sprayalpha);
sprayalpha += 5;
if (sprayalpha >= 100) {
player->powerup = PW_SPRAYDOWN;
if (levelcomplete != LV_DOPOKER) {
SDL_SetAlpha(greenbox, SDL_SRCALPHA, sprayalpha);
sprayalpha += 5;
if (sprayalpha >= 100) {
player->powerup = PW_SPRAYDOWN;
}
SDL_BlitSurface(greenbox,NULL,screen,NULL);
}
SDL_BlitSurface(greenbox,NULL,screen,NULL);
} else if (player->powerup == PW_SPRAYDOWN) { // green overlay for fly spray
SDL_SetAlpha(greenbox, SDL_SRCALPHA, sprayalpha);
sprayalpha -= 5;
if (sprayalpha <= 0) {
player->powerup = PW_SPRAYUP;
if (levelcomplete != LV_DOPOKER) {
SDL_SetAlpha(greenbox, SDL_SRCALPHA, sprayalpha);
sprayalpha -= 5;
if (sprayalpha <= 0) {
player->powerup = PW_SPRAYUP;
}
SDL_BlitSurface(greenbox,NULL,screen,NULL);
}
SDL_BlitSurface(greenbox,NULL,screen,NULL);
} else if (player->powerup == PW_RATSHAKE) { // horizontal shake due to rat
// shake screen
if (timer % 5 == 0) {
@ -732,6 +739,7 @@ int main (int argc, char **argv) {
if (toggletimer > 0) toggletimer--;
fpscount++;
tick();
} // end main loop
@ -774,6 +782,11 @@ void tick(void) {
} else {
/* once per second */
if (fpsticks - fpsstart >= 1000) {
// calculate frames per second
fps = fpscount;
fpscount = 0;
// incremenet game time
gtime++;
// check for game over - 5 seocnds after game over text disappears
@ -3729,7 +3742,7 @@ void drawscore(void) {
}
if (wantframerate) {
scoreval = SDL_getFramerate(&manager);
scoreval = fps;
} else {
scoreval = player->score;
}
@ -3869,6 +3882,7 @@ void removeall(void) {
text_t *t;
SDL_Rect area;
int clearfull = B_FALSE;
int *animtile;
switch (player->powerup) {
@ -3892,6 +3906,18 @@ void removeall(void) {
if (curlevel->iced) clearfull = B_TRUE;
if (paused) clearfull = B_TRUE;
if (playedbell == BELL_DONESOUND) {
if (timer < BELLTIME) {
clearfull = B_TRUE;
}
}
if (isbosslevel(curlevelnum)) {
clearfull = B_TRUE;
}
if (clearfull) {
// clear the entire screen
SDL_BlitSurface(temps, NULL, screen, NULL);
@ -3912,6 +3938,22 @@ void removeall(void) {
removesprite(s);
}
// animated tiles
for (animtile = curlevel->animtiles; animtile && *animtile != -1; animtile++) {
int offset,tx,ty;
offset = *animtile;
tx = offset%LEVELW; ty = offset / LEVELW;
area.x = tx*TILEW;
area.y = ty*TILEH;
area.w = TILEW;
area.h = TILEH;
SDL_BlitSurface(temps, &area, screen, &area);
}
// remove all text
for (t = text ; t ; t = t->next) {
/* draw text */
@ -7042,7 +7084,7 @@ if (cheat) {
gaincard(player, getrandomcard());
gaincard(player, getrandomcard());
/*
gaincard(player, P_CARDD4);
/gaincard(player, P_CARDD4);
gaincard(player, P_CARDD5);
gaincard(player, P_CARDS8);
gaincard(player, P_CARDH8);
@ -7064,6 +7106,7 @@ if (cheat) {
player->speed = 2; // fast
player->netsticky = B_TRUE;
player->doublejump = B_TRUE;
player->hasbell = B_TRUE;
sprintf(tempm, "Cheat!");
addoutlinetext(player->x,player->y - player->img->h/2, TEXTSIZE_POINTS, tempm,&white,&black,POINTSDELAY,TT_NORM);
toggletimer = 80;
@ -7461,6 +7504,7 @@ void docannoneffect(void) {
if (player->timer3 <= 0) {
player->powerup = B_FALSE;
s->dead = D_FINAL;
SDL_BlitSurface(temps, NULL, screen, NULL);
}
}
}