-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevels.cp
2627 lines (2470 loc) · 100 KB
/
levels.cp
1
/****************************************************************************************//* LEVELS.CP *//****************************************************************************************//* (c) 1995 by Magnet Interactive Studios, inc. All rights reserved. *//****************************************************************************************//* Revision History: *//* 8/31/94 File first created. By Andrew Looney. *//* v2.2 9/7/94 Sixteen level version. By Andrew Looney. *//* v2.3 9/23/94 Thirty level version burned onto CD-ROM. By Andrew Looney. *//* 9/27/94 File massively re-written. By Andrew Looney. *//* v2.4 10/19/94 Fifty level version. By Andrew Looney. *//* v2.5 10/31/94 Sixty level version burned onto CD-ROM. By Andrew Looney. *//* v3.0 10/31/94 Began switching over to real artwork. By Andrew Looney. *//* v3.1 11/11/94 COMDEX version. By Andrew Looney. *//* v3.2 12/2/94 Seventy-five level version. By Andrew Looney. *//* v3.3 12/14/94 Ack! Zombies! By Andrew Looney. *//* v3.4 12/23/94 Orange Meanies! By Andrew Looney. *//* v3.5 1/3/95 100 Levels! By Andrew Looney. *//* v3.6 1/5/95 101 Levels. By Andrew Looney. *//* v3.7 1/16/95 New, improved Brainy Seeker logic! By Andrew Looney. *//* v3.8 1/27/95 114 level version burned onto CD-ROM. By Andrew Looney. *//* v3.9 2/3/95 New CD-ROM burned for shipment to 3DO. By Andrew Looney. *//* v4.0 2/9/95 New CD-ROM featuring the big level grid. By Andrew Looney. *//* v4.1 2/22/95 New CD-ROM with rough draft of full interface. By Andrew Looney. *//* v4.2 3/17/95 The St. Patrick's Day Version. By Andrew Looney. *//* v4.3 3/20/95 The last version before the movies get added. By Andrew Looney. *//* v4.4 3/21/95 First version with movies integrated. By Andrew Looney. *//* v4.5 3/22/95 Second version with movies integrated. By Andrew Looney. *//* v4.6 3/27/95 Third version with movies integrated. By Andrew Looney. *//* v5.0 3/28/95 Newest version sent to QA. By Andrew Looney. *//* v5.1 3/28/95 Now, with Easter Eggs! By Andrew Looney. *//* v5.2 3/29/95 Could this be the final version? By Andrew Looney. *//* v5.3 3/30/95 OK, now maybe THIS is the final version! By Andrew Looney. *//* v5.4 4/3/95 Made a couple more minor changes. By Andrew Looney. *//****************************************************************************************//***************************** WHAT THIS SOFTWARE DOES ********************************** This file contains all of the code that deals with loading in the level specificparameters for each level. Most of these functions are top level functions and could justas well be in the application level file (ICEBREAKER.CP); instead, however, they are gathered together into this file because it is easier to integrate a new level if all ofthe level definition stuff is in one place. By this same token, the functionInitializeSeekers (from the seeker class) is located in this file (rather than inSEEKER.CP where it really belongs).*****************************************************************************************//***** includes (make sure CPlusSwiHack.h is the last one) *****/#include "graphics.h"#include "stdio.h"#include "stdlib.h"#include "mem.h"#include "types.h"#include "hardware.h"#include "event.h"#include "strings.h"#include "access.h"#include "UMemory.h"#include "Form3DO.h"#include "Init3DO.h"#include "Parse3DO.h"#include "Utils3DO.h"#include "audio.h"#include "music.h"/***** Magnet includes *****/#include "icebreaker.h"#include "levels.h"#include "animation.h"#include "landscape.h"#include "solids.h"#include "seeker.h"#include "PlayMusic.h"/***** special c++ include (this must be last) *****/#include "CPlusSwiHack.h"/***** global variables *****/extern int32 g_total_pyramids;extern int32 level_lookup_table [ROWS_IN_LANDSCAPE] [COLUMNS_IN_LANDSCAPE];extern int32 g_file_buffer[MAX_FILE_BYTES/4];extern bool g_art_usage[TOTAL_ART_ELEMENTS];extern char g_level_filename[80];extern random_level *random_level_spec;extern landscape pavement;extern solids population;extern seeker enemies;/********************************* FetchLevelName ************************************* This function is used whenever the name of a level is to be displayed. It takes thelevel number as input and returns the name of the level as a string. It also copies thename of the corresponding level spec file into the global variable g_level_filename; thiskills the proverbial two birds with one stone and saves us the trouble of having to maintain two separate, gigantic, level-specific case statements.*****************************************************************************************/void FetchLevelName (char *msg, int32 level){ sprintf (msg, "This level does not yet exist."); strcpy(g_level_filename,"$boot/IceFiles/levels/lesson_2"); switch(level) { case LESSON_1_BLUE: sprintf (msg, "Lesson One: %cBlue Guys%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/lesson_1"); break; case LESSON_2_RED: sprintf (msg, "Lesson Two: %cRed Guys%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/lesson_2"); break; case LESSON_3_GREEN: sprintf (msg, "Lesson Three: %cGreen Guys%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/lesson_3"); break; case LESSON_4_RANDOM_CHANGES: sprintf (msg, "Lesson Four: %cRandom Changes%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/lesson_4"); break; case ROLSTON_LEVEL: sprintf (msg, "%cThe Rolston Level%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/rolston_level"); break; case ORIGINAL_LEVEL: sprintf (msg, "%cThe Original Level%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/original_level"); break; case DONT_PANIC: sprintf (msg, "%cDon't Panic!%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Dont_Panic"); break; case ONCE_AND_FUTURE_PYRAMID: sprintf (msg, "%cThe Once and Future Pyramid%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Once_and_future_pyramid"); break; case DIG_YOUR_OWN_GRAVE: sprintf (msg, "%cDig Your Own Grave%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/dig_your_own_grave"); break; case DONT_FALL_IN_THE_MOAT: sprintf (msg, "%cDon't Fall in the Moat%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/dont_fall_in_the_moat"); break; case LAUGH_WHILE_YOU_CAN: sprintf (msg, "%cLaugh While You Can%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Laugh_while_you_can"); break; case KITCHEN_SINK: sprintf (msg, "%cKitchen Sink%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/kitchen_sink"); break; case BATHROOM_SINK: strcpy(g_level_filename,"$boot/IceFiles/levels/bathroom_sink"); sprintf (msg, "%cBathroom Sink%c",34,34); break; case FIRE_IS_COOL: sprintf (msg, "%cFire is Cool%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Fire_is_Cool"); break; case PASCALS_TRIANGLES: sprintf (msg, "%cPascal's Triangles%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Pascals_triangles"); break; case FIRE_AND_ICE: sprintf (msg, "%cFire and Ice%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/fire_and_ice"); break; case ADVANCED_PITS: sprintf (msg, "%cAdvanced Pits%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/advanced_pits"); break; case BURN_YOUR_BRIDGES: sprintf (msg, "%cBurn Your Bridges%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/burn_your_bridges"); break; case ITS_TOTALLY_RANDOM: sprintf (msg, "%cIt's Totally Random!%c",34,34); strcpy(g_level_filename,"ITS_TOTALLY_RANDOM"); break; case WOODSTOCK: sprintf (msg, "%cWoodstock%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/woodstock"); break; case NEW_XI_CITY: sprintf (msg, "%cNew Xi City%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/new_xi_city"); break; case STONESHOOTER_BLUES: sprintf (msg, "%cStoneshooter Blues%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/stoneshooter_blues"); break; case ARE_YOU_THE_KEYMASTER: sprintf (msg, "%cAre you the Keymaster?%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/are_you_the_keymaster"); break; case MONSTER_ISLAND: sprintf (msg, "%cMonster Island%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/monster_island"); break; case DIVIDE_AND_CONQUER: sprintf (msg, "%cDivide and Conquer%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/divide_and_conquer"); break; case COLORADO: sprintf (msg, "%cColorado%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/colorado"); break; case SEA_OF_GREEN: sprintf (msg, "%cThe Sea of Green%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Sea_of_Green"); break; case X_MARKS_THE_SPOT: sprintf (msg, "%cX Marks the Spot%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/x_marks_the_spot"); break; case SHATTERED_ZONES: sprintf (msg, "%cShattered Zones%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/shattered_zones"); break; case BOX_CANYON: sprintf (msg, "%cBox Canyon%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/box_canyon"); break; case NO_PYRAMID_ZONE: sprintf (msg, "%cNo Pyramid Zone%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/no_pyramid_zone"); break; case CYANIDE_SANDWICH: sprintf (msg, "%cCyanide Sandwich%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/CYANIDE_SANDWICH"); break; case KEY_LIME_DIE: sprintf (msg, "%cKey Lime Die%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/key_lime_die"); break; case RADICAL_LEFTIES: sprintf (msg, "%cRadical Lefties%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/radical_lefties"); break; case ENGLISH_COUNTRY_ROCK_GARDEN: sprintf (msg, "%cEnglish Country Rock Garden%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/english_rock_garden"); break; case CEREAL_KILLERS: sprintf (msg, "%cCereal Killers%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Cereal_Killers"); break; case RIGHT_WING_EXTREMISTS: sprintf (msg, "%cRight Wing Extremists%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/right_wing_extremists"); break; case SLIPPERY_ICE: sprintf (msg, "%cSlippery Ice%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/slippery_ice"); break; case SLIDE_AND_CONQUER: sprintf (msg, "%cSlide and Conquer%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/slide_and_conquer"); break; case BLUE_ICE: sprintf (msg, "%cBlue Ice%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/blue_ice"); break; case MORAINE: sprintf (msg, "%cMoraine%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/moraine"); break; case BREAKFAST_AT_PHILLIES: sprintf (msg, "%cBreakfast at Phillies%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Breakfast_at_Phillies"); break; case YRAMIDSPAY_USTMAY_IEDAY: sprintf (msg, "%cYramidspay Ustmay Ieday!%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Yramidspay_Ustmay_Ieday"); break; case REALM_OF_THE_STONECUTTERS: sprintf (msg, "%cRealm of the Stonecutters%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/stonecutters"); break; case VOLCANO: sprintf (msg, "%cVolcano%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/volcano"); break; case THE_POOL_OF_FIRE: sprintf (msg, "%cThe Pool of Fire%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/the_pool_of_fire"); break; case ZORAKS_LEVEL: sprintf (msg, "%cMantis Z's Green and Evil Level%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/zoraks_level"); break; case NORTH_POLE: sprintf (msg, "%cThe North Pole%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/the_north_pole"); break; case MOLTARS_OVENS: sprintf (msg, "%cOvens of the Molten One%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/moltars_ovens"); break; case A_LEVEL_FOR_CHAMELEON: sprintf (msg, "%cA Level For Chameleon%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/a_level_for_chameleon"); break; case GREEN_AND_PLEASANT: sprintf (msg, "%cA Green and Pleasant Level%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/green_and_pleasant"); break; case ICE_SCREAM: sprintf (msg, "%cIce Scream%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/ice_scream"); break; case THEY_LIVE: sprintf (msg, "%cThey Live%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/they_live"); break; case ITS_NOT_EASY: sprintf (msg, "%cIt's Not Easy Fleeing Green%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/its_not_easy"); break; case FOUR_TRAPS: sprintf (msg, "%c4 Traps for 4 Limeys%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/4_traps"); break; case ELEVEN_TRAPS: sprintf (msg, "%c11 Traps for 11 Limeys%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/11_traps"); break; case KING_ME: sprintf (msg, "%cKing Me%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/king_me"); break; case PURPLE_DAZE: sprintf (msg, "%cPurple Daze%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/purple_daze"); break; case TWELVE_DUDES_A_CREEPING: sprintf (msg, "%c12 Dudes a-Creeping%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/12_dudes_a_creeping"); break; case ALL_THE_PYRAMIDS_MEN: sprintf (msg, "%cAll the Pyramid's Men%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/ALL_THE_PYRAMIDS_MEN"); break; case MOLTARS_FREEZER: sprintf (msg, "%cFreezer of the Molten One%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/MOLTARS_FREEZER"); break; case NINTH_CIRCLE: sprintf (msg, "%cNinth Circle%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/NINTH_CIRCLE"); break; case COMPUTER_IS_YOUR_FRIEND: sprintf (msg, "%cThe Computer is your Friend%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_COMPUTER_IS_YOUR_FRIEND"); break; case HOUSE_OF_PAIN: sprintf (msg, "%cThe House of Pain%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_HOUSE_OF_PAIN"); break; case BRIDE_OF_SLIME: sprintf (msg, "%cBride of the Slime Level%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/bride_of_the_slime_level"); break; case NO_NAME: sprintf (msg, "%cThe Level with No Name%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/the_level_with_no_name"); break; case ARCTIC_COUNTRY_ROCK_GARDEN: sprintf (msg, "%cArctic Country Rock Garden%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/ARCTIC_COUNTRY_ROCK_GARDEN"); break; case ANDYS_WORKSHOP: sprintf (msg, "%cAndy's Workshop%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/andys_workshop"); break; case HARD_ROCK_ZOMBIE_PYRAMIDS: sprintf (msg, "%cHard Rock Zombie Pyramids%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/HARD_ROCK_ZOMBIE_PYRAMIDS"); break; case CROSSFIRE: sprintf (msg, "%cCrossfire%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/CROSSFIRE"); break; case PIT_OF_ICHOR: sprintf (msg, "%cPit of Ichor%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/pit_of_ichor"); break; case THE_FIRE_SWAMP: sprintf (msg, "%cThe Fire Swamp%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/the_fire_swamp"); break; case WELL_YOU_ARE_DEAD: sprintf (msg, "%cWell, You Are Dead%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/WELL_YOU_ARE_DEAD"); break; case BWAHAHAHAHAHA: sprintf (msg, "%cBwahahahahaha%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Bwahahahahaha"); break; case RINGWORLD: sprintf (msg, "%cRingworld%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/ringworld"); break; case SLOT1: sprintf (msg, "Slot 1 (Temporary Test Level)"); strcpy(g_level_filename,"$boot/IceFiles/levels/slot1"); break; case SLOT2: sprintf (msg, "Slot 2 (Temporary Test Level)"); strcpy(g_level_filename,"$boot/IceFiles/levels/slot2"); break; case SLOT3: sprintf (msg, "Slot 3 (Temporary Test Level)"); strcpy(g_level_filename,"$boot/IceFiles/levels/slot3"); break; case SLOT4: sprintf (msg, "Slot 4 (Temporary Test Level)"); strcpy(g_level_filename,"$boot/IceFiles/levels/slot4"); break; case SLOT5: sprintf (msg, "Slot 5 (Temporary Test Level)"); strcpy(g_level_filename,"$boot/IceFiles/levels/slot5"); break; case SLOT6: sprintf (msg, "Slot 6 (Temporary Test Level)"); strcpy(g_level_filename,"$boot/IceFiles/levels/slot6"); break; case SLOT7: sprintf (msg, "Slot 7 (Temporary Test Level)"); strcpy(g_level_filename,"$boot/IceFiles/levels/slot7"); break; case SLOT8: sprintf (msg, "Slot 8 (Temporary Test Level)"); strcpy(g_level_filename,"$boot/IceFiles/levels/slot8"); break; case SLOT9: sprintf (msg, "Slot 9 (Temporary Test Level)"); strcpy(g_level_filename,"$boot/IceFiles/levels/slot9"); break; case UNDERGROUND_SEA: sprintf (msg, "%cUnderground Sea%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/UNDERGROUND_SEA"); break; case DESERT_MAZE: sprintf (msg, "%cDesert Maze%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/DESERT_MAZE"); break; case THE_CATACOMBS: sprintf (msg, "%cThe Catacombs%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_CATACOMBS"); break; case THE_TOMB: sprintf (msg, "%cThe Tomb%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/The_Tomb"); break; case FIVE_PYRAMIDS_IN_SEARCH: sprintf (msg, "%c5 Pyramids in search of an Exit%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/5_pyramids_in_search"); break; case SEA_OF_HOLES: sprintf (msg, "%cThe Sea of Holes%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/sea_of_holes"); break; case IN_THE_ICEHOUSE: sprintf (msg, "%cIn the Icehouse%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/In_the_icehouse"); break; case STOP_N_GO: sprintf (msg, "%cStop n' Go%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/stop_n'_go"); break; case ZOMBIE_FOUNTAIN: sprintf (msg, "%cZombie Fountain%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/zombie_fountain"); break; case NOWHERE_TO_RUN: sprintf (msg, "%cNowhere to Run%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/NOWHERE_TO_RUN"); break; case ZOMBIE_GEYSER: sprintf (msg, "%cZombie Geyser%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/ZOMBIE_GEYSER"); break; case DIE_DIE_ALL_DIE: sprintf (msg, "%cDie Die All Die%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/DIE_DIE_ALL_DIE"); break; case PATHWAYS_IN_THE_SAND: sprintf (msg, "%cPathways in the Sand%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/PATHWAYS_IN_THE_SAND"); break; case THE_PYRAMIDS_OF_DR_MOREAU: sprintf (msg, "%cThe Pyramids of Dr. Moreau%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_PYRAMIDS_OF_DR_MOREAU"); break; case GRAVEYARD: sprintf (msg, "%cGraveyard%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/GRAVEYARD"); break; case MEANYVILLE: sprintf (msg, "%cMeanyville%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/MEANYVILLE"); break; case GOPHER_HOLES: sprintf (msg, "%cGopher Holes%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/GOPHER_HOLES"); break; case LIVE_AND_LET_SLIDE: sprintf (msg, "%cLive and Let Slide%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/LIVE_AND_LET_SLIDE"); break; case PINKZILLA: sprintf (msg, "%cPinkzilla%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/PINKZILLA"); break; case CURSE_OF_PELE: sprintf (msg, "%cThe Curse of Pele%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Curse_of_pele"); break; case LURKERS_ABOVE: sprintf (msg, "%cLurkers Above%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/LURKERS_ABOVE"); break; case LEVEL_THAT_TIME_FORGOT: sprintf (msg, "%cThe Level that Time Forgot%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/LEVEL_THAT_TIME_FORGOT"); break; case THE_VALLEY_OF_DEATH: sprintf (msg, "%cThe Valley of Death%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_VALLEY_OF_DEATH"); break; case PINK_OR_SWIM: sprintf (msg, "%cPink or Swim%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/PINK_OR_SWIM"); break; case THE_BAD_PLACE: sprintf (msg, "%cThe Bad Place%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_BAD_PLACE"); break; case THE_CHEESE_SHOP: sprintf (msg, "%cThe Cheese Shop%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_CHEESE_SHOP"); break; case THE_QUICK_AND_THE_DEAD: sprintf (msg, "%cThe Quick and the Dead%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_QUICK_AND_THE_DEAD"); break; case THE_HOT_SEAT: sprintf (msg, "%cThe Hot Seat%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_HOT_SEAT"); break; case THE_OASIS: sprintf (msg, "%cThe Oasis%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_OASIS"); break; case BUNKERS: sprintf (msg, "%cBunkers%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/BUNKERS"); break; case BARRIER_REEF: sprintf (msg, "%cBarrier Reef%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/BARRIER_REEF"); break; case HAVE_FUN_STORMING_THE_CASTLE: sprintf (msg, "%cHave Fun Storming the Castle%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Have_fun_storming_the_castle"); break; case GATEWAY: sprintf (msg, "%cGateway%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/GATEWAY"); break; case IN_DEEP: sprintf (msg, "%cIn Deep%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/IN_DEEP"); break; case MOUNT_ST_MONDAY: sprintf (msg, "%cMount St. Monday%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Mount_St._Monday"); break; case NOT_A_NICE_NEIGHBORHOOD: sprintf (msg, "%cNot a Nice Neighborhood%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Not_a_Nice_Neighborhood"); break; case SLIMEY_PINKNESS: sprintf (msg, "%cSlimey Pinkness%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/SLIMEY_PINKNESS"); break; case BLUE_AND_GREY: sprintf (msg, "%cThe Blue and the Grey%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/The_Blue_and_the_Grey"); break; case SEND_IN_THE_LURKERS: sprintf (msg, "%cSend in the Lurkers%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/SEND_IN_THE_LURKERS"); break; case WONDERFUL_WORLD_OF_ALVEOLI: sprintf (msg, "%cThe Wonderful World of Alveoli%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/WONDERFUL_WORLD_OF_ALVEOLI"); break; case YOULL_LAVA_IT: sprintf (msg, "%cYou'll Lava it%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/YOU'LL_LAVA_IT"); break; case GROTTO: sprintf (msg, "%cGrotto%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/GROTTO"); break; case LEMMINGS: sprintf (msg, "%cLemmings!%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/LEMMINGS"); break; case HOW_THE_WEST_WAS_WON: sprintf (msg, "%cHow the West was Won%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/How_the_west_was_won"); break; case ICEBERG: sprintf (msg, "%cIceberg%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/iceberg"); break; case LURKERS_ON_ICE: sprintf (msg, "%cLurkers on Ice%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/LURKERS_ON_ICE"); break; case SLIME_TIME: sprintf (msg, "%cSlime Time%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/SLIME_TIME"); break; case ICY_U: sprintf (msg, "%cIcy U.%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/ICY_U"); break; case CATWALKS: sprintf (msg, "%cCatwalks%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/CATWALKS"); break; case CASTLE_OF_DR_MID: sprintf (msg, "%cThe Castle of Dr. Mid%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Castle_of_Dr_Mid"); break; case GREEN_SLIME: sprintf (msg, "%cGreen Slime%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/GREEN_SLIME"); break; case TIE_DIE: sprintf (msg, "%cTie Die%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/TIE_DIE"); break; case DANCE_OF_THE_DEAD: sprintf (msg, "%cDance of the Dead%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/DANCE_OF_THE_DEAD"); break; case ONE_MID_TWO_MID: sprintf (msg, "%cOne 'mid, Two 'mid%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/One_mid_two_mid"); break; case GUNNER_SABOT_LIMEY: sprintf (msg, "%cGunner - Sabot - Limey%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Gunner_Sabot_Limey"); break; case PYRAMIDS_BEFORE_SWINE: sprintf (msg, "%cPyramids Before Swine%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Pyramids_Before_Swine"); break; case PYRAMID_HENGE: sprintf (msg, "%cPyramid-Henge%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Pyramid_Henge"); break; case OF_ICE_AND_PYRAMIDS: sprintf (msg, "%cOf Ice and Pyramids%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/OF_ICE_AND_PYRAMIDS"); break; case SWAMPWALK: sprintf (msg, "%cSwampwalk%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/SWAMPWALK"); break; case PYRAMIDS_IN_THE_MIST: sprintf (msg, "%cPyramids in the Mist%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/PYRAMIDS_IN_THE_MIST"); break; case VALLEY_OF_THE_14TH_PART: sprintf (msg, "%cValley of the Fourteenth Part%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Valley_of_the_Fourteenth_Part"); break; case THE_CRACKS_OF_DOOM: sprintf (msg, "%cThe Cracks of Doom%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/The_Cracks_of_Doom"); break; case DOUBLE_DOUBLE_BOIL_AND_BUBBLE: sprintf (msg, "%cDouble, Double, Boil and Bubble%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Double_Double_Boil_and_Bubble"); break; case PAUL_IS_DEAD: sprintf (msg, "%cPaul is Dead%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Paul_is_Dead"); break; case EYE_OF_THE_PYRAMID: sprintf (msg, "%cThe Eye of the Pyramid%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_EYE_OF_THE_PYRAMID"); break; case TRIANGLE_MAN: sprintf (msg, "%cTriangle Man%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/TRIANGLE_MAN"); break; case MALTEESE_PYRAMID: sprintf (msg, "%cThe Maltese Pyramid%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_MALTEESE_PYRAMID"); break; case FIRES_OF_HECK: sprintf (msg, "%cThe Fires of Heck%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_FIRES_OF_HECK"); break; case PYRAMIDS_IN_A_STRANGE_LAND: sprintf (msg, "%cPyramids in a Strange Land%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/PYRAMIDS_IN_A_STRANGE_LAND"); break; case LEVEL_OF_GOLD_AND_LEAD: sprintf (msg, "%cThe Level of Gold and Lead%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/The_level_of_gold_and_lead"); break; case DRUMS_OVER_MALTA: sprintf (msg, "%cDrums Over Malta%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/DRUMS_OVER_MALTA"); break; case BLARNEY_LEVEL: sprintf (msg, "%cThe Blarney Level%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/blarney_level"); break; case HOPSCOTCH: sprintf (msg, "%cHopscotch%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/HOPSCOTCH"); break; case TREAD_CAREFULLY: sprintf (msg, "%cTread Carefully%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/TREAD_CAREFULLY"); break; case PIT_FIENDS: sprintf (msg, "%cPit Fiends%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/PIT_FIENDS"); break; case MELTDOWN: sprintf (msg, "%cMeltdown%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/MELTDOWN"); break; case RANDOM_ACCESS: sprintf (msg, "%cRandom Access%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/RANDOM_ACCESS"); break; case SPIRAL_DEATH_TRAP: sprintf (msg, "%cSpiral Death Trap%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Spiral_Death_Trap"); break; case RED_HOT_MAMMA: sprintf (msg, "%cRed Hot Mamma%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/Red_Hot_Mamma"); break; case THE_FIRE_PIT: sprintf (msg, "%cThe Fire Pit%c",34,34); strcpy(g_level_filename,"$boot/IceFiles/levels/THE_FIRE_PIT"); break; }}/***************************** FetchMusicTrackFromFile ******************************** Included in the level spec file is a text string that identifies the musical track tobe played during the level. This function opens the level spec file, reads in the musicspecification string, translates it into the corresponding code, and returns the code.****************************************************************************************/int32 FetchMusicTrackFromFile() { int32 i; int32 bytes_read; char *input_index; int32 music_track; if (strcmp(g_level_filename,"ITS_TOTALLY_RANDOM") == 0) { switch (RandomNumber (0, TOTAL_TRACKS - 1)) { default: return (QUACK); case 0: return (QUACK); case 1: return (CHECK_THIS_OUT_TALK); case 2: return (MADONNA); case 3: return (SPACE_AGE); case 4: return (SOUND_OF_TALK); case 5: return (LOTS_OF_PERC); case 6: return (DRUNK_TRUMPET); case 7: return (MONKEY); case 8: return (THE_LONGER_ONE); case 9: return (MORE_QUACK); case 10: return (SEVENTIES2); case 11: return (SHAFT); case 12: return (HIT_ME); case 13: return (WATER_WORKS); case 14: return (FAST_HUNT); case 15: return (G_BOUNCE); case 16: return (SCHICK); case 17: return (BALI); } } bytes_read = ReadFile(g_level_filename,MAX_FILE_BYTES,g_file_buffer,0); if (bytes_read == -1) { printf("Bummer dude! Failure in attempt to open level parms file!!!!!\n"); return(QUACK); } input_index = (char *) &g_file_buffer[0]; for (i = 0; i < 33; i++) { while (*(input_index) != 13) input_index++; input_index++; } music_track = QUACK; if (strncmp(input_index,"CHECK_THIS_OUT_TALK",strlen("CHECK_THIS_OUT_TALK")) == 0) music_track = CHECK_THIS_OUT_TALK; if (strncmp(input_index,"SPACE_AGE",strlen("SPACE_AGE")) == 0) music_track = SPACE_AGE; if (strncmp(input_index,"SOUND_OF_TALK",strlen("SOUND_OF_TALK")) == 0) music_track = SOUND_OF_TALK; if (strncmp(input_index,"LOTS_OF_PERC",strlen("LOTS_OF_PERC")) == 0) music_track = LOTS_OF_PERC; if (strncmp(input_index,"DRUNK_TRUMPET",strlen("DRUNK_TRUMPET")) == 0) music_track = DRUNK_TRUMPET; if (strncmp(input_index,"MONKEY",strlen("MONKEY")) == 0) music_track = MONKEY; if (strncmp(input_index,"THE_LONGER_ONE",strlen("THE_LONGER_ONE")) == 0) music_track = THE_LONGER_ONE; if (strncmp(input_index,"MORE_QUACK",strlen("MORE_QUACK")) == 0) music_track = MORE_QUACK; if (strncmp(input_index,"SEVENTIES2",strlen("SEVENTIES2")) == 0) music_track = SEVENTIES2; if (strncmp(input_index,"MADONNA",strlen("MADONNA")) == 0) music_track = MADONNA; if (strncmp(input_index,"SHAFT",strlen("SHAFT")) == 0) music_track = SHAFT; if (strncmp(input_index,"HIT_ME",strlen("HIT_ME")) == 0) music_track = HIT_ME; if (strncmp(input_index,"WATER_WORKS",strlen("WATER_WORKS")) == 0) music_track = WATER_WORKS; if (strncmp(input_index,"FAST_HUNT",strlen("FAST_HUNT")) == 0) music_track = FAST_HUNT; if (strncmp(input_index,"G_BOUNCE",strlen("G_BOUNCE")) == 0) music_track = G_BOUNCE; if (strncmp(input_index,"SCHICK",strlen("SCHICK")) == 0) music_track = SCHICK; if (strncmp(input_index,"BALI",strlen("BALI")) == 0) music_track = BALI; if (strncmp(input_index,"QUACK",strlen("QUACK")) == 0) music_track = QUACK; else if (music_track == QUACK) printf("Warning: using default music track.\n"); return(music_track);}/******************************* ExtractSeekerData *********************************** Given a pointer to a string that contains seeker specification information, thisfunction parses that string and returns the type and home base information for thatseeker.****************************************************************************************/char* ExtractSeekerData(char *input_index, int32 &seeker_type, int32 &row, int32 &column, int32 &direction){ /***** First, extract the seeker type from the line. *****/ seeker_type = NOTHING; if (strncmp(input_index,"LTBLUE_SEEKER",13) == 0) seeker_type = LTBLUE_SEEKER; if (strncmp(input_index,"YELLOW_SEEKER",13) == 0) seeker_type = YELLOW_SEEKER; if (strncmp(input_index,"PINK_SEEKER",11) == 0) seeker_type = PINK_SEEKER; if (strncmp(input_index,"CHAMELEON",9) == 0) seeker_type = DORMANT_CHAMELEON; if (strncmp(input_index,"LIME_SEEKER",11) == 0) seeker_type = LIME_SEEKER; if (strncmp(input_index,"ZOMBIE",strlen("ZOMBIE")) == 0) seeker_type = ZOMBIE; if (strncmp(input_index,"LURKER",strlen("LURKER")) == 0) seeker_type = LURKER; if (strncmp(input_index,"MEANY",strlen("MEANY")) == 0) seeker_type = MEANY; if (seeker_type == NOTHING) { printf("Error: Unknown seeker type ('"); while (*(input_index) != ',') { printf("%c",*(input_index)); input_index++; } printf("').\n"); exit(0); } /***** Second, extract the home tile row from the line. *****/ while (*(input_index) != ',') input_index++; while ((*(input_index) == ',') || (*(input_index) == ' ') || (*(input_index) == TAB)) input_index++; row = atoi(input_index); /***** Third, extract the home tile column from the line. *****/ while (*(input_index) != ',') input_index++; while ((*(input_index) == ',') || (*(input_index) == ' ') || (*(input_index) == TAB)) input_index++; column = atoi(input_index); /***** Fourth, extract the offset direction from the line. *****/ while ((*(input_index) >= '0') && (*(input_index) <= '9')) input_index++; while ((*(input_index) == ',') || (*(input_index) == ' ') || (*(input_index) == TAB)) input_index++; direction = NO_DIRECTION; if (strncmp(input_index,"NORTH",5) == 0) direction = NORTH; if (strncmp(input_index,"SOUTH",5) == 0) direction = SOUTH; if (strncmp(input_index,"WEST",4) == 0) direction = WEST; if (strncmp(input_index,"EAST",4) == 0) direction = EAST; if (strncmp(input_index,"NONE",4) == 0) direction = NO_DIRECTION; if (strncmp(input_index,"RANDOM",6) == 0) direction = RANDOM; if ((direction == NO_DIRECTION) && (seeker_type != DORMANT_CHAMELEON) && (seeker_type != ZOMBIE)) { printf("Error: Invalid Offset Direction ('"); while (*(input_index) != 13) { printf("%c",*(input_index)); input_index++; } printf("').\n"); exit(0); } /***** Lastly, skip to the end of the line *****/ while (*(input_index) != 13) input_index++; input_index++; return(input_index);}/******************************** TranslateTileCode ************************************ Given a 16 bit number (i.e. the value of 2 ascii characters) this function translatesthis code into the symbol for the corresponding tile. If no known symbol matches the code,the value AMBIGUOUS is returned.*****************************************************************************************/int32 TranslateTileCode (int16 tile_code){ int32 tile; bool obsolete,warning; obsolete = FALSE; warning = FALSE; switch (tile_code) { case 0x4731: /* G1 */ tile = GA_TILE; obsolete = TRUE; break; case 0x4732: /* G2 */ tile = GB_TILE; obsolete = TRUE; break; case 0x4733: /* G3 */ tile = HE_TILE; obsolete = TRUE; break; case 0x5731: /* W1 */ tile = DA_TILE; obsolete = TRUE; break; case 0x5732: /* W2 */ tile = DA_TILE; obsolete = TRUE; break; case 0x5733: /* W3 */ tile = DA_TILE; obsolete = TRUE; break; case 0x5734: /* W4 */ tile = DA_TILE; obsolete = TRUE; break; case 0x5735: /* W5 */ tile = DA_TILE; obsolete = TRUE; break; case 0x5032: /* P2 */ tile = PB_TILE; obsolete = TRUE; break; case 0x4931: /* I1 */ tile = IA_TILE; obsolete = TRUE; break; case 0x5332: /* S2 */ tile = SA_TILE; obsolete = TRUE; break; case 0x5031: /* P1 */ tile = P1_TILE; break; case 0x4741: /* GA */ tile = GA_TILE; break; case 0x4742: /* GB */ tile = GB_TILE; break; case 0x4743: /* GC */ tile = GC_TILE; break; case 0x4744: /* GD */ tile = GD_TILE; break; case 0x4745: /* GE */ tile = GE_TILE; break; case 0x4746: /* GF */ tile = GF_TILE; break; case 0x4845: /* HE */ tile = HE_TILE; break; case 0x4441: /* DA */ tile = DA_TILE; break; case 0x4442: /* DB */ tile = DB_TILE; break; case 0x4443: /* DC */ tile = DC_TILE; break; case 0x4444: /* DD */ tile = DD_TILE; break; case 0x4445: /* DE */ tile = DE_TILE; break; case 0x5741: /* WA */ tile = WA_TILE; break; case 0x4841: /* HA */ tile = HA_TILE; break; case 0x4842: /* HB */ tile = HB_TILE; break; case 0x4843: /* HC */ tile = HC_TILE; break; case 0x4844: /* HD */ tile = HD_TILE; break; case 0x5041: /* PA */ tile = PA_TILE; break; case 0x5042: /* PB */ tile = PB_TILE; break; case 0x4941: /* IA */ tile = IA_TILE; break; case 0x5331: /* S1 */ tile = S1_TILE; break; case 0x5341: /* SA */ tile = SA_TILE; break; case 0x4C31: /* L1 */ tile = L1_TILE; break; case 0x4C41: /* LA */ tile = LA_TILE; break; case 0x4C42: /* LB */ tile = LB_TILE; break; case 0x5342: /* SB */ tile = SB_TILE; break; case 0x4942: /* IB */ tile = IB_TILE; break; case 0x5043: /* PC */ tile = PC_TILE; break; case 0x5047: /* PA */ tile = PG_TILE; break; case 0x5742: /* WB */ tile = WB_TILE; break; case 0x5743: /* WC */ tile = WC_TILE; break; case 0x5744: /* WD */ tile = WD_TILE; break; case 0x4943: /* IC */ tile = IC_TILE; break; case 0x4944: /* ID */ tile = ID_TILE; break; case 0x5044: /* PD */ tile = PD_TILE; break; case 0x5045: /* PE */ tile = PE_TILE; break; case 0x5046: /* PF */ tile = PF_TILE; break; case 0x5048: /* PH */ tile = PH_TILE; break; case 0x5049: /* PI */ tile = PI_TILE; break; case 0x504A: /* PJ */ tile = PJ_TILE; break; case 0x504B: /* PK */ tile = PK_TILE; break; case 0x504C: /* PL */ tile = PL_TILE; break; case 0x504D: /* PM */ tile = PM_TILE; break; case 0x5541: /* UA */ tile = UA_TILE; break; case 0x5542: /* UB */ tile = UB_TILE; break; case 0x5543: /* UC */ tile = UC_TILE; break; case 0x5544: /* UD */ tile = UD_TILE; break; case 0x5545: /* UE */ tile = UE_TILE; break; case 0x5641: /* VA */ tile = VA_TILE; break; case 0x5642: /* VB */ tile = VB_TILE; break; default: tile = AMBIGUOUS; break; } if ((obsolete) && (warning)) printf("Warning: Obsolete tile code (%c%c).\n",(char) (tile_code >> 8), (char) (tile_code & 0xFF)); return(tile); }/************************************ LoadLevel *************************************** This function is dedicated to performing as much of the level-specific initializationas possible. Specifically, it parses the level parameters file and uses the data thereinto construct the population of solid objects and the layout of tiles. A global datastructure called level_lookup_table is used for initialization of both of these gameassets. The specification of the solid objects (which appears first in the parametersfile) is stored in the level_lookup_table and then is used by the solids class to createthe initial population, after which the table is no longer needed. This function thenreuses the level_lookup_table. The tile layout specification (which appears in secondin the parameters file) is parsed and stored in the same data structure, which isthen handed off for use by the landscape class. Unlike the solids class, the landscapeclass uses the level_lookup_table throughout execution of the game. After this,the wasteland descriptor is read in. This routine also fills out the global art usage table, which is used to determineif a given piece of artwork will be used during the level. If it won't be, but is alreadyin memory from a previous level, it can be recognized as unneeded and discarded.****************************************************************************************/void LoadLevel (int32 level) { int32 i,j; int32 bytes_read; char *input_index; int16 *short_pointer; int32 seeker_type, row, column, direction; for (i = 0; i < MAX_FILE_BYTES/4; i++) g_file_buffer[i] = 0xFFFFFFFF; for (i = 0; i < TOTAL_ART_ELEMENTS; i++) g_art_usage[i] = FALSE; g_art_usage[BLUE_PYRAMID] = TRUE; g_art_usage[RED_PYRAMID] = TRUE; g_art_usage[GREEN_PYRAMID] = TRUE; /**********************************************************************************/ // Deal with special case levels first, then exit: /**********************************************************************************/ if (level == ITS_TOTALLY_RANDOM) { g_total_pyramids = 0; for (i = 0; i < ROWS_IN_LANDSCAPE; i++) { for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) { level_lookup_table[i][j] = random_level_spec->pyramids[i][j]; g_art_usage[level_lookup_table[i][j]] = TRUE; if ((level_lookup_table[i][j] != NOTHING) && (level_lookup_table[i][j] < FIRST_BOULDER)) g_total_pyramids++; } } population.InitializeSolids(); pavement.wasteland_descriptor = random_level_spec->wasteland; g_art_usage[pavement.wasteland_descriptor] = TRUE; for (i = 0; i < ROWS_IN_LANDSCAPE; i++) { for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) { level_lookup_table[i][j] = random_level_spec->tiles[i][j]; g_art_usage[level_lookup_table[i][j]] = TRUE; } } return; } /**********************************************************************************/ // Open the file and discard the title line: /**********************************************************************************/ bytes_read = ReadFile(g_level_filename,MAX_FILE_BYTES,g_file_buffer,0); if (bytes_read == -1) { printf("Bummer dude! Failure in attempt to open level parms file!!!!!\n"); return; } input_index = (char *) &g_file_buffer[0]; while (*(input_index) != 13) input_index++; /**********************************************************************************/ // Translate the solids table: /**********************************************************************************/ for (i = 0; i < ROWS_IN_LANDSCAPE; i++) { for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) { /* skip over white space (or asterisks): */ while ((*(input_index) == 13) || (*(input_index) == 32) || (*(input_index)==42)) input_index++; /* translate the character into the correct type of dude: */ switch (*(input_index)) { case 'R': level_lookup_table[i][j] = RED_PYRAMID; break; case 'B': level_lookup_table[i][j] = BLUE_PYRAMID; break; case 'G': level_lookup_table[i][j] = GREEN_PYRAMID; break; case 'P': level_lookup_table[i][j] = PURPLE_PYRAMID; break; case 'T': level_lookup_table[i][j] = RAINBOW_PYRAMID; g_art_usage[PURPLE_PYRAMID] = TRUE; break; case 'C': level_lookup_table[i][j] = CONCRETE_PYRAMID; break; case 'O': level_lookup_table[i][j] = BOULDER0; break; case '0': level_lookup_table[i][j] = BOULDER0; break; case '1': level_lookup_table[i][j] = BOULDER1; break; case '2': level_lookup_table[i][j] = BOULDER2; break; case '3': level_lookup_table[i][j] = BOULDER3; break; case '4': level_lookup_table[i][j] = BOULDER4; break; case '5': level_lookup_table[i][j] = BOULDER5; break; case '6': level_lookup_table[i][j] = BOULDER6; break; case '7': level_lookup_table[i][j] = BOULDER7; break; case '8': level_lookup_table[i][j] = BOULDER8; break; case '9': level_lookup_table[i][j] = BOULDER9; break; case 'A': level_lookup_table[i][j] = BOULDERA; break; case 'D': level_lookup_table[i][j] = BOULDERD; break; case 'N': level_lookup_table[i][j] = NOTHING; break; default: printf("invalid object descriptor (%c).\n",*(input_index)); level_lookup_table[i][j] = NOTHING; break; } g_art_usage[(level_lookup_table[i][j])] = TRUE; /* now move on to the next element: */ input_index++; } } /**********************************************************************************/ // Calculate the number of pyramids: /**********************************************************************************/ g_total_pyramids = 0; for (i = 0; i < ROWS_IN_LANDSCAPE; i++) for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) if ((level_lookup_table[i][j] != NOTHING) && (level_lookup_table[i][j] < FIRST_BOULDER)) g_total_pyramids++; /**********************************************************************************/ // Pass level_lookup_table (with solids info) to solids class for initialization: /**********************************************************************************/ population.InitializeSolids(); /**********************************************************************************/ // Translate the landscape table: /**********************************************************************************/ for (i = 0; i < ROWS_IN_LANDSCAPE; i++) { for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) { /* skip over white space (or asterisks): */ while ((*(input_index) == 13) || (*(input_index) == 32) || (*(input_index) == 42)) input_index++; /* translate the 2 character code into the correct type of tile: */ short_pointer = (int16 *) input_index; level_lookup_table[i][j] = TranslateTileCode (*(short_pointer)); if (level_lookup_table[i][j] == AMBIGUOUS) { printf("Warning: invalid tile (%c%c).\n",*(input_index),*(input_index+1)); level_lookup_table[i][j] = GA_TILE; } /* then indicate in the usage table that this tile is being used: */ g_art_usage[(level_lookup_table[i][j])] = TRUE; /* and then move on to the next element. */ input_index += 2; } } /**********************************************************************************/ // Fetch the wasteland identifier: /**********************************************************************************/ pavement.wasteland_descriptor = DA_TILE; while ((*(input_index) == 13) || (*(input_index) == 32) || (*(input_index) == 42)) input_index++; short_pointer = (int16 *) input_index; pavement.wasteland_descriptor = TranslateTileCode (*(short_pointer)); if (pavement.wasteland_descriptor == AMBIGUOUS) { printf("invalid wasteland descriptor.\n"); pavement.wasteland_descriptor = DA_TILE; } g_art_usage[pavement.wasteland_descriptor] = TRUE; /**********************************************************************************/ // Skip over the music track identifier: /**********************************************************************************/ input_index += 2; while ((*(input_index) == 13) || (*(input_index) == 32) || (*(input_index) == 42)) input_index++; for (i = 0; i < 2; i++) { while (*(input_index) != 13) input_index++; input_index++; } /**********************************************************************************/ // Examine seeker specs and fill out art usage table accordingly: /**********************************************************************************/ while (*(input_index) != 0xFF) { if ((*(input_index) == 13) || (*(input_index) == 32) || (*(input_index) == 42)) input_index++; else { input_index = ExtractSeekerData(input_index,seeker_type,row,column,direction); g_art_usage[seeker_type] = TRUE; } } if ((pavement.wasteland_descriptor == LA_TILE) || (pavement.wasteland_descriptor == LB_TILE)) { if ((g_art_usage[YELLOW_SEEKER] == TRUE) || (g_art_usage[LTBLUE_SEEKER] == TRUE) || (g_art_usage[PINK_SEEKER] == TRUE) || (g_art_usage[LIME_SEEKER] == TRUE) || (g_art_usage[DORMANT_CHAMELEON] == TRUE)) { printf("Sorry, only Zombies are allowed on a level with a lava wasteland.\n"); exit(0); } }}/**************************** seeker::InitializeSeekers ******************************* This function handles all setup and initialization of variables that are used by this class. It is intended to be used repeatedly, at the start of each round of the game. Note that this function is part of the seeker class, but it is in this file ratherthan SEEKER.CP because of its intense level specific orientation.****************************************************************************************/void seeker::InitializeSeekers (int32 level, int16 skill_level) { int32 seeker_type, row, column, direction; int32 i,j,k; int32 bytes_read; char *input_index; int16 difficulty; bool this_mode_has_seekers,warning; warning = FALSE; seeker_list = (dude *) NULL; grumpy_death_toll = 0; ShutdownUnusedArtwork(); if (level == ITS_TOTALLY_RANDOM) { k = 0; for (i = 0; i < random_level_spec->total_flavors; i++) { for (j = 0; j < random_level_spec->insane_seeker_count[i]; j++) { this_mode_has_seekers = FALSE; switch (skill_level) { case EASY: if (j < random_level_spec->easy_seeker_count[i]) this_mode_has_seekers = TRUE; break; case MEDIUM: if (j < random_level_spec->medium_seeker_count[i]) this_mode_has_seekers = TRUE; break; case HARD: if (j < random_level_spec->hard_seeker_count[i]) this_mode_has_seekers = TRUE; break; case INSANE: this_mode_has_seekers = TRUE; break; } if (this_mode_has_seekers) { CreateSeeker(random_level_spec->seeker_type[k], random_level_spec->row[k], random_level_spec->column[k], random_level_spec->direction[k]); g_art_usage[random_level_spec->seeker_type[k]] = TRUE; } k++; } } return; } bytes_read = ReadFile(g_level_filename,MAX_FILE_BYTES,g_file_buffer,0); if (bytes_read == -1) { printf("Bummer dude! Failure in attempt to open level parms file!!!!!\n"); return; } /* skip over the specs that don't relate to the seekers: */ input_index = (char *) &g_file_buffer[0]; for (i = 0; i < 35; i++) { while (*(input_index) != 13) input_index++; input_index++; } difficulty = 0; this_mode_has_seekers = FALSE; while (*(input_index) != 0xFF) { if (*(input_index) == '*') { while (*(input_index) != 13) input_index++; input_index++; if ((this_mode_has_seekers == FALSE) && (warning)) { switch (difficulty) { case 0: printf("\nNo seekers for EASY mode. "); break; case 1: printf("\nNo seekers for MEDIUM mode. "); break; case 2: printf("\nNo seekers for HARD mode. "); break; case 3: printf("\nNo seekers for INSANE mode. "); break; } } this_mode_has_seekers = FALSE; difficulty++; if (difficulty > skill_level) break; } if (*(input_index) != '*') { input_index = ExtractSeekerData(input_index,seeker_type,row,column,direction); this_mode_has_seekers = TRUE; if (seeker_type == DORMANT_CHAMELEON) population.ConcealChameleons(RandomNumber(row,column)); else CreateSeeker(seeker_type, row, column, direction); } }}/****************************** PlaceHazardsRandomly ********************************** Given a type of hazard (or otherwise interesting) tile, a count of how many to use,and a pointer to a level specification structure, this function will randomly distributethe supply of hazard tiles within that structure.****************************************************************************************/void PlaceHazardsRandomly (int32 total, int32 type, int32 base){ int32 i, row, column; for (i = 0; i < total; i++) { do { row = RandomNumber(0,13); column = RandomNumber(0,13); } while (random_level_spec->tiles[row][column] != (char) base); random_level_spec->tiles[row][column] = (char) type; }}/******************************* PlaceHazardsInLines ********************************** Given a type of hazard (or otherwise interesting) tile, a count of how many to use,and a pointer to a level specification structure, this function will distribute the supply of hazard tiles within that structure, in one or more diagonal lines.****************************************************************************************/void PlaceHazardsInLines (int32 total, int32 type, int32 base){ int32 direction, row, column, line_length, new_row, new_column; direction = SOUTHWEST; while (total) { do { row = RandomNumber(0,13); column = RandomNumber(0,13); } while (random_level_spec->tiles[row][column] != (char) base); random_level_spec->tiles[row][column] = (char) type; total--; switch (RandomNumber(0,3)) { case 0: direction = SOUTHWEST; break; case 1: direction = SOUTHEAST; break; case 2: direction = NORTHWEST; break; case 3: direction = NORTHEAST; break; } line_length = RandomNumber (0,total); while(line_length) { pavement.DetermineAdjacentTile (row, column, direction, new_row, new_column); if (new_row == -1) break; if (random_level_spec->tiles[new_row][new_column] != (char) base) break; random_level_spec->tiles[new_row][new_column] = (char) type; line_length--; total--; row = new_row; column = new_column; } }}/****************************** PlaceHazardsInBunches ********************************* Given a type of hazard (or otherwise interesting) tile, a count of how many to use,and a pointer to a level specification structure, this function will distribute the supply of hazard tiles within that structure, in one or small clusters.****************************************************************************************/void PlaceHazardsInBunches (int32 total, int32 type, int32 base){ int32 direction, row, column, cluster_size, new_row, new_column, i; bool directions_attempted[8]; while (total) { for (i = 0; i < 8; i++) directions_attempted[i] = FALSE; do { row = RandomNumber(0,13); column = RandomNumber(0,13); } while (random_level_spec->tiles[row][column] != (char) base); random_level_spec->tiles[row][column] = (char) type; total--; if (total > 8) cluster_size = RandomNumber (0,8); else cluster_size = RandomNumber (0,total); while (cluster_size) { direction = RandomNumber (0,7); if (directions_attempted[direction] == FALSE) { directions_attempted[direction] = TRUE; cluster_size--; pavement.DetermineAdjacentTile (row, column, direction, new_row, new_column); if ((new_row != -1) && (random_level_spec->tiles[new_row][new_column] == (char) base)) { random_level_spec->tiles[new_row][new_column] = (char) type; total--; } } } }}/******************************** ThisTileIsHazardous ********************************* This is a simple function that returns TRUE if the specified tile value is deadly,and FALSE if it isn't. This function is intended for use by the RandomLevelGenerator,and as such considers SLIME deadly (even though it isn't for seekers) and rocks deadly(even though they aren't, simply because you can't go through them).****************************************************************************************/bool ThisTileIsHazardous (int32 tile_type){ if ((tile_type >= FIRST_SLIME_TILE) && (tile_type <= LAST_SLIME_TILE)) return(TRUE); if ((tile_type >= FIRST_LAVA_TILE) && (tile_type <= LAST_LAVA_TILE)) return(TRUE); if ((tile_type >= FIRST_PIT_TILE) && (tile_type <= LAST_PIT_TILE)) return(TRUE); if ((tile_type >= FIRST_BOULDER) && (tile_type <= LAST_BOULDER)) return(TRUE); return(FALSE);}/****************************** CheckForAndRemoveImpossibilites ********************************** Given the existence of a randomly generated landscape chart, this function examinesthe chart to make sure that no illegal situations exist, i.e. the starting square doesn'tcontain a hazard, and that there are no locations in the level that cannot be reachedby the player.****************************************************************************************/void CheckForAndRemoveImpossibilites (int32 base_tile){ int32 i,j,k,m,n; int32 pass; int32 still_unreachable; bool wasteland_safe_and_reachable; int32 row_to_change,column_to_change; wasteland_safe_and_reachable = FALSE; row_to_change = 0; column_to_change = 0; /* Make sure the home tile is ok. */ if (ThisTileIsHazardous(random_level_spec->tiles[6][5])) random_level_spec->tiles[6][5] = (char) base_tile; /* Initially set the chart up with all obstacles set to impassable and all tiles */ /* except the home tile set to unreachable. */ for (i = 0; i < ROWS_IN_LANDSCAPE; i++) { for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) { if (ThisTileIsHazardous(random_level_spec->tiles[i][j])) random_level_spec->pyramids[i][j] = IMPASSABLE; else random_level_spec->pyramids[i][j] = UNREACHABLE; } } random_level_spec->pyramids[6][5] = REACHABLE; /* we will stay in this loop until all tiles can be reached. */ while (FOREVER) { pass = 0; while (pass++ < 20) { /* count the number of unreachable tiles. */ still_unreachable = 0; for (i = 0; i < ROWS_IN_LANDSCAPE; i++) for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) if (random_level_spec->pyramids[i][j] == UNREACHABLE) still_unreachable++; if (still_unreachable == 0) return; /* now flag any tile that's adjacent to a reachable tile on at least one side.*/ for (i = 0; i < ROWS_IN_LANDSCAPE; i++) { for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) { if (random_level_spec->pyramids[i][j] == UNREACHABLE) { for (k = 0; k < 8; k++) { pavement.DetermineAdjacentTile(i,j,k,m,n); if (m == -1) { if (wasteland_safe_and_reachable) { random_level_spec->pyramids[i][j] = REACHABLE; break; } } else { if (random_level_spec->pyramids[m][n] == REACHABLE) { random_level_spec->pyramids[i][j] = REACHABLE; break; } } } } /* if we've reached a non-deadly wasteland from the center, set a flag. */ else { if ((random_level_spec->pyramids[i][j] == REACHABLE) && (random_level_spec->wasteland != SA_TILE) && (random_level_spec->wasteland != SB_TILE) && (wasteland_safe_and_reachable == FALSE)) { for (k = 0; k < 8; k++) { pavement.DetermineAdjacentTile(i,j,k,m,n); if (m == -1) wasteland_safe_and_reachable = TRUE; } } } } } } /* if we get to here, then the level can't currently be completely. Change it. */ for (i = 0; i < ROWS_IN_LANDSCAPE; i++) for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) if (random_level_spec->pyramids[i][j] == UNREACHABLE) for (k = 0; k < 8; k++) { pavement.DetermineAdjacentTile(i,j,k,m,n); if ((m != -1) && (random_level_spec->pyramids[m][n] == IMPASSABLE)) { row_to_change = m; column_to_change = n; break; } } random_level_spec->pyramids[row_to_change][column_to_change] = UNREACHABLE; random_level_spec->tiles[row_to_change][column_to_change] = (char) base_tile; printf("Randomly generated level is currently impossible. "); printf("Removing obstruction at %ld,%ld.\n",row_to_change, column_to_change); }}/******************************* GenerateRandomLevel ********************************** As the name suggests, this function creates a level specification at random. Thedetails of the random level are stored in the data structure pointed to by the globalpointer called random_level_spec. The random level can then be replayed again and againas long as the level specification structure remains intact.****************************************************************************************/void GenerateRandomLevel (void){ int32 base_tile; int32 base_tile_type; int32 wasteland_type; int32 number_of_special_tile_types; int32 total_number_of_special_tiles; int32 featured_special_tiles[4]; int32 number_of_featured_special_tiles[4]; int32 chosen_random_number; int32 i,j,k; int32 type_of_environment; int32 swamp_status; int32 types_of_normal_pyramids; int32 featured_normal_pyramids[3]; int32 types_of_special_pyramids; int32 total_special_pyramids; int32 featured_special_pyramids[3]; i = 0; j = 0; k = 0; wasteland_type = DA_TILE; number_of_special_tile_types = 2; /************************************************************************************/ /***** Step 1: Select the base tile. ************************************************/ /************************************************************************************/ switch (RandomNumber(0,9)) { case 0: base_tile_type = FROZEN; base_tile = RandomNumber(FIRST_ICE_TILE,LAST_ICE_TILE); break; case 1: base_tile_type = MARSH; base_tile = RandomNumber(FIRST_SWAMP_TILE,LAST_SWAMP_TILE); break; default: base_tile_type = PLAINS; base_tile = RandomNumber(FIRST_PLAIN_TILE,LAST_PLAIN_TILE); break; } /************************************************************************************/ /***** Step 2: Select the wasteland tile. *******************************************/ /************************************************************************************/ chosen_random_number = RandomNumber(0,99); switch (base_tile_type) { case FROZEN: if (chosen_random_number < 10) wasteland_type = TOXIC; else if (chosen_random_number < 20) wasteland_type = MARSH; else if (chosen_random_number < 60) wasteland_type = FROZEN; else wasteland_type = PLAINS; break; case PLAINS: if (chosen_random_number < 30) wasteland_type = TOXIC; else if (chosen_random_number < 35) wasteland_type = MARSH; else if (chosen_random_number < 45) wasteland_type = FROZEN; else wasteland_type = PLAINS; break; case MARSH: if (chosen_random_number < 20) wasteland_type = TOXIC; else if (chosen_random_number < 60) wasteland_type = MARSH; else if (chosen_random_number < 70) wasteland_type = FROZEN; else wasteland_type = PLAINS; break; } switch (wasteland_type) { case TOXIC: random_level_spec->wasteland = RandomNumber(SA_TILE,SB_TILE); break; case FROZEN: random_level_spec->wasteland = RandomNumber(FIRST_ICE_TILE,LAST_ICE_TILE); break; case PLAINS: random_level_spec->wasteland = RandomNumber(FIRST_PLAIN_TILE,LAST_PLAIN_TILE); break; case MARSH: random_level_spec->wasteland = RandomNumber(FIRST_SWAMP_TILE,LAST_SWAMP_TILE); break; } /************************************************************************************/ /***** Step 3: Decide how many different kinds of special tiles the level will have.*/ /************************************************************************************/ chosen_random_number = RandomNumber(0,99); switch (base_tile_type) { case PLAINS: case FROZEN: if (chosen_random_number < 25) number_of_special_tile_types = 0; else if (chosen_random_number < 60) number_of_special_tile_types = 1; else if (chosen_random_number < 80) number_of_special_tile_types = 2; else if (chosen_random_number < 95) number_of_special_tile_types = 3; else number_of_special_tile_types = 4; break; case MARSH: if (chosen_random_number < 10) number_of_special_tile_types = 0; else if (chosen_random_number < 45) number_of_special_tile_types = 1; else if (chosen_random_number < 70) number_of_special_tile_types = 2; else if (chosen_random_number < 95) number_of_special_tile_types = 3; else number_of_special_tile_types = 4; break; } /************************************************************************************/ /***** Step 4: Now decide what the special tiles will be. ***************************/ /************************************************************************************/ for (i = 0; i < 4; i++) featured_special_tiles[i] = base_tile; for (i = 0; i < number_of_special_tile_types; i++) { do { chosen_random_number = RandomNumber(0,99); switch (base_tile_type) { case FROZEN: if (chosen_random_number < 10) j = MARSH; else if (chosen_random_number < 30) j = PLAINS; else if (chosen_random_number < 45) j = CHASM; else if (chosen_random_number < 60) j = MOLTEN; else if (chosen_random_number < 70) j = TOXIC; else j = ROCKY; break; case MARSH: if (chosen_random_number < 10) j = FROZEN; else if (chosen_random_number < 30) j = PLAINS; else if (chosen_random_number < 45) j = CHASM; else if (chosen_random_number < 60) j = MOLTEN; else if (chosen_random_number < 80) j = TOXIC; else j = ROCKY; break; case PLAINS: if (chosen_random_number < 10) j = MARSH; else if (chosen_random_number < 20) j = FROZEN; else if (chosen_random_number < 35) j = CHASM; else if (chosen_random_number < 50) j = MOLTEN; else if (chosen_random_number < 70) j = TOXIC; else j = ROCKY; break; } switch (j) { case PLAINS: k = RandomNumber(FIRST_PLAIN_TILE, LAST_PLAIN_TILE); break; case FROZEN: k = RandomNumber(FIRST_ICE_TILE, LAST_ICE_TILE); break; case MARSH: k = RandomNumber(FIRST_SWAMP_TILE, LAST_SWAMP_TILE); break; case TOXIC: k = RandomNumber(FIRST_SLIME_TILE, LAST_SLIME_TILE); break; case MOLTEN: k = RandomNumber(FIRST_LAVA_TILE, LAST_LAVA_TILE); break; case CHASM: k = RandomNumber(FIRST_PIT_TILE, LAST_PIT_TILE); break; case ROCKY: k = RandomNumber(BOULDER0,BOULDERD); break; } } while ((featured_special_tiles[0] == k) || (featured_special_tiles[1] == k) || (featured_special_tiles[2] == k) || (featured_special_tiles[3] == k)); featured_special_tiles[i] = k; } /************************************************************************************/ /***** Step 5: Decide on how many special tiles there will be. **********************/ /************************************************************************************/ total_number_of_special_tiles = (number_of_special_tile_types * 5) + RandomNumber(0,15) + RandomNumber(0,15); i = RandomNumber(1,6); if (i == 1) total_number_of_special_tiles += 50; if (i == 2) total_number_of_special_tiles += 20; /************************************************************************************/ /***** Step 6: Decide on how many of each type of special tile there will be. *******/ /************************************************************************************/ if (number_of_special_tile_types > 0) { for (i = 0; i < number_of_special_tile_types; i++) total_number_of_special_tiles -= 5; for (i = 0; i < (number_of_special_tile_types - 1); i++) { j = RandomNumber(0,total_number_of_special_tiles); total_number_of_special_tiles -= j; number_of_featured_special_tiles[i] = 5 + j; } i = number_of_special_tile_types - 1; number_of_featured_special_tiles[i] = 5 + total_number_of_special_tiles; } /************************************************************************************/ /***** Step 7: Load the tile chart up with the basic tile. **************************/ /************************************************************************************/ for (i = 0; i < ROWS_IN_LANDSCAPE; i++) for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) random_level_spec->tiles[i][j] = (char) base_tile; /************************************************************************************/ /***** Step 8: Distribute the special tiles within the landscape. *******************/ /************************************************************************************/ switch(RandomNumber(0,2)) { case 0: for (i = 0; i < number_of_special_tile_types; i++) PlaceHazardsRandomly (number_of_featured_special_tiles[i], featured_special_tiles[i],base_tile); break; case 1: for (i = 0; i < number_of_special_tile_types; i++) PlaceHazardsInLines (number_of_featured_special_tiles[i], featured_special_tiles[i],base_tile); break; case 2: for (i = 0; i < number_of_special_tile_types; i++) PlaceHazardsInBunches (number_of_featured_special_tiles[i], featured_special_tiles[i],base_tile); break; } /************************************************************************************/ /***** Step 9: Check the landscape for unacceptible situations and remove any found.*/ /************************************************************************************/ CheckForAndRemoveImpossibilites (base_tile); /************************************************************************************/ /***** Step 10: Initialize the solids layout. **************************************/ /************************************************************************************/ for (i = 0; i < ROWS_IN_LANDSCAPE; i++) for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) random_level_spec->pyramids[i][j] = NOTHING; /************************************************************************************/ /***** Step 11: Convert the rock tiles into rock objects. **************************/ /************************************************************************************/ for (i = 0; i < ROWS_IN_LANDSCAPE; i++) { for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) { if ((random_level_spec->tiles[i][j] >= BOULDER0) && (random_level_spec->tiles[i][j] <= LAST_BOULDER)) { random_level_spec->pyramids[i][j] = random_level_spec->tiles[i][j]; random_level_spec->tiles[i][j] = (char) base_tile; } } } /************************************************************************************/ /***** Step 12: Decide how many special pyramids to include. ***********************/ /************************************************************************************/ chosen_random_number = RandomNumber(0,99); if (chosen_random_number < 10) types_of_special_pyramids = 3; else if (chosen_random_number < 20) types_of_special_pyramids = 2; else if (chosen_random_number < 30) types_of_special_pyramids = 1; else types_of_special_pyramids = 0; total_special_pyramids = (types_of_special_pyramids * 5) + RandomNumber (0,30); featured_special_pyramids[0] = RandomNumber(PURPLE_PYRAMID,CONCRETE_PYRAMID); if (types_of_special_pyramids == 2) { do featured_special_pyramids[1] = RandomNumber(PURPLE_PYRAMID,CONCRETE_PYRAMID); while (featured_special_pyramids[1] == featured_special_pyramids[0]); } if (types_of_special_pyramids == 3) { featured_special_pyramids[0] = PURPLE_PYRAMID; featured_special_pyramids[1] = RAINBOW_PYRAMID; featured_special_pyramids[2] = CONCRETE_PYRAMID; } /************************************************************************************/ /***** Step 13: Populate the universe with special pyramids (if any). ***************/ /************************************************************************************/ if (types_of_special_pyramids != 0) { while (total_special_pyramids) { do { i = RandomNumber(0,13); j = RandomNumber(0,13); } while ((ThisTileIsHazardous(random_level_spec->tiles[i][j])) || (random_level_spec->pyramids[i][j] != NOTHING)); k = RandomNumber(0,(types_of_special_pyramids - 1)); random_level_spec->pyramids[i][j] = (char) featured_special_pyramids[k]; total_special_pyramids--; } } /************************************************************************************/ /***** Step 14: Decide how many types of normal pyramids to use. *******************/ /************************************************************************************/ chosen_random_number = RandomNumber(0,99); types_of_normal_pyramids = 3; if (chosen_random_number >= 75) types_of_normal_pyramids = 2; if (chosen_random_number < 15) types_of_normal_pyramids = 1; featured_normal_pyramids[0] = RandomNumber (BLUE_PYRAMID,GREEN_PYRAMID); if (types_of_normal_pyramids == 2) { do featured_normal_pyramids[1] = RandomNumber (BLUE_PYRAMID,GREEN_PYRAMID); while (featured_normal_pyramids[1] == featured_normal_pyramids[0]); } if (types_of_normal_pyramids == 3) { featured_normal_pyramids[0] = BLUE_PYRAMID; featured_normal_pyramids[1] = GREEN_PYRAMID; featured_normal_pyramids[2] = RED_PYRAMID; } /************************************************************************************/ /***** Step 15: Populate the open spaces with normal pyramids. *********************/ /************************************************************************************/ for (i = 0; i < ROWS_IN_LANDSCAPE; i++) { for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) { if ((!(ThisTileIsHazardous(random_level_spec->tiles[i][j]))) && (random_level_spec->pyramids[i][j] == NOTHING)) { k = RandomNumber(0,(types_of_normal_pyramids - 1)); random_level_spec->pyramids[i][j] = (char) featured_normal_pyramids[k]; } } } /************************************************************************************/ /***** Step 16: Determine the type of environment (from the seeker's point of view).*/ /************************************************************************************/ type_of_environment = HAZARDLESS; swamp_status = SWAMPLESS; if (base_tile_type == MARSH) swamp_status = SWAMPY_BASE; for (i = 0; i < number_of_special_tile_types; i++) { if (((featured_special_tiles[i] >= FIRST_LAVA_TILE) && (featured_special_tiles[i] <= LAST_LAVA_TILE)) || ((featured_special_tiles[i] >= FIRST_PIT_TILE) && (featured_special_tiles[i] <= LAST_PIT_TILE))) { if (type_of_environment == HAZARDLESS) type_of_environment = PITS_ONLY; if (type_of_environment == ROCKS_ONLY) type_of_environment = ROCKS_AND_PITS; } if ((featured_special_tiles[i] >= BOULDER0) && (featured_special_tiles[i] <= BOULDERD)) { if (type_of_environment == HAZARDLESS) type_of_environment = ROCKS_ONLY; if (type_of_environment == PITS_ONLY) type_of_environment = ROCKS_AND_PITS; } if ((featured_special_tiles[i] >= FIRST_SWAMP_TILE) && (featured_special_tiles[i] <= LAST_SWAMP_TILE)) { switch (base_tile_type) { case MARSH: swamp_status = SWAMPY_WITH_SWAMPS; break; case FROZEN: swamp_status = ICY_WITH_SWAMPS; break; case PLAINS: swamp_status = PLAIN_WITH_SWAMPS; break; } } } /************************************************************************************/ /***** Step 17: Decide how many different types of seekers this level will have. ***/ /************************************************************************************/ random_level_spec->total_flavors = 1; i = RandomNumber(0,9); if (i <= 3) random_level_spec->total_flavors = 2; if (i >= 8) random_level_spec->total_flavors = 3; /************************************************************************************/ /***** Step 18: Will there be zombies? *********************************************/ /************************************************************************************/ chosen_random_number = RandomNumber(0,99); random_level_spec->featured_flavors[0] = NOTHING; if (wasteland_type == MARSH) { switch (swamp_status) { case SWAMPLESS: if (chosen_random_number < 35) random_level_spec->featured_flavors[0] = ZOMBIE; break; case SWAMPY_BASE: if (chosen_random_number < 95) random_level_spec->featured_flavors[0] = ZOMBIE; break; case PLAIN_WITH_SWAMPS: if (chosen_random_number < 65) random_level_spec->featured_flavors[0] = ZOMBIE; break; case ICY_WITH_SWAMPS: if (chosen_random_number < 45) random_level_spec->featured_flavors[0] = ZOMBIE; break; case SWAMPY_WITH_SWAMPS: if (chosen_random_number < 95) random_level_spec->featured_flavors[0] = ZOMBIE; break; } } else { switch (swamp_status) { case SWAMPLESS: break; case SWAMPY_BASE: if (chosen_random_number < 85) random_level_spec->featured_flavors[0] = ZOMBIE; break; case PLAIN_WITH_SWAMPS: if (chosen_random_number < 30) random_level_spec->featured_flavors[0] = ZOMBIE; break; case ICY_WITH_SWAMPS: if (chosen_random_number < 15) random_level_spec->featured_flavors[0] = ZOMBIE; break; case SWAMPY_WITH_SWAMPS: if (chosen_random_number < 85) random_level_spec->featured_flavors[0] = ZOMBIE; break; } } /************************************************************************************/ /***** Step 19: Decide what other seeker flavors will be featured. *****************/ /************************************************************************************/ k = 0; if (random_level_spec->featured_flavors[0] == ZOMBIE) { k = 1; if (random_level_spec->total_flavors == 3) random_level_spec->total_flavors = 2; } for (i = k; i < random_level_spec->total_flavors; i++) { chosen_random_number = RandomNumber(0,99); if (base_tile_type != FROZEN) { switch (type_of_environment) { case HAZARDLESS: do { if (chosen_random_number < 20) j = YELLOW_SEEKER; else if (chosen_random_number < 50) j = LTBLUE_SEEKER; else if (chosen_random_number < 65) j = PINK_SEEKER; else if (chosen_random_number < 80) j = LIME_SEEKER; else if (chosen_random_number < 95) j = LURKER; else j = MEANY; chosen_random_number = RandomNumber(0,99); } while ((random_level_spec->total_flavors == 1) && (j == YELLOW_SEEKER)); break; case ROCKS_ONLY: if (chosen_random_number < 15) j = YELLOW_SEEKER; else if (chosen_random_number < 50) j = LTBLUE_SEEKER; else if (chosen_random_number < 60) j = PINK_SEEKER; else if (chosen_random_number < 80) j = LIME_SEEKER; else if (chosen_random_number < 95) j = LURKER; else j = MEANY; break; case PITS_ONLY: if (chosen_random_number < 15) j = YELLOW_SEEKER; else if (chosen_random_number < 30) j = LTBLUE_SEEKER; else if (chosen_random_number < 50) j = PINK_SEEKER; else if (chosen_random_number < 70) j = LIME_SEEKER; else if (chosen_random_number < 85) j = LURKER; else j = MEANY; break; case ROCKS_AND_PITS: if (chosen_random_number < 15) j = YELLOW_SEEKER; else if (chosen_random_number < 30) j = LTBLUE_SEEKER; else if (chosen_random_number < 45) j = PINK_SEEKER; else if (chosen_random_number < 70) j = LIME_SEEKER; else if (chosen_random_number < 85) j = LURKER; else j = MEANY; break; } } else { switch (type_of_environment) { case HAZARDLESS: do { if (chosen_random_number < 50) j = YELLOW_SEEKER; else if (chosen_random_number < 70) j = LTBLUE_SEEKER; else if (chosen_random_number < 85) j = PINK_SEEKER; else if (chosen_random_number < 90) j = LIME_SEEKER; else if (chosen_random_number < 99) j = LURKER; else j = MEANY; chosen_random_number = RandomNumber(0,99); } while ((random_level_spec->total_flavors == 1) && (j == YELLOW_SEEKER)); break; case ROCKS_ONLY: if (chosen_random_number < 35) j = YELLOW_SEEKER; else if (chosen_random_number < 60) j = LTBLUE_SEEKER; else if (chosen_random_number < 75) j = PINK_SEEKER; else if (chosen_random_number < 90) j = LIME_SEEKER; else if (chosen_random_number < 99) j = LURKER; else j = MEANY; break; case PITS_ONLY: if (chosen_random_number < 20) j = YELLOW_SEEKER; else if (chosen_random_number < 40) j = LTBLUE_SEEKER; else if (chosen_random_number < 65) j = PINK_SEEKER; else if (chosen_random_number < 85) j = LIME_SEEKER; else if (chosen_random_number < 95) j = LURKER; else j = MEANY; break; case ROCKS_AND_PITS: if (chosen_random_number < 20) j = YELLOW_SEEKER; else if (chosen_random_number < 40) j = LTBLUE_SEEKER; else if (chosen_random_number < 60) j = PINK_SEEKER; else if (chosen_random_number < 80) j = LIME_SEEKER; else if (chosen_random_number < 90) j = LURKER; else j = MEANY; break; } } random_level_spec->featured_flavors[i] = j; } /************************************************************************************/ /***** Step 20: Decide how many of each type of seeker (in each mode) there will be.*/ /************************************************************************************/ for (i = 0; i < random_level_spec->total_flavors; i++) { switch (random_level_spec->total_flavors) { case 1: switch(random_level_spec->featured_flavors[i]) { case YELLOW_SEEKER: random_level_spec->easy_seeker_count[i] = RandomNumber(3,6); random_level_spec->medium_seeker_count[i] = RandomNumber(7,10); random_level_spec->hard_seeker_count[i] = RandomNumber(11,15); random_level_spec->insane_seeker_count[i] = RandomNumber(16,50); break; case PINK_SEEKER: random_level_spec->easy_seeker_count[i] = RandomNumber(2,5); random_level_spec->medium_seeker_count[i] = RandomNumber(6,9); random_level_spec->hard_seeker_count[i] = RandomNumber(10,12); random_level_spec->insane_seeker_count[i] = RandomNumber(13,20); break; case LTBLUE_SEEKER: random_level_spec->easy_seeker_count[i] = RandomNumber(2,4); random_level_spec->medium_seeker_count[i] = RandomNumber(5,6); random_level_spec->hard_seeker_count[i] = RandomNumber(7,8); random_level_spec->insane_seeker_count[i] = RandomNumber(9,10); break; case LIME_SEEKER: random_level_spec->easy_seeker_count[i] = RandomNumber(2,3); random_level_spec->medium_seeker_count[i] = RandomNumber(4,5); random_level_spec->hard_seeker_count[i] = RandomNumber(6,7); random_level_spec->insane_seeker_count[i] = RandomNumber(8,12); break; case ZOMBIE: random_level_spec->easy_seeker_count[i] = RandomNumber(2,3); random_level_spec->medium_seeker_count[i] = RandomNumber(4,5); random_level_spec->hard_seeker_count[i] = RandomNumber(6,7); random_level_spec->insane_seeker_count[i] = RandomNumber(8,10); break; case LURKER: random_level_spec->easy_seeker_count[i] = 1; random_level_spec->medium_seeker_count[i] = RandomNumber(2,3); random_level_spec->hard_seeker_count[i] = RandomNumber(4,5); random_level_spec->insane_seeker_count[i] = RandomNumber(6,10); break; case MEANY: random_level_spec->easy_seeker_count[i] = 1; random_level_spec->medium_seeker_count[i] = 2; random_level_spec->hard_seeker_count[i] = RandomNumber(3,4); random_level_spec->insane_seeker_count[i] = RandomNumber(5,7); break; } break; case 2: switch(random_level_spec->featured_flavors[i]) { case YELLOW_SEEKER: random_level_spec->easy_seeker_count[i] = RandomNumber(2,3); random_level_spec->medium_seeker_count[i] = RandomNumber(4,5); random_level_spec->hard_seeker_count[i] = RandomNumber(6,7); random_level_spec->insane_seeker_count[i] = RandomNumber(8,25); break; case PINK_SEEKER: random_level_spec->easy_seeker_count[i] = RandomNumber(1,2); random_level_spec->medium_seeker_count[i] = RandomNumber(3,4); random_level_spec->hard_seeker_count[i] = RandomNumber(5,6); random_level_spec->insane_seeker_count[i] = RandomNumber(7,10); break; case LTBLUE_SEEKER: random_level_spec->easy_seeker_count[i] = RandomNumber(1,2); random_level_spec->medium_seeker_count[i] = RandomNumber(3,4); random_level_spec->hard_seeker_count[i] = RandomNumber(5,6); random_level_spec->insane_seeker_count[i] = RandomNumber(7,10); break; case LIME_SEEKER: random_level_spec->easy_seeker_count[i] = 1; random_level_spec->medium_seeker_count[i] = RandomNumber(2,3); random_level_spec->hard_seeker_count[i] = RandomNumber(4,5); random_level_spec->insane_seeker_count[i] = RandomNumber(6,7); break; case ZOMBIE: random_level_spec->easy_seeker_count[i] = 1; random_level_spec->medium_seeker_count[i] = 2; random_level_spec->hard_seeker_count[i] = RandomNumber(3,4); random_level_spec->insane_seeker_count[i] = RandomNumber(5,6); break; case LURKER: random_level_spec->easy_seeker_count[i] = 1; random_level_spec->medium_seeker_count[i] = 2; random_level_spec->hard_seeker_count[i] = 3; random_level_spec->insane_seeker_count[i] = RandomNumber(4,5); break; case MEANY: random_level_spec->easy_seeker_count[i] = 1; random_level_spec->medium_seeker_count[i] = 2; random_level_spec->hard_seeker_count[i] = 3; random_level_spec->insane_seeker_count[i] = 4; break; } break; case 3: switch(random_level_spec->featured_flavors[i]) { case YELLOW_SEEKER: random_level_spec->easy_seeker_count[i] = RandomNumber(1,2); random_level_spec->medium_seeker_count[i] = RandomNumber(2,3); random_level_spec->hard_seeker_count[i] = RandomNumber(3,4); random_level_spec->insane_seeker_count[i] = RandomNumber(5,10); break; case PINK_SEEKER: random_level_spec->easy_seeker_count[i] = RandomNumber(1,2); random_level_spec->medium_seeker_count[i] = RandomNumber(2,3); random_level_spec->hard_seeker_count[i] = RandomNumber(3,4); random_level_spec->insane_seeker_count[i] = RandomNumber(4,5); break; case LTBLUE_SEEKER: random_level_spec->easy_seeker_count[i] = RandomNumber(1,2); random_level_spec->medium_seeker_count[i] = RandomNumber(2,3); random_level_spec->hard_seeker_count[i] = RandomNumber(3,4); random_level_spec->insane_seeker_count[i] = RandomNumber(4,5); break; case LIME_SEEKER: random_level_spec->easy_seeker_count[i] = 1; random_level_spec->medium_seeker_count[i] = 2; random_level_spec->hard_seeker_count[i] = 3; random_level_spec->insane_seeker_count[i] = 4; break; case ZOMBIE: random_level_spec->easy_seeker_count[i] = 1; random_level_spec->medium_seeker_count[i] = 2; random_level_spec->hard_seeker_count[i] = 2; random_level_spec->insane_seeker_count[i] = 3; break; case LURKER: random_level_spec->easy_seeker_count[i] = 1; random_level_spec->medium_seeker_count[i] = 1; random_level_spec->hard_seeker_count[i] = 2; random_level_spec->insane_seeker_count[i] = 3; break; case MEANY: random_level_spec->easy_seeker_count[i] = 1; random_level_spec->medium_seeker_count[i] = 1; random_level_spec->hard_seeker_count[i] = 2; random_level_spec->insane_seeker_count[i] = 2; break; } break; } } /************************************************************************************/ /***** Step 21: Now assign homes at random for all these guys. **********************/ /************************************************************************************/ k = 0; for (i = 0; i < random_level_spec->total_flavors; i++) { for (j = 0; j < random_level_spec->insane_seeker_count[i]; j++) { random_level_spec->seeker_type[k] = random_level_spec->featured_flavors[i]; switch (RandomNumber(0,3)) { case 0: random_level_spec->direction[k] = NORTH; break; case 1: random_level_spec->direction[k] = SOUTH; break; case 2: random_level_spec->direction[k] = EAST; break; case 3: random_level_spec->direction[k] = WEST; break; } switch (random_level_spec->direction[k]) { case NORTH: random_level_spec->row[k] = 0; random_level_spec->column[k] = RandomNumber(0,13); break; case SOUTH: random_level_spec->row[k] = 13; random_level_spec->column[k] = RandomNumber(0,13); break; case WEST: random_level_spec->row[k] = RandomNumber(0,13); random_level_spec->column[k] = 0; break; case EAST: random_level_spec->row[k] = RandomNumber(0,13); random_level_spec->column[k] = 13; break; } if ((random_level_spec->seeker_type[k] == ZOMBIE) && (swamp_status != SWAMPLESS)) { random_level_spec->direction[k] = RANDOM; random_level_spec->row[k] = 0; random_level_spec->column[k] = 0; } k++; } }}/******************************** PrintObjectCode ************************************** This function is used by DumpRandomlyGeneratedLevel to output the ASCII sybmol forthe given solid object.*****************************************************************************************/void PrintObjectCode(int32 object_id){ switch(object_id) { case NOTHING: printf("N "); break; case BLUE_PYRAMID: printf("B "); break; case RED_PYRAMID: printf("R "); break; case GREEN_PYRAMID: printf("G "); break; case PURPLE_PYRAMID: printf("P "); break; case RAINBOW_PYRAMID: printf("T "); break; case CONCRETE_PYRAMID: printf("C "); break; case BOULDER0: printf("0 "); break; case BOULDER1: printf("1 "); break; case BOULDER2: printf("2 "); break; case BOULDER3: printf("3 "); break; case BOULDER4: printf("4 "); break; case BOULDER5: printf("5 "); break; case BOULDER6: printf("6 "); break; case BOULDER7: printf("7 "); break; case BOULDER8: printf("8 "); break; case BOULDER9: printf("9 "); break; case BOULDERA: printf("A "); break; case BOULDERD: printf("D "); break; default: printf("%ld ",object_id); break; }}/********************************* PrintTileCode *************************************** This function is used by DumpRandomlyGeneratedLevel to output the ASCII sybmol forthe given tile.*****************************************************************************************/void PrintTileCode(int32 tile_id){ switch(tile_id) { case UA_TILE: printf("UA"); break; case UB_TILE: printf("UB"); break; case UC_TILE: printf("UC"); break; case UD_TILE: printf("UD"); break; case UE_TILE: printf("UE"); break; case DA_TILE: printf("DA"); break; case DB_TILE: printf("DB"); break; case DC_TILE: printf("DC"); break; case DD_TILE: printf("DD"); break; case GA_TILE: printf("GA"); break; case GB_TILE: printf("GB"); break; case GC_TILE: printf("GC"); break; case GD_TILE: printf("GD"); break; case GE_TILE: printf("GE"); break; case GF_TILE: printf("GF"); break; case HA_TILE: printf("HA"); break; case HB_TILE: printf("HB"); break; case HC_TILE: printf("HC"); break; case HD_TILE: printf("HD"); break; case HE_TILE: printf("HE"); break; case IA_TILE: printf("IA"); break; case IB_TILE: printf("IB"); break; case IC_TILE: printf("IC"); break; case ID_TILE: printf("ID"); break; case WA_TILE: printf("WA"); break; case WB_TILE: printf("WB"); break; case S1_TILE: printf("S1"); break; case SA_TILE: printf("SA"); break; case L1_TILE: printf("L1"); break; case LA_TILE: printf("LA"); break; case LB_TILE: printf("LB"); break; case PA_TILE: printf("PA"); break; case PB_TILE: printf("PB"); break; case PC_TILE: printf("PC"); break; case PD_TILE: printf("PD"); break; case PE_TILE: printf("PE"); break; case PF_TILE: printf("PF"); break; case PG_TILE: printf("PG"); break; case PH_TILE: printf("PH"); break; case PI_TILE: printf("PI"); break; case PJ_TILE: printf("PJ"); break; case P1_TILE: printf("P1"); break; case VA_TILE: printf("VA"); break; case VB_TILE: printf("VB"); break; case PK_TILE: printf("PK"); break; case SB_TILE: printf("SB"); break; case DE_TILE: printf("DE"); break; case WC_TILE: printf("WC"); break; case WD_TILE: printf("WD"); break; case PL_TILE: printf("PL"); break; case PM_TILE: printf("PM"); break; default: printf("%ld ",tile_id); break; }}/************************ PrintRandomSeekersForGivenSetting *************************** This function is used by DumpRandomlyGeneratedLevel to output the seeker settings fora particular difficulty's contingent of seekers.*****************************************************************************************/void PrintRandomSeekersForGivenSetting(int32 setting){ int32 i,j,k; bool print_this_seeker; k = 0; for (i = 0; i < random_level_spec->total_flavors; i++) { for (j = 0; j < random_level_spec->insane_seeker_count[i]; j++) { print_this_seeker = FALSE; switch (setting) { case EASY: if (j < random_level_spec->easy_seeker_count[i]) print_this_seeker = TRUE; break; case MEDIUM: if ((j >= random_level_spec->easy_seeker_count[i]) && (j < random_level_spec->medium_seeker_count[i])) print_this_seeker = TRUE; break; case HARD: if ((j >= random_level_spec->medium_seeker_count[i]) && (j < random_level_spec->hard_seeker_count[i])) print_this_seeker = TRUE; break; case INSANE: if (j >= random_level_spec->hard_seeker_count[i]) print_this_seeker = TRUE; break; } if (print_this_seeker) { switch(random_level_spec->seeker_type[k]) { case YELLOW_SEEKER: printf("YELLOW_SEEKER, "); break; case LTBLUE_SEEKER: printf("LTBLUE_SEEKER, "); break; case PINK_SEEKER: printf("PINK_SEEKER, "); break; case LIME_SEEKER: printf("LIME_SEEKER, "); break; case LURKER: printf("LURKER, "); break; case ZOMBIE: printf("ZOMBIE, "); break; case MEANY: printf("MEANY, "); break; } printf("%ld, %ld, ", random_level_spec->row[k], random_level_spec->column[k]); switch(random_level_spec->direction[k]) { case NORTH: printf("NORTH"); break; case SOUTH: printf("SOUTH"); break; case EAST: printf("EAST"); break; case WEST: printf("WEST"); break; case RANDOM: printf("RANDOM"); break; case NO_DIRECTION: printf("NONE"); break; } printf("\n"); } k++; } }}/**************************** DumpRandomlyGeneratedLevel ******************************* This function prints the particulars of a randomly generated level in the usuallevel specification format. It is meant for use in cases in which a randomly generatedlevel is particularly successful and we want to save it for use as an actual level. *****************************************************************************************/void DumpRandomlyGeneratedLevel(){ int32 i,j; printf("*** Randomly Generated Level Specification ***\n"); for (i = 0; i < ROWS_IN_LANDSCAPE; i++) { for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) PrintObjectCode(random_level_spec->pyramids[i][j]); printf("\n"); } printf("*****************************************\n"); for (i = 0; i < ROWS_IN_LANDSCAPE; i++) { for (j = 0; j < COLUMNS_IN_LANDSCAPE; j++) { PrintTileCode(random_level_spec->tiles[i][j]); printf(" "); } printf("\n"); } printf("*****************************************\n"); PrintTileCode(random_level_spec->wasteland); printf("\n"); printf("*****************************************\n"); switch (RandomNumber (0, TOTAL_TRACKS - 1)) { default: printf ("QUACK\n"); break; case 0: printf ("QUACK\n"); break; case 1: printf ("CHECK_THIS_OUT_TALK\n"); break; case 2: printf ("MADONNA\n"); break; case 3: printf ("SPACE_AGE\n"); break; case 4: printf ("SOUND_OF_TALK\n"); break; case 5: printf ("LOTS_OF_PERC\n"); break; case 6: printf ("DRUNK_TRUMPET\n"); break; case 7: printf ("MONKEY\n"); break; case 8: printf ("THE_LONGER_ONE\n"); break; case 9: printf ("MORE_QUACK\n"); break; case 10: printf ("SEVENTIES2\n"); break; case 11: printf ("SHAFT\n"); break; case 12: printf ("HIT_ME\n"); break; case 13: printf ("WATER_WORKS\n"); break; case 14: printf ("FAST_HUNT\n"); break; case 15: printf ("G_BOUNCE\n"); break; case 16: printf ("SCHICK\n"); break; case 17: printf ("BALI\n"); break; } printf("*****************************************\n"); PrintRandomSeekersForGivenSetting(EASY); printf("*****************************************\n"); PrintRandomSeekersForGivenSetting(MEDIUM); printf("*****************************************\n"); PrintRandomSeekersForGivenSetting(HARD); printf("*****************************************\n"); PrintRandomSeekersForGivenSetting(INSANE); printf("*****************************************\n");} /***************************************** EOF ******************************************/