Minor cleanup. Got rid of some extra files and some comments.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@84 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
MaddMugsy
2006-05-25 15:54:16 +00:00
parent 0070e55b0b
commit 913341b610
6 changed files with 6 additions and 7499 deletions
-2
View File
@@ -178,8 +178,6 @@ typedef struct
INT8 iInsaneAPBonus;
// Moved from NewGameSettings.cpp
// System settings
UINT8 gubDeadLockDelay;
BOOLEAN gfEnableEmergencyButton_SkipStrategicEvents;
@@ -2760,6 +2760,9 @@
<File
RelativePath="font.h">
</File>
<File
RelativePath="gameloop.h">
</File>
<File
RelativePath="himage.h">
</File>
@@ -2877,6 +2880,9 @@
<File
RelativePath="WCheck.h">
</File>
<File
RelativePath="Winbart97.h">
</File>
<File
RelativePath="WinFont.h">
</File>
File diff suppressed because it is too large Load Diff
-606
View File
@@ -1,606 +0,0 @@
#ifndef MAP_SCREEN_INTERFACE_H
#define MAP_SCREEN_INTERFACE_H
#include "Types.h"
#include "Soldier Control.h"
#include "MessageBoxScreen.h"
typedef struct FASTHELPREGION {
// the string
CHAR16 FastHelpText[ 256 ];
// the x and y position values
INT32 iX;
INT32 iY;
INT32 iW;
} FASTHELPREGION;
// String Lengths Defines
#define MAX_NAME_LENGTH 10
#define MAX_LOCATION_SIZE 8
#define MAX_DESTETA_SIZE 8
#define MAX_ASSIGN_SIZE 10
#define MAX_TIME_REMAINING_SIZE 8
// char breath and life position
#define BAR_INFO_X 66
#define BAR_INFO_Y 61
// merc icon position
#define CHAR_ICON_CONTRACT_Y 64
#define CHAR_ICON_X 187
#define CHAR_ICON_WIDTH 10
#define CHAR_ICON_HEIGHT 10
#define CHAR_ICON_SPACING 13
// max number of characters and vehicles
//Character List Length
#define MAX_CHARACTER_COUNT 20
#define MAX_VEHICLE_COUNT 20
// map screen font
#define MAP_SCREEN_FONT BLOCKFONT2
// characterlist regions
#define Y_START 135 //146
#define MAP_START_KEYRING_Y 107
#define Y_SIZE GetFontHeight(MAP_SCREEN_FONT)
// attribute menu defines (must match NUM_TRAINABLE_STATS defines, and pAttributeMenuStrings )
enum {
ATTRIB_MENU_STR=0,
ATTRIB_MENU_DEX,
ATTRIB_MENU_AGI,
ATTRIB_MENU_HEA,
ATTRIB_MENU_MARK,
ATTRIB_MENU_MED,
ATTRIB_MENU_MECH,
ATTRIB_MENU_LEAD,
ATTRIB_MENU_EXPLOS,
ATTRIB_MENU_CANCEL,
MAX_ATTRIBUTE_STRING_COUNT,
};
// the epc assignment menu
enum{
EPC_MENU_ON_DUTY = 0,
EPC_MENU_PATIENT,
EPC_MENU_VEHICLE,
EPC_MENU_REMOVE,
EPC_MENU_CANCEL,
MAX_EPC_MENU_STRING_COUNT,
};
// assignment menu defines
enum {
ASSIGN_MENU_ON_DUTY=0,
ASSIGN_MENU_DOCTOR,
ASSIGN_MENU_PATIENT,
ASSIGN_MENU_VEHICLE,
ASSIGN_MENU_REPAIR,
ASSIGN_MENU_TRAIN,
ASSIGN_MENU_CANCEL,
MAX_ASSIGN_STRING_COUNT,
};
// training assignment menu defines
enum {
TRAIN_MENU_SELF,
TRAIN_MENU_TOWN,
TRAIN_MENU_TEAMMATES,
TRAIN_MENU_TRAIN_BY_OTHER,
TRAIN_MENU_CANCEL,
MAX_TRAIN_STRING_COUNT,
};
// the remove merc from team pop up box strings
enum{
REMOVE_MERC = 0,
REMOVE_MERC_CANCEL,
MAX_REMOVE_MERC_COUNT,
};
// squad menu defines
enum{
SQUAD_MENU_1,
SQUAD_MENU_2,
SQUAD_MENU_3,
SQUAD_MENU_4,
SQUAD_MENU_5,
SQUAD_MENU_6,
SQUAD_MENU_7,
SQUAD_MENU_8,
SQUAD_MENU_9,
SQUAD_MENU_10,
SQUAD_MENU_11,
SQUAD_MENU_12,
SQUAD_MENU_13,
SQUAD_MENU_14,
SQUAD_MENU_15,
SQUAD_MENU_16,
SQUAD_MENU_17,
SQUAD_MENU_18,
SQUAD_MENU_19,
SQUAD_MENU_20,
SQUAD_MENU_CANCEL,
MAX_SQUAD_MENU_STRING_COUNT,
};
// contract menu defines
enum{
CONTRACT_MENU_CURRENT_FUNDS = 0,
CONTRACT_MENU_SPACE,
CONTRACT_MENU_DAY,
CONTRACT_MENU_WEEK,
CONTRACT_MENU_TWO_WEEKS,
CONTRACT_MENU_TERMINATE,
CONTRACT_MENU_CANCEL,
MAX_CONTRACT_MENU_STRING_COUNT,
};
// enums for pre battle interface pop ups
enum
{
ASSIGNMENT_POPUP,
DESTINATION_POPUP,
CONTRACT_POPUP
};
enum{
NO_REASON_FOR_UPDATE = 0,
CONTRACT_FINISHED_FOR_UPDATE,
ASSIGNMENT_FINISHED_FOR_UPDATE,
ASSIGNMENT_RETURNING_FOR_UPDATE,
ASLEEP_GOING_AUTO_FOR_UPDATE,
CONTRACT_EXPIRE_WARNING_REASON,
};
enum{
START_RED_SECTOR_LOCATOR = 0,
STOP_RED_SECTOR_LOCATOR,
START_YELLOW_SECTOR_LOCATOR,
STOP_YELLOW_SECTOR_LOCATOR,
};
// dimensions and offset for merc update box
#define UPDATE_MERC_FACE_X_WIDTH 50
#define UPDATE_MERC_FACE_X_HEIGHT 50
#define UPDATE_MERC_FACE_X_OFFSET 2
#define UPDATE_MERC_FACE_Y_OFFSET 2
#define WIDTH_OF_UPDATE_PANEL_BLOCKS 50
#define HEIGHT_OF_UPDATE_PANEL_BLOCKS 50
#define UPDATE_MERC_Y_OFFSET 4
#define UPDATE_MERC_X_OFFSET 4
// dimensions and offset for merc update box
#define TACT_UPDATE_MERC_FACE_X_WIDTH 70
#define TACT_UPDATE_MERC_FACE_X_HEIGHT 49
#define TACT_UPDATE_MERC_FACE_X_OFFSET 8
#define TACT_UPDATE_MERC_FACE_Y_OFFSET 6
#define TACT_WIDTH_OF_UPDATE_PANEL_BLOCKS 70
#define TACT_HEIGHT_OF_UPDATE_PANEL_BLOCKS 49
#define TACT_UPDATE_MERC_Y_OFFSET 4
#define TACT_UPDATE_MERC_X_OFFSET 4
// the first vehicle slot int he list
#define FIRST_VEHICLE 18
typedef struct MERC_LEAVE_ITEM{
OBJECTTYPE o;
struct MERC_LEAVE_ITEM *pNext;
}MERC_LEAVE_ITEM;
extern BOOLEAN fShowAssignmentMenu;
extern BOOLEAN fShowTrainingMenu ;
extern BOOLEAN fShowAttributeMenu;
extern BOOLEAN fShowSquadMenu ;
extern BOOLEAN fShowContractMenu ;
extern BOOLEAN fShowRemoveMenu ;
extern BOOLEAN fFirstTimeInMapScreen;
extern BOOLEAN fLockOutMapScreenInterface;
// The character data structure
typedef struct {
UINT16 usSolID;// soldier ID in MenPtrs
BOOLEAN fValid;// is the current soldier a valid soldier
} MapScreenCharacterSt;
// map screen character structure list, contrains soldier ids into menptr
extern MapScreenCharacterSt gCharactersList[ ];
extern BOOLEAN fShowMapScreenHelpText;
// map inventory pool inited
extern BOOLEAN fMapInventoryPoolInited;
// highlighted lines
extern INT32 giHighLine;
extern INT32 giAssignHighLine;
extern INT32 giDestHighLine;
extern INT32 giContractHighLine;
extern INT32 giSleepHighLine;
extern UINT32 guiUpdatePanel;
extern UINT32 guiUpdatePanelTactical;
extern BOOLEAN fShowUpdateBox;
extern SGPRect ContractDimensions;
extern SGPPoint ContractPosition;
extern SGPRect AttributeDimensions;
extern SGPPoint AttributePosition;
extern SGPRect TrainDimensions;
extern SGPPoint TrainPosition;
extern SGPRect VehicleDimensions;
extern SGPPoint VehiclePosition;
extern SGPRect AssignmentDimensions ;
extern SGPPoint AssignmentPosition ;
extern SGPPoint SquadPosition ;
extern SGPRect SquadDimensions ;
extern SGPPoint RepairPosition;
extern SGPRect RepairDimensions;
extern SGPPoint OrigContractPosition;
extern SGPPoint OrigAttributePosition;
extern SGPPoint OrigSquadPosition ;
extern SGPPoint OrigAssignmentPosition ;
extern SGPPoint OrigTrainPosition;
extern SGPPoint OrigVehiclePosition;
// disble team info panel due to showing of battle roster
extern BOOLEAN fDisableDueToBattleRoster;
extern BOOLEAN gfAtLeastOneMercWasHired;
// curtrent map sector z that is being displayed in the mapscreen
extern INT32 iCurrentMapSectorZ;
// y position of the pop up box
extern INT32 giBoxY;
// pop up box textures
extern UINT32 guiPOPUPTEX;
extern UINT32 guiPOPUPBORDERS;
// the level-changing markers on the map border
extern UINT32 guiLEVELMARKER;
// the currently selected character arrow
extern UINT32 guiSelectedCharArrow;
// sam and mine icons
extern UINT32 guiSAMICON;
extern BOOLEAN fShowMapScreenMovementList;
// do we need to rebuild the mapscreen characterlist?
extern BOOLEAN fReBuildCharacterList;
// restore glow rotation in contract region glow boxes
extern BOOLEAN fResetContractGlow;
// init vehicle and characters list
void InitalizeVehicleAndCharacterList( void );
// set this entry to as selected
void SetEntryInSelectedCharacterList( INT8 bEntry );
// set this entry to as unselected
void ResetEntryForSelectedList( INT8 bEntry );
// reset selected list
void ResetSelectedListForMapScreen( );
// build a selected list from a to b, inclusive
void BuildSelectedListFromAToB( INT8 bA, INT8 bB );
// isa this entry int he selected character list set?
BOOLEAN IsEntryInSelectedListSet( INT8 bEntry );
// is there more than one person selected?
BOOLEAN MultipleCharacterListEntriesSelected( void );
// toggle this entry on or off
void ToggleEntryInSelectedList( INT8 bEntry );
// reset assignments for mercs on selected list who have this assignment
void ResetAssignmentsForMercsTrainingUnpaidSectorsInSelectedList( INT8 bAssignment );
/*
// plot path for selected character list
void PlotPathForSelectedCharacterList( INT16 sX, INT16 sY );
*/
void RestoreBackgroundForAssignmentGlowRegionList( void );
void RestoreBackgroundForDestinationGlowRegionList( void );
void RestoreBackgroundForContractGlowRegionList( void );
void RestoreBackgroundForSleepGlowRegionList( void );
// play click when we are entering a glow region
void PlayGlowRegionSound( void );
// is this character in the action of plotting a path?
INT16 CharacterIsGettingPathPlotted( INT16 sCharNumber );
// disable team info panels
void DisableTeamInfoPanels( void );
// enable team info panels
void EnableTeamInfoPanels( void );
// activate pop up for soldiers in the pre battle interface
void ActivateSoldierPopup( SOLDIERTYPE *pSoldier, UINT8 ubPopupType, INT16 xp, INT16 yp );
// do mapscreen message box
INT32 DoMapMessageBox( UINT8 ubStyle, INT16 * zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
// hop up one leve,l int he map screen level interface
void GoUpOneLevelInMap( void );
// go down one level in the mapscreen map interface
void GoDownOneLevelInMap( void );
// jump to this level on the map
void JumpToLevel( INT32 iLevel );
// check to see if we need to update the screen
void CheckAndUpdateBasedOnContractTimes( void );
// check if are just about to display this pop up or stopping display
void HandleDisplayOfItemPopUpForSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ );
// display red arrow by name of selected merc
void HandleDisplayOfSelectedMercArrows( void );
// check which guys can move with this guy
void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier );
// get morale string for this grunt given this morale level
void GetMoraleString( SOLDIERTYPE *pSoldier, STR16 sString );
// handle leaving of equipment in sector
void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId );
// set up a linked list of items being dropped and post an event to later drop them
void HandleMercLeavingEquipmentInDrassen( UINT32 uiMercId );
void HandleMercLeavingEquipmentInOmerta( UINT32 uiMercId );
// actually drop the stored list of items
void HandleEquipmentLeftInOmerta( UINT32 uiSlotIndex );
void HandleEquipmentLeftInDrassen( UINT32 uiSlotIndex );
// init/shutdown leave item lists
void InitLeaveList( void );
void ShutDownLeaveList( void );
// add item to leave equip index
BOOLEAN AddItemToLeaveIndex( OBJECTTYPE *o, UINT32 uiIndex );
// release memory for all items in this slot's leave item list
void FreeLeaveListSlot( UINT32 uiSlotIndex );
// first free slot in equip leave list
INT32 FindFreeSlotInLeaveList( void );
// set up drop list
INT32 SetUpDropItemListForMerc( UINT32 uiMercId );
// store owner's profile id for the items added to this leave slot index
void SetUpMercAboutToLeaveEquipment( UINT32 ubProfileId, UINT32 uiSlotIndex );
// remove item from leave index
//BOOLEAN RemoveItemFromLeaveIndex( MERC_LEAVE_ITEM *pItem, UINT32 uiIndex );
// handle a group about to arrive in a sector
void HandleGroupAboutToArrive( void );
// up arrow
void HandleMapScreenUpArrow( void );
void HandleMapScreenDownArrow( void );
// create and destroy the status bars mouse region
void CreateMapStatusBarsRegion( void );
void RemoveMapStatusBarsRegion( void );
void UpdateCharRegionHelpText( void );
// find this soldier in mapscreen character list and set as contract
void FindAndSetThisContractSoldier( SOLDIERTYPE *pSoldier );
// lose the cursor, re-render
void HandleMAPUILoseCursorFromOtherScreen( void );
void RenderMapRegionBackground( void );
// update mapscreen assignment positions
void UpdateMapScreenAssignmentPositions( void );
// get the umber of valid mercs in the mapscreen character list
INT32 GetNumberOfPeopleInCharacterList( void );
// the next and previous people in the mapscreen
void GoToPrevCharacterInList( void );
void GoToNextCharacterInList( void );
// this does the whole miner giving player info speil
void HandleMinerEvent( UINT8 bMinerNumber, INT16 sSectorX, INT16 sSectorY, INT16 sQuoteNumber, BOOLEAN fForceMapscreen );
// set up the event of animating a mine sector
void SetUpAnimationOfMineSectors( INT32 iEvent );
// display map screen
void DisplayMapScreenFastHelpList( void );
// handle display of fast help
void HandleDisplayOfExitToTacticalMessageForFirstEntryToMapScreen( void );
// is the text up?
BOOLEAN IsMapScreenHelpTextUp( void );
// stop the help text in mapscreen
void StopMapScreenHelpText( void );
// set up the help text
void SetUpMapScreenFastHelpText( void );
void TurnOnSectorLocator( UINT8 ubProfileID );
void TurnOffSectorLocator();
extern INT16 gsSectorLocatorX;
extern INT16 gsSectorLocatorY;
extern UINT8 gubBlitSectorLocatorCode;
enum
{
LOCATOR_COLOR_NONE,
LOCATOR_COLOR_RED,
LOCATOR_COLOR_YELLOW
};
extern UINT32 guiSectorLocatorGraphicID;
void HandleBlitOfSectorLocatorIcon( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, UINT8 ubLocatorID );
// the tactical version
// handle the actual showingof the list
void HandleShowingOfTacticalInterfaceFastHelpText( void );
// start showing the list
void StartShowingInterfaceFastHelpText( void );
// stop showing the list
void StopShowingInterfaceFastHelpText( void );
// is the list active?
BOOLEAN IsTheInterfaceFastHelpTextActive( void );
//set up the tactical lists
BOOLEAN SetUpFastHelpListRegions( INT32 iXPosition[], INT32 iYPosition[], INT32 iWidth[], STR16 sString[], INT32 iSize );
// the alternate mapscreen movement system
void InitializeMovingLists( void );
// reset assignment for mercs trainign militia in this sector
void ResetAssignmentOfMercsThatWereTrainingMilitiaInThisSector( INT16 sSectorX, INT16 sSectorY );
// the sector move box
void DeselectSquadForMovement( INT32 iSquadNumber );
void SelectedSquadForMovement( INT32 iSquadNumber );
void DeselectSoldierForMovement( SOLDIERTYPE *pSoldier );
void SelectSoldierForMovement( SOLDIERTYPE *pSoldier );
void SelectVehicleForMovement( INT32 iVehicleId, BOOLEAN fAndAllOnBoard );
void DeselectVehicleForMovement( INT32 iVehicleId );
void AddVehicleToMovingLists( INT32 iVehicleId );
void AddSquadToMovingLists( INT32 iSquadNumber );
void AddSoldierToMovingLists( SOLDIERTYPE *pSoldier );
void CreateDestroyMovementBox( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ );
void SetUpMovingListsForSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ );
void ReBuildMoveBox( void );
BOOLEAN IsCharacterSelectedForAssignment( INT16 sCharNumber );
BOOLEAN IsCharacterSelectedForSleep( INT16 sCharNumber );
// the update box
void CreateDestroyTheUpdateBox( void );
void SetSoldierUpdateBoxReason( INT32 iReason );
void AddSoldierToUpdateBox( SOLDIERTYPE *pSoldier );
void ResetSoldierUpdateBox( void );
void DisplaySoldierUpdateBox( );
BOOLEAN IsThePopUpBoxEmpty( void );
// unmarking buttons dirty for dialogue
void UpdateButtonsDuringCharacterDialogue( void );
void UpdateButtonsDuringCharacterDialogueSubTitles( void );
void SetUpdateBoxFlag( BOOLEAN fFlag );
/// set the town of Tixa as found by the player
void SetTixaAsFound( void );
// set the town of Orta as found by the player
void SetOrtaAsFound( void );
// set this SAM site as being found by the player
void SetSAMSiteAsFound( UINT8 uiSamIndex );
// init time menus
void InitTimersForMoveMenuMouseRegions( void );
// the screen mask
void CreateScreenMaskForMoveBox( void );
void RemoveScreenMaskForMoveBox( void );
// help text to show user merc has insurance
void UpdateHelpTextForMapScreenMercIcons( void );
void CreateDestroyInsuranceMouseRegionForMercs( BOOLEAN fCreate );
// stuff to deal with player just starting the game
BOOLEAN HandleTimeCompressWithTeamJackedInAndGearedToGo( void );
//void HandlePlayerEnteringMapScreenBeforeGoingToTactical( void );
// handle sector being taken over uncontested
BOOLEAN NotifyPlayerWhenEnemyTakesControlOfImportantSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fContested );
// handle notifying player of invasion by enemy
void NotifyPlayerOfInvasionByEnemyForces( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, MSGBOX_CALLBACK ReturnCallback );
void ShutDownUserDefineHelpTextRegions( void );
// shwo the update box
void ShowUpdateBox( void );
// add special events
void AddSoldierToWaitingListQueue( SOLDIERTYPE *pSoldier );
void AddReasonToWaitingListQueue( INT32 iReason );
void AddDisplayBoxToWaitingQueue( void );
// can this group move it out
BOOLEAN CanEntireMovementGroupMercIsInMove( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber );
void ReportMapScreenMovementError( INT8 bErrorNumber );
void HandleRebuildingOfMapScreenCharacterList( void );
void RequestToggleTimeCompression( void );
void RequestIncreaseInTimeCompression( void );
void RequestDecreaseInTimeCompression( void );
void SelectUnselectedMercsWhoMustMoveWithThisGuy( void );
BOOLEAN AnyMercInSameSquadOrVehicleIsSelected( SOLDIERTYPE *pSoldier );
BOOLEAN LoadLeaveItemList( HWFILE hFile );
BOOLEAN SaveLeaveItemList( HWFILE hFile );
BOOLEAN CheckIfSalaryIncreasedAndSayQuote( SOLDIERTYPE *pSoldier, BOOLEAN fTriggerContractMenu );
void EndUpdateBox( BOOLEAN fContinueTimeCompression );
extern BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber );
extern BOOLEAN MapscreenCanPassItemToCharNum( INT32 iNewCharSlot );
#endif
-406
View File
@@ -1,406 +0,0 @@
#ifdef PRECOMPILEDHEADERS
#include "Tactical All.h"
#else
#include "sgp.h"
#include "overhead types.h"
#include "Sound Control.h"
#include "Soldier Control.h"
#include "overhead.h"
#include "Event Pump.h"
#include "weapons.h"
#include "Animation Control.h"
#include "sys globals.h"
#include "Handle UI.h"
#include "Isometric Utils.h"
#include "worldman.h"
#include "math.h"
#include "points.h"
#include "ai.h"
#include "los.h"
#include "renderworld.h"
#include "opplist.h"
#include "interface.h"
#include "message.h"
#include "campaign.h"
#include "items.h"
#include "text.h"
#include "Soldier Profile.h"
#include "tile animation.h"
#include "Dialogue Control.h"
#include "SkillCheck.h"
#include "explosion control.h"
#include "Quests.h"
#include "Physics.h"
#include "Random.h"
#include "Vehicles.h"
#include "bullets.h"
#include "morale.h"
#include "meanwhile.h"
#include "SkillCheck.h"
#include "gamesettings.h"
#include "SaveLoadMap.h"
#include "Debug Control.h"
#include "expat.h"
#include "XML.h"
#endif
struct
{
PARSE_STAGE curElement;
INT8 szCharData[MAX_CHAR_DATA_LENGTH+1];
UINT32 maxArraySize;
UINT32 curIndex;
UINT32 currentDepth;
UINT32 maxReadDepth;
}
typedef ammoParseData;
static void XMLCALL
ammoStartElementHandle(void *userData, const char *name, const char **atts)
{
ammoParseData * pData = (ammoParseData *)userData;
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
{
if(strcmp(name, "AMMOLIST") == 0 && pData->curElement == ELEMENT_NONE)
{
pData->curElement = ELEMENT_LIST;
pData->maxReadDepth++; //we are not skipping this element
}
else if(strcmp(name, "AMMO") == 0 && pData->curElement == ELEMENT_LIST)
{
pData->curElement = ELEMENT;
pData->maxReadDepth++; //we are not skipping this element
pData->curIndex++;
}
else if(pData->curElement == ELEMENT &&
(strcmp(name, "AmmoCaliber") == 0 ||
strcmp(name, "BRCaliber") == 0 ||
strcmp(name, "BurstSound") == 0 ))
{
pData->curElement = ELEMENT_PROPERTY;
pData->maxReadDepth++; //we are not skipping this element
}
pData->szCharData[0] = '\0';
}
pData->currentDepth++;
}
static void XMLCALL
ammoCharacterDataHandle(void *userData, const char *str, int len)
{
ammoParseData * pData = (ammoParseData *)userData;
if( (pData->currentDepth <= pData->maxReadDepth) &&
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
){
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
}
}
static void XMLCALL
ammoEndElementHandle(void *userData, const char *name)
{
char temp;
ammoParseData * pData = (ammoParseData *)userData;
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
{
if(strcmp(name, "AMMOLIST") == 0)
{
pData->curElement = ELEMENT_NONE;
}
else if(strcmp(name, "AMMO") == 0)
{
pData->curElement = ELEMENT_LIST;
}
else if(strcmp(name, "AmmoCaliber") == 0)
{
pData->curElement = ELEMENT;
if(pData->curIndex < pData->maxArraySize)
{
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
{
temp = pData->szCharData[i];
AmmoCaliber[pData->curIndex][i] = temp;
}
}
}
else if(strcmp(name, "BRCaliber") == 0)
{
pData->curElement = ELEMENT;
if(pData->curIndex < pData->maxArraySize)
{
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
{
temp = pData->szCharData[i];
BobbyRayAmmoCaliber[pData->curIndex][i] = temp;
}
}
}
else if(strcmp(name, "BurstSound") == 0)
{
pData->curElement = ELEMENT;
if(pData->curIndex < pData->maxArraySize)
{
for(int i=0;i<min((int)strlen(pData->szCharData),MAX_CHAR_DATA_LENGTH);i++)
{
temp = pData->szCharData[i];
gzBurstSndStrings[pData->curIndex][i] = temp;
}
}
}
pData->maxReadDepth--;
}
pData->currentDepth--;
}
BOOLEAN ReadInAmmoStats(STR fileName)
{
HWFILE hFile;
UINT32 uiBytesRead;
UINT32 uiFSize;
CHAR8 * lpcBuffer;
XML_Parser parser = XML_ParserCreate(NULL);
ammoParseData pData;
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, "Loading AmmoStrings.xml" );
// Open ammos file
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
if ( !hFile )
return( FALSE );
uiFSize = FileGetSize(hFile);
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
//Read in block
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
{
MemFree(lpcBuffer);
return( FALSE );
}
lpcBuffer[uiFSize] = 0; //add a null terminator
FileClose( hFile );
XML_SetElementHandler(parser, ammoStartElementHandle, ammoEndElementHandle);
XML_SetCharacterDataHandler(parser, ammoCharacterDataHandle);
memset(&pData,0,sizeof(pData));
pData.maxArraySize = MAXITEMS;
pData.curIndex = -1;
XML_SetUserData(parser, &pData);
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
{
CHAR8 errorBuf[511];
sprintf(errorBuf, "XML Parser Error in AmmoStrings.xml: %s at line %d", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
LiveMessage(errorBuf);
MemFree(lpcBuffer);
return FALSE;
}
MemFree(lpcBuffer);
XML_ParserFree(parser);
return( TRUE );
}
BOOLEAN WriteAmmoStats()
{
HWFILE hFile;
//Debug code; make sure that what we got from the file is the same as what's there
// Open a new file
hFile = FileOpen( "TABLEDATA\\Ammos out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
if ( !hFile )
return( FALSE );
{
UINT32 cnt;
FilePrintf(hFile,"<AMMOLIST>\r\n");
for(cnt = 0;cnt < MAXITEMS;cnt++)
{
FilePrintf(hFile,"\t<AMMO>\r\n");
UINT16 * szRemainder = AmmoCaliber[cnt]; //the remaining string to be output (for making valid XML)
FilePrintf(hFile,"\t\t<AmmoCaliber>");
while(szRemainder[0] != '\0')
{
UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0");
UINT16 invChar = szRemainder[uiCharLoc];
if(uiCharLoc)
{
szRemainder[uiCharLoc] = '\0';
FilePrintf(hFile,"%s",szRemainder);
szRemainder[uiCharLoc] = invChar;
}
szRemainder += uiCharLoc;
switch(invChar)
{
case '&':
FilePrintf(hFile,"&amp;");
szRemainder++;
break;
case '<':
FilePrintf(hFile,"&lt;");
szRemainder++;
break;
case '>':
FilePrintf(hFile,"&gt;");
szRemainder++;
break;
case '\'':
FilePrintf(hFile,"&apos;");
szRemainder++;
break;
case '\"':
FilePrintf(hFile,"&quot;");
szRemainder++;
break;
}
}
FilePrintf(hFile,"</AmmoCaliber>\r\n");
szRemainder = BobbyRayAmmoCaliber[cnt]; //the remaining string to be output (for making valid XML)
FilePrintf(hFile,"\t\t<BRCaliber>");
while(szRemainder[0] != '\0')
{
UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0");
UINT16 invChar = szRemainder[uiCharLoc];
if(uiCharLoc)
{
szRemainder[uiCharLoc] = '\0';
FilePrintf(hFile,"%s",szRemainder);
szRemainder[uiCharLoc] = invChar;
}
szRemainder += uiCharLoc;
switch(invChar)
{
case '&':
FilePrintf(hFile,"&amp;");
szRemainder++;
break;
case '<':
FilePrintf(hFile,"&lt;");
szRemainder++;
break;
case '>':
FilePrintf(hFile,"&gt;");
szRemainder++;
break;
case '\'':
FilePrintf(hFile,"&apos;");
szRemainder++;
break;
case '\"':
FilePrintf(hFile,"&quot;");
szRemainder++;
break;
}
}
FilePrintf(hFile,"</BRCaliber>\r\n");
INT8 * szRemainder2 = gzBurstSndStrings[cnt]; //the remaining string to be output (for making valid XML)
FilePrintf(hFile,"\t\t<BurstSound>");
while(szRemainder2[0] != '\0')
{
UINT32 uiCharLoc = strcspn(szRemainder2,"&<>\'\"\0");
INT8 invChar = szRemainder2[uiCharLoc];
if(uiCharLoc)
{
szRemainder2[uiCharLoc] = '\0';
FilePrintf(hFile,"%s",szRemainder2);
szRemainder2[uiCharLoc] = invChar;
}
szRemainder2 += uiCharLoc;
switch(invChar)
{
case '&':
FilePrintf(hFile,"&amp;");
szRemainder2++;
break;
case '<':
FilePrintf(hFile,"&lt;");
szRemainder2++;
break;
case '>':
FilePrintf(hFile,"&gt;");
szRemainder2++;
break;
case '\'':
FilePrintf(hFile,"&apos;");
szRemainder2++;
break;
case '\"':
FilePrintf(hFile,"&quot;");
szRemainder2++;
break;
}
}
FilePrintf(hFile,"</BurstSound>\r\n");
FilePrintf(hFile,"\t</AMMO>\r\n");
}
FilePrintf(hFile,"</AMMOLIST>\r\n");
}
FileClose( hFile );
return( TRUE );
}
-3
View File
@@ -4,9 +4,6 @@
#include "Screens.h"
//rain
//#include "NewGameSettings.h"
//end rain