Main Page | Class List | Directories | File List | Class Members | File Members

old-scroller.c File Reference

#include <stdio.h>
#include <allegro.h>
#include "include/supercsbros.h"

Include dependency graph for old-scroller.c:

Go to the source code of this file.

Functions

void init_win32 ()
void init_freebsd ()
void init_linux ()
void init_unix ()
void init_unknown ()
char * OSinit (int number)
void ticker ()
int initializemusic ()
void loadsprites (void)
void initialize ()
BITMAP * grabframe (BITMAP *source, int width, int height, int startx, int starty, int columns, int frame)
int collided (int x, int y)
void draw_crosshair ()
void get_cd ()
void get_jumpdrive ()
void do_jump ()
void show_menu ()
void settings_menu ()
void restart_level ()
void updatestats ()
void updatescore ()
void updatetime ()
void checkinput ()
void updateplayer ()
int main (void)
 END_OF_MAIN ()


Function Documentation

void checkinput  ) 
 

Definition at line 449 of file old-scroller.c.

References ENVIRONMENT::audio_enabled, ENVIRONMENT::audio_pan, ENVIRONMENT::audio_pitch, ENVIRONMENT::audio_volume, collided(), SPRITE::collision, SPRITE::curframe, ENVIRONMENT::diff_mod, do_jump(), env, SPRITE::framecount, SPRITE::framedelay, get_cd(), get_jumpdrive(), STATS::health, SPRITE::height, jump, JUMPIT, STATS::lives, SPRITE::maxframe, music, player, restart_level(), SPRITE::rightfacing, stats, SPRITE::width, SPRITE::x, and SPRITE::y.

00450 {
00451 
00452   if (key[KEY_1])
00453     {
00454       if (env->audio_enabled)
00455         play_sample(music, env->audio_volume, env->audio_pan, env->audio_pitch, TRUE);
00456     }
00457   if (key[KEY_2])
00458     {
00459       if (env->audio_enabled)
00460       stop_sample(music);
00461     }
00462   if (key[KEY_H])
00463     {
00464       stats->health -= (int)(env->diff_mod * 5);
00465       if (stats->health < 0)
00466         {
00467           allegro_message("You die.  Your corpse is quickly eaten by a grue.");
00468           stats->lives--;
00469           restart_level();
00470         }
00471     }
00472 
00473   if (key[KEY_C])
00474     {
00475       get_cd();
00476     }
00477 
00478   if (key[KEY_J])
00479     {
00480       get_jumpdrive();
00481     }
00482 
00483   if (key[KEY_RIGHT]) 
00484     { 
00485       player->rightfacing = 1; 
00486       player->x+=4; 
00487       if (++player->framecount > player->framedelay)
00488         {
00489           player->framecount=0;
00490           if (++player->curframe > player->maxframe)
00491             player->curframe=1;
00492         }
00493     }
00494   else if (key[KEY_LEFT]) 
00495     { 
00496       player->rightfacing = 0; 
00497       player->x-=4; 
00498       if (++player->framecount > player->framedelay)
00499         {
00500           player->framecount=0;
00501           if (++player->curframe > player->maxframe)
00502             player->curframe=1;
00503         }
00504     }
00505   else player->curframe=0;
00506 
00507   /* this is the "normal" state when walking on a solid surface.                         */
00508   /* when you jump, this value is decreased until it reaches 0, at which point           */
00509   /* the player begins falling (ie gravity takes over and acceleration becomes negative) */
00510   /* until he hits the solid surface, below, once again.                                 */
00511   if (jump==JUMPIT)
00512     {
00513       if (!collided(player->x + player->width/2,
00514                     player->y + player->height+5)) /* this "+5" keeps player from always freaking out when on the ground ;) */
00515         {
00516           jump = 0;
00517           player->collision=0;
00518         }
00519       
00520       if (key[KEY_SPACE]) {
00521         do_jump();
00522         jump = 35;
00523       }
00524     }
00525   /* this is where we're in the air, either going up or going down */
00526   else
00527     {
00528       player->y -= jump/5;
00529       jump--;
00530     }
00531   
00532   if (jump<0)
00533     {
00534       
00535       if (collided(player->x + player->width/2,
00536                    player->y + player->height) ||
00537           collided(player->x + player->width/2, player->y))
00538         {
00539           player->collision=1;
00540           jump = JUMPIT;
00541           while (collided(player->x + player->width/2,
00542                           player->y + player->height))
00543             player->y -= 2;
00544         }
00545     }
00546   return;
00547 }

