Most of my code is a big mess with a lot of inefficient fixes. What I'm trying to do right now is no exception.. So imagine that in the last level of my TC, there are "gates" drawn on the wall and whenever you kill and enemy their body disappears and a new enemy is spawned in front of one of the gates at random. The purpose of the body disappearing is to prevent too many actors from crashing the game. The 22 positions that the new actors spawn are hard coded in front of these "gates".
I tried my best to implement this without asking for help, but I'm at a loss. The two problems I'm having are as follows:
1) the enemies are disappearing before their death animation is shown, ideally I'd like them to die, hit the floor and sit for like 10 seconds then disappear, and only after all this would the new enemy spawn.
2) Sometimes when an enemy spawns the game crashes with "MoveObj: bad dir!"
This is at the end of KillActor in WL_STATE.C.
OH! And I'm using the DOS version of the game.
I tried my best to implement this without asking for help, but I'm at a loss. The two problems I'm having are as follows:
1) the enemies are disappearing before their death animation is shown, ideally I'd like them to die, hit the floor and sit for like 10 seconds then disappear, and only after all this would the new enemy spawn.
2) Sometimes when an enemy spawns the game crashes with "MoveObj: bad dir!"
This is at the end of KillActor in WL_STATE.C.
OH! And I'm using the DOS version of the game.
- Code:
if (gamestate.mapon == 9) RemoveObj(ob);
if (gamestate.mapon == 9)
{
int RandomSpawn = US_RndT()%22;
if (RandomSpawn == 0 && tilemap[53][30] == 0) {SpawnStand(en_guard,53,30,116); }
if (RandomSpawn == 1 && tilemap[53][35] == 0) { SpawnGift(53,35); }
if (RandomSpawn == 2 && tilemap[52][42] == 0) { SpawnStand(en_officer,52,42,116); }
if (RandomSpawn == 3 && tilemap[49][51] == 0) { SpawnStand(en_guard,49,51,116); }
if (RandomSpawn == 4 && tilemap[43][54] == 0) { SpawnStand(en_dog,43,54,116); }
if (RandomSpawn == 5 && tilemap[36][55] == 0) { SpawnGift(36,55); }
if (RandomSpawn == 6 && tilemap[29][55] == 0) { SpawnStand(en_guard,29,55,116); }
if (RandomSpawn == 7 && tilemap[22][54] == 0) { SpawnStand(en_officer,22,54,116); }
if (RandomSpawn == 8 && tilemap[15][52] == 0) { SpawnStand(en_guard,15,52,116); }
if (RandomSpawn == 9 && tilemap[11][46] == 0) { SpawnStand(en_ss,11,46,116); }
if (RandomSpawn == 10 && tilemap[9][37] == 0) { SpawnStand(en_guard,9,37,116); }
if (RandomSpawn == 11 && tilemap[9][31] == 0) { SpawnStand(en_dog,9,31,116); }
if (RandomSpawn == 12 && tilemap[9][25] == 0) { SpawnGift(9,25); }
if (RandomSpawn == 13 && tilemap[10][19] == 0) { SpawnSchabbs(10,19); }
if (RandomSpawn == 14 && tilemap[12][14] == 0) { SpawnStand(en_guard,12,14,116); }
if (RandomSpawn == 15 && tilemap[17][10] == 0) { SpawnFakeHitler(17,10); }
if (RandomSpawn == 16 && tilemap[27][8] == 0) { SpawnStand(en_officer,27,8,116); }
if (RandomSpawn == 17 && tilemap[33][8] == 0) { SpawnStand(en_guard,33,8,116); }
if (RandomSpawn == 18 && tilemap[40][9] == 0) { SpawnHitler(40,9); }
if (RandomSpawn == 19 && tilemap[49][13] == 0) { SpawnStand(en_ss,49,13,116); }
if (RandomSpawn == 20 && tilemap[52][18] == 0) { SpawnBoss(52,18); }
if (RandomSpawn == 21 && tilemap[53][25] == 0) { SpawnGretel(53,25); }
}