global.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. /* -*- mode: c; tab-width: 4; c-basic-offset: 3; c-file-style: "linux" -*- */
  2. //
  3. // Copyright (c) 2009, Wei Mingzhi <whistler_wmz@users.sf.net>.
  4. // All rights reserved.
  5. //
  6. // This file is part of SDLPAL.
  7. //
  8. // SDLPAL is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. #ifndef GLOBAL_H
  22. #define GLOBAL_H
  23. #include "common.h"
  24. #include "map.h"
  25. #include "ui.h"
  26. #ifdef __cplusplus
  27. extern "C"
  28. {
  29. #endif
  30. //
  31. // SOME NOTES ON "AUTO SCRIPT" AND "TRIGGER SCRIPT":
  32. //
  33. // Auto scripts are executed automatically in each frame.
  34. //
  35. // Trigger scripts are only executed when the event is triggered (player touched
  36. // an event object, player triggered an event script by pressing Spacebar).
  37. //
  38. // maximum number of players in party
  39. #define MAX_PLAYERS_IN_PARTY 3
  40. // total number of possible player roles
  41. #define MAX_PLAYER_ROLES 6
  42. // totally number of playable player roles
  43. #define MAX_PLAYABLE_PLAYER_ROLES 5
  44. // maximum entries of inventory
  45. #define MAX_INVENTORY 256
  46. // maximum items in a store
  47. #define MAX_STORE_ITEM 9
  48. // total number of magic attributes
  49. #define NUM_MAGIC_ELEMENTAL 5
  50. // maximum number of enemies in a team
  51. #define MAX_ENEMIES_IN_TEAM 5
  52. // maximum number of equipments for a player
  53. #define MAX_PLAYER_EQUIPMENTS 6
  54. // maximum number of magics for a player
  55. #define MAX_PLAYER_MAGICS 32
  56. // maximum number of scenes
  57. #define MAX_SCENES 300
  58. // maximum number of objects
  59. #define MAX_OBJECTS 600
  60. // maximum number of event objects (should be somewhat more than the original,
  61. // as there are some modified versions which has more)
  62. #define MAX_EVENT_OBJECTS 5500
  63. // maximum number of effective poisons to players
  64. #define MAX_POISONS 16
  65. // maximum number of level
  66. #define MAX_LEVELS 99
  67. // status of characters
  68. typedef enum tagSTATUS
  69. {
  70. kStatusConfused = 0, // attack friends randomly
  71. #ifdef PAL_CLASSIC
  72. kStatusParalyzed, // paralyzed
  73. #else
  74. kStatusSlow, // slower
  75. #endif
  76. kStatusSleep, // not allowed to move
  77. kStatusSilence, // cannot use magic
  78. kStatusPuppet, // for dead players only, continue attacking
  79. kStatusBravery, // more power for physical attacks
  80. kStatusProtect, // more defense value
  81. kStatusHaste, // faster
  82. kStatusDualAttack, // dual attack
  83. kStatusAll
  84. } STATUS;
  85. #ifndef PAL_CLASSIC
  86. #define kStatusParalyzed kStatusSleep
  87. #endif
  88. // body parts of equipments
  89. typedef enum tagBODYPART
  90. {
  91. kBodyPartHead = 0,
  92. kBodyPartBody,
  93. kBodyPartShoulder,
  94. kBodyPartHand,
  95. kBodyPartFeet,
  96. kBodyPartWear,
  97. kBodyPartExtra,
  98. } BODYPART;
  99. // state of event object, used by the sState field of the EVENTOBJECT struct
  100. typedef enum tagOBJECTSTATE
  101. {
  102. kObjStateHidden = 0,
  103. kObjStateNormal = 1,
  104. kObjStateBlocker = 2
  105. } OBJECTSTATE, *LPOBJECTSTATE;
  106. typedef enum tagTRIGGERMODE
  107. {
  108. kTriggerNone = 0,
  109. kTriggerSearchNear = 1,
  110. kTriggerSearchNormal = 2,
  111. kTriggerSearchFar = 3,
  112. kTriggerTouchNear = 4,
  113. kTriggerTouchNormal = 5,
  114. kTriggerTouchFar = 6,
  115. kTriggerTouchFarther = 7,
  116. kTriggerTouchFarthest = 8
  117. } TRIGGERMODE;
  118. typedef struct tagEVENTOBJECT
  119. {
  120. SHORT sVanishTime; // vanish time (?)
  121. WORD x; // X coordinate on the map
  122. WORD y; // Y coordinate on the map
  123. SHORT sLayer; // layer value
  124. WORD wTriggerScript; // Trigger script entry
  125. WORD wAutoScript; // Auto script entry
  126. SHORT sState; // state of this object
  127. WORD wTriggerMode; // trigger mode
  128. WORD wSpriteNum; // number of the sprite
  129. USHORT nSpriteFrames; // total number of frames of the sprite
  130. WORD wDirection; // direction
  131. WORD wCurrentFrameNum; // current frame number
  132. USHORT nScriptIdleFrame; // count of idle frames, used by trigger script
  133. WORD wSpritePtrOffset; // FIXME: ???
  134. USHORT nSpriteFramesAuto; // total number of frames of the sprite, used by auto script
  135. WORD wScriptIdleFrameCountAuto; // count of idle frames, used by auto script
  136. } EVENTOBJECT, *LPEVENTOBJECT;
  137. typedef struct tagSCENE
  138. {
  139. WORD wMapNum; // number of the map
  140. WORD wScriptOnEnter; // when entering this scene, execute script from here
  141. WORD wScriptOnTeleport; // when teleporting out of this scene, execute script from here
  142. WORD wEventObjectIndex; // event objects in this scene begins from number wEventObjectIndex + 1
  143. } SCENE, *LPSCENE;
  144. // object including system strings, players, items, magics, enemies and poison scripts.
  145. // system strings and players
  146. typedef struct tagOBJECT_PLAYER
  147. {
  148. WORD wReserved[2]; // always zero
  149. WORD wScriptOnFriendDeath; // when friends in party dies, execute script from here
  150. WORD wScriptOnDying; // when dying, execute script from here
  151. } OBJECT_PLAYER;
  152. typedef enum tagITEMFLAG
  153. {
  154. kItemFlagUsable = (1 << 0),
  155. kItemFlagEquipable = (1 << 1),
  156. kItemFlagThrowable = (1 << 2),
  157. kItemFlagConsuming = (1 << 3),
  158. kItemFlagApplyToAll = (1 << 4),
  159. kItemFlagSellable = (1 << 5),
  160. kItemFlagEquipableByPlayerRole_First = (1 << 6)
  161. } ITEMFLAG;
  162. // items
  163. typedef struct tagOBJECT_ITEM
  164. {
  165. WORD wBitmap; // bitmap number in BALL.MKF
  166. WORD wPrice; // price
  167. WORD wScriptOnUse; // script executed when using this item
  168. WORD wScriptOnEquip; // script executed when equipping this item
  169. WORD wScriptOnThrow; // script executed when throwing this item to enemy
  170. #ifdef PAL_WIN95
  171. WORD wScriptDesc; // description script
  172. #endif
  173. WORD wFlags; // flags
  174. } OBJECT_ITEM;
  175. typedef enum tagMAGICFLAG
  176. {
  177. kMagicFlagUsableOutsideBattle = (1 << 0),
  178. kMagicFlagUsableInBattle = (1 << 1),
  179. kMagicFlagUsableToEnemy = (1 << 3),
  180. kMagicFlagApplyToAll = (1 << 4),
  181. } MAGICFLAG;
  182. // magics
  183. typedef struct tagOBJECT_MAGIC
  184. {
  185. WORD wMagicNumber; // magic number, according to DATA.MKF #3
  186. WORD wReserved1; // always zero
  187. WORD wScriptOnSuccess; // when magic succeed, execute script from here
  188. WORD wScriptOnUse; // when use this magic, execute script from here
  189. #ifdef PAL_WIN95
  190. WORD wScriptDesc; // description script
  191. #endif
  192. WORD wReserved2; // always zero
  193. WORD wFlags; // flags
  194. } OBJECT_MAGIC;
  195. // enemies
  196. typedef struct tagOBJECT_ENEMY
  197. {
  198. WORD wEnemyID; // ID of the enemy, according to DATA.MKF #1.
  199. // Also indicates the bitmap number in ABC.MKF.
  200. WORD wResistanceToSorcery; // resistance to sorcery and poison (0 min, 10 max)
  201. WORD wScriptOnTurnStart; // script executed when turn starts
  202. WORD wScriptOnBattleEnd; // script executed when battle ends
  203. WORD wScriptOnReady; // script executed when the enemy is ready
  204. } OBJECT_ENEMY;
  205. // poisons (scripts executed in each round)
  206. typedef struct tagOBJECT_POISON
  207. {
  208. WORD wPoisonLevel; // level of the poison
  209. WORD wColor; // color of avatars
  210. WORD wPlayerScript; // script executed when player has this poison (per round)
  211. WORD wReserved; // always zero
  212. WORD wEnemyScript; // script executed when enemy has this poison (per round)
  213. } OBJECT_POISON;
  214. typedef union tagOBJECT
  215. {
  216. #ifdef PAL_WIN95
  217. WORD rgwData[7];
  218. #else
  219. WORD rgwData[6];
  220. #endif
  221. OBJECT_PLAYER player;
  222. OBJECT_ITEM item;
  223. OBJECT_MAGIC magic;
  224. OBJECT_ENEMY enemy;
  225. OBJECT_POISON poison;
  226. } OBJECT, *LPOBJECT;
  227. typedef struct tagSCRIPTENTRY
  228. {
  229. WORD wOperation; // operation code
  230. WORD rgwOperand[3]; // operands
  231. } SCRIPTENTRY, *LPSCRIPTENTRY;
  232. typedef struct tagINVENTORY
  233. {
  234. WORD wItem; // item object code
  235. USHORT nAmount; // amount of this item
  236. USHORT nAmountInUse; // in-use amount of this item
  237. } INVENTORY, *LPINVENTORY;
  238. typedef struct tagSTORE
  239. {
  240. WORD rgwItems[MAX_STORE_ITEM];
  241. } STORE, *LPSTORE;
  242. typedef struct tagENEMY
  243. {
  244. WORD wIdleFrames; // total number of frames when idle
  245. WORD wMagicFrames; // total number of frames when using magics
  246. WORD wAttackFrames; // total number of frames when doing normal attack
  247. WORD wIdleAnimSpeed; // speed of the animation when idle
  248. WORD wActWaitFrames; // FIXME: ???
  249. WORD wYPosOffset;
  250. WORD wAttackSound; // sound played when this enemy uses normal attack
  251. WORD wActionSound; // FIXME: ???
  252. WORD wMagicSound; // sound played when this enemy uses magic
  253. WORD wDeathSound; // sound played when this enemy dies
  254. WORD wCallSound; // sound played when entering the battle
  255. WORD wHealth; // total HP of the enemy
  256. WORD wExp; // How many EXPs we'll get for beating this enemy
  257. WORD wCash; // how many cashes we'll get for beating this enemy
  258. WORD wLevel; // this enemy's level
  259. WORD wMagic; // this enemy's magic number
  260. WORD wMagicRate; // chance for this enemy to use magic
  261. WORD wAttackEquivItem; // equivalence item of this enemy's normal attack
  262. WORD wAttackEquivItemRate;// chance for equivalence item
  263. WORD wStealItem; // which item we'll get when stealing from this enemy
  264. USHORT nStealItem; // total amount of the items which can be stolen
  265. WORD wAttackStrength; // normal attack strength
  266. WORD wMagicStrength; // magical attack strength
  267. WORD wDefense; // resistance to all kinds of attacking
  268. WORD wDexterity; // dexterity
  269. WORD wFleeRate; // chance for successful fleeing
  270. WORD wPoisonResistance; // resistance to poison
  271. WORD wElemResistance[NUM_MAGIC_ELEMENTAL]; // resistance to elemental magics
  272. WORD wPhysicalResistance; // resistance to physical attack
  273. WORD wDualMove; // whether this enemy can do dual move or not
  274. WORD wCollectValue; // value for collecting this enemy for items
  275. } ENEMY, *LPENEMY;
  276. typedef struct tagENEMYTEAM
  277. {
  278. WORD rgwEnemy[MAX_ENEMIES_IN_TEAM];
  279. } ENEMYTEAM, *LPENEMYTEAM;
  280. typedef WORD PLAYERS[MAX_PLAYER_ROLES];
  281. typedef struct tagPLAYERROLES
  282. {
  283. PLAYERS rgwAvatar; // avatar (shown in status view)
  284. PLAYERS rgwSpriteNumInBattle; // sprite displayed in battle (in F.MKF)
  285. PLAYERS rgwSpriteNum; // sprite displayed in normal scene (in MGO.MKF)
  286. PLAYERS rgwName; // name of player class (in WORD.DAT)
  287. PLAYERS rgwAttackAll; // whether player can attack everyone in a bulk or not
  288. PLAYERS rgwUnknown1; // FIXME: ???
  289. PLAYERS rgwLevel; // level
  290. PLAYERS rgwMaxHP; // maximum HP
  291. PLAYERS rgwMaxMP; // maximum MP
  292. PLAYERS rgwHP; // current HP
  293. PLAYERS rgwMP; // current MP
  294. WORD rgwEquipment[MAX_PLAYER_EQUIPMENTS][MAX_PLAYER_ROLES]; // equipments
  295. PLAYERS rgwAttackStrength; // normal attack strength
  296. PLAYERS rgwMagicStrength; // magical attack strength
  297. PLAYERS rgwDefense; // resistance to all kinds of attacking
  298. PLAYERS rgwDexterity; // dexterity
  299. PLAYERS rgwFleeRate; // chance of successful fleeing
  300. PLAYERS rgwPoisonResistance; // resistance to poison
  301. WORD rgwElementalResistance[NUM_MAGIC_ELEMENTAL][MAX_PLAYER_ROLES]; // resistance to elemental magics
  302. PLAYERS rgwUnknown2; // FIXME: ???
  303. PLAYERS rgwUnknown3; // FIXME: ???
  304. PLAYERS rgwUnknown4; // FIXME: ???
  305. PLAYERS rgwCoveredBy; // who will cover me when I am low of HP or not sane
  306. WORD rgwMagic[MAX_PLAYER_MAGICS][MAX_PLAYER_ROLES]; // magics
  307. PLAYERS rgwWalkFrames; // walk frame (???)
  308. PLAYERS rgwCooperativeMagic; // cooperative magic
  309. PLAYERS rgwUnknown5; // FIXME: ???
  310. PLAYERS rgwUnknown6; // FIXME: ???
  311. PLAYERS rgwDeathSound; // sound played when player dies
  312. PLAYERS rgwAttackSound; // sound played when player attacks
  313. PLAYERS rgwWeaponSound; // weapon sound (???)
  314. PLAYERS rgwCriticalSound; // sound played when player make critical hits
  315. PLAYERS rgwMagicSound; // sound played when player is casting a magic
  316. PLAYERS rgwCoverSound; // sound played when player cover others
  317. PLAYERS rgwDyingSound; // sound played when player is dying
  318. } PLAYERROLES, *LPPLAYERROLES;
  319. typedef enum tagMAGIC_TYPE
  320. {
  321. kMagicTypeNormal = 0,
  322. kMagicTypeAttackAll = 1, // draw the effect on each of the enemies
  323. kMagicTypeAttackWhole = 2, // draw the effect on the whole enemy team
  324. kMagicTypeAttackField = 3, // draw the effect on the battle field
  325. kMagicTypeApplyToPlayer = 4, // the magic is used on one player
  326. kMagicTypeApplyToParty = 5, // the magic is used on the whole party
  327. kMagicTypeTrance = 8, // trance the player
  328. kMagicTypeSummon = 9, // summon
  329. } MAGIC_TYPE;
  330. typedef struct tagMAGIC
  331. {
  332. WORD wEffect; // effect sprite
  333. WORD wType; // type of this magic
  334. WORD wXOffset;
  335. WORD wYOffset;
  336. WORD wSummonEffect; // summon effect sprite (in F.MKF)
  337. WORD wSpeed; // speed of the effect
  338. WORD wKeepEffect; // FIXME: ???
  339. WORD wSoundDelay; // delay of the SFX
  340. WORD wEffectTimes; // total times of effect
  341. WORD wShake; // shake screen
  342. WORD wWave; // wave screen
  343. WORD wUnknown; // FIXME: ???
  344. WORD wCostMP; // MP cost
  345. WORD wBaseDamage; // base damage
  346. WORD wElemental; // elemental (0 = No Elemental, last = poison)
  347. WORD wSound; // sound played when using this magic
  348. } MAGIC, *LPMAGIC;
  349. typedef struct tagBATTLEFIELD
  350. {
  351. WORD wScreenWave; // level of screen waving
  352. SHORT rgsMagicEffect[NUM_MAGIC_ELEMENTAL]; // effect of attributed magics
  353. } BATTLEFIELD, *LPBATTLEFIELD;
  354. // magics learned when level up
  355. typedef struct tagLEVELUPMAGIC
  356. {
  357. WORD wLevel; // level reached
  358. WORD wMagic; // magic learned
  359. } LEVELUPMAGIC, *LPLEVELUPMAGIC;
  360. typedef struct tagLEVELUPMAGIC_ALL
  361. {
  362. LEVELUPMAGIC m[MAX_PLAYABLE_PLAYER_ROLES];
  363. } LEVELUPMAGIC_ALL, *LPLEVELUPMAGIC_ALL;
  364. typedef struct tagENEMYPOS
  365. {
  366. struct {
  367. WORD x;
  368. WORD y;
  369. } pos[MAX_ENEMIES_IN_TEAM][MAX_ENEMIES_IN_TEAM];
  370. } ENEMYPOS, *LPENEMYPOS;
  371. // Exp. points needed for the next level
  372. typedef WORD LEVELUPEXP, *LPLEVELUPEXP;
  373. // game data which is available in data files.
  374. typedef struct tagGAMEDATA
  375. {
  376. LPEVENTOBJECT lprgEventObject;
  377. int nEventObject;
  378. SCENE rgScene[MAX_SCENES];
  379. OBJECT rgObject[MAX_OBJECTS];
  380. LPSCRIPTENTRY lprgScriptEntry;
  381. int nScriptEntry;
  382. LPSTORE lprgStore;
  383. int nStore;
  384. LPENEMY lprgEnemy;
  385. int nEnemy;
  386. LPENEMYTEAM lprgEnemyTeam;
  387. int nEnemyTeam;
  388. PLAYERROLES PlayerRoles;
  389. LPMAGIC lprgMagic;
  390. int nMagic;
  391. LPBATTLEFIELD lprgBattleField;
  392. int nBattleField;
  393. LPLEVELUPMAGIC_ALL lprgLevelUpMagic;
  394. int nLevelUpMagic;
  395. ENEMYPOS EnemyPos;
  396. LEVELUPEXP rgLevelUpExp[MAX_LEVELS + 1];
  397. WORD rgwBattleEffectIndex[10][2];
  398. } GAMEDATA, *LPGAMEDATA;
  399. typedef struct tagFILES
  400. {
  401. FILE *fpFBP; // battlefield background images
  402. FILE *fpMGO; // sprites in scenes
  403. FILE *fpBALL; // item bitmaps
  404. FILE *fpDATA; // misc data
  405. FILE *fpF; // player sprites during battle
  406. FILE *fpFIRE; // fire effect sprites
  407. FILE *fpRGM; // character face bitmaps
  408. FILE *fpSSS; // script data
  409. } FILES, *LPFILES;
  410. // player party
  411. typedef struct tagPARTY
  412. {
  413. WORD wPlayerRole; // player role
  414. SHORT x, y; // position
  415. WORD wFrame; // current frame number
  416. WORD wImageOffset; // FIXME: ???
  417. } PARTY, *LPPARTY;
  418. // player trail, used for other party members to follow the main party member
  419. typedef struct tagTRAIL
  420. {
  421. WORD x, y; // position
  422. WORD wDirection; // direction
  423. } TRAIL, *LPTRAIL;
  424. typedef struct tagEXPERIENCE
  425. {
  426. WORD wExp; // current experience points
  427. WORD wReserved;
  428. WORD wLevel; // current level
  429. WORD wCount;
  430. } EXPERIENCE, *LPEXPERIENCE;
  431. typedef struct tagALLEXPERIENCE
  432. {
  433. EXPERIENCE rgPrimaryExp[MAX_PLAYER_ROLES];
  434. EXPERIENCE rgHealthExp[MAX_PLAYER_ROLES];
  435. EXPERIENCE rgMagicExp[MAX_PLAYER_ROLES];
  436. EXPERIENCE rgAttackExp[MAX_PLAYER_ROLES];
  437. EXPERIENCE rgMagicPowerExp[MAX_PLAYER_ROLES];
  438. EXPERIENCE rgDefenseExp[MAX_PLAYER_ROLES];
  439. EXPERIENCE rgDexterityExp[MAX_PLAYER_ROLES];
  440. EXPERIENCE rgFleeExp[MAX_PLAYER_ROLES];
  441. } ALLEXPERIENCE, *LPALLEXPERIENCE;
  442. typedef struct tagPOISONSTATUS
  443. {
  444. WORD wPoisonID; // kind of the poison
  445. WORD wPoisonScript; // script entry
  446. } POISONSTATUS, *LPPOISONSTATUS;
  447. typedef struct tagGLOBALVARS
  448. {
  449. FILES f;
  450. GAMEDATA g;
  451. BYTE bCurrentSaveSlot; // current save slot (1-5)
  452. int iCurMainMenuItem; // current main menu item number
  453. int iCurSystemMenuItem; // current system menu item number
  454. int iCurInvMenuItem; // current inventory menu item number
  455. int iCurPlayingRNG; // current playing RNG animation
  456. BOOL fGameStart; // TRUE if the has just started
  457. BOOL fEnteringScene; // TRUE if entering a new scene
  458. BOOL fNeedToFadeIn; // TRUE if need to fade in when drawing scene
  459. BOOL fInBattle; // TRUE if in battle
  460. BOOL fAutoBattle; // TRUE if auto-battle
  461. #ifndef PAL_CLASSIC
  462. BYTE bBattleSpeed; // Battle Speed (1 = Fastest, 5 = Slowest)
  463. #endif
  464. WORD wLastUnequippedItem; // last unequipped item
  465. PLAYERROLES rgEquipmentEffect[MAX_PLAYER_EQUIPMENTS + 1]; // equipment effects
  466. WORD rgPlayerStatus[MAX_PLAYER_ROLES][kStatusAll]; // player status
  467. PAL_POS viewport; // viewport coordination
  468. PAL_POS partyoffset;
  469. WORD wLayer;
  470. WORD wMaxPartyMemberIndex;// max index of members in party (0 to MAX_PLAYERS_IN_PARTY - 1)
  471. PARTY rgParty[MAX_PLAYABLE_PLAYER_ROLES]; // player party
  472. TRAIL rgTrail[MAX_PLAYABLE_PLAYER_ROLES]; // player trail
  473. WORD wPartyDirection; // direction of the party
  474. WORD wNumScene; // current scene number
  475. WORD wNumPalette; // current palette number
  476. BOOL fNightPalette; // TRUE if use the darker night palette
  477. WORD wNumMusic; // current music number
  478. WORD wNumBattleMusic; // current music number in battle
  479. WORD wNumBattleField; // current battle field number
  480. WORD wCollectValue; // value of "collected" items
  481. WORD wScreenWave; // level of screen waving
  482. SHORT sWaveProgression;
  483. WORD wChaseRange;
  484. WORD wChasespeedChangeCycles;
  485. USHORT nFollower;
  486. DWORD dwCash; // amount of cash
  487. ALLEXPERIENCE Exp; // experience status
  488. POISONSTATUS rgPoisonStatus[MAX_POISONS][MAX_PLAYABLE_PLAYER_ROLES]; // poison status
  489. INVENTORY rgInventory[MAX_INVENTORY]; // inventory status
  490. #ifndef PAL_WIN95
  491. LPOBJECTDESC lpObjectDesc;
  492. #endif
  493. DWORD dwFrameNum;
  494. } GLOBALVARS, *LPGLOBALVARS;
  495. typedef struct tagSAVEDGAME
  496. {
  497. WORD wSavedTimes; // saved times
  498. WORD wViewportX, wViewportY; // viewport location
  499. WORD nPartyMember; // number of members in party
  500. WORD wNumScene; // scene number
  501. WORD wPaletteOffset;
  502. WORD wPartyDirection; // party direction
  503. WORD wNumMusic; // music number
  504. WORD wNumBattleMusic; // battle music number
  505. WORD wNumBattleField; // battle field number
  506. WORD wScreenWave; // level of screen waving
  507. WORD wBattleSpeed; // battle speed
  508. WORD wCollectValue; // value of "collected" items
  509. WORD wLayer;
  510. WORD wChaseRange;
  511. WORD wChasespeedChangeCycles;
  512. WORD nFollower;
  513. WORD rgwReserved2[3]; // unused
  514. DWORD dwCash; // amount of cash
  515. PARTY rgParty[MAX_PLAYABLE_PLAYER_ROLES]; // player party
  516. TRAIL rgTrail[MAX_PLAYABLE_PLAYER_ROLES]; // player trail
  517. ALLEXPERIENCE Exp; // experience data
  518. PLAYERROLES PlayerRoles;
  519. POISONSTATUS rgPoisonStatus[MAX_POISONS][MAX_PLAYABLE_PLAYER_ROLES]; // poison status
  520. INVENTORY rgInventory[MAX_INVENTORY]; // inventory status
  521. SCENE rgScene[MAX_SCENES];
  522. OBJECT rgObject[MAX_OBJECTS];
  523. EVENTOBJECT rgEventObject[MAX_EVENT_OBJECTS];
  524. } SAVEDGAME, *LPSAVEDGAME;
  525. extern LPGLOBALVARS gpGlobals;
  526. INT
  527. PAL_InitGlobals(
  528. VOID
  529. );
  530. VOID
  531. PAL_FreeGlobals(
  532. VOID
  533. );
  534. VOID
  535. PAL_SaveGame(
  536. LPCSTR szFileName,
  537. WORD wSavedTimes
  538. );
  539. VOID
  540. PAL_InitGameData(
  541. INT iSaveSlot
  542. );
  543. BOOL
  544. PAL_AddItemToInventory(
  545. WORD wObjectID,
  546. INT iNum
  547. );
  548. BOOL
  549. PAL_IncreaseHPMP(
  550. WORD wPlayerRole,
  551. SHORT sHP,
  552. SHORT sMP
  553. );
  554. INT
  555. PAL_GetItemAmount(
  556. WORD wItem
  557. );
  558. VOID
  559. PAL_UpdateEquipments(
  560. VOID
  561. );
  562. VOID
  563. PAL_CompressInventory(
  564. VOID
  565. );
  566. VOID
  567. PAL_RemoveEquipmentEffect(
  568. WORD wPlayerRole,
  569. WORD wEquipPart
  570. );
  571. VOID
  572. PAL_AddPoisonForPlayer(
  573. WORD wPlayerRole,
  574. WORD wPoisonID
  575. );
  576. VOID
  577. PAL_CurePoisonByKind(
  578. WORD wPlayerRole,
  579. WORD wPoisonID
  580. );
  581. VOID
  582. PAL_CurePoisonByLevel(
  583. WORD wPlayerRole,
  584. WORD wMaxLevel
  585. );
  586. BOOL
  587. PAL_IsPlayerPoisonedByLevel(
  588. WORD wPlayerRole,
  589. WORD wMinLevel
  590. );
  591. BOOL
  592. PAL_IsPlayerPoisonedByKind(
  593. WORD wPlayerRole,
  594. WORD wPoisonID
  595. );
  596. WORD
  597. PAL_GetPlayerAttackStrength(
  598. WORD wPlayerRole
  599. );
  600. WORD
  601. PAL_GetPlayerMagicStrength(
  602. WORD wPlayerRole
  603. );
  604. WORD
  605. PAL_GetPlayerDefense(
  606. WORD wPlayerRole
  607. );
  608. WORD
  609. PAL_GetPlayerDexterity(
  610. WORD wPlayerRole
  611. );
  612. WORD
  613. PAL_GetPlayerFleeRate(
  614. WORD wPlayerRole
  615. );
  616. WORD
  617. PAL_GetPlayerPoisonResistance(
  618. WORD wPlayerRole
  619. );
  620. WORD
  621. PAL_GetPlayerElementalResistance(
  622. WORD wPlayerRole,
  623. INT iAttrib
  624. );
  625. WORD
  626. PAL_GetPlayerBattleSprite(
  627. WORD wPlayerRole
  628. );
  629. WORD
  630. PAL_GetPlayerCooperativeMagic(
  631. WORD wPlayerRole
  632. );
  633. BOOL
  634. PAL_PlayerCanAttackAll(
  635. WORD wPlayerRole
  636. );
  637. BOOL
  638. PAL_AddMagic(
  639. WORD wPlayerRole,
  640. WORD wMagic
  641. );
  642. VOID
  643. PAL_RemoveMagic(
  644. WORD wPlayerRole,
  645. WORD wMagic
  646. );
  647. VOID
  648. PAL_SetPlayerStatus(
  649. WORD wPlayerRole,
  650. WORD wStatusID,
  651. WORD wNumRound
  652. );
  653. VOID
  654. PAL_RemovePlayerStatus(
  655. WORD wPlayerRole,
  656. WORD wStatusID
  657. );
  658. VOID
  659. PAL_ClearAllPlayerStatus(
  660. VOID
  661. );
  662. VOID
  663. PAL_PlayerLevelUp(
  664. WORD wPlayerRole,
  665. WORD wNumLevel
  666. );
  667. #ifdef __cplusplus
  668. }
  669. #endif
  670. #endif