Here is the call graph for this function:

int collided int  x,
int  y
 

Definition at line 253 of file old-scroller.c.

References BLKSTR::bl, mapblockheight, mapblockwidth, and MapGetBlock().

00254 {
00255   BLKSTR *blockdata;
00256   blockdata = MapGetBlock(x/mapblockwidth, y/mapblockheight);
00257   return blockdata->bl;
00258 }

Here is the call graph for this function:

void do_jump  ) 
 

Definition at line 313 of file old-scroller.c.

References ENVIRONMENT::audio_enabled, ENVIRONMENT::audio_pan, ENVIRONMENT::audio_pitch, ENVIRONMENT::audio_volume, env, and jump_sound.

00314 {
00315   if (env->audio_enabled) {  play_sample(jump_sound, env->audio_volume, env->audio_pan, env->audio_pitch, FALSE); }
00316   return;
00317 }

void draw_crosshair  ) 
 

Definition at line 260 of file old-scroller.c.

References buffer, SPRITE::height, mapxoff, mapyoff, player, RED, SPRITE::width, SPRITE::x, and SPRITE::y.

00261 {
00262   // top left
00263   line(buffer, 
00264        (player->x - 10 - mapxoff), (player->y - mapyoff), 
00265        (player->x + 10 - mapxoff), (player->y - mapyoff), RED);
00266   line(buffer, 
00267        (player->x - mapxoff), (player->y - 10 - mapyoff), 
00268        (player->x - mapxoff), (player->y + 10 - mapyoff), RED);
00269 
00270   // bottom left
00271   line(buffer,
00272        (player->x - 10 - mapxoff), (player->y - mapyoff + player->height), 
00273        (player->x + 10 - mapxoff), (player->y - mapyoff + player->height), RED);
00274   line(buffer, 
00275        (player->x - mapxoff), (player->y - 10 - mapyoff + player->height), 
00276        (player->x - mapxoff), (player->y + 10 - mapyoff + player->height), RED);
00277 
00278   // top right
00279   line(buffer,
00280        (player->x - 10 - mapxoff + player->width), (player->y - mapyoff),
00281        (player->x + 10 - mapxoff + player->width), (player->y - mapyoff), RED);
00282   line(buffer,
00283        (player->x - mapxoff + player->width), (player->y - 10 - mapyoff),
00284        (player->x - mapxoff + player->width), (player->y + 10 - mapyoff), RED);
00285 
00286   // bottom right
00287   line(buffer,
00288        (player->x - 10 - mapxoff + player->width), (player->y - mapyoff + player->height),
00289        (player->x + 10 - mapxoff + player->width), (player->y - mapyoff + player->height), RED);
00290   line(buffer,
00291        (player->x - mapxoff + player->width), (player->y - 10 - mapyoff + player->height), 
00292        (player->x - mapxoff + player->width), (player->y + 10 - mapyoff + player->height), RED);
00293   return;
00294 }

END_OF_MAIN  ) 
 

void get_cd  ) 
 

Definition at line 297 of file old-scroller.c.

References ENVIRONMENT::audio_enabled, ENVIRONMENT::audio_pan, ENVIRONMENT::audio_pitch, ENVIRONMENT::audio_volume, env, jump_sound, STATS::score, and stats.

00298 {
00299   if (env->audio_enabled) {  play_sample(jump_sound, env->audio_volume, env->audio_pan, env->audio_pitch, FALSE); }
00300   stats->score += 35;
00301   return;
00302 }

