3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
8 * See LICENSING which should be included
9 * along with this file for more details
16 #include "ivancommon.h"
29 # define LIGHT_BORDER 80
32 #define PLAYER game::GetPlayer()
58 typedef std::map
<festring
, sLong
> valuemap
;
59 typedef truth (*stringkeyhandler
)(int, festring
&);
60 typedef v2 (*positionkeyhandler
)(v2
, int);
61 typedef void (*positionhandler
)(v2
);
62 typedef void (*bitmapeditor
)(bitmap
*, truth
);
72 outputfile
& operator<<(outputfile
&, const homedata
*);
73 inputfile
& operator>>(inputfile
&, homedata
*&);
78 configid (int Type
, int Config
) : Type(Type
), Config(Config
) {}
79 bool operator < (const configid
& CI
) const { return memcmp(this, &CI
, sizeof(configid
)) < 0; }
81 int Type NO_ALIGNMENT
;
82 int Config NO_ALIGNMENT
;
85 outputfile
& operator<<(outputfile
&, const configid
&);
86 inputfile
& operator>>(inputfile
&, configid
&);
90 dangerid () : NakedDanger(0), EquippedDanger(0) {}
91 dangerid (double NakedDanger
, double EquippedDanger
) : NakedDanger(NakedDanger
), EquippedDanger(EquippedDanger
) {}
93 double EquippedDanger
;
96 outputfile
& operator<<(outputfile
&, const dangerid
&);
97 inputfile
& operator>>(inputfile
&, dangerid
&);
109 massacreid (int Type
, int Config
, cfestring
&Name
) : Type(Type
), Config(Config
), Name(Name
) { }
110 bool operator < (const massacreid
&) const;
117 inline bool massacreid::operator<(const massacreid
& MI
) const
120 return Type
< MI
.Type
;
122 if(Config
!= MI
.Config
)
123 return Config
< MI
.Config
;
125 return Name
< MI
.Name
;
128 outputfile
& operator<<(outputfile
&, const massacreid
&);
129 inputfile
& operator>>(inputfile
&, massacreid
&);
134 killreason (cfestring
&String
, int Amount
) : String(String
), Amount(Amount
) {}
140 outputfile
& operator<<(outputfile
&, const killreason
&);
141 inputfile
& operator>>(inputfile
&, killreason
&);
145 killdata (int Amount
=0, double DangerSum
=0) : Amount(Amount
), DangerSum(DangerSum
) {}
149 std::vector
<killreason
> Reason
;
152 outputfile
& operator<<(outputfile
&, const killdata
&);
153 inputfile
& operator>>(inputfile
&, killdata
&);
156 typedef std::map
<configid
, dangerid
> dangermap
;
157 typedef std::map
<feuLong
, character
*> characteridmap
;
158 typedef std::map
<feuLong
, item
*> itemidmap
;
159 typedef std::map
<feuLong
, entity
*> trapidmap
;
160 typedef std::map
<massacreid
, killdata
> massacremap
;
161 typedef std::map
<feuLong
, feuLong
> boneidmap
;
162 typedef std::vector
<item
*> itemvector
;
163 typedef std::vector
<itemvector
> itemvectorvector
;
164 typedef std::vector
<character
*> charactervector
;
167 class quitrequest
{};
168 class areachangerequest
{};
178 FuncArg () : type(FARG_UNDEFINED
), sval(""), ival(0) {}
179 FuncArg (cfestring
&aVal
) : type(FARG_STRING
), sval(aVal
), ival(0) {}
180 FuncArg (sLong aVal
) : type(FARG_NUMBER
), sval(""), ival(aVal
) {}
190 static void InitPlaces ();
191 static truth
Init(cfestring
& = CONST_S(""));
192 static void DeInit();
194 static int GetMoveCommandKey(int);
195 static int MoveVectorToDirection (cv2
&mv
); // -1: none
196 static cv2
GetMoveVector(int I
) { return MoveVector
[I
]; }
197 static cv2
GetRelativeMoveVector(int I
) { return RelativeMoveVector
[I
]; }
198 static cv2
GetBasicMoveVector(int I
) { return BasicMoveVector
[I
]; }
199 static cv2
GetLargeMoveVector(int I
) { return LargeMoveVector
[I
]; }
200 static area
* GetCurrentArea() { return CurrentArea
; }
201 static level
* GetCurrentLevel() { return CurrentLevel
; }
202 static uChar
*** GetLuxTable() { return LuxTable
; }
203 static character
* GetPlayer() { return Player
; }
204 static void SetPlayer(character
*);
205 static v2
GetCamera() { return Camera
; }
206 static void UpdateCameraX();
207 static void UpdateCameraY();
208 static truth
IsLoading() { return Loading
; }
209 static void SetIsLoading(truth What
) { Loading
= What
; }
210 static truth
ForceJumpToPlayerBe() { return JumpToPlayerBe
; }
211 static void SetForceJumpToPlayerBe(truth What
) { JumpToPlayerBe
= What
; }
212 static level
* GetLevel(int);
213 static void InitLuxTable();
214 static void DeInitLuxTable();
215 static cchar
* Insult();
216 static truth
TruthQuestion(cfestring
&, int = 0, int = 0);
217 static void DrawEverything();
218 static truth
Save(cfestring
& = SaveName(""));
219 static int Load(cfestring
& = SaveName(""));
220 static truth
IsRunning() { return Running
; }
221 static void SetIsRunning(truth What
) { Running
= What
; }
222 static void UpdateCameraX(int);
223 static void UpdateCameraY(int);
224 static int GetCurrentLevelIndex() { return CurrentLevelIndex
; }
225 static int GetMoveCommandKeyBetweenPoints(v2
, v2
);
226 static void DrawEverythingNoBlit(truth
= false);
227 static god
* GetGod(int I
) { return God
[I
]; }
228 static cchar
* GetAlignment(int I
) { return Alignment
[I
]; }
229 static void ApplyDivineTick();
230 static void ApplyDivineAlignmentBonuses(god
*, int, truth
);
231 static v2
GetDirectionVectorForKey(int);
232 static festring
SaveName(cfestring
& = CONST_S(""));
233 static void ShowLevelMessage();
234 static double GetMinDifficulty();
235 static void TriggerQuestForGoldenEagleShirt();
236 static void CalculateGodNumber();
237 static void IncreaseTick() { ++Tick
; }
238 static feuLong
GetTick() { return Tick
; }
239 static festring
GetAutoSaveFileName() { return AutoSaveFileName
; }
240 static int DirectionQuestion(cfestring
&, truth
= true, truth
= false);
241 static void RemoveSaves(truth
= true);
242 static truth
IsInWilderness() { return InWilderness
; }
243 static void SetIsInWilderness(truth What
) { InWilderness
= What
; }
244 static worldmap
* GetWorldMap() { return WorldMap
; }
245 static void SetAreaInLoad(area
* What
) { AreaInLoad
= What
; }
246 static void SetSquareInLoad(square
* What
) { SquareInLoad
= What
; }
247 static area
* GetAreaInLoad() { return AreaInLoad
; }
248 static square
* GetSquareInLoad() { return SquareInLoad
; }
249 static int GetLevels();
250 static dungeon
* GetCurrentDungeon() { return Dungeon
[CurrentDungeonIndex
]; }
251 static dungeon
* GetDungeon(int I
) { return Dungeon
[I
]; }
252 static int GetCurrentDungeonIndex() { return CurrentDungeonIndex
; }
253 static void InitDungeons();
254 static truth
OnScreen(v2
);
255 static void DoEvilDeed(int);
256 static void SaveWorldMap(cfestring
& = SaveName(""), truth
= true);
257 static worldmap
* LoadWorldMap(cfestring
& = SaveName(""));
258 static void UpdateCamera();
259 static feuLong
CreateNewCharacterID(character
*);
260 static feuLong
CreateNewItemID(item
*);
261 static feuLong
CreateNewTrapID(entity
*);
262 static team
* GetTeam(int I
) { return Team
[I
]; }
263 static int GetTeams() { return Teams
; }
264 static void Hostility(team
*, team
*);
265 static void CreateTeams();
266 static festring
StringQuestion(cfestring
&, col16
, festring::sizetype
, festring::sizetype
, truth
, stringkeyhandler
= 0);
267 static sLong
NumberQuestion(cfestring
&, int, truth
= false);
268 static feuLong
IncreaseLOSTick();
269 static feuLong
GetLOSTick() { return LOSTick
; }
270 static void SendLOSUpdateRequest() { LOSUpdateRequested
= true; }
271 static void RemoveLOSUpdateRequest() { LOSUpdateRequested
= false; }
272 static character
* GetPetrus() { return Petrus
; }
273 static void SetPetrus(character
* What
) { Petrus
= What
; }
274 static truth
HandleQuitMessage();
275 static int GetDirectionForVector(v2
);
276 static cchar
* GetVerbalPlayerAlignment();
277 static void CreateGods();
278 static int GetScreenXSize() { return 42; }
279 static int GetScreenYSize() { return 26; }
280 static v2
CalculateScreenCoordinates(v2
);
281 static void BusyAnimation();
282 static void BusyAnimation(bitmap
*, truth
);
283 static v2
PositionQuestion(cfestring
&, v2
, positionhandler
= 0, positionkeyhandler
= 0, truth
= true);
284 static void LookHandler(v2
);
285 static int AskForKeyPress(cfestring
&);
286 static void AskForEscPress(cfestring
&Topic
);
287 static truth
AnimationController();
288 static gamescript
* GetGameScript() { return GameScript
; }
289 static void InitScript();
290 static valuemap
& GetGlobalValueMap() { return GlobalValueMap
; }
291 static void InitGlobalValueMap();
292 static void LoadGlobalValueMap (inputfile
&SaveFile
);
293 static void TextScreen(cfestring
&, v2
= ZERO_V2
, col16
= 0xFFFF, truth
= true, truth
= true, bitmapeditor
= 0);
294 static void SetCursorPos(v2 What
) { CursorPos
= What
; }
295 static truth
DoZoom() { return Zoom
; }
296 static void SetDoZoom(truth What
) { Zoom
= What
; }
297 static int KeyQuestion(cfestring
&, int, int, ...);
298 static v2
LookKeyHandler(v2
, int);
299 static v2
NameKeyHandler(v2
, int);
300 static void End(festring
, truth
= true, truth
= true);
301 static int CalculateRoughDirection(v2
);
302 static sLong
ScrollBarQuestion(cfestring
&, sLong
, sLong
, sLong
, sLong
, sLong
, col16
, col16
, col16
, void (*)(sLong
) = 0);
303 static truth
IsGenerating() { return Generating
; }
304 static void SetIsGenerating(truth What
) { Generating
= What
; }
305 static void CalculateNextDanger();
306 static int Menu(bitmap
*, v2
, cfestring
&, cfestring
&, col16
, cfestring
& = "", cfestring
& = "");
307 static void InitDangerMap();
308 static const dangermap
& GetDangerMap();
309 static truth
TryTravel(int, int, int, truth
= false, truth
= true);
310 static truth
LeaveArea(charactervector
&, truth
, truth
);
311 static void EnterArea(charactervector
&, int, int);
312 static int CompareLights(col24
, col24
);
313 static int CompareLightToInt(col24
, col24
);
314 static void CombineLights(col24
&, col24
);
315 static col24
CombineConstLights(col24
, col24
);
316 static truth
IsDark(col24
);
317 static void SetStandardListAttributes(felist
&);
318 static double GetAveragePlayerArmStrengthExperience() { return AveragePlayerArmStrengthExperience
; }
319 static double GetAveragePlayerLegStrengthExperience() { return AveragePlayerLegStrengthExperience
; }
320 static double GetAveragePlayerDexterityExperience() { return AveragePlayerDexterityExperience
; }
321 static double GetAveragePlayerAgilityExperience() { return AveragePlayerAgilityExperience
; }
322 static void InitPlayerAttributeAverage();
323 static void UpdatePlayerAttributeAverage();
324 static void CallForAttention(v2
, int);
325 static character
* SearchCharacter(feuLong
);
326 static item
* SearchItem(feuLong
);
327 static entity
* SearchTrap(feuLong
);
328 static void AddCharacterID(character
*, feuLong
);
329 static void RemoveCharacterID(feuLong
);
330 static void AddItemID(item
*, feuLong
);
331 static void RemoveItemID(feuLong
);
332 static void UpdateItemID(item
*, feuLong
);
333 static void AddTrapID(entity
*, feuLong
);
334 static void RemoveTrapID(feuLong
);
335 static void UpdateTrapID(entity
*, feuLong
);
336 static int GetStoryState() { return StoryState
; }
337 static void SetStoryState(int What
) { StoryState
= What
; }
338 static int GetMondedrPass () { return MondedrPass
; }
339 static void SetMondedrPass (int What
) { MondedrPass
= What
; }
340 static int GetRingOfThieves () { return RingOfThieves
; }
341 static void SetRingOfThieves (int What
) { RingOfThieves
= What
; }
342 static int GetMasamune () { return Masamune
; }
343 static void SetMasamune (int What
) { Masamune
= What
; }
344 static int GetMuramasa () { return Muramasa
; }
345 static void SetMuramasa (int What
) { Muramasa
= What
; }
346 static int GetLoricatusHammer () { return LoricatusHammer
; }
347 static void SetLoricatusHammer (int What
) { LoricatusHammer
= What
; }
348 static int GetLiberator () { return Liberator
; }
349 static void SetLiberator (int What
) { Liberator
= What
; }
350 static int GetOmmelBloodMission() { return OmmelBloodMission
; }
351 static void SetOmmelBloodMission(int What
) { OmmelBloodMission
= What
; }
352 static int GetRegiiTalkState() { return RegiiTalkState
; }
353 static void SetRegiiTalkState(int What
) { RegiiTalkState
= What
; }
354 static void SetIsInGetCommand(truth What
) { InGetCommand
= What
; }
355 static truth
IsInGetCommand() { return InGetCommand
; }
356 static festring
GetHomeDir();
357 static festring
GetSavePath();
358 static festring
GetGameDir();
359 static festring
GetBonePath();
360 static truth
PlayerWasHurtByExplosion() { return PlayerHurtByExplosion
; }
361 static void SetPlayerWasHurtByExplosion(truth What
) { PlayerHurtByExplosion
= What
; }
362 static void SetCurrentArea(area
* What
) { CurrentArea
= What
; }
363 static void SetCurrentLevel(level
* What
) { CurrentLevel
= What
; }
364 static void SetCurrentWSquareMap(wsquare
*** What
) { CurrentWSquareMap
= What
; }
365 static void SetCurrentLSquareMap(lsquare
*** What
) { CurrentLSquareMap
= What
; }
366 static festring
& GetDefaultPolymorphTo() { return DefaultPolymorphTo
; }
367 static festring
& GetDefaultSummonMonster() { return DefaultSummonMonster
; }
368 static festring
& GetDefaultChangeMaterial() { return DefaultChangeMaterial
; }
369 static festring
& GetDefaultDetectMaterial() { return DefaultDetectMaterial
; }
370 static festring
& GetDefaultTeam() { return DefaultTeam
; }
371 static void SignalDeath(ccharacter
*, ccharacter
*, festring
);
372 static void DisplayMassacreLists();
373 static void DisplayMassacreList(const massacremap
&, cchar
*, sLong
);
374 static truth
MassacreListsEmpty();
376 static void ActivateWizardMode() { WizardMode
= true; }
377 static void DeactivateWizardMode() { WizardMode
= false; }
378 static truth
WizardModeIsActive() { return WizardMode
; }
379 static void SeeWholeMap();
380 static int GetSeeWholeMapCheatMode() { return SeeWholeMapCheatMode
; }
381 static truth
GoThroughWallsCheatIsActive() { return GoThroughWallsCheat
; }
382 static void GoThroughWalls() { GoThroughWallsCheat
= !GoThroughWallsCheat
; }
384 static truth
WizardModeIsActive() { return false; }
385 static int GetSeeWholeMapCheatMode() { return 0; }
386 static truth
GoThroughWallsCheatIsActive() { return false; }
388 static truth
WizardModeIsReallyActive() { return WizardMode
; }
389 static void CreateBone();
390 static int GetQuestMonstersFound() { return QuestMonstersFound
; }
391 static void SignalQuestMonsterFound() { ++QuestMonstersFound
; }
392 static void SetQuestMonstersFound(int What
) { QuestMonstersFound
= What
; }
393 static truth
PrepareRandomBone(int);
394 static boneidmap
& GetBoneItemIDMap() { return BoneItemIDMap
; }
395 static boneidmap
& GetBoneCharacterIDMap() { return BoneCharacterIDMap
; }
396 static double CalculateAverageDanger(const charactervector
&, character
*);
397 static double CalculateAverageDangerOfAllNormalEnemies();
398 static character
* CreateGhost();
399 static truth
TooGreatDangerFound() { return TooGreatDangerFoundTruth
; }
400 static void SetTooGreatDangerFound(truth What
) { TooGreatDangerFoundTruth
= What
; }
401 static void CreateBusyAnimationCache();
402 static sLong
GetScore();
403 static truth
TweraifIsFree();
404 static truth
IsXMas();
405 static int AddToItemDrawVector(const itemvector
&);
406 static void ClearItemDrawVector();
407 static void ItemEntryDrawer(bitmap
*, v2
, uInt
);
408 static int AddToCharacterDrawVector(character
*);
409 static void ClearCharacterDrawVector();
410 static void CharacterEntryDrawer(bitmap
*, v2
, uInt
);
411 static void GodEntryDrawer(bitmap
*, v2
, uInt
);
412 static itemvectorvector
& GetItemDrawVector() { return ItemDrawVector
; }
413 static charactervector
& GetCharacterDrawVector() { return CharacterDrawVector
; }
414 static truth
IsSumoWrestling() { return SumoWrestling
; }
415 static void SetIsSumoWrestling(truth What
) { SumoWrestling
= What
; }
416 static truth
AllowHostilities() { return !SumoWrestling
; }
417 static truth
AllBodyPartsVanish() { return SumoWrestling
; }
418 static truth
TryToEnterSumoArena();
419 static truth
TryToExitSumoArena();
420 static truth
EndSumoWrestling(int);
421 static character
* GetSumo();
422 static cfestring
& GetPlayerName() { return PlayerName
; }
423 static rain
* ConstructGlobalRain();
424 static void SetGlobalRainLiquid(liquid
* What
) { GlobalRainLiquid
= What
; }
425 static void SetGlobalRainSpeed(v2 What
) { GlobalRainSpeed
= What
; }
426 static truth
PlayerIsSumoChampion() { return PlayerSumoChampion
; }
427 static truth
PlayerIsSolicitusChampion() { return PlayerSolicitusChampion
; }
428 static void MakePlayerSolicitusChampion() { PlayerSolicitusChampion
= true; }
429 static v2
GetSunLightDirectionVector();
430 static int CalculateMinimumEmitationRadius(col24
);
431 static feuLong
IncreaseSquarePartEmitationTicks();
432 static cint
GetLargeMoveDirection(int I
) { return LargeMoveDirection
[I
]; }
433 static bool Wish(character
*, cchar
*, cchar
*, bool canAbort
=false);
434 static festring
DefaultQuestion(festring
, festring
&, stringkeyhandler
= 0);
435 static void GetTime(ivantime
&);
436 static sLong
GetTurn() { return Turn
; }
437 static void IncreaseTurn() { ++Turn
; }
438 static int GetTotalMinutes() { return Tick
* 60 / 2000; }
439 static truth
PolymorphControlKeyHandler(int, festring
&);
440 static feuLong
* GetEquipmentMemory() { return EquipmentMemory
; }
441 static truth
PlayerIsRunning();
442 static void SetPlayerIsRunning(truth What
) { PlayerRunning
= What
; }
443 static truth
FillPetVector(cchar
*);
444 static truth
CommandQuestion();
445 static void NameQuestion();
446 static v2
CommandKeyHandler(v2
, int);
447 static void CommandScreen(cfestring
&, feuLong
, feuLong
, feuLong
&, feuLong
&);
448 static truth
CommandAll();
449 static double GetDangerFound() { return DangerFound
; }
450 static void SetDangerFound(double What
) { DangerFound
= What
; }
451 static col16
GetAttributeColor(int);
452 static void UpdateAttributeMemory();
453 static void InitAttributeMemory();
454 static void TeleportHandler(v2
);
455 static void PetHandler(v2
);
456 static truth
SelectPet(int);
457 static double GetGameSituationDanger();
458 static olterrain
* GetMonsterPortal() { return MonsterPortal
; }
459 static void SetMonsterPortal(olterrain
* What
) { MonsterPortal
= What
; }
460 static truth
GetCausePanicFlag() { return CausePanicFlag
; }
461 static void SetCausePanicFlag(truth What
) { CausePanicFlag
= What
; }
462 static sLong
GetTimeSpent();
463 static void AddSpecialCursor(v2
, int);
464 static void RemoveSpecialCursors();
465 static void LearnAbout(god
*);
466 static truth
PlayerKnowsAllGods();
467 static void AdjustRelationsToAllGods(int);
468 static void SetRelationsToAllGods(int);
469 static void ShowDeathSmiley(bitmap
*, truth
);
470 static void SetEnterImage(cbitmap
* What
) { EnterImage
= What
; }
471 static void SetEnterTextDisplacement (v2 What
) { EnterTextDisplacement
= What
; }
473 static int ListSelector (int defsel
, const cfestring title
, ...); // defsel<0: first
474 static int ListSelectorArray (int defsel
, cfestring
&title
, const char *items
[]); // defsel<0: first
476 static char GetAbnormalMoveKey (int idx
);
477 static void SetAbnormalMoveKey (int idx
, char ch
);
479 static truth
CheckDropLeftover (item
*i
);
481 static team
*FindTeam (cfestring
&name
);
482 //static team *FindTeam (const char *name);
484 static void ClearEventData ();
485 // return 'true' if event is 'eaten'
486 static truth
RunOnEvent (cfestring
&ename
);
487 static truth
RunOnCharEvent (character
*who
, cfestring
&ename
);
488 static truth
RunOnItemEvent (item
*what
, cfestring
&ename
);
490 static truth
RunAllowScriptStr (cfestring
&str
);
492 static festring
ldrGetVar (inputfile
*fl
, cfestring
&name
);
495 static truth
RunOnEventStr (cfestring
&name
, cfestring
&str
);
496 static truth
GetWord (festring
&w
);
497 static void SkipBlock (truth brcEaten
);
498 static void UpdateCameraCoordinate (int &, int, int, int);
499 static truth
DoOnEvent (truth brcEaten
, truth AllowScript
=false);
500 static int ParseFuncArgs (cfestring
&types
, std::vector
<FuncArg
> &args
, inputfile
*fl
=0, truth noterm
=false);
503 static cchar
* const Alignment
[];
505 static int CurrentLevelIndex
;
506 static int CurrentDungeonIndex
;
507 static cint MoveNormalCommandKey
[];
508 static int MoveAbnormalCommandKey
[];
509 static cv2 MoveVector
[];
510 static cv2 RelativeMoveVector
[];
511 static cv2 BasicMoveVector
[];
512 static cv2 LargeMoveVector
[];
513 static uChar
*** LuxTable
;
514 static truth Running
;
515 static character
* Player
;
518 static festring AutoSaveFileName
;
519 static truth InWilderness
;
520 static worldmap
* WorldMap
;
521 static area
* AreaInLoad
;
522 static square
* SquareInLoad
;
523 static dungeon
** Dungeon
;
524 static feuLong NextCharacterID
;
525 static feuLong NextItemID
;
526 static feuLong NextTrapID
;
528 static feuLong LOSTick
;
529 static truth LOSUpdateRequested
;
530 static character
* Petrus
;
531 static truth Loading
;
532 static truth JumpToPlayerBe
;
533 static gamescript
* GameScript
;
534 static valuemap GlobalValueMap
;
537 static truth Generating
;
538 static dangermap DangerMap
;
539 static int NextDangerIDType
;
540 static int NextDangerIDConfigIndex
;
541 static double AveragePlayerArmStrengthExperience
;
542 static double AveragePlayerLegStrengthExperience
;
543 static double AveragePlayerDexterityExperience
;
544 static double AveragePlayerAgilityExperience
;
545 static characteridmap CharacterIDMap
;
546 static itemidmap ItemIDMap
;
547 static trapidmap TrapIDMap
;
550 static int StoryState
;
551 static int MondedrPass
;
552 static int RingOfThieves
;
555 static int LoricatusHammer
;
556 static int Liberator
;
557 static int OmmelBloodMission
;
558 static int RegiiTalkState
;
559 static truth InGetCommand
;
560 static truth PlayerHurtByExplosion
;
561 static area
* CurrentArea
;
562 static level
* CurrentLevel
;
563 static wsquare
*** CurrentWSquareMap
;
564 static lsquare
*** CurrentLSquareMap
;
565 static festring DefaultPolymorphTo
;
566 static festring DefaultSummonMonster
;
567 static festring DefaultWish
;
568 static festring DefaultChangeMaterial
;
569 static festring DefaultDetectMaterial
;
570 static festring DefaultTeam
;
571 static massacremap PlayerMassacreMap
;
572 static massacremap PetMassacreMap
;
573 static massacremap MiscMassacreMap
;
574 static sLong PlayerMassacreAmount
;
575 static sLong PetMassacreAmount
;
576 static sLong MiscMassacreAmount
;
577 static truth WizardMode
;
578 static int SeeWholeMapCheatMode
;
579 static truth GoThroughWallsCheat
;
580 static int QuestMonstersFound
;
581 static boneidmap BoneItemIDMap
;
582 static boneidmap BoneCharacterIDMap
;
583 static truth TooGreatDangerFoundTruth
;
584 static bitmap
* BusyAnimationCache
[32];
585 static itemvectorvector ItemDrawVector
;
586 static charactervector CharacterDrawVector
;
587 static truth SumoWrestling
;
588 static festring PlayerName
;
589 static liquid
* GlobalRainLiquid
;
590 static v2 GlobalRainSpeed
;
591 static sLong GlobalRainTimeModifier
;
592 static truth PlayerSumoChampion
;
593 static truth PlayerSolicitusChampion
;
594 static feuLong SquarePartEmitationTick
;
595 static cint LargeMoveDirection
[];
597 static feuLong EquipmentMemory
[MAX_EQUIPMENT_SLOTS
];
598 static truth PlayerRunning
;
599 static character
* LastPetUnderCursor
;
600 static charactervector PetVector
;
601 static double DangerFound
;
602 static int OldAttribute
[ATTRIBUTES
];
603 static int NewAttribute
[ATTRIBUTES
];
604 static int LastAttributeChangeTick
[ATTRIBUTES
];
605 static int NecroCounter
;
606 static int CursorData
;
607 static olterrain
* MonsterPortal
;
608 static truth CausePanicFlag
;
609 static time_t TimePlayedBeforeLastLoad
;
610 static time_t LastLoad
;
611 static time_t GameBegan
;
612 static std::vector
<v2
> SpecialCursorPos
;
613 static std::vector
<int> SpecialCursorData
;
614 static truth PlayerHasReceivedAllGodsKnownBonus
;
615 static cbitmap
* EnterImage
;
616 static v2 EnterTextDisplacement
;
618 static std::stack
<inputfile
*> mFEStack
;
621 static character
*mChar
;
622 static ccharacter
*mActor
;
623 static ccharacter
*mSecondActor
;
628 inline void game::CombineLights(col24
& L1
, col24 L2
)
634 sLong Red1
= L1
& 0xFF0000, Red2
= L2
& 0xFF0000;
635 sLong New
= Red1
>= Red2
? Red1
: Red2
;
636 sLong Green1
= L1
& 0xFF00, Green2
= L2
& 0xFF00;
637 New
|= Green1
>= Green2
? Green1
: Green2
;
638 sLong Blue1
= L1
& 0xFF, Blue2
= L2
& 0xFF;
639 L1
= Blue1
>= Blue2
? New
| Blue1
: New
| Blue2
;
646 inline col24
game::CombineConstLights(col24 L1
, col24 L2
)
648 CombineLights(L1
, L2
);
652 inline truth
game::IsDark(col24 Light
)
655 || ((Light
& 0xFF0000) < (LIGHT_BORDER
<< 16)
656 && (Light
& 0x00FF00) < (LIGHT_BORDER
<< 8)
657 && (Light
& 0x0000FF) < LIGHT_BORDER
);
660 inline int game::CompareLights(col24 L1
, col24 L2
)
664 if((L1
& 0xFF0000) > (L2
& 0xFF0000)
665 || (L1
& 0x00FF00) > (L2
& 0x00FF00)
666 || (L1
& 0x0000FF) > (L2
& 0x0000FF))
668 else if((L1
& 0xFF0000) == (L2
& 0xFF0000)
669 || (L1
& 0x00FF00) == (L2
& 0x00FF00)
670 || (L1
& 0x0000FF) == (L2
& 0x0000FF))
679 inline v2
game::CalculateScreenCoordinates(v2 Pos
)
681 return v2((Pos
.X
- Camera
.X
+ 1) << 4, (Pos
.Y
- Camera
.Y
+ 2) << 4);