global.h 26 KB

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