void get_jumpdrive  ) 
 

Definition at line 305 of file old-scroller.c.

References ENVIRONMENT::audio_enabled, ENVIRONMENT::audio_pan, ENVIRONMENT::audio_pitch, ENVIRONMENT::audio_volume, env, jump_sound, STATS::score, and stats.

00306 {
00307   if (env->audio_enabled) {  play_sample(jump_sound, env->audio_volume, env->audio_pan, env->audio_pitch, FALSE); }
00308   stats->score += 15;
00309   return;
00310 }

BITMAP* grabframe BITMAP *  source,
int  width,
int  height,
int  startx,
int  starty,
int  columns,
int  frame
 

Definition at line 215 of file old-scroller.c.

References temp.

00219 {
00220   BITMAP *temp = create_bitmap(width,height);
00221   int x = startx + (frame % columns) * width;
00222   int y = starty + (frame / columns) * height;
00223   blit(source,temp,x,y,0,0,width,height);
00224   return temp;
00225 }

void init_freebsd  ) 
 

Definition at line 12 of file old-scroller.c.

References ENVIRONMENT::audio_enabled, env, and title_string.

Referenced by OSinit().

00013 {
00014   allegro_message("FreeBSD has not yet been tested; some options will be disabled");
00015   env->audio_enabled = FALSE;
00016   set_window_title(title_string);
00017   return;
00018 }

void init_linux  ) 
 

Definition at line 20 of file old-scroller.c.

References ENVIRONMENT::audio_enabled, env, and title_string.

00021 {
00022   allegro_message("GNU/Linux has not yet been tested; some options will be disabled");
00023   env->audio_enabled = FALSE;
00024   set_window_title(title_string);
00025   return;
00026 }

void init_unix  ) 
 

Definition at line 27 of file old-scroller.c.

References ENVIRONMENT::audio_enabled, env, and title_string.

00028 {
00029   env->audio_enabled = FALSE;
00030   set_window_title(title_string);
00031   return;
00032 }

void init_unknown  ) 
 

Definition at line 33 of file old-scroller.c.

Referenced by OSinit().

00034 {
00035   allegro_message("Your unknown platform has not been tested yet!\nDanger Will Robinson!");
00036   return;
00037 }

void init_win32  ) 
 

Definition at line 5 of file old-scroller.c.

References initializemusic(), and title_string.

00006 {
00007   set_window_title(title_string);
00008   initializemusic();
00009   return;
00010 }

Here is the call graph for this function:

void initialize  ) 
 

Definition at line 178 of file old-scroller.c.

References buffer, counter, ENVIRONMENT::diff_mod, env, STATS::health, HEIGHT, STATS::lives, loadsprites(), map_file, MapLoad(), MODE, OSinit(), STATS::score, stats, and WIDTH.

00179 {
00180   stats = malloc(sizeof(STATS));
00181   env = malloc(sizeof(ENVIRONMENT));
00182   allegro_init();
00183   OSinit(os_type);
00184   
00185   install_timer();
00186   install_keyboard();
00187   install_mouse();
00188   
00189 
00190 
00191   set_color_depth(32);
00192   set_gfx_mode(MODE, WIDTH, HEIGHT, 0, 0);
00193 
00194   if (MapLoad(map_file))
00195     {
00196       allegro_message("Error reading the map file: %s", map_file);
00197       exit(1);
00198     }
00199 
00200   buffer = create_bitmap (WIDTH, HEIGHT);
00201   clear(buffer);
00202 
00203   loadsprites();
00204 
00205 
00206   stats->health = 25;
00207   stats->score = 0;
00208   stats->lives = 3;
00209   env->diff_mod = 0.42;
00210   counter= 300;
00211   return;
00212 }

Here is the call graph for this function:

int initializemusic  ) 
 

Definition at line 87 of file old-scroller.c.

