1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * Declaration of Interface class, central interconnect for various GemRB parts
29 //skip messy warnings in MSVC6
36 #include "GlobalTimer.h"
42 #ifdef _MSC_VER // No SFINAE
44 #include "DataFileMgr.h"
46 #include "ScriptEngine.h"
47 #include "StringMgr.h"
48 #include "SymbolMgr.h"
74 class ProjectileServer
;
78 class SaveGameIterator
;
80 class ScriptedAnimation
;
108 struct DamageInfoStruct
{
110 unsigned int resist_stat
;
113 // maybe also add the ac bonus and/or the DL_ constants
116 struct ModalStatesStruct
{
119 unsigned int entering_str
;
120 unsigned int leaving_str
;
121 unsigned int failed_str
;
129 //if count is odd and the column titles start with 2, the random roll should be 2d((c+1)/2)-1
132 ItemList(unsigned int size
, int label
) {
133 ResRefs
= (ieResRef
*) calloc(size
, sizeof(ieResRef
) );
135 if ((size
&1) && (label
==2)) {
148 // Colors of modal window shadow
149 // !!! Keep these synchronized with GUIDefines.py !!!
150 #define MODAL_SHADOW_NONE 0
151 #define MODAL_SHADOW_GRAY 1
152 #define MODAL_SHADOW_BLACK 2
154 #define WINDOW_INVALID -1
155 #define WINDOW_INVISIBLE 0
156 #define WINDOW_VISIBLE 1
157 #define WINDOW_GRAYED 2
158 #define WINDOW_FRONT 3
162 #define QF_QUITGAME 1
163 #define QF_EXITGAME 2
164 #define QF_CHANGESCRIPT 4
165 #define QF_LOADGAME 8
166 #define QF_ENTERGAME 16
168 //events that are called out of drawwindow
169 //they wait until the condition is right
170 #define EF_CONTROL 1 //updates the game window statuses
171 #define EF_SHOWMAP 2 //starts worldmap
172 #define EF_PORTRAIT 4 //updates portraits
173 #define EF_ACTION 8 //updates the actions bar
174 #define EF_UPDATEANIM 16 //updates avatar animation
175 #define EF_SEQUENCER 32 //starts sequencer/contingency creation
176 #define EF_IDENTIFY 64 //starts identify screen
177 #define EF_SELECTION 128 //selection changed
178 #define EF_OPENSTORE 256 //open store window
179 #define EF_MASTERSCRIPT 512 //change masterscript request
182 #define AP_UNUSABLE 0
183 #define AP_ATTACKED 1
187 #define AP_NOTARGET 5
188 #define AP_ENDROUND 6
191 #define AP_SPELLCAST 9
193 /** ea relations (derivated from 2 actor's EA value) */
195 #define EAR_NEUTRAL 1
196 #define EAR_HOSTILE 2
198 /** Max size of actor's ground circle (PST) */
199 #define MAX_CIRCLE_SIZE 3
202 #define EAM_SOURCEALLY 0
203 #define EAM_SOURCEENEMY 1
206 #define EAM_NEUTRAL 4
207 #define EAM_DEFAULT 5
209 #define STAT_CON_HP_NORMAL 0
210 #define STAT_CON_HP_WARRIOR 1
211 #define STAT_CON_HP_MIN 2
212 #define STAT_CON_HP_REGEN 3
213 #define STAT_CON_FATIGUE 4
215 #define STAT_DEX_REACTION 0
216 #define STAT_DEX_MISSILE 1
217 #define STAT_DEX_AC 2
219 #define STAT_INT_LEARN 0
220 #define STAT_INT_MAXLEVEL 1
221 #define STAT_INT_MAXNUMBER 2
223 //sloteffects (querysloteffect returns it)
224 #define SLOT_EFFECT_NONE 0
225 #define SLOT_EFFECT_ITEM 1 //normal equipped item
226 #define SLOT_EFFECT_FIST 2 //fist slot
227 #define SLOT_EFFECT_MAGIC 3 //magic weapon slot
228 #define SLOT_EFFECT_MELEE 4 //normal weapon slot
229 #define SLOT_EFFECT_MISSILE 5 //quiver slots
230 #define SLOT_EFFECT_LEFT 6 //shield (left hand) slot
231 #define SLOT_EFFECT_HEAD 7 //head slot
234 #define FOG_DRAWFOG 1
235 #define FOG_DRAWSEARCHMAP 2
236 #define FOG_DITHERSPRITES 4
238 enum PluginFlagsType
{
246 * Central interconnect for all GemRB parts, driving functions and utility functions possibly belonging to a better place
249 class GEM_EXPORT Interface
253 Holder
<Audio
> AudioDriver
;
254 std::string VideoDriverName
;
255 std::string AudioDriverName
;
256 ProjectileServer
* projserv
;
260 std::vector
<Font
*> fonts
;
262 Holder
<WindowMgr
> windowmgr
;
265 Holder
<ScriptEngine
> guiscript
;
266 SaveGameIterator
*sgiterator
;
268 std::vector
<Window
*> windows
;
269 std::vector
<int> topwin
;
272 Holder
<MusicMgr
> music
;
273 std::vector
<Symbol
> symbols
;
274 Holder
<DataFileMgr
> INIparty
;
275 Holder
<DataFileMgr
> INIbeasts
;
276 Holder
<DataFileMgr
> INIquests
;
277 Holder
<DataFileMgr
> INIresdata
;
280 WorldMapArray
* worldmap
;
281 ieDword GameFeatures
; //the first 32 bits
282 ieDword GameFeatures2
; //the second 32 bits
285 ieResRef ScrollCursorBam
;
286 ieResRef GroundCircleBam
[MAX_CIRCLE_SIZE
];
287 int GroundCircleScale
[MAX_CIRCLE_SIZE
];
288 ieResRef TooltipFont
;
289 ieResRef TooltipBackResRef
;
291 ieResRef
*DefSound
; //default sounds
298 ieDword
* slotmatrix
; //itemtype vs slottype
303 int tooltip_currtextw
;
304 // the control owning the tooltip
305 Control
* tooltip_ctrl
;
306 // Currently dragged item or NULL
307 CREItem
* DraggedItem
;
311 // Index of current container
312 Container
* CurrentContainer
;
317 /** Next Script Name */
320 Holder
<StringMgr
> strings
;
322 Palette
*InfoTextPalette
;
323 int SaveAsOriginal
; //if true, saves files in compatible mode
326 SaveGame
*LoadGameIndex
;
328 unsigned int SlotTypes
; //this is the same as the inventory size
329 ieResRef GlobalScript
;
330 ieResRef WorldMapName
;
331 Variables
* AreaAliasTable
;
332 Variables
* ItemExclTable
;
333 Variables
* ItemDialTable
, *ItemDial2Table
;
334 Variables
* ItemTooltipTable
;
337 //Sprite2D *ArrowSprites[MAX_ORIENT/2];
338 Sprite2D
*FogSprites
[32];
339 Sprite2D
**TooltipBack
;
340 Sprite2D
*WindowFrames
[4];
341 Sprite2D
*GroundCircles
[MAX_CIRCLE_SIZE
][6];
342 std::vector
<char *> musiclist
;
343 std::multimap
<ieDword
, DamageInfoStruct
> DamageInfoMap
;
344 std::vector
<ModalStatesStruct
> ModalStates
;
346 Interface(int iargc
, char *iargv
[]);
349 //TODO: Core Methods in Interface Class
350 void SetFeature(int value
, int position
);
351 /* don't rely on the exact return value of this function */
352 ieDword
HasFeature(int position
) const;
353 bool IsAvailable(SClass_ID filetype
) const;
354 const char * TypeExt(SClass_ID type
) const;
355 ProjectileServer
* GetProjectileServer() const;
356 Video
* GetVideoDriver() const;
357 /* create or change a custom string */
358 ieStrRef
UpdateString(ieStrRef strref
, const char *text
) const;
359 /* returns a newly created string */
360 char * GetString(ieStrRef strref
, ieDword options
= 0) const;
361 /* makes sure the string is freed in TLKImp */
362 void FreeString(char *&str
) const;
363 /* sets the floattext color */
364 void SetInfoTextColor(const Color
&color
);
365 /** returns a gradient set */
366 Color
* GetPalette(unsigned index
, int colors
, Color
*buffer
) const;
367 /** Returns a preloaded Font */
368 Font
* GetFont(const char *) const;
369 Font
* GetFont(unsigned int index
) const;
370 /** Returns the button font */
371 Font
* GetButtonFont() const;
372 /** Returns the Event Manager */
373 EventMgr
* GetEventMgr() const;
374 /** Returns the Window Manager */
375 WindowMgr
* GetWindowMgr() const;
376 /** Get GUI Script Manager */
377 ScriptEngine
* GetGUIScriptEngine() const;
378 /** core for summoning creatures, returns the last created Actor
379 may apply a single fx on the summoned creature normally an unsummon effect */
380 Actor
*SummonCreature(const ieResRef resource
, const ieResRef vvcres
, Scriptable
*Owner
, Actor
*target
, const Point
&position
, int eamod
, int level
, Effect
*fx
, bool sexmod
=1);
381 /** Loads a WindowPack (CHUI file) in the Window Manager */
382 bool LoadWindowPack(const char *name
);
383 /** Loads a Window in the Window Manager */
384 int LoadWindow(unsigned short WindowID
);
385 /** Creates a Window in the Window Manager */
391 int CreateWindow(unsigned short WindowID
, int XPos
, int YPos
, unsigned int Width
, unsigned int Height
, char* Background
);
392 /** Sets a Window on the Top */
393 void SetOnTop(int Index
);
394 /** Add a window to the Window List */
395 void AddWindow(Window
* win
);
396 /** Get a Control on a Window */
397 int GetControl(unsigned short WindowIndex
, unsigned long ControlID
) const;
398 /** Adjust the scrolling of the control (if applicable) */
399 int AdjustScrolling(unsigned short WindowIndex
, unsigned short ControlIndex
, short x
, short y
);
400 /** Set the Text of a Control */
401 int SetText(unsigned short WindowIndex
, unsigned short ControlIndex
, const char * string
);
402 /** Set the Tooltip text of a Control */
403 int SetTooltip(unsigned short WindowIndex
, unsigned short ControlIndex
, const char * string
);
404 /** sets tooltip to be displayed */
405 void DisplayTooltip(int x
, int y
, Control
* ctrl
);
406 /** Actually draws tooltip on the screen. Called from SDLVideoDriver */
408 /** returns the label which should receive game messages (overrides messagetextarea) */
409 Label
*GetMessageLabel() const;
410 /** returns the textarea of the main game screen */
411 TextArea
*GetMessageTextArea() const;
412 /** returns a string reference from a string reference index constant*/
413 ieStrRef
GetStringReference(int stridx
) const;
414 /** returns true if a string reference for a string reference index constant exists */
415 bool HasStringReference(int stridx
) const;
416 /** returns the speaker's color and name */
417 unsigned int GetSpeakerColor(const char *&name
, const Scriptable
*&speaker
) const;
418 /** displays any string in the textarea */
419 void DisplayString(const char *txt
, Scriptable
*speaker
=NULL
) const;
420 /** displays a string constant in the textarea */
421 void DisplayConstantString(int stridx
, unsigned int color
, Scriptable
*speaker
=NULL
) const;
422 /** displays actor name - action : parameter */
423 void DisplayConstantStringNameString(int stridx
, unsigned int color
, int stridx2
, const Scriptable
*actor
) const;
424 /** displays a string constant followed by a number in the textarea */
425 void DisplayConstantStringValue(int stridx
, unsigned int color
, ieDword value
) const;
426 /** displays a string constant in the textarea, starting with speaker's name */
427 void DisplayConstantStringName(int stridx
, unsigned int color
, const Scriptable
*speaker
) const;
428 /** displays a string constant in the textarea, starting with actor, and ending with target */
429 void DisplayConstantStringAction(int stridx
, unsigned int color
, const Scriptable
*actor
, const Scriptable
*target
) const;
430 /** displays a string in the textarea */
431 void DisplayString(int stridx
, unsigned int color
, ieDword flags
) const;
432 /** displays a string in the textarea, starting with speaker's name */
433 void DisplayStringName(int stridx
, unsigned int color
, const Scriptable
*speaker
, ieDword flags
) const;
434 void DisplayStringName(const char *text
, unsigned int color
, const Scriptable
*speaker
) const;
435 /** returns the Window Visible Flag */
436 int GetVisible(unsigned short WindowIndex
) const;
437 /** Set a Window Visible Flag */
438 int SetVisible(unsigned short WindowIndex
, int visible
);
439 /** Show a Window in Modal Mode */
440 int ShowModal(unsigned short WindowIndex
, int Shadow
);
441 /** Set the Status of a Control in a Window */
442 int SetControlStatus(unsigned short WindowIndex
, unsigned short ControlIndex
, unsigned long Status
);
443 /** Get a Window from the Loaded Window List */
444 Window
* GetWindow(unsigned short WindowIndex
) const;
445 /** Returns true if wnd is a valid window with WindowIndex */
446 bool IsValidWindow(unsigned short WindowID
, Window
*wnd
) const;
447 /** Removes a Loaded Window */
448 int DelWindow(unsigned short WindowIndex
);
449 /** Removes all Loaded Windows */
450 void DelAllWindows();
451 /** Redraws all window */
453 /** Refreshes any control associated with the variable name with value*/
454 void RedrawControls(const char *varname
, unsigned int value
);
455 /** Popup the Console */
457 /** Draws the Console */
459 /** Get the SaveGameIterator */
460 SaveGameIterator
* GetSaveGameIterator() const;
461 /** Get the Variables Dictionary */
462 Variables
* GetDictionary() const;
463 /** Get the Token Dictionary */
464 Variables
* GetTokenDictionary() const;
465 /** Get the Music Manager */
466 MusicMgr
* GetMusicMgr() const;
467 /** Loads an IDS Table, returns -1 on error or the Symbol Table Index on success */
468 int LoadSymbol(const char * ResRef
);
469 /** Gets the index of a loaded Symbol Table, returns -1 on error */
470 int GetSymbolIndex(const char * ResRef
) const;
471 /** Gets a Loaded Symbol Table by its index, returns NULL on error */
472 Holder
<SymbolMgr
> GetSymbol(unsigned int index
) const;
473 /** Frees a Loaded Symbol Table, returns false on error, true on success */
474 bool DelSymbol(unsigned int index
);
476 int PlayMovie(const char * ResRef
);
477 /** Generates traditional random number xdy+z */
478 int Roll(int dice
, int size
, int add
) const;
479 /** Loads a Game Compiled Script */
480 int LoadScript(const char * ResRef
);
481 /** Enables/Disables the CutScene Mode */
482 void SetCutSceneMode(bool active
);
483 /** returns true if in cutscene mode */
484 bool InCutSceneMode() const;
485 /** Updates the Game Script Engine State */
486 void GSUpdate(bool update_scripts
)
495 /** Get the Party INI Interpreter */
496 DataFileMgr
* GetPartyINI() const
498 return INIparty
.get();
500 DataFileMgr
* GetBeastsINI() const
502 return INIbeasts
.get();
504 DataFileMgr
* GetQuestsINI() const
506 return INIquests
.get();
508 DataFileMgr
* GetResDataINI() const
510 return INIresdata
.get();
512 /** Gets the Game class */
513 Game
* GetGame() const
517 /** Gets the Calendar class */
518 Calendar
* GetCalendar() const
523 /** Gets the WorldMap class, returns the current worldmap or the first worldmap containing the area*/
524 WorldMap
* GetWorldMap(const char *area
= NULL
);
525 void SetWindowFrame(int i
, Sprite2D
*Picture
);
526 GameControl
*GetGameControl() const;
527 /** if backtomain is not null then goes back to main screen */
528 void QuitGame(int backtomain
);
529 /** sets up load game */
530 void SetupLoadGame(SaveGame
*save
, int ver_override
);
531 /** load saved game by index (-1 is default), ver_override is an optional parameter
532 to override the saved game's version */
533 void LoadGame(SaveGame
*save
, int ver_override
);
534 /** fix changes in global script/worldmap*/
535 void UpdateMasterScript();
536 /*reads the filenames of the portraits folder into a list */
537 int GetPortraits(TextArea
* ta
, bool smallorlarge
);
538 /*reads the filenames of the sounds folder into a list */
539 int GetCharSounds(TextArea
*ta
);
540 /*reads the filenames of the characters folder into a list */
541 int GetCharacters(TextArea
*ta
);
542 unsigned int GetInventorySize() const { return SlotTypes
-1; }
543 ieDword
FindSlot(unsigned int idx
) const;
544 ieDword
QuerySlot(unsigned int idx
) const;
545 ieDword
QuerySlotType(unsigned int idx
) const;
546 ieDword
QuerySlottip(unsigned int idx
) const;
547 ieDword
QuerySlotID(unsigned int idx
) const;
548 ieDword
QuerySlotEffects(unsigned int idx
) const;
549 const char * QuerySlotResRef(unsigned int idx
) const;
550 /*returns true if an itemtype is acceptable for a slottype, also checks the usability flags */
551 int CanUseItemType(int slottype
, Item
*item
, Actor
*actor
=NULL
, bool feedback
=false) const;
552 /*removes single file from cache*/
553 void RemoveFromCache(const ieResRef resref
, SClass_ID SClassID
);
554 /*removes all files from directory*/
555 void DelTree(const char *path
, bool onlysaved
);
556 /*returns 0,1,2 based on how the file should be saved */
557 int SavedExtension(const char *filename
);
558 /*returns true if the file should never be deleted accidentally */
559 bool ProtectedExtension(const char *filename
);
560 /*returns true if the directory path isn't good as a Cache */
561 bool StupidityDetector(const char* Pt
);
562 /*handles the load screen*/
563 void LoadProgress(int percent
);
565 Palette
* CreatePalette(const Color
&color
, const Color
&back
);
567 void DragItem(CREItem
* item
, const ieResRef Picture
);
568 CREItem
* GetDraggedItem() const { return DraggedItem
; }
569 /* use this only when the dragged item is dropped */
570 void ReleaseDraggedItem();
571 int GetDraggedPortrait() const { return DraggedPortrait
; }
572 void SetDraggedPortrait(int dp
, int cursor
=-1);
573 CREItem
*ReadItem(DataStream
*str
);
574 bool ResolveRandomItem(CREItem
*itm
);
575 ieStrRef
GetRumour(const ieResRef resname
);
576 Container
*GetCurrentContainer();
577 int CloseCurrentContainer();
578 void SetCurrentContainer(Actor
*actor
, Container
*arg
, bool flag
=false);
579 Store
*GetCurrentStore();
580 int CloseCurrentStore();
581 Store
*SetCurrentStore(const ieResRef resname
, const ieVariable owner
);
582 void SetMouseScrollSpeed(int speed
);
583 int GetMouseScrollSpeed();
584 // FIXME: due to Win32 we have to allocate/release all common
585 // memory from Interface. Yes, it is ugly.
586 ITMExtHeader
*GetITMExt(int count
);
587 SPLExtHeader
*GetSPLExt(int count
);
588 //creates a standalone effect with opcode
589 Effect
*GetEffect(ieDword opcode
);
590 Effect
*GetFeatures(int count
);
591 void FreeITMExt(ITMExtHeader
*p
, Effect
*e
);
592 void FreeSPLExt(SPLExtHeader
*p
, Effect
*e
);
593 WorldMapArray
*NewWorldMapArray(int count
);
594 void DoTheStoreHack(Store
*s
);
595 /** plays stock gui sound referenced by index */
596 void PlaySound(int idx
);
597 /** returns the first selected PC, if forced is set, then it returns
598 first PC if none was selected */
599 Actor
*GetFirstSelectedPC(bool forced
);
600 /** returns a cursor sprite (not cached) */
601 Sprite2D
*GetCursorSprite();
602 /** returns a scroll cursor sprite */
603 Sprite2D
*GetScrollCursorSprite(int frameNum
, int spriteNum
);
604 /** returns 0 for unmovable, -1 for movable items, otherwise it
605 returns gold value! */
606 int CanMoveItem(const CREItem
*item
) const;
607 int GetMaximumAbility() const;
608 int GetStrengthBonus(int column
, int value
, int ex
) const;
609 int GetIntelligenceBonus(int column
, int value
) const;
610 int GetDexterityBonus(int column
, int value
) const;
611 int GetConstitutionBonus(int column
, int value
) const;
612 int GetCharismaBonus(int column
, int value
) const;
613 int GetLoreBonus(int column
, int value
) const;
615 /** applies the spell on the target */
616 void ApplySpell(const ieResRef resname
, Actor
*target
, Scriptable
*caster
, int level
);
617 /** applies the spell on the area or on a scriptable object */
618 void ApplySpellPoint(const ieResRef resname
, Map
*area
, const Point
&pos
, Scriptable
*caster
, int level
);
619 /** applies a single effect on the target */
620 int ApplyEffect(Effect
*fx
, Actor
*target
, Scriptable
*caster
);
621 //int ApplyEffect(const ieResRef resname, Actor *target, Scriptable *caster, int level, const Point &p);
622 //Actor *target, Scriptable *caster,
623 Effect
*GetEffect(const ieResRef resname
, int level
, const Point
&p
);
624 /** dumps an area object to the cache */
625 int SwapoutArea(Map
*map
);
626 /** saves (exports a character to the characters folder */
627 int WriteCharacter(const char *name
, Actor
*actor
);
628 /** saves the game object to the destination folder */
629 int WriteGame(const char *folder
);
630 /** saves the worldmap object to the destination folder */
631 int WriteWorldMap(const char *folder
);
632 /** saves the .are and .sto files to the destination folder */
633 int CompressSave(const char *folder
);
634 /** receives an autopause reason, returns 1 if pause was triggered by this call, -1 if it was already triggered */
635 int Autopause(ieDword reason
);
636 /** registers engine opcodes */
637 void RegisterOpcodes(int count
, const EffectRef
*opcodes
);
638 /** reads a list of resrefs into an array, returns array size */
639 int ReadResRefTable(const ieResRef tablename
, ieResRef
*&data
);
640 /** frees the data */
641 void FreeResRefTable(ieResRef
*&table
, int &count
);
642 /** Returns the item tooltip value for the xth extension header */
643 int GetItemTooltip(const ieResRef itemname
, int idx
, int identified
);
644 /** Returns the item exclusion value */
645 int GetItemExcl(const ieResRef itemname
) const;
646 /** Returns the strref for the item dialog */
647 int GetItemDialStr(const ieResRef itemname
) const;
648 /** Returns the strref for the item dialog */
649 int GetItemDialRes(const ieResRef itemname
, ieResRef dialog
) const;
650 /** Returns the virtual worldmap entry of a sub-area */
651 int GetAreaAlias(const ieResRef areaname
) const;
652 /** Returns up to 3 resources from resref, choosing rows randomly
653 unwanted return variables could be omitted */
654 void GetResRefFrom2DA(const ieResRef resref
, ieResRef resource1
, ieResRef resource2
= NULL
, ieResRef resource3
= NULL
);
655 /** returns a numeric list read from a 2da. The 0th element is the number of elements in the list */
656 ieDword
*GetListFrom2DA(const ieResRef resref
);
657 /** translates a stat symbol to numeric value */
658 ieDword
TranslateStat(const char *stat_name
);
659 /** Opens CD prompt window and waits for the specified disc */
660 void WaitForDisc(int disc_number
, const char* path
);
661 /** Returns the music playlist corresponding to the provided type */
662 /** it allows scrapping the entry, hence it isn't const */
663 char *GetMusicPlaylist(int SongType
) const;
664 /** Removes the extraneus EOL newline and carriage return */
665 void StripLine(char * string
, size_t size
);
666 /** Returns the DeathVarFormat of the day */
667 static const char *GetDeathVarFormat();
670 bool LoadConfig(void);
671 bool LoadConfig(const char *filename
);
673 bool LoadINI(const char * filename
);
674 bool InitItemTypes();
676 bool ReadRandomItems();
677 bool ReadItemTable(const ieResRef item
, const char *Prefix
);
678 bool ReadAbilityTables();
679 bool ReadAbilityTable(const ieResRef name
, ieWordSigned
*mem
, int cols
, int rows
);
680 bool ReadMusicTable(const ieResRef name
, int col
);
681 bool ReadDamageTypeTable();
682 bool ReadModalStates();
683 /** Reads table of area name mappings for WorldMap (PST only) */
684 bool ReadAreaAliasTable(const ieResRef name
);
685 /** Reads itemexcl, itemdial, tooltip */
686 bool ReadAuxItemTables();
687 /** handles the QuitFlag bits (main loop events) */
689 /** handles the EventFlag bits (conditional events) */
691 /** handles hardcoded gui behaviour */
692 void HandleGUIBehaviour();
693 /** Creates a game control, closes all other windows */
694 GameControl
* StartGameControl();
695 /** Executes everything (non graphical) in the main game loop */
698 char GameDataPath
[_MAX_PATH
];
699 char GameOverridePath
[_MAX_PATH
];
700 char GameSoundsPath
[_MAX_PATH
];
701 char GameScriptsPath
[_MAX_PATH
];
702 char GamePortraitsPath
[_MAX_PATH
];
703 char GameCharactersPath
[_MAX_PATH
];
704 char GemRBOverridePath
[_MAX_PATH
];
705 ieResRef GameNameResRef
;
706 ieResRef GoldResRef
; //MISC07.itm
708 char UserDir
[_MAX_PATH
];
711 char GameName
[_MAX_PATH
];
712 char GameType
[_MAX_PATH
];
713 char GemRBPath
[_MAX_PATH
];
714 char PluginsPath
[_MAX_PATH
];
715 char CachePath
[_MAX_PATH
];
716 char GUIScriptsPath
[_MAX_PATH
];
717 char GamePath
[_MAX_PATH
];
718 char SavePath
[_MAX_PATH
];
719 char INIConfig
[_MAX_PATH
];
720 char CD
[6][_MAX_PATH
];
721 int Width
, Height
, Bpp
, ForceStereo
;
722 unsigned int TooltipDelay
;
723 unsigned int FogOfWar
;
724 bool FullScreen
, CaseSensitive
, GameOnCD
, SkipIntroVideos
, DrawFPS
;
725 bool GUIEnhancements
;
727 Variables
*plugin_flags
;
728 /** The Main program loop */
730 /** returns true if the game is paused */
732 /** Draws the Visible windows in the Windows Array */
733 void DrawWindows(void);
734 /** Sends a termination signal to the Video Driver */
736 /** CheatKey support */
737 inline void EnableCheatKeys(int Flag
)
739 CheatFlag
=(Flag
> 0);
742 inline bool CheatEnabled()
747 inline void SetEventFlag(int Flag
)
752 /** Set Next Script */
753 void SetNextScript(const char *script
);
754 /** Console is on Screen */
756 /** Cheats enabled? */
758 /** The Console Object */
761 Audio
* GetAudioDrv(void) const;
764 int FileStreamPtrCount
;
765 int CachedFileStreamPtrCount
;
769 extern GEM_EXPORT Interface
* core
;