/* ----------------------------------------------- GTASC - GTA adaptation for TI Calculators ----------------------------------------------- Programmed by : Olivier SANGALA Version : 1.2 License : Free under GNU General Public License ( see "gpl.txt" ) Release Date : 05/01/2007 Platform : TI89/TI92+/V200 Website : http://olivier.sangala.free.fr Email : olivier_sangala@hotmail.com ---------- License ---------- Copyright (C) 2002-2007 Olivier SANGALA This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ //----------------------------------------------------------------------------- /* Code for Story Missions */ #include // Include All Header Files #include "defines.h" #include "kblib.h" #include "tmde.h" //-------------------------------------------------------------------------- // extern extern TGame*Game; //-------------------------------------------------------------------------- extern int FrameCounter; extern TCamera Camera; extern unsigned char * TileMap; extern unsigned short * TileData; extern TPoint8 TMSize; extern int scx; extern int scy; extern int TileMasked; extern int BlankSquare; extern int TilePalette; extern char * Plane0; extern char * Plane1; //-------------------------------------------------------------------------- /* if missions ends with parking veh in garage call this to get out automatically from veh, and remove veh */ void Miss_GarageOut(void) { TPed*P=Game->MainPed; TVeh*V=Game->MainVeh; // get out of veh P->MD.speed = 0; Game->motion_type=MT_PED; Game->MainVeh=NULL; Game->MainVeh2=NULL; // place ped P->MD.Pos=V->MD.Pos; P->MD.Pos.x+=4; P->MD.Pos.y+=4; P->MD.angle=0; Ped_OnNewAngle(P); // disable veh V->enable=0; } //-------------------------------------------------------------------------- void Miss_ShowBrief(char*str) { // pause for 3s COULD be done // to avoid flash screen while playing PortSet(GetPlane(0),239,127); ClrScr(); PortSet(GetPlane(1),239,127); ClrScr(); FontSetSys(0); // DEBUG printf("Mission ID : %d \n",Game->Save.progress_story); clrscr(); printf("Mission Details : \n\n"); printf(str); printf("\n\n"); printf("Press ENTER..."); FontSetSys(1); PortRestore(); WaitForKeyDOWN(KEYFLAGS_ENTER); WaitForAllKeysReleased(); } //-------------------------------------------------------------------------- void Miss_Lose(void) { Miss_RemoveMU(); TMission*Miss=&Game->Miss; Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } //-------------------------------------------------------------------------- void Miss_SetPlace(byte y, byte x) { TPoint P; P.x=MUL16(x); P.y=MUL16(y); TMission*Miss=&Game->Miss; Miss->target_enable = 1; Miss->target_type = TT_PLACE; Miss->target_PP=P; } //-------------------------------------------------------------------------- void Miss_SetTimer(int value, int visible) { TMission*Miss=&Game->Miss; Miss->timer_enable=1; Miss->timer_value=value; Miss->timer_visible=visible; } //-------------------------------------------------------------------------- void Miss_SetTargetVeh(TVeh*V) { TMission*Miss=&Game->Miss; Miss->target_enable = 1; Miss->target_type = TT_VEH; Miss->target_V=V; } //-------------------------------------------------------------------------- /* disable mission used objects */ void Miss_RemoveMU(void) { TMission*Miss=&Game->Miss; // Peds if (Miss->P) { Miss->P->mission_used = 0; Miss->P=NULL; } // Vehs if (Miss->V) { Miss->V->mission_used = 0; Miss->V=NULL; } } //-------------------------------------------------------------------------- /* function that runs missions steps NOTE : use missions flags to go through steps reset useful flags before and after detecting them */ void Miss_Code(void) { TMission*Miss=&Game->Miss; int stepc = 0; int midc = 0; // ********************************* // ********** NEW MISSION ********** // ********************************* // ********** MISSID = 00 ********** // ********************************* if (Game->Save.progress_story==(midc++)) { if (Miss->step==(stepc++)) { if (Miss->flag_begin) { Miss->flag_begin=0; Miss->flag_placestop_ped=0; Miss_SetPlace(PHONEBOX1_N1); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_vehinto=0; Miss->target_enable=0; Miss_ShowBrief("Let's start easy. Hijack a vehicle!"); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehinto) { Miss->flag_vehinto=0; Miss->flag_respray=0; Miss->V = Game->MainVeh; Miss->V->mission_used=1; // damage veh automatically to enable respray Miss->V->health = VEH_HEALTH-1; Miss_ShowBrief("Right. Now, get it resprayed."); Game->Save.fugitive_factor=1; Miss_SetPlace(GARAGE1_SPRAY); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_respray && Miss->ResprayVeh==Miss->V) { Miss->flag_respray=0; Miss->flag_placestop_veh=0; Miss->target_enable=0; Miss_ShowBrief("OK. Just bring that back into the garage!"); Miss_SetPlace(GARAGE1_VEHPARK); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_veh) { Miss->flag_placestop_veh=0; Miss->target_enable=0; Miss_GarageOut(); Miss_RemoveMU(); Miss_ShowBrief("Good work! Here's $5000! "); Game->Save.cash+=5; Game->Save.progress_story++; // Mission completed! Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } } } // ********************************* // ********** NEW MISSION ********** // ********************************* // ********** MISSID = 01 ********** // ********************************* else if (Game->Save.progress_story==(midc++)) { if (Miss->step==(stepc++)) { if (Miss->flag_begin) { Miss->flag_begin=0; Miss->flag_placestop_ped=0; Miss_SetPlace(PHONEBOX1_N2); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_vehinto=0; Miss->target_enable=0; Miss_ShowBrief("Steal a Yakusa vehicle!"); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehinto && Game->MainVeh->skin==VEH_SKIN_Y) { Miss->flag_vehinto=0; Miss->flag_crushed=0; Miss->V = Game->MainVeh; Miss->V->mission_used=1; Miss_ShowBrief("Bring it to the car crusher!"); Miss_SetPlace(GARAGE1_CRUSHER); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_crushed && Miss->CrushedVeh==Miss->V) { Miss->flag_crushed=0; Miss->flag_vehinto=0; Miss->target_enable=0; Miss_ShowBrief("Now steal a Loony vehicle!"); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehinto && Game->MainVeh->skin==VEH_SKIN_L) { Miss->flag_vehinto=0; Miss->flag_crushed=0; Miss->V = Game->MainVeh; Miss->V->mission_used=1; Miss_ShowBrief("Bring it to the car crusher!"); Miss_SetPlace(GARAGE1_CRUSHER); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_crushed && Miss->CrushedVeh==Miss->V) { Miss->flag_crushed=0; Miss->target_enable=0; Miss_RemoveMU(); Miss_ShowBrief("Good work, Homie! You deserve $8000."); Game->Save.cash+=8; Game->Save.progress_story++; // Mission completed! Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } } } // ********************************* // ********** NEW MISSION ********** // ********************************* // ********** MISSID = 02 ********** // ********************************* else if (Game->Save.progress_story==(midc++)) { if (Miss->step==(stepc++)) { if (Miss->flag_begin) { Miss->flag_begin=0; Miss->flag_placestop_ped=0; Miss_SetPlace(PHONEBOX1_N1); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_vehinto=0; Miss->target_enable=0; Miss_ShowBrief("Find a vehicle."); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehinto && Game->MainVeh) { Miss->flag_vehinto=0; Miss->flag_vehblownup=0; Miss_ShowBrief("Loonies make me sick. I want you to destroy 3 of theirs vehicles."); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehblownup && Miss->BlownUpVeh->skin==VEH_SKIN_L) { Miss->flag_vehblownup=0; Miss_ShowBrief("OK, 2 vehicles left."); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehblownup && Miss->BlownUpVeh->skin==VEH_SKIN_L) { Miss->flag_vehblownup=0; Miss_ShowBrief("Just one more!"); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehblownup && Miss->BlownUpVeh->skin==VEH_SKIN_L) { Miss->flag_vehblownup=0; Miss_RemoveMU(); Miss_ShowBrief("OK, that's enough. Take this : $10000."); Game->Save.cash+=10; Game->Save.progress_story++; // Mission completed! Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } } } // ********************************* // ********** NEW MISSION ********** // ********************************* // ********** MISSID = 03 ********** // ********************************* else if (Game->Save.progress_story==(midc++)) { if (Miss->step==(stepc++)) { if (Miss->flag_begin) { Miss->flag_begin=0; Miss->flag_placestop_ped=0; Miss_SetPlace(PHONEBOX1_N2); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_placestop_veh=0; Miss->target_enable=0; Miss_ShowBrief("Get into a vehicle and go onto the target."); Miss_SetPlace(10,100); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_veh) { Miss->flag_placestop_veh=0; Miss->flag_timer=0; Miss->target_enable=0; Miss_ShowBrief("Follow the vehicle!"); Miss->V=Game->Vehs; if (Miss->V==Game->MainVeh) Miss->V++; Veh_Init(Miss->V); Miss->V->enable=1; Miss->V->MD.angle=12; Miss->V->MD.Pos.y=MUL16(10); Miss->V->MD.Pos.x=MUL16(97); Miss->V->MD.speed=SPEED_LCD; Miss->V->skin=VEH_SKIN_L; Miss->V->CC_behaviour=BH_Veh_Computer; Veh_OnNewAngle(Miss->V); Veh_LoadTD(Miss->V); Miss->V->mission_used=1; Miss_SetTargetVeh(Miss->V); Miss_SetTimer(60,0); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_timer) { Miss->flag_timer=0; Miss->target_enable=0; Miss->timer_enable=0; Miss->flag_vehblownup=0; Miss_ShowBrief("OK. Now destroy the vehicle"); Miss_SetTargetVeh(Miss->V); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehblownup && Miss->BlownUpVeh==Miss->V) { Miss->flag_vehblownup=0; Miss->target_enable=0; Miss_RemoveMU(); Miss_ShowBrief("Excellent! Get those $10000."); Game->Save.cash+=10; Game->Save.progress_story++; // Mission completed! Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } } } // ********************************* // ********** NEW MISSION ********** // ********************************* // ********** MISSID = 04 ********** // ********************************* else if (Game->Save.progress_story==(midc++)) { if (Miss->step==(stepc++)) { if (Miss->flag_begin) { Miss->flag_begin=0; Miss->flag_placestop_ped=0; Miss_SetPlace(PHONEBOX1_N1); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_vehinto=0; Miss->target_enable=0; Miss_ShowBrief("Get into a Loony vehicle."); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehinto && Miss->IntoVeh->skin==VEH_SKIN_L) { Miss->flag_vehinto=0; Miss->flag_pedkilled=0; Miss_ShowBrief("I want you to take off 3 Yakusa gangsters."); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_pedkilled && Miss->KilledPed->skin==PED_SKIN_Y) { Miss->flag_pedkilled=0; Miss_ShowBrief("Still 2 gangsters!"); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_pedkilled && Miss->KilledPed->skin==PED_SKIN_Y) { Miss->flag_pedkilled=0; Miss_ShowBrief("One left!"); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_pedkilled && Miss->KilledPed->skin==PED_SKIN_Y) { Miss->flag_pedkilled=0; Miss_RemoveMU(); Miss_ShowBrief("You did it! What about $15000 ?"); Game->Save.cash+=15; Game->Save.progress_story++; // Mission completed! Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } } } // ********************************* // ********** NEW MISSION ********** // ********************************* // ********** MISSID = 05 ********** // ********************************* else if (Game->Save.progress_story==(midc++)) { if (Miss->step==(stepc++)) { if (Miss->flag_begin) { Miss->flag_begin=0; Miss->flag_placestop_ped=0; Miss_SetPlace(PHONEBOX2_N1); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_placestop_veh=0; Miss->target_enable=0; Miss_ShowBrief("Find a vehicle and go to the Bomb Shop."); Miss_SetPlace(GARAGE2_BOMB); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_veh) { Miss->flag_placestop_veh=0; Miss->V=Game->MainVeh; Miss->V->mission_used=1; Miss_ShowBrief("Now park the vehicle into Zaibatsu area."); Miss_SetPlace(217,183); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_veh) { Miss->flag_placestop_ped=0; Miss->flag_placestop_veh=0; Miss->target_enable=0; Miss_ShowBrief("Get out and go onto the target to make the vehicle explode!"); Miss_SetPlace(203,194); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_pedkilled=0; Miss->target_enable=0; Miss->step2=0; Veh_Blow(Miss->V); Miss_ShowBrief("That's huge! Take off some Zaibatsu gangsters to conclude!"); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_pedkilled && Miss->KilledPed->skin==PED_SKIN_Z) { Miss->flag_pedkilled=0; Miss->step2++; if (Miss->step2==10) { Miss->step2=0; Miss_RemoveMU(); Miss_ShowBrief("Awesome! This cash is for you, $20000."); Game->Save.cash+=20; Game->Save.progress_story++; // Mission completed! Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } } } } // ********************************* // ********** NEW MISSION ********** // ********************************* // ********** MISSID = 06 ********** // ********************************* else if (Game->Save.progress_story==(midc++)) { if (Miss->step==(stepc++)) { if (Miss->flag_begin) { Miss->flag_begin=0; Miss->flag_placestop_ped=0; Miss_SetPlace(PHONEBOX2_N2); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_vehinto=0; Miss->target_enable=0; Miss_ShowBrief("I was stolen my vehicle! I'm sure Zaibatsu are responsible for this. Bring me back my vehicle!"); Miss->V=Game->Vehs; if (Miss->V==Game->MainVeh) Miss->V++; Veh_Init(Miss->V); Miss->V->enable=1; Miss->V->MD.angle=4; Miss->V->MD.Pos.y=MUL16(233); Miss->V->MD.Pos.x=MUL16(153); Miss->V->MD.speed=0; Miss->V->skin=VEH_SKIN_S; Miss->V->CC_behaviour=BH_Veh_None; Veh_OnNewAngle(Miss->V); Veh_LoadTD(Miss->V); Miss->V->mission_used=1; Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehinto && Miss->IntoVeh==Miss->V) { Miss->flag_vehinto=0; Miss->flag_placestop_veh=0; Miss_ShowBrief("You found it! Bring it back!"); Miss_SetPlace(GARAGE2_VEHPARK); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_veh) { Miss->flag_placestop_veh=0; Miss->target_enable=0; Miss_GarageOut(); Miss_RemoveMU(); Miss_ShowBrief("Good work! You need those $20000, don't you?"); Game->Save.cash+=20; Game->Save.progress_story++; // Mission completed! Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } } } // ********************************* // ********** NEW MISSION ********** // ********************************* // ********** MISSID = 07 ********** // ********************************* else if (Game->Save.progress_story==(midc++)) { if (Miss->step==(stepc++)) { if (Miss->flag_begin) { Miss->flag_begin=0; Miss->flag_placestop_ped=0; Miss_SetPlace(PHONEBOX2_N3); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->target_enable=0; Miss_ShowBrief("Brand new Spank is waiting for you in South West City. Go and get it!"); Miss_SetPlace(247,64); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_timer=0; Miss->target_enable=0; Miss_ShowBrief("Damned, the cops! Flee!"); Game->Save.fugitive_factor=3; Miss_SetTimer(30,0); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_timer) { Miss->flag_timer=0; Miss->flag_respray=0; Miss_ShowBrief("OK! What I guess is you gotta get resprayed!"); Miss->V=Game->MainVeh; Miss->V->mission_used=1; Miss_SetPlace(GARAGE2_SPRAY); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_respray && Miss->ResprayVeh==Miss->V) { Miss->flag_respray=0; Miss->target_enable=0; Miss->flag_placestop_veh=0; Miss_ShowBrief("That's all right! Come back to Safe House!"); Miss_SetPlace(GARAGE2_VEHPARK); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_veh) { Miss->flag_placestop_veh=0; Miss->target_enable=0; Miss_GarageOut(); Miss_RemoveMU(); Miss_ShowBrief("Really well done! I've got $25000 for you."); Game->Save.cash+=25; Game->Save.progress_story++; // Mission completed! Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } } } // ********************************* // ********** NEW MISSION ********** // ********************************* // ********** MISSID = 08 ********** // ********************************* else if (Game->Save.progress_story==(midc++)) { if (Miss->step==(stepc++)) { if (Miss->flag_begin) { Miss->flag_begin=0; Miss->flag_placestop_ped=0; Miss_SetPlace(PHONEBOX2_N4); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_vehblownup=0; Miss->target_enable=0; Miss_ShowBrief("We've come to a dead end, my friend. Get a vehicle and blow up those Yakusa!"); Miss_ShowBrief("I want 10 burning vehicles of them!"); Miss->step++; Miss->step2=0; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehblownup && Miss->BlownUpVeh->skin==VEH_SKIN_Y) { Miss->flag_vehblownup=0; Miss->step2++; if (Miss->step2==10) { Miss->step2=0; Miss->flag_pedkilled=0; Miss_ShowBrief("Now kill 10 Yakusa gangsters!"); Miss->step++; Miss->step2=0; } } } else if (Miss->step==(stepc++)) { if (Miss->flag_pedkilled && Miss->KilledPed->skin==PED_SKIN_Y) { Miss->flag_pedkilled=0; Miss->step2++; if (Miss->step2==10) { Miss->step2=0; Miss_RemoveMU(); Miss_ShowBrief("You're the one! Don't refuse $30000."); Game->Save.cash+=30; Game->Save.progress_story++; // Mission completed! Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } } } } // ********************************* // ********** NEW MISSION ********** // ********************************* // ********** MISSID = 09 ********** // ********************************* else if (Game->Save.progress_story==(midc++)) { if (Miss->step==(stepc++)) { if (Miss->flag_begin) { Miss->flag_begin=0; Miss->flag_placestop_ped=0; Miss_SetPlace(PHONEBOX2_N2); Miss->step++; } } else if (Miss->step==(stepc++)) { if (Miss->flag_placestop_ped) { Miss->flag_placestop_ped=0; Miss->flag_vehblownup=0; Miss->target_enable=0; Miss_ShowBrief("Get ready for the last one! I want you to burn 3 police vehicles!"); Miss->step++; Miss->step2=0; } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehblownup && Miss->BlownUpVeh->skin==VEH_SKIN_COP) { Miss->flag_vehblownup=0; Miss->step2++; if (Miss->step2==3) { Miss->step2=0; Miss_ShowBrief("Time for gang war! Burn 5 Zaibatsu vehicles!"); Miss->step++; } } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehblownup && Miss->BlownUpVeh->skin==VEH_SKIN_Z) { Miss->flag_vehblownup=0; Miss->step2++; if (Miss->step2==5) { Miss->step2=0; Miss_ShowBrief("Burn 5 Yakusa vehicles!"); Miss->step++; } } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehblownup && Miss->BlownUpVeh->skin==VEH_SKIN_Y) { Miss->flag_vehblownup=0; Miss->step2++; if (Miss->step2==5) { Miss->step2=0; Miss_ShowBrief("Burn 5 Loony vehicles!"); Miss->step++; } } } else if (Miss->step==(stepc++)) { if (Miss->flag_vehblownup && Miss->BlownUpVeh->skin==VEH_SKIN_L) { Miss->flag_vehblownup=0; Miss->step2++; if (Miss->step2==5) { Miss->step2=0; Miss_ShowBrief("That's really well done. You receive $50000!"); Miss_ShowBrief("Congratulations!!! You completed all the missions sucessfully!!"); Miss->step++; Game->Save.cash+=50; Game->Save.progress_story++; // Mission completed! Miss->step=0; // start from beginning Miss->flag_begin=1; // get ready next mission } } } } } //---------------------------------------------------------------------------