References ENVIRONMENT::audio_enabled, ENVIRONMENT::audio_pan, ENVIRONMENT::audio_pitch, ENVIRONMENT::audio_volume, env, item_file, item_sound, jump_file, jump_sound, and music.

Referenced by init_win32().

00088 {
00089   env->audio_enabled = 1;
00090   env->audio_pan = 128;
00091   env->audio_pitch = 1000;
00092   env->audio_volume = 128;
00093 
00094   if (install_sound(DIGI_AUTODETECT, MIDI_NONE, "") != 0)
00095     {
00096       allegro_message("Error initializing sound system!\nCall Operation Ivy!");
00097       return;
00098     }
00099 
00100   music = load_sample(music_file);
00101   if (!music) {
00102     allegro_message("Can't play background music...\n");
00103     return;
00104   }
00105 
00106   jump_sound = load_sample(jump_file);
00107   if (!jump_sound) { 
00108     allegro_message("Can't make jump sound...\n");
00109     return;
00110   }
00111 
00112   item_sound = load_sample(item_file);
00113   if (!item_sound){
00114     allegro_message("Can't make item pickup sound...\n");
00115     return;
00116   }
00117   return;
00118 }

void loadsprites void   ) 
 

Definition at line 121 of file old-scroller.c.

References bar, SPRITE::collision, SPRITE::curframe, SPRITE::framecount, SPRITE::framedelay, grabframe(), SPRITE::height, SPRITE::maxframe, player, player_bitmap, player_images, SPRITE::rightfacing, temp, SPRITE::width, SPRITE::x, and SPRITE::y.

00122 {
00123   int n;
00124 
00125   // used for health status
00126   temp = load_bitmap("images/progress.bmp", NULL);
00127   progress = grabframe(temp,130,14,0,0,1,0);
00128   bar = grabframe(temp,6,10,130,2,1,0);
00129   destroy_bitmap(temp);
00130 
00131   // Stevie's sprites
00132   temp = load_bitmap(player_bitmap, NULL);
00133   for (n=0; n<8; n++)
00134     player_images[n] = grabframe(temp,50,64,0,0,8,n);
00135   destroy_bitmap(temp);
00136     
00137   player = malloc(sizeof(SPRITE));
00138   player->x = 80;
00139   player->y = 100;
00140   player->curframe=0;
00141   player->framecount=0;
00142   player->framedelay=6;
00143   player->rightfacing=0;
00144   player->maxframe=7;
00145   player->width=player_images[0]->w;
00146   player->height=player_images[0]->h;
00147   player->collision=0;
00148     
00149 /*   //load MIS sprites - yes, we're only using one type for now... */
00150 /*   temp = load_bitmap(enemy_bitmap1, NULL); */
00151 /*   for (n=0; n<8; n++) */
00152 /*     mis_1_images[n] = grabframe(temp,50,64,0,0,8,n); */
00153 /*   destroy_bitmap(temp); */
00154 
00155 /*   for (n=0; n<MAX_ENEMIES; n++) */
00156 /*     { */
00157 /*       enemies[n] = malloc(sizeof(SPRITE)); */
00158 /*       enemies[n]->alive = 0; */
00159 /*       enemies[n]->x = rand() % 100 + 50; */
00160 /*       enemies[n]->y = 0; */
00161 /*       enemies[n]->width = mis_1_images[0]->w; */
00162 /*       enemies[n]->height = mis_1_images[0]->h; */
00163 /*       enemies[n]->xdelay = 4; */
00164 /*       enemies[n]->ydelay = 4; */
00165 /*       enemies[n]->xcount = 0; */
00166 /*       enemies[n]->ycount = 0; */
00167 /*       enemies[n]->xspeed = (rand() % 2 - 3); */
00168 /*       enemies[n]->yspeed = 1; */
00169 /*       enemies[n]->curframe = 0; */
00170 /*       enemies[n]->maxframe = 2; */
00171 /*       enemies[n]->framecount = 0; */
00172 /*       enemies[n]->framedelay = 10; */
00173 /*       enemies[n]->animdir = 1; */
00174 /*     } */
00175 }

