mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Development Trunk: https://ja2svn.dyndns.org/source/ja2/branches/Wanne/JA2%201.13%20MP A detailed list of all the features (changes) is visible in the history log of the development trunk: INFO: The source code for the official 2011 release (4870) has been branched here: https://ja2svn.dyndns.org/source/ja2/branches/JA2_rev.4870_2011 This commit contains the following features: *** Externalized Vehicles *** o Now with this feature we can add/remove vehicles o New XML File: TableData\Vehicles.xml o Added a new function parameter to lua file Scripts\Overhead lua to set up the helicopter in method: SetUpHelicopterForPlayer() o Added example mini (Docs\Externalized Vehicles Example.zip) mod which adds 2 additional vehicles (hummer and ice-cream truck to sector A9) *** Up to 255 save slots *** - There is a "Next" and "Prev" button where you can scroll through the save slots - It is now possible to load the automatic save (SAVE_EVERY_N_HOURS) from the load screen. This is the first slot after the quickload slot - Added the 2 alternate players end turn saves (which can be enabled/disabled in option screen) to the save/load game form *** New Feature: Externalized emails from Emails.edt to XML*** o This feature can be enabled/disabled in the Source: --> See email.cpp: If "ReadXMLEmail" == FALSE, then normal way (read from Email.edt) otherwise read from XML files o 2 new XML files: TableData\Email\EmailMercAvailable.xml and EmailMercLevelUp.xml o Renamed SenderNamesList.xml to EmailSenderNamesList.xml and moved from TableData folder to TableData\Email folder o Names for mercenaries are get from the file MercProfiles.xml and different names get from the file EmailSenderNamesList.xml *** Externalized Hidden Towns (Tixa, Orta) *** o Now it is possible to add new hidden towns (locations) o See file: TableData/Map/Cities.xml o New variable in TableData/Map/Cities.xml - hiddenTown: 0 = show on strategy map, 1 = Hide on strategy map - townIcon: 1 = on, 0 = off (This is the icon you see on the strategy map) - szIconFile: The path to the sti icon file (eg: interface\prison.sti, interface\my_icon.sti) - iconPosition: The x,y position of the icon on the strategy map *** Encyclopedia and Briefing Room, reachable from the laptop *** o 2 new ja2_options.ini properties: BRIEFING_ROOM, ENCYCLOPEDIA o demonstration video: http://www.youtube.com/watch?v=7CIXdXWLrAo o Added Example usage of the Briefing Room - Extract it in your JA2 1.13 folder and use the latest development executable - The briefing room can be reached from the laptop. Enter SN5631 for the code and then click the "Exit" button - See "Info_BriefingRoom.txt" and "BriefingRoom_Mission1.png" *** Improved interrupt system (IIS) *** o This system changes the way interrupts work. See: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=290787#Post290787 o Option system (see ja2_options.ini: IMPROVED_INTERRUPT_SYSTEM) o A few more settings for the interrupt system in ja2_options.ini o INFO: Multiplayer games always use the "old" interrupt system, not matter what the user selects in the ja2_options.ini *** Walking and sidestepping with weapon raised *** o Enable/disable the walking/sidestepping with raised weapon in ja2_options.ini: ALLOW_WALKING_WITH_WEAPON_RAISED o You can set an AP/BP modifier when walking/sidestepping with weapon raised in APBPConstants.ini: AP_MODIFIER_WEAPON_READY o The following feature apply when you walk/sidestep with weapon raised: -> limited angle of view, but you can see more farther when the weapon has a scope -> better change for interrupts if you see an enemy -> less APs and BPs when shooting, because the weapon is already raised -> It should cost more APs when walking. Maybe you can export the additional AP and BP modifier to the APBPConstants.ini *** Increase squad size to 8 (800x600) and 8 and 10 (1024x768) *** o Squad sizes (dependend on the screen resolution) can be selected in the start new game screen o In a multiplayer game, the squad size will always be 6, because it does not work with more soldiers/squad *** Added UB-1.13 source code *** o Merged the UB-1.13 source code (Revision: 4721) from svn: http://subversion.assembla.com/svn/ub-source113 o If you want to build UB-EXE or UB-MapEditor, just enable the 2 defines (JA2UB and JA2UBMAPS) in "builddefines.h" o The UB-Verion reads from "ja2_UB.ini" instead of "ja2.ini" o There are 2 new XML files - Layout\LayoutMainMenu.xml - MapAction\ActionItems.xml o There are 2 new LUA-Script files - Scripts\ExplosionControl.lua - Scripts\InterfaceDialogue.lua *** Hide enemy health text / enemy hit count *** o ja2_options.ini: HIDE_ENEMY_HEALTH_TEXT, HIDE_ENEMY_HIT_COUNT o both new settings only have effect in a singleplayer game o see: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=128840&page=1 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4885 3b4a5df2-a311-0410-b5c6-a8a6f20db521
876 lines
18 KiB
C++
876 lines
18 KiB
C++
#ifdef PRECOMPILEDHEADERS
|
|
#include "Tactical All.h"
|
|
#else
|
|
#include "builddefines.h"
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "wcheck.h"
|
|
#include "stdlib.h"
|
|
#include "debug.h"
|
|
//#include "soldier control.h"
|
|
// HEADROCK HAM 3.5: Strange that this wasn't included.
|
|
#include "GameSettings.h"
|
|
#include "weapons.h"
|
|
#include "handle items.h"
|
|
#include "worlddef.h"
|
|
#include "worldman.h"
|
|
#include "rotting corpses.h"
|
|
#include "tile cache.h"
|
|
#include "isometric utils.h"
|
|
#include "animation control.h"
|
|
#include "utilities.h"
|
|
#include "game clock.h"
|
|
#include "soldier create.h"
|
|
#include "renderworld.h"
|
|
#include "tile animation.h"
|
|
#include "merc entering.h"
|
|
#include "Sound Control.h"
|
|
#include "strategic.h"
|
|
#include "strategicmap.h"
|
|
#include "Handle UI.h"
|
|
#include "squads.h"
|
|
#include "english.h"
|
|
#include "cursors.h"
|
|
#include "cursor control.h"
|
|
#include "Merc Hiring.h"
|
|
#include "Font Control.h"
|
|
#include "message.h"
|
|
#include "Text.h"
|
|
#include "strategic turns.h"
|
|
#include "ai.h"
|
|
#include "Dialogue Control.h"
|
|
#include "Music Control.h"
|
|
#include "Tactical Save.h"
|
|
// HEADROCK HAM 3.5: Need this to see if enemies present at starting sector
|
|
#include "Overhead.h"
|
|
#endif
|
|
|
|
#ifdef JA2UB
|
|
#include "ub_config.h"
|
|
#endif
|
|
|
|
|
|
//forward declarations of common classes to eliminate includes
|
|
class OBJECTTYPE;
|
|
class SOLDIERTYPE;
|
|
|
|
// WDS - make number of mercenaries, etc. be configurable
|
|
#define MAX_MERC_IN_HELI CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS
|
|
#define MAX_HELI_SCRIPT 30
|
|
#define ME_SCRIPT_DELAY 100
|
|
#define NUM_PER_HELI_RUN 6
|
|
|
|
enum
|
|
{
|
|
HELI_APPROACH,
|
|
HELI_MOVETO,
|
|
HELI_BEGINDROP,
|
|
HELI_DROP,
|
|
HELI_ENDDROP,
|
|
HELI_MOVEAWAY,
|
|
HELI_EXIT,
|
|
NUM_HELI_STATES
|
|
|
|
} HeliStateEnums;
|
|
|
|
enum
|
|
{
|
|
HELI_REST,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVEY,
|
|
HELI_MOVELARGERY,
|
|
HELI_HANDLE_DROP,
|
|
HELI_SHOW_HELI,
|
|
|
|
HELI_GOTO_BEGINDROP,
|
|
HELI_GOTO_DROP,
|
|
HELI_GOTO_EXIT,
|
|
HELI_GOTO_MOVETO,
|
|
HELI_GOTO_MOVEAWAY,
|
|
HELI_DONE,
|
|
|
|
|
|
} HeliCodes;
|
|
|
|
|
|
UINT8 ubHeliScripts[ NUM_HELI_STATES ][ MAX_HELI_SCRIPT ] =
|
|
{
|
|
// HELI_APPROACH
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_GOTO_MOVETO,
|
|
|
|
// MOVE TO
|
|
HELI_SHOW_HELI,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_MOVEY,
|
|
HELI_GOTO_BEGINDROP,
|
|
|
|
// HELI_BEGIN_DROP
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_MOVE_DOWN,
|
|
HELI_GOTO_DROP,
|
|
|
|
// Heli Begin Drop
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
HELI_MOVESMALL_UP,
|
|
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_MOVESMALL_DOWN,
|
|
HELI_GOTO_DROP,
|
|
|
|
// HELI END DROP
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_MOVE_UP,
|
|
HELI_GOTO_MOVEAWAY,
|
|
|
|
// MOVE AWAY
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_MOVELARGERY,
|
|
HELI_GOTO_EXIT,
|
|
|
|
// HELI EXIT
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_REST,
|
|
HELI_DONE,
|
|
};
|
|
|
|
|
|
BOOLEAN gfHandleHeli = FALSE;
|
|
UINT8 gusHeliSeats[ MAX_MERC_IN_HELI ];
|
|
INT8 gbNumHeliSeatsOccupied = 0;
|
|
|
|
BOOLEAN gfFirstGuyDown = FALSE;
|
|
|
|
UINT32 uiSoundSample;
|
|
INT32 gsGridNoSweetSpot;
|
|
INT16 gsHeliXPos;
|
|
INT16 gsHeliYPos;
|
|
FLOAT gdHeliZPos;
|
|
INT16 gsHeliScript;
|
|
UINT8 gubHeliState;
|
|
UINT32 guiHeliLastUpdate;
|
|
INT8 gbCurDrop;
|
|
INT8 gbExitCount;
|
|
INT8 gbHeliRound;
|
|
|
|
BOOLEAN fFadingHeliIn = FALSE;
|
|
BOOLEAN fFadingHeliOut = FALSE;
|
|
|
|
BOOLEAN gfIngagedInDrop = FALSE;
|
|
|
|
ANITILE *gpHeli;
|
|
BOOLEAN gfFirstHeliRun;
|
|
|
|
|
|
void HandleFirstHeliDropOfGame( );
|
|
|
|
|
|
|
|
|
|
|
|
void ResetHeliSeats( )
|
|
{
|
|
gbNumHeliSeatsOccupied = 0;
|
|
}
|
|
|
|
void AddMercToHeli( UINT8 ubID )
|
|
{
|
|
INT32 cnt;
|
|
|
|
if ( gbNumHeliSeatsOccupied < MAX_MERC_IN_HELI )
|
|
{
|
|
// Check if it already exists!
|
|
for ( cnt = 0; cnt < gbNumHeliSeatsOccupied; cnt++ )
|
|
{
|
|
if ( gusHeliSeats[ cnt ] == ubID )
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
gusHeliSeats[ gbNumHeliSeatsOccupied ] = ubID;
|
|
gbNumHeliSeatsOccupied++;
|
|
}
|
|
}
|
|
|
|
|
|
void StartHelicopterRun( INT32 sGridNoSweetSpot )
|
|
{
|
|
INT16 sX, sY;
|
|
|
|
gsGridNoSweetSpot = sGridNoSweetSpot;
|
|
|
|
if ( gbNumHeliSeatsOccupied == 0 )
|
|
{
|
|
return;
|
|
}
|
|
|
|
InterruptTime();
|
|
PauseGame();
|
|
LockPauseState( 20 );
|
|
|
|
ConvertGridNoToCenterCellXY( sGridNoSweetSpot, &sX, &sY );
|
|
|
|
gsHeliXPos = sX - ( 2 * CELL_X_SIZE );
|
|
gsHeliYPos = sY - ( 10 * CELL_Y_SIZE );
|
|
//gsHeliXPos = sX - ( 3 * CELL_X_SIZE );
|
|
//gsHeliYPos = sY + ( 4 * CELL_Y_SIZE );
|
|
gdHeliZPos = 0;
|
|
gsHeliScript = 0;
|
|
gbCurDrop = 0;
|
|
gbExitCount = 0;
|
|
gbHeliRound = 1;
|
|
|
|
gubHeliState = HELI_APPROACH;
|
|
guiHeliLastUpdate = GetJA2Clock( );
|
|
|
|
// Start sound
|
|
uiSoundSample = PlayJA2Sample( HELI_1, RATE_11025, 0, 10000, MIDDLEPAN );
|
|
fFadingHeliIn = TRUE;
|
|
|
|
gfHandleHeli = TRUE;
|
|
|
|
gfFirstGuyDown = TRUE;
|
|
|
|
guiPendingOverrideEvent = LU_BEGINUILOCK;
|
|
}
|
|
|
|
|
|
void HandleHeliDrop( )
|
|
{
|
|
UINT8 ubScriptCode;
|
|
UINT32 uiClock;
|
|
//INT16 sWorldX, sWorldY;
|
|
INT32 iVol;
|
|
INT32 cnt;
|
|
ANITILE_PARAMS AniParams;
|
|
|
|
|
|
if ( gfHandleHeli )
|
|
{
|
|
if ( gCurrentUIMode != LOCKUI_MODE )
|
|
{
|
|
guiPendingOverrideEvent = LU_BEGINUILOCK;
|
|
}
|
|
|
|
if ( _KeyDown( ESC ) )
|
|
{
|
|
// Loop through all mercs not yet placed
|
|
for ( cnt = gbCurDrop; cnt < gbNumHeliSeatsOccupied; cnt++ )
|
|
{
|
|
// Add merc to sector
|
|
#ifdef JA2UB
|
|
//MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
|
MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
|
MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO;
|
|
#else
|
|
//MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
|
MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
|
MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation;
|
|
#endif
|
|
// HEADROCK HAM 3.5: Externalized!
|
|
UpdateMercInSector( MercPtrs[ gusHeliSeats[ cnt ] ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ );
|
|
|
|
// Check for merc arrives quotes...
|
|
HandleMercArrivesQuotes( MercPtrs[ gusHeliSeats[ cnt ] ] );
|
|
|
|
ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ cnt ] ]->name );
|
|
|
|
}
|
|
|
|
// Remove heli
|
|
DeleteAniTile( gpHeli );
|
|
|
|
RebuildCurrentSquad( );
|
|
|
|
// Remove sound
|
|
if( uiSoundSample!=NO_SAMPLE )
|
|
{
|
|
SoundStop( uiSoundSample );
|
|
}
|
|
|
|
gfHandleHeli = FALSE;
|
|
gfIgnoreScrolling = FALSE;
|
|
gbNumHeliSeatsOccupied = 0;
|
|
UnLockPauseState();
|
|
UnPauseGame();
|
|
|
|
|
|
// Select our first guy
|
|
SelectSoldier( gusHeliSeats[ 0 ], FALSE, TRUE );
|
|
|
|
//guiCurrentEvent = LU_ENDUILOCK;
|
|
//gCurrentUIMode = LOCKUI_MODE;
|
|
guiPendingOverrideEvent = LU_ENDUILOCK;
|
|
//UIHandleLUIEndLock( NULL );
|
|
|
|
HandleFirstHeliDropOfGame( );
|
|
return;
|
|
|
|
}
|
|
|
|
gfIgnoreScrolling = TRUE;
|
|
|
|
uiClock = GetJA2Clock( );
|
|
|
|
if ( ( uiClock - guiHeliLastUpdate ) > ME_SCRIPT_DELAY )
|
|
{
|
|
guiHeliLastUpdate = uiClock;
|
|
|
|
if(fFadingHeliIn)
|
|
{
|
|
if( uiSoundSample!=NO_SAMPLE )
|
|
{
|
|
iVol=SoundGetVolume( uiSoundSample );
|
|
iVol=__min( HIGHVOLUME, iVol+5);
|
|
SoundSetVolume(uiSoundSample, iVol);
|
|
if(iVol==HIGHVOLUME)
|
|
fFadingHeliIn=FALSE;
|
|
}
|
|
else
|
|
{
|
|
fFadingHeliIn=FALSE;
|
|
}
|
|
}
|
|
else if(fFadingHeliOut)
|
|
{
|
|
if( uiSoundSample!=NO_SAMPLE )
|
|
{
|
|
iVol=SoundGetVolume(uiSoundSample);
|
|
|
|
iVol=__max( 0, iVol-5);
|
|
|
|
SoundSetVolume(uiSoundSample, iVol);
|
|
if(iVol==0)
|
|
{
|
|
// Stop sound
|
|
SoundStop( uiSoundSample );
|
|
fFadingHeliOut=FALSE;
|
|
gfHandleHeli = FALSE;
|
|
gfIgnoreScrolling = FALSE;
|
|
gbNumHeliSeatsOccupied = 0;
|
|
guiPendingOverrideEvent = LU_ENDUILOCK;
|
|
UnLockPauseState();
|
|
UnPauseGame();
|
|
|
|
RebuildCurrentSquad( );
|
|
|
|
HandleFirstHeliDropOfGame( );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
fFadingHeliOut=FALSE;
|
|
gfHandleHeli = FALSE;
|
|
gfIgnoreScrolling = FALSE;
|
|
gbNumHeliSeatsOccupied = 0;
|
|
guiPendingOverrideEvent = LU_ENDUILOCK;
|
|
UnLockPauseState();
|
|
UnPauseGame();
|
|
|
|
RebuildCurrentSquad( );
|
|
|
|
HandleFirstHeliDropOfGame( );
|
|
}
|
|
}
|
|
|
|
if ( gsHeliScript == MAX_HELI_SCRIPT )
|
|
{
|
|
return;
|
|
}
|
|
|
|
ubScriptCode = ubHeliScripts[ gubHeliState ][ gsHeliScript ];
|
|
|
|
// Switch on mode...
|
|
if ( gubHeliState == HELI_DROP )
|
|
{
|
|
if ( !gfIngagedInDrop )
|
|
{
|
|
INT8 bEndVal;
|
|
|
|
bEndVal = ( gbHeliRound * NUM_PER_HELI_RUN );
|
|
|
|
if ( bEndVal > gbNumHeliSeatsOccupied )
|
|
{
|
|
bEndVal = gbNumHeliSeatsOccupied;
|
|
}
|
|
|
|
// OK, Check if we have anybody left to send!
|
|
if ( gbCurDrop < bEndVal )
|
|
{
|
|
//sWorldX = CenterX( gsGridNoSweetSpot );
|
|
//sWorldY = CenterY( gsGridNoSweetSpot );
|
|
MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->EVENT_InitNewSoldierAnim( HELIDROP, 0 , FALSE );
|
|
|
|
// Change insertion code
|
|
#ifdef JA2UB
|
|
//MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
|
MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
|
MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO;
|
|
#else
|
|
//MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH;
|
|
MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO;
|
|
MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation;
|
|
#endif
|
|
// HEADROCK HAM 3.5: Externalized!
|
|
UpdateMercInSector( MercPtrs[ gusHeliSeats[ gbCurDrop ] ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ );
|
|
//EVENT_SetSoldierPosition( MercPtrs[ gusHeliSeats[ gbCurDrop ] ], sWorldX, sWorldY );
|
|
|
|
// IF the first guy down, set squad!
|
|
if ( gfFirstGuyDown )
|
|
{
|
|
gfFirstGuyDown = FALSE;
|
|
SetCurrentSquad( MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->bAssignment, TRUE );
|
|
}
|
|
ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->name );
|
|
|
|
gbCurDrop++;
|
|
|
|
gfIngagedInDrop = TRUE;
|
|
}
|
|
else
|
|
{
|
|
if( gbExitCount == 0 )
|
|
{
|
|
gbExitCount = 2;
|
|
}
|
|
else
|
|
{
|
|
gbExitCount--;
|
|
|
|
if ( gbExitCount == 1 )
|
|
{
|
|
// Goto leave
|
|
gsHeliScript = -1;
|
|
gubHeliState = HELI_ENDDROP;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
switch( ubScriptCode )
|
|
{
|
|
case HELI_REST:
|
|
|
|
break;
|
|
|
|
case HELI_MOVE_DOWN:
|
|
|
|
gdHeliZPos -= 1;
|
|
gpHeli->pLevelNode->sRelativeZ = ( INT16 )gdHeliZPos;
|
|
break;
|
|
|
|
case HELI_MOVE_UP:
|
|
|
|
gdHeliZPos += 1;
|
|
gpHeli->pLevelNode->sRelativeZ = ( INT16 )gdHeliZPos;
|
|
break;
|
|
|
|
case HELI_MOVESMALL_DOWN:
|
|
|
|
gdHeliZPos -= 0.25;
|
|
gpHeli->pLevelNode->sRelativeZ = ( INT16 )gdHeliZPos;
|
|
break;
|
|
|
|
case HELI_MOVESMALL_UP:
|
|
|
|
gdHeliZPos += 0.25;
|
|
gpHeli->pLevelNode->sRelativeZ = ( INT16 )gdHeliZPos;
|
|
break;
|
|
|
|
|
|
case HELI_MOVEY:
|
|
|
|
gpHeli->sRelativeY += 4;
|
|
break;
|
|
|
|
case HELI_MOVELARGERY:
|
|
|
|
gpHeli->sRelativeY += 6;
|
|
break;
|
|
|
|
case HELI_GOTO_BEGINDROP:
|
|
|
|
gsHeliScript = -1;
|
|
gubHeliState = HELI_BEGINDROP;
|
|
break;
|
|
|
|
case HELI_SHOW_HELI:
|
|
|
|
// Start animation
|
|
memset( &AniParams, 0, sizeof( ANITILE_PARAMS ) );
|
|
AniParams.sGridNo = gsGridNoSweetSpot;
|
|
AniParams.ubLevelID = ANI_SHADOW_LEVEL;
|
|
AniParams.sDelay = 90;
|
|
AniParams.sStartFrame = 0;
|
|
AniParams.uiFlags = ANITILE_CACHEDTILE | ANITILE_FORWARD | ANITILE_LOOPING;
|
|
AniParams.sX = gsHeliXPos;
|
|
AniParams.sY = gsHeliYPos;
|
|
AniParams.sZ = (INT16)gdHeliZPos;
|
|
strcpy( AniParams.zCachedFile, "TILECACHE\\HELI_SH.STI" );
|
|
|
|
gpHeli = CreateAnimationTile( &AniParams );
|
|
break;
|
|
|
|
case HELI_GOTO_DROP:
|
|
|
|
// Goto drop animation
|
|
gdHeliZPos -= 0.25;
|
|
gpHeli->pLevelNode->sRelativeZ = ( INT16 )gdHeliZPos;
|
|
gsHeliScript = -1;
|
|
gubHeliState = HELI_DROP;
|
|
break;
|
|
|
|
case HELI_GOTO_MOVETO:
|
|
|
|
// Goto drop animation
|
|
gsHeliScript = -1;
|
|
gubHeliState = HELI_MOVETO;
|
|
break;
|
|
|
|
case HELI_GOTO_MOVEAWAY:
|
|
|
|
// Goto drop animation
|
|
gsHeliScript = -1;
|
|
gubHeliState = HELI_MOVEAWAY;
|
|
break;
|
|
|
|
case HELI_GOTO_EXIT:
|
|
|
|
if ( gbCurDrop < gbNumHeliSeatsOccupied )
|
|
{
|
|
// Start another run......
|
|
INT16 sX, sY;
|
|
|
|
ConvertGridNoToCenterCellXY( gsGridNoSweetSpot, &sX, &sY );
|
|
|
|
gsHeliXPos = sX - ( 2 * CELL_X_SIZE );
|
|
gsHeliYPos = sY - ( 10 * CELL_Y_SIZE );
|
|
gdHeliZPos = 0;
|
|
gsHeliScript = 0;
|
|
gbExitCount = 0;
|
|
gubHeliState = HELI_APPROACH;
|
|
gbHeliRound++;
|
|
|
|
// Ahh, but still delete the heli!
|
|
DeleteAniTile( gpHeli );
|
|
gpHeli = NULL;
|
|
}
|
|
else
|
|
{
|
|
// Goto drop animation
|
|
gsHeliScript = -1;
|
|
gubHeliState = HELI_EXIT;
|
|
|
|
// Delete helicopter image!
|
|
DeleteAniTile( gpHeli );
|
|
gpHeli = NULL;
|
|
gfIgnoreScrolling = FALSE;
|
|
|
|
// Select our first guy
|
|
SelectSoldier( gusHeliSeats[ 0 ], FALSE, TRUE );
|
|
}
|
|
break;
|
|
|
|
case HELI_DONE:
|
|
|
|
// End
|
|
fFadingHeliOut = TRUE;
|
|
|
|
// HEADROCK HAM 3.5: Update now, in case the LZ is still in a "RED" airspace sector. This is only
|
|
// required if the sector is free of enemies... but still required. Will run immediately after the
|
|
// helicopter is gone.
|
|
UpdateAirspaceControl( );
|
|
break;
|
|
}
|
|
|
|
gsHeliScript++;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void BeginMercEntering( SOLDIERTYPE *pSoldier, INT32 sGridNo )
|
|
{
|
|
ResetHeliSeats( );
|
|
|
|
AddMercToHeli( pSoldier->ubID );
|
|
|
|
|
|
StartHelicopterRun( sGridNo );
|
|
|
|
// Make sure AI does nothing.....
|
|
PauseAIUntilManuallyUnpaused();
|
|
}
|
|
|
|
|
|
void HandleFirstHeliDropOfGame( )
|
|
{
|
|
// Are we in the first heli drop?
|
|
if ( gfFirstHeliRun )
|
|
{
|
|
SyncStrategicTurnTimes();
|
|
|
|
// Call people to area
|
|
CallAvailableEnemiesTo( gsGridNoSweetSpot );
|
|
|
|
// Move to header file...
|
|
// HEADROCK HAM 3.5: Externalized!
|
|
AddExtraItems( (UINT8)gGameExternalOptions.ubDefaultArrivalSectorX, (UINT8)gGameExternalOptions.ubDefaultArrivalSectorY, startingZ, true );
|
|
|
|
// HEADROCK HAM 3.5: Starting sector externalized - might not contain enemies at all!
|
|
if (NumEnemyInSector( ) > 0)
|
|
//if ( NumEnemiesInAnySector( gWorldSectorX, gWorldSectorY, 0 ) > 0 )
|
|
{
|
|
// Say quote.....
|
|
SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE );
|
|
// Start music
|
|
SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT );
|
|
}
|
|
else
|
|
{
|
|
// Say quote.....
|
|
SayQuoteFromAnyBodyInSector( QUOTE_MERC_REACHED_DESTINATION );
|
|
// Start music
|
|
SetMusicMode( MUSIC_TACTICAL_NOTHING );
|
|
}
|
|
|
|
gfFirstHeliRun = FALSE;
|
|
|
|
}
|
|
|
|
// Send message to turn on ai again....
|
|
CharacterDialogueWithSpecialEvent( 0, 0, 0, DIALOGUE_TACTICAL_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_ENABLE_AI ,0, 0 );
|
|
|
|
}
|
|
|
|
|
|
|