home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ISV Strong Games
/
ISV_STRONG_GAMES.iso
/
shootemup
/
hive
/
!Hive
/
c
/
waves
< prev
Wrap
Text File
|
2000-11-27
|
1KB
|
64 lines
#include <stdio.h>
#include <string.h>
#include "DeskLib:h.File"
#include "DeskLib:h.SWI"
#include "Popcorn:h.Popcorn"
#include "h.game"
#include "h.sound"
#include "h.useful"
void wave_initialise(int num)
{
FILE *wave_file;
char filename[256], back_name[256];
struct game_object *obj;
int id,x,y,xv,yv;
sprintf(filename, "<Hive$Dir>.Data.Wave%d\0", num);
wave_file = fopen(filename, "rb");
if (wave_file == NULL)
return;
fscanf(wave_file, "%s\n", back_name);
File_LoadTo(back_name, backdrop, NULL);
while (!feof(wave_file))
{
fscanf(wave_file, "%s %d %d %d %d\n", &id, &x, &y, &xv, &yv);
obj = Popcorn_NewPrototype(alien_table, id, x<<12, y<<12);
obj->xv = xv; obj->yv = yv;
aliens_left++;
}
fclose(wave_file);
}
void check_newwave(void)
{
int time;
if (aliens_left == 0 && wave != 0)
{
SWI(0, 1, SWI_OS_ReadMonotonicTime, &time);
if (last_killed_at == -1)
{
make_sound("<Hive$Dir>.Sounds.EndLevel");
last_killed_at = time;
}
if ( (time - last_killed_at) >= 400 )
{
hit_bottom = FALSE;
last_killed_at = -1;
fire_freq = 50;
wave++;
wave_initialise(wave);
}
}
}