Here is the call graph for this function:

int main void   ) 
 

Definition at line 600 of file old-scroller.c.

References buffer, checkinput(), SPRITE::collision, counter, ENVIRONMENT::diff_mod, draw_crosshair(), env, HEIGHT, initialize(), MapFreeMem(), SPRITE::oldpx, SPRITE::oldpy, player, show_menu(), ticker(), ticks, updateplayer(), updatescore(), updatestats(), updatetime(), WIDTH, SPRITE::x, and SPRITE::y.

00601 {
00602   int nticks;
00603   initialize(); 
00604   show_menu();  /* env->diff_mod is given a value here.  it is part of the difficulty setting menu. */
00605   
00606   LOCK_VARIABLE(ticks);
00607   LOCK_FUNCTION(ticker);
00608   install_int_ex(ticker, MSEC_TO_TIMER( (int)(1000 * env->diff_mod)));
00609 
00610   while (!key[KEY_ESC])
00611     {
00612       player->oldpy = player->y; /* XXX: Here be dragons.  We need to keep track of last */
00613       player->oldpx = player->x; /*      position for collision detection                */
00614  
00615       nticks = ticks;
00616       ticks = 0;
00617 
00618       for (; nticks >0; nticks--) {
00619         --counter;
00620       }
00621       player->collision=0;
00622       checkinput();    
00623       updateplayer();
00624       draw_crosshair();
00625       updatestats();
00626       updatescore();
00627       updatetime();
00628       
00629       vsync();
00630       acquire_screen();
00631       blit(buffer, screen, 0, 0, 0, 0, WIDTH-1, HEIGHT-1);
00632       release_screen();
00633     }
00634 
00635   MapFreeMem ();
00636   allegro_exit();
00637 
00638   return 0;
00639 }

Here is the call graph for this function:

char* OSinit int  number  ) 
 

Definition at line 40 of file old-scroller.c.

References init_freebsd(), init_linux(), init_unix(), init_unknown(), and init_win32().

00041 {
00042   switch (number)
00043     {
00044     case OSTYPE_UNKNOWN: return "Unknown or MS-DOS";
00045     case OSTYPE_WIN3:    /* fallthrough */
00046     case OSTYPE_WIN95:   /*      |      */
00047     case OSTYPE_WIN98:   /*      |      */
00048     case OSTYPE_WINME:   /*      |      */
00049     case OSTYPE_WINNT:   /*     \|/     */
00050     case OSTYPE_WIN2000: /*      '      */
00051     case OSTYPE_WINXP:
00052       init_win32(); 
00053       break;
00054     case OSTYPE_OS2:
00055       /* fallthrough */
00056     case OSTYPE_WARP:    
00057     case OSTYPE_DOSEMU:  
00058     case OSTYPE_OPENDOS:
00059       init_unknown();
00060       break;
00061     case OSTYPE_LINUX:
00062       init_linux();
00063       break;
00064     case OSTYPE_FREEBSD:
00065       init_freebsd();
00066       break;
00067     case OSTYPE_QNX:
00068       /* fallthrough */
00069     case OSTYPE_UNIX:
00070       init_unix();
00071       break;
00072     case OSTYPE_BEOS:
00073       /* fallthrough */
00074     case OSTYPE_MACOS:
00075       init_unknown();
00076       break;
00077     }
00078   return "";
00079 }

Here is the call graph for this function:

void restart_level  ) 
 

Definition at line 394 of file old-scroller.c.

References SPRITE::collision, counter, STATS::health, jump, JUMPIT, STATS::lives, player, STATS::score, stats, SPRITE::x, and SPRITE::y.

00395 {
00396   if (stats->lives > 0)
00397     {
00398       stats->health=25;
00399       counter=300;
00400       stats->score=0;
00401       player->x = 80;
00402       player->y = 100;
00403       player->collision=0;
00404       jump = JUMPIT;
00405     }
00406   else
00407     {
00408       allegro_message("Deiner gemütlichkeit is kaput!  Exiting game...\n");
00409       exit(0);
00410     }
00411   return;
00412 }

void settings_menu  ) 
 

Definition at line 387 of file old-scroller.c.

00388 {
00389   allegro_message("Pull up settings menu here");
00390   return;
00391 }

void show_menu  ) 
 

Definition at line 327 of file old-scroller.c.

References bg_file, and settings_menu().

Referenced by main().

00328 {
00329   int n;
00330   int s = 0;
00331   int t = 0;
00332   BITMAP *cursor;
00333   cursor = load_bitmap("images/cursor.pcx", NULL);
00334 
00335   enable_hardware_cursor();
00336   select_mouse_cursor(MOUSE_CURSOR_ARROW);
00337   show_mouse(screen);
00338   
00339   BITMAP *bg;
00340   /* in order: start, settings, quit */
00341   BITMAP *menu_items_unselected[3];
00342   BITMAP *menu_items_selected[3];
00343 
00344   bg = load_bitmap(bg_file, NULL);
00345   if (!bg) {
00346     allegro_message("Error loading %s", bg);
00347     return;
00348   }
00349   blit(bg, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
00350   
00351   destroy_bitmap(bg);
00352 
00353   menu_items_unselected[0] = load_bitmap("menus/start_unselected.pcx", NULL);
00354   menu_items_unselected[1] = load_bitmap("menus/settings_unselected.pcx", NULL);
00355   menu_items_unselected[2] = load_bitmap("menus/quit_unselected.pcx", NULL);
00356   
00357   menu_items_selected[0] = load_bitmap("menus/start_selected.pcx", NULL);
00358   menu_items_selected[1] = load_bitmap("menus/settings_selected.pcx", NULL);
00359   menu_items_selected[2] = load_bitmap("menus/quit_selected.pcx", NULL);
00360 
00361 
00362 
00363   for (n=0; n<3; n++) {
00364     blit(menu_items_unselected[n], screen, 0, 0, 300, (200 + n * 64), SCREEN_W-1, SCREEN_H-1);
00365   }
00366 
00367   blit(menu_items_selected[s], screen, 0, 0, 300, (200 + s * 64), SCREEN_W-1, SCREEN_H-1);
00368   while (1)
00369     {
00370       if (mouse_b & 1) {
00371         if ( (mouse_x >= 300) && (mouse_x <= 510) && (mouse_y >= 200) && (mouse_y <= 263))
00372           return;
00373         if ( (mouse_x >= 300) && (mouse_x <= 510) && (mouse_y >= 264) && (mouse_y <= 327))
00374           settings_menu();
00375         if ( (mouse_x >= 300) && (mouse_x <= 510) && (mouse_y >= 328) && (mouse_y <= 392))
00376           {
00377             for (n=0; n<3; n++) {
00378               destroy_bitmap(menu_items_unselected[n]);
00379               destroy_bitmap(menu_items_selected[n]);
00380             }
00381             exit(0);
00382           }
00383       }
00384     }
00385 }

Here is the call graph for this function:

void ticker  ) 
 

Definition at line 82 of file old-scroller.c.

References ticks.

00083 {
00084   ++ticks;
00085 }

void updateplayer  ) 
 

Definition at line 550 of file old-scroller.c.

References buffer, collided(), SPRITE::collision, SPRITE::curframe, HEIGHT, SPRITE::height, mapblockheight, mapblockwidth, MapDrawBG(), MapDrawFG(), mapheight, mapwidth, mapxoff, mapyoff, SPRITE::oldpx, player, player_images, SPRITE::rightfacing, WIDTH, SPRITE::width, SPRITE::x, and SPRITE::y.

00551 {
00552 
00553   //check for collided with foreground tiles
00554   if (!player->rightfacing) 
00555     { 
00556       if (collided(player->x, player->y + player->height) || collided(player->x, player->y+5)) {
00557         player->collision=1;
00558         player->x = player->oldpx; 
00559       }
00560     }
00561   else 
00562     { 
00563       if (collided(player->x + player->width, player->y + player->height) || collided(player->x + player->width, player->y+5)) {
00564         player->collision=1;
00565         player->x = player->oldpx; 
00566       }
00567     }      
00568   //update the map scroll position
00569   mapxoff = player->x + player->width/2 - WIDTH/2 + 10;
00570   mapyoff = player->y + player->height/2 - HEIGHT/2 + 10;
00571   
00572   
00573   //avoid moving beyond the map edge
00574   if (mapxoff < 0) mapxoff = 0;
00575   if (mapxoff > (mapwidth * mapblockwidth - WIDTH))
00576     mapxoff = mapwidth * mapblockwidth - WIDTH;
00577   if (mapyoff < 0) 
00578     mapyoff = 0;
00579   if (mapyoff > (mapheight * mapblockheight - HEIGHT)) 
00580     mapyoff = mapheight * mapblockheight - HEIGHT;
00581   
00582   //draw the background tiles
00583   MapDrawBG(buffer, mapxoff, mapyoff, 0, 0, WIDTH-1, HEIGHT-1);
00584   
00585   //draw foreground tiles
00586   MapDrawFG(buffer, mapxoff, mapyoff, 0, 0, WIDTH-1, HEIGHT-1, 0);
00587   
00588   //draw the player's sprite
00589   if (player->rightfacing) 
00590     draw_sprite(buffer, player_images[player->curframe], 
00591                 (player->x-mapxoff), (player->y-mapyoff+1));
00592   else 
00593     draw_sprite_h_flip(buffer, player_images[player->curframe], 
00594                        (player->x-mapxoff), (player->y-mapyoff));
00595   return;
00596 }

Here is the call graph for this function:

void updatescore  ) 
 

Definition at line 424 of file old-scroller.c.

References buffer, SPRITE::collision, jump, STATS::lives, player, STATS::score, stats, WHITE, SPRITE::x, and SPRITE::y.

00425 {
00426   textprintf_ex(buffer, font, 15, 5, WHITE, -1,"Score: %d", stats->score);
00427   textprintf_ex(buffer, font, 105, 5, WHITE, -1, "Lives: %d", stats->lives);
00428   textprintf_ex(buffer, font, 210, 5, WHITE, -1, "Jump: %d", jump);
00429   textprintf_ex(buffer, font, 300, 5, WHITE, -1, "Player->x: %d", player->x);
00430   textprintf_ex(buffer, font, 450, 5, WHITE, -1, "Player->y: %d", player->y);
00431   if (jump < 0) {textprintf_ex(buffer, font, 400, 300, WHITE, -1, "FALLING!");}
00432   if (player->collision) {textprintf_ex(buffer, font, 400, 315, WHITE, -1, "Collision!!");}
00433   return;
00434 }

void updatestats  ) 
 

Definition at line 414 of file old-scroller.c.

References bar, and buffer.

00415 {
00416   int n;
00417   draw_sprite(buffer, progress, 14, 15);
00418    
00419   for (n = 0; n < stats->health; n++) {
00420     draw_sprite(buffer, bar, 15+n*5, 17);
00421   }
00422 }

void updatetime  ) 
 

Definition at line 436 of file old-scroller.c.

References counter, restart_level(), WHITE, and WIDTH.

00437 {
00438   if (counter > 0)
00439     textprintf_ex(screen, font, (WIDTH-100), 5, WHITE, -1, "Time: %d", counter);
00440   else
00441     {
00442       allegro_message("You've run out of time.  We should do someting now...like restart the level!\n");
00443       restart_level();
00444     }
00445   return;
00446 }

Here is the call graph for this function:


Generated on Wed Jul 5 09:05:46 2006 for Super CS Brothers by  doxygen 1.4.4