From e54aeb96aa07b5a89a897e84484c265b5b90cccd Mon Sep 17 00:00:00 2001 From: lalien Date: Wed, 19 Apr 2006 11:32:51 +0000 Subject: [PATCH] Original Source for 1.13 Mod High Resolution version from 12/06/05 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@21 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Cheats.h | 65 + Credits.cpp | 1467 ++ Credits.h | 10 + Editor/Button Defines.h | 267 + Editor/Cursor Modes.cpp | 464 + Editor/Cursor Modes.h | 38 + Editor/Editor All.h | 127 + Editor/Editor Callback Prototypes.h | 157 + Editor/Editor Callbacks.cpp | 1342 ++ Editor/Editor Modes.cpp | 395 + Editor/Editor Modes.h | 17 + Editor/Editor Taskbar Creation.cpp | 809 + Editor/Editor Taskbar Creation.h | 10 + Editor/Editor Taskbar Utils.cpp | 984 + Editor/Editor Taskbar Utils.h | 70 + Editor/Editor Undo.cpp | 999 + Editor/Editor Undo.h | 22 + Editor/Editor.dep | 147 + Editor/Editor.dsp | 450 + Editor/Editor.mak | 1274 ++ Editor/Editor.vcproj | 2321 ++ Editor/EditorBuildings.cpp | 765 + Editor/EditorBuildings.h | 67 + Editor/EditorDefines.h | 264 + Editor/EditorItems.cpp | 1641 ++ Editor/EditorItems.h | 69 + Editor/EditorMapInfo.cpp | 300 + Editor/EditorMapInfo.h | 35 + Editor/EditorMercs.cpp | 3743 ++++ Editor/EditorMercs.h | 156 + Editor/EditorTerrain.cpp | 284 + Editor/EditorTerrain.h | 43 + Editor/Item Statistics.cpp | 1541 ++ Editor/Item Statistics.h | 97 + Editor/LoadScreen.cpp | 1174 + Editor/LoadScreen.h | 60 + Editor/Road Smoothing.cpp | 450 + Editor/Road Smoothing.h | 64 + Editor/Sector Summary.cpp | 3101 +++ Editor/Sector Summary.h | 35 + Editor/SmartMethod.cpp | 628 + Editor/SmartMethod.h | 48 + Editor/Smoothing Utils.cpp | 469 + Editor/Smoothing Utils.h | 65 + Editor/Summary Info.h | 109 + Editor/edit_sys.cpp | 1446 ++ Editor/edit_sys.h | 80 + Editor/editscreen.cpp | 3842 ++++ Editor/editscreen.h | 83 + Editor/messagebox.cpp | 167 + Editor/messagebox.h | 51 + Editor/newsmooth.cpp | 1190 ++ Editor/newsmooth.h | 28 + Editor/popupmenu.cpp | 497 + Editor/popupmenu.h | 106 + Editor/selectwin.cpp | 1671 ++ Editor/selectwin.h | 186 + Editor/smooth.cpp | 733 + Editor/smooth.h | 34 + Fade Screen.cpp | 698 + Fade Screen.h | 40 + GameInitOptionsScreen.cpp | 1355 ++ GameInitOptionsScreen.h | 12 + GameSettings.cpp | 734 + GameSettings.h | 206 + GameVersion.cpp | 41 + GameVersion.h | 34 + HelpScreen.cpp | 2570 +++ HelpScreen.h | 75 + HelpScreenText.h | 178 + Init.cpp | 563 + Init.h | 9 + Intro.cpp | 518 + Intro.h | 26 + JA2 All.h | 162 + JA2 Demo Ads.h | 6 + JA2 Splash.cpp | 71 + JA2 Splash.h | 9 + JA2.dep | 4179 ++++ JA2.dsp | 461 + JA2.dsw | 185 + JA2.mak | 2273 ++ JA2.opt | Bin 0 -> 106496 bytes JA2.plg | 1288 ++ JA2.sln | 207 + JA2.suo | Bin 0 -> 66560 bytes JA2.vcproj | 2429 +++ Language Defines.h | 21 + Laptop/AimArchives.cpp | 703 + Laptop/AimArchives.h | 16 + Laptop/AimFacialIndex.cpp | 338 + Laptop/AimFacialIndex.h | 32 + Laptop/AimHistory.cpp | 626 + Laptop/AimHistory.h | 17 + Laptop/AimLinks.cpp | 181 + Laptop/AimLinks.h | 16 + Laptop/AimMembers.cpp | 4440 ++++ Laptop/AimMembers.h | 45 + Laptop/AimPolicies.cpp | 891 + Laptop/AimPolicies.h | 17 + Laptop/AimSort.cpp | 751 + Laptop/AimSort.h | 25 + Laptop/BobbyR.cpp | 923 + Laptop/BobbyR.h | 71 + Laptop/BobbyRAmmo.cpp | 99 + Laptop/BobbyRAmmo.h | 18 + Laptop/BobbyRArmour.cpp | 99 + Laptop/BobbyRArmour.h | 18 + Laptop/BobbyRGuns.cpp | 1793 ++ Laptop/BobbyRGuns.h | 65 + Laptop/BobbyRMailOrder.cpp | 2453 +++ Laptop/BobbyRMailOrder.h | 87 + Laptop/BobbyRMisc.cpp | 96 + Laptop/BobbyRMisc.h | 18 + Laptop/BobbyRShipments.cpp | 417 + Laptop/BobbyRShipments.h | 21 + Laptop/BobbyRUsed.cpp | 96 + Laptop/BobbyRUsed.h | 18 + Laptop/BrokenLink.cpp | 67 + Laptop/BrokenLink.h | 20 + Laptop/CharProfile.cpp | 729 + Laptop/CharProfile.h | 93 + Laptop/GunEmporium.cpp | 33 + Laptop/GunEmporium.h | 16 + Laptop/IMP AboutUs.cpp | 133 + Laptop/IMP AboutUs.h | 10 + Laptop/IMP Attribute Entrance.cpp | 127 + Laptop/IMP Attribute Entrance.h | 11 + Laptop/IMP Attribute Finish.cpp | 211 + Laptop/IMP Attribute Finish.h | 10 + Laptop/IMP Attribute Selection.cpp | 1821 ++ Laptop/IMP Attribute Selection.h | 24 + Laptop/IMP Begin Screen.cpp | 1544 ++ Laptop/IMP Begin Screen.h | 12 + Laptop/IMP Compile Character.cpp | 1001 + Laptop/IMP Compile Character.h | 25 + Laptop/IMP Confirm.cpp | 850 + Laptop/IMP Confirm.h | 17 + Laptop/IMP Finish.cpp | 694 + Laptop/IMP Finish.h | 13 + Laptop/IMP HomePage.cpp | 483 + Laptop/IMP HomePage.h | 16 + Laptop/IMP MainPage.cpp | 881 + Laptop/IMP MainPage.h | 28 + Laptop/IMP Personality Entrance.cpp | 130 + Laptop/IMP Personality Entrance.h | 10 + Laptop/IMP Personality Finish.cpp | 392 + Laptop/IMP Personality Finish.h | 12 + Laptop/IMP Personality Quiz.cpp | 1862 ++ Laptop/IMP Personality Quiz.h | 15 + Laptop/IMP Portraits.cpp | 393 + Laptop/IMP Portraits.h | 13 + Laptop/IMP Skill Trait.cpp | 693 + Laptop/IMP Skill Trait.h | 35 + Laptop/IMP Text System.cpp | 435 + Laptop/IMP Text System.h | 147 + Laptop/IMP Voices.cpp | 520 + Laptop/IMP Voices.h | 12 + Laptop/IMPVideoObjects.cpp | 1423 ++ Laptop/IMPVideoObjects.h | 175 + Laptop/Insurance Text.h | 97 + Laptop/Laptop All.h | 141 + Laptop/Laptop.dep | 9978 +++++++++ Laptop/Laptop.dsp | 697 + Laptop/Laptop.mak | 2540 +++ Laptop/Laptop.vcproj | 4865 +++++ Laptop/LaptopSave.h | 184 + Laptop/Speck Quotes.h | 119 + Laptop/Store Inventory.cpp | 924 + Laptop/Store Inventory.h | 39 + Laptop/aim.cpp | 1262 ++ Laptop/aim.h | 105 + Laptop/email.cpp | 5171 +++++ Laptop/email.h | 302 + Laptop/files.cpp | 1834 ++ Laptop/files.h | 83 + Laptop/finances.cpp | 2717 +++ Laptop/finances.h | 76 + Laptop/florist Cards.cpp | 226 + Laptop/florist Cards.h | 19 + Laptop/florist Gallery.cpp | 421 + Laptop/florist Gallery.h | 24 + Laptop/florist Order Form.cpp | 1322 ++ Laptop/florist Order Form.h | 15 + Laptop/florist.cpp | 302 + Laptop/florist.h | 32 + Laptop/funeral.cpp | 355 + Laptop/funeral.h | 16 + Laptop/history.cpp | 1761 ++ Laptop/history.h | 129 + Laptop/insurance Comments.cpp | 218 + Laptop/insurance Comments.h | 10 + Laptop/insurance Contract.cpp | 1745 ++ Laptop/insurance Contract.h | 31 + Laptop/insurance Info.cpp | 574 + Laptop/insurance Info.h | 12 + Laptop/insurance.cpp | 399 + Laptop/insurance.h | 46 + Laptop/laptop.cpp | 6388 ++++++ Laptop/laptop.h | 197 + Laptop/mercs Account.cpp | 533 + Laptop/mercs Account.h | 12 + Laptop/mercs Files.cpp | 706 + Laptop/mercs Files.h | 10 + Laptop/mercs No Account.cpp | 194 + Laptop/mercs No Account.h | 10 + Laptop/mercs.cpp | 2678 +++ Laptop/mercs.h | 103 + Laptop/personnel.cpp | 7159 +++++++ Laptop/personnel.h | 45 + Laptop/sirtech.cpp | 37 + Laptop/sirtech.h | 16 + Loading Screen.cpp | 964 + Loading Screen.h | 65 + MainMenuScreen.cpp | 705 + Makefile | 72 + MessageBoxScreen.cpp | 1277 ++ MessageBoxScreen.h | 108 + Options Screen.cpp | 1417 ++ Options Screen.h | 29 + Res/ja2.aps | Bin 0 -> 20816 bytes Res/ja2.rc | 111 + Res/jagged3.ico | Bin 0 -> 2246 bytes Res/resource.h | 23 + SCREENS.H | 37 + SCREENS.cpp | 51 + SMACKW32.LIB | Bin 0 -> 42534 bytes SaveLoadGame.cpp | 5427 +++++ SaveLoadGame.h | 82 + SaveLoadScreen.cpp | 2557 +++ SaveLoadScreen.h | 43 + Standard Gaming Platform/Bitmap.h | 63 + .../Button Sound Control.cpp | 193 + .../Button Sound Control.h | 20 + Standard Gaming Platform/Button System.cpp | 4416 ++++ Standard Gaming Platform/Button System.h | 369 + Standard Gaming Platform/Compression.cpp | 165 + Standard Gaming Platform/Compression.h | 52 + Standard Gaming Platform/Container.cpp | 2112 ++ Standard Gaming Platform/Container.h | 132 + Standard Gaming Platform/Cursor Control.cpp | 653 + Standard Gaming Platform/Cursor Control.h | 119 + Standard Gaming Platform/DEBUG.H | 172 + Standard Gaming Platform/DEBUG.cpp | 638 + Standard Gaming Platform/DbMan.cpp | 1038 + Standard Gaming Platform/DbMan.h | 87 + Standard Gaming Platform/DirectDraw Calls.cpp | 541 + Standard Gaming Platform/DirectDraw Calls.h | 97 + Standard Gaming Platform/DirectX Common.cpp | 244 + Standard Gaming Platform/DirectX Common.h | 29 + Standard Gaming Platform/English.cpp | 1040 + .../ExceptionHandling.cpp | 558 + Standard Gaming Platform/ExceptionHandling.h | 31 + Standard Gaming Platform/FileCat.cpp | 97 + Standard Gaming Platform/FileCat.h | 48 + Standard Gaming Platform/FileMan.cpp | 2102 ++ Standard Gaming Platform/FileMan.h | 199 + Standard Gaming Platform/Flic.cpp | 1699 ++ Standard Gaming Platform/Font.cpp | 2692 +++ Standard Gaming Platform/Font.h | 194 + Standard Gaming Platform/Install.cpp | 64 + Standard Gaming Platform/Install.h | 52 + Standard Gaming Platform/JA2 SGP ALL.H | 98 + Standard Gaming Platform/Ja2 Libs.cpp | 52 + Standard Gaming Platform/Ja2 Libs.h | 56 + Standard Gaming Platform/LibraryDataBase.cpp | 1124 + Standard Gaming Platform/LibraryDataBase.h | 215 + Standard Gaming Platform/MemMan.cpp | 753 + Standard Gaming Platform/MemMan.h | 106 + Standard Gaming Platform/Mss-old.h | 4082 ++++ Standard Gaming Platform/Mss.h | 4805 +++++ Standard Gaming Platform/Mutex Manager.cpp | 223 + Standard Gaming Platform/Mutex Manager.h | 20 + Standard Gaming Platform/PCX.cpp | 382 + Standard Gaming Platform/RAD.H | 638 + Standard Gaming Platform/Random.cpp | 109 + Standard Gaming Platform/RegInst.cpp | 386 + Standard Gaming Platform/RegInst.h | 75 + Standard Gaming Platform/SMACK.H | 434 + Standard Gaming Platform/STCI.cpp | 405 + Standard Gaming Platform/STCI.h | 5 + .../Standard Gaming Platform.dep | 2682 +++ .../Standard Gaming Platform.dsp | 650 + .../Standard Gaming Platform.mak | 2707 +++ .../Standard Gaming Platform.vcproj | 2892 +++ Standard Gaming Platform/TopicIDs.h | 66 + Standard Gaming Platform/TopicOps.h | 25 + Standard Gaming Platform/Types.h | 134 + Standard Gaming Platform/WCheck.h | 14 + Standard Gaming Platform/WinFont.cpp | 358 + Standard Gaming Platform/WinFont.h | 24 + Standard Gaming Platform/WizShare.h | 54 + Standard Gaming Platform/ZCONF.H | 184 + Standard Gaming Platform/ZLIB.H | 780 + Standard Gaming Platform/ddraw.h | 3102 +++ Standard Gaming Platform/ddraw.lib | Bin 0 -> 13958 bytes Standard Gaming Platform/dsound.h | 366 + Standard Gaming Platform/english.h | 133 + Standard Gaming Platform/expat.h | 1001 + Standard Gaming Platform/flic.h | 224 + Standard Gaming Platform/himage.cpp | 1015 + Standard Gaming Platform/himage.h | 215 + Standard Gaming Platform/imgfmt.h | 92 + Standard Gaming Platform/impTGA.cpp | 463 + Standard Gaming Platform/impTGA.h | 54 + Standard Gaming Platform/input.cpp | 1653 ++ Standard Gaming Platform/input.h | 140 + Standard Gaming Platform/line.cpp | 690 + Standard Gaming Platform/line.h | 80 + Standard Gaming Platform/mousesystem.cpp | 1711 ++ Standard Gaming Platform/mousesystem.h | 232 + Standard Gaming Platform/mousesystem_macros.h | 40 + Standard Gaming Platform/pcx.h | 40 + Standard Gaming Platform/random.h | 42 + Standard Gaming Platform/readdir.cpp | 22 + Standard Gaming Platform/readdir.h | 27 + Standard Gaming Platform/sgp.cpp | 1006 + Standard Gaming Platform/sgp.h | 58 + Standard Gaming Platform/shading.cpp | 318 + Standard Gaming Platform/shading.h | 39 + Standard Gaming Platform/soundman.cpp | 3247 +++ Standard Gaming Platform/soundman.h | 264 + Standard Gaming Platform/stringicmp.cpp | 27 + Standard Gaming Platform/stringicmp.h | 16 + Standard Gaming Platform/timer.cpp | 73 + Standard Gaming Platform/timer.h | 30 + Standard Gaming Platform/trle.h | 31 + Standard Gaming Platform/video.cpp | 3162 +++ Standard Gaming Platform/video.h | 99 + Standard Gaming Platform/video_private.h | 21 + Standard Gaming Platform/vobject.cpp | 1608 ++ Standard Gaming Platform/vobject.h | 279 + Standard Gaming Platform/vobject_blitters.cpp | 17623 ++++++++++++++++ Standard Gaming Platform/vobject_blitters.h | 194 + Standard Gaming Platform/vobject_private.h | 4 + Standard Gaming Platform/vsurface.cpp | 2670 +++ Standard Gaming Platform/vsurface.h | 276 + Standard Gaming Platform/vsurface_private.h | 18 + Strategic/AI Viewer.cpp | 2041 ++ Strategic/Assignments.cpp | 11527 ++++++++++ Strategic/Assignments.h | 334 + Strategic/Auto Resolve.cpp | 4699 ++++ Strategic/Auto Resolve.h | 22 + Strategic/Campaign Init.cpp | 373 + Strategic/Campaign Init.h | 9 + Strategic/Campaign Types.h | 270 + Strategic/Creature Spreading.cpp | 1660 ++ Strategic/Creature Spreading.h | 58 + Strategic/Game Clock.cpp | 1210 ++ Strategic/Game Clock.h | 204 + Strategic/Game Event Hook.cpp | 472 + Strategic/Game Event Hook.h | 163 + Strategic/Game Events.cpp | 785 + Strategic/Game Events.h | 49 + Strategic/Game Init.cpp | 843 + Strategic/Game Init.h | 18 + Strategic/Hourly Update.cpp | 329 + Strategic/Map Screen Helicopter.cpp | 2305 ++ Strategic/Map Screen Helicopter.h | 265 + Strategic/Map Screen Interface Border.cpp | 1599 ++ Strategic/Map Screen Interface Border.h | 112 + Strategic/Map Screen Interface Bottom.cpp | 1822 ++ Strategic/Map Screen Interface Bottom.h | 65 + .../Map Screen Interface Map Inventory.cpp | 2188 ++ .../Map Screen Interface Map Inventory.h | 60 + Strategic/Map Screen Interface Map.cpp | 7115 +++++++ Strategic/Map Screen Interface Map.h | 274 + .../Map Screen Interface TownMine Info.cpp | 922 + .../Map Screen Interface TownMine Info.h | 15 + Strategic/Map Screen Interface.cpp | 6473 ++++++ Strategic/Map Screen Interface.h | 606 + Strategic/Meanwhile.cpp | 1326 ++ Strategic/Meanwhile.h | 106 + Strategic/Merc Contract.cpp | 1523 ++ Strategic/Merc Contract.h | 88 + Strategic/Player Command.cpp | 467 + Strategic/Player Command.h | 32 + Strategic/PreBattle Interface.cpp | 2048 ++ Strategic/PreBattle Interface.h | 101 + Strategic/Queen Command.cpp | 1879 ++ Strategic/Queen Command.h | 58 + Strategic/Quest Debug System.cpp | 4059 ++++ Strategic/Quest Debug System.h | 16 + Strategic/QuestText.cpp | 609 + Strategic/QuestText.h | 15 + Strategic/Quests.cpp | 1390 ++ Strategic/Quests.h | 571 + Strategic/Scheduling.cpp | 1389 ++ Strategic/Scheduling.h | 111 + Strategic/Strategic AI.cpp | 5516 +++++ Strategic/Strategic AI.h | 142 + Strategic/Strategic All.h | 229 + Strategic/Strategic Event Handler.cpp | 1189 ++ Strategic/Strategic Event Handler.h | 33 + Strategic/Strategic Merc Handler.cpp | 1099 + Strategic/Strategic Merc Handler.h | 13 + Strategic/Strategic Mines.cpp | 1321 ++ Strategic/Strategic Mines.h | 204 + Strategic/Strategic Movement Costs.cpp | 2815 +++ Strategic/Strategic Movement.cpp | 5157 +++++ Strategic/Strategic Movement.h | 306 + Strategic/Strategic Pathing.cpp | 2091 ++ Strategic/Strategic Pathing.h | 127 + Strategic/Strategic Status.cpp | 405 + Strategic/Strategic Status.h | 133 + Strategic/Strategic Town Loyalty.cpp | 1984 ++ Strategic/Strategic Town Loyalty.h | 207 + Strategic/Strategic Turns.cpp | 110 + Strategic/Strategic Turns.h | 11 + Strategic/Strategic.dep | 8621 ++++++++ Strategic/Strategic.dsp | 550 + Strategic/Strategic.mak | 1906 ++ Strategic/Strategic.vcproj | 3623 ++++ Strategic/Town Militia.cpp | 1284 ++ Strategic/Town Militia.h | 81 + Strategic/mapscreen.cpp | 12885 +++++++++++ Strategic/mapscreen.h | 81 + Strategic/strategic town reputation.cpp | 205 + Strategic/strategic town reputation.h | 36 + Strategic/strategic.cpp | 129 + Strategic/strategic.h | 49 + Strategic/strategicmap.cpp | 5257 +++++ Strategic/strategicmap.h | 183 + Sys Globals.cpp | 41 + Sys Globals.h | 81 + Tactical/Action Items.h | 33 + Tactical/Air Raid.cpp | 1593 ++ Tactical/Air Raid.h | 65 + Tactical/Animation Cache.cpp | 167 + Tactical/Animation Cache.h | 28 + Tactical/Animation Control.cpp | 3582 ++++ Tactical/Animation Control.h | 571 + Tactical/Animation Data.cpp | 1106 + Tactical/Animation Data.h | 571 + Tactical/Arms Dealer Init.cpp | 2864 +++ Tactical/Arms Dealer Init.h | 299 + Tactical/ArmsDealerInvInit.cpp | 1475 ++ Tactical/ArmsDealerInvInit.h | 76 + Tactical/Auto Bandage.cpp | 1209 ++ Tactical/Auto Bandage.h | 19 + Tactical/Boxing.cpp | 514 + Tactical/Boxing.h | 46 + Tactical/Bullets.h | 89 + Tactical/Campaign.cpp | 1570 ++ Tactical/Campaign.h | 89 + Tactical/Civ Quotes.cpp | 844 + Tactical/Civ Quotes.h | 87 + Tactical/Dialogue Control.cpp | 2874 +++ Tactical/Dialogue Control.h | 350 + Tactical/DisplayCover.cpp | 1046 + Tactical/DisplayCover.h | 22 + Tactical/Drugs And Alcohol.cpp | 459 + Tactical/Drugs And Alcohol.h | 35 + Tactical/End Game.cpp | 482 + Tactical/End Game.h | 22 + Tactical/Enemy Soldier Save.cpp | 2172 ++ Tactical/Enemy Soldier Save.h | 25 + Tactical/Faces.cpp | 2284 ++ Tactical/GAP.H | 21 + Tactical/GAP.cpp | 273 + Tactical/Handle Doors.cpp | 1442 ++ Tactical/Handle Doors.h | 29 + Tactical/Handle Items.cpp | 5428 +++++ Tactical/Handle Items.h | 177 + Tactical/Handle UI Plan.cpp | 308 + Tactical/Handle UI Plan.h | 17 + Tactical/Handle UI.cpp | 6262 ++++++ Tactical/Handle UI.h | 346 + Tactical/Interface Control.cpp | 1049 + Tactical/Interface Control.h | 43 + Tactical/Interface Cursors.cpp | 788 + Tactical/Interface Cursors.h | 216 + Tactical/Interface Dialogue.cpp | 4940 +++++ Tactical/Interface Items.cpp | 7680 +++++++ Tactical/Interface Items.h | 159 + Tactical/Interface Panels.cpp | 6016 ++++++ Tactical/Interface Panels.h | 138 + Tactical/Interface Utils.cpp | 495 + Tactical/Interface Utils.h | 26 + Tactical/Interface.cpp | 4082 ++++ Tactical/Interface.h | 246 + Tactical/Inventory Choosing.cpp | 2674 +++ Tactical/Inventory Choosing.h | 118 + Tactical/Item Types.h | 893 + Tactical/Items.cpp | 6896 ++++++ Tactical/Items.h | 283 + Tactical/Keys.cpp | 2163 ++ Tactical/Keys.h | 255 + Tactical/LOS.cpp | 5388 +++++ Tactical/LOS.h | 172 + Tactical/Map Information.cpp | 635 + Tactical/Map Information.h | 47 + Tactical/Merc Entering.cpp | 813 + Tactical/Merc Hiring.cpp | 674 + Tactical/Merc Hiring.h | 56 + Tactical/Militia Control.cpp | 130 + Tactical/Militia Control.h | 11 + Tactical/Morale.cpp | 966 + Tactical/Morale.h | 71 + Tactical/Overhead Types.h | 353 + Tactical/Overhead.cpp | 8147 +++++++ Tactical/Overhead.h | 373 + Tactical/PATHAI.H | 123 + Tactical/PATHAI.cpp | 2855 +++ Tactical/PathAIDebug.h | 1 + Tactical/Points.cpp | 2264 ++ Tactical/Points.h | 343 + Tactical/QARRAY.cpp | 1259 ++ Tactical/Real Time Input.cpp | 1553 ++ Tactical/Rotting Corpses.cpp | 1948 ++ Tactical/Rotting Corpses.h | 188 + Tactical/ShopKeeper Interface.cpp | 7821 +++++++ Tactical/ShopKeeper Interface.h | 124 + Tactical/ShopKeeper Quotes.h | 49 + Tactical/SkillCheck.cpp | 525 + Tactical/SkillCheck.h | 48 + Tactical/Soldier Add.cpp | 1720 ++ Tactical/Soldier Add.h | 63 + Tactical/Soldier Ani.cpp | 4058 ++++ Tactical/Soldier Ani.h | 18 + Tactical/Soldier Control.cpp | 11250 ++++++++++ Tactical/Soldier Control.h | 1209 ++ Tactical/Soldier Create.cpp | 2696 +++ Tactical/Soldier Create.h | 233 + Tactical/Soldier Find.cpp | 1031 + Tactical/Soldier Find.h | 51 + Tactical/Soldier Functions.h | 27 + Tactical/Soldier Init List.cpp | 2329 ++ Tactical/Soldier Init List.h | 61 + Tactical/Soldier Profile.cpp | 1522 ++ Tactical/Soldier Profile.h | 198 + Tactical/Soldier Tile.cpp | 865 + Tactical/Soldier macros.h | 34 + Tactical/Spread Burst.cpp | 227 + Tactical/Spread burst.h | 26 + Tactical/Squads.cpp | 1586 ++ Tactical/Squads.h | 171 + Tactical/Strategic Exit GUI.cpp | 968 + Tactical/Strategic Exit GUI.h | 28 + Tactical/Structure Wrap.cpp | 570 + Tactical/Structure Wrap.h | 51 + Tactical/Tactical All.h | 230 + Tactical/Tactical Save.cpp | 3127 +++ Tactical/Tactical Save.h | 125 + Tactical/Tactical Turns.cpp | 259 + Tactical/Tactical Turns.h | 7 + Tactical/Tactical.dep | 15296 ++++++++++++++ Tactical/Tactical.dsp | 922 + Tactical/Tactical.mak | 3379 +++ Tactical/Tactical.vcproj | 6971 ++++++ Tactical/TeamTurns.cpp | 2096 ++ Tactical/TeamTurns.h | 30 + Tactical/Turn Based Input.cpp | 4958 +++++ Tactical/UI Cursors.cpp | 2220 ++ Tactical/UI Cursors.h | 28 + Tactical/Vehicles.cpp | 2527 +++ Tactical/Vehicles.h | 236 + Tactical/Weapons.cpp | 5418 +++++ Tactical/Weapons.h | 363 + Tactical/World Items.cpp | 620 + Tactical/World Items.h | 65 + Tactical/XML.h | 120 + Tactical/XML_AmmoTypes.cpp | 429 + Tactical/XML_Armour.cpp | 260 + Tactical/XML_AttachmentInfo.cpp | 266 + Tactical/XML_Attachments.cpp | 245 + Tactical/XML_BurstSoundStrings.cpp | 406 + Tactical/XML_ComboMergeInfo.cpp | 267 + Tactical/XML_CompatibleFaceItems.cpp | 245 + Tactical/XML_EnemyItemChoice.cpp | 549 + Tactical/XML_EnemyWeaponChoice.cpp | 549 + Tactical/XML_Explosive.cpp | 302 + Tactical/XML_IMPItemChoices.cpp | 557 + Tactical/XML_IncompatibleAttachments.cpp | 245 + Tactical/XML_Launchable.cpp | 245 + Tactical/XML_Magazine.cpp | 260 + Tactical/XML_Merge.cpp | 261 + Tactical/XML_Sounds.cpp | 270 + Tactical/XML_TonyInventory.cpp | 253 + Tactical/bullets.cpp | 524 + Tactical/faces.h | 249 + Tactical/fov.cpp | 904 + Tactical/fov.h | 23 + Tactical/interface Dialogue.h | 373 + Tactical/merc entering.h | 18 + Tactical/opplist.cpp | 6837 ++++++ Tactical/opplist.h | 151 + Tactical/qarray.h | 15 + Tactical/rt time defines.h | 19 + Tactical/soldier profile type.h | 364 + Tactical/soldier tile.h | 30 + TacticalAI/AI All.h | 98 + TacticalAI/AIInternals.h | 224 + TacticalAI/AIList.cpp | 940 + TacticalAI/AIList.h | 18 + TacticalAI/AIMain.cpp | 2845 +++ TacticalAI/AIUtils.cpp | 2524 +++ TacticalAI/Attacks.cpp | 2373 +++ TacticalAI/CreatureDecideAction.cpp | 1750 ++ TacticalAI/DecideAction.cpp | 5044 +++++ TacticalAI/FindLocations.cpp | 2776 +++ TacticalAI/Knowledge.cpp | 403 + TacticalAI/Medical.cpp | 459 + TacticalAI/Movement.cpp | 1172 + TacticalAI/NPC.cpp | 3419 +++ TacticalAI/NPC.h | 215 + TacticalAI/PanicButtons.cpp | 540 + TacticalAI/QuestDebug.cpp | 167 + TacticalAI/QuestDebug.h | 28 + TacticalAI/Realtime.cpp | 264 + TacticalAI/TacticalAI.dep | 1826 ++ TacticalAI/TacticalAI.dsp | 326 + TacticalAI/TacticalAI.mak | 907 + TacticalAI/TacticalAI.vcproj | 1514 ++ TacticalAI/ai.h | 256 + TileEngine/Ambient Control.cpp | 303 + TileEngine/Ambient Control.h | 50 + TileEngine/Ambient Types.h | 23 + TileEngine/Buildings.cpp | 481 + TileEngine/Buildings.h | 32 + TileEngine/Exit Grids.cpp | 409 + TileEngine/Exit Grids.h | 37 + TileEngine/Explosion Control.cpp | 3532 ++++ TileEngine/Explosion Control.h | 117 + TileEngine/Fog Of War.cpp | 35 + TileEngine/Fog Of War.h | 12 + TileEngine/Interactive Tiles.cpp | 1111 + TileEngine/Interactive Tiles.h | 50 + TileEngine/Isometric Utils.cpp | 1078 + TileEngine/Isometric Utils.h | 116 + TileEngine/LightEffects.cpp | 482 + TileEngine/LightEffects.h | 48 + TileEngine/Map Edgepoints.cpp | 1897 ++ TileEngine/Map Edgepoints.h | 84 + TileEngine/Radar Screen.cpp | 826 + TileEngine/Radar Screen.h | 42 + TileEngine/Render Dirty.cpp | 1452 ++ TileEngine/Render Dirty.h | 152 + TileEngine/Render Fun.cpp | 355 + TileEngine/Render Fun.h | 32 + TileEngine/Render Z.cpp | 247 + TileEngine/SaveLoadMap.cpp | 1197 ++ TileEngine/SaveLoadMap.h | 115 + TileEngine/Shade Table Util.cpp | 218 + TileEngine/Shade Table Util.h | 16 + TileEngine/Simple Render Utils.cpp | 38 + TileEngine/Simple Render Utils.h | 8 + TileEngine/Smell.cpp | 577 + TileEngine/Smell.h | 24 + TileEngine/SmokeEffects.cpp | 889 + TileEngine/SmokeEffects.h | 66 + TileEngine/Structure Internals.h | 245 + TileEngine/Tactical Placement GUI.cpp | 1205 ++ TileEngine/Tactical Placement GUI.h | 23 + TileEngine/Tile Animation.cpp | 872 + TileEngine/Tile Animation.h | 140 + TileEngine/Tile Cache.cpp | 380 + TileEngine/Tile Cache.h | 57 + TileEngine/Tile Surface.cpp | 199 + TileEngine/Tile Surface.h | 17 + TileEngine/TileDat.cpp | 938 + TileEngine/TileDat.h | 3257 +++ TileEngine/TileEngine All.h | 158 + TileEngine/TileEngine.dep | 6034 ++++++ TileEngine/TileEngine.dsp | 506 + TileEngine/TileEngine.mak | 1684 ++ TileEngine/TileEngine.vcproj | 3163 +++ TileEngine/World Tileset Enums.h | 89 + TileEngine/WorldDat.cpp | 234 + TileEngine/WorldDat.h | 37 + TileEngine/environment.cpp | 634 + TileEngine/environment.h | 84 + TileEngine/lighting.cpp | 3671 ++++ TileEngine/lighting.h | 206 + TileEngine/overhead map.cpp | 1810 ++ TileEngine/overhead map.h | 24 + TileEngine/phys math.cpp | 145 + TileEngine/phys math.h | 63 + TileEngine/physics.cpp | 2673 +++ TileEngine/physics.h | 106 + TileEngine/pits.cpp | 265 + TileEngine/pits.h | 20 + TileEngine/renderworld.cpp | 7461 +++++++ TileEngine/renderworld.h | 220 + TileEngine/structure.cpp | 2393 +++ TileEngine/structure.h | 127 + TileEngine/sysutil.cpp | 53 + TileEngine/sysutil.h | 21 + TileEngine/tiledef.cpp | 1315 ++ TileEngine/tiledef.h | 197 + TileEngine/worlddef.cpp | 4155 ++++ TileEngine/worlddef.h | 296 + TileEngine/worldman.cpp | 3759 ++++ TileEngine/worldman.h | 156 + Utils/Animated ProgressBar.cpp | 360 + Utils/Animated ProgressBar.h | 78 + Utils/Cinematics.cpp | 306 + Utils/Cinematics.h | 65 + Utils/Cursors.cpp | 1632 ++ Utils/Cursors.h | 255 + Utils/Debug Control.cpp | 69 + Utils/Debug Control.h | 57 + Utils/Encrypted File.cpp | 73 + Utils/Encrypted File.h | 8 + Utils/Event Manager.cpp | 239 + Utils/Event Manager.h | 33 + Utils/Event Pump.cpp | 1258 ++ Utils/Event Pump.h | 257 + Utils/Font Control.cpp | 371 + Utils/Font Control.h | 194 + Utils/INIReader.cpp | 63 + Utils/INIReader.h | 21 + Utils/MapUtility.cpp | 372 + Utils/MercTextBox.cpp | 705 + Utils/MercTextBox.h | 75 + Utils/Multi Language Graphic Utils.cpp | 359 + Utils/Multi Language Graphic Utils.h | 44 + Utils/Multilingual Text Code Generator.cpp | 159 + Utils/Multilingual Text Code Generator.h | 12 + Utils/Music Control.cpp | 557 + Utils/Music Control.h | 55 + Utils/PopUpBox.cpp | 1643 ++ Utils/PopUpBox.h | 170 + Utils/Quantize Wrap.cpp | 96 + Utils/Quantize Wrap.h | 21 + Utils/Quantize.cpp | 205 + Utils/Quantize.h | 43 + Utils/RADMAL.I | 57 + Utils/RADMALW.I | 42 + Utils/STIConvert.cpp | 830 + Utils/STIConvert.h | 11 + Utils/Slider.cpp | 778 + Utils/Slider.h | 63 + Utils/Sound Control.cpp | 1101 + Utils/Sound Control.h | 462 + Utils/Text Input.cpp | 1764 ++ Utils/Text Input.h | 195 + Utils/Text Utils.cpp | 312 + Utils/Text.h | 1426 ++ Utils/Timer Control.cpp | 351 + Utils/Timer Control.h | 124 + Utils/Utilities.cpp | 481 + Utils/Utilities.h | 33 + Utils/Utils All.h | 110 + Utils/Utils.dep | 3573 ++++ Utils/Utils.dsp | 478 + Utils/Utils.mak | 1684 ++ Utils/Utils.vcproj | 3429 +++ Utils/Win Util.cpp | 343 + Utils/Win Util.h | 12 + Utils/WordWrap.cpp | 2032 ++ Utils/WordWrap.h | 76 + Utils/XMLAccess.cpp | 410 + Utils/XML_Items.cpp | 1432 ++ Utils/XML_Strings.cpp | 265 + Utils/XML_Strings2.cpp | 0 Utils/_DutchText.cpp | 4007 ++++ Utils/_EnglishText.cpp | 4008 ++++ Utils/_FrenchText.cpp | 3987 ++++ Utils/_GermanText.cpp | 3790 ++++ Utils/_ItalianText.cpp | 3988 ++++ Utils/_Ja25EnglishText.cpp | 71 + Utils/_Ja25EnglishText.h | 43 + Utils/_Ja25GermanText.cpp | 50 + Utils/_Ja25GermanText.h | 42 + Utils/_PolishText.cpp | 3986 ++++ Utils/_RussianText.cpp | 3981 ++++ Utils/_TaiwaneseText.cpp | 3964 ++++ Utils/dsutil.cpp | 381 + Utils/dsutil.h | 215 + Utils/maputility.h | 8 + Utils/message.cpp | 1882 ++ Utils/message.h | 108 + VtuneApi.h | 58 + VtuneApi.lib | Bin 0 -> 9250 bytes aniviewscreen.cpp | 403 + builddefines.h | 38 + gameloop.cpp | 436 + gameloop.h | 22 + gamescreen.cpp | 1122 + gamescreen.h | 44 + ja2.h | 8 + jascreens.cpp | 1038 + jascreens.h | 143 + libexpatMT.lib | Bin 0 -> 231362 bytes local.h | 46 + mainmenuscreen.h | 8 + mss32.lib | Bin 0 -> 18120 bytes resource.h | 16 + screenids.h | 43 + 790 files changed, 741287 insertions(+) create mode 100644 Cheats.h create mode 100644 Credits.cpp create mode 100644 Credits.h create mode 100644 Editor/Button Defines.h create mode 100644 Editor/Cursor Modes.cpp create mode 100644 Editor/Cursor Modes.h create mode 100644 Editor/Editor All.h create mode 100644 Editor/Editor Callback Prototypes.h create mode 100644 Editor/Editor Callbacks.cpp create mode 100644 Editor/Editor Modes.cpp create mode 100644 Editor/Editor Modes.h create mode 100644 Editor/Editor Taskbar Creation.cpp create mode 100644 Editor/Editor Taskbar Creation.h create mode 100644 Editor/Editor Taskbar Utils.cpp create mode 100644 Editor/Editor Taskbar Utils.h create mode 100644 Editor/Editor Undo.cpp create mode 100644 Editor/Editor Undo.h create mode 100644 Editor/Editor.dep create mode 100644 Editor/Editor.dsp create mode 100644 Editor/Editor.mak create mode 100644 Editor/Editor.vcproj create mode 100644 Editor/EditorBuildings.cpp create mode 100644 Editor/EditorBuildings.h create mode 100644 Editor/EditorDefines.h create mode 100644 Editor/EditorItems.cpp create mode 100644 Editor/EditorItems.h create mode 100644 Editor/EditorMapInfo.cpp create mode 100644 Editor/EditorMapInfo.h create mode 100644 Editor/EditorMercs.cpp create mode 100644 Editor/EditorMercs.h create mode 100644 Editor/EditorTerrain.cpp create mode 100644 Editor/EditorTerrain.h create mode 100644 Editor/Item Statistics.cpp create mode 100644 Editor/Item Statistics.h create mode 100644 Editor/LoadScreen.cpp create mode 100644 Editor/LoadScreen.h create mode 100644 Editor/Road Smoothing.cpp create mode 100644 Editor/Road Smoothing.h create mode 100644 Editor/Sector Summary.cpp create mode 100644 Editor/Sector Summary.h create mode 100644 Editor/SmartMethod.cpp create mode 100644 Editor/SmartMethod.h create mode 100644 Editor/Smoothing Utils.cpp create mode 100644 Editor/Smoothing Utils.h create mode 100644 Editor/Summary Info.h create mode 100644 Editor/edit_sys.cpp create mode 100644 Editor/edit_sys.h create mode 100644 Editor/editscreen.cpp create mode 100644 Editor/editscreen.h create mode 100644 Editor/messagebox.cpp create mode 100644 Editor/messagebox.h create mode 100644 Editor/newsmooth.cpp create mode 100644 Editor/newsmooth.h create mode 100644 Editor/popupmenu.cpp create mode 100644 Editor/popupmenu.h create mode 100644 Editor/selectwin.cpp create mode 100644 Editor/selectwin.h create mode 100644 Editor/smooth.cpp create mode 100644 Editor/smooth.h create mode 100644 Fade Screen.cpp create mode 100644 Fade Screen.h create mode 100644 GameInitOptionsScreen.cpp create mode 100644 GameInitOptionsScreen.h create mode 100644 GameSettings.cpp create mode 100644 GameSettings.h create mode 100644 GameVersion.cpp create mode 100644 GameVersion.h create mode 100644 HelpScreen.cpp create mode 100644 HelpScreen.h create mode 100644 HelpScreenText.h create mode 100644 Init.cpp create mode 100644 Init.h create mode 100644 Intro.cpp create mode 100644 Intro.h create mode 100644 JA2 All.h create mode 100644 JA2 Demo Ads.h create mode 100644 JA2 Splash.cpp create mode 100644 JA2 Splash.h create mode 100644 JA2.dep create mode 100644 JA2.dsp create mode 100644 JA2.dsw create mode 100644 JA2.mak create mode 100644 JA2.opt create mode 100644 JA2.plg create mode 100644 JA2.sln create mode 100644 JA2.suo create mode 100644 JA2.vcproj create mode 100644 Language Defines.h create mode 100644 Laptop/AimArchives.cpp create mode 100644 Laptop/AimArchives.h create mode 100644 Laptop/AimFacialIndex.cpp create mode 100644 Laptop/AimFacialIndex.h create mode 100644 Laptop/AimHistory.cpp create mode 100644 Laptop/AimHistory.h create mode 100644 Laptop/AimLinks.cpp create mode 100644 Laptop/AimLinks.h create mode 100644 Laptop/AimMembers.cpp create mode 100644 Laptop/AimMembers.h create mode 100644 Laptop/AimPolicies.cpp create mode 100644 Laptop/AimPolicies.h create mode 100644 Laptop/AimSort.cpp create mode 100644 Laptop/AimSort.h create mode 100644 Laptop/BobbyR.cpp create mode 100644 Laptop/BobbyR.h create mode 100644 Laptop/BobbyRAmmo.cpp create mode 100644 Laptop/BobbyRAmmo.h create mode 100644 Laptop/BobbyRArmour.cpp create mode 100644 Laptop/BobbyRArmour.h create mode 100644 Laptop/BobbyRGuns.cpp create mode 100644 Laptop/BobbyRGuns.h create mode 100644 Laptop/BobbyRMailOrder.cpp create mode 100644 Laptop/BobbyRMailOrder.h create mode 100644 Laptop/BobbyRMisc.cpp create mode 100644 Laptop/BobbyRMisc.h create mode 100644 Laptop/BobbyRShipments.cpp create mode 100644 Laptop/BobbyRShipments.h create mode 100644 Laptop/BobbyRUsed.cpp create mode 100644 Laptop/BobbyRUsed.h create mode 100644 Laptop/BrokenLink.cpp create mode 100644 Laptop/BrokenLink.h create mode 100644 Laptop/CharProfile.cpp create mode 100644 Laptop/CharProfile.h create mode 100644 Laptop/GunEmporium.cpp create mode 100644 Laptop/GunEmporium.h create mode 100644 Laptop/IMP AboutUs.cpp create mode 100644 Laptop/IMP AboutUs.h create mode 100644 Laptop/IMP Attribute Entrance.cpp create mode 100644 Laptop/IMP Attribute Entrance.h create mode 100644 Laptop/IMP Attribute Finish.cpp create mode 100644 Laptop/IMP Attribute Finish.h create mode 100644 Laptop/IMP Attribute Selection.cpp create mode 100644 Laptop/IMP Attribute Selection.h create mode 100644 Laptop/IMP Begin Screen.cpp create mode 100644 Laptop/IMP Begin Screen.h create mode 100644 Laptop/IMP Compile Character.cpp create mode 100644 Laptop/IMP Compile Character.h create mode 100644 Laptop/IMP Confirm.cpp create mode 100644 Laptop/IMP Confirm.h create mode 100644 Laptop/IMP Finish.cpp create mode 100644 Laptop/IMP Finish.h create mode 100644 Laptop/IMP HomePage.cpp create mode 100644 Laptop/IMP HomePage.h create mode 100644 Laptop/IMP MainPage.cpp create mode 100644 Laptop/IMP MainPage.h create mode 100644 Laptop/IMP Personality Entrance.cpp create mode 100644 Laptop/IMP Personality Entrance.h create mode 100644 Laptop/IMP Personality Finish.cpp create mode 100644 Laptop/IMP Personality Finish.h create mode 100644 Laptop/IMP Personality Quiz.cpp create mode 100644 Laptop/IMP Personality Quiz.h create mode 100644 Laptop/IMP Portraits.cpp create mode 100644 Laptop/IMP Portraits.h create mode 100644 Laptop/IMP Skill Trait.cpp create mode 100644 Laptop/IMP Skill Trait.h create mode 100644 Laptop/IMP Text System.cpp create mode 100644 Laptop/IMP Text System.h create mode 100644 Laptop/IMP Voices.cpp create mode 100644 Laptop/IMP Voices.h create mode 100644 Laptop/IMPVideoObjects.cpp create mode 100644 Laptop/IMPVideoObjects.h create mode 100644 Laptop/Insurance Text.h create mode 100644 Laptop/Laptop All.h create mode 100644 Laptop/Laptop.dep create mode 100644 Laptop/Laptop.dsp create mode 100644 Laptop/Laptop.mak create mode 100644 Laptop/Laptop.vcproj create mode 100644 Laptop/LaptopSave.h create mode 100644 Laptop/Speck Quotes.h create mode 100644 Laptop/Store Inventory.cpp create mode 100644 Laptop/Store Inventory.h create mode 100644 Laptop/aim.cpp create mode 100644 Laptop/aim.h create mode 100644 Laptop/email.cpp create mode 100644 Laptop/email.h create mode 100644 Laptop/files.cpp create mode 100644 Laptop/files.h create mode 100644 Laptop/finances.cpp create mode 100644 Laptop/finances.h create mode 100644 Laptop/florist Cards.cpp create mode 100644 Laptop/florist Cards.h create mode 100644 Laptop/florist Gallery.cpp create mode 100644 Laptop/florist Gallery.h create mode 100644 Laptop/florist Order Form.cpp create mode 100644 Laptop/florist Order Form.h create mode 100644 Laptop/florist.cpp create mode 100644 Laptop/florist.h create mode 100644 Laptop/funeral.cpp create mode 100644 Laptop/funeral.h create mode 100644 Laptop/history.cpp create mode 100644 Laptop/history.h create mode 100644 Laptop/insurance Comments.cpp create mode 100644 Laptop/insurance Comments.h create mode 100644 Laptop/insurance Contract.cpp create mode 100644 Laptop/insurance Contract.h create mode 100644 Laptop/insurance Info.cpp create mode 100644 Laptop/insurance Info.h create mode 100644 Laptop/insurance.cpp create mode 100644 Laptop/insurance.h create mode 100644 Laptop/laptop.cpp create mode 100644 Laptop/laptop.h create mode 100644 Laptop/mercs Account.cpp create mode 100644 Laptop/mercs Account.h create mode 100644 Laptop/mercs Files.cpp create mode 100644 Laptop/mercs Files.h create mode 100644 Laptop/mercs No Account.cpp create mode 100644 Laptop/mercs No Account.h create mode 100644 Laptop/mercs.cpp create mode 100644 Laptop/mercs.h create mode 100644 Laptop/personnel.cpp create mode 100644 Laptop/personnel.h create mode 100644 Laptop/sirtech.cpp create mode 100644 Laptop/sirtech.h create mode 100644 Loading Screen.cpp create mode 100644 Loading Screen.h create mode 100644 MainMenuScreen.cpp create mode 100644 Makefile create mode 100644 MessageBoxScreen.cpp create mode 100644 MessageBoxScreen.h create mode 100644 Options Screen.cpp create mode 100644 Options Screen.h create mode 100644 Res/ja2.aps create mode 100644 Res/ja2.rc create mode 100644 Res/jagged3.ico create mode 100644 Res/resource.h create mode 100644 SCREENS.H create mode 100644 SCREENS.cpp create mode 100644 SMACKW32.LIB create mode 100644 SaveLoadGame.cpp create mode 100644 SaveLoadGame.h create mode 100644 SaveLoadScreen.cpp create mode 100644 SaveLoadScreen.h create mode 100644 Standard Gaming Platform/Bitmap.h create mode 100644 Standard Gaming Platform/Button Sound Control.cpp create mode 100644 Standard Gaming Platform/Button Sound Control.h create mode 100644 Standard Gaming Platform/Button System.cpp create mode 100644 Standard Gaming Platform/Button System.h create mode 100644 Standard Gaming Platform/Compression.cpp create mode 100644 Standard Gaming Platform/Compression.h create mode 100644 Standard Gaming Platform/Container.cpp create mode 100644 Standard Gaming Platform/Container.h create mode 100644 Standard Gaming Platform/Cursor Control.cpp create mode 100644 Standard Gaming Platform/Cursor Control.h create mode 100644 Standard Gaming Platform/DEBUG.H create mode 100644 Standard Gaming Platform/DEBUG.cpp create mode 100644 Standard Gaming Platform/DbMan.cpp create mode 100644 Standard Gaming Platform/DbMan.h create mode 100644 Standard Gaming Platform/DirectDraw Calls.cpp create mode 100644 Standard Gaming Platform/DirectDraw Calls.h create mode 100644 Standard Gaming Platform/DirectX Common.cpp create mode 100644 Standard Gaming Platform/DirectX Common.h create mode 100644 Standard Gaming Platform/English.cpp create mode 100644 Standard Gaming Platform/ExceptionHandling.cpp create mode 100644 Standard Gaming Platform/ExceptionHandling.h create mode 100644 Standard Gaming Platform/FileCat.cpp create mode 100644 Standard Gaming Platform/FileCat.h create mode 100644 Standard Gaming Platform/FileMan.cpp create mode 100644 Standard Gaming Platform/FileMan.h create mode 100644 Standard Gaming Platform/Flic.cpp create mode 100644 Standard Gaming Platform/Font.cpp create mode 100644 Standard Gaming Platform/Font.h create mode 100644 Standard Gaming Platform/Install.cpp create mode 100644 Standard Gaming Platform/Install.h create mode 100644 Standard Gaming Platform/JA2 SGP ALL.H create mode 100644 Standard Gaming Platform/Ja2 Libs.cpp create mode 100644 Standard Gaming Platform/Ja2 Libs.h create mode 100644 Standard Gaming Platform/LibraryDataBase.cpp create mode 100644 Standard Gaming Platform/LibraryDataBase.h create mode 100644 Standard Gaming Platform/MemMan.cpp create mode 100644 Standard Gaming Platform/MemMan.h create mode 100644 Standard Gaming Platform/Mss-old.h create mode 100644 Standard Gaming Platform/Mss.h create mode 100644 Standard Gaming Platform/Mutex Manager.cpp create mode 100644 Standard Gaming Platform/Mutex Manager.h create mode 100644 Standard Gaming Platform/PCX.cpp create mode 100644 Standard Gaming Platform/RAD.H create mode 100644 Standard Gaming Platform/Random.cpp create mode 100644 Standard Gaming Platform/RegInst.cpp create mode 100644 Standard Gaming Platform/RegInst.h create mode 100644 Standard Gaming Platform/SMACK.H create mode 100644 Standard Gaming Platform/STCI.cpp create mode 100644 Standard Gaming Platform/STCI.h create mode 100644 Standard Gaming Platform/Standard Gaming Platform.dep create mode 100644 Standard Gaming Platform/Standard Gaming Platform.dsp create mode 100644 Standard Gaming Platform/Standard Gaming Platform.mak create mode 100644 Standard Gaming Platform/Standard Gaming Platform.vcproj create mode 100644 Standard Gaming Platform/TopicIDs.h create mode 100644 Standard Gaming Platform/TopicOps.h create mode 100644 Standard Gaming Platform/Types.h create mode 100644 Standard Gaming Platform/WCheck.h create mode 100644 Standard Gaming Platform/WinFont.cpp create mode 100644 Standard Gaming Platform/WinFont.h create mode 100644 Standard Gaming Platform/WizShare.h create mode 100644 Standard Gaming Platform/ZCONF.H create mode 100644 Standard Gaming Platform/ZLIB.H create mode 100644 Standard Gaming Platform/ddraw.h create mode 100644 Standard Gaming Platform/ddraw.lib create mode 100644 Standard Gaming Platform/dsound.h create mode 100644 Standard Gaming Platform/english.h create mode 100644 Standard Gaming Platform/expat.h create mode 100644 Standard Gaming Platform/flic.h create mode 100644 Standard Gaming Platform/himage.cpp create mode 100644 Standard Gaming Platform/himage.h create mode 100644 Standard Gaming Platform/imgfmt.h create mode 100644 Standard Gaming Platform/impTGA.cpp create mode 100644 Standard Gaming Platform/impTGA.h create mode 100644 Standard Gaming Platform/input.cpp create mode 100644 Standard Gaming Platform/input.h create mode 100644 Standard Gaming Platform/line.cpp create mode 100644 Standard Gaming Platform/line.h create mode 100644 Standard Gaming Platform/mousesystem.cpp create mode 100644 Standard Gaming Platform/mousesystem.h create mode 100644 Standard Gaming Platform/mousesystem_macros.h create mode 100644 Standard Gaming Platform/pcx.h create mode 100644 Standard Gaming Platform/random.h create mode 100644 Standard Gaming Platform/readdir.cpp create mode 100644 Standard Gaming Platform/readdir.h create mode 100644 Standard Gaming Platform/sgp.cpp create mode 100644 Standard Gaming Platform/sgp.h create mode 100644 Standard Gaming Platform/shading.cpp create mode 100644 Standard Gaming Platform/shading.h create mode 100644 Standard Gaming Platform/soundman.cpp create mode 100644 Standard Gaming Platform/soundman.h create mode 100644 Standard Gaming Platform/stringicmp.cpp create mode 100644 Standard Gaming Platform/stringicmp.h create mode 100644 Standard Gaming Platform/timer.cpp create mode 100644 Standard Gaming Platform/timer.h create mode 100644 Standard Gaming Platform/trle.h create mode 100644 Standard Gaming Platform/video.cpp create mode 100644 Standard Gaming Platform/video.h create mode 100644 Standard Gaming Platform/video_private.h create mode 100644 Standard Gaming Platform/vobject.cpp create mode 100644 Standard Gaming Platform/vobject.h create mode 100644 Standard Gaming Platform/vobject_blitters.cpp create mode 100644 Standard Gaming Platform/vobject_blitters.h create mode 100644 Standard Gaming Platform/vobject_private.h create mode 100644 Standard Gaming Platform/vsurface.cpp create mode 100644 Standard Gaming Platform/vsurface.h create mode 100644 Standard Gaming Platform/vsurface_private.h create mode 100644 Strategic/AI Viewer.cpp create mode 100644 Strategic/Assignments.cpp create mode 100644 Strategic/Assignments.h create mode 100644 Strategic/Auto Resolve.cpp create mode 100644 Strategic/Auto Resolve.h create mode 100644 Strategic/Campaign Init.cpp create mode 100644 Strategic/Campaign Init.h create mode 100644 Strategic/Campaign Types.h create mode 100644 Strategic/Creature Spreading.cpp create mode 100644 Strategic/Creature Spreading.h create mode 100644 Strategic/Game Clock.cpp create mode 100644 Strategic/Game Clock.h create mode 100644 Strategic/Game Event Hook.cpp create mode 100644 Strategic/Game Event Hook.h create mode 100644 Strategic/Game Events.cpp create mode 100644 Strategic/Game Events.h create mode 100644 Strategic/Game Init.cpp create mode 100644 Strategic/Game Init.h create mode 100644 Strategic/Hourly Update.cpp create mode 100644 Strategic/Map Screen Helicopter.cpp create mode 100644 Strategic/Map Screen Helicopter.h create mode 100644 Strategic/Map Screen Interface Border.cpp create mode 100644 Strategic/Map Screen Interface Border.h create mode 100644 Strategic/Map Screen Interface Bottom.cpp create mode 100644 Strategic/Map Screen Interface Bottom.h create mode 100644 Strategic/Map Screen Interface Map Inventory.cpp create mode 100644 Strategic/Map Screen Interface Map Inventory.h create mode 100644 Strategic/Map Screen Interface Map.cpp create mode 100644 Strategic/Map Screen Interface Map.h create mode 100644 Strategic/Map Screen Interface TownMine Info.cpp create mode 100644 Strategic/Map Screen Interface TownMine Info.h create mode 100644 Strategic/Map Screen Interface.cpp create mode 100644 Strategic/Map Screen Interface.h create mode 100644 Strategic/Meanwhile.cpp create mode 100644 Strategic/Meanwhile.h create mode 100644 Strategic/Merc Contract.cpp create mode 100644 Strategic/Merc Contract.h create mode 100644 Strategic/Player Command.cpp create mode 100644 Strategic/Player Command.h create mode 100644 Strategic/PreBattle Interface.cpp create mode 100644 Strategic/PreBattle Interface.h create mode 100644 Strategic/Queen Command.cpp create mode 100644 Strategic/Queen Command.h create mode 100644 Strategic/Quest Debug System.cpp create mode 100644 Strategic/Quest Debug System.h create mode 100644 Strategic/QuestText.cpp create mode 100644 Strategic/QuestText.h create mode 100644 Strategic/Quests.cpp create mode 100644 Strategic/Quests.h create mode 100644 Strategic/Scheduling.cpp create mode 100644 Strategic/Scheduling.h create mode 100644 Strategic/Strategic AI.cpp create mode 100644 Strategic/Strategic AI.h create mode 100644 Strategic/Strategic All.h create mode 100644 Strategic/Strategic Event Handler.cpp create mode 100644 Strategic/Strategic Event Handler.h create mode 100644 Strategic/Strategic Merc Handler.cpp create mode 100644 Strategic/Strategic Merc Handler.h create mode 100644 Strategic/Strategic Mines.cpp create mode 100644 Strategic/Strategic Mines.h create mode 100644 Strategic/Strategic Movement Costs.cpp create mode 100644 Strategic/Strategic Movement.cpp create mode 100644 Strategic/Strategic Movement.h create mode 100644 Strategic/Strategic Pathing.cpp create mode 100644 Strategic/Strategic Pathing.h create mode 100644 Strategic/Strategic Status.cpp create mode 100644 Strategic/Strategic Status.h create mode 100644 Strategic/Strategic Town Loyalty.cpp create mode 100644 Strategic/Strategic Town Loyalty.h create mode 100644 Strategic/Strategic Turns.cpp create mode 100644 Strategic/Strategic Turns.h create mode 100644 Strategic/Strategic.dep create mode 100644 Strategic/Strategic.dsp create mode 100644 Strategic/Strategic.mak create mode 100644 Strategic/Strategic.vcproj create mode 100644 Strategic/Town Militia.cpp create mode 100644 Strategic/Town Militia.h create mode 100644 Strategic/mapscreen.cpp create mode 100644 Strategic/mapscreen.h create mode 100644 Strategic/strategic town reputation.cpp create mode 100644 Strategic/strategic town reputation.h create mode 100644 Strategic/strategic.cpp create mode 100644 Strategic/strategic.h create mode 100644 Strategic/strategicmap.cpp create mode 100644 Strategic/strategicmap.h create mode 100644 Sys Globals.cpp create mode 100644 Sys Globals.h create mode 100644 Tactical/Action Items.h create mode 100644 Tactical/Air Raid.cpp create mode 100644 Tactical/Air Raid.h create mode 100644 Tactical/Animation Cache.cpp create mode 100644 Tactical/Animation Cache.h create mode 100644 Tactical/Animation Control.cpp create mode 100644 Tactical/Animation Control.h create mode 100644 Tactical/Animation Data.cpp create mode 100644 Tactical/Animation Data.h create mode 100644 Tactical/Arms Dealer Init.cpp create mode 100644 Tactical/Arms Dealer Init.h create mode 100644 Tactical/ArmsDealerInvInit.cpp create mode 100644 Tactical/ArmsDealerInvInit.h create mode 100644 Tactical/Auto Bandage.cpp create mode 100644 Tactical/Auto Bandage.h create mode 100644 Tactical/Boxing.cpp create mode 100644 Tactical/Boxing.h create mode 100644 Tactical/Bullets.h create mode 100644 Tactical/Campaign.cpp create mode 100644 Tactical/Campaign.h create mode 100644 Tactical/Civ Quotes.cpp create mode 100644 Tactical/Civ Quotes.h create mode 100644 Tactical/Dialogue Control.cpp create mode 100644 Tactical/Dialogue Control.h create mode 100644 Tactical/DisplayCover.cpp create mode 100644 Tactical/DisplayCover.h create mode 100644 Tactical/Drugs And Alcohol.cpp create mode 100644 Tactical/Drugs And Alcohol.h create mode 100644 Tactical/End Game.cpp create mode 100644 Tactical/End Game.h create mode 100644 Tactical/Enemy Soldier Save.cpp create mode 100644 Tactical/Enemy Soldier Save.h create mode 100644 Tactical/Faces.cpp create mode 100644 Tactical/GAP.H create mode 100644 Tactical/GAP.cpp create mode 100644 Tactical/Handle Doors.cpp create mode 100644 Tactical/Handle Doors.h create mode 100644 Tactical/Handle Items.cpp create mode 100644 Tactical/Handle Items.h create mode 100644 Tactical/Handle UI Plan.cpp create mode 100644 Tactical/Handle UI Plan.h create mode 100644 Tactical/Handle UI.cpp create mode 100644 Tactical/Handle UI.h create mode 100644 Tactical/Interface Control.cpp create mode 100644 Tactical/Interface Control.h create mode 100644 Tactical/Interface Cursors.cpp create mode 100644 Tactical/Interface Cursors.h create mode 100644 Tactical/Interface Dialogue.cpp create mode 100644 Tactical/Interface Items.cpp create mode 100644 Tactical/Interface Items.h create mode 100644 Tactical/Interface Panels.cpp create mode 100644 Tactical/Interface Panels.h create mode 100644 Tactical/Interface Utils.cpp create mode 100644 Tactical/Interface Utils.h create mode 100644 Tactical/Interface.cpp create mode 100644 Tactical/Interface.h create mode 100644 Tactical/Inventory Choosing.cpp create mode 100644 Tactical/Inventory Choosing.h create mode 100644 Tactical/Item Types.h create mode 100644 Tactical/Items.cpp create mode 100644 Tactical/Items.h create mode 100644 Tactical/Keys.cpp create mode 100644 Tactical/Keys.h create mode 100644 Tactical/LOS.cpp create mode 100644 Tactical/LOS.h create mode 100644 Tactical/Map Information.cpp create mode 100644 Tactical/Map Information.h create mode 100644 Tactical/Merc Entering.cpp create mode 100644 Tactical/Merc Hiring.cpp create mode 100644 Tactical/Merc Hiring.h create mode 100644 Tactical/Militia Control.cpp create mode 100644 Tactical/Militia Control.h create mode 100644 Tactical/Morale.cpp create mode 100644 Tactical/Morale.h create mode 100644 Tactical/Overhead Types.h create mode 100644 Tactical/Overhead.cpp create mode 100644 Tactical/Overhead.h create mode 100644 Tactical/PATHAI.H create mode 100644 Tactical/PATHAI.cpp create mode 100644 Tactical/PathAIDebug.h create mode 100644 Tactical/Points.cpp create mode 100644 Tactical/Points.h create mode 100644 Tactical/QARRAY.cpp create mode 100644 Tactical/Real Time Input.cpp create mode 100644 Tactical/Rotting Corpses.cpp create mode 100644 Tactical/Rotting Corpses.h create mode 100644 Tactical/ShopKeeper Interface.cpp create mode 100644 Tactical/ShopKeeper Interface.h create mode 100644 Tactical/ShopKeeper Quotes.h create mode 100644 Tactical/SkillCheck.cpp create mode 100644 Tactical/SkillCheck.h create mode 100644 Tactical/Soldier Add.cpp create mode 100644 Tactical/Soldier Add.h create mode 100644 Tactical/Soldier Ani.cpp create mode 100644 Tactical/Soldier Ani.h create mode 100644 Tactical/Soldier Control.cpp create mode 100644 Tactical/Soldier Control.h create mode 100644 Tactical/Soldier Create.cpp create mode 100644 Tactical/Soldier Create.h create mode 100644 Tactical/Soldier Find.cpp create mode 100644 Tactical/Soldier Find.h create mode 100644 Tactical/Soldier Functions.h create mode 100644 Tactical/Soldier Init List.cpp create mode 100644 Tactical/Soldier Init List.h create mode 100644 Tactical/Soldier Profile.cpp create mode 100644 Tactical/Soldier Profile.h create mode 100644 Tactical/Soldier Tile.cpp create mode 100644 Tactical/Soldier macros.h create mode 100644 Tactical/Spread Burst.cpp create mode 100644 Tactical/Spread burst.h create mode 100644 Tactical/Squads.cpp create mode 100644 Tactical/Squads.h create mode 100644 Tactical/Strategic Exit GUI.cpp create mode 100644 Tactical/Strategic Exit GUI.h create mode 100644 Tactical/Structure Wrap.cpp create mode 100644 Tactical/Structure Wrap.h create mode 100644 Tactical/Tactical All.h create mode 100644 Tactical/Tactical Save.cpp create mode 100644 Tactical/Tactical Save.h create mode 100644 Tactical/Tactical Turns.cpp create mode 100644 Tactical/Tactical Turns.h create mode 100644 Tactical/Tactical.dep create mode 100644 Tactical/Tactical.dsp create mode 100644 Tactical/Tactical.mak create mode 100644 Tactical/Tactical.vcproj create mode 100644 Tactical/TeamTurns.cpp create mode 100644 Tactical/TeamTurns.h create mode 100644 Tactical/Turn Based Input.cpp create mode 100644 Tactical/UI Cursors.cpp create mode 100644 Tactical/UI Cursors.h create mode 100644 Tactical/Vehicles.cpp create mode 100644 Tactical/Vehicles.h create mode 100644 Tactical/Weapons.cpp create mode 100644 Tactical/Weapons.h create mode 100644 Tactical/World Items.cpp create mode 100644 Tactical/World Items.h create mode 100644 Tactical/XML.h create mode 100644 Tactical/XML_AmmoTypes.cpp create mode 100644 Tactical/XML_Armour.cpp create mode 100644 Tactical/XML_AttachmentInfo.cpp create mode 100644 Tactical/XML_Attachments.cpp create mode 100644 Tactical/XML_BurstSoundStrings.cpp create mode 100644 Tactical/XML_ComboMergeInfo.cpp create mode 100644 Tactical/XML_CompatibleFaceItems.cpp create mode 100644 Tactical/XML_EnemyItemChoice.cpp create mode 100644 Tactical/XML_EnemyWeaponChoice.cpp create mode 100644 Tactical/XML_Explosive.cpp create mode 100644 Tactical/XML_IMPItemChoices.cpp create mode 100644 Tactical/XML_IncompatibleAttachments.cpp create mode 100644 Tactical/XML_Launchable.cpp create mode 100644 Tactical/XML_Magazine.cpp create mode 100644 Tactical/XML_Merge.cpp create mode 100644 Tactical/XML_Sounds.cpp create mode 100644 Tactical/XML_TonyInventory.cpp create mode 100644 Tactical/bullets.cpp create mode 100644 Tactical/faces.h create mode 100644 Tactical/fov.cpp create mode 100644 Tactical/fov.h create mode 100644 Tactical/interface Dialogue.h create mode 100644 Tactical/merc entering.h create mode 100644 Tactical/opplist.cpp create mode 100644 Tactical/opplist.h create mode 100644 Tactical/qarray.h create mode 100644 Tactical/rt time defines.h create mode 100644 Tactical/soldier profile type.h create mode 100644 Tactical/soldier tile.h create mode 100644 TacticalAI/AI All.h create mode 100644 TacticalAI/AIInternals.h create mode 100644 TacticalAI/AIList.cpp create mode 100644 TacticalAI/AIList.h create mode 100644 TacticalAI/AIMain.cpp create mode 100644 TacticalAI/AIUtils.cpp create mode 100644 TacticalAI/Attacks.cpp create mode 100644 TacticalAI/CreatureDecideAction.cpp create mode 100644 TacticalAI/DecideAction.cpp create mode 100644 TacticalAI/FindLocations.cpp create mode 100644 TacticalAI/Knowledge.cpp create mode 100644 TacticalAI/Medical.cpp create mode 100644 TacticalAI/Movement.cpp create mode 100644 TacticalAI/NPC.cpp create mode 100644 TacticalAI/NPC.h create mode 100644 TacticalAI/PanicButtons.cpp create mode 100644 TacticalAI/QuestDebug.cpp create mode 100644 TacticalAI/QuestDebug.h create mode 100644 TacticalAI/Realtime.cpp create mode 100644 TacticalAI/TacticalAI.dep create mode 100644 TacticalAI/TacticalAI.dsp create mode 100644 TacticalAI/TacticalAI.mak create mode 100644 TacticalAI/TacticalAI.vcproj create mode 100644 TacticalAI/ai.h create mode 100644 TileEngine/Ambient Control.cpp create mode 100644 TileEngine/Ambient Control.h create mode 100644 TileEngine/Ambient Types.h create mode 100644 TileEngine/Buildings.cpp create mode 100644 TileEngine/Buildings.h create mode 100644 TileEngine/Exit Grids.cpp create mode 100644 TileEngine/Exit Grids.h create mode 100644 TileEngine/Explosion Control.cpp create mode 100644 TileEngine/Explosion Control.h create mode 100644 TileEngine/Fog Of War.cpp create mode 100644 TileEngine/Fog Of War.h create mode 100644 TileEngine/Interactive Tiles.cpp create mode 100644 TileEngine/Interactive Tiles.h create mode 100644 TileEngine/Isometric Utils.cpp create mode 100644 TileEngine/Isometric Utils.h create mode 100644 TileEngine/LightEffects.cpp create mode 100644 TileEngine/LightEffects.h create mode 100644 TileEngine/Map Edgepoints.cpp create mode 100644 TileEngine/Map Edgepoints.h create mode 100644 TileEngine/Radar Screen.cpp create mode 100644 TileEngine/Radar Screen.h create mode 100644 TileEngine/Render Dirty.cpp create mode 100644 TileEngine/Render Dirty.h create mode 100644 TileEngine/Render Fun.cpp create mode 100644 TileEngine/Render Fun.h create mode 100644 TileEngine/Render Z.cpp create mode 100644 TileEngine/SaveLoadMap.cpp create mode 100644 TileEngine/SaveLoadMap.h create mode 100644 TileEngine/Shade Table Util.cpp create mode 100644 TileEngine/Shade Table Util.h create mode 100644 TileEngine/Simple Render Utils.cpp create mode 100644 TileEngine/Simple Render Utils.h create mode 100644 TileEngine/Smell.cpp create mode 100644 TileEngine/Smell.h create mode 100644 TileEngine/SmokeEffects.cpp create mode 100644 TileEngine/SmokeEffects.h create mode 100644 TileEngine/Structure Internals.h create mode 100644 TileEngine/Tactical Placement GUI.cpp create mode 100644 TileEngine/Tactical Placement GUI.h create mode 100644 TileEngine/Tile Animation.cpp create mode 100644 TileEngine/Tile Animation.h create mode 100644 TileEngine/Tile Cache.cpp create mode 100644 TileEngine/Tile Cache.h create mode 100644 TileEngine/Tile Surface.cpp create mode 100644 TileEngine/Tile Surface.h create mode 100644 TileEngine/TileDat.cpp create mode 100644 TileEngine/TileDat.h create mode 100644 TileEngine/TileEngine All.h create mode 100644 TileEngine/TileEngine.dep create mode 100644 TileEngine/TileEngine.dsp create mode 100644 TileEngine/TileEngine.mak create mode 100644 TileEngine/TileEngine.vcproj create mode 100644 TileEngine/World Tileset Enums.h create mode 100644 TileEngine/WorldDat.cpp create mode 100644 TileEngine/WorldDat.h create mode 100644 TileEngine/environment.cpp create mode 100644 TileEngine/environment.h create mode 100644 TileEngine/lighting.cpp create mode 100644 TileEngine/lighting.h create mode 100644 TileEngine/overhead map.cpp create mode 100644 TileEngine/overhead map.h create mode 100644 TileEngine/phys math.cpp create mode 100644 TileEngine/phys math.h create mode 100644 TileEngine/physics.cpp create mode 100644 TileEngine/physics.h create mode 100644 TileEngine/pits.cpp create mode 100644 TileEngine/pits.h create mode 100644 TileEngine/renderworld.cpp create mode 100644 TileEngine/renderworld.h create mode 100644 TileEngine/structure.cpp create mode 100644 TileEngine/structure.h create mode 100644 TileEngine/sysutil.cpp create mode 100644 TileEngine/sysutil.h create mode 100644 TileEngine/tiledef.cpp create mode 100644 TileEngine/tiledef.h create mode 100644 TileEngine/worlddef.cpp create mode 100644 TileEngine/worlddef.h create mode 100644 TileEngine/worldman.cpp create mode 100644 TileEngine/worldman.h create mode 100644 Utils/Animated ProgressBar.cpp create mode 100644 Utils/Animated ProgressBar.h create mode 100644 Utils/Cinematics.cpp create mode 100644 Utils/Cinematics.h create mode 100644 Utils/Cursors.cpp create mode 100644 Utils/Cursors.h create mode 100644 Utils/Debug Control.cpp create mode 100644 Utils/Debug Control.h create mode 100644 Utils/Encrypted File.cpp create mode 100644 Utils/Encrypted File.h create mode 100644 Utils/Event Manager.cpp create mode 100644 Utils/Event Manager.h create mode 100644 Utils/Event Pump.cpp create mode 100644 Utils/Event Pump.h create mode 100644 Utils/Font Control.cpp create mode 100644 Utils/Font Control.h create mode 100644 Utils/INIReader.cpp create mode 100644 Utils/INIReader.h create mode 100644 Utils/MapUtility.cpp create mode 100644 Utils/MercTextBox.cpp create mode 100644 Utils/MercTextBox.h create mode 100644 Utils/Multi Language Graphic Utils.cpp create mode 100644 Utils/Multi Language Graphic Utils.h create mode 100644 Utils/Multilingual Text Code Generator.cpp create mode 100644 Utils/Multilingual Text Code Generator.h create mode 100644 Utils/Music Control.cpp create mode 100644 Utils/Music Control.h create mode 100644 Utils/PopUpBox.cpp create mode 100644 Utils/PopUpBox.h create mode 100644 Utils/Quantize Wrap.cpp create mode 100644 Utils/Quantize Wrap.h create mode 100644 Utils/Quantize.cpp create mode 100644 Utils/Quantize.h create mode 100644 Utils/RADMAL.I create mode 100644 Utils/RADMALW.I create mode 100644 Utils/STIConvert.cpp create mode 100644 Utils/STIConvert.h create mode 100644 Utils/Slider.cpp create mode 100644 Utils/Slider.h create mode 100644 Utils/Sound Control.cpp create mode 100644 Utils/Sound Control.h create mode 100644 Utils/Text Input.cpp create mode 100644 Utils/Text Input.h create mode 100644 Utils/Text Utils.cpp create mode 100644 Utils/Text.h create mode 100644 Utils/Timer Control.cpp create mode 100644 Utils/Timer Control.h create mode 100644 Utils/Utilities.cpp create mode 100644 Utils/Utilities.h create mode 100644 Utils/Utils All.h create mode 100644 Utils/Utils.dep create mode 100644 Utils/Utils.dsp create mode 100644 Utils/Utils.mak create mode 100644 Utils/Utils.vcproj create mode 100644 Utils/Win Util.cpp create mode 100644 Utils/Win Util.h create mode 100644 Utils/WordWrap.cpp create mode 100644 Utils/WordWrap.h create mode 100644 Utils/XMLAccess.cpp create mode 100644 Utils/XML_Items.cpp create mode 100644 Utils/XML_Strings.cpp create mode 100644 Utils/XML_Strings2.cpp create mode 100644 Utils/_DutchText.cpp create mode 100644 Utils/_EnglishText.cpp create mode 100644 Utils/_FrenchText.cpp create mode 100644 Utils/_GermanText.cpp create mode 100644 Utils/_ItalianText.cpp create mode 100644 Utils/_Ja25EnglishText.cpp create mode 100644 Utils/_Ja25EnglishText.h create mode 100644 Utils/_Ja25GermanText.cpp create mode 100644 Utils/_Ja25GermanText.h create mode 100644 Utils/_PolishText.cpp create mode 100644 Utils/_RussianText.cpp create mode 100644 Utils/_TaiwaneseText.cpp create mode 100644 Utils/dsutil.cpp create mode 100644 Utils/dsutil.h create mode 100644 Utils/maputility.h create mode 100644 Utils/message.cpp create mode 100644 Utils/message.h create mode 100644 VtuneApi.h create mode 100644 VtuneApi.lib create mode 100644 aniviewscreen.cpp create mode 100644 builddefines.h create mode 100644 gameloop.cpp create mode 100644 gameloop.h create mode 100644 gamescreen.cpp create mode 100644 gamescreen.h create mode 100644 ja2.h create mode 100644 jascreens.cpp create mode 100644 jascreens.h create mode 100644 libexpatMT.lib create mode 100644 local.h create mode 100644 mainmenuscreen.h create mode 100644 mss32.lib create mode 100644 resource.h create mode 100644 screenids.h diff --git a/Cheats.h b/Cheats.h new file mode 100644 index 00000000..aaa041a2 --- /dev/null +++ b/Cheats.h @@ -0,0 +1,65 @@ +#ifndef _CHEATS__H_ +#define _CHEATS__H_ + +#include "Language Defines.h" + + +extern UINT8 gubCheatLevel; + + + + +// GLOBALS FOR CHEAT MODE...... +#ifdef GERMAN + #ifdef JA2TESTVERSION + #define STARTING_CHEAT_LEVEL 7 + #elif defined JA2BETAVERSION + #define STARTING_CHEAT_LEVEL 5 + #else + #define STARTING_CHEAT_LEVEL 0 + #endif +#else + #ifdef JA2TESTVERSION + #define STARTING_CHEAT_LEVEL 6 + #elif defined JA2BETAVERSION + #define STARTING_CHEAT_LEVEL 3 + #else + #define STARTING_CHEAT_LEVEL 0 + #endif +#endif + + + +#ifdef GERMAN + + // ATE: remove cheats unless we're doing a debug build +//#ifdef JA2TESTVERSION + #define INFORMATION_CHEAT_LEVEL( ) ( gubCheatLevel >= 5 ) + #define CHEATER_CHEAT_LEVEL( ) ( gubCheatLevel >= 6 ) + #define DEBUG_CHEAT_LEVEL( ) ( gubCheatLevel >= 7 ) +//#else +// #define INFORMATION_CHEAT_LEVEL( ) ( FALSE ) +// #define CHEATER_CHEAT_LEVEL( ) ( FALSE ) +// #define DEBUG_CHEAT_LEVEL( ) ( FALSE ) +//#endif + + #define RESET_CHEAT_LEVEL( ) ( gubCheatLevel = 0 ) + +#else + + // ATE: remove cheats unless we're doing a debug build +//#ifdef JA2TESTVERSION + #define INFORMATION_CHEAT_LEVEL( ) ( gubCheatLevel >= 3 ) + #define CHEATER_CHEAT_LEVEL( ) ( gubCheatLevel >= 5 ) + #define DEBUG_CHEAT_LEVEL( ) ( gubCheatLevel >= 6 ) +//#else +// #define INFORMATION_CHEAT_LEVEL( ) ( FALSE ) +// #define CHEATER_CHEAT_LEVEL( ) ( FALSE ) +// #define DEBUG_CHEAT_LEVEL( ) ( FALSE ) +//#endif + + #define RESET_CHEAT_LEVEL( ) ( gubCheatLevel = 0 ) +#endif + + +#endif \ No newline at end of file diff --git a/Credits.cpp b/Credits.cpp new file mode 100644 index 00000000..9712a4aa --- /dev/null +++ b/Credits.cpp @@ -0,0 +1,1467 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" + #include "Credits.h" + #include "Encrypted File.h" +#else + #include "Types.h" + #include "Credits.h" +#endif + + + +//externals +extern HVSURFACE ghFrameBuffer; + + + +//local Defines +enum +{ + CRDT_RENDER_NONE, + CRDT_RENDER_ALL, +}; + + +//nnn +typedef struct _CRDT_NODE +{ + UINT32 uiType; //the type of node + + CHAR16 *pString; //string for the node if the node contains a string + + UINT32 uiFlags; //various flags + + INT16 sPosX; //position of the node on the screen if the node is displaying stuff + INT16 sPosY; + + INT16 sOldPosX; //position of the node on the screen if the node is displaying stuff + INT16 sOldPosY; + + INT16 sHeightOfString; //The height of the displayed string + + BOOLEAN fDelete; //Delete this loop + + UINT32 uiLastTime; // The last time the node was udated + + UINT32 uiVideoSurfaceImage; + + struct _CRDT_NODE *pPrev; + struct _CRDT_NODE *pNext; +} CRDT_NODE; + +//type of credits +enum +{ + CRDT_NODE_NONE, + CRDT_NODE_DEFAULT, // scrolls up and off the screen +}; + +//flags for the credits +//Flags: +#define CRDT_FLAG__TITLE 0x00000001 +#define CRDT_FLAG__START_SECTION 0x00000002 +#define CRDT_FLAG__END_SECTION 0x00000004 + + +//#define CRDT_NAME_OF_CREDIT_FILE "BINARYDATA\\Credits.txt" +#define CRDT_NAME_OF_CREDIT_FILE "BINARYDATA\\Credits.edt" + +#define CREDITS_LINESIZE 80 * 2 + + +// +// Code tokens +// +//new codes: +#define CRDT_START_CODE '@' +#define CRDT_SEPARATION_CODE L"," +#define CRDT_END_CODE L";" + +#define CRDT_DELAY_BN_STRINGS_CODE 'D' +#define CRDT_DELAY_BN_SECTIONS_CODE 'B' +#define CRDT_SCROLL_SPEED 'S' +#define CRDT_FONT_JUSTIFICATION 'J' +#define CRDT_TITLE_FONT_COLOR 'C' +#define CRDT_ACTIVE_FONT_COLOR 'R' + +//Flags: +#define CRDT_TITLE 'T' +#define CRDT_START_OF_SECTION '{' +#define CRDT_END_OF_SECTION '}' + + +#define CRDT_NAME_LOC_X 375 +#define CRDT_NAME_LOC_Y 420 +#define CRDT_NAME_TITLE_LOC_Y 435 +#define CRDT_NAME_FUNNY_LOC_Y 450 +#define CRDT_NAME_LOC_WIDTH 260 +#define CRDT_NAME_LOC_HEIGHT ( CRDT_NAME_FUNNY_LOC_Y - CRDT_NAME_LOC_Y + GetFontHeight( CRDT_NAME_FONT ) ) + +#define CRDT_NAME_FONT FONT12ARIAL + +#define CRDT_LINE_NODE_DISAPPEARS_AT 0//20 + +/* +//new codes: +enum +{ + CRDT_ERROR, + CRDT_CODE_DELAY_BN_STRINGS, + CRDT_CODE_SCROLL_SPEED, + CRDT_CODE_FONT_JUSIFICATION, + CRDT_CODE_FONT_COLOR, + + CRDT_NUM_CODES, +}; +*/ + + +#define CRDT_WIDTH_OF_TEXT_AREA 210 +#define CRDT_TEXT_START_LOC 10 + + +#define CRDT_SCROLL_PIXEL_AMOUNT 1 +#define CRDT_NODE_DELAY_AMOUNT 25 +#define CRDT_DELAY_BN_NODES 750 +#define CRDT_DELAY_BN_SECTIONS 2500 + +#define CRDT_SPACE_BN_SECTIONS 50 +#define CRDT_SPACE_BN_NODES 12 + +#define CRDT_START_POS_Y 479 + +#define CRDT_EYE_WIDTH 30 +#define CRDT_EYE_HEIGHT 12 + +#define CRDT_EYES_CLOSED_TIME 150 +//ddd + + + + + + + + +typedef struct +{ + INT16 sX; + INT16 sY; + INT16 sWidth; + INT16 sHeight; + + INT16 sEyeX; + INT16 sEyeY; + + INT16 sMouthX; + INT16 sMouthY; + + INT16 sBlinkFreq; + UINT32 uiLastBlinkTime; + UINT32 uiEyesClosedTime; + +} CDRT_FACE; + +CDRT_FACE gCreditFaces[] = +{ +// x y w h + 298, 137, 37, 49, 310, 157, 304, 170, 2500, 0, 0, //Camfield + 348, 137, 43, 47, 354, 153, 354, 153, 3700, 0, 0, //Shawn + 407, 132, 30, 50, 408, 151, 410, 164, 3000, 0, 0, //Kris + 443, 131, 30, 50, 447, 151, 446, 161, 4000, 0, 0, //Ian + 487, 136, 43, 50, 493, 155, 493, 155, 3500, 0, 0, //Linda + 529, 145, 43, 50, 536, 164, 536, 164, 4000, 0, 0, //Eric + 581, 132, 43, 48, 584, 150, 583, 161, 3500, 0, 0, //Lynn + 278, 211, 36, 51, 283, 232, 283, 241, 3700, 0, 0, //Norm + 319, 210, 34, 49, 323, 227, 320, 339, 4000, 0, 0, //George + 358, 211, 38, 49, 364, 226, 361, 239, 3600, 0, 0, //Andrew Stacey + 396, 200, 42, 50, 406, 220, 403, 230, 4600, 0, 0, //Scott + 444, 202, 43, 51, 452, 220, 452, 231, 2800, 0, 0, //Emmons + 493, 188, 36, 51, 501, 207, 499, 217, 4500, 0, 0, //Dave + 531, 199, 47, 56, 541, 221, 540, 232, 4000, 0, 0, //Alex + 585, 196, 39, 49, 593, 218, 593, 228, 3500, 0, 0, //Joey +}; + +/* +enum +{ + CRDT_CAMFIELD, + CRDT_SHAWN, + CRDT_KRIS, + CRDT_IAN, + CRDT_LINDA, + CRDT_ERIC, + CRDT_LYNN, + CRDT_NORM, + CRDT_GEORGE, + CRDT_STACEY, + CRDT_SCOTT, + CRDT_EMMONS, + CRDT_DAVE, + CRDT_ALEX, + CRDT_JOEY, + + NUM_PEOPLE_IN_CREDITS, +}; + +STR16 gzCreditNames[]= +{ + L"Chris Camfield", + L"Shaun Lyng", + L"Kris Märnes", + L"Ian Currie", + L"Linda Currie", + L"Eric \"WTF\" Cheng", + L"Lynn Holowka", + L"Norman \"NRG\" Olsen", + L"George Brooks", + L"Andrew Stacey", + L"Scot Loving", + L"Andrew \"Big Cheese\" Emmons", + L"Dave \"The Feral\" French", + L"Alex Meduna", + L"Joey \"Joeker\" Whelan", +}; + + +STR16 gzCreditNameTitle[]= +{ + L"Game Internals Programmer", // Chris Camfield + L"Co-designer/Writer", // Shaun Lyng + L"Strategic Systems & Editor Programmer", //Kris \"The Cow Rape Man\" Marnes + L"Producer/Co-designer", // Ian Currie + L"Co-designer/Map Designer", // Linda Currie + L"Artist", // Eric \"WTF\" Cheng + L"Beta Coordinator, Support", // Lynn Holowka + L"Artist Extraordinaire", // Norman \"NRG\" Olsen + L"Sound Guru", // George Brooks + L"Screen Designer/Artist", // Andrew Stacey + L"Lead Artist/Animator", // Scot Loving + L"Lead Programmer", // Andrew \"Big Cheese Doddle\" Emmons + L"Programmer", // Dave French + L"Strategic Systems & Game Balance Programmer", // Alex Meduna + L"Portraits Artist", // Joey \"Joeker\" Whelan", +}; + +STR16 gzCreditNameFunny[]= +{ + L"", // Chris Camfield + L"(still learning punctuation)", // Shaun Lyng + L"(\"It's done. I'm just fixing it\")", //Kris \"The Cow Rape Man\" Marnes + L"(getting much too old for this)", // Ian Currie + L"(and working on Wizardry 8)", // Linda Currie + L"(forced at gunpoint to also do QA)", // Eric \"WTF\" Cheng + L"(Left us for the CFSA - go figure...)", // Lynn Holowka + L"", // Norman \"NRG\" Olsen + L"", // George Brooks + L"(Dead Head and jazz lover)", // Andrew Stacey + L"(his real name is Robert)", // Scot Loving + L"(the only responsible person)", // Andrew \"Big Cheese Doddle\" Emmons + L"(can now get back to motocrossing)", // Dave French + L"(stolen from Wizardry 8)", // Alex Meduna + L"(did items and loading screens too!)", // Joey \"Joeker\" Whelan", +}; + +*/ + + +//Global Variables + +MOUSE_REGION gCrdtMouseRegions[ NUM_PEOPLE_IN_CREDITS ]; +void SelectCreditFaceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectCreditFaceMovementRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + + +UINT32 guiCreditBackGroundImage; +UINT32 guiCreditFaces; +BOOLEAN gfCreditsScreenEntry = TRUE; +BOOLEAN gfCreditsScreenExit = FALSE; +UINT32 guiCreditsExitScreen; + +UINT8 gubCreditScreenRenderFlags = CRDT_RENDER_ALL; + +CRDT_NODE *gCrdtRootNode=NULL; +CRDT_NODE *gCrdtLastAddedNode=NULL; + +BOOLEAN gfCrdtHaveRenderedFirstFrameToSaveBuffer; // need to render background image to save buffer once + +INT32 giCurrentlySelectedFace = -1; + +// +//VAriables needed for processing of the nodes: +// + + +UINT32 guiCreditScreenActiveFont; // the font that is used +UINT32 guiCreditScreenTitleFont; // the font that is used +UINT8 gubCreditScreenActiveColor; // color of the font +UINT8 gubCreditScreenTitleColor; // color of a Title node +//UINT32 guiCreditScreenActiveDisplayFlags; // + +UINT32 guiCrdtNodeScrollSpeed = CRDT_NODE_DELAY_AMOUNT; //speed credits go up at +//UINT32 guiCrdtTimeTillReadNextCredit = CRDT_DELAY_BN_SECTIONS; //the delay before reading the next credit ( normall = guiCrdtDelayBetweenCreditSection or guiCrdtDelayBetweenNodes ) +//UINT32 guiCrdtDelayBetweenCreditSection = CRDT_DELAY_BN_SECTIONS; //delay between major credits sections ( programming and art ) appearing on the screen +//UINT32 guiCrdtDelayBetweenNodes = CRDT_DELAY_BN_NODES; //delay between credits appearing on the screen +UINT32 guiCrdtLastTimeUpdatingNode=0; // the last time a node was read from the file +UINT8 gubCrdtJustification = CENTER_JUSTIFIED; // the current justification + +UINT32 guiGapBetweenCreditSections = CRDT_SPACE_BN_SECTIONS; +UINT32 guiGapBetweenCreditNodes = CRDT_SPACE_BN_NODES; +UINT32 guiGapTillReadNextCredit = CRDT_SPACE_BN_NODES; + +UINT32 guiCurrentCreditRecord = 0; +BOOLEAN gfPauseCreditScreen = FALSE; + +HWFILE ghFile; + +//ggg + + + + + +//Function Prototypes + + +BOOLEAN EnterCreditsScreen(); +BOOLEAN ExitCreditScreen(); +void HandleCreditScreen(); +BOOLEAN RenderCreditScreen(); +void GetCreditScreenUserInput(); +void SetCreditsExitScreen( UINT32 uiScreenToGoTo ); +BOOLEAN ShutDownCreditList(); +BOOLEAN AddCreditNode( UINT32 uiType, UINT32 uiFlags, STR16 pString ); +BOOLEAN InitCreditNode( ); +BOOLEAN DisplayCreditNode( CRDT_NODE *pCurrent ); +void HandleCreditNodes(); +void HandleNode_Default( CRDT_NODE *pCurrent ); +void HandleCurrentCreditNode( CRDT_NODE *pCurrent ); +BOOLEAN DeleteNode( CRDT_NODE *pNodeToDelete ); +UINT32 GetAndHandleCreditCodeFromCodeString( STR16 pzCode ); +BOOLEAN GetNextCreditFromTextFile(); +UINT32 CountNumberOfCreditNodes(); +STR16 GetNextCreditCode( STR16 pString, UINT32 *pSizeOfCode ); +void HandleCreditFlags( UINT32 uiFlags ); +void HandleCreditEyeBlinking(); +void InitCreditEyeBlinking(); +//ppp + + + + + + + + + +// VSURFACE_DESC vs_desc; +// HVSURFACE hVSurface; + + + + + + + + +UINT32 CreditScreenInit( void ) +{ + gfCreditsScreenEntry = TRUE; + return( 1 ); +} + + + +UINT32 CreditScreenHandle( void ) +{ + StartFrameBufferRender(); + + if( gfCreditsScreenEntry ) + { + if( !EnterCreditsScreen() ) + { + gfCreditsScreenEntry = FALSE; + gfCreditsScreenExit = TRUE; + } + else + { + gfCreditsScreenEntry = FALSE; + gfCreditsScreenExit = FALSE; + } + gubCreditScreenRenderFlags = CRDT_RENDER_ALL; + } + + GetCreditScreenUserInput(); + + + HandleCreditScreen(); + + // render buttons marked dirty +// MarkButtonsDirty( ); +// RenderButtons( ); + + // render help +// RenderFastHelp( ); +// RenderButtonsFastHelp( ); + + + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + + + if( gfCreditsScreenExit ) + { + ExitCreditScreen(); + gfCreditsScreenEntry = TRUE; + gfCreditsScreenExit = FALSE; + } + + + return( guiCreditsExitScreen ); +} + + +UINT32 CreditScreenShutdown( void ) +{ + return( 1 ); +} + + + + + + + + + + +//eee +BOOLEAN EnterCreditsScreen() +{ + UINT32 uiCnt; + VOBJECT_DESC VObjectDesc; +/* + + VSURFACE_DESC vs_desc; + + vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; + + strcpy(vs_desc.ImageFile, "INTERFACE\\Credits.sti"); + + if( !AddVideoSurface( &vs_desc, &guiCreditBackGroundImage ) ) + { + return( FALSE ); + } +*/ + ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\Credits.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCreditBackGroundImage )); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\Credit Faces.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCreditFaces )); + + + + //Initialize the root credit node + InitCreditNode( ); + + guiCreditsExitScreen = CREDIT_SCREEN; + gfCrdtHaveRenderedFirstFrameToSaveBuffer = FALSE; + + guiCreditScreenActiveFont = FONT12ARIAL; + gubCreditScreenActiveColor = FONT_MCOLOR_DKWHITE; + guiCreditScreenTitleFont = FONT14ARIAL; + gubCreditScreenTitleColor = FONT_MCOLOR_RED; +// guiCreditScreenActiveDisplayFlags = LEFT_JUSTIFIED; + guiCrdtNodeScrollSpeed = CRDT_NODE_DELAY_AMOUNT; + gubCrdtJustification = CENTER_JUSTIFIED; + guiCurrentCreditRecord = 0; + +// guiCrdtTimeTillReadNextCredit = CRDT_DELAY_BN_SECTIONS; +// guiCrdtDelayBetweenCreditSection = CRDT_DELAY_BN_SECTIONS; +// guiCrdtDelayBetweenNodes = CRDT_DELAY_BN_NODES; + + guiCrdtLastTimeUpdatingNode = GetJA2Clock(); + + + guiGapBetweenCreditSections = CRDT_SPACE_BN_SECTIONS; + guiGapBetweenCreditNodes = CRDT_SPACE_BN_NODES; + guiGapTillReadNextCredit = CRDT_SPACE_BN_NODES; + + + for( uiCnt=0; uiCnt < NUM_PEOPLE_IN_CREDITS; uiCnt++) + { + // Make a mouse region + MSYS_DefineRegion( &gCrdtMouseRegions[uiCnt], gCreditFaces[uiCnt].sX, gCreditFaces[uiCnt].sY, (INT16)(gCreditFaces[uiCnt].sX + gCreditFaces[uiCnt].sWidth), (INT16)(gCreditFaces[uiCnt].sY + gCreditFaces[uiCnt].sHeight), MSYS_PRIORITY_NORMAL, + CURSOR_WWW, SelectCreditFaceMovementRegionCallBack, SelectCreditFaceRegionCallBack ); + + // Add region + MSYS_AddRegion( &gCrdtMouseRegions[uiCnt] ); + + MSYS_SetRegionUserData( &gCrdtMouseRegions[uiCnt], 0, uiCnt ); + } + +/* + //open the credit text file + ghFile = FileOpen( CRDT_NAME_OF_CREDIT_FILE, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + if( !ghFile ) + { + return( FALSE ); + } +*/ + + giCurrentlySelectedFace = -1; + gfPauseCreditScreen = FALSE; + + InitCreditEyeBlinking(); + + + return( TRUE ); +} + + + +BOOLEAN ExitCreditScreen() +{ + UINT32 uiCnt; + + + //Blit the background image +// DeleteVideoSurfaceFromIndex( guiCreditBackGroundImage ); + DeleteVideoObjectFromIndex( guiCreditBackGroundImage ); + + DeleteVideoObjectFromIndex( guiCreditFaces ); + + + //ShutDown Credit link list + ShutDownCreditList(); + + for( uiCnt=0; uiCnt < NUM_PEOPLE_IN_CREDITS; uiCnt++) + { + MSYS_RemoveRegion( &gCrdtMouseRegions[uiCnt] ); + } + +/* + //close the text file + FileClose( ghFile ); + ghFile = 0; +*/ + + return( TRUE ); +} + + +//hhh +void HandleCreditScreen() +{ +// UINT32 uiTime = GetJA2Clock(); + + if( gubCreditScreenRenderFlags == CRDT_RENDER_ALL ) + { + RenderCreditScreen(); + gubCreditScreenRenderFlags = CRDT_RENDER_NONE; + } + + + //Handle the Credit linked list + HandleCreditNodes(); + + //Handle the blinkng eyes + HandleCreditEyeBlinking(); + + + //is it time to get a new node + if( gCrdtLastAddedNode == NULL || ( CRDT_START_POS_Y - ( gCrdtLastAddedNode->sPosY + gCrdtLastAddedNode->sHeightOfString - 16 ) ) >= (INT16)guiGapTillReadNextCredit ) + { + //if there are no more credits in the file + if( !GetNextCreditFromTextFile() && gCrdtLastAddedNode == NULL ) + { + SetCreditsExitScreen( MAINMENU_SCREEN ); + } + } + + + + RestoreExternBackgroundRect( CRDT_NAME_LOC_X, CRDT_NAME_LOC_Y, CRDT_NAME_LOC_WIDTH, (INT16)CRDT_NAME_LOC_HEIGHT ); + + if( giCurrentlySelectedFace != -1 ) + { + DrawTextToScreen( gzCreditNames[giCurrentlySelectedFace], CRDT_NAME_LOC_X, CRDT_NAME_LOC_Y, CRDT_NAME_LOC_WIDTH, CRDT_NAME_FONT, FONT_MCOLOR_WHITE, 0, FALSE, INVALIDATE_TEXT | CENTER_JUSTIFIED ); + DrawTextToScreen( gzCreditNameTitle[giCurrentlySelectedFace], CRDT_NAME_LOC_X, CRDT_NAME_TITLE_LOC_Y, CRDT_NAME_LOC_WIDTH, CRDT_NAME_FONT, FONT_MCOLOR_WHITE, 0, FALSE, INVALIDATE_TEXT | CENTER_JUSTIFIED ); + DrawTextToScreen( gzCreditNameFunny[giCurrentlySelectedFace], CRDT_NAME_LOC_X, CRDT_NAME_FUNNY_LOC_Y, CRDT_NAME_LOC_WIDTH, CRDT_NAME_FONT, FONT_MCOLOR_WHITE, 0, FALSE, INVALIDATE_TEXT | CENTER_JUSTIFIED ); + } +} + + +//rrr +BOOLEAN RenderCreditScreen() +{ + + HVOBJECT hPixHandle; + + GetVideoObject(&hPixHandle, guiCreditBackGroundImage ); + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY, NULL); +/* + HVSURFACE hVSurface; + + GetVideoSurface( &hVSurface, guiCreditBackGroundImage ); + BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); +*/ + if( !gfCrdtHaveRenderedFirstFrameToSaveBuffer ) + { + gfCrdtHaveRenderedFirstFrameToSaveBuffer = TRUE; + + //blit everything to the save buffer ( cause the save buffer can bleed through ) + BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + UnmarkButtonsDirty( ); + } + + InvalidateScreen( ); + return( TRUE ); +} + + +void GetCreditScreenUserInput() +{ + InputAtom Event; + + while( DequeueEvent( &Event ) ) + { + if( Event.usEvent == KEY_DOWN ) + { + switch( Event.usParam ) + { + + case ESC: + //Exit out of the screen + SetCreditsExitScreen( MAINMENU_SCREEN ); + break; + +#ifdef JA2TESTVERSION + case 'r': + gubCreditScreenRenderFlags = CRDT_RENDER_ALL; + break; + + case 'i': + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + break; + + case UPARROW: + guiCrdtNodeScrollSpeed+=5; + break; + case DNARROW: + if( guiCrdtNodeScrollSpeed > 5 ) + guiCrdtNodeScrollSpeed-=5; + break; + + case PAUSE: + case SPACE: + if( gfPauseCreditScreen ) + gfPauseCreditScreen = FALSE; + else + gfPauseCreditScreen = TRUE; + break; +#endif + } + } + } +} + +void SetCreditsExitScreen( UINT32 uiScreenToGoTo ) +{ + gfCreditsScreenExit = TRUE; + + guiCreditsExitScreen = uiScreenToGoTo; +} + + + +BOOLEAN InitCreditNode( ) +{ + if( gCrdtRootNode != NULL ) + Assert( 0 ); + + gCrdtRootNode = NULL; + + return( TRUE ); +} + + +BOOLEAN ShutDownCreditList() +{ + CRDT_NODE *pNodeToDelete=NULL; + CRDT_NODE *pTemp=NULL; + + pNodeToDelete = gCrdtRootNode; + + + while( pNodeToDelete!= NULL ) + { + pTemp = pNodeToDelete; + + pNodeToDelete = pNodeToDelete->pNext; + + //Delete the current node + DeleteNode( pTemp ); + } + + return( TRUE ); +} + +BOOLEAN DeleteNode( CRDT_NODE *pNodeToDelete ) +{ + CRDT_NODE *pTempNode; + + pTempNode = pNodeToDelete; + + if( gCrdtLastAddedNode == pNodeToDelete ) + { + gCrdtLastAddedNode = NULL; + } + + //if its Not the first node + if( pNodeToDelete->pPrev != NULL ) + pNodeToDelete->pPrev = pNodeToDelete->pNext; + else + { + if( gCrdtRootNode->pNext != NULL ) + { + gCrdtRootNode = gCrdtRootNode->pNext; + gCrdtRootNode->pPrev = NULL; + } + } + + //if its the last node in the list + if( pNodeToDelete->pNext == NULL && pNodeToDelete->pPrev != NULL ) + pNodeToDelete->pPrev->pNext = NULL; + + //iof the node that is being deleted is the first node + if( pTempNode == gCrdtRootNode ) + gCrdtRootNode = NULL; + + //Free the string + if( pTempNode->pString != NULL ) + { + MemFree( pTempNode->pString ); + pTempNode->pString = NULL; + } + + + //if the node had something to display, delete a surface for it + if( pTempNode->uiType == CRDT_NODE_DEFAULT ) + { + DeleteVideoSurfaceFromIndex( pTempNode->uiVideoSurfaceImage ); + pTempNode->uiVideoSurfaceImage = 0; + } + + + //Free the node + MemFree( pTempNode ); + pTempNode = NULL; + + return( TRUE ); +} + + +//aaa +BOOLEAN AddCreditNode( UINT32 uiType, UINT32 uiFlags, STR16 pString ) +{ + CRDT_NODE *pNodeToAdd=NULL; + CRDT_NODE *pTemp=NULL; + UINT32 uiSizeOfString = ( wcslen( pString ) + 2 ) * 2; + UINT32 uiFontToUse; + UINT8 uiColorToUse; + + //if + if( uiType == CRDT_NODE_NONE) + { + //Assert( 0 ); + return( TRUE ); + } + + pNodeToAdd = (CRDT_NODE *) MemAlloc( sizeof( CRDT_NODE) ); + if( pNodeToAdd == NULL ) + { + return( FALSE ); + } + memset( pNodeToAdd, 0, sizeof( CRDT_NODE) ); + + + //Determine the font and the color to use + if( uiFlags & CRDT_FLAG__TITLE ) + { + uiFontToUse = guiCreditScreenTitleFont; + uiColorToUse = gubCreditScreenTitleColor; + } +/* + else if ( uiFlags & CRDT_FLAG__START_SECTION ) + { + uiFontToUse = ; + uiColorToUse = ; + } + else if ( uiFlags & CRDT_FLAG__END_SECTION ) + { + uiFontToUse = ; + uiColorToUse = ; + } +*/ + else + { + uiFontToUse = guiCreditScreenActiveFont; + uiColorToUse = gubCreditScreenActiveColor; + } + + // + // Set some default data + // + + //the type of the node + pNodeToAdd->uiType = uiType; + + //any flags that are added + pNodeToAdd->uiFlags = uiFlags; + + //the starting left position for the it + pNodeToAdd->sPosX = CRDT_TEXT_START_LOC; + + //Allocate memory for the string + pNodeToAdd->pString = (CHAR16 *) MemAlloc( uiSizeOfString ); + if( pNodeToAdd->pString == NULL ) + return( FALSE ); + + //copy the string into the node + wcscpy( pNodeToAdd->pString, pString ); + + //Calculate the height of the string + pNodeToAdd->sHeightOfString = DisplayWrappedString( 0, 0, CRDT_WIDTH_OF_TEXT_AREA, 2, uiFontToUse, uiColorToUse, pNodeToAdd->pString, 0, FALSE, DONT_DISPLAY_TEXT ) + 1; + + //starting y position on the screen + pNodeToAdd->sPosY = CRDT_START_POS_Y; + +// pNodeToAdd->uiLastTime = GetJA2Clock(); + + //if the node can have something to display, Create a surface for it + if( pNodeToAdd->uiType == CRDT_NODE_DEFAULT ) + { + VSURFACE_DESC vs_desc; + + // Create a background video surface to blt the face onto + vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; + vs_desc.usWidth = CRDT_WIDTH_OF_TEXT_AREA; + vs_desc.usHeight = pNodeToAdd->sHeightOfString; + vs_desc.ubBitDepth = 16; + + if( AddVideoSurface( &vs_desc, &pNodeToAdd->uiVideoSurfaceImage) == 0 ) + { + return( FALSE ); + } + + //Set transparency + SetVideoSurfaceTransparency( pNodeToAdd->uiVideoSurfaceImage, 0 ); + + //fill the surface with a transparent color + ColorFillVideoSurfaceArea(pNodeToAdd->uiVideoSurfaceImage, 0, 0, CRDT_WIDTH_OF_TEXT_AREA, pNodeToAdd->sHeightOfString, 0 ); + + //set the font dest buffer to be the surface + SetFontDestBuffer( pNodeToAdd->uiVideoSurfaceImage, 0, 0, CRDT_WIDTH_OF_TEXT_AREA, pNodeToAdd->sHeightOfString, FALSE ); + + //write the string onto the surface + DisplayWrappedString( 0, 1, CRDT_WIDTH_OF_TEXT_AREA, 2, uiFontToUse, uiColorToUse, pNodeToAdd->pString, 0, FALSE, gubCrdtJustification ); + + //reset the font dest buffer + SetFontDestBuffer(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE); + } + + + + + // + // Insert the node into the list + // + + //if its the first node to add + if( gCrdtRootNode == NULL ) + { + //make the new node the root node + gCrdtRootNode = pNodeToAdd; + + gCrdtRootNode->pNext = NULL; + gCrdtRootNode->pPrev = NULL; + } + else + { + pTemp = gCrdtRootNode; + + while( pTemp->pNext != NULL ) + { + pTemp = pTemp->pNext; + } + + //Add the new node to the list + pTemp->pNext = pNodeToAdd; + + //Assign the prev node + pNodeToAdd->pPrev = pTemp; + } + + gCrdtLastAddedNode = pNodeToAdd; + + return( TRUE ); +} + + +void HandleCreditNodes() +{ + UINT32 uiCurrentTime =GetJA2Clock(); + CRDT_NODE *pCurrent=NULL; + CRDT_NODE *pTemp=NULL; + + if( gCrdtRootNode == NULL ) + return; + + //if the screen is paused, exit + if( gfPauseCreditScreen ) + return; + + + pCurrent = gCrdtRootNode; + + if( !( GetJA2Clock() - guiCrdtLastTimeUpdatingNode > guiCrdtNodeScrollSpeed ) ) + return; + + //loop through all the nodes + while( pCurrent != NULL ) + { + pTemp = pCurrent; + + pCurrent = pCurrent->pNext; + + //Handle the current node + HandleCurrentCreditNode( pTemp ); + + //if the node is to be deleted + if( pTemp->fDelete ) + { + //delete the node + DeleteNode( pTemp ); + } + } + +// RestoreExternBackgroundRect( CRDT_TEXT_START_LOC, 0, CRDT_WIDTH_OF_TEXT_AREA, CRDT_LINE_NODE_DISAPPEARS_AT ); + + guiCrdtLastTimeUpdatingNode = GetJA2Clock(); +} + +void HandleCurrentCreditNode( CRDT_NODE *pCurrent ) +{ + //switch on the type of node + switch( pCurrent->uiType ) + { +//new codes: + case CRDT_NODE_DEFAULT: + HandleNode_Default( pCurrent ); + break; + + default: + Assert( 0 ); + break; + } +} + +void HandleNode_Default( CRDT_NODE *pCurrent ) +{ + UINT32 uiCurrentTime =GetJA2Clock(); + + //if it is time to update the current node +// if( ( uiCurrentTime - pCurrent->uiLastTime ) > guiCrdtNodeScrollSpeed ) + { + //Display the Current Node + DisplayCreditNode( pCurrent ); + + //Save the old position + pCurrent->sOldPosX = pCurrent->sPosX; + pCurrent->sOldPosY = pCurrent->sPosY; + + //Move the current node up + pCurrent->sPosY -= CRDT_SCROLL_PIXEL_AMOUNT; + + //if the node is entirely off the screen + if( ( pCurrent->sPosY + pCurrent->sHeightOfString ) < CRDT_LINE_NODE_DISAPPEARS_AT ) + { + //mark the node to be deleted this frame + pCurrent->fDelete = TRUE; + } + + //Update the last time to be the current time +// pCurrent->uiLastTime = uiCurrentTime + ( uiCurrentTime - ( pCurrent->uiLastTime + guiCrdtNodeScrollSpeed ) ); + +// pCurrent->uiLastTime = ( uiCurrentTime - ( uiCurrentTime - pCurrent->uiLastTime - guiCrdtNodeScrollSpeed) ); + + pCurrent->uiLastTime = GetJA2Clock(); + } +} + + + +BOOLEAN DisplayCreditNode( CRDT_NODE *pCurrent ) +{ + HVSURFACE hVSurface; + + //Currently, we have no need to display a node that doesnt have a string + if( pCurrent->pString == NULL ) + return( FALSE ); + + + //if the node is new and we havent displayed it yet + if( pCurrent->uiLastTime == 0 ) + { + + } + + //else we have to restore were the string was + else + { + // + //Restore the background before blitting the text back on + // + + //if the surface is at the bottom of the screen + if( pCurrent->sOldPosY + pCurrent->sHeightOfString > CRDT_START_POS_Y ) + { + INT16 sHeight = 480 - pCurrent->sOldPosY; + RestoreExternBackgroundRect( pCurrent->sOldPosX, pCurrent->sOldPosY, CRDT_WIDTH_OF_TEXT_AREA, sHeight ); + } + else if( pCurrent->sOldPosY > CRDT_LINE_NODE_DISAPPEARS_AT ) + { + RestoreExternBackgroundRect( pCurrent->sOldPosX, pCurrent->sOldPosY, CRDT_WIDTH_OF_TEXT_AREA, pCurrent->sHeightOfString ); + } + + //if the surface is at the top of the screen + else + { + INT16 sHeight = pCurrent->sOldPosY + pCurrent->sHeightOfString; + + RestoreExternBackgroundRect( pCurrent->sOldPosX, CRDT_LINE_NODE_DISAPPEARS_AT, CRDT_WIDTH_OF_TEXT_AREA, sHeight ); + } + } + + GetVideoSurface( &hVSurface, pCurrent->uiVideoSurfaceImage ); + + + BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, pCurrent->sPosX, pCurrent->sPosY, VS_BLT_CLIPPED | VS_BLT_USECOLORKEY, NULL ); + + return( TRUE ); +} + +//return false from this function when there are no more items in the text file +BOOLEAN GetNextCreditFromTextFile() +{ + BOOLEAN fDone = FALSE; + UINT32 uiStringWidth = 20; + CHAR16 zOriginalString[512]; + CHAR16 zString[512]; + CHAR16 zCodes[512]; + STR16 pzNewCode=NULL; + UINT32 uiCodeType = 0; + UINT32 uiNodeType = 0; + UINT32 uiStartLoc = 0; + UINT32 uiFlags=0; + + + switch(guiCurrentCreditRecord) + { + case 0: + wcscpy(zOriginalString, L"@T,C208,R134,D16,B40,S10,J1,};"); + break; + + case 1: + wcscpy(zOriginalString, L"@T,{;JA2: Whitehat Project Team"); + break; + + case 2: + wcscpy(zOriginalString, L"@};"); + break; + + case 3: + wcscpy(zOriginalString, L"@T,C163,{;Programming"); + break; + + case 4: + wcscpy(zOriginalString, L"Alex \"Digicrab\" Vostrov"); + break; + + case 5: + wcscpy(zOriginalString, L"Michal \"Joker\" Laskowski"); + break; + + case 6: + wcscpy(zOriginalString, L"@};Jackaians"); + break; + + case 7: + wcscpy(zOriginalString, L"@T,{;Project Organization"); + break; + + case 8: + wcscpy(zOriginalString, L"Shanga"); + break; + + case 9: + wcscpy(zOriginalString, L"@};Keith \"Mouse Master\" Scroggins"); + break; + + default: + //Get the current Credit record + uiStartLoc = CREDITS_LINESIZE * (guiCurrentCreditRecord-10); + if( !LoadEncryptedDataFromFile( CRDT_NAME_OF_CREDIT_FILE, zOriginalString, uiStartLoc, CREDITS_LINESIZE ) ) + { + //there are no more credits + return( FALSE ); + } + + } + + //Increment to the next crdit record + guiCurrentCreditRecord++; + + + //if there are no codes in the string + if( zOriginalString[0] != CRDT_START_CODE ) + { + //copy the string + wcscpy( zString, zOriginalString ); + uiNodeType = CRDT_NODE_DEFAULT; + } + else + { + UINT32 uiSizeOfCodes = 0; + UINT32 uiSizeOfSubCode = 0; + STR16 pzEndCode = NULL; + UINT32 uiDistanceIntoCodes = 0; + + //Retrive all the codes from the string + pzEndCode = wcsstr( zOriginalString, CRDT_END_CODE ); + + + //Make a string for the codes + wcscpy( zCodes, zOriginalString ); + + //end the setence after the codes + zCodes[ pzEndCode - zOriginalString + 1 ] = '\0'; + + //Get the size of the codes + uiSizeOfCodes = pzEndCode - zOriginalString + 1; + + // + //check to see if there is a string, or just codes + // + + //if the string is the same size as the codes + if( wcslen( zOriginalString ) == uiSizeOfCodes ) + { + //there is no string, just codes + uiNodeType = CRDT_NODE_NONE; + } + + //else there is a string aswell + else + { + //copy the main string + wcscpy( zString, &zOriginalString[ uiSizeOfCodes ] ); + + uiNodeType = CRDT_NODE_DEFAULT; + } + + //get rid of the start code delimeter + uiDistanceIntoCodes = 1; + + uiFlags = 0; + + //loop through the string of codes to get all the control codes out + while( uiDistanceIntoCodes < uiSizeOfCodes ) + { + //Determine what kind of code it is, and handle it + uiFlags |= GetAndHandleCreditCodeFromCodeString( &zCodes[ uiDistanceIntoCodes ] ); + + //get the next code from the string of codes, returns NULL when done + pzNewCode = GetNextCreditCode( &zCodes[ uiDistanceIntoCodes ], &uiSizeOfSubCode ); + + //if we are done getting the sub codes + if( pzNewCode == NULL ) + { + uiDistanceIntoCodes = uiSizeOfCodes; + } + else + { + //else increment by the size of the code + uiDistanceIntoCodes += uiSizeOfSubCode; + } + } + } + + if( uiNodeType != CRDT_NODE_NONE ) + { + //add the node to the list + AddCreditNode( uiNodeType, uiFlags, zString ); + } + + //if any processing of the flags need to be done + HandleCreditFlags( uiFlags ); + + return( TRUE ); +} + +//return any flags that need to be set in the node +UINT32 GetAndHandleCreditCodeFromCodeString( STR16 pzCode ) +{ +//new codes: + + + //if the code is to change the delay between strings + if( pzCode[0] == CRDT_DELAY_BN_STRINGS_CODE ) + { + UINT32 uiNewDelay=0; + + //Get the delay from the string + swscanf( &pzCode[1], L"%d%*s", &uiNewDelay ); + +// guiCrdtDelayBetweenNodes = uiNewDelay; + guiGapBetweenCreditNodes = uiNewDelay; + + return( CRDT_NODE_NONE ); + } + + //if the code is to change the delay between sections strings + else if( pzCode[0] == CRDT_DELAY_BN_SECTIONS_CODE ) + { + UINT32 uiNewDelay=0; + + //Get the delay from the string + swscanf( &pzCode[1], L"%d%*s", &uiNewDelay ); + +// guiCrdtDelayBetweenCreditSection = uiNewDelay; + guiGapBetweenCreditSections = uiNewDelay; + + return( CRDT_NODE_NONE ); + } + + + else if( pzCode[0] == CRDT_SCROLL_SPEED ) + { + UINT32 uiScrollSpeed=0; + + //Get the delay from the string + swscanf( &pzCode[1], L"%d%*s", &uiScrollSpeed ); + + guiCrdtNodeScrollSpeed = uiScrollSpeed; + + return( CRDT_NODE_NONE ); + } + + else if( pzCode[0] == CRDT_FONT_JUSTIFICATION ) + { + UINT32 uiJustification=0; + + //Get the delay from the string + swscanf( &pzCode[1], L"%d%*s", &uiJustification ); + + //get the justification + switch( uiJustification ) + { + case 0: + gubCrdtJustification = LEFT_JUSTIFIED; + break; + case 1: + gubCrdtJustification = CENTER_JUSTIFIED; + break; + case 2: + gubCrdtJustification = RIGHT_JUSTIFIED; + break; + default: + Assert( 0 ); + } + + return( CRDT_NODE_NONE ); + } + + else if( pzCode[0] == CRDT_TITLE_FONT_COLOR ) + { + //Get the new color for the title + swscanf( &pzCode[1], L"%d%*s", &gubCreditScreenTitleColor ); + + return( CRDT_NODE_NONE ); + } + + else if( pzCode[0] == CRDT_ACTIVE_FONT_COLOR ) + { + //Get the new color for the active text + swscanf( &pzCode[1], L"%d%*s", &gubCreditScreenActiveColor ); + + return( CRDT_NODE_NONE ); + } + + + //else its the title code + else if( pzCode[0] == CRDT_TITLE ) + { + return( CRDT_FLAG__TITLE ); + } + + //else its the title code + else if( pzCode[0] == CRDT_START_OF_SECTION ) + { + return( CRDT_FLAG__START_SECTION ); + } + + //else its the title code + else if( pzCode[0] == CRDT_END_OF_SECTION ) + { + return( CRDT_FLAG__END_SECTION ); + } + + //else its an error + else + { + Assert( 0 ); + } + + return( CRDT_NODE_NONE ); +} + +UINT32 CountNumberOfCreditNodes() +{ + UINT32 uiNumNodes = 0; + CRDT_NODE *pTempNode = gCrdtRootNode; + + while( pTempNode ) + { + uiNumNodes++; + + pTempNode = pTempNode->pNext; + } + + return( uiNumNodes ); +} + +STR16 GetNextCreditCode( STR16 pString, UINT32 *pSizeOfCode ) +{ + STR16 pzNewCode=NULL; + UINT32 uiSizeOfCode = 0; + + //get the new subcode out + pzNewCode = wcsstr( pString, CRDT_SEPARATION_CODE ); + + //if there is no separation code, then there must be an end code + if( pzNewCode == NULL ) + { + //pzNewCode = wcsstr( pString, CRDT_END_CODE ); + + //we are done + pzNewCode = NULL; + } + else + { + //get rid of separeation code + pzNewCode++; + + + //calc size of sub string + uiSizeOfCode = pzNewCode - pString; + } + + *pSizeOfCode = uiSizeOfCode; + return( pzNewCode ); +} + + +//Flags: +void HandleCreditFlags( UINT32 uiFlags ) +{ + if( uiFlags & CRDT_FLAG__TITLE ) + { + } + + if( uiFlags & CRDT_FLAG__START_SECTION ) + { +// guiCrdtTimeTillReadNextCredit = guiCrdtDelayBetweenNodes; + guiGapTillReadNextCredit = guiGapBetweenCreditNodes; + } + + if( uiFlags & CRDT_FLAG__END_SECTION ) + { +// guiCrdtTimeTillReadNextCredit = guiCrdtDelayBetweenCreditSection; + guiGapTillReadNextCredit = guiGapBetweenCreditSections; + } +} + + + +void SelectCreditFaceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + +void SelectCreditFaceMovementRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + giCurrentlySelectedFace = -1; + } + else if( iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + giCurrentlySelectedFace = MSYS_GetRegionUserData( pRegion,0 ); + } + else if( iReason & MSYS_CALLBACK_REASON_MOVE ) + { + } +} + +void InitCreditEyeBlinking() +{ + UINT8 ubCnt; + + for( ubCnt=0; ubCnt (UINT32)gCreditFaces[ubCnt].sBlinkFreq ) + { + BltVideoObject( FRAME_BUFFER, hPixHandle, (UINT8)(ubCnt*3), gCreditFaces[ubCnt].sEyeX, gCreditFaces[ubCnt].sEyeY, VO_BLT_SRCTRANSPARENCY, NULL); + InvalidateRegion( gCreditFaces[ubCnt].sEyeX, gCreditFaces[ubCnt].sEyeY, gCreditFaces[ubCnt].sEyeX + CRDT_EYE_WIDTH, gCreditFaces[ubCnt].sEyeY + CRDT_EYE_HEIGHT ); + + gCreditFaces[ubCnt].uiLastBlinkTime = GetJA2Clock(); + + gCreditFaces[ubCnt].uiEyesClosedTime = GetJA2Clock() + CRDT_EYES_CLOSED_TIME + Random( CRDT_EYES_CLOSED_TIME ); + } + else if( GetJA2Clock() > gCreditFaces[ubCnt].uiEyesClosedTime ) + { + gCreditFaces[ubCnt].uiEyesClosedTime = 0; + + RestoreExternBackgroundRect( gCreditFaces[ubCnt].sEyeX, gCreditFaces[ubCnt].sEyeY, CRDT_EYE_WIDTH, CRDT_EYE_HEIGHT ); + } + } +} + diff --git a/Credits.h b/Credits.h new file mode 100644 index 00000000..bb9425ec --- /dev/null +++ b/Credits.h @@ -0,0 +1,10 @@ +#ifndef _CREDITS__H_ +#define _CREDITS__H_ + + +UINT32 CreditScreenInit( void ); +UINT32 CreditScreenHandle( void ); +UINT32 CreditScreenShutdown( void ); + + +#endif diff --git a/Editor/Button Defines.h b/Editor/Button Defines.h new file mode 100644 index 00000000..e4ec9dac --- /dev/null +++ b/Editor/Button Defines.h @@ -0,0 +1,267 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __BUTTON_DEFINES_H +#define __BUTTON_DEFINES_H + +enum +{ + //Main Editor tabs + TAB_TERRAIN, FIRST_EDITORTAB_BUTTON = TAB_TERRAIN, + TAB_BUILDINGS, + TAB_ITEMS, + TAB_MERCS, + TAB_MAPINFO, + TAB_OPTIONS, LAST_EDITORTAB_BUTTON = TAB_OPTIONS, + + //Terrain menu + TERRAIN_FGROUND_TEXTURES, FIRST_TERRAIN_BUTTON = TERRAIN_FGROUND_TEXTURES, + TERRAIN_BGROUND_TEXTURES, + TERRAIN_PLACE_CLIFFS, + TERRAIN_PLACE_ROADS, + TERRAIN_PLACE_DEBRIS, + TERRAIN_FILL_AREA, + TERRAIN_PLACE_TREES, + TERRAIN_PLACE_ROCKS, + TERRAIN_PLACE_MISC, + TERRAIN_TOGGLE_ERASEMODE, + TERRAIN_CYCLE_BRUSHSIZE, + TERRAIN_RAISE_DENSITY, + TERRAIN_LOWER_DENSITY, + TERRAIN_UNDO, LAST_TERRAIN_BUTTON = TERRAIN_UNDO, + //Buildings menu + BUILDING_PLACE_WALLS, FIRST_BUILDINGS_BUTTON = BUILDING_PLACE_WALLS, + BUILDING_PLACE_DOORS, + BUILDING_PLACE_WINDOWS, + BUILDING_PLACE_ROOFS, + BUILDING_PLACE_BROKEN_WALLS, + BUILDING_PLACE_FURNITURE, + BUILDING_PLACE_DECALS, + BUILDING_PLACE_TOILETS, + BUILDING_PLACE_FLOORS, + BUILDING_SMART_WALLS, + BUILDING_SMART_DOORS, + BUILDING_SMART_WINDOWS, + BUILDING_SMART_BROKEN_WALLS, + BUILDING_DOORKEY, + BUILDING_NEW_ROOM, + BUILDING_SAW_ROOM, + BUILDING_NEW_ROOF, + BUILDING_KILL_BUILDING, + BUILDING_COPY_BUILDING, + BUILDING_MOVE_BUILDING, + BUILDING_CAVE_DRAWING, + BUILDING_DRAW_ROOMNUM, + BUILDING_ERASE_ROOMNUM, + BUILDING_TOGGLE_ERASEMODE, + BUILDING_UNDO, + BUILDING_CYCLE_BRUSHSIZE, + BUILDING_TOGGLE_ROOF_VIEW, + BUILDING_TOGGLE_WALL_VIEW, + BUILDING_TOGGLE_INFO_VIEW, LAST_BUILDINGS_BUTTON = BUILDING_TOGGLE_INFO_VIEW, + //Items menu + ITEMS_WEAPONS, FIRST_ITEMS_BUTTON = ITEMS_WEAPONS, + ITEMS_AMMO, + ITEMS_ARMOUR, + ITEMS_EXPLOSIVES, + ITEMS_EQUIPMENT1, + ITEMS_EQUIPMENT2, + ITEMS_EQUIPMENT3, + ITEMS_TRIGGERS, + ITEMS_KEYS, + ITEMS_LEFTSCROLL, + ITEMS_RIGHTSCROLL, LAST_ITEMS_BUTTON = ITEMS_RIGHTSCROLL, + //MapInfo menu + MAPINFO_ADD_LIGHT1_SOURCE, FIRST_MAPINFO_BUTTON = MAPINFO_ADD_LIGHT1_SOURCE, + MAPINFO_LIGHT_PANEL, + MAPINFO_PRIMETIME_LIGHT, + MAPINFO_NIGHTTIME_LIGHT, + MAPINFO_24HOUR_LIGHT, + MAPINFO_TOGGLE_FAKE_LIGHTS, + MAPINFO_TOGGLE_ERASEMODE, + MAPINFO_DRAW_EXITGRIDS, + MAPINFO_CYCLE_BRUSHSIZE, + MAPINFO_UNDO, + MAPINFO_RADIO_PANEL, + MAPINFO_RADIO_NORMAL, + MAPINFO_RADIO_BASEMENT, + MAPINFO_RADIO_CAVES, + MAPINFO_NORTH_POINT, + MAPINFO_WEST_POINT, + MAPINFO_EAST_POINT, + MAPINFO_SOUTH_POINT, + MAPINFO_CENTER_POINT, + MAPINFO_ISOLATED_POINT, LAST_MAPINFO_BUTTON = MAPINFO_ISOLATED_POINT, + + //Options menu + OPTIONS_NEW_MAP, FIRST_OPTIONS_BUTTON = OPTIONS_NEW_MAP, + OPTIONS_NEW_BASEMENT, + OPTIONS_NEW_CAVES, + OPTIONS_LOAD_MAP, + OPTIONS_SAVE_MAP, + OPTIONS_CHANGE_TILESET, + OPTIONS_LEAVE_EDITOR, + OPTIONS_QUIT_GAME, LAST_OPTIONS_BUTTON = OPTIONS_QUIT_GAME, + //Mercs menu + MERCS_PLAYER, FIRST_MERCS_BUTTON = MERCS_PLAYER, + MERCS_ENEMY, + MERCS_CREATURE, + MERCS_REBEL, + MERCS_CIVILIAN, + + MERCS_PLAYERTOGGLE, + MERCS_ENEMYTOGGLE, + MERCS_CREATURETOGGLE, + MERCS_REBELTOGGLE, + MERCS_CIVILIANTOGGLE, + + MERCS_1, + MERCS_DETAILEDCHECKBOX, + MERCS_GENERAL, + MERCS_ATTRIBUTES, + MERCS_INVENTORY, + MERCS_APPEARANCE, + MERCS_PROFILE, + MERCS_SCHEDULE, + MERCS_GLOWSCHEDULE, + + MERCS_DELETE, + MERCS_NEXT, + + MERCS_PRIORITYEXISTANCE_CHECKBOX, + MERCS_HASKEYS_CHECKBOX, + + MERCS_ORDERS_STATIONARY, + MERCS_ORDERS_ONGUARD, + MERCS_ORDERS_CLOSEPATROL, + MERCS_ORDERS_FARPATROL, + MERCS_ORDERS_POINTPATROL, + MERCS_ORDERS_ONCALL, + MERCS_ORDERS_SEEKENEMY, + MERCS_ORDERS_RNDPTPATROL, + + MERCS_ATTITUDE_DEFENSIVE, + MERCS_ATTITUDE_BRAVESOLO, + MERCS_ATTITUDE_BRAVEAID, + MERCS_ATTITUDE_CUNNINGSOLO, + MERCS_ATTITUDE_CUNNINGAID, + MERCS_ATTITUDE_AGGRESSIVE, + + MERCS_DIRECTION_N, + MERCS_DIRECTION_NE, + MERCS_DIRECTION_E, + MERCS_DIRECTION_SE, + MERCS_DIRECTION_S, + MERCS_DIRECTION_SW, + MERCS_DIRECTION_W, + MERCS_DIRECTION_NW, + MERCS_DIRECTION_FIND, + + MERCS_EQUIPMENT_BAD, + MERCS_EQUIPMENT_POOR, + MERCS_EQUIPMENT_AVERAGE, + MERCS_EQUIPMENT_GOOD, + MERCS_EQUIPMENT_GREAT, + + MERCS_ATTRIBUTES_BAD, + MERCS_ATTRIBUTES_POOR, + MERCS_ATTRIBUTES_AVERAGE, + MERCS_ATTRIBUTES_GOOD, + MERCS_ATTRIBUTES_GREAT, + + MERCS_ARMY_CODE, + MERCS_ADMIN_CODE, + MERCS_ELITE_CODE, + + MERCS_CIVILIAN_GROUP, + + MERCS_TOGGLECOLOR_BUTTON, + MERCS_HAIRCOLOR_DOWN, + MERCS_HAIRCOLOR_UP, + MERCS_SKINCOLOR_DOWN, + MERCS_SKINCOLOR_UP, + MERCS_VESTCOLOR_DOWN, + MERCS_VESTCOLOR_UP, + MERCS_PANTCOLOR_DOWN, + MERCS_PANTCOLOR_UP, + + MERCS_BODYTYPE_DOWN, + MERCS_BODYTYPE_UP, + + MERCS_SCHEDULE_ACTION1, + MERCS_SCHEDULE_ACTION2, + MERCS_SCHEDULE_ACTION3, + MERCS_SCHEDULE_ACTION4, + MERCS_SCHEDULE_VARIANCE1, + MERCS_SCHEDULE_VARIANCE2, + MERCS_SCHEDULE_VARIANCE3, + MERCS_SCHEDULE_VARIANCE4, + MERCS_SCHEDULE_DATA1A, + MERCS_SCHEDULE_DATA2A, + MERCS_SCHEDULE_DATA3A, + MERCS_SCHEDULE_DATA4A, + MERCS_SCHEDULE_DATA1B, + MERCS_SCHEDULE_DATA2B, + MERCS_SCHEDULE_DATA3B, + MERCS_SCHEDULE_DATA4B, + MERCS_SCHEDULE_CLEAR, + + MERCS_HEAD_SLOT, + MERCS_BODY_SLOT, + MERCS_LEGS_SLOT, + MERCS_LEFTHAND_SLOT, + MERCS_RIGHTHAND_SLOT, + MERCS_PACK1_SLOT, + MERCS_PACK2_SLOT, + MERCS_PACK3_SLOT, + MERCS_PACK4_SLOT, LAST_MERCS_BUTTON = MERCS_PACK4_SLOT, + + ITEMSTATS_PANEL, FIRST_ITEMSTATS_BUTTON = ITEMSTATS_PANEL, + ITEMSTATS_HIDDEN_BTN, + ITEMSTATS_DELETE_BTN, LAST_ITEMSTATS_BUTTON = ITEMSTATS_DELETE_BTN, + + NUMBER_EDITOR_BUTTONS, +}; + +#define FIRST_MERCS_TEAMMODE_BUTTON MERCS_PLAYER +#define LAST_MERCS_TEAMMODE_BUTTON MERCS_CIVILIANTOGGLE + +#define FIRST_MERCS_BASICMODE_BUTTON MERCS_1 +#define LAST_MERCS_BASICMODE_BUTTON MERCS_DETAILEDCHECKBOX + +#define FIRST_MERCS_PRIORITYMODE_BUTTON MERCS_GENERAL +#define LAST_MERCS_PRIORITYMODE_BUTTON MERCS_SCHEDULE + +#define FIRST_MERCS_GENERAL_BUTTON MERCS_PRIORITYEXISTANCE_CHECKBOX +#define LAST_MERCS_GENERAL_BUTTON LAST_MERCS_COLORCODE_BUTTON +#define FIRST_MERCS_ORDERS_BUTTON MERCS_ORDERS_STATIONARY +#define LAST_MERCS_ORDERS_BUTTON MERCS_ORDERS_RNDPTPATROL +#define FIRST_MERCS_ATTITUDE_BUTTON MERCS_ATTITUDE_DEFENSIVE +#define LAST_MERCS_ATTITUDE_BUTTON MERCS_ATTITUDE_AGGRESSIVE +#define FIRST_MERCS_DIRECTION_BUTTON MERCS_DIRECTION_N +#define LAST_MERCS_DIRECTION_BUTTON MERCS_DIRECTION_FIND +#define FIRST_MERCS_REL_EQUIPMENT_BUTTON MERCS_EQUIPMENT_BAD +#define LAST_MERCS_REL_EQUIPMENT_BUTTON MERCS_EQUIPMENT_GREAT +#define FIRST_MERCS_REL_ATTRIBUTE_BUTTON MERCS_ATTRIBUTES_BAD +#define LAST_MERCS_REL_ATTRIBUTE_BUTTON MERCS_ATTRIBUTES_GREAT +#define FIRST_MERCS_COLORCODE_BUTTON MERCS_ARMY_CODE +#define LAST_MERCS_COLORCODE_BUTTON MERCS_ELITE_CODE + +#define FIRST_MERCS_COLORMODE_BUTTON MERCS_TOGGLECOLOR_BUTTON +#define LAST_MERCS_COLORMODE_BUTTON MERCS_BODYTYPE_UP +#define FIRST_MERCS_COLOR_BUTTON MERCS_HAIRCOLOR_DOWN +#define LAST_MERCS_COLOR_BUTTON MERCS_PANTCOLOR_UP +#define FIRST_MERCS_BODYTYPE_BUTTON MERCS_BODYTYPE_DOWN +#define LAST_MERCS_BODYTYPE_BUTTON MERCS_BODYTYPE_UP + +#define FIRST_MERCS_INVENTORY_BUTTON MERCS_HEAD_SLOT +#define LAST_MERCS_INVENTORY_BUTTON MERCS_PACK4_SLOT + +#define FIRST_MERCS_GETITEM_BUTTON FIRST_ITEMS_BUTTON +#define LAST_MERCS_GETITEM_BUTTON LAST_ITEMS_BUTTON + +#define FIRST_MERCS_SCHEDULE_BUTTON MERCS_SCHEDULE_ACTION1 +#define LAST_MERCS_SCHEDULE_BUTTON MERCS_SCHEDULE_CLEAR + +#endif +#endif \ No newline at end of file diff --git a/Editor/Cursor Modes.cpp b/Editor/Cursor Modes.cpp new file mode 100644 index 00000000..d40c6f1e --- /dev/null +++ b/Editor/Cursor Modes.cpp @@ -0,0 +1,464 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "types.h" + #include "Cursor Modes.h" + #include "renderworld.h" + #include "random.h" + #include "worldman.h" + #include "interface.h" + #include "Isometric Utils.h" + #include "editscreen.h" + #include "EditorDefines.h" + #include "input.h" + #include "english.h" + #include "Editor Taskbar Utils.h" + #include "Overhead.h" + #include "EditorMercs.h" + #include "EditorBuildings.h" +#endif + +BOOLEAN fValidCursor = FALSE; +BOOLEAN fAnchored = FALSE; +BOOLEAN gfBrushEnabled = TRUE; +UINT16 gusSelectionWidth = 1, gusPreserveSelectionWidth = 1; +UINT16 gusSelectionType = SMALLSELECTION; +UINT16 gusSelectionDensity = 2; +UINT16 gusSavedSelectionType = SMALLSELECTION; +UINT16 gusSavedBuildingSelectionType = AREASELECTION; +extern INT16 sGridX; // symbol already declared globally in editscreen.cpp (jonathanl) +extern INT16 sGridY; // symbol already declared globally in editscreen.cpp (jonathanl) +INT16 sBadMarker = -1; + +UINT16 *wszSelType[6]= { L"Small", L"Medium", L"Large", L"XLarge", L"Width: xx", L"Area" }; + +BOOLEAN gfAllowRightButtonSelections = FALSE; +BOOLEAN gfCurrentSelectionWithRightButton = FALSE; + +void DrawBuildingLayout( INT32 iMapIndex ); +void RemoveBuildingLayout(); + +void ValidateSelectionRegionBoundaries(); +void ForceAreaSelectionWidth(); +BOOLEAN HandleAreaSelection(); +void EnsureSelectionType(); + +//Used for offseting cursor to show that it is on the roof rather than on the ground. +//This can be conveniently executed by moving the cursor up and right 3 gridnos for a +//total of -483 -(160*3)-(1*3) +#define ROOF_OFFSET (-483) +BOOLEAN gfUsingOffset; + +//Based on the density level setting and the selection type, this test will +//randomly choose TRUE or FALSE to reflect the *odds*. +BOOLEAN PerformDensityTest() +{ + if( Random(100) < gusSelectionDensity ) + return TRUE; + return FALSE; +} + +void IncreaseSelectionDensity() +{ + if( gusSelectionDensity == 100 ) + gusSelectionDensity = 2; + else if( gusSelectionDensity == 2 ) + gusSelectionDensity = 5; + else if( gusSelectionDensity == 5 ) + gusSelectionDensity = 10; + else + gusSelectionDensity += 10; +} + +void DecreaseSelectionDensity() +{ + if( gusSelectionDensity == 10 ) + gusSelectionDensity = 5; + else if( gusSelectionDensity == 5 ) + gusSelectionDensity = 2; + else if( gusSelectionDensity == 2 ) + gusSelectionDensity = 100; + else + gusSelectionDensity -= 10; +} + +void RemoveCursors() +{ + INT32 x, y, iMapIndex; + if( gpBuildingLayoutList ) + { + RemoveBuildingLayout(); + } + Assert( gSelectRegion.iTop >= 0 && gSelectRegion.iTop <= gSelectRegion.iBottom ); + Assert( gSelectRegion.iLeft >= 0 && gSelectRegion.iLeft <= gSelectRegion.iRight ); + for( y = gSelectRegion.iTop; y <= gSelectRegion.iBottom; y++ ) + { + for( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ ) + { + LEVELNODE* pNode; + iMapIndex = y * WORLD_COLS + x; + if( gfUsingOffset ) + iMapIndex += ROOF_OFFSET; + pNode = gpWorldLevelData[ iMapIndex ].pTopmostHead; + while( pNode ) + { + if( pNode->usIndex == FIRSTPOINTERS1 || pNode->usIndex == FIRSTPOINTERS5 ) + { + RemoveTopmost( iMapIndex, pNode->usIndex ); + break; + } + pNode = pNode->pNext; + } + } + } + fValidCursor = FALSE; + gfUsingOffset = FALSE; +} + +void RemoveBadMarker() +{ + LEVELNODE *pNode; + if( sBadMarker < 0 ) + return; + pNode = gpWorldLevelData[ sBadMarker ].pTopmostHead; + while( pNode ) + { + if( pNode->usIndex == BADMARKER1 ) + { + RemoveTopmost( sBadMarker, pNode->usIndex ); + sBadMarker = -1; + break; + } + pNode = pNode->pNext; + } +} + +void UpdateCursorAreas() +{ + INT32 x, y, iMapIndex; + + RemoveCursors(); + + EnsureSelectionType(); + + //Determine if the mouse is currently in the world. + if( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA && GetMouseXY( &sGridX, &sGridY ) ) + { + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + if( gpBuildingLayoutList ) + { + gSelectRegion.iLeft = gSelectRegion.iRight = sGridX; + gSelectRegion.iTop = gSelectRegion.iBottom = sGridY; + fValidCursor = TRUE; + DrawBuildingLayout( iMapIndex ); + } + else switch( gusSelectionType ) + { + case SMALLSELECTION: + gSelectRegion.iLeft = gSelectRegion.iRight = sGridX; + gSelectRegion.iTop = gSelectRegion.iBottom = sGridY; + fValidCursor = TRUE; + break; + case MEDIUMSELECTION: + case LARGESELECTION: + case XLARGESELECTION: + //The mouse mode value reflects the size of the cursor. + gSelectRegion.iTop = sGridY - gusSelectionType; + gSelectRegion.iBottom = sGridY + gusSelectionType; + gSelectRegion.iLeft = sGridX - gusSelectionType; + gSelectRegion.iRight = sGridX + gusSelectionType; + ValidateSelectionRegionBoundaries(); + fValidCursor = TRUE; + break; + case LINESELECTION: + fValidCursor = HandleAreaSelection(); + ForceAreaSelectionWidth(); + ValidateSelectionRegionBoundaries(); + break; + case AREASELECTION: + fValidCursor = HandleAreaSelection(); + break; + } + } + //Draw all of the area cursors here. + if( fValidCursor ) + { + if( iDrawMode == DRAW_MODE_ENEMY || iDrawMode == DRAW_MODE_CREATURE || + iDrawMode == DRAW_MODE_REBEL || iDrawMode == DRAW_MODE_CIVILIAN || + iDrawMode == DRAW_MODE_SCHEDULEACTION ) + { + iMapIndex = gSelectRegion.iTop * WORLD_COLS + gSelectRegion.iLeft; + if( !IsLocationSittable( iMapIndex, gfRoofPlacement ) && iDrawMode != DRAW_MODE_SCHEDULEACTION || + !IsLocationSittableExcludingPeople( iMapIndex, gfRoofPlacement ) && iDrawMode == DRAW_MODE_SCHEDULEACTION ) + { + if( sBadMarker != iMapIndex ) + { + RemoveBadMarker(); + if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) ) + { + AddTopmostToTail( iMapIndex + ROOF_OFFSET, BADMARKER1 ); + sBadMarker = (INT16)(iMapIndex + ROOF_OFFSET ); + } + else + { + AddTopmostToTail( (iMapIndex), BADMARKER1 ); + sBadMarker = (INT16)(iMapIndex); + } + } + } + else + { + RemoveBadMarker(); + if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) ) + { + AddTopmostToTail( iMapIndex + ROOF_OFFSET, FIRSTPOINTERS5 ); + gfUsingOffset = TRUE; + } + else + AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 ); + } + } + else for( y = gSelectRegion.iTop; y <= gSelectRegion.iBottom; y++ ) + { + for( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 ); + } + } + } +} + +void ForceAreaSelectionWidth() +{ + UINT16 gusDecSelWidth; + + //If the anchor isn't set, we don't want to force the size yet. + if( !fAnchored ) + return; + + gusDecSelWidth = gusSelectionWidth - 1; + + //compare the region with the anchor and determine if we are going to force size via + //height or width depending on the cursor distance from the anchor. + if( abs( sGridX - gSelectAnchor.iX ) < abs( sGridY - gSelectAnchor.iY ) ) + { //restrict the x axis + if( sGridX < gSelectAnchor.iX ) + { //to the left + gSelectRegion.iLeft = gSelectAnchor.iX - gusDecSelWidth; + gSelectRegion.iRight = gSelectAnchor.iX; + } + else + { //to the right + gSelectRegion.iLeft = gSelectAnchor.iX; + gSelectRegion.iRight = gSelectAnchor.iX + gusDecSelWidth; + } + } + else + { //restrict the y axis + if( sGridY < gSelectAnchor.iY ) + { //to the upper + gSelectRegion.iTop = gSelectAnchor.iY - gusDecSelWidth; + gSelectRegion.iBottom = gSelectAnchor.iY; + } + else + { //to the lower + gSelectRegion.iBottom = gSelectAnchor.iY + gusDecSelWidth; + gSelectRegion.iTop = gSelectAnchor.iY; + } + } +} + +BOOLEAN HandleAreaSelection() +{ + //When the user releases the left button, then clear and process the area. + if( fAnchored ) + { + if( !gfLeftButtonState && !gfCurrentSelectionWithRightButton || + !gfRightButtonState && gfCurrentSelectionWithRightButton ) + { + fAnchored = FALSE; + ProcessAreaSelection( (BOOLEAN)!gfCurrentSelectionWithRightButton ); + gfCurrentSelectionWithRightButton = FALSE; + return FALSE; + } + } + //When the user first clicks, anchor the area. + if( !fAnchored ) + { + if( gfLeftButtonState || gfRightButtonState && gfAllowRightButtonSelections ) + { + if( gfRightButtonState && !gfLeftButtonState ) + gfCurrentSelectionWithRightButton = TRUE; + else + gfCurrentSelectionWithRightButton = FALSE; + fAnchored = TRUE; + gSelectAnchor.iX = sGridX; + gSelectAnchor.iY = sGridY; + gSelectRegion.iLeft = gSelectRegion.iRight = sGridX; + gSelectRegion.iTop = gSelectRegion.iBottom = sGridY; + return TRUE; + } + } + //If no anchoring, then we are really dealing with a single cursor, + //until the user clicks and holds the mouse button to anchor the cursor. + if( !fAnchored ) + { + gSelectRegion.iLeft = gSelectRegion.iRight = sGridX; + gSelectRegion.iTop = gSelectRegion.iBottom = sGridY; + return TRUE; + } + //Base the area from the anchor to the current mouse position. + if ( sGridX <= gSelectAnchor.iX ) + { + gSelectRegion.iLeft = sGridX; + gSelectRegion.iRight = gSelectAnchor.iX; + } + else + { + gSelectRegion.iRight = sGridX; + gSelectRegion.iLeft = gSelectAnchor.iX; + } + if ( sGridY <= gSelectAnchor.iY ) + { + gSelectRegion.iTop = sGridY; + gSelectRegion.iBottom = gSelectAnchor.iY; + } + else + { + gSelectRegion.iBottom = sGridY; + gSelectRegion.iTop = gSelectAnchor.iY; + } + return TRUE; +} + +void ValidateSelectionRegionBoundaries() +{ + gSelectRegion.iLeft = max( min( 159, gSelectRegion.iLeft ), 0 ); + gSelectRegion.iRight = max( min( 159, gSelectRegion.iRight ), 0 ); + gSelectRegion.iTop = max( min( 159, gSelectRegion.iTop ), 0 ); + gSelectRegion.iBottom = max( min( 159, gSelectRegion.iBottom ), 0 ); +} + +void EnsureSelectionType() +{ + BOOLEAN fPrevBrushEnabledState = gfBrushEnabled; + + //At time of writing, the only drawing mode supporting right mouse button + //area selections is the cave drawing mode. + gfAllowRightButtonSelections = ( iDrawMode == DRAW_MODE_CAVES ); + + //if we are erasing, we have more flexibility with the drawing modes. + if( iDrawMode >= DRAW_MODE_ERASE ) + { + //erase modes supporting any cursor mode + gusSavedSelectionType = gusSelectionType; + gusSelectionWidth = gusPreserveSelectionWidth; + gfBrushEnabled = TRUE; + } + else switch( iDrawMode ) + { //regular modes + case DRAW_MODE_SAW_ROOM: + case DRAW_MODE_ROOM: + case DRAW_MODE_CAVES: + gusSavedBuildingSelectionType = gusSelectionType; + gusSelectionWidth = gusPreserveSelectionWidth; + gfBrushEnabled = TRUE; + break; + case DRAW_MODE_SLANTED_ROOF: + gusSelectionType = LINESELECTION; + gusSelectionWidth = 8; + gfBrushEnabled = FALSE; + break; + case DRAW_MODE_EXITGRID: + case DRAW_MODE_ROOMNUM: + case DRAW_MODE_FLOORS: + case DRAW_MODE_GROUND: + case DRAW_MODE_OSTRUCTS: + case DRAW_MODE_OSTRUCTS1: + case DRAW_MODE_OSTRUCTS2: + case DRAW_MODE_DEBRIS: + //supports all modes + gusSavedSelectionType = gusSelectionType; + gusSelectionWidth = gusPreserveSelectionWidth; + gfBrushEnabled = TRUE; + break; + default: + gusSelectionType = SMALLSELECTION; + gusSelectionWidth = gusPreserveSelectionWidth; + gfBrushEnabled = FALSE; + break; + } + + if( gfBrushEnabled != fPrevBrushEnabledState ) + { + if( gfBrushEnabled ) + { + EnableEditorButton( TERRAIN_CYCLE_BRUSHSIZE ); + EnableEditorButton( BUILDING_CYCLE_BRUSHSIZE ); + EnableEditorButton( MAPINFO_CYCLE_BRUSHSIZE ); + } + else + { + DisableEditorButton( TERRAIN_CYCLE_BRUSHSIZE ); + DisableEditorButton( BUILDING_CYCLE_BRUSHSIZE ); + DisableEditorButton( MAPINFO_CYCLE_BRUSHSIZE ); + } + } +} + +void DrawBuildingLayout( INT32 iMapIndex ) +{ + BUILDINGLAYOUTNODE *curr; + INT32 iOffset; + LEVELNODE* pNode; + BOOLEAN fAdd; + iOffset = iMapIndex - gsBuildingLayoutAnchorGridNo; + curr = gpBuildingLayoutList; + while( curr ) + { + iMapIndex = curr->sGridNo + iOffset; + if( iMapIndex > 0 && iMapIndex < WORLD_MAX ) + { + fAdd = TRUE; + pNode = gpWorldLevelData[ iMapIndex ].pTopmostHead; + while( pNode ) + { + if( pNode->usIndex == FIRSTPOINTERS1 ) + { + fAdd = FALSE; + break; + } + pNode = pNode->pNext; + } + if( fAdd ) + AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 ); + } + curr = curr->next; + } +} + +void RemoveBuildingLayout() +{ + BUILDINGLAYOUTNODE *curr; + INT32 iOffset; + INT32 iMapIndex; + iMapIndex = gSelectRegion.iLeft + gSelectRegion.iTop * WORLD_COLS; + iOffset = iMapIndex - gsBuildingLayoutAnchorGridNo; + curr = gpBuildingLayoutList; + while( curr ) + { + iMapIndex = curr->sGridNo + iOffset; + if( iMapIndex > 0 && iMapIndex < WORLD_MAX ) + RemoveTopmost( iMapIndex, FIRSTPOINTERS1 ); + curr = curr->next; + } +} + +#endif \ No newline at end of file diff --git a/Editor/Cursor Modes.h b/Editor/Cursor Modes.h new file mode 100644 index 00000000..13c57bbc --- /dev/null +++ b/Editor/Cursor Modes.h @@ -0,0 +1,38 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __CURSOR_MODES_H +#define __CURSOR_MODES_H + +enum +{ + SMALLSELECTION, // 1x1 + MEDIUMSELECTION, // 3x3 + LARGESELECTION, // 5x5 + XLARGESELECTION, // 7x7 + LINESELECTION, // v or h line with a specified width + AREASELECTION, // user controlled area + NUMSELECTIONTYPES +}; + +extern UINT16 gusSelectionType; +extern UINT16 gusSelectionWidth; +extern UINT16 gusPreserveSelectionWidth; +extern UINT16 gusSelectionDensity; +extern UINT16 gusSavedSelectionType; +extern UINT16 gusSavedBuildingSelectionType; + +BOOLEAN PerformDensityTest(); +void SetDrawingMode( INT32 iMode ); +void UpdateCursorAreas(); +void IncreaseSelectionDensity(); +void DecreaseSelectionDensity(); +void RemoveCursors(); + +extern UINT16 *wszSelType[6]; + +extern BOOLEAN gfCurrentSelectionWithRightButton; + +#endif + +#endif \ No newline at end of file diff --git a/Editor/Editor All.h b/Editor/Editor All.h new file mode 100644 index 00000000..da876d15 --- /dev/null +++ b/Editor/Editor All.h @@ -0,0 +1,127 @@ +#include "BuildDefines.h" + +#ifndef __EDITOR_ALL_H +#define __EDITOR_ALL_H + +#ifdef JA2EDITOR + +#pragma message("GENERATED PCH FOR EDITOR PROJECT.") + +//external +#include "types.h" +#include +#include +#include "Action Items.h" +#include "Button System.h" +#include "debug.h" +#include "english.h" +#include "environment.h" +#include "Exit Grids.h" +#include "font.h" +#include "Font Control.h" +#include "Keys.h" +#include "input.h" +#include "interface.h" +#include "Interface Items.h" +#include "Isometric Utils.h" +#include "interface panels.h" +#include "lighting.h" +#include "Map Information.h" +#include "mousesystem.h" +#include "Overhead.h" +#include "Overhead map.h" +#include "overhead types.h" +#include "pits.h" +#include "random.h" +#include "Render Fun.h" +#include "Render Dirty.h" +#include "renderworld.h" +#include "Simple Render Utils.h" +#include "Soldier Create.h" +#include "Soldier Find.h" +#include "sysutil.h" +#include "Text.h" +#include "Text Input.h" +#include "tiledef.h" +#include "utilities.h" +#include "video.h" +#include "vobject.h" +#include "vobject_blitters.h" +#include "vsurface.h" +#include "wcheck.h" +#include "weapons.h" +#include "wordwrap.h" +#include "WorldDat.h" +#include "worlddef.h" +#include "World Items.h" +#include "worldman.h" +#include "line.h" +#include "Animation Data.h" +#include "Animation Control.h" +#include "Soldier Init List.h" +#include "StrategicMap.h" +#include "Soldier Add.h" +#include "Soldier Control.h" +#include "soldier profile type.h" +#include "Soldier Profile.h" +#include "Inventory Choosing.h" +#include "Scheduling.h" +#include "Timer Control.h" +#include "sgp.h" +#include "screenids.h" +#include "Sys Globals.h" +#include "Interactive Tiles.h" +#include "Handle UI.h" +#include "Event Pump.h" +#include "message.h" +#include "Game Clock.h" +#include "Game Init.h" +#include "Map Edgepoints.h" +#include "Music Control.h" +#include +#include "Item Types.h" +#include "Items.h" +#include "Handle Items.h" +#include "Animated ProgressBar.h" +#include "gameloop.h" +#include +#include "Structure Internals.h" +#include "Cursors.h" +#include "FileMan.h" +#include "Summary Info.h" +#include "time.h" +#include "structure wrap.h" +#include "MessageBoxScreen.h" +#include "GameSettings.h" + + +//internal +#include "Cursor Modes.h" +#include "edit_sys.h" +#include "Editor Callback Prototypes.h" +#include "Editor Modes.h" +#include "Editor Taskbar Creation.h" +#include "Editor Taskbar Utils.h" +#include "Editor Undo.h" +#include "EditorBuildings.h" +#include "EditorDefines.h" +#include "EditorItems.h" +#include "EditorMapInfo.h" +#include "EditorMercs.h" +#include "EditorTerrain.h" +#include "editscreen.h" +#include "Item Statistics.h" +#include "LoadScreen.h" +#include "messagebox.h" +#include "newsmooth.h" +#include "popupmenu.h" +#include "Road Smoothing.h" +#include "Sector Summary.h" +#include "selectwin.h" +#include "SmartMethod.h" +#include "smooth.h" +#include "Smoothing Utils.h" + +#endif + +#endif diff --git a/Editor/Editor Callback Prototypes.h b/Editor/Editor Callback Prototypes.h new file mode 100644 index 00000000..28bbcb3d --- /dev/null +++ b/Editor/Editor Callback Prototypes.h @@ -0,0 +1,157 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDITOR_CALLBACK_PROTOTYPES_H +#define __EDITOR_CALLBACK_PROTOTYPES_H + +// Editor Tabs +void TaskTerrainCallback(GUI_BUTTON *btn,INT32 reason); +void TaskBuildingCallback(GUI_BUTTON *btn,INT32 reason); +void TaskItemsCallback(GUI_BUTTON *btn,INT32 reason); +void TaskMercsCallback(GUI_BUTTON *btn,INT32 reason); +void TaskMapInfoCallback(GUI_BUTTON *btn,INT32 reason); +void TaskOptionsCallback(GUI_BUTTON *btn,INT32 reason); +// Options Tab Callbacks +void BtnLoadCallback(GUI_BUTTON *btn,INT32 reason); +void BtnSaveCallback(GUI_BUTTON *btn,INT32 reason); +void BtnCancelCallback(GUI_BUTTON *btn,INT32 reason); +void BtnQuitCallback( GUI_BUTTON *btn, INT32 reason ); +void BtnNewMapCallback(GUI_BUTTON *btn,INT32 reason); +void BtnNewBasementCallback( GUI_BUTTON *btn, INT32 reason ); +void BtnNewCavesCallback( GUI_BUTTON *btn, INT32 reason ); +void BtnChangeTilesetCallback(GUI_BUTTON *btn,INT32 reason); +// Mercs Tab Callbacks +void MercsTogglePlayers( GUI_BUTTON *btn, INT32 reason ); +void MercsToggleEnemies( GUI_BUTTON *btn, INT32 reason ); +void MercsToggleCreatures( GUI_BUTTON *btn, INT32 reason ); +void MercsToggleRebels( GUI_BUTTON *btn, INT32 reason ); +void MercsToggleCivilians( GUI_BUTTON *btn, INT32 reason ); +void MercsPlayerTeamCallback(GUI_BUTTON *btn,INT32 reason); +void MercsEnemyTeamCallback(GUI_BUTTON *btn,INT32 reason); +void MercsCreatureTeamCallback(GUI_BUTTON *btn,INT32 reason); +void MercsRebelTeamCallback(GUI_BUTTON *btn,INT32 reason); +void MercsCivilianTeamCallback(GUI_BUTTON *btn,INT32 reason); +void MercsDetailedPlacementCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsPriorityExistanceCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsHasKeysCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsNextCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsDeleteCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsGeneralModeCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsAttributesModeCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsInventoryModeCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsAppearanceModeCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsProfileModeCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleModeCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsSetEnemyColorCodeCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsSetOrdersCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsSetAttitudeCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsDirectionSetCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsFindSelectedMercCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsSetRelativeEquipmentCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsSetRelativeAttributesCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsToggleColorModeCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsSetColorsCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsSetBodyTypeCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsInventorySlotCallback( GUI_BUTTON *btn, INT32 reason ); +void MouseMovedInMercRegion( MOUSE_REGION *reg, INT32 reason ); +void MouseClickedInMercRegion( MOUSE_REGION *reg, INT32 reason ); +void MercsCivilianGroupCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleAction1Callback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleAction2Callback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleAction3Callback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleAction4Callback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleData1ACallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleData1BCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleData2ACallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleData2BCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleData3ACallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleData3BCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleData4ACallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleData4BCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleClearCallback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleToggleVariance1Callback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleToggleVariance2Callback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleToggleVariance3Callback( GUI_BUTTON *btn, INT32 reason ); +void MercsScheduleToggleVariance4Callback( GUI_BUTTON *btn, INT32 reason ); +// Terrain Tab Callbacks +void BtnLandRaiseCallback(GUI_BUTTON *btn,INT32 reason); +void BtnLandLowerCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIncBrushDensityCallback(GUI_BUTTON *btn,INT32 reason); +void BtnDecBrushDensityCallback(GUI_BUTTON *btn,INT32 reason); +void BtnFgGrndCallback(GUI_BUTTON *btn,INT32 reason); +void BtnBkGrndCallback(GUI_BUTTON *btn,INT32 reason); +void BtnObjectCallback(GUI_BUTTON *btn,INT32 reason); +void BtnBanksCallback(GUI_BUTTON *btn,INT32 reason); +void BtnRoadsCallback(GUI_BUTTON *btn,INT32 reason); +void BtnDebrisCallback(GUI_BUTTON *btn,INT32 reason); +void BtnBrushCallback(GUI_BUTTON *btn,INT32 reason); +void BtnObject1Callback(GUI_BUTTON *btn,INT32 reason); +void BtnObject2Callback(GUI_BUTTON *btn,INT32 reason); +void BtnFillCallback(GUI_BUTTON *btn,INT32 reason); +void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason); +// Items Tab Callbacks +void ItemsWeaponsCallback(GUI_BUTTON *btn,INT32 reason); +void ItemsAmmoCallback(GUI_BUTTON *btn,INT32 reason); +void ItemsArmourCallback(GUI_BUTTON *btn,INT32 reason); +void ItemsExplosivesCallback(GUI_BUTTON *btn,INT32 reason); +void ItemsEquipment1Callback(GUI_BUTTON *btn,INT32 reason); +void ItemsEquipment2Callback(GUI_BUTTON *btn,INT32 reason); +void ItemsEquipment3Callback(GUI_BUTTON *btn,INT32 reason); +void ItemsTriggersCallback(GUI_BUTTON *btn,INT32 reason); +void ItemsKeysCallback(GUI_BUTTON *btn, INT32 reason); +void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason); +void ItemsRightScrollCallback(GUI_BUTTON *btn, INT32 reason); +void MouseMovedInItemsRegion(MOUSE_REGION *reg, INT32 reason); +void MouseClickedInItemsRegion(MOUSE_REGION *reg, INT32 reason); +// MapInfo Callbacks +void BtnFakeLightCallback(GUI_BUTTON *btn,INT32 reason); +void MapInfoPrimeTimeRadioCallback( GUI_BUTTON *btn, INT32 reason ); +void MapInfoNightTimeRadioCallback( GUI_BUTTON *btn, INT32 reason ); +void MapInfo24HourTimeRadioCallback( GUI_BUTTON *btn, INT32 reason ); +void BtnDrawLightsCallback(GUI_BUTTON *btn,INT32 reason); +void MapInfoDrawExitGridCallback( GUI_BUTTON *btn, INT32 reason ); +void MapInfoEntryPointsCallback( GUI_BUTTON *btn, INT32 reason ); +void MapInfoNormalRadioCallback( GUI_BUTTON *btn, INT32 reason ); +void MapInfoBasementRadioCallback( GUI_BUTTON *btn, INT32 reason ); +void MapInfoCavesRadioCallback( GUI_BUTTON *btn, INT32 reason ); +// Building callbacks +void BuildingWallCallback( GUI_BUTTON *btn, INT32 reason ); +void BuildingDoorCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingWindowCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingRoofCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingCrackWallCallback( GUI_BUTTON *btn, INT32 reason ); +void BuildingFurnitureCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingDecalCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingFloorCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingToiletCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingSmartWallCallback( GUI_BUTTON *btn, INT32 reason ); +void BuildingSmartDoorCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingSmartWindowCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingSmartCrackWallCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingDoorKeyCallback(GUI_BUTTON *btn, INT32 reason ); +void BuildingNewRoomCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingNewRoofCallback(GUI_BUTTON *btn, INT32 reason ); +void BuildingSawRoomCallback( GUI_BUTTON *btn, INT32 reason ); +void BuildingKillBuildingCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingCopyBuildingCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingMoveBuildingCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingCaveDrawingCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingDrawRoomNumCallback(GUI_BUTTON *btn, INT32 reason); +void BuildingEraseRoomNumCallback( GUI_BUTTON *btn, INT32 reason ); +void BuildingToggleRoofViewCallback(GUI_BUTTON *btn,INT32 reason); +void BuildingToggleWallViewCallback(GUI_BUTTON *btn,INT32 reason); +void BuildingToggleInfoViewCallback(GUI_BUTTON *btn,INT32 reason); + +// ItemStats Callbacks +void ItemStatsToggleHideCallback( GUI_BUTTON *btn, INT32 reason ); +void ItemStatsDeleteCallback( GUI_BUTTON *btn, INT32 reason ); + + +// Various Callbacks +void BtnUndoCallback(GUI_BUTTON *btn,INT32 reason); +void BtnEraseCallback(GUI_BUTTON *btn,INT32 reason); + + + +#endif +#endif \ No newline at end of file diff --git a/Editor/Editor Callbacks.cpp b/Editor/Editor Callbacks.cpp new file mode 100644 index 00000000..60fcef1d --- /dev/null +++ b/Editor/Editor Callbacks.cpp @@ -0,0 +1,1342 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "types.h" + #include "Button System.h" + #include "EditorDefines.h" + + #include "Editor Taskbar Utils.h" + #include "renderworld.h" + #include "EditorItems.h" + + #include "Editor Callback Prototypes.h" + #include "Editor Modes.h" + + #include "EditorBuildings.h" + #include "EditorMercs.h" + #include "editscreen.h" + #include "Item Statistics.h" + #include "Cursor Modes.h" + #include "popupmenu.h" + #include "Simple Render Utils.h" + #include "Soldier Init List.h" + #include "Overhead.h" + #include "Scheduling.h" + #include "input.h" + #include "Map Information.h" + #include "EditorMapInfo.h" +#endif + +extern SOLDIERINITNODE *gpSelected; +extern SCHEDULENODE gCurrSchedule; +extern void ExtractAndUpdateMercSchedule(); + +//TERRAIN +void BtnFgGrndCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason&MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorTerrainTaskbarMode( TERRAIN_FGROUND_TEXTURES ); + } +} + +void BtnBkGrndCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason&MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorTerrainTaskbarMode( TERRAIN_BGROUND_TEXTURES ); + } +} + +void BtnObjectCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason&MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_TREES ); + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_TREES ); + iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS; + } +} + +void BtnObject1Callback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason&MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_ROCKS ); + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_ROCKS ); + iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS1; + } +} + + +void BtnObject2Callback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason&MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_MISC ); + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_MISC ); + iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS2; + } +} + + +void BtnBanksCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason&MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_CLIFFS ); + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_CLIFFS ); + iEditorToolbarState = TBAR_MODE_GET_BANKS; + } +} + +void BtnRoadsCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_ROADS ); + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_ROADS ); + iEditorToolbarState = TBAR_MODE_GET_ROADS; + } +} + +void BtnDebrisCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason&MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_DEBRIS ); + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorTerrainTaskbarMode( TERRAIN_PLACE_DEBRIS ); + iEditorToolbarState = TBAR_MODE_GET_DEBRIS; + } +} + +void BtnBrushCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditorToolbarState = TBAR_MODE_CHANGE_BRUSH; + } +} + +void BtnFillCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorTerrainTaskbarMode( TERRAIN_FILL_AREA ); + } +} + + +void BtnIncBrushDensityCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditorToolbarState = TBAR_MODE_DENS_UP; + } +} + + +void BtnDecBrushDensityCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditorToolbarState = TBAR_MODE_DENS_DWN; + } +} + +//BUILDINGS +void BuildingWallCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_WALLS ); + iDrawMode = DRAW_MODE_WALLS; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_WALLS ); + iEditorToolbarState = TBAR_MODE_GET_WALL; + } +} + +void BuildingDoorCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_DOORS ); + iDrawMode = DRAW_MODE_DOORS; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_DOORS ); + iEditorToolbarState = TBAR_MODE_GET_DOOR; + } +} + +void BuildingWindowCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_WINDOWS ); + iDrawMode = DRAW_MODE_WINDOWS; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_WINDOWS ); + iEditorToolbarState = TBAR_MODE_GET_WINDOW; + } +} + +void BuildingRoofCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_ROOFS ); + iDrawMode = DRAW_MODE_ROOFS; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_ROOFS ); + iEditorToolbarState = TBAR_MODE_GET_ROOF; + } +} + +void BuildingCrackWallCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_BROKEN_WALLS ); + iDrawMode = DRAW_MODE_BROKEN_WALLS; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_BROKEN_WALLS ); + iEditorToolbarState = TBAR_MODE_GET_BROKEN_WALL; + } +} + +void BuildingFloorCallback(GUI_BUTTON *btn, INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_FLOORS ); + iDrawMode = DRAW_MODE_FLOORS; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_FLOORS ); + iEditorToolbarState = TBAR_MODE_GET_FLOOR; + } +} + +void BuildingToiletCallback(GUI_BUTTON *btn, INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_TOILETS ); + iDrawMode = DRAW_MODE_TOILET; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_TOILETS ); + iEditorToolbarState = TBAR_MODE_GET_TOILET; + } +} + +void BuildingFurnitureCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_FURNITURE ); + iDrawMode = DRAW_MODE_DECOR; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_FURNITURE ); + iEditorToolbarState = TBAR_MODE_GET_DECOR; + } +} + +void BuildingDecalCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_DECALS ); + iDrawMode = DRAW_MODE_DECALS; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorBuildingTaskbarMode( BUILDING_PLACE_DECALS ); + iEditorToolbarState = TBAR_MODE_GET_DECAL; + } +} + +void BuildingSmartWallCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + SetEditorBuildingTaskbarMode( BUILDING_SMART_WALLS ); + iDrawMode = DRAW_MODE_SMART_WALLS; + } +} + +void BuildingSmartWindowCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_SMART_WINDOWS ); + iDrawMode = DRAW_MODE_SMART_WINDOWS; + } +} + +void BuildingSmartDoorCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_SMART_DOORS ); + iDrawMode = DRAW_MODE_SMART_DOORS; + } +} + +void BuildingSmartCrackWallCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_SMART_BROKEN_WALLS ); + iDrawMode = DRAW_MODE_SMART_BROKEN_WALLS; + } +} + +void BuildingDoorKeyCallback(GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + SetEditorBuildingTaskbarMode( BUILDING_DOORKEY ); + iDrawMode = DRAW_MODE_DOORKEYS; + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + SetEditorBuildingTaskbarMode( BUILDING_DOORKEY ); + iDrawMode = DRAW_MODE_DOORKEYS; + FindNextLockedDoor(); + } +} + +void BuildingNewRoomCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_NEW_ROOM ); + gusSelectionType = gusSavedBuildingSelectionType; + iDrawMode = DRAW_MODE_ROOM; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + SetEditorBuildingTaskbarMode( BUILDING_NEW_ROOM ); + gusSelectionType = gusSavedBuildingSelectionType; + iDrawMode = DRAW_MODE_ROOM; + iEditorToolbarState = TBAR_MODE_GET_ROOM; + } +} + +void BuildingNewRoofCallback(GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + SetEditorBuildingTaskbarMode( BUILDING_NEW_ROOF ); + iDrawMode = DRAW_MODE_NEWROOF; + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) + { + SetEditorBuildingTaskbarMode( BUILDING_NEW_ROOF ); + iDrawMode = DRAW_MODE_NEWROOF; + iEditorToolbarState = TBAR_MODE_GET_NEW_ROOF; + } +} + +void BuildingCaveDrawingCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + SetEditorBuildingTaskbarMode( BUILDING_CAVE_DRAWING ); + gusSelectionType = gusSavedBuildingSelectionType; + iDrawMode = DRAW_MODE_CAVES; + } +} + +void BuildingSawRoomCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + SetEditorBuildingTaskbarMode( BUILDING_SAW_ROOM ); + gusSelectionType = gusSavedBuildingSelectionType; + iDrawMode = DRAW_MODE_SAW_ROOM; + } +} + + +void BuildingKillBuildingCallback(GUI_BUTTON *btn, INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_KILL_BUILDING ); + iDrawMode = DRAW_MODE_KILL_BUILDING; + } +} + +void BuildingCopyBuildingCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + SetEditorBuildingTaskbarMode( BUILDING_COPY_BUILDING ); + iDrawMode = DRAW_MODE_COPY_BUILDING; + } +} + +void BuildingMoveBuildingCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + SetEditorBuildingTaskbarMode( BUILDING_MOVE_BUILDING ); + iDrawMode = DRAW_MODE_MOVE_BUILDING; + } +} + +void BuildingDrawRoomNumCallback(GUI_BUTTON *btn, INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + SetEditorBuildingTaskbarMode( BUILDING_DRAW_ROOMNUM ); + iDrawMode = DRAW_MODE_ROOMNUM; + gubCurrRoomNumber = gubMaxRoomNumber; + } +} + +void BuildingEraseRoomNumCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason &MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + SetEditorBuildingTaskbarMode( BUILDING_ERASE_ROOMNUM ); + iDrawMode = DRAW_MODE_ROOMNUM + DRAW_MODE_ERASE; + } +} + +void BuildingToggleRoofViewCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( fBuildingShowRoofs ^= 1 ) + { + ClickEditorButton( BUILDING_TOGGLE_ROOF_VIEW ); + } + else + { + UnclickEditorButton( BUILDING_TOGGLE_ROOF_VIEW ); + } + //Name could be a bit misleading. It'll hide or show the roofs based on the + //fBuildingShowRoofs value. + UpdateRoofsView(); + } +} + +void BuildingToggleWallViewCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( fBuildingShowWalls ^= 1 ) + { + ClickEditorButton( BUILDING_TOGGLE_WALL_VIEW ); + } + else + { + UnclickEditorButton( BUILDING_TOGGLE_WALL_VIEW ); + } + //Name could be a bit misleading. It'll hide or show the walls based on the + //fBuildingShowWalls value. + UpdateWallsView(); + } +} + +void BuildingToggleInfoViewCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( fBuildingShowRoomInfo ^= 1 ) + { + ClickEditorButton( BUILDING_TOGGLE_INFO_VIEW ); + } + else + { + UnclickEditorButton( BUILDING_TOGGLE_INFO_VIEW ); + } + gfRenderWorld = TRUE; + } +} + +//MAPINFO +void BtnFakeLightCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + btn->uiFlags &= (~BUTTON_CLICKED_ON); + else + btn->uiFlags |= BUTTON_CLICKED_ON; + + iEditorToolbarState = TBAR_MODE_FAKE_LIGHTING; + } +} + +void BtnDrawLightsCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorMapInfoTaskbarMode( MAPINFO_ADD_LIGHT1_SOURCE ); +} + +void MapInfoDrawExitGridCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetEditorMapInfoTaskbarMode( MAPINFO_DRAW_EXITGRIDS ); + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + SetEditorMapInfoTaskbarMode( MAPINFO_DRAW_EXITGRIDS ); + LocateNextExitGrid(); + } +} + +void MapInfoEntryPointsCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & (MSYS_CALLBACK_REASON_LBUTTON_UP | MSYS_CALLBACK_REASON_RBUTTON_UP) ) + { + INT16 x, sGridNo; + for( x = MAPINFO_NORTH_POINT; x <= MAPINFO_ISOLATED_POINT; x++ ) + { + if( btn == ButtonList[ iEditorButton[ x ] ] ) + { + SetEditorMapInfoTaskbarMode( x ); + if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + switch( x ) + { + case MAPINFO_NORTH_POINT: sGridNo = gMapInformation.sNorthGridNo; break; + case MAPINFO_WEST_POINT: sGridNo = gMapInformation.sWestGridNo; break; + case MAPINFO_EAST_POINT: sGridNo = gMapInformation.sEastGridNo; break; + case MAPINFO_SOUTH_POINT: sGridNo = gMapInformation.sSouthGridNo; break; + case MAPINFO_CENTER_POINT: sGridNo = gMapInformation.sCenterGridNo; break; + case MAPINFO_ISOLATED_POINT: sGridNo = gMapInformation.sIsolatedGridNo; break; + } + if( sGridNo != -1 ) + { + CenterScreenAtMapIndex( sGridNo ); + } + } + break; + } + } + } +} + +void MapInfoNormalRadioCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetEditorMapInfoTaskbarMode( MAPINFO_RADIO_NORMAL ); +} + +void MapInfoBasementRadioCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetEditorMapInfoTaskbarMode( MAPINFO_RADIO_BASEMENT ); +} + +void MapInfoCavesRadioCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetEditorMapInfoTaskbarMode( MAPINFO_RADIO_CAVES ); +} + +void MapInfoPrimeTimeRadioCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + ChangeLightDefault( PRIMETIME_LIGHT ); +} + +void MapInfoNightTimeRadioCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + ChangeLightDefault( NIGHTTIME_LIGHT ); +} + +void MapInfo24HourTimeRadioCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + ChangeLightDefault( ALWAYSON_LIGHT ); +} + +//OPTIONS +void BtnNewMapCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditorToolbarState = TBAR_MODE_NEW_MAP; + gfPendingBasement = FALSE; + gfPendingCaves = FALSE; + } +} + +void BtnNewBasementCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditorToolbarState = TBAR_MODE_NEW_MAP; + gfPendingBasement = TRUE; + gfPendingCaves = FALSE; + } +} + +void BtnNewCavesCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditorToolbarState = TBAR_MODE_NEW_MAP; + gfPendingBasement = FALSE; + gfPendingCaves = TRUE; + } +} + +void BtnSaveCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditorToolbarState = TBAR_MODE_SAVE; + } +} + +void BtnLoadCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditorToolbarState = TBAR_MODE_LOAD; + } +} + +void BtnChangeTilesetCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + iEditorToolbarState = TBAR_MODE_CHANGE_TILESET; + } +} + +void BtnCancelCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason&MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditorToolbarState = TBAR_MODE_EXIT_EDIT; + } +} + +void BtnQuitCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + iEditorToolbarState = TBAR_MODE_QUIT_GAME; + } +} + +//ITEMS +void MouseMovedInItemsRegion( MOUSE_REGION *reg, INT32 reason ) +{ + HandleItemsPanel( gusMouseXPos, gusMouseYPos, GUI_MOVE_EVENT ); +} + +void MouseClickedInItemsRegion(MOUSE_REGION *reg, INT32 reason) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + HandleItemsPanel( gusMouseXPos, gusMouseYPos, GUI_LCLICK_EVENT ); + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + HandleItemsPanel( gusMouseXPos, gusMouseYPos, GUI_RCLICK_EVENT ); +} + +void ItemsWeaponsCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorItemsTaskbarMode( ITEMS_WEAPONS ); +} + +void ItemsAmmoCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorItemsTaskbarMode( ITEMS_AMMO ); +} + +void ItemsArmourCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorItemsTaskbarMode( ITEMS_ARMOUR ); +} + +void ItemsExplosivesCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorItemsTaskbarMode( ITEMS_EXPLOSIVES ); +} + +void ItemsEquipment1Callback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorItemsTaskbarMode( ITEMS_EQUIPMENT1 ); +} + +void ItemsEquipment2Callback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorItemsTaskbarMode( ITEMS_EQUIPMENT2 ); +} + +void ItemsEquipment3Callback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorItemsTaskbarMode( ITEMS_EQUIPMENT3 ); +} + +void ItemsTriggersCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorItemsTaskbarMode( ITEMS_TRIGGERS ); +} + +void ItemsKeysCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + SetEditorItemsTaskbarMode( ITEMS_KEYS ); +} + +void ItemsLeftScrollCallback(GUI_BUTTON *btn, INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + gfRenderTaskbar = TRUE; + eInfo.sScrollIndex--; + if( !eInfo.sScrollIndex ) + DisableButton( iEditorButton[ITEMS_LEFTSCROLL] ); + if( eInfo.sScrollIndex < ((eInfo.sNumItems+1)/2)-6 ) + EnableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); + } +} + +void ItemsRightScrollCallback(GUI_BUTTON *btn, INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + gfRenderTaskbar = TRUE; + eInfo.sScrollIndex++; + EnableButton( iEditorButton[ITEMS_LEFTSCROLL] ); + if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0) ) + DisableButton( iEditorButton[ITEMS_RIGHTSCROLL] ); + } +} + +//MERCS +void MercsTogglePlayers( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfShowPlayers = btn->uiFlags & BUTTON_CLICKED_ON ? TRUE : FALSE; + SetMercTeamVisibility( OUR_TEAM, gfShowCivilians ); + } +} + +void MercsToggleEnemies( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfShowEnemies = btn->uiFlags & BUTTON_CLICKED_ON ? TRUE : FALSE; + SetMercTeamVisibility( ENEMY_TEAM, gfShowEnemies ); + } +} + +void MercsToggleCreatures( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfShowCreatures = btn->uiFlags & BUTTON_CLICKED_ON ? TRUE : FALSE; + SetMercTeamVisibility( CREATURE_TEAM, gfShowCreatures ); + } +} + +void MercsToggleRebels( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfShowRebels = btn->uiFlags & BUTTON_CLICKED_ON ? TRUE : FALSE; + SetMercTeamVisibility( MILITIA_TEAM, gfShowRebels ); + } +} + +void MercsToggleCivilians( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfShowCivilians = btn->uiFlags & BUTTON_CLICKED_ON ? TRUE : FALSE; + SetMercTeamVisibility( CIV_TEAM, gfShowCivilians ); + } +} + +void MercsPlayerTeamCallback(GUI_BUTTON *btn,INT32 reason) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + ClickEditorButton( MERCS_PLAYER ); + UnclickEditorButton( MERCS_ENEMY ); + UnclickEditorButton( MERCS_CREATURE ); + UnclickEditorButton( MERCS_REBEL ); + UnclickEditorButton( MERCS_CIVILIAN ); + iDrawMode = DRAW_MODE_PLAYER; + SetMercEditingMode ( MERC_TEAMMODE ); + } +} + +void MercsEnemyTeamCallback(GUI_BUTTON *btn,INT32 reason) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UnclickEditorButton( MERCS_PLAYER ); + ClickEditorButton( MERCS_ENEMY ); + UnclickEditorButton( MERCS_CREATURE ); + UnclickEditorButton( MERCS_REBEL ); + UnclickEditorButton( MERCS_CIVILIAN ); + iDrawMode = DRAW_MODE_ENEMY; + SetMercEditingMode ( MERC_TEAMMODE ); + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + IndicateSelectedMerc( SELECT_NEXT_ENEMY ); + } +} + +void MercsCreatureTeamCallback(GUI_BUTTON *btn,INT32 reason) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UnclickEditorButton( MERCS_PLAYER ); + UnclickEditorButton( MERCS_ENEMY ); + ClickEditorButton( MERCS_CREATURE ); + UnclickEditorButton( MERCS_REBEL ); + UnclickEditorButton( MERCS_CIVILIAN ); + iDrawMode = DRAW_MODE_CREATURE; + SetMercEditingMode ( MERC_TEAMMODE ); + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + IndicateSelectedMerc( SELECT_NEXT_CREATURE ); + } +} + +void MercsRebelTeamCallback(GUI_BUTTON *btn,INT32 reason) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UnclickEditorButton( MERCS_PLAYER ); + UnclickEditorButton( MERCS_ENEMY ); + UnclickEditorButton( MERCS_CREATURE ); + ClickEditorButton( MERCS_REBEL ); + UnclickEditorButton( MERCS_CIVILIAN ); + iDrawMode = DRAW_MODE_REBEL; + SetMercEditingMode ( MERC_TEAMMODE ); + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + IndicateSelectedMerc( SELECT_NEXT_REBEL ); + } +} + +void MercsCivilianTeamCallback(GUI_BUTTON *btn,INT32 reason) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UnclickEditorButton( MERCS_PLAYER ); + UnclickEditorButton( MERCS_ENEMY ); + UnclickEditorButton( MERCS_CREATURE ); + UnclickEditorButton( MERCS_REBEL ); + ClickEditorButton( MERCS_CIVILIAN ); + iDrawMode = DRAW_MODE_CIVILIAN; + SetMercEditingMode ( MERC_TEAMMODE ); + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + IndicateSelectedMerc( SELECT_NEXT_CIV ); + } +} + +void MercsNextCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + IndicateSelectedMerc( SELECT_NEXT_MERC ); + } +} + +void MercsDeleteCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + DeleteSelectedMerc(); + SetMercEditingMode( MERC_TEAMMODE ); + } +} + +void MercsInventorySlotCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + INT32 uiSlot; + uiSlot = MSYS_GetBtnUserData( btn, 0 ); + if( btn->uiFlags & BUTTON_CLICKED_ON ) + SetEnemyDroppableStatus( uiSlot, TRUE ); + else + SetEnemyDroppableStatus( uiSlot, FALSE ); + } +} + +void MercsSetEnemyColorCodeCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT8 ubColorCode; + ubColorCode = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + SetEnemyColorCode( ubColorCode ); + } +} + +void MercsCivilianGroupCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + iEditorToolbarState = TBAR_MODE_CIVILIAN_GROUP; + } +} + + +void MercsScheduleAction1Callback( GUI_BUTTON *btn, INT32 reason ) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) + { + gubCurrentScheduleActionIndex = 0; + InitPopupMenu( iEditorButton[ MERCS_SCHEDULE_ACTION1 ], SCHEDULEACTION_POPUP, DIR_UPRIGHT ); + } +} + +void MercsScheduleAction2Callback( GUI_BUTTON *btn, INT32 reason ) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) + { + gubCurrentScheduleActionIndex = 1; + InitPopupMenu( iEditorButton[ MERCS_SCHEDULE_ACTION2 ], SCHEDULEACTION_POPUP, DIR_UPRIGHT ); + } +} + +void MercsScheduleAction3Callback( GUI_BUTTON *btn, INT32 reason ) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) + { + gubCurrentScheduleActionIndex = 2; + InitPopupMenu( iEditorButton[ MERCS_SCHEDULE_ACTION3 ], SCHEDULEACTION_POPUP, DIR_UPRIGHT ); + } +} + +void MercsScheduleAction4Callback( GUI_BUTTON *btn, INT32 reason ) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) + { + gubCurrentScheduleActionIndex = 3; + InitPopupMenu( iEditorButton[ MERCS_SCHEDULE_ACTION4 ], SCHEDULEACTION_POPUP, DIR_UPRIGHT ); + } +} + +void MercsScheduleToggleVariance1Callback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + gCurrSchedule.usFlags |= SCHEDULE_FLAGS_VARIANCE1; + else + gCurrSchedule.usFlags &= ~SCHEDULE_FLAGS_VARIANCE1; + } +} + +void MercsScheduleToggleVariance2Callback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + gCurrSchedule.usFlags |= SCHEDULE_FLAGS_VARIANCE2; + else + gCurrSchedule.usFlags &= ~SCHEDULE_FLAGS_VARIANCE2; + } +} + +void MercsScheduleToggleVariance3Callback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + gCurrSchedule.usFlags |= SCHEDULE_FLAGS_VARIANCE3; + else + gCurrSchedule.usFlags &= ~SCHEDULE_FLAGS_VARIANCE3; + } +} + +void MercsScheduleToggleVariance4Callback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + gCurrSchedule.usFlags |= SCHEDULE_FLAGS_VARIANCE4; + else + gCurrSchedule.usFlags &= ~SCHEDULE_FLAGS_VARIANCE4; + } +} + +void MercsScheduleData1ACallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gubCurrentScheduleActionIndex = 0; + StartScheduleAction(); + gfSingleAction = TRUE; + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + FindScheduleGridNo( 0 ); + } +} + +void MercsScheduleData1BCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gubCurrentScheduleActionIndex = 0; + gfUseScheduleData2 = FALSE; + RegisterCurrentScheduleAction( gCurrSchedule.usData1[0] ); + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + FindScheduleGridNo( 1 ); + } +} + +void MercsScheduleData2ACallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gubCurrentScheduleActionIndex = 1; + StartScheduleAction(); + gfSingleAction = TRUE; + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + FindScheduleGridNo( 2 ); + } +} + +void MercsScheduleData2BCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gubCurrentScheduleActionIndex = 1; + gfUseScheduleData2 = FALSE; + RegisterCurrentScheduleAction( gCurrSchedule.usData1[1] ); + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + FindScheduleGridNo( 3 ); + } +} + +void MercsScheduleData3ACallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gubCurrentScheduleActionIndex = 2; + StartScheduleAction(); + gfSingleAction = TRUE; + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + FindScheduleGridNo( 4 ); + } +} + +void MercsScheduleData3BCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gubCurrentScheduleActionIndex = 2; + gfUseScheduleData2 = FALSE; + RegisterCurrentScheduleAction( gCurrSchedule.usData1[2] ); + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + FindScheduleGridNo( 5 ); + } +} + +void MercsScheduleData4ACallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gubCurrentScheduleActionIndex = 3; + StartScheduleAction(); + gfSingleAction = TRUE; + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + FindScheduleGridNo( 6 ); + } +} + +void MercsScheduleData4BCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gubCurrentScheduleActionIndex = 3; + gfUseScheduleData2 = FALSE; + RegisterCurrentScheduleAction( gCurrSchedule.usData1[3] ); + } + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + FindScheduleGridNo( 7 ); + } +} + +void MercsScheduleClearCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + ClearCurrentSchedule(); + ExtractAndUpdateMercSchedule(); + } +} + + +void MercsDetailedPlacementCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) //button is checked + { + InitDetailedPlacementForMerc(); + SetMercEditingMode( MERC_GENERALMODE ); + } + else //button is unchecked. + { + KillDetailedPlacementForMerc(); + SetMercEditingMode( MERC_BASICMODE ); + } + } +} + +void MercsPriorityExistanceCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( gpSelected ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) //button is checked + { + gpSelected->pBasicPlacement->fPriorityExistance = TRUE; + } + else //button is unchecked. + { + gpSelected->pBasicPlacement->fPriorityExistance = FALSE; + } + } + } +} + +void MercsHasKeysCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( gpSelected ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) //button is checked + { + gpSelected->pBasicPlacement->fHasKeys = TRUE; + } + else //button is unchecked. + { + gpSelected->pBasicPlacement->fHasKeys = FALSE; + } + if( gpSelected->pDetailedPlacement ) + { + gpSelected->pDetailedPlacement->fHasKeys = gpSelected->pBasicPlacement->fHasKeys; + } + } + } +} + +void MercsGeneralModeCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercEditingMode( MERC_GENERALMODE ); +} + +void MercsAttributesModeCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercEditingMode( MERC_ATTRIBUTEMODE ); +} + +void MercsInventoryModeCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercEditingMode( MERC_INVENTORYMODE ); +} + +void MercsAppearanceModeCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercEditingMode( MERC_APPEARANCEMODE ); +} + +void MercsProfileModeCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercEditingMode( MERC_PROFILEMODE ); +} + +void MercsScheduleModeCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercEditingMode( MERC_SCHEDULEMODE ); +} + + +//multiple orders buttons +void MercsSetOrdersCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercOrders( (UINT8)MSYS_GetBtnUserData( btn, 0) ); +} + +//multiple attitude buttons +void MercsSetAttitudeCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercAttitude( (UINT8)MSYS_GetBtnUserData( btn, 0) ); +} + +//multiple direction buttons +void MercsDirectionSetCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercDirection( (UINT8)MSYS_GetBtnUserData( btn, 0) ); +} + +void MercsFindSelectedMercCallback( GUI_BUTTON *btn, INT32 reason ) +{ + SOLDIERTYPE *pSoldier; + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( gsSelectedMercID == -1 ) + return; + GetSoldier( &pSoldier, gsSelectedMercID ); + if( !pSoldier ) + return; + CenterScreenAtMapIndex( pSoldier->sGridNo ); + } +} + +void MercsSetRelativeEquipmentCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercRelativeEquipment( (INT8)MSYS_GetBtnUserData( btn, 0 ) ); +} + +void MercsSetRelativeAttributesCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + SetMercRelativeAttributes( (INT8)MSYS_GetBtnUserData( btn, 0 ) ); +} + +void MouseMovedInMercRegion( MOUSE_REGION *reg, INT32 reason ) +{ + HandleMercInventoryPanel( reg->RelativeXPos, reg->RelativeYPos, GUI_MOVE_EVENT ); +} + +void MouseClickedInMercRegion( MOUSE_REGION *reg, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + HandleMercInventoryPanel( reg->RelativeXPos, reg->RelativeYPos, GUI_LCLICK_EVENT ); + else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + HandleMercInventoryPanel( reg->RelativeXPos, reg->RelativeYPos, GUI_RCLICK_EVENT ); +} + +//VARIOUS +void BtnUndoCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditorToolbarState = TBAR_MODE_UNDO; + } +} + +void BtnEraseCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( iDrawMode >= DRAW_MODE_ERASE ) + btn->uiFlags &= (~BUTTON_CLICKED_ON); + else + btn->uiFlags |= BUTTON_CLICKED_ON; + iEditorToolbarState = (btn->uiFlags & BUTTON_CLICKED_ON) ? (TBAR_MODE_ERASE) : (TBAR_MODE_ERASE_OFF); + } +} + +//ITEM STATS +void ItemStatsToggleHideCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + ExecuteItemStatsCmd( ITEMSTATS_HIDE ); + else + ExecuteItemStatsCmd( ITEMSTATS_SHOW ); + } +} + +void ItemStatsDeleteCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + ExecuteItemStatsCmd( ITEMSTATS_DELETE ); +} + + +#endif \ No newline at end of file diff --git a/Editor/Editor Modes.cpp b/Editor/Editor Modes.cpp new file mode 100644 index 00000000..95bfa4e1 --- /dev/null +++ b/Editor/Editor Modes.cpp @@ -0,0 +1,395 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "types.h" + #include "Editor Modes.h" + #include "Editor Taskbar Utils.h" + #include "EditorDefines.h" + #include "EditorItems.h" + #include "EditorBuildings.h" + #include "EditorTerrain.h" + #include "Cursor Modes.h" + #include "Map Information.h" + #include "editscreen.h" + #include "selectwin.h" + #include "environment.h" + #include "worlddef.h" + #include "Exit Grids.h" + #include "Worldman.h" +#endif + +BOOLEAN gfShowExitGrids = FALSE; + +void SetEditorItemsTaskbarMode( UINT16 usNewMode ) +{ + UnclickEditorButtons( ITEMS_WEAPONS, ITEMS_KEYS ); + switch( usNewMode ) + { + case ITEMS_WEAPONS: + ClickEditorButton( ITEMS_WEAPONS ); + iEditorToolbarState = TBAR_MODE_ITEM_WEAPONS; + break; + case ITEMS_AMMO: + ClickEditorButton( ITEMS_AMMO ); + iEditorToolbarState = TBAR_MODE_ITEM_AMMO; + break; + case ITEMS_ARMOUR: + ClickEditorButton( ITEMS_ARMOUR ); + iEditorToolbarState = TBAR_MODE_ITEM_ARMOUR; + break; + case ITEMS_EXPLOSIVES: + ClickEditorButton( ITEMS_EXPLOSIVES ); + iEditorToolbarState = TBAR_MODE_ITEM_EXPLOSIVES; + break; + case ITEMS_EQUIPMENT1: + ClickEditorButton( ITEMS_EQUIPMENT1 ); + iEditorToolbarState = TBAR_MODE_ITEM_EQUIPMENT1; + break; + case ITEMS_EQUIPMENT2: + ClickEditorButton( ITEMS_EQUIPMENT2 ); + iEditorToolbarState = TBAR_MODE_ITEM_EQUIPMENT2; + break; + case ITEMS_EQUIPMENT3: + ClickEditorButton( ITEMS_EQUIPMENT3 ); + iEditorToolbarState = TBAR_MODE_ITEM_EQUIPMENT3; + break; + case ITEMS_TRIGGERS: + ClickEditorButton( ITEMS_TRIGGERS ); + iEditorToolbarState = TBAR_MODE_ITEM_TRIGGERS; + break; + case ITEMS_KEYS: + ClickEditorButton( ITEMS_KEYS ); + iEditorToolbarState = TBAR_MODE_ITEM_KEYS; + break; + } +} + +#define NO_EFFECT 2 + +void SetEditorBuildingTaskbarMode( UINT16 usNewMode ) +{ + BOOLEAN fNewGroup = FALSE; + BOOLEAN fNewRoofs, fNewWalls, fNewRoomInfo; + if( usNewMode == usCurrentMode ) + { + ClickEditorButton( usNewMode ); + return; + } + usCurrentMode = usNewMode; + //Unclick all of the building section buttons first -- except the view modes. + UnclickEditorButton( BUILDING_PLACE_WALLS ); + UnclickEditorButton( BUILDING_PLACE_DOORS ); + UnclickEditorButton( BUILDING_PLACE_WINDOWS ); + UnclickEditorButton( BUILDING_PLACE_ROOFS ); + UnclickEditorButton( BUILDING_PLACE_BROKEN_WALLS ); + UnclickEditorButton( BUILDING_PLACE_FURNITURE ); + UnclickEditorButton( BUILDING_PLACE_DECALS ); + UnclickEditorButton( BUILDING_PLACE_FLOORS ); + UnclickEditorButton( BUILDING_PLACE_TOILETS ); + UnclickEditorButton( BUILDING_SMART_WALLS ); + UnclickEditorButton( BUILDING_SMART_DOORS ); + UnclickEditorButton( BUILDING_SMART_WINDOWS ); + UnclickEditorButton( BUILDING_SMART_BROKEN_WALLS ); + UnclickEditorButton( BUILDING_DOORKEY ); + UnclickEditorButton( BUILDING_NEW_ROOM ); + UnclickEditorButton( BUILDING_NEW_ROOF ); + UnclickEditorButton( BUILDING_CAVE_DRAWING ); + UnclickEditorButton( BUILDING_SAW_ROOM ); + UnclickEditorButton( BUILDING_KILL_BUILDING ); + UnclickEditorButton( BUILDING_COPY_BUILDING ); + UnclickEditorButton( BUILDING_MOVE_BUILDING ); + UnclickEditorButton( BUILDING_DRAW_ROOMNUM ); + ClickEditorButton( usNewMode ); + + gfRenderDrawingMode = TRUE; + + //Clicking on certain buttons will automatically activate/deactive certain views. + switch( usNewMode ) + { + case BUILDING_KILL_BUILDING://Show everything + fNewWalls = TRUE; + fNewRoofs = TRUE; + fNewRoomInfo = TRUE; + break; + case BUILDING_NEW_ROOF: + case BUILDING_PLACE_ROOFS: + fNewWalls = TRUE; + fNewRoofs = TRUE; + fNewRoomInfo = FALSE; + break; + case BUILDING_DRAW_ROOMNUM: //Show room info + case BUILDING_ERASE_ROOMNUM: //Show room info + fNewWalls = NO_EFFECT; + fNewRoofs = gfBasement ? TRUE : FALSE; + fNewRoomInfo = TRUE; + break; + case BUILDING_PLACE_DOORS: + case BUILDING_PLACE_WINDOWS: + case BUILDING_PLACE_WALLS: + case BUILDING_PLACE_BROKEN_WALLS: + case BUILDING_PLACE_FLOORS: + case BUILDING_PLACE_TOILETS: + case BUILDING_PLACE_FURNITURE: + case BUILDING_PLACE_DECALS: + case BUILDING_SMART_WALLS: + case BUILDING_SMART_DOORS: + case BUILDING_SMART_WINDOWS: + case BUILDING_SMART_BROKEN_WALLS: + case BUILDING_DOORKEY: + case BUILDING_SAW_ROOM: + case BUILDING_NEW_ROOM: + case BUILDING_COPY_BUILDING: + case BUILDING_MOVE_BUILDING: + case BUILDING_CAVE_DRAWING: + fNewRoofs = gfBasement ? TRUE : FALSE; + fNewWalls = TRUE; + fNewRoomInfo = FALSE; + if( usNewMode == BUILDING_PLACE_FLOORS ) + gusSelectionType = gusSavedSelectionType; + break; + default: + return; + } + UnclickEditorButton( BUILDING_TOGGLE_INFO_VIEW ); + if( fNewWalls != NO_EFFECT && fNewWalls != fBuildingShowWalls ) + { + if( fNewWalls ) + ClickEditorButton( BUILDING_TOGGLE_WALL_VIEW ); + else + UnclickEditorButton( BUILDING_TOGGLE_WALL_VIEW ); + fBuildingShowWalls = fNewWalls; + UpdateWallsView(); + } + if( fNewRoofs != NO_EFFECT && fNewRoofs != fBuildingShowRoofs ) + { + if( fNewRoofs ) + ClickEditorButton( BUILDING_TOGGLE_ROOF_VIEW ); + else + UnclickEditorButton( BUILDING_TOGGLE_ROOF_VIEW ); + fBuildingShowRoofs = fNewRoofs; + UpdateRoofsView(); + } + if( fNewRoomInfo != NO_EFFECT && fNewRoomInfo != fBuildingShowRoomInfo ) + { + if( fNewRoomInfo ) + ClickEditorButton( BUILDING_TOGGLE_INFO_VIEW ); + else + UnclickEditorButton( BUILDING_TOGGLE_INFO_VIEW ); + fBuildingShowRoomInfo = fNewRoomInfo; + gfRenderWorld = TRUE; + } +} + +void SetEditorTerrainTaskbarMode( UINT16 usNewMode ) +{ + UnclickEditorButton( TERRAIN_FGROUND_TEXTURES ); + UnclickEditorButton( TERRAIN_BGROUND_TEXTURES ); + UnclickEditorButton( TERRAIN_PLACE_CLIFFS ); + UnclickEditorButton( TERRAIN_PLACE_DEBRIS ); + UnclickEditorButton( TERRAIN_PLACE_TREES ); + UnclickEditorButton( TERRAIN_PLACE_ROCKS ); + UnclickEditorButton( TERRAIN_PLACE_MISC ); + UnclickEditorButton( TERRAIN_FILL_AREA ); + TerrainTileDrawMode=0; + + gfRenderDrawingMode = TRUE; + + switch( usNewMode ) + { + case TERRAIN_FGROUND_TEXTURES: + TerrainTileDrawMode = TERRAIN_TILES_FOREGROUND; + ClickEditorButton( TERRAIN_FGROUND_TEXTURES ); + iDrawMode = DRAW_MODE_GROUND; + gusSelectionType = gusSavedSelectionType; + break; + case TERRAIN_BGROUND_TEXTURES: + TerrainTileDrawMode = TERRAIN_TILES_BACKGROUND; + ClickEditorButton( TERRAIN_BGROUND_TEXTURES ); + iDrawMode = DRAW_MODE_NEW_GROUND; + break; + case TERRAIN_PLACE_CLIFFS: + ClickEditorButton( TERRAIN_PLACE_CLIFFS ); + iDrawMode = DRAW_MODE_BANKS; + break; + case TERRAIN_PLACE_ROADS: + ClickEditorButton( TERRAIN_PLACE_ROADS ); + iDrawMode = DRAW_MODE_ROADS; + break; + case TERRAIN_PLACE_DEBRIS: + ClickEditorButton( TERRAIN_PLACE_DEBRIS ); + iDrawMode = DRAW_MODE_DEBRIS; + gusSelectionType = gusSavedSelectionType; + break; + case TERRAIN_PLACE_TREES: + ClickEditorButton( TERRAIN_PLACE_TREES ); + iDrawMode = DRAW_MODE_OSTRUCTS; + gusSelectionType = gusSavedSelectionType; + break; + case TERRAIN_PLACE_ROCKS: + ClickEditorButton( TERRAIN_PLACE_ROCKS ); + iDrawMode = DRAW_MODE_OSTRUCTS1; + gusSelectionType = gusSavedSelectionType; + break; + case TERRAIN_PLACE_MISC: + ClickEditorButton( TERRAIN_PLACE_MISC ); + iDrawMode = DRAW_MODE_OSTRUCTS2; + gusSelectionType = gusSavedSelectionType; + break; + case TERRAIN_FILL_AREA: + ClickEditorButton( TERRAIN_FILL_AREA ); + iDrawMode = DRAW_MODE_FILL_AREA + DRAW_MODE_GROUND; + TerrainTileDrawMode=1; + break; + } +} + +void ShowExitGrids() +{ + UINT16 i; + LEVELNODE *pLevelNode; + if( gfShowExitGrids ) + return; + gfShowExitGrids = TRUE; + for( i = 0; i < WORLD_MAX; i++ ) + { + if( GetExitGridLevelNode( i, &pLevelNode ) ) + { + AddTopmostToTail( i, FIRSTPOINTERS8 ); + } + } +} + +void HideExitGrids() +{ + UINT16 i; + LEVELNODE *pLevelNode; + if( !gfShowExitGrids ) + return; + gfShowExitGrids = FALSE; + for( i = 0; i < WORLD_MAX; i++ ) + { + if( GetExitGridLevelNode( i, &pLevelNode ) ) + { + pLevelNode = gpWorldLevelData[ i ].pTopmostHead; + while( pLevelNode ) + { + if( pLevelNode->usIndex == FIRSTPOINTERS8 ) + { + RemoveTopmost( i, pLevelNode->usIndex ); + break; + } + pLevelNode = pLevelNode->pNext; + } + } + } +} + +void SetEditorMapInfoTaskbarMode( UINT16 usNewMode ) +{ + BOOLEAN fShowExitGrids = FALSE; + UnclickEditorButton( MAPINFO_ADD_LIGHT1_SOURCE ); + UnclickEditorButton( MAPINFO_DRAW_EXITGRIDS ); + UnclickEditorButton( MAPINFO_NORTH_POINT ); + UnclickEditorButton( MAPINFO_WEST_POINT ); + UnclickEditorButton( MAPINFO_CENTER_POINT ); + UnclickEditorButton( MAPINFO_EAST_POINT ); + UnclickEditorButton( MAPINFO_SOUTH_POINT ); + UnclickEditorButton( MAPINFO_ISOLATED_POINT ); + ClickEditorButton( usNewMode ); + switch( usNewMode ) + { + case MAPINFO_ADD_LIGHT1_SOURCE: + iDrawMode = DRAW_MODE_LIGHT; + break; + case MAPINFO_DRAW_EXITGRIDS: + iDrawMode = DRAW_MODE_EXITGRID; + gusSelectionType = gusSavedSelectionType; + fShowExitGrids = TRUE; + break; + case MAPINFO_NORTH_POINT: + iDrawMode = DRAW_MODE_NORTHPOINT; + break; + case MAPINFO_WEST_POINT: + iDrawMode = DRAW_MODE_WESTPOINT; + break; + case MAPINFO_EAST_POINT: + iDrawMode = DRAW_MODE_EASTPOINT; + break; + case MAPINFO_SOUTH_POINT: + iDrawMode = DRAW_MODE_SOUTHPOINT; + break; + case MAPINFO_CENTER_POINT: + iDrawMode = DRAW_MODE_CENTERPOINT; + break; + case MAPINFO_ISOLATED_POINT: + iDrawMode = DRAW_MODE_ISOLATEDPOINT; + break; + case MAPINFO_RADIO_NORMAL: + SetEditorSmoothingMode( SMOOTHING_NORMAL ); + gfRenderTaskbar = TRUE; + break; + case MAPINFO_RADIO_BASEMENT: + SetEditorSmoothingMode( SMOOTHING_BASEMENT ); + gfRenderTaskbar = TRUE; + break; + case MAPINFO_RADIO_CAVES: + SetEditorSmoothingMode( SMOOTHING_CAVES ); + gfRenderTaskbar = TRUE; + break; + } + if( fShowExitGrids ) + { + ShowExitGrids(); + } + else + { + HideExitGrids(); + } +} + + +void SetEditorSmoothingMode( UINT8 ubNewMode ) +{ + UnclickEditorButtons( MAPINFO_RADIO_NORMAL, MAPINFO_RADIO_CAVES ); + if( iCurrentTaskbar == TASK_BUILDINGS ) + HideEditorButtons( BUILDING_NEW_ROOM, BUILDING_CAVE_DRAWING ); + gfBasement = FALSE; + gfCaves = FALSE; + gMapInformation.ubEditorSmoothingType = SMOOTHING_NORMAL; + switch( ubNewMode ) + { + case SMOOTHING_NORMAL: + ClickEditorButton( MAPINFO_RADIO_NORMAL ); + if( iCurrentTaskbar == TASK_BUILDINGS ) + ShowEditorButtons( BUILDING_NEW_ROOM, BUILDING_MOVE_BUILDING ); + EnableEditorButtons( BUILDING_SMART_WALLS, BUILDING_SMART_BROKEN_WALLS ); + break; + case SMOOTHING_BASEMENT: + gfBasement = TRUE; + ClickEditorButton( MAPINFO_RADIO_BASEMENT ); + if( iCurrentTaskbar == TASK_BUILDINGS ) + ShowEditorButtons( BUILDING_NEW_ROOM, BUILDING_KILL_BUILDING ); + EnableEditorButtons( BUILDING_SMART_WALLS, BUILDING_SMART_BROKEN_WALLS ); + break; + case SMOOTHING_CAVES: + gfCaves = TRUE; + ClickEditorButton( MAPINFO_RADIO_CAVES ); + if( iCurrentTaskbar == TASK_BUILDINGS ) + ShowEditorButton( BUILDING_CAVE_DRAWING ); + DisableEditorButtons( BUILDING_SMART_WALLS, BUILDING_SMART_BROKEN_WALLS ); + break; + default: + AssertMsg( 0, "Attempting to set an illegal smoothing mode." ); + break; + } + gMapInformation.ubEditorSmoothingType = ubNewMode; +} + +#endif \ No newline at end of file diff --git a/Editor/Editor Modes.h b/Editor/Editor Modes.h new file mode 100644 index 00000000..5b6eb61e --- /dev/null +++ b/Editor/Editor Modes.h @@ -0,0 +1,17 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDITOR_MODES_H +#define __EDITOR_MODES_H + +void SetEditorItemsTaskbarMode( UINT16 usNewMode ); +void SetEditorBuildingTaskbarMode( UINT16 usNewMode ); +void SetEditorTerrainTaskbarMode( UINT16 usNewMode ); +void SetEditorMapInfoTaskbarMode( UINT16 usNewMode ); +void SetEditorSmoothingMode( UINT8 ubNewMode ); + +void ShowExitGrids(); +void HideExitGrids(); + +#endif +#endif \ No newline at end of file diff --git a/Editor/Editor Taskbar Creation.cpp b/Editor/Editor Taskbar Creation.cpp new file mode 100644 index 00000000..ddc267f7 --- /dev/null +++ b/Editor/Editor Taskbar Creation.cpp @@ -0,0 +1,809 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + //sgp + #include "Button System.h" + #include "Font Control.h" + #include "debug.h" + //editor + #include "EditorDefines.h" + #include "Editor Callback Prototypes.h" + #include "Editor Taskbar Utils.h" + #include "EditorMercs.h" + #include "EditorMapInfo.h" + //tactical + #include "Soldier Create.h" + #include "overhead types.h" +#endif + +//Category tabs of the editor buttons +void InitEditorTerrainToolbar(); +void InitEditorBuildingsToolbar(); +void InitEditorItemsToolbar(); +void InitEditorMercsToolbar(); +void InitEditorMapInfoToolbar(); +void InitEditorOptionsToolbar(); +void InitEditorItemStatsButtons(); + +void InitEditorItemStatsButtons() +{ + iEditorButton[ ITEMSTATS_PANEL ] = + CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, 480, 361, 160, 99, BUTTON_TOGGLE, + MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); + SpecifyDisabledButtonStyle( iEditorButton[ ITEMSTATS_PANEL ], DISABLED_STYLE_NONE ); + DisableButton( iEditorButton[ ITEMSTATS_PANEL ] ); + iEditorButton[ ITEMSTATS_HIDDEN_BTN ] = + CreateCheckBoxButton( 485, 365, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, ItemStatsToggleHideCallback ); + iEditorButton[ ITEMSTATS_DELETE_BTN ] = + CreateTextButton( L"Delete", FONT10ARIAL, FONT_RED, FONT_BLACK, BUTTON_USE_DEFAULT, + 600, 441, 36, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL+1, DEFAULT_MOVE_CALLBACK, ItemStatsDeleteCallback ); +} + +void InitEditorMercsToolbar() +{ + INT16 TempString[30]; + UINT16 *FaceDirs[8] = {L"north",L"northeast",L"east",L"southeast",L"south",L"southwest",L"west",L"northwest"}; + INT32 x; + + iEditorButton[ MERCS_PLAYERTOGGLE ] = + CreateCheckBoxButton( 4, 362, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsTogglePlayers ); + if( gfShowPlayers ) + ClickEditorButton( MERCS_PLAYERTOGGLE ); + SetButtonFastHelpText( iEditorButton[ MERCS_PLAYERTOGGLE ], L"Toggle viewing of players"); + DisableButton( iEditorButton[ MERCS_PLAYERTOGGLE ] ); + iEditorButton[ MERCS_ENEMYTOGGLE ] = + CreateCheckBoxButton( 4, 382, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleEnemies ); + if( gfShowEnemies ) + ClickEditorButton( MERCS_ENEMYTOGGLE ); + SetButtonFastHelpText( iEditorButton[ MERCS_ENEMYTOGGLE ], L"Toggle viewing of enemies"); + iEditorButton[ MERCS_CREATURETOGGLE ] = + CreateCheckBoxButton( 4, 402, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleCreatures ); + if( gfShowCreatures ) + ClickEditorButton( MERCS_CREATURETOGGLE ); + SetButtonFastHelpText( iEditorButton[ MERCS_CREATURETOGGLE ], L"Toggle viewing of creatures"); + iEditorButton[ MERCS_REBELTOGGLE ] = + CreateCheckBoxButton( 4, 422, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleRebels ); + if( gfShowRebels ) + ClickEditorButton( MERCS_REBELTOGGLE ); + SetButtonFastHelpText( iEditorButton[ MERCS_REBELTOGGLE ], L"Toggle viewing of rebels"); + iEditorButton[ MERCS_CIVILIANTOGGLE ] = + CreateCheckBoxButton( 4, 442, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleCivilians ); + if( gfShowCivilians ) + ClickEditorButton( MERCS_CIVILIANTOGGLE ); + SetButtonFastHelpText( iEditorButton[ MERCS_CIVILIANTOGGLE ], L"Toggle viewing of civilians"); + iEditorButton[MERCS_PLAYER] = + CreateTextButton( L"Player",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT, + 20, 362, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsPlayerTeamCallback ); + SpecifyButtonDownTextColors( iEditorButton[MERCS_PLAYER], FONT_YELLOW, FONT_BLACK ); + DisableButton( iEditorButton[MERCS_PLAYER] ); + iEditorButton[MERCS_ENEMY] = + CreateTextButton( L"Enemy",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT, + 20, 382, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsEnemyTeamCallback ); + SpecifyButtonDownTextColors( iEditorButton[MERCS_ENEMY], FONT_YELLOW, FONT_BLACK ); + iEditorButton[MERCS_CREATURE] = + CreateTextButton( L"Creature",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT, + 20, 402, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsCreatureTeamCallback ); + SpecifyButtonDownTextColors( iEditorButton[MERCS_CREATURE], FONT_YELLOW, FONT_BLACK ); + iEditorButton[MERCS_REBEL] = + CreateTextButton( L"Rebels",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT, + 20, 422, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsRebelTeamCallback ); + SpecifyButtonDownTextColors( iEditorButton[MERCS_REBEL], FONT_YELLOW, FONT_BLACK ); + iEditorButton[MERCS_CIVILIAN] = + CreateTextButton( L"Civilian",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT, + 20, 442, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsCivilianTeamCallback ); + SpecifyButtonDownTextColors( iEditorButton[MERCS_CIVILIAN], FONT_YELLOW, FONT_BLACK ); + + iEditorButton[ MERCS_1 ] = + CreateTextButton( L"DETAILED PLACEMENT", SMALLCOMPFONT, FONT_ORANGE, 60, BUTTON_USE_DEFAULT, + 100, 362, 68, 20, BUTTON_TOGGLE, + MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); + DisableButton( iEditorButton[ MERCS_1 ] ); + SpecifyDisabledButtonStyle( iEditorButton[ MERCS_1 ], DISABLED_STYLE_NONE ); + SpecifyButtonTextOffsets( iEditorButton[ MERCS_1 ], 20, 4, FALSE ); + SpecifyButtonTextWrappedWidth( iEditorButton[ MERCS_1 ], 46 ); + iEditorButton[ MERCS_DETAILEDCHECKBOX ] = + CreateCheckBoxButton( 103, 365, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsDetailedPlacementCallback ); + + iEditorButton[ MERCS_GENERAL ] = + CreateEasyToggleButton( 100, 382, "EDITOR//MercGeneral.sti", MercsGeneralModeCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_GENERAL ], L"General information mode"); + iEditorButton[ MERCS_APPEARANCE ] = + CreateEasyToggleButton( 134, 382, "EDITOR//MercAppearance.sti", MercsAppearanceModeCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_APPEARANCE ], L"Physical appearance mode"); + iEditorButton[ MERCS_ATTRIBUTES ] = + CreateEasyToggleButton( 100, 408, "EDITOR//MercAttributes.sti", MercsAttributesModeCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_ATTRIBUTES ], L"Attributes mode"); + iEditorButton[ MERCS_INVENTORY ] = + CreateEasyToggleButton( 134, 408, "EDITOR//MercInventory.sti", MercsInventoryModeCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_INVENTORY ], L"Inventory mode"); + iEditorButton[ MERCS_PROFILE ] = + CreateEasyToggleButton( 100, 434, "EDITOR//MercProfile.sti", MercsProfileModeCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_PROFILE ], L"Profile ID mode"); + iEditorButton[ MERCS_SCHEDULE ] = + CreateEasyToggleButton( 134, 434, "EDITOR//MercSchedule.sti", MercsScheduleModeCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE ], L"Schedule mode"); + //Workaround for identical buttons. + MSYS_SetBtnUserData( iEditorButton[ MERCS_SCHEDULE ], 3, 0xffffffff ); + iEditorButton[ MERCS_GLOWSCHEDULE ] = + CreateEasyToggleButton( 134, 434, "EDITOR//MercGlowSchedule.sti", MercsScheduleModeCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_GLOWSCHEDULE ], L"Schedule mode"); + HideEditorButton( MERCS_GLOWSCHEDULE ); + + iEditorButton[ MERCS_DELETE ] = + CreateTextButton( L"DELETE", (UINT16)SMALLCOMPFONT, FONT_DKBLUE, FONT_BLACK, BUTTON_USE_DEFAULT, + 600, 362, 40, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsDeleteCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_DELETE ], L"Delete currently selected merc (DEL)."); + iEditorButton[ MERCS_NEXT ] = + CreateTextButton( L"NEXT", (UINT16)SMALLCOMPFONT, FONT_DKBLUE, FONT_BLACK, BUTTON_USE_DEFAULT, + 600, 382, 40, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsNextCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_NEXT ], L"Find next merc (SPACE)."); + + //Priority Existance + iEditorButton[ MERCS_PRIORITYEXISTANCE_CHECKBOX ] = + CreateCheckBoxButton( 170, 365, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsPriorityExistanceCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_PRIORITYEXISTANCE_CHECKBOX ], L"Toggle priority existance" ); + + //If merc has keys + iEditorButton[ MERCS_HASKEYS_CHECKBOX ] = + CreateCheckBoxButton( 170, 390, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsHasKeysCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_HASKEYS_CHECKBOX ], L"Toggle whether or not placement has/naccess to all doors." ); + + //Orders + iEditorButton[ MERCS_ORDERS_STATIONARY ] = + CreateTextButton( L"STATIONARY", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + 200, 368, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetOrdersCallback ); + iEditorButton[ MERCS_ORDERS_ONGUARD] = + CreateTextButton( L"ON GUARD", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + 200, 380, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetOrdersCallback ); + iEditorButton[ MERCS_ORDERS_ONCALL ] = + CreateTextButton( L"ON CALL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + 200, 392, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetOrdersCallback ); + iEditorButton[ MERCS_ORDERS_SEEKENEMY ] = + CreateTextButton( L"SEEK ENEMY", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + 200, 404, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetOrdersCallback ); + iEditorButton[ MERCS_ORDERS_CLOSEPATROL ] = + CreateTextButton( L"CLOSE PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + 270, 368, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetOrdersCallback ); + iEditorButton[ MERCS_ORDERS_FARPATROL ] = + CreateTextButton( L"FAR PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + 270, 380, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetOrdersCallback ); + iEditorButton[ MERCS_ORDERS_POINTPATROL ] = + CreateTextButton( L"POINT PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + 270, 392, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetOrdersCallback ); + iEditorButton[ MERCS_ORDERS_RNDPTPATROL ] = + CreateTextButton( L"RND PT PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT, + 270, 404, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetOrdersCallback ); + for ( x = 0; x < 8; x++ ) + { + MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_ORDERS_BUTTON + x ], 0, x); + } + + //Attitudes + iEditorButton[ MERCS_ATTITUDE_DEFENSIVE ] = + CreateTextButton( L"DEFENSIVE", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + 200, 424, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetAttitudeCallback ); + iEditorButton[ MERCS_ATTITUDE_BRAVESOLO ] = + CreateTextButton( L"BRAVE SOLO", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + 200, 436, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetAttitudeCallback ); + iEditorButton[ MERCS_ATTITUDE_BRAVEAID ] = + CreateTextButton( L"BRAVE AID", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + 200, 448, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetAttitudeCallback ); + iEditorButton[ MERCS_ATTITUDE_AGGRESSIVE ] = + CreateTextButton( L"AGGRESSIVE", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + 270, 424, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetAttitudeCallback ); + iEditorButton[ MERCS_ATTITUDE_CUNNINGSOLO ] = + CreateTextButton( L"CUNNING SOLO", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + 270, 436, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetAttitudeCallback ); + iEditorButton[ MERCS_ATTITUDE_CUNNINGAID ] = + CreateTextButton( L"CUNNING AID", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT, + 270, 448, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, + MercsSetAttitudeCallback ); + for ( x = 0; x < 6; x++ ) + { + MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_ATTITUDE_BUTTON + x ], 0, x); + } + + iEditorButton[ MERCS_DIRECTION_W ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 7, BUTTON_USE_DEFAULT, + 360, 365, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); + iEditorButton[ MERCS_DIRECTION_NW ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 0, BUTTON_USE_DEFAULT, + 390, 365, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); + iEditorButton[ MERCS_DIRECTION_N ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 1, BUTTON_USE_DEFAULT, + 420, 365, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); + iEditorButton[ MERCS_DIRECTION_NE] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 2, BUTTON_USE_DEFAULT, + 420, 395, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); + iEditorButton[ MERCS_DIRECTION_E ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 3, BUTTON_USE_DEFAULT, + 420, 425, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); + iEditorButton[ MERCS_DIRECTION_SE ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 4, BUTTON_USE_DEFAULT, + 390, 425, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); + iEditorButton[ MERCS_DIRECTION_S ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 5, BUTTON_USE_DEFAULT, + 360, 425, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); + iEditorButton[ MERCS_DIRECTION_SW ] = + CreateIconButton((INT16)giEditMercDirectionIcons[0], 6, BUTTON_USE_DEFAULT, + 360, 395, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback ); + for ( x = 0; x < 8; x++ ) + { + swprintf( (wchar_t *)TempString, (wchar_t *)L"Set merc to face %s", FaceDirs[x] ); + SetButtonFastHelpText( iEditorButton[ FIRST_MERCS_DIRECTION_BUTTON + x ], (UINT16 *) TempString ); + MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_DIRECTION_BUTTON + x ], 0, x); + } + + iEditorButton[ MERCS_DIRECTION_FIND ] = + CreateTextButton( L"Find", (INT16)FONT12POINT1, FONT_MCOLOR_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + 390, 395, 30, 30, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsFindSelectedMercCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_DIRECTION_FIND] , L"Find selected merc" ); + + iEditorButton[ MERCS_EQUIPMENT_BAD ] = + CreateTextButton( L"BAD", (INT16)SMALLCOMPFONT, FONT_GRAY1, FONT_BLACK, BUTTON_USE_DEFAULT, + 480, 385, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeEquipmentCallback ); + SpecifyButtonDownTextColors( iEditorButton[ MERCS_EQUIPMENT_BAD ], FONT_LTRED, FONT_BLACK ); + iEditorButton[ MERCS_EQUIPMENT_POOR ] = + CreateTextButton( L"POOR", (INT16)SMALLCOMPFONT, FONT_GRAY1, FONT_BLACK, BUTTON_USE_DEFAULT, + 480, 400, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeEquipmentCallback ); + SpecifyButtonDownTextColors( iEditorButton[ MERCS_EQUIPMENT_POOR ], FONT_ORANGE, FONT_BLACK ); + iEditorButton[ MERCS_EQUIPMENT_AVERAGE ] = + CreateTextButton( L"AVERAGE", (INT16)SMALLCOMPFONT, FONT_GRAY1, FONT_BLACK, BUTTON_USE_DEFAULT, + 480, 415, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeEquipmentCallback ); + SpecifyButtonDownTextColors( iEditorButton[ MERCS_EQUIPMENT_AVERAGE ], FONT_YELLOW, FONT_BLACK ); + iEditorButton[ MERCS_EQUIPMENT_GOOD ] = + CreateTextButton( L"GOOD", (INT16)SMALLCOMPFONT, FONT_GRAY1, FONT_BLACK, BUTTON_USE_DEFAULT, + 480, 430, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeEquipmentCallback ); + SpecifyButtonDownTextColors( iEditorButton[ MERCS_EQUIPMENT_GOOD ], FONT_LTGREEN, FONT_BLACK ); + iEditorButton[ MERCS_EQUIPMENT_GREAT ] = + CreateTextButton( L"GREAT", (INT16)SMALLCOMPFONT, FONT_GRAY1, FONT_BLACK, BUTTON_USE_DEFAULT, + 480, 445, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeEquipmentCallback ); + SpecifyButtonDownTextColors( iEditorButton[ MERCS_EQUIPMENT_GREAT ], FONT_LTBLUE, FONT_BLACK ); + for ( x = 0; x < 5; x++ ) + { + MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_REL_EQUIPMENT_BUTTON + x ], 0, x); + } + + iEditorButton[ MERCS_ATTRIBUTES_BAD ] = + CreateTextButton( L"BAD", (INT16)SMALLCOMPFONT, FONT_GRAY1, FONT_BLACK, BUTTON_USE_DEFAULT, + 530, 385, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeAttributesCallback ); + SpecifyButtonDownTextColors( iEditorButton[ MERCS_ATTRIBUTES_BAD ], FONT_LTRED, FONT_BLACK ); + iEditorButton[ MERCS_ATTRIBUTES_POOR ] = + CreateTextButton( L"POOR", (INT16)SMALLCOMPFONT, FONT_GRAY1, FONT_BLACK, BUTTON_USE_DEFAULT, + 530, 400, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeAttributesCallback ); + SpecifyButtonDownTextColors( iEditorButton[ MERCS_ATTRIBUTES_POOR ], FONT_ORANGE, FONT_BLACK ); + iEditorButton[ MERCS_ATTRIBUTES_AVERAGE ] = + CreateTextButton( L"AVERAGE", (INT16)SMALLCOMPFONT, FONT_GRAY1, FONT_BLACK, BUTTON_USE_DEFAULT, + 530, 415, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeAttributesCallback ); + SpecifyButtonDownTextColors( iEditorButton[ MERCS_ATTRIBUTES_AVERAGE ], FONT_YELLOW, FONT_BLACK ); + iEditorButton[ MERCS_ATTRIBUTES_GOOD ] = + CreateTextButton( L"GOOD", (INT16)SMALLCOMPFONT, FONT_GRAY1, FONT_BLACK, BUTTON_USE_DEFAULT, + 530, 430, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeAttributesCallback ); + SpecifyButtonDownTextColors( iEditorButton[ MERCS_ATTRIBUTES_GOOD ], FONT_LTGREEN, FONT_BLACK ); + iEditorButton[ MERCS_ATTRIBUTES_GREAT ] = + CreateTextButton( L"GREAT", (INT16)SMALLCOMPFONT, FONT_GRAY1, FONT_BLACK, BUTTON_USE_DEFAULT, + 530, 445, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeAttributesCallback ); + SpecifyButtonDownTextColors( iEditorButton[ MERCS_ATTRIBUTES_GREAT ], FONT_LTBLUE, FONT_BLACK ); + for( x = 0; x < 5; x++ ) + MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_REL_ATTRIBUTE_BUTTON + x ], 0, x); + + iEditorButton[ MERCS_ARMY_CODE ] = + CreateCheckBoxButton( 575, 410, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MercsSetEnemyColorCodeCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_ARMY_CODE ], 0, SOLDIER_CLASS_ARMY ); + iEditorButton[ MERCS_ADMIN_CODE ] = + CreateCheckBoxButton( 575, 424, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MercsSetEnemyColorCodeCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_ADMIN_CODE ], 0, SOLDIER_CLASS_ADMINISTRATOR ); + iEditorButton[ MERCS_ELITE_CODE ] = + CreateCheckBoxButton( 575, 438, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MercsSetEnemyColorCodeCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_ELITE_CODE ], 0, SOLDIER_CLASS_ELITE ); + + iEditorButton[ MERCS_CIVILIAN_GROUP ] = + CreateTextButton( gszCivGroupNames[0], (INT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 574, 410, 60, 25, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsCivilianGroupCallback ); + + iEditorButton[ MERCS_TOGGLECOLOR_BUTTON ] = + CreateCheckBoxButton( 180, 364, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleColorModeCallback ); + iEditorButton[MERCS_HAIRCOLOR_DOWN] = + CreateEasyNoToggleButton( 200,364,"EDITOR//leftarrow.sti", MercsSetColorsCallback ); + iEditorButton[MERCS_HAIRCOLOR_UP] = + CreateEasyNoToggleButton( 360,364,"EDITOR//rightarrow.sti", MercsSetColorsCallback ); + iEditorButton[MERCS_SKINCOLOR_DOWN] = + CreateEasyNoToggleButton( 200,388,"EDITOR//leftarrow.sti", MercsSetColorsCallback ); + iEditorButton[MERCS_SKINCOLOR_UP] = + CreateEasyNoToggleButton( 360,388,"EDITOR//rightarrow.sti", MercsSetColorsCallback ); + iEditorButton[MERCS_VESTCOLOR_DOWN] = + CreateEasyNoToggleButton( 200,412,"EDITOR//leftarrow.sti", MercsSetColorsCallback ); + iEditorButton[MERCS_VESTCOLOR_UP] = + CreateEasyNoToggleButton( 360,412,"EDITOR//rightarrow.sti", MercsSetColorsCallback ); + iEditorButton[MERCS_PANTCOLOR_DOWN] = + CreateEasyNoToggleButton( 200,436,"EDITOR//leftarrow.sti", MercsSetColorsCallback ); + iEditorButton[MERCS_PANTCOLOR_UP] = + CreateEasyNoToggleButton( 360,436,"EDITOR//rightarrow.sti", MercsSetColorsCallback ); + for ( x = FIRST_MERCS_COLOR_BUTTON; x < LAST_MERCS_COLOR_BUTTON; x+=2 ) + { + SetButtonFastHelpText( iEditorButton[x], L"Previous color set" ); + SetButtonFastHelpText( iEditorButton[x + 1], L"Next color set" ); + DisableButton( iEditorButton[ x ] ); + DisableButton( iEditorButton[ x + 1 ] ); + } + + iEditorButton[MERCS_BODYTYPE_DOWN] = + CreateEasyNoToggleButton( 460,364,"EDITOR//leftarrow.sti", MercsSetBodyTypeCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_BODYTYPE_DOWN ], L"Previous body type"); + iEditorButton[MERCS_BODYTYPE_UP] = + CreateEasyNoToggleButton( 560,364,"EDITOR//rightarrow.sti", MercsSetBodyTypeCallback ); + SetButtonFastHelpText( iEditorButton[ MERCS_BODYTYPE_UP ], L"Next body type"); + + iEditorButton[ MERCS_SCHEDULE_VARIANCE1 ] = + CreateCheckBoxButton( 309, 375, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance1Callback ); + SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE1 ], L"Toggle time variance (+ or - 15 minutes)"); + iEditorButton[ MERCS_SCHEDULE_VARIANCE2 ] = + CreateCheckBoxButton( 309, 396, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance2Callback ); + SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE2 ], L"Toggle time variance (+ or - 15 minutes)"); + iEditorButton[ MERCS_SCHEDULE_VARIANCE3 ] = + CreateCheckBoxButton( 309, 417, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance3Callback ); + SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE3 ], L"Toggle time variance (+ or - 15 minutes)"); + iEditorButton[ MERCS_SCHEDULE_VARIANCE4 ] = + CreateCheckBoxButton( 309, 438, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance4Callback ); + SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE4 ], L"Toggle time variance (+ or - 15 minutes)"); + + iEditorButton[ MERCS_SCHEDULE_ACTION1 ] = + CreateTextButton( L"No action", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 186, 373, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleAction1Callback ); + iEditorButton[ MERCS_SCHEDULE_ACTION2 ] = + CreateTextButton( L"No action", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 186, 394, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleAction2Callback ); + iEditorButton[ MERCS_SCHEDULE_ACTION3 ] = + CreateTextButton( L"No action", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 186, 415, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleAction3Callback ); + iEditorButton[ MERCS_SCHEDULE_ACTION4 ] = + CreateTextButton( L"No action", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 186, 436, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleAction4Callback ); + + iEditorButton[ MERCS_SCHEDULE_DATA1A ] = + CreateTextButton( L"", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 331, 373, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleData1ACallback ); + iEditorButton[ MERCS_SCHEDULE_DATA1B ] = + CreateTextButton( L"", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 381, 373, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleData1BCallback ); + iEditorButton[ MERCS_SCHEDULE_DATA2A ] = + CreateTextButton( L"", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 331, 394, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleData2ACallback ); + iEditorButton[ MERCS_SCHEDULE_DATA2B ] = + CreateTextButton( L"", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 381, 394, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleData2BCallback ); + iEditorButton[ MERCS_SCHEDULE_DATA3A ] = + CreateTextButton( L"", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 331, 415, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleData3ACallback ); + iEditorButton[ MERCS_SCHEDULE_DATA3B ] = + CreateTextButton( L"", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 381, 415, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleData3BCallback ); + iEditorButton[ MERCS_SCHEDULE_DATA4A ] = + CreateTextButton( L"", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 331, 436, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleData4ACallback ); + iEditorButton[ MERCS_SCHEDULE_DATA4B ] = + CreateTextButton( L"", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 381, 436, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleData4BCallback ); + iEditorButton[ MERCS_SCHEDULE_CLEAR ] = + CreateTextButton( L"Clear Schedule", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 516, 362, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleClearCallback ); + HideEditorButtons( MERCS_SCHEDULE_DATA1A, MERCS_SCHEDULE_DATA4B ); + + iEditorButton[ MERCS_HEAD_SLOT ] = + CreateCheckBoxButton( MERCPANEL_X+61, MERCPANEL_Y+0, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_HEAD_SLOT ], 0, HELMETPOS ); + iEditorButton[ MERCS_BODY_SLOT ] = + CreateCheckBoxButton( MERCPANEL_X+61, MERCPANEL_Y+22, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_BODY_SLOT ], 0, VESTPOS ); + iEditorButton[ MERCS_LEGS_SLOT ] = + CreateCheckBoxButton( MERCPANEL_X+62, MERCPANEL_Y+73, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_LEGS_SLOT ], 0, LEGPOS ); + iEditorButton[ MERCS_LEFTHAND_SLOT ] = + CreateCheckBoxButton( MERCPANEL_X+12, MERCPANEL_Y+43, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_LEFTHAND_SLOT ], 0, HANDPOS ); + iEditorButton[ MERCS_RIGHTHAND_SLOT ] = + CreateCheckBoxButton( MERCPANEL_X+90, MERCPANEL_Y+42, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_RIGHTHAND_SLOT ], 0, SECONDHANDPOS ); + iEditorButton[ MERCS_PACK1_SLOT ] = + CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+6, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK1_SLOT ], 0, BIGPOCK1POS ); + iEditorButton[ MERCS_PACK2_SLOT ] = + CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+29, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK2_SLOT ], 0, BIGPOCK2POS ); + iEditorButton[ MERCS_PACK3_SLOT ] = + CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+52, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK3_SLOT ], 0, BIGPOCK3POS ); + iEditorButton[ MERCS_PACK4_SLOT ] = + CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+75, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK4_SLOT ], 0, BIGPOCK4POS ); +} + +void InitEditorBuildingsToolbar() +{ + iEditorButton[BUILDING_TOGGLE_ROOF_VIEW] = + CreateTextButton(L"ROOFS",(UINT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 110, 400, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK, + BuildingToggleRoofViewCallback); + iEditorButton[BUILDING_TOGGLE_WALL_VIEW] = + CreateTextButton(L"WALLS",(UINT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 110, 415, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK, + BuildingToggleWallViewCallback); + iEditorButton[BUILDING_TOGGLE_INFO_VIEW] = + CreateTextButton(L"ROOM INFO",(UINT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 110, 430, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK, + BuildingToggleInfoViewCallback); + //Selection method buttons + iEditorButton[BUILDING_PLACE_WALLS] = + CreateEasyToggleButton( 180,370,"EDITOR//wall.sti", BuildingWallCallback); + //SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WALLS],L"Place walls using selection method"); + + + SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WALLS], + L"Place walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\n"); + + + iEditorButton[BUILDING_PLACE_DOORS] = + CreateEasyToggleButton( 210,370,"EDITOR//door.sti", BuildingDoorCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_DOORS],L"Place doors using selection method"); + iEditorButton[BUILDING_PLACE_ROOFS] = + CreateEasyToggleButton( 240,370,"EDITOR//roof.sti", BuildingRoofCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_ROOFS],L"Place roofs using selection method"); + iEditorButton[BUILDING_PLACE_WINDOWS] = + CreateEasyToggleButton( 180,400,"EDITOR//window.sti", BuildingWindowCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WINDOWS],L"Place windows using selection method"); + iEditorButton[BUILDING_PLACE_BROKEN_WALLS] = + CreateEasyToggleButton( 210,400,"EDITOR//crackwall.sti", BuildingCrackWallCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_BROKEN_WALLS],L"Place damaged walls using selection method."); + iEditorButton[BUILDING_PLACE_FURNITURE] = + CreateEasyToggleButton( 240,400,"EDITOR//decor.sti", BuildingFurnitureCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_FURNITURE],L"Place furniture using selection method"); + iEditorButton[BUILDING_PLACE_DECALS] = + CreateEasyToggleButton( 180,430,"EDITOR//decal.sti", BuildingDecalCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_DECALS],L"Place wall decals using selection method"); + iEditorButton[BUILDING_PLACE_FLOORS] = + CreateEasyToggleButton( 210,430,"EDITOR//floor.sti", BuildingFloorCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_FLOORS],L"Place floors using selection method"); + iEditorButton[BUILDING_PLACE_TOILETS] = + CreateEasyToggleButton( 240,430,"EDITOR//toilet.sti", BuildingToiletCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_TOILETS],L"Place generic furniture using selection method"); + + //Smart method buttons + iEditorButton[BUILDING_SMART_WALLS] = + CreateEasyToggleButton( 290,370,"EDITOR//wall.sti", BuildingSmartWallCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_SMART_WALLS],L"Place walls using smart method"); + iEditorButton[BUILDING_SMART_DOORS] = + CreateEasyToggleButton( 320,370,"EDITOR//door.sti", BuildingSmartDoorCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_SMART_DOORS],L"Place doors using smart method"); + iEditorButton[BUILDING_SMART_WINDOWS] = + CreateEasyToggleButton( 290,400,"EDITOR//window.sti", BuildingSmartWindowCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_SMART_WINDOWS],L"Place windows using smart method"); + iEditorButton[BUILDING_SMART_BROKEN_WALLS] = + CreateEasyToggleButton( 320,400,"EDITOR//crackwall.sti", BuildingSmartCrackWallCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_SMART_BROKEN_WALLS],L"Place damaged walls using smart method"); + iEditorButton[BUILDING_DOORKEY] = + CreateEasyToggleButton( 290, 430,"EDITOR//key.sti", BuildingDoorKeyCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_DOORKEY], L"Lock or trap existing doors" ); + + iEditorButton[BUILDING_NEW_ROOM] = + CreateEasyToggleButton( 370,370,"EDITOR//newroom.sti", BuildingNewRoomCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_NEW_ROOM],L"Add a new room"); + iEditorButton[BUILDING_CAVE_DRAWING] = + CreateEasyToggleButton( 370,370,"EDITOR//caves.sti", BuildingCaveDrawingCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_CAVE_DRAWING],L"Edit cave walls."); + iEditorButton[BUILDING_SAW_ROOM] = + CreateEasyToggleButton( 370,400,"EDITOR//sawroom.sti", BuildingSawRoomCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_SAW_ROOM],L"Remove an area from existing building."); + iEditorButton[BUILDING_KILL_BUILDING] = + CreateEasyToggleButton( 370,430,"EDITOR//delroom.sti", BuildingKillBuildingCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_KILL_BUILDING],L"Remove a building"); + iEditorButton[BUILDING_NEW_ROOF] = + CreateEasyToggleButton( 400,430,"EDITOR//newroof.sti", BuildingNewRoofCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_NEW_ROOF],L"Add/replace building's roof with new flat roof."); + iEditorButton[BUILDING_COPY_BUILDING] = + CreateEasyToggleButton( 430,430,"EDITOR//copyroom.sti", BuildingCopyBuildingCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_COPY_BUILDING],L"Copy a building"); + iEditorButton[BUILDING_MOVE_BUILDING] = + CreateEasyToggleButton( 460,430,"EDITOR//moveroom.sti", BuildingMoveBuildingCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_MOVE_BUILDING],L"Move a building"); + iEditorButton[BUILDING_DRAW_ROOMNUM] = + CreateEasyToggleButton( 410,370,"EDITOR//addTileRoom.sti", BuildingDrawRoomNumCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_DRAW_ROOMNUM],L"Draw room number"); + iEditorButton[BUILDING_ERASE_ROOMNUM] = + CreateEasyToggleButton( 440,370,"EDITOR//killTileRoom.sti", BuildingEraseRoomNumCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_ERASE_ROOMNUM],L"Erase room numbers"); + + iEditorButton[BUILDING_TOGGLE_ERASEMODE] = + CreateEasyToggleButton( 500,400,"EDITOR//eraser.sti", BtnEraseCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_TOGGLE_ERASEMODE],L"Toggle erase mode"); + iEditorButton[BUILDING_UNDO] = + CreateEasyNoToggleButton( 530,400,"EDITOR//undo.sti", BtnUndoCallback); + SetButtonFastHelpText(iEditorButton[BUILDING_UNDO],L"Undo last change"); + iEditorButton[BUILDING_CYCLE_BRUSHSIZE] = + CreateEasyNoToggleButton( 500,430,"EDITOR//paint.sti",BtnBrushCallback); + SetButtonFastHelpText( iEditorButton[ BUILDING_CYCLE_BRUSHSIZE ], L"Cycle brush size"); +} + +void InitEditorItemsToolbar() +{ + SetFontForeground( FONT_MCOLOR_LTRED ); + iEditorButton[ITEMS_WEAPONS] = + CreateTextButton(L"Weapons",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + 100, 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + ItemsWeaponsCallback); + iEditorButton[ITEMS_AMMO] = + CreateTextButton(L"Ammo",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + 159, 440, 40, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + ItemsAmmoCallback); + iEditorButton[ITEMS_ARMOUR] = + CreateTextButton(L"Armour",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + 199, 440, 52, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + ItemsArmourCallback); + iEditorButton[ITEMS_EXPLOSIVES] = + CreateTextButton(L"Explosives",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + 251, 440, 69, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + ItemsExplosivesCallback); + iEditorButton[ITEMS_EQUIPMENT1] = + CreateTextButton(L"E1",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + 320, 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + ItemsEquipment1Callback); + iEditorButton[ITEMS_EQUIPMENT2] = + CreateTextButton(L"E2",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + 341, 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + ItemsEquipment2Callback); + iEditorButton[ITEMS_EQUIPMENT3] = + CreateTextButton(L"E3",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + 362, 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + ItemsEquipment3Callback); + iEditorButton[ITEMS_TRIGGERS] = + CreateTextButton( L"Triggers",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + 383, 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + ItemsTriggersCallback ); + iEditorButton[ITEMS_KEYS] = + CreateTextButton( L"Keys",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT, + 442, 440, 38, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK, + ItemsKeysCallback ); + + iEditorButton[ITEMS_LEFTSCROLL] = + CreateEasyNoToggleButton( 1,361,"EDITOR//leftscroll.sti", ItemsLeftScrollCallback); + iEditorButton[ITEMS_RIGHTSCROLL] = + CreateEasyNoToggleButton( 50,361,"EDITOR//rightscroll.sti", ItemsRightScrollCallback); + +} + +void InitEditorMapInfoToolbar() +{ + iEditorButton[MAPINFO_ADD_LIGHT1_SOURCE] = + CreateEasyToggleButton( 10, 362, "EDITOR//light.sti", BtnDrawLightsCallback ); + SetButtonFastHelpText(iEditorButton[MAPINFO_ADD_LIGHT1_SOURCE],L"Add ambient light source"); + + iEditorButton[ MAPINFO_LIGHT_PANEL ] = + CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, 45, 362, 60, 50, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); + SpecifyDisabledButtonStyle( iEditorButton[ MAPINFO_LIGHT_PANEL ], DISABLED_STYLE_NONE ); + DisableButton( iEditorButton[ MAPINFO_LIGHT_PANEL ] ); + iEditorButton[ MAPINFO_PRIMETIME_LIGHT ] = + CreateCheckBoxButton( 48, 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoPrimeTimeRadioCallback ); + iEditorButton[ MAPINFO_NIGHTTIME_LIGHT ] = + CreateCheckBoxButton( 48, 380, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoNightTimeRadioCallback ); + iEditorButton[ MAPINFO_24HOUR_LIGHT ] = + CreateCheckBoxButton( 48, 395, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfo24HourTimeRadioCallback ); + ClickEditorButton( gbDefaultLightType + MAPINFO_PRIMETIME_LIGHT ); + + iEditorButton[MAPINFO_TOGGLE_FAKE_LIGHTS] = + CreateEasyToggleButton( 120, 362, "EDITOR//fakelight.sti", BtnFakeLightCallback ); + SetButtonFastHelpText(iEditorButton[MAPINFO_TOGGLE_FAKE_LIGHTS], L"Toggle fake ambient lights."); + + iEditorButton[ MAPINFO_RADIO_PANEL ] = + CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, 207, 362, 70, 50, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); + SpecifyDisabledButtonStyle( iEditorButton[ MAPINFO_RADIO_PANEL ], DISABLED_STYLE_NONE ); + DisableButton( iEditorButton[ MAPINFO_RADIO_PANEL ] ); + iEditorButton[ MAPINFO_RADIO_NORMAL ] = + CreateCheckBoxButton( 210, 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoNormalRadioCallback ); + iEditorButton[ MAPINFO_RADIO_BASEMENT ] = + CreateCheckBoxButton( 210, 380, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoBasementRadioCallback ); + iEditorButton[ MAPINFO_RADIO_CAVES ] = + CreateCheckBoxButton( 210, 395, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoCavesRadioCallback ); + + iEditorButton[MAPINFO_DRAW_EXITGRIDS] = + CreateEasyToggleButton( 305, 372, "EDITOR//exitgridbut.sti", MapInfoDrawExitGridCallback ); + SetButtonFastHelpText(iEditorButton[MAPINFO_DRAW_EXITGRIDS],L"Add exit grids (r-clk to query existing)."); + iEditorButton[MAPINFO_CYCLE_BRUSHSIZE] = + CreateEasyNoToggleButton( 420, 430, "EDITOR//paint.sti", BtnBrushCallback ); + SetButtonFastHelpText(iEditorButton[MAPINFO_CYCLE_BRUSHSIZE],L"Cycle brush size"); + iEditorButton[MAPINFO_UNDO] = + CreateEasyNoToggleButton( 510, 430, "EDITOR//undo.sti", BtnUndoCallback ); + SetButtonFastHelpText(iEditorButton[MAPINFO_UNDO],L"Undo last change"); + iEditorButton[MAPINFO_TOGGLE_ERASEMODE] = + CreateEasyToggleButton( 540, 430, "EDITOR//eraser.sti", BtnEraseCallback); + SetButtonFastHelpText(iEditorButton[MAPINFO_TOGGLE_ERASEMODE],L"Toggle erase mode"); + + iEditorButton[ MAPINFO_NORTH_POINT ] = + CreateEasyToggleButton( 540, 365, "EDITOR//north.sti", MapInfoEntryPointsCallback); + SetButtonFastHelpText( iEditorButton[ MAPINFO_NORTH_POINT ], L"Specify north point for validation purposes."); + + iEditorButton[ MAPINFO_WEST_POINT ] = + CreateEasyToggleButton( 525, 386, "EDITOR//west.sti", MapInfoEntryPointsCallback); + SetButtonFastHelpText( iEditorButton[ MAPINFO_WEST_POINT ], L"Specify west point for validation purposes."); + + iEditorButton[ MAPINFO_EAST_POINT ] = + CreateEasyToggleButton( 555, 386, "EDITOR//east.sti", MapInfoEntryPointsCallback); + SetButtonFastHelpText( iEditorButton[ MAPINFO_EAST_POINT ], L"Specify east point for validation purposes."); + + iEditorButton[ MAPINFO_SOUTH_POINT ] = + CreateEasyToggleButton( 540, 407, "EDITOR//south.sti", MapInfoEntryPointsCallback); + SetButtonFastHelpText( iEditorButton[ MAPINFO_SOUTH_POINT ], L"Specify south point for validation purposes."); + + iEditorButton[ MAPINFO_CENTER_POINT ] = + CreateEasyToggleButton( 590, 375, "EDITOR//center.sti", MapInfoEntryPointsCallback); + SetButtonFastHelpText( iEditorButton[ MAPINFO_CENTER_POINT ], L"Specify center point for validation purposes."); + + iEditorButton[ MAPINFO_ISOLATED_POINT ] = + CreateEasyToggleButton( 590, 396, "EDITOR//isolated.sti", MapInfoEntryPointsCallback); + SetButtonFastHelpText( iEditorButton[ MAPINFO_ISOLATED_POINT ], L"Specify isolated point for validation purposes."); +} + +void InitEditorOptionsToolbar() +{ + iEditorButton[OPTIONS_NEW_MAP] = + CreateEasyNoToggleButton( 71,401,"EDITOR//new.sti", BtnNewMapCallback); + SetButtonFastHelpText(iEditorButton[OPTIONS_NEW_MAP],L"New map"); + + iEditorButton[OPTIONS_NEW_BASEMENT] = + CreateEasyNoToggleButton( 101,401,"EDITOR//new.sti", BtnNewBasementCallback); + SetButtonFastHelpText(iEditorButton[OPTIONS_NEW_BASEMENT],L"New basement"); + + iEditorButton[OPTIONS_NEW_CAVES] = + CreateEasyNoToggleButton( 131,401,"EDITOR//new.sti", BtnNewCavesCallback); + SetButtonFastHelpText(iEditorButton[OPTIONS_NEW_CAVES],L"New cave level"); + + iEditorButton[OPTIONS_SAVE_MAP] = + CreateEasyNoToggleButton( 161,401,"EDITOR//save.sti", BtnSaveCallback); + SetButtonFastHelpText(iEditorButton[OPTIONS_SAVE_MAP],L"Save map"); + + iEditorButton[OPTIONS_LOAD_MAP] = + CreateEasyNoToggleButton( 191,401,"EDITOR//load.sti", BtnLoadCallback); + SetButtonFastHelpText(iEditorButton[OPTIONS_LOAD_MAP],L"Load map"); + + iEditorButton[OPTIONS_CHANGE_TILESET] = + CreateEasyNoToggleButton( 221,401,"EDITOR//tileset.sti", BtnChangeTilesetCallback); + SetButtonFastHelpText(iEditorButton[OPTIONS_CHANGE_TILESET],L"Select tileset"); + + iEditorButton[OPTIONS_LEAVE_EDITOR] = + CreateEasyNoToggleButton( 251,401,"EDITOR//cancel.sti", BtnCancelCallback); + SetButtonFastHelpText(iEditorButton[OPTIONS_LEAVE_EDITOR],L"Leave Editor mode"); + + iEditorButton[OPTIONS_QUIT_GAME] = + CreateEasyNoToggleButton( 281,401,"EDITOR//cancel.sti", BtnQuitCallback); + SetButtonFastHelpText(iEditorButton[OPTIONS_QUIT_GAME],L"Exit game."); +} + +void InitEditorTerrainToolbar() +{ + iEditorButton[TERRAIN_FGROUND_TEXTURES] = + CreateEasyToggleButton( 100,400,"EDITOR//downgrid.sti", BtnFgGrndCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_FGROUND_TEXTURES],L"Draw ground textures"); + + iEditorButton[TERRAIN_BGROUND_TEXTURES] = + CreateEasyToggleButton( 130,400,"EDITOR//upgrid.sti", BtnBkGrndCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_BGROUND_TEXTURES],L"Set map ground textures"); + + iEditorButton[TERRAIN_PLACE_CLIFFS] = + CreateEasyToggleButton( 160,400,"EDITOR//banks.sti", BtnBanksCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_CLIFFS],L"Place banks and cliffs"); + + iEditorButton[TERRAIN_PLACE_ROADS] = + CreateEasyToggleButton( 190,400,"EDITOR//road.sti", BtnRoadsCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_ROADS],L"Draw roads"); + + iEditorButton[TERRAIN_PLACE_DEBRIS] = + CreateEasyToggleButton( 220,400,"EDITOR//debris.sti", BtnDebrisCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_DEBRIS],L"Draw debris"); + + iEditorButton[TERRAIN_PLACE_TREES] = + CreateEasyToggleButton( 250,400,"EDITOR//tree.sti", BtnObjectCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_TREES],L"Place trees & bushes"); + + iEditorButton[TERRAIN_PLACE_ROCKS] = + CreateEasyToggleButton( 280,400,"EDITOR//num1.sti", BtnObject1Callback); + SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_ROCKS],L"Place rocks"); + + iEditorButton[TERRAIN_PLACE_MISC] = + CreateEasyToggleButton( 310,400,"EDITOR//num2.sti", BtnObject2Callback); + SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_MISC],L"Place barrels & other junk"); + + iEditorButton[TERRAIN_FILL_AREA] = + CreateEasyToggleButton( 100,430,"EDITOR//fill.sti", BtnFillCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_FILL_AREA],L"Fill area"); + + iEditorButton[TERRAIN_UNDO] = + CreateEasyNoToggleButton( 130,430,"EDITOR//undo.sti", BtnUndoCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_UNDO],L"Undo last change"); + + iEditorButton[TERRAIN_TOGGLE_ERASEMODE] = + CreateEasyToggleButton( 160,430,"EDITOR//eraser.sti", BtnEraseCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_TOGGLE_ERASEMODE],L"Toggle erase mode"); + + iEditorButton[TERRAIN_CYCLE_BRUSHSIZE] = + CreateEasyNoToggleButton( 190,430,"EDITOR//paint.sti", BtnBrushCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_CYCLE_BRUSHSIZE],L"Cycle brush size"); + + iEditorButton[TERRAIN_RAISE_DENSITY] = + CreateEasyNoToggleButton( 280,430,"EDITOR//uparrow.sti", BtnIncBrushDensityCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_RAISE_DENSITY],L"Raise brush density"); + + iEditorButton[TERRAIN_LOWER_DENSITY] = + CreateEasyNoToggleButton( 350,430,"EDITOR//downarrow.sti", BtnDecBrushDensityCallback); + SetButtonFastHelpText(iEditorButton[TERRAIN_LOWER_DENSITY],L"Lower brush density"); +} + +void CreateEditorTaskbarInternal() +{ + //Create the tabs for the editor taskbar + iEditorButton[ TAB_TERRAIN ] = + CreateTextButton(L"Terrain", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, + 100, 460, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + TaskTerrainCallback); + SpecifyButtonDownTextColors( iEditorButton[TAB_TERRAIN], FONT_YELLOW, FONT_ORANGE ); + iEditorButton[ TAB_BUILDINGS ] = + CreateTextButton(L"Buildings", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, + 190, 460, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + TaskBuildingCallback); + SpecifyButtonDownTextColors( iEditorButton[TAB_BUILDINGS], FONT_YELLOW, FONT_ORANGE ); + iEditorButton[ TAB_ITEMS ] = + CreateTextButton(L"Items", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, + 280, 460, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + TaskItemsCallback); + SpecifyButtonDownTextColors( iEditorButton[TAB_ITEMS], FONT_YELLOW, FONT_ORANGE ); + iEditorButton[ TAB_MERCS ] = + CreateTextButton(L"Mercs", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, + 370, 460, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + TaskMercsCallback); + SpecifyButtonDownTextColors( iEditorButton[TAB_MERCS], FONT_YELLOW, FONT_ORANGE ); + iEditorButton[ TAB_MAPINFO ] = + CreateTextButton(L"Map Info", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, + 460, 460, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + TaskMapInfoCallback); + SpecifyButtonDownTextColors( iEditorButton[TAB_MAPINFO], FONT_YELLOW, FONT_ORANGE ); + iEditorButton[ TAB_OPTIONS ] = + CreateTextButton(L"Options", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, + 550, 460, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK, + TaskOptionsCallback); + SpecifyButtonDownTextColors( iEditorButton[TAB_OPTIONS], FONT_YELLOW, FONT_ORANGE ); + + //Create the buttons within each tab. + InitEditorTerrainToolbar(); + InitEditorBuildingsToolbar(); + InitEditorItemsToolbar(); + InitEditorMercsToolbar(); + InitEditorMapInfoToolbar(); + InitEditorOptionsToolbar(); + InitEditorItemStatsButtons(); +} + + +#endif \ No newline at end of file diff --git a/Editor/Editor Taskbar Creation.h b/Editor/Editor Taskbar Creation.h new file mode 100644 index 00000000..7ed74205 --- /dev/null +++ b/Editor/Editor Taskbar Creation.h @@ -0,0 +1,10 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDITOR_TASKBAR_CREATION_H +#define __EDITOR_TASKBAR_CREATION_H + +void CreateEditorTaskbarInternal(); + +#endif +#endif \ No newline at end of file diff --git a/Editor/Editor Taskbar Utils.cpp b/Editor/Editor Taskbar Utils.cpp new file mode 100644 index 00000000..62178506 --- /dev/null +++ b/Editor/Editor Taskbar Utils.cpp @@ -0,0 +1,984 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include + #include "types.h" + #include "mousesystem.h" + #include "Button System.h" + #include "Font Control.h" + #include "Isometric Utils.h" + #include "WorldDat.h" + #include "Render Dirty.h" + #include "sysutil.h" + #include "wordwrap.h" + #include "environment.h" + #include "Interface Items.h" + #include "Soldier Find.h" + #include "World Items.h" + #include "Text.h" + #include "Overhead map.h" + #include "Cursor Modes.h" + #include "editscreen.h" + #include "EditorTerrain.h" + #include "Cursor Modes.h" + #include "EditorItems.h" + #include "EditorMercs.h" + #include "EditorBuildings.h" + #include "EditorMapInfo.h" + #include "EditorDefines.h" + #include "Editor Taskbar Utils.h" + #include "Editor Taskbar Creation.h" + #include "Editor Callback Prototypes.h" + #include "Editor Modes.h" + #include "Text Input.h" + #include "Item Statistics.h" + #include "Map Information.h" + #include "Sector Summary.h" + #include "Item Statistics.h" + #include "pits.h" + #include "Soldier Find.h" + #include "lighting.h" + #include "Keys.h" +#endif + +void RenderEditorInfo(); + +extern ITEM_POOL *gpItemPool; + +//editor icon storage vars +INT32 giEditMercDirectionIcons[2]; +UINT32 guiMercInventoryPanel; +UINT32 guiOmertaMap; +UINT32 guiMercInvPanelBuffers[9]; +UINT32 guiMercTempBuffer; +INT32 giEditMercImage[2]; +UINT32 guiExclamation; +UINT32 guiKeyImage; + +//editor Mouseregion storage vars +MOUSE_REGION TerrainTileButtonRegion[ NUM_TERRAIN_TILE_REGIONS ]; +MOUSE_REGION ItemsRegion; +MOUSE_REGION MercRegion; +MOUSE_REGION EditorRegion; + +void EnableEditorRegion( INT8 bRegionID ) +{ + switch( bRegionID ) + { + case BASE_TERRAIN_TILE_REGION_ID: + case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: + MSYS_EnableRegion( &TerrainTileButtonRegion[ bRegionID ] ); + break; + case ITEM_REGION_ID: + MSYS_EnableRegion( &ItemsRegion ); + break; + case MERC_REGION_ID: + MSYS_EnableRegion( &MercRegion ); + break; + } +} + +void DisableEditorRegion( INT8 bRegionID ) +{ + switch( bRegionID ) + { + case BASE_TERRAIN_TILE_REGION_ID: + case 1: case 2: case 3: case 4: case 5: case 6: case 7: + MSYS_DisableRegion( &TerrainTileButtonRegion[ bRegionID ] ); + break; + case ITEM_REGION_ID: + MSYS_DisableRegion( &ItemsRegion ); + break; + case MERC_REGION_ID: + MSYS_DisableRegion( &MercRegion ); + break; + } +} + +void RemoveEditorRegions() +{ + INT32 x; + MSYS_RemoveRegion( &EditorRegion ); + for(x = BASE_TERRAIN_TILE_REGION_ID; x < NUM_TERRAIN_TILE_REGIONS; x++ ) + { + MSYS_RemoveRegion( &TerrainTileButtonRegion[ x ] ); + } + MSYS_RemoveRegion( &ItemsRegion ); + MSYS_RemoveRegion( &MercRegion ); +} + +void InitEditorRegions() +{ + INT32 x; + + //By doing this, all of the buttons underneath are blanketed and can't be used anymore. + //Any new buttons will cover this up as well. Think of it as a barrier between the editor buttons, + //and the game's interface panel buttons and regions. + MSYS_DefineRegion( &EditorRegion, 0, 360, 640, 480, MSYS_PRIORITY_NORMAL, 0, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + + //Create the regions for the terrain tile selections + for( x = 0; x < NUM_TERRAIN_TILE_REGIONS; x++ ) + { + MSYS_DefineRegion(&TerrainTileButtonRegion[x],(INT16)(261+x*42),369,(INT16)(303+x*42),391, + MSYS_PRIORITY_NORMAL, 0, MSYS_NO_CALLBACK,(MOUSE_CALLBACK)TerrainTileButtonRegionCallback); + MSYS_SetRegionUserData( &TerrainTileButtonRegion[x], 0, x ); + MSYS_DisableRegion( &TerrainTileButtonRegion[x] ); + } + gfShowTerrainTileButtons=FALSE; + + //Create the region for the items selection window. + MSYS_DefineRegion( &ItemsRegion, 100, 360, 540, 440, MSYS_PRIORITY_NORMAL, 0, + (MOUSE_CALLBACK)MouseMovedInItemsRegion, (MOUSE_CALLBACK)MouseClickedInItemsRegion ); + MSYS_DisableRegion( &ItemsRegion ); + + //Create the region for the merc inventory panel. + MSYS_DefineRegion( &MercRegion, 175, 361, 450, 460, MSYS_PRIORITY_NORMAL, 0, + MouseMovedInMercRegion, MouseClickedInMercRegion ); + MSYS_DisableRegion( &MercRegion ); +} + +void LoadEditorImages() +{ + VOBJECT_DESC VObjectDesc; + + //Set up the merc inventory panel + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + sprintf( VObjectDesc.ImageFile, "EDITOR\\InvPanel.sti" ); + if( !AddVideoObject( &VObjectDesc, &guiMercInventoryPanel ) ) + AssertMsg( 0, "Failed to load data\\editor\\InvPanel.sti" ); + //Set up small omerta map + sprintf( VObjectDesc.ImageFile, "EDITOR\\omerta.sti" ); + if( !AddVideoObject( &VObjectDesc, &guiOmertaMap ) ) + AssertMsg( 0, "Failed to load data\\editor\\omerta.sti" ); + //Set up the merc directional buttons. + giEditMercDirectionIcons[0] = LoadGenericButtonIcon("EDITOR//arrowsoff.sti"); + giEditMercDirectionIcons[1] = LoadGenericButtonIcon("EDITOR//arrowson.sti"); + + giEditMercImage[0] = LoadButtonImage("EDITOR\\leftarrow.sti",0,1,2,3,4); + giEditMercImage[1] = LoadButtonImage("EDITOR\\rightarrow.sti",0,1,2,3,4); + + sprintf( VObjectDesc.ImageFile, "EDITOR\\Exclamation.sti" ); + if( !AddVideoObject( &VObjectDesc, &guiExclamation ) ) + AssertMsg( 0, "Failed to load data\\editor\\Exclamation.sti" ); + sprintf( VObjectDesc.ImageFile, "EDITOR\\KeyImage.sti" ); + if( !AddVideoObject( &VObjectDesc, &guiKeyImage ) ) + AssertMsg( 0, "Failed to load data\\editor\\KeyImage.sti" ); +} + +void DeleteEditorImages() +{ + //The merc inventory panel + DeleteVideoObjectFromIndex( guiMercInventoryPanel ); + DeleteVideoObjectFromIndex( guiOmertaMap ); + //The merc directional buttons + UnloadGenericButtonIcon( (INT16)giEditMercDirectionIcons[0] ); + UnloadGenericButtonIcon( (INT16)giEditMercDirectionIcons[1] ); + + UnloadButtonImage( giEditMercImage[0] ); + UnloadButtonImage( giEditMercImage[1] ); +} + +void CreateEditorBuffers() +{ + + INT32 i; + VSURFACE_DESC vs_desc; + UINT16 usUselessWidth, usUselessHeight; + UINT8 ubBitDepth; + + //create buffer for the transition slot for merc items. This slot contains the newly + //selected item graphic in it's inventory size version. This buffer is then scaled down + //into the associated merc inventory panel slot buffer which is approximately 20% smaller. + GetCurrentVideoSettings( &usUselessWidth, &usUselessHeight, &ubBitDepth ); + vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; + vs_desc.usWidth = 60; + vs_desc.usHeight = 25; + vs_desc.ubBitDepth = ubBitDepth; + if( !AddVideoSurface( &vs_desc, &guiMercTempBuffer ) ) + AssertMsg( 0, "Failed to allocate memory for merc tempitem buffer." ); + + //create the nine buffers for the merc's inventory slots. + vs_desc.usHeight = MERCINV_SLOT_HEIGHT; + for( i = 0; i < 9; i++ ) + { + vs_desc.usWidth = i<3 ? MERCINV_SMSLOT_WIDTH : MERCINV_LGSLOT_WIDTH; + if( !AddVideoSurface( &vs_desc, &guiMercInvPanelBuffers[i] ) ) + AssertMsg( 0, "Failed to allocate memory for merc item[] buffers." ); + } +} + +void DeleteEditorBuffers() +{ + INT32 i; + DeleteVideoSurfaceFromIndex( guiMercTempBuffer ); + for( i = 0; i < 9; i++ ) + { + DeleteVideoSurfaceFromIndex( guiMercInvPanelBuffers[ i ] ); + } +} + +void ShowEditorToolbar( INT32 iNewTaskMode ) +{ + switch( iNewTaskMode ) + { + case TASK_TERRAIN: ShowEditorButtons( FIRST_TERRAIN_BUTTON, LAST_TERRAIN_BUTTON ); break; + case TASK_BUILDINGS: ShowEditorButtons( FIRST_BUILDINGS_BUTTON, LAST_BUILDINGS_BUTTON ); break; + case TASK_ITEMS: ShowEditorButtons( FIRST_ITEMS_BUTTON, LAST_ITEMS_BUTTON ); break; + case TASK_MERCS: ShowEditorButtons( FIRST_MERCS_TEAMMODE_BUTTON, LAST_MERCS_TEAMMODE_BUTTON ); break; + case TASK_MAPINFO: ShowEditorButtons( FIRST_MAPINFO_BUTTON, LAST_MAPINFO_BUTTON ); break; + case TASK_OPTIONS: ShowEditorButtons( FIRST_OPTIONS_BUTTON, LAST_OPTIONS_BUTTON ); break; + default: return; + } +} + +void HideEditorToolbar( INT32 iOldTaskMode ) +{ + INT32 i, iStart, iEnd; + switch( iOldTaskMode ) + { + case TASK_TERRAIN: iStart = FIRST_TERRAIN_BUTTON; iEnd = LAST_TERRAIN_BUTTON; break; + case TASK_BUILDINGS: iStart = FIRST_BUILDINGS_BUTTON; iEnd = LAST_BUILDINGS_BUTTON; break; + case TASK_ITEMS: iStart = FIRST_ITEMS_BUTTON; iEnd = LAST_ITEMS_BUTTON; break; + case TASK_MERCS: iStart = FIRST_MERCS_BUTTON; iEnd = LAST_MERCS_BUTTON; break; + case TASK_MAPINFO: iStart = FIRST_MAPINFO_BUTTON; iEnd = LAST_MAPINFO_BUTTON; break; + case TASK_OPTIONS: iStart = FIRST_OPTIONS_BUTTON; iEnd = LAST_OPTIONS_BUTTON; break; + default: return; + } + for( i = iStart; i <= iEnd; i++ ) + { + HideButton( iEditorButton[ i ] ); + UnclickEditorButton( i ); + } +} + +void CreateEditorTaskbar() +{ + InitEditorRegions(); + LoadEditorImages(); + CreateEditorBuffers(); + CreateEditorTaskbarInternal(); + HideItemStatsPanel(); +} + +void DeleteEditorTaskbar() +{ + INT32 x; + + iOldTaskMode = iCurrentTaskbar; + + for( x = 0; x < NUMBER_EDITOR_BUTTONS; x++ ) + RemoveButton( iEditorButton[ x ] ); + + RemoveEditorRegions(); + DeleteEditorImages(); + DeleteEditorBuffers(); + +} + +void DoTaskbar(void) +{ + if(!iTaskMode || iTaskMode == iCurrentTaskbar ) + { + return; + } + + gfRenderTaskbar = TRUE; + + HideEditorToolbar( iCurrentTaskbar ); + + //Special code when exiting previous editor tab + switch( iCurrentTaskbar ) + { + case TASK_TERRAIN: + UnclickEditorButton( TAB_TERRAIN ); + HideTerrainTileButtons(); + break; + case TASK_BUILDINGS: + UnclickEditorButton( TAB_BUILDINGS ); + KillTextInputMode(); + break; + case TASK_ITEMS: + UnclickEditorButton( TAB_ITEMS ); + HideItemStatsPanel(); + if( eInfo.fActive ) + ClearEditorItemsInfo(); + gfShowPits = FALSE; + RemoveAllPits(); + break; + case TASK_MERCS: + UnclickEditorButton( TAB_MERCS ); + IndicateSelectedMerc( SELECT_NO_MERC ); + SetMercEditingMode( MERC_NOMODE ); + break; + case TASK_MAPINFO: + UnclickEditorButton( TAB_MAPINFO ); + ExtractAndUpdateMapInfo(); + KillTextInputMode(); + HideExitGrids(); + break; + case TASK_OPTIONS: + UnclickEditorButton( TAB_OPTIONS ); + break; + } + + //Setup the new tab mode + iCurrentTaskbar = iTaskMode; + ShowEditorToolbar( iTaskMode ); + iTaskMode = TASK_NONE; + + //Special code when entering a new editor tab + switch( iCurrentTaskbar ) + { + case TASK_MERCS: + ClickEditorButton( TAB_MERCS ); + ClickEditorButton( MERCS_ENEMY); + iDrawMode = DRAW_MODE_ENEMY; + SetMercEditingMode( MERC_TEAMMODE ); + fBuildingShowRoofs = FALSE; + UpdateRoofsView(); + break; + case TASK_TERRAIN: + ClickEditorButton( TAB_TERRAIN ); + ShowTerrainTileButtons(); + SetEditorTerrainTaskbarMode( TERRAIN_FGROUND_TEXTURES ); + break; + case TASK_BUILDINGS: + ClickEditorButton( TAB_BUILDINGS ); + if(fBuildingShowRoofs) + ClickEditorButton( BUILDING_TOGGLE_ROOF_VIEW ); + if(fBuildingShowWalls) + ClickEditorButton( BUILDING_TOGGLE_WALL_VIEW ); + if(fBuildingShowRoomInfo) + ClickEditorButton( BUILDING_TOGGLE_INFO_VIEW ); + if( gfCaves ) + { + ClickEditorButton( BUILDING_CAVE_DRAWING ); + iDrawMode = DRAW_MODE_CAVES; + } + else + { + ClickEditorButton( BUILDING_NEW_ROOM ); + iDrawMode = DRAW_MODE_ROOM; + } + TerrainTileDrawMode = TERRAIN_TILES_BRETS_STRANGEMODE; + SetEditorSmoothingMode( gMapInformation.ubEditorSmoothingType ); + gusSelectionType = gusSavedBuildingSelectionType; + SetupTextInputForBuildings(); + break; + case TASK_ITEMS: + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + ClickEditorButton( TAB_ITEMS ); + ClickEditorButton( ITEMS_WEAPONS + eInfo.uiItemType - TBAR_MODE_ITEM_WEAPONS ); + InitEditorItemsInfo( eInfo.uiItemType ); + ShowItemStatsPanel(); + gfShowPits = TRUE; + AddAllPits(); + iDrawMode = DRAW_MODE_PLACE_ITEM; + break; + case TASK_MAPINFO: + ClickEditorButton( TAB_MAPINFO ); + if ( gfFakeLights ) + ClickEditorButton( MAPINFO_TOGGLE_FAKE_LIGHTS ); + ClickEditorButton( MAPINFO_ADD_LIGHT1_SOURCE ); + iDrawMode = DRAW_MODE_LIGHT; + TerrainTileDrawMode = TERRAIN_TILES_BRETS_STRANGEMODE; + SetupTextInputForMapInfo(); + break; + case TASK_OPTIONS: + ClickEditorButton( TAB_OPTIONS ); + TerrainTileDrawMode = TERRAIN_TILES_NODRAW; + break; + } +} + +//Disables the task bar, but leaves it on screen. Used when a selection window is up. +void DisableEditorTaskbar(void) +{ + INT32 x; + for(x = 0; x < NUMBER_EDITOR_BUTTONS; x++ ) + DisableButton( iEditorButton[ x ] ); +} + + +void EnableEditorTaskbar(void) +{ + INT32 x; + + for(x = 0; x < NUMBER_EDITOR_BUTTONS; x++ ) + EnableButton( iEditorButton[ x ] ); + //Keep permanent buttons disabled. + DisableButton( iEditorButton[ MERCS_1 ] ); + DisableButton( iEditorButton[ MAPINFO_LIGHT_PANEL ] ); + DisableButton( iEditorButton[ MAPINFO_RADIO_PANEL ] ); + DisableButton( iEditorButton[ ITEMSTATS_PANEL ] ); + DisableButton( iEditorButton[ MERCS_PLAYERTOGGLE ] ); + DisableButton( iEditorButton[ MERCS_PLAYER ] ); + if( iCurrentTaskbar == TASK_ITEMS ) + DetermineItemsScrolling(); +} + +//A specialized mprint function that'll restore the editor panel underneath the +//string before rendering the string. This is obviously only useful for drawing text +//in the editor taskbar. +void mprintfEditor(INT16 x, INT16 y, UINT16 *pFontString, ...) +{ + va_list argptr; + wchar_t string[512]; + UINT16 uiStringLength, uiStringHeight; + + Assert( pFontString != NULL ); + + va_start( argptr, pFontString ); // Set up variable argument pointer + vswprintf( string, pFontString, argptr); // process gprintf string (get output str) + va_end( argptr ); + + uiStringLength = StringPixLength( string, FontDefault ); + uiStringHeight = GetFontHeight( FontDefault ); + + ClearTaskbarRegion( x, y, (INT16)(x+uiStringLength), (INT16)(y+uiStringHeight) ); + mprintf( x, y, string ); +} + +void ClearTaskbarRegion( INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom ) +{ + ColorFillVideoSurfaceArea( ButtonDestBuffer, sLeft, sTop, sRight, sBottom, gusEditorTaskbarColor ); + + if( !sLeft ) + { + ColorFillVideoSurfaceArea( ButtonDestBuffer, 0, sTop, 1, sBottom, gusEditorTaskbarHiColor ); + sLeft++; + } + if( sTop == 360 ) + { + ColorFillVideoSurfaceArea( ButtonDestBuffer, sLeft, 360, sRight, 361, gusEditorTaskbarHiColor ); + sTop++; + } + if( sBottom == 480 ) + ColorFillVideoSurfaceArea( ButtonDestBuffer, sLeft, 479, sRight, 480, gusEditorTaskbarLoColor ); + if( sRight == 640 ) + ColorFillVideoSurfaceArea( ButtonDestBuffer, 639, sTop, 640, sBottom, gusEditorTaskbarLoColor ); + + InvalidateRegion( sLeft, sTop, sRight, sBottom ); +} + + +//Kris: +//This is a new function which duplicates the older "yellow info boxes" that +//are common throughout the editor. This draws the yellow box with the indentation +//look. +void DrawEditorInfoBox( UINT16 *str, UINT32 uiFont, UINT16 x, UINT16 y, UINT16 w, UINT16 h ) +{ + UINT16 usFillColorDark, usFillColorLight, usFillColorBack; + UINT16 x2, y2; + UINT16 usStrWidth; + + x2 = x + w; + y2 = y + h; + + usFillColorDark = Get16BPPColor(FROMRGB(24, 61, 81)); + usFillColorLight = Get16BPPColor(FROMRGB(136, 138, 135)); + usFillColorBack = Get16BPPColor(FROMRGB(250, 240, 188)); + + ColorFillVideoSurfaceArea(ButtonDestBuffer, x, y, x2, y2, usFillColorDark); + ColorFillVideoSurfaceArea(ButtonDestBuffer, x + 1, y + 1, x2, y2, usFillColorLight); + ColorFillVideoSurfaceArea(ButtonDestBuffer, x + 1, y + 1, x2 - 1, y2 - 1, usFillColorBack); + + usStrWidth = StringPixLength( str, uiFont ); + if( usStrWidth > w ) + { //the string is too long, so use the wrapped method + y += 1; + DisplayWrappedString( x, y, w, 2, uiFont, FONT_BLACK, str, FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + return; + } + //center the string vertically and horizontally. + SetFont( uiFont ); + SetFontForeground( FONT_BLACK ); + SetFontShadow( FONT_BLACK ); + x += (w - (UINT16)StringPixLength( str, uiFont )) / 2; + y += (h - (UINT16)GetFontHeight( uiFont)) / 2; + mprintf( x, y, L"%s", str ); + InvalidateRegion( x, y, x2, y2 ); +} + +void ClickEditorButton( INT32 iEditorButtonID ) +{ + GUI_BUTTON *butn; + if ( iEditorButtonID < 0 || iEditorButtonID >= NUMBER_EDITOR_BUTTONS ) + return; + if ( iEditorButton[ iEditorButtonID ] != -1 ) + { + butn = ButtonList[ iEditorButton[ iEditorButtonID ] ]; + if( butn ) + butn->uiFlags |= BUTTON_CLICKED_ON; + } +} + +void UnclickEditorButton( INT32 iEditorButtonID ) +{ + GUI_BUTTON *butn; + if ( iEditorButtonID < 0 || iEditorButtonID >= NUMBER_EDITOR_BUTTONS ) + return; + if ( iEditorButton[ iEditorButtonID ] != -1 ) + { + butn = ButtonList[ iEditorButton[ iEditorButtonID ] ]; + if( butn ) + butn->uiFlags &= (~BUTTON_CLICKED_ON); + } +} + +void HideEditorButton( INT32 iEditorButtonID ) +{ + HideButton( iEditorButton[ iEditorButtonID ] ); +} + +void ShowEditorButton( INT32 iEditorButtonID ) +{ + ShowButton( iEditorButton[ iEditorButtonID ] ); +} + +void DisableEditorButton( INT32 iEditorButtonID ) +{ + DisableButton( iEditorButton[ iEditorButtonID ] ); +} + +void EnableEditorButton( INT32 iEditorButtonID ) +{ + EnableButton( iEditorButton[ iEditorButtonID ] ); +} + +void ClickEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ) +{ + INT32 i; + GUI_BUTTON *b; + for( i = iFirstEditorButtonID; i <= iLastEditorButtonID; i++ ) + { + Assert( iEditorButton[ i ] != -1 ); + b = ButtonList[ iEditorButton[ i ] ]; + Assert( b ); + b->uiFlags |= BUTTON_CLICKED_ON; + } +} + +void UnclickEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ) +{ + INT32 i; + GUI_BUTTON *b; + for( i = iFirstEditorButtonID; i <= iLastEditorButtonID; i++ ) + { + Assert( iEditorButton[ i ] != -1 ); + b = ButtonList[ iEditorButton[ i ] ]; + Assert( b ); + b->uiFlags &= (~BUTTON_CLICKED_ON); + } +} + +void HideEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ) +{ + INT32 i; + for( i = iFirstEditorButtonID; i <= iLastEditorButtonID; i++ ) + HideButton( iEditorButton[ i ] ); +} + +void ShowEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ) +{ + INT32 i; + for( i = iFirstEditorButtonID; i <= iLastEditorButtonID; i++ ) + ShowButton( iEditorButton[ i ] ); +} + +void DisableEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ) +{ + INT32 i; + for( i = iFirstEditorButtonID; i <= iLastEditorButtonID; i++ ) + DisableButton( iEditorButton[ i ] ); +} + +void EnableEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ) +{ + INT32 i; + for( i = iFirstEditorButtonID; i <= iLastEditorButtonID; i++ ) + EnableButton( iEditorButton[ i ] ); +} + +void RenderMapEntryPointsAndLights() +{ + INT16 sGridNo; + INT16 sScreenX, sScreenY; + INT32 i; + if( gfSummaryWindowActive ) + return; + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + SetFontShadow( FONT_NEARBLACK ); + sGridNo = gMapInformation.sNorthGridNo; + if( sGridNo != -1 ) + { + GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); + if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) + { + DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"North Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + } + } + sGridNo = gMapInformation.sWestGridNo; + if( sGridNo != -1 ) + { + GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); + if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) + { + DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"West Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + } + } + sGridNo = gMapInformation.sEastGridNo; + if( sGridNo != -1 ) + { + GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); + if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) + { + DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"East Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + } + } + sGridNo = gMapInformation.sSouthGridNo; + if( sGridNo != -1 ) + { + GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); + if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) + { + DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"South Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + } + } + sGridNo = gMapInformation.sCenterGridNo; + if( sGridNo != -1 ) + { + GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); + if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) + { + DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"Center Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + } + } + sGridNo = gMapInformation.sIsolatedGridNo; + if( sGridNo != -1 ) + { + GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); + if( sScreenY >= -20 && sScreenY < 340 && sScreenX >= -40 && sScreenX < 640 ) + { + DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"Isolated Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + } + } + //Do the lights now. + for( i = 0; i < MAX_LIGHT_SPRITES; i++ ) + { + if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE ) + { + sGridNo = LightSprites[ i ].iY * WORLD_COLS + LightSprites[ i ].iX; + GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY ); + if( sScreenY >= -50 && sScreenY < 300 && sScreenX >= -40 && sScreenX < 640 ) + { + if( LightSprites[ i ].uiFlags & LIGHT_PRIMETIME ) + DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_ORANGE, L"Prime", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + else if( LightSprites[ i ].uiFlags & LIGHT_NIGHTTIME ) + DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_RED, L"Night", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + else + DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_YELLOW, L"24Hour", FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + } + } + } +} + +void BuildTriggerName( OBJECTTYPE *pItem, UINT16 *szItemName ) +{ + if( pItem->usItem == SWITCH ) + { + if( pItem->bFrequency == PANIC_FREQUENCY ) + swprintf( szItemName, L"Panic Trigger1" ); + else if( pItem->bFrequency == PANIC_FREQUENCY_2 ) + swprintf( szItemName, L"Panic Trigger2" ); + else if( pItem->bFrequency == PANIC_FREQUENCY_3 ) + swprintf( szItemName, L"Panic Trigger3" ); + else + swprintf( szItemName, L"Trigger%d", pItem->bFrequency - 50 ); + } + else + { //action item + if( pItem->bDetonatorType == BOMB_PRESSURE ) + swprintf( szItemName, L"Pressure Action" ); + else if( pItem->bFrequency == PANIC_FREQUENCY ) + swprintf( szItemName, L"Panic Action1" ); + else if( pItem->bFrequency == PANIC_FREQUENCY_2 ) + swprintf( szItemName, L"Panic Action2" ); + else if( pItem->bFrequency == PANIC_FREQUENCY_3 ) + swprintf( szItemName, L"Panic Action3" ); + else + swprintf( szItemName, L"Action%d", pItem->bFrequency - 50 ); + } +} + +void RenderDoorLockInfo() +{ + INT16 i, xp, yp; + INT16 sScreenX, sScreenY; + UINT16 str[ 50 ]; + for( i = 0; i < gubNumDoors; i++ ) + { + GetGridNoScreenPos( DoorTable[ i ].sGridNo, 0, &sScreenX, &sScreenY ); + if( sScreenY > 390 ) + continue; + if( DoorTable[ i ].ubLockID != 255 ) + swprintf( str, L"%S", LockTable[ DoorTable[ i ].ubLockID ].ubEditorName ); + else + swprintf( str, L"No Lock ID" ); + xp = sScreenX - 10; + yp = sScreenY - 40; + DisplayWrappedString( xp, yp, 60, 2, FONT10ARIAL, FONT_LTKHAKI, str, FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + if( DoorTable[ i ].ubTrapID ) + { + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_RED ); + SetFontShadow( FONT_NEARBLACK ); + switch( DoorTable[ i ].ubTrapID ) + { + case EXPLOSION: + swprintf( str, L"Explosion Trap" ); + break; + case ELECTRIC: + swprintf( str, L"Electric Trap" ); + break; + case SIREN: + swprintf( str, L"Siren Trap" ); + break; + case SILENT_ALARM: + swprintf( str, L"Silent Alarm" ); + break; + case SUPER_ELECTRIC: + swprintf( str, L"Super Electric Trap" ); + break; + + } + xp = sScreenX + 20 - StringPixLength( str, FONT10ARIAL ) / 2; + yp = sScreenY; + mprintf( xp, yp, str ); + swprintf( str, L"Trap Level %d", DoorTable[ i ].ubTrapLevel ); + xp = sScreenX + 20 - StringPixLength( str, FONT10ARIAL ) / 2; + mprintf( xp, yp+10, str ); + } + } +} + +void RenderSelectedItemBlownUp() +{ + UINT32 uiVideoObjectIndex; + HVOBJECT hVObject; + INT16 sScreenX, sScreenY, xp, yp; + ITEM_POOL *pItemPool; + UINT16 szItemName[ SIZE_ITEM_NAME ]; + INT32 i; + INT16 sWidth, sHeight, sOffsetX, sOffsetY; + + GetGridNoScreenPos( gsItemGridNo, 0, &sScreenX, &sScreenY ); + + if( sScreenY > 340 ) + return; + + //Display the enlarged item graphic + uiVideoObjectIndex = GetInterfaceGraphicForItem( &Item[ gpItem->usItem ] ); + GetVideoObject( &hVObject, uiVideoObjectIndex ); + + sWidth = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].usWidth; + sOffsetX = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].sOffsetX; + xp = sScreenX + (40 - sWidth - sOffsetX*2) / 2; + + sHeight = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].usHeight; + sOffsetY = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].sOffsetY; + yp = sScreenY + (20 - sHeight - sOffsetY*2) / 2; + + BltVideoObjectOutlineFromIndex( FRAME_BUFFER, uiVideoObjectIndex, Item[ gpItem->usItem ].ubGraphicNum, xp, yp, Get16BPPColor(FROMRGB(0, 140, 170)), TRUE ); + + //Display the item name above it + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + SetFontShadow( FONT_NEARBLACK ); + if( gpItem->usItem == ACTION_ITEM || gpItem->usItem == SWITCH ) + { + BuildTriggerName( gpItem, szItemName ); + } + else if( Item[ gpItem->usItem ].usItemClass == IC_KEY ) + { + swprintf( szItemName, L"%S", LockTable[ gpItem->ubKeyID ].ubEditorName ); + } + else + { + LoadItemInfo( gpItem->usItem, szItemName, NULL ); + } + xp = sScreenX - (StringPixLength( szItemName, FONT10ARIAL ) - 40) / 2; + yp -= 10; + mprintf( xp, yp, szItemName ); + + if( gpItem->usItem == ACTION_ITEM ) + { + UINT16 *pStr; + pStr = GetActionItemName( gpItem ); + xp = sScreenX - (StringPixLength( pStr, FONT10ARIALBOLD ) - 40) / 2; + yp += 10; + SetFont( FONT10ARIALBOLD ); + SetFontForeground( FONT_LTKHAKI ); + mprintf( xp, yp, pStr ); + SetFontForeground( FONT_YELLOW ); + } + + //Count the number of items in the current pool, and display that. + i = 0; + GetItemPool( gsItemGridNo, &pItemPool, 0 ); + Assert( pItemPool ); + while( pItemPool ) + { + i++; + pItemPool = pItemPool->pNext; + } + xp = sScreenX; + yp = sScreenY + 10; + mprintf( xp, yp, L"%d", i ); + + //If the item is hidden, render a blinking H (just like DG) + if( gWorldItems[ gpItemPool->iItemIndex ].bVisible == HIDDEN_ITEM || + gWorldItems[ gpItemPool->iItemIndex ].bVisible == BURIED ) + { + SetFont( FONT10ARIALBOLD ); + if( GetJA2Clock() % 1000 > 500 ) + { + SetFontForeground( 249 ); + } + mprintf( sScreenX + 16, sScreenY + 7, L"H" ); + InvalidateRegion( sScreenX + 16, sScreenY + 7, sScreenX + 24, sScreenY + 27 ); + } +} + +void RenderEditorInfo( ) +{ + wchar_t FPSText[ 50 ]; + static INT32 iSpewWarning = 0; + INT16 iMapIndex; + + SetFont( FONT12POINT1 ); + SetFontForeground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); + + //Display the mapindex position + if( GetMouseMapPos( &iMapIndex ) ) + swprintf( FPSText, L" (%d) ", iMapIndex ); + else + swprintf( FPSText, L" " ); + mprintfEditor( (UINT16)(50-StringPixLength( FPSText, FONT12POINT1 )/2), 463, FPSText ); + + switch( iCurrentTaskbar ) + { + case TASK_OPTIONS: + if( !gfWorldLoaded || giCurrentTilesetID < 0 ) + mprintf( 260, 445, L"No map currently loaded." ); + else + mprintf( 260, 445, L"File: %S, Current Tileset: %s", + gubFilename, gTilesets[ giCurrentTilesetID ].zName ); + break; + case TASK_TERRAIN: + if( gusSelectionType == LINESELECTION ) + swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth ); + DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, 220, 430, 60, 30 ); + swprintf( FPSText, L"%d%%", gusSelectionDensity ); + DrawEditorInfoBox( FPSText, FONT12POINT1, 310, 430, 40, 30 ); + break; + case TASK_ITEMS: + RenderEditorItemsInfo(); + UpdateItemStatsPanel(); + break; + case TASK_BUILDINGS: + UpdateBuildingsInfo(); + if( gusSelectionType == LINESELECTION ) + swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth ); + DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, 530, 430, 60, 30 ); + break; + case TASK_MERCS: + UpdateMercsInfo(); + break; + case TASK_MAPINFO: + UpdateMapInfo(); + if( gusSelectionType == LINESELECTION ) + swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth ); + DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, 440, 430, 60, 30 ); + break; + } +} + +//This is in ButtonSystem.c as a hack. Because we need to save the buffer whenever we do a full +//taskbar render, we need to draw the buttons without hilites, hence this flag. This flag is +//always true in ButtonSystem.c, so it won't effect anything else. +extern BOOLEAN gfGotoGridNoUI; + +void ProcessEditorRendering() +{ + BOOLEAN fSaveBuffer = FALSE; + if( gfRenderTaskbar ) //do a full taskbar render. + { + ClearTaskbarRegion( 0, 360, 640, 480 ); + RenderTerrainTileButtons(); + MarkButtonsDirty(); + gfRenderTaskbar = FALSE; + fSaveBuffer = TRUE; + gfRenderDrawingMode = TRUE; + gfRenderHilights = FALSE; + gfRenderMercInfo = TRUE; + } + if( gfRenderDrawingMode ) + { + if( iCurrentTaskbar == TASK_BUILDINGS || iCurrentTaskbar == TASK_TERRAIN || iCurrentTaskbar == TASK_ITEMS ) + { + ShowCurrentDrawingMode(); + gfRenderDrawingMode = FALSE; + } + } + //render dynamically changed buttons only + RenderButtons( ); + + if( gfSummaryWindowActive ) + RenderSummaryWindow(); + else if( !gfGotoGridNoUI && !InOverheadMap() ) + RenderMercStrings(); + + if( gfEditingDoor ) + RenderDoorEditingWindow(); + + if( TextInputMode() ) + RenderAllTextFields(); + RenderEditorInfo(); + + if( !gfSummaryWindowActive && !gfGotoGridNoUI && !InOverheadMap() ) + { + if( gpItem && gsItemGridNo != -1 ) + RenderSelectedItemBlownUp(); + if( iCurrentTaskbar == TASK_MAPINFO ) + RenderMapEntryPointsAndLights(); + if( iDrawMode == DRAW_MODE_PLACE_ITEM && eInfo.uiItemType == TBAR_MODE_ITEM_KEYS || + iDrawMode == DRAW_MODE_DOORKEYS ) + RenderDoorLockInfo(); + } + + + + if( fSaveBuffer ) + BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 360, 640, 120 ); + + //Make sure this is TRUE at all times. + //It is set to false when before we save the buffer, so the buttons don't get + //rendered with hilites, in case the mouse is over one. + gfRenderHilights = TRUE; + + RenderButtonsFastHelp(); + +} + + +#endif \ No newline at end of file diff --git a/Editor/Editor Taskbar Utils.h b/Editor/Editor Taskbar Utils.h new file mode 100644 index 00000000..8a96a413 --- /dev/null +++ b/Editor/Editor Taskbar Utils.h @@ -0,0 +1,70 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDITOR_TASKBAR_UTILS_H +#define __EDITOR_TASKBAR_UTILS_H + +//These are utilities that are used within the editor. This function absorbs the expensive +//compile time of the SGP dependencies, while allowing the other editor files to hook into it +//without paying, so to speak. + + +enum +{ + GUI_CLEAR_EVENT, + GUI_LCLICK_EVENT, + GUI_RCLICK_EVENT, + GUI_MOVE_EVENT +}; + +//Taskbar manipulation functions +void DoTaskbar(void); +void ProcessEditorRendering(); +void EnableEditorTaskbar(); +void DisableEditorTaskbar(); +void CreateEditorTaskbar(); +void DeleteEditorTaskbar(); + +//Button manipulation functions +void ClickEditorButton( INT32 iEditorButtonID ); +void UnclickEditorButton( INT32 iEditorButtonID ); +void HideEditorButton( INT32 iEditorButtonID ); +void ShowEditorButton( INT32 iEditorButtonID ); +void DisableEditorButton( INT32 iEditorButtonID ); +void EnableEditorButton( INT32 iEditorButtonID ); + +void ClickEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ); +void UnclickEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ); +void HideEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ); +void ShowEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ); +void DisableEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ); +void EnableEditorButtons( INT32 iFirstEditorButtonID, INT32 iLastEditorButtonID ); + +//Region Utils +#define NUM_TERRAIN_TILE_REGIONS 9 +enum{ + BASE_TERRAIN_TILE_REGION_ID, + ITEM_REGION_ID = NUM_TERRAIN_TILE_REGIONS, + MERC_REGION_ID, +}; + +void EnableEditorRegion( INT8 bRegionID ); +void DisableEditorRegion( INT8 bRegionID ); + + +//Rendering Utils +void mprintfEditor(INT16 x, INT16 y, UINT16 *pFontString, ...); +void ClearTaskbarRegion( INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom ); +void DrawEditorInfoBox( UINT16 *str, UINT32 uiFont, UINT16 x, UINT16 y, UINT16 w, UINT16 h ); + +extern INT32 giEditMercDirectionIcons[2]; +extern UINT32 guiMercInventoryPanel; +extern UINT32 guiOmertaMap; +extern UINT32 guiExclamation; +extern UINT32 guiKeyImage; +extern UINT32 guiMercInvPanelBuffers[9]; +extern UINT32 guiMercTempBuffer; +extern INT32 giEditMercImage[2]; + +#endif +#endif \ No newline at end of file diff --git a/Editor/Editor Undo.cpp b/Editor/Editor Undo.cpp new file mode 100644 index 00000000..bc128b58 --- /dev/null +++ b/Editor/Editor Undo.cpp @@ -0,0 +1,999 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "worlddef.h" + #include "worldman.h" + #include "smooth.h" + #include "input.h" + #include "debug.h" + #include "Isometric Utils.h" + + #include "editscreen.h" + #include "Editor Undo.h" + #include "Render Fun.h" //for access to gubWorldRoomInfo; + #include "Cursor Modes.h" + #include "Exit Grids.h" +#endif + +/* +Kris -- Notes on how the undo code works: + +At the bottom of the hierarchy, we need to determine the state of the undo command. The idea +is that we want to separate undo commands by separating them by new mouse clicks. By holding a mouse +down and painting various objects in the world would all constitute a single undo command. As soon as +the mouse is release, then a new undo command is setup. So, to automate this, there is a call every +frame to DetermineUndoState(). + +At the next level, there is a binary tree that keeps track of what map indices have been backup up in +the current undo command. The whole reason to maintain this list, is to avoid multiple map elements of +the same map index from being saved. In the outer code, everytime something is changed, a call to +AddToUndoList() is called, so there are many cases (especially with building/terrain smoothing) that the +same mapindex is added to the undo list. This is also completely transparent, and doesn't need to be +maintained. + +In the outer code, there are several calls to AddToUndoList( iMapIndex ). This function basically looks +in the binary tree for an existing entry, and if there isn't, then the entire mapelement is saved (with +the exception of the merc level ). Lights are also supported, but there is a totally different methodology +for accomplishing this. The equivalent function is AddLightToUndoList( iMapIndex ). In this case, only the +light is saved, along with internal maintanance of several flags. + +The actual mapelement copy code, is very complex. The mapelement is copied in parallel with a new one which +has to allocate several nodes of several types because a mapelement contains over a dozen separate lists, and +all of them need to be saved. The structure information of certain mapelements may be multitiled and must +also save the affected gridno's as well. This is also done internally. Basically, your call to +AddToUndoList() for any particular gridno, may actually save several entries (like for a car which could be 6+ +tiles) + +MERCS +Mercs are not supported in the undo code. Because they are so dynamic, and stats could change, they could +move, etc., it doesn't need to be in the undo code. The editor has its own way of dealing with mercs which +doesn't use the undo methodology. + +*/ + + +BOOLEAN gfUndoEnabled = FALSE; + +void EnableUndo() +{ + gfUndoEnabled = TRUE; +} + +void DisableUndo() +{ + gfUndoEnabled = FALSE; +} + +// undo node data element +typedef struct +{ + INT32 iMapIndex; + MAP_ELEMENT *pMapTile; + BOOLEAN fLightSaved; //determines that a light has been saved + UINT8 ubLightRadius; //the radius of the light to build if undo is called + UINT8 ubLightID; //only applies if a light was saved. + UINT8 ubRoomNum; +} undo_struct; + +// Undo stack node +typedef struct TAG_undo_stack +{ + INT32 iCmdCount; + undo_struct *pData; + struct TAG_undo_stack *pNext; + INT32 iUndoType; +} undo_stack; +undo_stack *gpTileUndoStack = NULL; + +// Map tile element manipulation functions +BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pMapTile, INT32 iMapIndex ); +BOOLEAN SwapMapElementWithWorld( INT32 iDestMapTileIndex, MAP_ELEMENT *pMapTile ); + +// Undo structure functions +BOOLEAN DeleteTopStackNode( void ); +undo_stack *DeleteThisStackNode( undo_stack *pThisNode ); +BOOLEAN DeleteStackNodeContents( undo_stack *pCurrent ); +BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount ); +void CropStackToMaxLength( INT32 iMaxCmds ); +void SmoothUndoMapTileTerrain( INT32 iWorldTile, MAP_ELEMENT *pUndoTile ); + + +BOOLEAN fNewUndoCmd = TRUE; +BOOLEAN gfIgnoreUndoCmdsForLights = FALSE; + +//New pre-undo binary tree stuff +//With this, new undo commands will not duplicate saves in the same command. This will +//increase speed, and save memory. +typedef struct MapIndexBinaryTree +{ + struct MapIndexBinaryTree *left, *right; + UINT16 usMapIndex; +}MapIndexBinaryTree; + +MapIndexBinaryTree *top = NULL; +void ClearUndoMapIndexTree(); +BOOLEAN AddMapIndexToTree( UINT16 usMapIndex ); +void CheckMapIndexForMultiTileStructures( UINT16 usMapIndex ); +void CheckForMultiTilesInTreeAndAddToUndoList( MapIndexBinaryTree *node ); + + +//Recursively deletes all nodes below the node passed including itself. +void DeleteTreeNode( MapIndexBinaryTree **node ) +{ + if( (*node)->left ) + DeleteTreeNode( &((*node)->left) ); + if( (*node)->right ) + DeleteTreeNode( &((*node)->right) ); + MemFree( *node ); + *node = NULL; +} + +//Recursively delete all nodes (from the top down). +void ClearUndoMapIndexTree() +{ + if( top ) + DeleteTreeNode( &top ); +} + +BOOLEAN AddMapIndexToTree( UINT16 usMapIndex ) +{ + MapIndexBinaryTree *curr, *parent; + if( !top ) + { + top = (MapIndexBinaryTree*)MemAlloc( sizeof( MapIndexBinaryTree ) ); + Assert( top ); + top->usMapIndex = usMapIndex; + top->left = NULL; + top->right = NULL; + return TRUE; + } + curr = top; + parent = NULL; + //Traverse down the tree and attempt to find a matching mapindex. + //If one is encountered, then we fail, and don't add the mapindex to the + //tree. + while( curr ) + { + parent = curr; + if( curr->usMapIndex == usMapIndex ) //found a match, so stop + return FALSE; + //if the mapIndex is < node's mapIndex, then go left, else right + curr = ( usMapIndex < curr->usMapIndex ) ? curr->left : curr->right; + } + //if we made it this far, then curr is null and parent is pointing + //directly above. + //Create the new node and fill in the information. + curr = (MapIndexBinaryTree*)MemAlloc( sizeof( MapIndexBinaryTree ) ); + Assert( curr ); + curr->usMapIndex = usMapIndex; + curr->left = NULL; + curr->right = NULL; + //Now link the new node to the parent. + if( curr->usMapIndex < parent->usMapIndex ) + parent->left = curr; + else + parent->right = curr; + return TRUE; +} +//************************************************************************* +// +// Start of Undo code +// +//************************************************************************* + +BOOLEAN DeleteTopStackNode( void ) +{ + undo_stack *pCurrent; + + pCurrent = gpTileUndoStack; + + DeleteStackNodeContents( pCurrent ); + + // Remove node from stack, and free it's memory + gpTileUndoStack = gpTileUndoStack->pNext; + MemFree( pCurrent ); + + return( TRUE ); +} + + +undo_stack *DeleteThisStackNode( undo_stack *pThisNode ) +{ + undo_stack *pCurrent; + undo_stack *pNextNode; + + pCurrent = pThisNode; + pNextNode = pThisNode->pNext; + + // Remove node from stack, and free it's memory + DeleteStackNodeContents( pCurrent ); + MemFree( pCurrent ); + + return( pNextNode ); +} + + +BOOLEAN DeleteStackNodeContents( undo_stack *pCurrent ) +{ + undo_struct *pData; + MAP_ELEMENT *pMapTile; + LEVELNODE *pLandNode; + LEVELNODE *pObjectNode; + LEVELNODE *pStructNode; + LEVELNODE *pShadowNode; + LEVELNODE *pMercNode; + LEVELNODE *pTopmostNode; + LEVELNODE *pRoofNode; + LEVELNODE *pOnRoofNode; + STRUCTURE *pStructureNode; + + pData = pCurrent->pData; + pMapTile = pData->pMapTile; + + if( !pMapTile ) + return TRUE; //light was saved -- mapelement wasn't saved. + + // Free the memory associated with the map tile liked lists + pLandNode = pMapTile->pLandHead; + while ( pLandNode != NULL ) + { + pMapTile->pLandHead = pLandNode->pNext; + MemFree( pLandNode ); + pLandNode = pMapTile->pLandHead; + } + + pObjectNode = pMapTile->pObjectHead; + while ( pObjectNode != NULL ) + { + pMapTile->pObjectHead = pObjectNode->pNext; + MemFree( pObjectNode ); + pObjectNode = pMapTile->pObjectHead; + } + + pStructNode = pMapTile->pStructHead; + while ( pStructNode != NULL ) + { + pMapTile->pStructHead = pStructNode->pNext; + MemFree( pStructNode ); + pStructNode = pMapTile->pStructHead; + } + + pShadowNode = pMapTile->pShadowHead; + while ( pShadowNode != NULL ) + { + pMapTile->pShadowHead = pShadowNode->pNext; + MemFree( pShadowNode ); + pShadowNode = pMapTile->pShadowHead; + } + + pMercNode = pMapTile->pMercHead; + while ( pMercNode != NULL ) + { + pMapTile->pMercHead = pMercNode->pNext; + MemFree( pMercNode ); + pMercNode = pMapTile->pMercHead; + } + + pRoofNode = pMapTile->pRoofHead; + while ( pRoofNode != NULL ) + { + pMapTile->pRoofHead = pRoofNode->pNext; + MemFree( pRoofNode ); + pRoofNode = pMapTile->pRoofHead; + } + + pOnRoofNode = pMapTile->pOnRoofHead; + while ( pOnRoofNode != NULL ) + { + pMapTile->pOnRoofHead = pOnRoofNode->pNext; + MemFree( pOnRoofNode ); + pOnRoofNode = pMapTile->pOnRoofHead; + } + + pTopmostNode = pMapTile->pTopmostHead; + while ( pTopmostNode != NULL ) + { + pMapTile->pTopmostHead = pTopmostNode->pNext; + MemFree( pTopmostNode ); + pTopmostNode = pMapTile->pTopmostHead; + } + + pStructureNode = pMapTile->pStructureHead; + while( pStructureNode ) + { + pMapTile->pStructureHead = pStructureNode->pNext; + if( pStructureNode->usStructureID > INVALID_STRUCTURE_ID ) + { //Okay to delete the structure data -- otherwise, this would be + //merc structure data that we DON'T want to delete, because the merc node + //that hasn't been modified will still use this structure data! + MemFree( pStructureNode ); + } + pStructureNode = pMapTile->pStructureHead; + } + + // Free the map tile structure itself + MemFree( pMapTile ); + + // Free the undo struct + MemFree( pData ); + + return( TRUE ); +} + + +void CropStackToMaxLength( INT32 iMaxCmds ) +{ + INT32 iCmdCount; + undo_stack *pCurrent; + + iCmdCount = 0; + pCurrent = gpTileUndoStack; + + // If stack is empty, leave + if ( pCurrent == NULL ) + return; + + while ( (iCmdCount <= (iMaxCmds - 1)) && (pCurrent != NULL) ) + { + if ( pCurrent->iCmdCount == 1 ) + iCmdCount++; + pCurrent = pCurrent->pNext; + } + + // If the max number of commands was reached, and there is something + // to crop, from the rest of the stack, remove it. + if ( (iCmdCount >= iMaxCmds) && pCurrent != NULL ) + { + while ( pCurrent->pNext != NULL ) + pCurrent->pNext = DeleteThisStackNode( pCurrent->pNext ); + } +} + + +//We are adding a light to the undo list. We won't save the mapelement, nor will +//we validate the gridno in the binary tree. This works differently than a mapelement, +//because lights work on a different system. By setting the fLightSaved flag to TRUE, +//this will handle the way the undo command is handled. If there is no lightradius in +//our saved light, then we intend on erasing the light upon undo execution, otherwise, we +//save the light radius and light ID, so that we place it during undo execution. +void AddLightToUndoList( INT32 iMapIndex, INT32 iLightRadius, UINT8 ubLightID ) +{ + undo_stack *pNode; + undo_struct *pUndoInfo; + + if( !gfUndoEnabled ) + return; + //When executing an undo command (by adding a light or removing one), that command + //actually tries to add it to the undo list. So we wrap the execution of the undo + //command by temporarily setting this flag, so it'll ignore, and not place a new undo + //command. When finished, the flag is cleared, and lights are again allowed to be saved + //in the undo list. + if( gfIgnoreUndoCmdsForLights ) + return; + + pNode = (undo_stack*)MemAlloc( sizeof( undo_stack ) ); + if( !pNode ) + return; + + pUndoInfo = (undo_struct *)MemAlloc( sizeof( undo_struct ) ); + if( !pUndoInfo ) + { + MemFree( pNode ); + return; + } + + pUndoInfo->fLightSaved = TRUE; + //if ubLightRadius is 0, then we don't need to save the light information because we + //will erase it when it comes time to execute the undo command. + pUndoInfo->ubLightRadius = (UINT8)iLightRadius; + pUndoInfo->ubLightID = ubLightID; + pUndoInfo->iMapIndex = iMapIndex; + pUndoInfo->pMapTile = NULL; + + //Add to undo stack + pNode->iCmdCount = 1; + pNode->pData = pUndoInfo; + pNode->pNext = gpTileUndoStack; + gpTileUndoStack = pNode; + + CropStackToMaxLength( MAX_UNDO_COMMAND_LENGTH ); +} + +BOOLEAN AddToUndoList( INT32 iMapIndex ) +{ + static INT32 iCount = 1; + + if( !gfUndoEnabled ) + return FALSE; + if ( fNewUndoCmd ) + { + iCount = 0; + fNewUndoCmd = FALSE; + } + + //Check to see if the tile in question is even on the visible map, then + //if that is true, then check to make sure we don't already have the mapindex + //saved in the new binary tree (which only holds unique mapindex values). + if( GridNoOnVisibleWorldTile( (INT16)iMapIndex ) && AddMapIndexToTree( (UINT16)iMapIndex ) ) + + { + if( AddToUndoListCmd( iMapIndex, ++iCount ) ) + return TRUE; + iCount--; + } + return FALSE; +} + + +BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount ) +{ + undo_stack *pNode; + undo_struct *pUndoInfo; + MAP_ELEMENT *pData; + STRUCTURE *pStructure; + INT32 iCoveredMapIndex; + UINT8 ubLoop; + + if ( (pNode = (undo_stack *)MemAlloc(sizeof( undo_stack )) ) == NULL ) + { + return( FALSE ); + } + + if ( (pUndoInfo = (undo_struct *)MemAlloc(sizeof( undo_struct )) ) == NULL ) + { + MemFree( pNode ); + return( FALSE ); + } + + if ( (pData = (MAP_ELEMENT *)MemAlloc(sizeof( MAP_ELEMENT )) ) == NULL ) + { + MemFree( pNode ); + MemFree( pUndoInfo ); + return( FALSE ); + } + + // Init map element struct + pData->pLandHead = pData->pLandStart = NULL; + pData->pObjectHead = NULL; + pData->pStructHead = NULL; + pData->pShadowHead = NULL; + pData->pMercHead = NULL; + pData->pRoofHead = NULL; + pData->pOnRoofHead = NULL; + pData->pTopmostHead = NULL; + pData->pStructureHead = pData->pStructureTail = NULL; + pData->sHeight = 0; + + + // Copy the world map's tile + if ( CopyMapElementFromWorld( pData, iMapIndex ) == FALSE ) + { + MemFree( pNode ); + MemFree( pUndoInfo ); + MemFree( pData ); + return( FALSE ); + } + + // copy the room number information (it's not in the mapelement structure) + pUndoInfo->ubRoomNum = gubWorldRoomInfo[ iMapIndex ]; + + pUndoInfo->fLightSaved = FALSE; + pUndoInfo->ubLightRadius = 0; + pUndoInfo->ubLightID = 0; + pUndoInfo->pMapTile = pData; + pUndoInfo->iMapIndex = iMapIndex; + + pNode->pData = pUndoInfo; + pNode->iCmdCount = iCmdCount; + pNode->pNext = gpTileUndoStack; + gpTileUndoStack = pNode; + + // loop through pData->pStructureHead list + // for each structure + // find the base tile + // reference the db structure + // if number of tiles > 1 + // add all covered tiles to undo list + pStructure = pData->pStructureHead; + while (pStructure) + { + for (ubLoop = 1; ubLoop < pStructure->pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++) + { + // this loop won't execute for single-tile structures; for multi-tile structures, we have to + // add to the undo list all the other tiles covered by the structure + iCoveredMapIndex = pStructure->sBaseGridNo + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; + AddToUndoList( iCoveredMapIndex ); + } + pStructure = pStructure->pNext; + } + + CropStackToMaxLength( MAX_UNDO_COMMAND_LENGTH ); + + return( TRUE ); +} + + +void CheckMapIndexForMultiTileStructures( UINT16 usMapIndex ) +{ + STRUCTURE * pStructure; + UINT8 ubLoop; + INT32 iCoveredMapIndex; + + pStructure = gpWorldLevelData[usMapIndex].pStructureHead; + while (pStructure) + { + if (pStructure->pDBStructureRef->pDBStructure->ubNumberOfTiles > 1) + { + for (ubLoop = 0; ubLoop < pStructure->pDBStructureRef->pDBStructure->ubNumberOfTiles; ubLoop++) + { + // for multi-tile structures we have to add, to the undo list, all the other tiles covered by the structure + if (pStructure->fFlags & STRUCTURE_BASE_TILE) + { + iCoveredMapIndex = usMapIndex + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; + } + else + { + iCoveredMapIndex = pStructure->sBaseGridNo + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase; + } + AddToUndoList( iCoveredMapIndex ); + } + } + pStructure = pStructure->pNext; + } +} + +void CheckForMultiTilesInTreeAndAddToUndoList( MapIndexBinaryTree *node ) +{ + CheckMapIndexForMultiTileStructures( node->usMapIndex ); + if( node->left ) + CheckForMultiTilesInTreeAndAddToUndoList( node->left ); + if( node->right ) + CheckForMultiTilesInTreeAndAddToUndoList( node->right ); +} + +BOOLEAN RemoveAllFromUndoList( void ) +{ + ClearUndoMapIndexTree(); + + while ( gpTileUndoStack != NULL ) + DeleteTopStackNode(); + + return( TRUE ); +} + + +BOOLEAN ExecuteUndoList( void ) +{ + INT32 iCmdCount, iCurCount; + INT32 iUndoMapIndex; + BOOLEAN fExitGrid; + + if( !gfUndoEnabled ) + return FALSE; + + // Is there something on the undo stack? + if ( gpTileUndoStack == NULL ) + return( TRUE ); + + // Get number of stack entries for this command (top node will tell this) + iCmdCount = gpTileUndoStack->iCmdCount; + + // Execute each stack node in command, and remove each from stack. + iCurCount = 0; + while ( (iCurCount < iCmdCount) && (gpTileUndoStack != NULL) ) + { + iUndoMapIndex = gpTileUndoStack->pData->iMapIndex; + + // Find which map tile we are to "undo" + if( gpTileUndoStack->pData->fLightSaved ) + { //We saved a light, so delete that light + INT16 sX, sY; + //Turn on this flag so that the following code, when executed, doesn't attempt to + //add lights to the undo list. That would cause problems... + gfIgnoreUndoCmdsForLights = TRUE; + ConvertGridNoToXY( (INT16)iUndoMapIndex, &sX, &sY ); + if( !gpTileUndoStack->pData->ubLightRadius ) + RemoveLight( sX, sY ); + else + PlaceLight( gpTileUndoStack->pData->ubLightRadius, sX, sY, gpTileUndoStack->pData->ubLightID ); + //Turn off the flag so lights can again be added to the undo list. + gfIgnoreUndoCmdsForLights = FALSE; + } + else + { // We execute the undo command node by simply swapping the contents + // of the undo's MAP_ELEMENT with the world's element. + fExitGrid = ExitGridAtGridNo( (UINT16)iUndoMapIndex ); + SwapMapElementWithWorld( iUndoMapIndex, gpTileUndoStack->pData->pMapTile ); + + // copy the room number information back + gubWorldRoomInfo[ iUndoMapIndex ] = gpTileUndoStack->pData->ubRoomNum; + + // Now we smooth out the changes... + //SmoothUndoMapTileTerrain( iUndoMapIndex, gpTileUndoStack->pData->pMapTile ); + SmoothAllTerrainTypeRadius( iUndoMapIndex, 1, TRUE ); + } + + // ...trash the top element of the stack... + DeleteTopStackNode( ); + + // ...and bump the command counter up by 1 + iCurCount++; + + //Kris: + //The new cursor system is somehow interfering with the undo stuff. When + //an undo is called, the item is erased, but a cursor is added! I'm quickly + //hacking around this by erasing all cursors here. + RemoveAllTopmostsOfTypeRange( iUndoMapIndex, FIRSTPOINTERS, FIRSTPOINTERS ); + + if( fExitGrid && !ExitGridAtGridNo( (UINT16)iUndoMapIndex ) ) + { //An exitgrid has been removed, so get rid of the associated indicator. + RemoveTopmost( (UINT16)iUndoMapIndex, FIRSTPOINTERS8 ); + } + else if( !fExitGrid && ExitGridAtGridNo( (UINT16)iUndoMapIndex ) ) + { //An exitgrid has been added, so add the associated indicator + AddTopmostToTail( (UINT16)iUndoMapIndex, FIRSTPOINTERS8 ); + } + } + + return( TRUE ); +} + + +void SmoothUndoMapTileTerrain( INT32 iWorldTile, MAP_ELEMENT *pUndoTile ) +{ + LEVELNODE *pWorldLand; + LEVELNODE *pUndoLand; + LEVELNODE *pLand; + LEVELNODE *pWLand; + UINT32 uiCheckType, uiWCheckType; + BOOLEAN fFound; + + pUndoLand = pUndoTile->pLandHead; + pWorldLand = gpWorldLevelData[ iWorldTile ].pLandHead; + + if ( pUndoLand == NULL ) + { + // nothing in the old tile, so smooth the entire land in world's tile + pLand = gpWorldLevelData[ iWorldTile ].pLandHead; + while( pLand != NULL ) + { + GetTileType( pLand->usIndex, &uiCheckType ); + SmoothTerrainRadius( iWorldTile, uiCheckType, 1, TRUE ); + pLand = pLand->pNext; + } + } + else if ( gpWorldLevelData[ iWorldTile ].pLandHead == NULL ) + { + // Nothing in world's tile, so smooth out the land in the old tile. + pLand = pUndoLand; + while( pLand != NULL ) + { + GetTileType( pLand->usIndex, &uiCheckType ); + SmoothTerrainRadius( iWorldTile, uiCheckType, 1, TRUE ); + pLand = pLand->pNext; + } + } + else + { + pLand = pUndoLand; + while( pLand != NULL ) + { + GetTileType( pLand->usIndex, &uiCheckType); + + fFound = FALSE; + pWLand = pWorldLand; + while( pWLand != NULL && !fFound ) + { + GetTileType( pWLand->usIndex, &uiWCheckType); + + if ( uiCheckType == uiWCheckType ) + fFound = TRUE; + + pWLand = pWLand->pNext; + } + + if ( !fFound ) + SmoothTerrainRadius( iWorldTile, uiCheckType, 1, TRUE ); + + pLand = pLand->pNext; + } + + pWLand = pWorldLand; + while( pWLand != NULL ) + { + GetTileType( pWLand->usIndex, &uiWCheckType); + + fFound = FALSE; + pLand = pUndoLand; + while( pLand != NULL && !fFound ) + { + GetTileType( pLand->usIndex, &uiCheckType); + + if ( uiCheckType == uiWCheckType ) + fFound = TRUE; + + pLand = pLand->pNext; + } + + if ( !fFound ) + SmoothTerrainRadius( iWorldTile, uiWCheckType, 1, TRUE ); + + pWLand = pWLand->pNext; + } + } +} + +//Because of the potentially huge amounts of memory that can be allocated due to the inefficient +//undo methods coded by Bret, it is feasible that it could fail. Instead of using assertions to +//terminate the program, destroy the memory allocated thusfar. +void DeleteMapElementContentsAfterCreationFail( MAP_ELEMENT *pNewMapElement ) +{ + LEVELNODE *pLevelNode; + STRUCTURE *pStructure; + INT32 x; + for( x = 0; x < 9; x++ ) + { + if( x == 1 ) + continue; + pLevelNode = pNewMapElement->pLevelNodes[ x ]; + while( pLevelNode ) + { + LEVELNODE *temp; + temp = pLevelNode; + pLevelNode = pLevelNode->pNext; + MemFree( temp ); + } + } + pStructure = pNewMapElement->pStructureHead; + while( pStructure ) + { + STRUCTURE *temp; + temp = pStructure; + pStructure = pStructure->pNext; + MemFree( temp ); + } +} + +/* + union + { + struct TAG_level_node *pPrevNode; // FOR LAND, GOING BACKWARDS POINTER + ITEM_POOL *pItemPool; // ITEM POOLS + STRUCTURE *pStructureData; // STRUCTURE DATA + INT32 iPhysicsObjectID; // ID FOR PHYSICS ITEM + INT32 uiAPCost; // FOR AP DISPLAY + }; // ( 4 byte union ) + union + { + struct + { + UINT16 usIndex; // TILE DATABASE INDEX + INT16 sCurrentFrame; // Stuff for animated tiles for a given tile location ( doors, etc ) + }; + struct + { + SOLDIERTYPE *pSoldier; // POINTER TO SOLDIER + }; + }; // ( 4 byte union ) +*/ +BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex ) +{ + MAP_ELEMENT *pOldMapElement; + LEVELNODE *pOldLevelNode; + LEVELNODE *pLevelNode; + LEVELNODE *pNewLevelNode; + LEVELNODE *tail; + INT32 x; + + STRUCTURE *pOldStructure; + + //Get a pointer to the current map index + pOldMapElement = &gpWorldLevelData[ iMapIndex ]; + + //Save the structure information from the mapelement + pOldStructure = pOldMapElement->pStructureHead; + if( pOldStructure ) + { + STRUCTURE *pNewStructure; + STRUCTURE *pStructure; + STRUCTURE *tail; + tail = NULL; + pNewStructure = NULL; + while( pOldStructure ) + { + pStructure = (STRUCTURE*)MemAlloc( sizeof( STRUCTURE ) ); + if( !pStructure ) + { + DeleteMapElementContentsAfterCreationFail( pNewMapElement ); + return FALSE; + } + if( !tail ) + { //first node in structure list + tail = pStructure; + *tail = *pOldStructure; + tail->pPrev = NULL; + tail->pNext = NULL; + } + else + { //add to the end of the levelnode list + tail->pNext = pStructure; + *pStructure = *pOldStructure; + pStructure->pPrev = tail; + pStructure->pNext = NULL; + tail = tail->pNext; + } + //place the new node inside of the new map element + if( !pNewStructure ) + { + pNewMapElement->pStructureHead = pStructure; + pNewStructure = pStructure; + } + else + { + pNewStructure->pNext = pStructure; + pNewStructure = pNewStructure->pNext; + } + pOldStructure = pOldStructure->pNext; + } + if( tail ) + { + pNewMapElement->pStructureTail = tail; + } + } + + //For each of the 9 levelnodes, save each one + //except for levelnode[1] which is a pointer to the first land to render. + for( x = 0; x < 9; x++ ) + { + if( x == 1 || x == 5 ) //skip the pLandStart and pMercLevel LEVELNODES + continue; + tail = NULL; + pOldLevelNode = pOldMapElement->pLevelNodes[ x ]; + pNewLevelNode = NULL; + while( pOldLevelNode ) + { + //copy the level node + pLevelNode = ( LEVELNODE* )MemAlloc( sizeof( LEVELNODE ) ); + if( !pLevelNode ) + { + DeleteMapElementContentsAfterCreationFail( pNewMapElement ); + return FALSE; + } + if( !tail ) + { //first node in levelnode list + tail = pLevelNode; + *tail = *pOldLevelNode; + if( !x ) //land layer only + tail->pPrevNode = NULL; + tail->pNext = NULL; + } + else + { //add to the end of the levelnode list + tail->pNext = pLevelNode; + *pLevelNode = *pOldLevelNode; + if( !x ) //land layer only + pLevelNode->pPrevNode = tail; + pLevelNode->pNext = NULL; + tail = tail->pNext; + } + //place the new node inside of the new map element + if( !pNewLevelNode ) + { + pNewMapElement->pLevelNodes[ x ] = pLevelNode; + pNewLevelNode = pLevelNode; + } + else + { + pNewLevelNode->pNext = pLevelNode; + pNewLevelNode = pNewLevelNode->pNext; + } + //Handle levelnode layer specific stuff + switch( x ) + { + case 0: //LAND LAYER + if( pOldLevelNode == pOldMapElement->pLandStart ) + { //set the new landstart to point to the new levelnode. + pNewMapElement->pLandStart = pNewLevelNode; + } + break; + case 2: //OBJECT LAYER + if( pOldLevelNode->pItemPool ) + { //save the item pool? + //pNewLevelNode->pItemPool = (ITEM_POOL*)MemAlloc( sizeof( ITEM_POOL ) ); + } + break; + case 3: //STRUCT LAYER + case 6: //ROOF LAYER + case 7: //ON ROOF LAYER + if( pOldLevelNode->pStructureData ) + { //make sure the structuredata pointer points to the parallel structure + STRUCTURE *pOld, *pNew; + //both lists are exactly the same size and contain the same information, + //but the addresses are different. We will traverse the old list until + //we find the match, then + pOld = pOldMapElement->pStructureHead; + pNew = pNewMapElement->pStructureHead; + while( pOld ) + { + Assert( pNew ); + if( pOld == pOldLevelNode->pStructureData ) + { + pNewLevelNode->pStructureData = pNew; + break; + } + pOld = pOld->pNext; + pNew = pNew->pNext; + } + //Kris: + //If this assert should fail, that means there is something wrong with + //the preservation of the structure data within the mapelement. + if( pOld != pOldLevelNode->pStructureData ) + { + //OUCH!!! THIS IS HAPPENING. DISABLED IT FOR LINDA'S SAKE + Assert( 1 ); + } + } + break; + } + //Done, go to next node in this level + pOldLevelNode = pOldLevelNode->pNext; + } + //Done, go to next level + } + + //Save the rest of the information in the mapelement. + pNewMapElement->uiFlags = pOldMapElement->uiFlags; + pNewMapElement->sSumRealLights[0] = pOldMapElement->sSumRealLights[0]; + pNewMapElement->sSumRealLights[1] = pOldMapElement->sSumRealLights[1]; + pNewMapElement->sHeight = pOldMapElement->sHeight; + pNewMapElement->ubTerrainID = pOldMapElement->ubTerrainID; + pNewMapElement->ubReservedSoldierID = pOldMapElement->ubReservedSoldierID; + + return TRUE; +} + + +BOOLEAN SwapMapElementWithWorld( INT32 iMapIndex, MAP_ELEMENT *pUndoMapElement ) +{ + MAP_ELEMENT *pCurrentMapElement; + MAP_ELEMENT TempMapElement; + + pCurrentMapElement = &gpWorldLevelData[ iMapIndex ]; + + //Transfer the merc level node from the current world to the undo mapelement + //that will replace it. We do this, because mercs aren't associated with + //undo commands. + pUndoMapElement->pMercHead = gpWorldLevelData[ iMapIndex ].pMercHead; + gpWorldLevelData[ iMapIndex ].pMercHead = NULL; + + //Swap the mapelements + TempMapElement = *pCurrentMapElement; + *pCurrentMapElement = *pUndoMapElement; + *pUndoMapElement = TempMapElement; + + return ( TRUE ); +} + +void DetermineUndoState() +{ + // Reset the undo command mode if we released the left button. + if( !fNewUndoCmd ) + { + if( !gfLeftButtonState && !gfCurrentSelectionWithRightButton || + !gfRightButtonState && gfCurrentSelectionWithRightButton ) + { + //Clear the mapindex binary tree list, and set up flag for new undo command. + fNewUndoCmd = TRUE; + ClearUndoMapIndexTree(); + } + } +} + + +#endif \ No newline at end of file diff --git a/Editor/Editor Undo.h b/Editor/Editor Undo.h new file mode 100644 index 00000000..cf81a584 --- /dev/null +++ b/Editor/Editor Undo.h @@ -0,0 +1,22 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDITOR_UNDO_H +#define __EDITOR_UNDO_H + +BOOLEAN AddToUndoList( INT32 iMapIndex ); +void AddLightToUndoList( INT32 iMapIndex, INT32 iLightRadius, UINT8 ubLightID ); + +BOOLEAN RemoveAllFromUndoList(); +BOOLEAN ExecuteUndoList(); + +void EnableUndo(); +void DisableUndo(); + +void DetermineUndoState(); + +// Undo command flags +#define MAX_UNDO_COMMAND_LENGTH 10 + +#endif +#endif \ No newline at end of file diff --git a/Editor/Editor.dep b/Editor/Editor.dep new file mode 100644 index 00000000..11274b91 --- /dev/null +++ b/Editor/Editor.dep @@ -0,0 +1,147 @@ +# Microsoft Developer Studio Generated Dependency File, included by Editor.mak + +".\Cursor Modes.cpp" : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\edit_sys.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +".\Editor Callbacks.cpp" : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +".\Editor Modes.cpp" : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +".\Editor Taskbar Creation.cpp" : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +".\Editor Taskbar Utils.cpp" : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +".\Editor Undo.cpp" : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\EditorBuildings.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\EditorItems.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\EditorMapInfo.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\EditorMercs.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\EditorTerrain.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\editscreen.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + "..\screenids.h"\ + ".\Editor All.h"\ + + +".\Item Statistics.cpp" : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\LoadScreen.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + "..\screenids.h"\ + ".\Editor All.h"\ + + +.\messagebox.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\newsmooth.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\popupmenu.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +".\Road Smoothing.cpp" : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +".\Sector Summary.cpp" : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\selectwin.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\SmartMethod.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +.\smooth.cpp : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + + +".\Smoothing Utils.cpp" : \ + "..\builddefines.h"\ + "..\Language Defines.h"\ + ".\Editor All.h"\ + diff --git a/Editor/Editor.dsp b/Editor/Editor.dsp new file mode 100644 index 00000000..e4aa827d --- /dev/null +++ b/Editor/Editor.dsp @@ -0,0 +1,450 @@ +# Microsoft Developer Studio Project File - Name="Editor" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=Editor - Win32 Demo Bounds Checker +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Editor.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Editor.mak" CFG="Editor - Win32 Demo Bounds Checker" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Editor - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Release with Debug Info" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Bounds Checker" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Debug Demo" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Release Demo" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Demo Release with Debug Info" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Demo Bounds Checker" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName ""$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA" +# PROP Scc_LocalPath "..\..\..\ja2\build" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Editor - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /Ob2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"Editor All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Editor - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "PRECOMPILEDHEADERS" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"Editor All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Editor - Win32 Release with Debug Info" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Editor__" +# PROP BASE Intermediate_Dir "Editor__" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release with Debug" +# PROP Intermediate_Dir "Release with Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "JA2" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\TileEngine" /I "..\Utils" /I "..\TacticalAI" /I "..\Tactical" /I "..\strategic" /I ".\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"Editor All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Editor - Win32 Bounds Checker" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Editor_1" +# PROP BASE Intermediate_Dir "Editor_1" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Bounds Checker" +# PROP Intermediate_Dir "Bounds Checker" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "JA2" /FR /YX /FD /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /FR /YX"Editor All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Editor - Win32 Debug Demo" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Editor_0" +# PROP BASE Intermediate_Dir "Editor_0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug Demo" +# PROP Intermediate_Dir "Debug Demo" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "JA2" /FR /YX /FD /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "JA2DEMO" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"Editor All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Editor - Win32 Release Demo" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Editor_2" +# PROP BASE Intermediate_Dir "Editor_2" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release Demo" +# PROP Intermediate_Dir "Release Demo" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "JA2" /FR /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "NDEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"Editor All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Editor - Win32 Demo Release with Debug Info" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Editor_3" +# PROP BASE Intermediate_Dir "Editor_3" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Demo Release with Debug" +# PROP Intermediate_Dir "Demo Release with Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "JA2" /FR /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\TileEngine" /I "..\Utils" /I "..\TacticalAI" /I "..\Tactical" /I "..\strategic" /I ".\\" /D "NDEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"Editor All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Editor - Win32 Demo Bounds Checker" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Editor_4" +# PROP BASE Intermediate_Dir "Editor_4" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Demo Bounds Checker" +# PROP Intermediate_Dir "Demo Bounds Checker" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "BOUNDS_CHECKER" /FR /YX /FD /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"Editor All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "Editor - Win32 Release" +# Name "Editor - Win32 Debug" +# Name "Editor - Win32 Release with Debug Info" +# Name "Editor - Win32 Bounds Checker" +# Name "Editor - Win32 Debug Demo" +# Name "Editor - Win32 Release Demo" +# Name "Editor - Win32 Demo Release with Debug Info" +# Name "Editor - Win32 Demo Bounds Checker" +# Begin Group "Source Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=".\Cursor Modes.cpp" +# End Source File +# Begin Source File + +SOURCE=.\edit_sys.cpp +# End Source File +# Begin Source File + +SOURCE=".\Editor Callbacks.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Editor Modes.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Editor Taskbar Creation.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Editor Taskbar Utils.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Editor Undo.cpp" +# End Source File +# Begin Source File + +SOURCE=.\EditorBuildings.cpp +# End Source File +# Begin Source File + +SOURCE=.\EditorItems.cpp +# End Source File +# Begin Source File + +SOURCE=.\EditorMapInfo.cpp +# End Source File +# Begin Source File + +SOURCE=.\EditorMercs.cpp +# End Source File +# Begin Source File + +SOURCE=.\EditorTerrain.cpp +# End Source File +# Begin Source File + +SOURCE=.\editscreen.cpp +# End Source File +# Begin Source File + +SOURCE=".\Item Statistics.cpp" +# End Source File +# Begin Source File + +SOURCE=.\LoadScreen.cpp +# End Source File +# Begin Source File + +SOURCE=.\messagebox.cpp +# End Source File +# Begin Source File + +SOURCE=.\newsmooth.cpp +# End Source File +# Begin Source File + +SOURCE=.\popupmenu.cpp +# End Source File +# Begin Source File + +SOURCE=".\Road Smoothing.cpp" +# End Source File +# Begin Source File + +SOURCE=".\Sector Summary.cpp" +# End Source File +# Begin Source File + +SOURCE=.\selectwin.cpp +# End Source File +# Begin Source File + +SOURCE=.\SmartMethod.cpp +# End Source File +# Begin Source File + +SOURCE=.\smooth.cpp +# End Source File +# Begin Source File + +SOURCE=".\Smoothing Utils.cpp" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=".\Button Defines.h" +# End Source File +# Begin Source File + +SOURCE=".\Cursor Modes.h" +# End Source File +# Begin Source File + +SOURCE=.\edit_sys.h +# End Source File +# Begin Source File + +SOURCE=".\Editor All.h" +# End Source File +# Begin Source File + +SOURCE=".\Editor Callback Prototypes.h" +# End Source File +# Begin Source File + +SOURCE=".\Editor Modes.h" +# End Source File +# Begin Source File + +SOURCE=".\Editor Taskbar Creation.h" +# End Source File +# Begin Source File + +SOURCE=".\Editor Taskbar Utils.h" +# End Source File +# Begin Source File + +SOURCE=".\Editor Undo.h" +# End Source File +# Begin Source File + +SOURCE=.\EditorBuildings.h +# End Source File +# Begin Source File + +SOURCE=.\EditorDefines.h +# End Source File +# Begin Source File + +SOURCE=.\EditorItems.h +# End Source File +# Begin Source File + +SOURCE=.\EditorMapInfo.h +# End Source File +# Begin Source File + +SOURCE=.\EditorMercs.h +# End Source File +# Begin Source File + +SOURCE=.\EditorTerrain.h +# End Source File +# Begin Source File + +SOURCE=.\editscreen.h +# End Source File +# Begin Source File + +SOURCE=".\Item Statistics.h" +# End Source File +# Begin Source File + +SOURCE=.\LoadScreen.h +# End Source File +# Begin Source File + +SOURCE=.\messagebox.h +# End Source File +# Begin Source File + +SOURCE=.\newsmooth.h +# End Source File +# Begin Source File + +SOURCE=.\popupmenu.h +# End Source File +# Begin Source File + +SOURCE=".\Road Smoothing.h" +# End Source File +# Begin Source File + +SOURCE=".\Sector Summary.h" +# End Source File +# Begin Source File + +SOURCE=.\selectwin.h +# End Source File +# Begin Source File + +SOURCE=.\SmartMethod.h +# End Source File +# Begin Source File + +SOURCE=.\smooth.h +# End Source File +# Begin Source File + +SOURCE=".\Smoothing Utils.h" +# End Source File +# Begin Source File + +SOURCE=".\Summary Info.h" +# End Source File +# End Group +# End Target +# End Project diff --git a/Editor/Editor.mak b/Editor/Editor.mak new file mode 100644 index 00000000..d3c35340 --- /dev/null +++ b/Editor/Editor.mak @@ -0,0 +1,1274 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on Editor.dsp +!IF "$(CFG)" == "" +CFG=Editor - Win32 Demo Bounds Checker +!MESSAGE No configuration specified. Defaulting to Editor - Win32 Demo Bounds Checker. +!ENDIF + +!IF "$(CFG)" != "Editor - Win32 Release" && "$(CFG)" != "Editor - Win32 Debug" && "$(CFG)" != "Editor - Win32 Release with Debug Info" && "$(CFG)" != "Editor - Win32 Bounds Checker" && "$(CFG)" != "Editor - Win32 Debug Demo" && "$(CFG)" != "Editor - Win32 Release Demo" && "$(CFG)" != "Editor - Win32 Demo Release with Debug Info" && "$(CFG)" != "Editor - Win32 Demo Bounds Checker" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Editor.mak" CFG="Editor - Win32 Demo Bounds Checker" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Editor - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Release with Debug Info" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Bounds Checker" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Debug Demo" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Release Demo" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Demo Release with Debug Info" (based on "Win32 (x86) Static Library") +!MESSAGE "Editor - Win32 Demo Bounds Checker" (based on "Win32 (x86) Static Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Editor - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +ALL : "$(OUTDIR)\Editor.lib" "$(OUTDIR)\Editor.bsc" + + +CLEAN : + -@erase "$(INTDIR)\Cursor Modes.obj" + -@erase "$(INTDIR)\Cursor Modes.sbr" + -@erase "$(INTDIR)\edit_sys.obj" + -@erase "$(INTDIR)\edit_sys.sbr" + -@erase "$(INTDIR)\Editor Callbacks.obj" + -@erase "$(INTDIR)\Editor Callbacks.sbr" + -@erase "$(INTDIR)\Editor Modes.obj" + -@erase "$(INTDIR)\Editor Modes.sbr" + -@erase "$(INTDIR)\Editor Taskbar Creation.obj" + -@erase "$(INTDIR)\Editor Taskbar Creation.sbr" + -@erase "$(INTDIR)\Editor Taskbar Utils.obj" + -@erase "$(INTDIR)\Editor Taskbar Utils.sbr" + -@erase "$(INTDIR)\Editor Undo.obj" + -@erase "$(INTDIR)\Editor Undo.sbr" + -@erase "$(INTDIR)\EditorBuildings.obj" + -@erase "$(INTDIR)\EditorBuildings.sbr" + -@erase "$(INTDIR)\EditorItems.obj" + -@erase "$(INTDIR)\EditorItems.sbr" + -@erase "$(INTDIR)\EditorMapInfo.obj" + -@erase "$(INTDIR)\EditorMapInfo.sbr" + -@erase "$(INTDIR)\EditorMercs.obj" + -@erase "$(INTDIR)\EditorMercs.sbr" + -@erase "$(INTDIR)\EditorTerrain.obj" + -@erase "$(INTDIR)\EditorTerrain.sbr" + -@erase "$(INTDIR)\editscreen.obj" + -@erase "$(INTDIR)\editscreen.sbr" + -@erase "$(INTDIR)\Item Statistics.obj" + -@erase "$(INTDIR)\Item Statistics.sbr" + -@erase "$(INTDIR)\LoadScreen.obj" + -@erase "$(INTDIR)\LoadScreen.sbr" + -@erase "$(INTDIR)\messagebox.obj" + -@erase "$(INTDIR)\messagebox.sbr" + -@erase "$(INTDIR)\newsmooth.obj" + -@erase "$(INTDIR)\newsmooth.sbr" + -@erase "$(INTDIR)\popupmenu.obj" + -@erase "$(INTDIR)\popupmenu.sbr" + -@erase "$(INTDIR)\Road Smoothing.obj" + -@erase "$(INTDIR)\Road Smoothing.sbr" + -@erase "$(INTDIR)\Sector Summary.obj" + -@erase "$(INTDIR)\Sector Summary.sbr" + -@erase "$(INTDIR)\selectwin.obj" + -@erase "$(INTDIR)\selectwin.sbr" + -@erase "$(INTDIR)\SmartMethod.obj" + -@erase "$(INTDIR)\SmartMethod.sbr" + -@erase "$(INTDIR)\smooth.obj" + -@erase "$(INTDIR)\smooth.sbr" + -@erase "$(INTDIR)\Smoothing Utils.obj" + -@erase "$(INTDIR)\Smoothing Utils.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Editor.bsc" + -@erase "$(OUTDIR)\Editor.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MT /W3 /GX /O2 /Ob2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Editor.pch" /YX"Editor All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Editor.bsc" +BSC32_SBRS= \ + "$(INTDIR)\Cursor Modes.sbr" \ + "$(INTDIR)\edit_sys.sbr" \ + "$(INTDIR)\Editor Callbacks.sbr" \ + "$(INTDIR)\Editor Modes.sbr" \ + "$(INTDIR)\Editor Taskbar Creation.sbr" \ + "$(INTDIR)\Editor Taskbar Utils.sbr" \ + "$(INTDIR)\Editor Undo.sbr" \ + "$(INTDIR)\EditorBuildings.sbr" \ + "$(INTDIR)\EditorItems.sbr" \ + "$(INTDIR)\EditorMapInfo.sbr" \ + "$(INTDIR)\EditorMercs.sbr" \ + "$(INTDIR)\EditorTerrain.sbr" \ + "$(INTDIR)\editscreen.sbr" \ + "$(INTDIR)\Item Statistics.sbr" \ + "$(INTDIR)\LoadScreen.sbr" \ + "$(INTDIR)\messagebox.sbr" \ + "$(INTDIR)\newsmooth.sbr" \ + "$(INTDIR)\popupmenu.sbr" \ + "$(INTDIR)\Road Smoothing.sbr" \ + "$(INTDIR)\Sector Summary.sbr" \ + "$(INTDIR)\selectwin.sbr" \ + "$(INTDIR)\SmartMethod.sbr" \ + "$(INTDIR)\smooth.sbr" \ + "$(INTDIR)\Smoothing Utils.sbr" + +"$(OUTDIR)\Editor.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Editor.lib" +LIB32_OBJS= \ + "$(INTDIR)\Cursor Modes.obj" \ + "$(INTDIR)\edit_sys.obj" \ + "$(INTDIR)\Editor Callbacks.obj" \ + "$(INTDIR)\Editor Modes.obj" \ + "$(INTDIR)\Editor Taskbar Creation.obj" \ + "$(INTDIR)\Editor Taskbar Utils.obj" \ + "$(INTDIR)\Editor Undo.obj" \ + "$(INTDIR)\EditorBuildings.obj" \ + "$(INTDIR)\EditorItems.obj" \ + "$(INTDIR)\EditorMapInfo.obj" \ + "$(INTDIR)\EditorMercs.obj" \ + "$(INTDIR)\EditorTerrain.obj" \ + "$(INTDIR)\editscreen.obj" \ + "$(INTDIR)\Item Statistics.obj" \ + "$(INTDIR)\LoadScreen.obj" \ + "$(INTDIR)\messagebox.obj" \ + "$(INTDIR)\newsmooth.obj" \ + "$(INTDIR)\popupmenu.obj" \ + "$(INTDIR)\Road Smoothing.obj" \ + "$(INTDIR)\Sector Summary.obj" \ + "$(INTDIR)\selectwin.obj" \ + "$(INTDIR)\SmartMethod.obj" \ + "$(INTDIR)\smooth.obj" \ + "$(INTDIR)\Smoothing Utils.obj" + +"$(OUTDIR)\Editor.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Editor - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +ALL : "$(OUTDIR)\Editor.lib" "$(OUTDIR)\Editor.bsc" + + +CLEAN : + -@erase "$(INTDIR)\Cursor Modes.obj" + -@erase "$(INTDIR)\Cursor Modes.sbr" + -@erase "$(INTDIR)\edit_sys.obj" + -@erase "$(INTDIR)\edit_sys.sbr" + -@erase "$(INTDIR)\Editor Callbacks.obj" + -@erase "$(INTDIR)\Editor Callbacks.sbr" + -@erase "$(INTDIR)\Editor Modes.obj" + -@erase "$(INTDIR)\Editor Modes.sbr" + -@erase "$(INTDIR)\Editor Taskbar Creation.obj" + -@erase "$(INTDIR)\Editor Taskbar Creation.sbr" + -@erase "$(INTDIR)\Editor Taskbar Utils.obj" + -@erase "$(INTDIR)\Editor Taskbar Utils.sbr" + -@erase "$(INTDIR)\Editor Undo.obj" + -@erase "$(INTDIR)\Editor Undo.sbr" + -@erase "$(INTDIR)\EditorBuildings.obj" + -@erase "$(INTDIR)\EditorBuildings.sbr" + -@erase "$(INTDIR)\EditorItems.obj" + -@erase "$(INTDIR)\EditorItems.sbr" + -@erase "$(INTDIR)\EditorMapInfo.obj" + -@erase "$(INTDIR)\EditorMapInfo.sbr" + -@erase "$(INTDIR)\EditorMercs.obj" + -@erase "$(INTDIR)\EditorMercs.sbr" + -@erase "$(INTDIR)\EditorTerrain.obj" + -@erase "$(INTDIR)\EditorTerrain.sbr" + -@erase "$(INTDIR)\editscreen.obj" + -@erase "$(INTDIR)\editscreen.sbr" + -@erase "$(INTDIR)\Item Statistics.obj" + -@erase "$(INTDIR)\Item Statistics.sbr" + -@erase "$(INTDIR)\LoadScreen.obj" + -@erase "$(INTDIR)\LoadScreen.sbr" + -@erase "$(INTDIR)\messagebox.obj" + -@erase "$(INTDIR)\messagebox.sbr" + -@erase "$(INTDIR)\newsmooth.obj" + -@erase "$(INTDIR)\newsmooth.sbr" + -@erase "$(INTDIR)\popupmenu.obj" + -@erase "$(INTDIR)\popupmenu.sbr" + -@erase "$(INTDIR)\Road Smoothing.obj" + -@erase "$(INTDIR)\Road Smoothing.sbr" + -@erase "$(INTDIR)\Sector Summary.obj" + -@erase "$(INTDIR)\Sector Summary.sbr" + -@erase "$(INTDIR)\selectwin.obj" + -@erase "$(INTDIR)\selectwin.sbr" + -@erase "$(INTDIR)\SmartMethod.obj" + -@erase "$(INTDIR)\SmartMethod.sbr" + -@erase "$(INTDIR)\smooth.obj" + -@erase "$(INTDIR)\smooth.sbr" + -@erase "$(INTDIR)\Smoothing Utils.obj" + -@erase "$(INTDIR)\Smoothing Utils.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Editor.bsc" + -@erase "$(OUTDIR)\Editor.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /GX /Z7 /Od /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "PRECOMPILEDHEADERS" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Editor.pch" /YX"Editor All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Editor.bsc" +BSC32_SBRS= \ + "$(INTDIR)\Cursor Modes.sbr" \ + "$(INTDIR)\edit_sys.sbr" \ + "$(INTDIR)\Editor Callbacks.sbr" \ + "$(INTDIR)\Editor Modes.sbr" \ + "$(INTDIR)\Editor Taskbar Creation.sbr" \ + "$(INTDIR)\Editor Taskbar Utils.sbr" \ + "$(INTDIR)\Editor Undo.sbr" \ + "$(INTDIR)\EditorBuildings.sbr" \ + "$(INTDIR)\EditorItems.sbr" \ + "$(INTDIR)\EditorMapInfo.sbr" \ + "$(INTDIR)\EditorMercs.sbr" \ + "$(INTDIR)\EditorTerrain.sbr" \ + "$(INTDIR)\editscreen.sbr" \ + "$(INTDIR)\Item Statistics.sbr" \ + "$(INTDIR)\LoadScreen.sbr" \ + "$(INTDIR)\messagebox.sbr" \ + "$(INTDIR)\newsmooth.sbr" \ + "$(INTDIR)\popupmenu.sbr" \ + "$(INTDIR)\Road Smoothing.sbr" \ + "$(INTDIR)\Sector Summary.sbr" \ + "$(INTDIR)\selectwin.sbr" \ + "$(INTDIR)\SmartMethod.sbr" \ + "$(INTDIR)\smooth.sbr" \ + "$(INTDIR)\Smoothing Utils.sbr" + +"$(OUTDIR)\Editor.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Editor.lib" +LIB32_OBJS= \ + "$(INTDIR)\Cursor Modes.obj" \ + "$(INTDIR)\edit_sys.obj" \ + "$(INTDIR)\Editor Callbacks.obj" \ + "$(INTDIR)\Editor Modes.obj" \ + "$(INTDIR)\Editor Taskbar Creation.obj" \ + "$(INTDIR)\Editor Taskbar Utils.obj" \ + "$(INTDIR)\Editor Undo.obj" \ + "$(INTDIR)\EditorBuildings.obj" \ + "$(INTDIR)\EditorItems.obj" \ + "$(INTDIR)\EditorMapInfo.obj" \ + "$(INTDIR)\EditorMercs.obj" \ + "$(INTDIR)\EditorTerrain.obj" \ + "$(INTDIR)\editscreen.obj" \ + "$(INTDIR)\Item Statistics.obj" \ + "$(INTDIR)\LoadScreen.obj" \ + "$(INTDIR)\messagebox.obj" \ + "$(INTDIR)\newsmooth.obj" \ + "$(INTDIR)\popupmenu.obj" \ + "$(INTDIR)\Road Smoothing.obj" \ + "$(INTDIR)\Sector Summary.obj" \ + "$(INTDIR)\selectwin.obj" \ + "$(INTDIR)\SmartMethod.obj" \ + "$(INTDIR)\smooth.obj" \ + "$(INTDIR)\Smoothing Utils.obj" + +"$(OUTDIR)\Editor.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Editor - Win32 Release with Debug Info" + +OUTDIR=.\Release with Debug +INTDIR=.\Release with Debug +# Begin Custom Macros +OutDir=.\Release with Debug +# End Custom Macros + +ALL : "$(OUTDIR)\Editor.lib" "$(OUTDIR)\Editor.bsc" + + +CLEAN : + -@erase "$(INTDIR)\Cursor Modes.obj" + -@erase "$(INTDIR)\Cursor Modes.sbr" + -@erase "$(INTDIR)\edit_sys.obj" + -@erase "$(INTDIR)\edit_sys.sbr" + -@erase "$(INTDIR)\Editor Callbacks.obj" + -@erase "$(INTDIR)\Editor Callbacks.sbr" + -@erase "$(INTDIR)\Editor Modes.obj" + -@erase "$(INTDIR)\Editor Modes.sbr" + -@erase "$(INTDIR)\Editor Taskbar Creation.obj" + -@erase "$(INTDIR)\Editor Taskbar Creation.sbr" + -@erase "$(INTDIR)\Editor Taskbar Utils.obj" + -@erase "$(INTDIR)\Editor Taskbar Utils.sbr" + -@erase "$(INTDIR)\Editor Undo.obj" + -@erase "$(INTDIR)\Editor Undo.sbr" + -@erase "$(INTDIR)\EditorBuildings.obj" + -@erase "$(INTDIR)\EditorBuildings.sbr" + -@erase "$(INTDIR)\EditorItems.obj" + -@erase "$(INTDIR)\EditorItems.sbr" + -@erase "$(INTDIR)\EditorMapInfo.obj" + -@erase "$(INTDIR)\EditorMapInfo.sbr" + -@erase "$(INTDIR)\EditorMercs.obj" + -@erase "$(INTDIR)\EditorMercs.sbr" + -@erase "$(INTDIR)\EditorTerrain.obj" + -@erase "$(INTDIR)\EditorTerrain.sbr" + -@erase "$(INTDIR)\editscreen.obj" + -@erase "$(INTDIR)\editscreen.sbr" + -@erase "$(INTDIR)\Item Statistics.obj" + -@erase "$(INTDIR)\Item Statistics.sbr" + -@erase "$(INTDIR)\LoadScreen.obj" + -@erase "$(INTDIR)\LoadScreen.sbr" + -@erase "$(INTDIR)\messagebox.obj" + -@erase "$(INTDIR)\messagebox.sbr" + -@erase "$(INTDIR)\newsmooth.obj" + -@erase "$(INTDIR)\newsmooth.sbr" + -@erase "$(INTDIR)\popupmenu.obj" + -@erase "$(INTDIR)\popupmenu.sbr" + -@erase "$(INTDIR)\Road Smoothing.obj" + -@erase "$(INTDIR)\Road Smoothing.sbr" + -@erase "$(INTDIR)\Sector Summary.obj" + -@erase "$(INTDIR)\Sector Summary.sbr" + -@erase "$(INTDIR)\selectwin.obj" + -@erase "$(INTDIR)\selectwin.sbr" + -@erase "$(INTDIR)\SmartMethod.obj" + -@erase "$(INTDIR)\SmartMethod.sbr" + -@erase "$(INTDIR)\smooth.obj" + -@erase "$(INTDIR)\smooth.sbr" + -@erase "$(INTDIR)\Smoothing Utils.obj" + -@erase "$(INTDIR)\Smoothing Utils.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Editor.bsc" + -@erase "$(OUTDIR)\Editor.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\TileEngine" /I "..\Utils" /I "..\TacticalAI" /I "..\Tactical" /I "..\strategic" /I ".\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Editor.pch" /YX"Editor All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Editor.bsc" +BSC32_SBRS= \ + "$(INTDIR)\Cursor Modes.sbr" \ + "$(INTDIR)\edit_sys.sbr" \ + "$(INTDIR)\Editor Callbacks.sbr" \ + "$(INTDIR)\Editor Modes.sbr" \ + "$(INTDIR)\Editor Taskbar Creation.sbr" \ + "$(INTDIR)\Editor Taskbar Utils.sbr" \ + "$(INTDIR)\Editor Undo.sbr" \ + "$(INTDIR)\EditorBuildings.sbr" \ + "$(INTDIR)\EditorItems.sbr" \ + "$(INTDIR)\EditorMapInfo.sbr" \ + "$(INTDIR)\EditorMercs.sbr" \ + "$(INTDIR)\EditorTerrain.sbr" \ + "$(INTDIR)\editscreen.sbr" \ + "$(INTDIR)\Item Statistics.sbr" \ + "$(INTDIR)\LoadScreen.sbr" \ + "$(INTDIR)\messagebox.sbr" \ + "$(INTDIR)\newsmooth.sbr" \ + "$(INTDIR)\popupmenu.sbr" \ + "$(INTDIR)\Road Smoothing.sbr" \ + "$(INTDIR)\Sector Summary.sbr" \ + "$(INTDIR)\selectwin.sbr" \ + "$(INTDIR)\SmartMethod.sbr" \ + "$(INTDIR)\smooth.sbr" \ + "$(INTDIR)\Smoothing Utils.sbr" + +"$(OUTDIR)\Editor.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Editor.lib" +LIB32_OBJS= \ + "$(INTDIR)\Cursor Modes.obj" \ + "$(INTDIR)\edit_sys.obj" \ + "$(INTDIR)\Editor Callbacks.obj" \ + "$(INTDIR)\Editor Modes.obj" \ + "$(INTDIR)\Editor Taskbar Creation.obj" \ + "$(INTDIR)\Editor Taskbar Utils.obj" \ + "$(INTDIR)\Editor Undo.obj" \ + "$(INTDIR)\EditorBuildings.obj" \ + "$(INTDIR)\EditorItems.obj" \ + "$(INTDIR)\EditorMapInfo.obj" \ + "$(INTDIR)\EditorMercs.obj" \ + "$(INTDIR)\EditorTerrain.obj" \ + "$(INTDIR)\editscreen.obj" \ + "$(INTDIR)\Item Statistics.obj" \ + "$(INTDIR)\LoadScreen.obj" \ + "$(INTDIR)\messagebox.obj" \ + "$(INTDIR)\newsmooth.obj" \ + "$(INTDIR)\popupmenu.obj" \ + "$(INTDIR)\Road Smoothing.obj" \ + "$(INTDIR)\Sector Summary.obj" \ + "$(INTDIR)\selectwin.obj" \ + "$(INTDIR)\SmartMethod.obj" \ + "$(INTDIR)\smooth.obj" \ + "$(INTDIR)\Smoothing Utils.obj" + +"$(OUTDIR)\Editor.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Editor - Win32 Bounds Checker" + +OUTDIR=.\Bounds Checker +INTDIR=.\Bounds Checker +# Begin Custom Macros +OutDir=.\Bounds Checker +# End Custom Macros + +ALL : "$(OUTDIR)\Editor.lib" "$(OUTDIR)\Editor.bsc" + + +CLEAN : + -@erase "$(INTDIR)\Cursor Modes.obj" + -@erase "$(INTDIR)\Cursor Modes.sbr" + -@erase "$(INTDIR)\edit_sys.obj" + -@erase "$(INTDIR)\edit_sys.sbr" + -@erase "$(INTDIR)\Editor Callbacks.obj" + -@erase "$(INTDIR)\Editor Callbacks.sbr" + -@erase "$(INTDIR)\Editor Modes.obj" + -@erase "$(INTDIR)\Editor Modes.sbr" + -@erase "$(INTDIR)\Editor Taskbar Creation.obj" + -@erase "$(INTDIR)\Editor Taskbar Creation.sbr" + -@erase "$(INTDIR)\Editor Taskbar Utils.obj" + -@erase "$(INTDIR)\Editor Taskbar Utils.sbr" + -@erase "$(INTDIR)\Editor Undo.obj" + -@erase "$(INTDIR)\Editor Undo.sbr" + -@erase "$(INTDIR)\EditorBuildings.obj" + -@erase "$(INTDIR)\EditorBuildings.sbr" + -@erase "$(INTDIR)\EditorItems.obj" + -@erase "$(INTDIR)\EditorItems.sbr" + -@erase "$(INTDIR)\EditorMapInfo.obj" + -@erase "$(INTDIR)\EditorMapInfo.sbr" + -@erase "$(INTDIR)\EditorMercs.obj" + -@erase "$(INTDIR)\EditorMercs.sbr" + -@erase "$(INTDIR)\EditorTerrain.obj" + -@erase "$(INTDIR)\EditorTerrain.sbr" + -@erase "$(INTDIR)\editscreen.obj" + -@erase "$(INTDIR)\editscreen.sbr" + -@erase "$(INTDIR)\Item Statistics.obj" + -@erase "$(INTDIR)\Item Statistics.sbr" + -@erase "$(INTDIR)\LoadScreen.obj" + -@erase "$(INTDIR)\LoadScreen.sbr" + -@erase "$(INTDIR)\messagebox.obj" + -@erase "$(INTDIR)\messagebox.sbr" + -@erase "$(INTDIR)\newsmooth.obj" + -@erase "$(INTDIR)\newsmooth.sbr" + -@erase "$(INTDIR)\popupmenu.obj" + -@erase "$(INTDIR)\popupmenu.sbr" + -@erase "$(INTDIR)\Road Smoothing.obj" + -@erase "$(INTDIR)\Road Smoothing.sbr" + -@erase "$(INTDIR)\Sector Summary.obj" + -@erase "$(INTDIR)\Sector Summary.sbr" + -@erase "$(INTDIR)\selectwin.obj" + -@erase "$(INTDIR)\selectwin.sbr" + -@erase "$(INTDIR)\SmartMethod.obj" + -@erase "$(INTDIR)\SmartMethod.sbr" + -@erase "$(INTDIR)\smooth.obj" + -@erase "$(INTDIR)\smooth.sbr" + -@erase "$(INTDIR)\Smoothing Utils.obj" + -@erase "$(INTDIR)\Smoothing Utils.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Editor.bsc" + -@erase "$(OUTDIR)\Editor.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Editor.pch" /YX"Editor All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Editor.bsc" +BSC32_SBRS= \ + "$(INTDIR)\Cursor Modes.sbr" \ + "$(INTDIR)\edit_sys.sbr" \ + "$(INTDIR)\Editor Callbacks.sbr" \ + "$(INTDIR)\Editor Modes.sbr" \ + "$(INTDIR)\Editor Taskbar Creation.sbr" \ + "$(INTDIR)\Editor Taskbar Utils.sbr" \ + "$(INTDIR)\Editor Undo.sbr" \ + "$(INTDIR)\EditorBuildings.sbr" \ + "$(INTDIR)\EditorItems.sbr" \ + "$(INTDIR)\EditorMapInfo.sbr" \ + "$(INTDIR)\EditorMercs.sbr" \ + "$(INTDIR)\EditorTerrain.sbr" \ + "$(INTDIR)\editscreen.sbr" \ + "$(INTDIR)\Item Statistics.sbr" \ + "$(INTDIR)\LoadScreen.sbr" \ + "$(INTDIR)\messagebox.sbr" \ + "$(INTDIR)\newsmooth.sbr" \ + "$(INTDIR)\popupmenu.sbr" \ + "$(INTDIR)\Road Smoothing.sbr" \ + "$(INTDIR)\Sector Summary.sbr" \ + "$(INTDIR)\selectwin.sbr" \ + "$(INTDIR)\SmartMethod.sbr" \ + "$(INTDIR)\smooth.sbr" \ + "$(INTDIR)\Smoothing Utils.sbr" + +"$(OUTDIR)\Editor.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Editor.lib" +LIB32_OBJS= \ + "$(INTDIR)\Cursor Modes.obj" \ + "$(INTDIR)\edit_sys.obj" \ + "$(INTDIR)\Editor Callbacks.obj" \ + "$(INTDIR)\Editor Modes.obj" \ + "$(INTDIR)\Editor Taskbar Creation.obj" \ + "$(INTDIR)\Editor Taskbar Utils.obj" \ + "$(INTDIR)\Editor Undo.obj" \ + "$(INTDIR)\EditorBuildings.obj" \ + "$(INTDIR)\EditorItems.obj" \ + "$(INTDIR)\EditorMapInfo.obj" \ + "$(INTDIR)\EditorMercs.obj" \ + "$(INTDIR)\EditorTerrain.obj" \ + "$(INTDIR)\editscreen.obj" \ + "$(INTDIR)\Item Statistics.obj" \ + "$(INTDIR)\LoadScreen.obj" \ + "$(INTDIR)\messagebox.obj" \ + "$(INTDIR)\newsmooth.obj" \ + "$(INTDIR)\popupmenu.obj" \ + "$(INTDIR)\Road Smoothing.obj" \ + "$(INTDIR)\Sector Summary.obj" \ + "$(INTDIR)\selectwin.obj" \ + "$(INTDIR)\SmartMethod.obj" \ + "$(INTDIR)\smooth.obj" \ + "$(INTDIR)\Smoothing Utils.obj" + +"$(OUTDIR)\Editor.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Editor - Win32 Debug Demo" + +OUTDIR=.\Debug Demo +INTDIR=.\Debug Demo +# Begin Custom Macros +OutDir=.\Debug Demo +# End Custom Macros + +ALL : "$(OUTDIR)\Editor.lib" "$(OUTDIR)\Editor.bsc" + + +CLEAN : + -@erase "$(INTDIR)\Cursor Modes.obj" + -@erase "$(INTDIR)\Cursor Modes.sbr" + -@erase "$(INTDIR)\edit_sys.obj" + -@erase "$(INTDIR)\edit_sys.sbr" + -@erase "$(INTDIR)\Editor Callbacks.obj" + -@erase "$(INTDIR)\Editor Callbacks.sbr" + -@erase "$(INTDIR)\Editor Modes.obj" + -@erase "$(INTDIR)\Editor Modes.sbr" + -@erase "$(INTDIR)\Editor Taskbar Creation.obj" + -@erase "$(INTDIR)\Editor Taskbar Creation.sbr" + -@erase "$(INTDIR)\Editor Taskbar Utils.obj" + -@erase "$(INTDIR)\Editor Taskbar Utils.sbr" + -@erase "$(INTDIR)\Editor Undo.obj" + -@erase "$(INTDIR)\Editor Undo.sbr" + -@erase "$(INTDIR)\EditorBuildings.obj" + -@erase "$(INTDIR)\EditorBuildings.sbr" + -@erase "$(INTDIR)\EditorItems.obj" + -@erase "$(INTDIR)\EditorItems.sbr" + -@erase "$(INTDIR)\EditorMapInfo.obj" + -@erase "$(INTDIR)\EditorMapInfo.sbr" + -@erase "$(INTDIR)\EditorMercs.obj" + -@erase "$(INTDIR)\EditorMercs.sbr" + -@erase "$(INTDIR)\EditorTerrain.obj" + -@erase "$(INTDIR)\EditorTerrain.sbr" + -@erase "$(INTDIR)\editscreen.obj" + -@erase "$(INTDIR)\editscreen.sbr" + -@erase "$(INTDIR)\Item Statistics.obj" + -@erase "$(INTDIR)\Item Statistics.sbr" + -@erase "$(INTDIR)\LoadScreen.obj" + -@erase "$(INTDIR)\LoadScreen.sbr" + -@erase "$(INTDIR)\messagebox.obj" + -@erase "$(INTDIR)\messagebox.sbr" + -@erase "$(INTDIR)\newsmooth.obj" + -@erase "$(INTDIR)\newsmooth.sbr" + -@erase "$(INTDIR)\popupmenu.obj" + -@erase "$(INTDIR)\popupmenu.sbr" + -@erase "$(INTDIR)\Road Smoothing.obj" + -@erase "$(INTDIR)\Road Smoothing.sbr" + -@erase "$(INTDIR)\Sector Summary.obj" + -@erase "$(INTDIR)\Sector Summary.sbr" + -@erase "$(INTDIR)\selectwin.obj" + -@erase "$(INTDIR)\selectwin.sbr" + -@erase "$(INTDIR)\SmartMethod.obj" + -@erase "$(INTDIR)\SmartMethod.sbr" + -@erase "$(INTDIR)\smooth.obj" + -@erase "$(INTDIR)\smooth.sbr" + -@erase "$(INTDIR)\Smoothing Utils.obj" + -@erase "$(INTDIR)\Smoothing Utils.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Editor.bsc" + -@erase "$(OUTDIR)\Editor.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "JA2DEMO" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Editor.pch" /YX"Editor All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Editor.bsc" +BSC32_SBRS= \ + "$(INTDIR)\Cursor Modes.sbr" \ + "$(INTDIR)\edit_sys.sbr" \ + "$(INTDIR)\Editor Callbacks.sbr" \ + "$(INTDIR)\Editor Modes.sbr" \ + "$(INTDIR)\Editor Taskbar Creation.sbr" \ + "$(INTDIR)\Editor Taskbar Utils.sbr" \ + "$(INTDIR)\Editor Undo.sbr" \ + "$(INTDIR)\EditorBuildings.sbr" \ + "$(INTDIR)\EditorItems.sbr" \ + "$(INTDIR)\EditorMapInfo.sbr" \ + "$(INTDIR)\EditorMercs.sbr" \ + "$(INTDIR)\EditorTerrain.sbr" \ + "$(INTDIR)\editscreen.sbr" \ + "$(INTDIR)\Item Statistics.sbr" \ + "$(INTDIR)\LoadScreen.sbr" \ + "$(INTDIR)\messagebox.sbr" \ + "$(INTDIR)\newsmooth.sbr" \ + "$(INTDIR)\popupmenu.sbr" \ + "$(INTDIR)\Road Smoothing.sbr" \ + "$(INTDIR)\Sector Summary.sbr" \ + "$(INTDIR)\selectwin.sbr" \ + "$(INTDIR)\SmartMethod.sbr" \ + "$(INTDIR)\smooth.sbr" \ + "$(INTDIR)\Smoothing Utils.sbr" + +"$(OUTDIR)\Editor.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Editor.lib" +LIB32_OBJS= \ + "$(INTDIR)\Cursor Modes.obj" \ + "$(INTDIR)\edit_sys.obj" \ + "$(INTDIR)\Editor Callbacks.obj" \ + "$(INTDIR)\Editor Modes.obj" \ + "$(INTDIR)\Editor Taskbar Creation.obj" \ + "$(INTDIR)\Editor Taskbar Utils.obj" \ + "$(INTDIR)\Editor Undo.obj" \ + "$(INTDIR)\EditorBuildings.obj" \ + "$(INTDIR)\EditorItems.obj" \ + "$(INTDIR)\EditorMapInfo.obj" \ + "$(INTDIR)\EditorMercs.obj" \ + "$(INTDIR)\EditorTerrain.obj" \ + "$(INTDIR)\editscreen.obj" \ + "$(INTDIR)\Item Statistics.obj" \ + "$(INTDIR)\LoadScreen.obj" \ + "$(INTDIR)\messagebox.obj" \ + "$(INTDIR)\newsmooth.obj" \ + "$(INTDIR)\popupmenu.obj" \ + "$(INTDIR)\Road Smoothing.obj" \ + "$(INTDIR)\Sector Summary.obj" \ + "$(INTDIR)\selectwin.obj" \ + "$(INTDIR)\SmartMethod.obj" \ + "$(INTDIR)\smooth.obj" \ + "$(INTDIR)\Smoothing Utils.obj" + +"$(OUTDIR)\Editor.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Editor - Win32 Release Demo" + +OUTDIR=.\Release Demo +INTDIR=.\Release Demo +# Begin Custom Macros +OutDir=.\Release Demo +# End Custom Macros + +ALL : "$(OUTDIR)\Editor.lib" "$(OUTDIR)\Editor.bsc" + + +CLEAN : + -@erase "$(INTDIR)\Cursor Modes.obj" + -@erase "$(INTDIR)\Cursor Modes.sbr" + -@erase "$(INTDIR)\edit_sys.obj" + -@erase "$(INTDIR)\edit_sys.sbr" + -@erase "$(INTDIR)\Editor Callbacks.obj" + -@erase "$(INTDIR)\Editor Callbacks.sbr" + -@erase "$(INTDIR)\Editor Modes.obj" + -@erase "$(INTDIR)\Editor Modes.sbr" + -@erase "$(INTDIR)\Editor Taskbar Creation.obj" + -@erase "$(INTDIR)\Editor Taskbar Creation.sbr" + -@erase "$(INTDIR)\Editor Taskbar Utils.obj" + -@erase "$(INTDIR)\Editor Taskbar Utils.sbr" + -@erase "$(INTDIR)\Editor Undo.obj" + -@erase "$(INTDIR)\Editor Undo.sbr" + -@erase "$(INTDIR)\EditorBuildings.obj" + -@erase "$(INTDIR)\EditorBuildings.sbr" + -@erase "$(INTDIR)\EditorItems.obj" + -@erase "$(INTDIR)\EditorItems.sbr" + -@erase "$(INTDIR)\EditorMapInfo.obj" + -@erase "$(INTDIR)\EditorMapInfo.sbr" + -@erase "$(INTDIR)\EditorMercs.obj" + -@erase "$(INTDIR)\EditorMercs.sbr" + -@erase "$(INTDIR)\EditorTerrain.obj" + -@erase "$(INTDIR)\EditorTerrain.sbr" + -@erase "$(INTDIR)\editscreen.obj" + -@erase "$(INTDIR)\editscreen.sbr" + -@erase "$(INTDIR)\Item Statistics.obj" + -@erase "$(INTDIR)\Item Statistics.sbr" + -@erase "$(INTDIR)\LoadScreen.obj" + -@erase "$(INTDIR)\LoadScreen.sbr" + -@erase "$(INTDIR)\messagebox.obj" + -@erase "$(INTDIR)\messagebox.sbr" + -@erase "$(INTDIR)\newsmooth.obj" + -@erase "$(INTDIR)\newsmooth.sbr" + -@erase "$(INTDIR)\popupmenu.obj" + -@erase "$(INTDIR)\popupmenu.sbr" + -@erase "$(INTDIR)\Road Smoothing.obj" + -@erase "$(INTDIR)\Road Smoothing.sbr" + -@erase "$(INTDIR)\Sector Summary.obj" + -@erase "$(INTDIR)\Sector Summary.sbr" + -@erase "$(INTDIR)\selectwin.obj" + -@erase "$(INTDIR)\selectwin.sbr" + -@erase "$(INTDIR)\SmartMethod.obj" + -@erase "$(INTDIR)\SmartMethod.sbr" + -@erase "$(INTDIR)\smooth.obj" + -@erase "$(INTDIR)\smooth.sbr" + -@erase "$(INTDIR)\Smoothing Utils.obj" + -@erase "$(INTDIR)\Smoothing Utils.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Editor.bsc" + -@erase "$(OUTDIR)\Editor.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "NDEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Editor.pch" /YX"Editor All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Editor.bsc" +BSC32_SBRS= \ + "$(INTDIR)\Cursor Modes.sbr" \ + "$(INTDIR)\edit_sys.sbr" \ + "$(INTDIR)\Editor Callbacks.sbr" \ + "$(INTDIR)\Editor Modes.sbr" \ + "$(INTDIR)\Editor Taskbar Creation.sbr" \ + "$(INTDIR)\Editor Taskbar Utils.sbr" \ + "$(INTDIR)\Editor Undo.sbr" \ + "$(INTDIR)\EditorBuildings.sbr" \ + "$(INTDIR)\EditorItems.sbr" \ + "$(INTDIR)\EditorMapInfo.sbr" \ + "$(INTDIR)\EditorMercs.sbr" \ + "$(INTDIR)\EditorTerrain.sbr" \ + "$(INTDIR)\editscreen.sbr" \ + "$(INTDIR)\Item Statistics.sbr" \ + "$(INTDIR)\LoadScreen.sbr" \ + "$(INTDIR)\messagebox.sbr" \ + "$(INTDIR)\newsmooth.sbr" \ + "$(INTDIR)\popupmenu.sbr" \ + "$(INTDIR)\Road Smoothing.sbr" \ + "$(INTDIR)\Sector Summary.sbr" \ + "$(INTDIR)\selectwin.sbr" \ + "$(INTDIR)\SmartMethod.sbr" \ + "$(INTDIR)\smooth.sbr" \ + "$(INTDIR)\Smoothing Utils.sbr" + +"$(OUTDIR)\Editor.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Editor.lib" +LIB32_OBJS= \ + "$(INTDIR)\Cursor Modes.obj" \ + "$(INTDIR)\edit_sys.obj" \ + "$(INTDIR)\Editor Callbacks.obj" \ + "$(INTDIR)\Editor Modes.obj" \ + "$(INTDIR)\Editor Taskbar Creation.obj" \ + "$(INTDIR)\Editor Taskbar Utils.obj" \ + "$(INTDIR)\Editor Undo.obj" \ + "$(INTDIR)\EditorBuildings.obj" \ + "$(INTDIR)\EditorItems.obj" \ + "$(INTDIR)\EditorMapInfo.obj" \ + "$(INTDIR)\EditorMercs.obj" \ + "$(INTDIR)\EditorTerrain.obj" \ + "$(INTDIR)\editscreen.obj" \ + "$(INTDIR)\Item Statistics.obj" \ + "$(INTDIR)\LoadScreen.obj" \ + "$(INTDIR)\messagebox.obj" \ + "$(INTDIR)\newsmooth.obj" \ + "$(INTDIR)\popupmenu.obj" \ + "$(INTDIR)\Road Smoothing.obj" \ + "$(INTDIR)\Sector Summary.obj" \ + "$(INTDIR)\selectwin.obj" \ + "$(INTDIR)\SmartMethod.obj" \ + "$(INTDIR)\smooth.obj" \ + "$(INTDIR)\Smoothing Utils.obj" + +"$(OUTDIR)\Editor.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Editor - Win32 Demo Release with Debug Info" + +OUTDIR=.\Demo Release with Debug +INTDIR=.\Demo Release with Debug +# Begin Custom Macros +OutDir=.\Demo Release with Debug +# End Custom Macros + +ALL : "$(OUTDIR)\Editor.lib" "$(OUTDIR)\Editor.bsc" + + +CLEAN : + -@erase "$(INTDIR)\Cursor Modes.obj" + -@erase "$(INTDIR)\Cursor Modes.sbr" + -@erase "$(INTDIR)\edit_sys.obj" + -@erase "$(INTDIR)\edit_sys.sbr" + -@erase "$(INTDIR)\Editor Callbacks.obj" + -@erase "$(INTDIR)\Editor Callbacks.sbr" + -@erase "$(INTDIR)\Editor Modes.obj" + -@erase "$(INTDIR)\Editor Modes.sbr" + -@erase "$(INTDIR)\Editor Taskbar Creation.obj" + -@erase "$(INTDIR)\Editor Taskbar Creation.sbr" + -@erase "$(INTDIR)\Editor Taskbar Utils.obj" + -@erase "$(INTDIR)\Editor Taskbar Utils.sbr" + -@erase "$(INTDIR)\Editor Undo.obj" + -@erase "$(INTDIR)\Editor Undo.sbr" + -@erase "$(INTDIR)\EditorBuildings.obj" + -@erase "$(INTDIR)\EditorBuildings.sbr" + -@erase "$(INTDIR)\EditorItems.obj" + -@erase "$(INTDIR)\EditorItems.sbr" + -@erase "$(INTDIR)\EditorMapInfo.obj" + -@erase "$(INTDIR)\EditorMapInfo.sbr" + -@erase "$(INTDIR)\EditorMercs.obj" + -@erase "$(INTDIR)\EditorMercs.sbr" + -@erase "$(INTDIR)\EditorTerrain.obj" + -@erase "$(INTDIR)\EditorTerrain.sbr" + -@erase "$(INTDIR)\editscreen.obj" + -@erase "$(INTDIR)\editscreen.sbr" + -@erase "$(INTDIR)\Item Statistics.obj" + -@erase "$(INTDIR)\Item Statistics.sbr" + -@erase "$(INTDIR)\LoadScreen.obj" + -@erase "$(INTDIR)\LoadScreen.sbr" + -@erase "$(INTDIR)\messagebox.obj" + -@erase "$(INTDIR)\messagebox.sbr" + -@erase "$(INTDIR)\newsmooth.obj" + -@erase "$(INTDIR)\newsmooth.sbr" + -@erase "$(INTDIR)\popupmenu.obj" + -@erase "$(INTDIR)\popupmenu.sbr" + -@erase "$(INTDIR)\Road Smoothing.obj" + -@erase "$(INTDIR)\Road Smoothing.sbr" + -@erase "$(INTDIR)\Sector Summary.obj" + -@erase "$(INTDIR)\Sector Summary.sbr" + -@erase "$(INTDIR)\selectwin.obj" + -@erase "$(INTDIR)\selectwin.sbr" + -@erase "$(INTDIR)\SmartMethod.obj" + -@erase "$(INTDIR)\SmartMethod.sbr" + -@erase "$(INTDIR)\smooth.obj" + -@erase "$(INTDIR)\smooth.sbr" + -@erase "$(INTDIR)\Smoothing Utils.obj" + -@erase "$(INTDIR)\Smoothing Utils.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Editor.bsc" + -@erase "$(OUTDIR)\Editor.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\TileEngine" /I "..\Utils" /I "..\TacticalAI" /I "..\Tactical" /I "..\strategic" /I ".\\" /D "NDEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Editor.pch" /YX"Editor All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Editor.bsc" +BSC32_SBRS= \ + "$(INTDIR)\Cursor Modes.sbr" \ + "$(INTDIR)\edit_sys.sbr" \ + "$(INTDIR)\Editor Callbacks.sbr" \ + "$(INTDIR)\Editor Modes.sbr" \ + "$(INTDIR)\Editor Taskbar Creation.sbr" \ + "$(INTDIR)\Editor Taskbar Utils.sbr" \ + "$(INTDIR)\Editor Undo.sbr" \ + "$(INTDIR)\EditorBuildings.sbr" \ + "$(INTDIR)\EditorItems.sbr" \ + "$(INTDIR)\EditorMapInfo.sbr" \ + "$(INTDIR)\EditorMercs.sbr" \ + "$(INTDIR)\EditorTerrain.sbr" \ + "$(INTDIR)\editscreen.sbr" \ + "$(INTDIR)\Item Statistics.sbr" \ + "$(INTDIR)\LoadScreen.sbr" \ + "$(INTDIR)\messagebox.sbr" \ + "$(INTDIR)\newsmooth.sbr" \ + "$(INTDIR)\popupmenu.sbr" \ + "$(INTDIR)\Road Smoothing.sbr" \ + "$(INTDIR)\Sector Summary.sbr" \ + "$(INTDIR)\selectwin.sbr" \ + "$(INTDIR)\SmartMethod.sbr" \ + "$(INTDIR)\smooth.sbr" \ + "$(INTDIR)\Smoothing Utils.sbr" + +"$(OUTDIR)\Editor.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Editor.lib" +LIB32_OBJS= \ + "$(INTDIR)\Cursor Modes.obj" \ + "$(INTDIR)\edit_sys.obj" \ + "$(INTDIR)\Editor Callbacks.obj" \ + "$(INTDIR)\Editor Modes.obj" \ + "$(INTDIR)\Editor Taskbar Creation.obj" \ + "$(INTDIR)\Editor Taskbar Utils.obj" \ + "$(INTDIR)\Editor Undo.obj" \ + "$(INTDIR)\EditorBuildings.obj" \ + "$(INTDIR)\EditorItems.obj" \ + "$(INTDIR)\EditorMapInfo.obj" \ + "$(INTDIR)\EditorMercs.obj" \ + "$(INTDIR)\EditorTerrain.obj" \ + "$(INTDIR)\editscreen.obj" \ + "$(INTDIR)\Item Statistics.obj" \ + "$(INTDIR)\LoadScreen.obj" \ + "$(INTDIR)\messagebox.obj" \ + "$(INTDIR)\newsmooth.obj" \ + "$(INTDIR)\popupmenu.obj" \ + "$(INTDIR)\Road Smoothing.obj" \ + "$(INTDIR)\Sector Summary.obj" \ + "$(INTDIR)\selectwin.obj" \ + "$(INTDIR)\SmartMethod.obj" \ + "$(INTDIR)\smooth.obj" \ + "$(INTDIR)\Smoothing Utils.obj" + +"$(OUTDIR)\Editor.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Editor - Win32 Demo Bounds Checker" + +OUTDIR=.\Demo Bounds Checker +INTDIR=.\Demo Bounds Checker +# Begin Custom Macros +OutDir=.\Demo Bounds Checker +# End Custom Macros + +ALL : "$(OUTDIR)\Editor.lib" "$(OUTDIR)\Editor.bsc" + + +CLEAN : + -@erase "$(INTDIR)\Cursor Modes.obj" + -@erase "$(INTDIR)\Cursor Modes.sbr" + -@erase "$(INTDIR)\edit_sys.obj" + -@erase "$(INTDIR)\edit_sys.sbr" + -@erase "$(INTDIR)\Editor Callbacks.obj" + -@erase "$(INTDIR)\Editor Callbacks.sbr" + -@erase "$(INTDIR)\Editor Modes.obj" + -@erase "$(INTDIR)\Editor Modes.sbr" + -@erase "$(INTDIR)\Editor Taskbar Creation.obj" + -@erase "$(INTDIR)\Editor Taskbar Creation.sbr" + -@erase "$(INTDIR)\Editor Taskbar Utils.obj" + -@erase "$(INTDIR)\Editor Taskbar Utils.sbr" + -@erase "$(INTDIR)\Editor Undo.obj" + -@erase "$(INTDIR)\Editor Undo.sbr" + -@erase "$(INTDIR)\EditorBuildings.obj" + -@erase "$(INTDIR)\EditorBuildings.sbr" + -@erase "$(INTDIR)\EditorItems.obj" + -@erase "$(INTDIR)\EditorItems.sbr" + -@erase "$(INTDIR)\EditorMapInfo.obj" + -@erase "$(INTDIR)\EditorMapInfo.sbr" + -@erase "$(INTDIR)\EditorMercs.obj" + -@erase "$(INTDIR)\EditorMercs.sbr" + -@erase "$(INTDIR)\EditorTerrain.obj" + -@erase "$(INTDIR)\EditorTerrain.sbr" + -@erase "$(INTDIR)\editscreen.obj" + -@erase "$(INTDIR)\editscreen.sbr" + -@erase "$(INTDIR)\Item Statistics.obj" + -@erase "$(INTDIR)\Item Statistics.sbr" + -@erase "$(INTDIR)\LoadScreen.obj" + -@erase "$(INTDIR)\LoadScreen.sbr" + -@erase "$(INTDIR)\messagebox.obj" + -@erase "$(INTDIR)\messagebox.sbr" + -@erase "$(INTDIR)\newsmooth.obj" + -@erase "$(INTDIR)\newsmooth.sbr" + -@erase "$(INTDIR)\popupmenu.obj" + -@erase "$(INTDIR)\popupmenu.sbr" + -@erase "$(INTDIR)\Road Smoothing.obj" + -@erase "$(INTDIR)\Road Smoothing.sbr" + -@erase "$(INTDIR)\Sector Summary.obj" + -@erase "$(INTDIR)\Sector Summary.sbr" + -@erase "$(INTDIR)\selectwin.obj" + -@erase "$(INTDIR)\selectwin.sbr" + -@erase "$(INTDIR)\SmartMethod.obj" + -@erase "$(INTDIR)\SmartMethod.sbr" + -@erase "$(INTDIR)\smooth.obj" + -@erase "$(INTDIR)\smooth.sbr" + -@erase "$(INTDIR)\Smoothing Utils.obj" + -@erase "$(INTDIR)\Smoothing Utils.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Editor.bsc" + -@erase "$(OUTDIR)\Editor.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Editor.pch" /YX"Editor All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Editor.bsc" +BSC32_SBRS= \ + "$(INTDIR)\Cursor Modes.sbr" \ + "$(INTDIR)\edit_sys.sbr" \ + "$(INTDIR)\Editor Callbacks.sbr" \ + "$(INTDIR)\Editor Modes.sbr" \ + "$(INTDIR)\Editor Taskbar Creation.sbr" \ + "$(INTDIR)\Editor Taskbar Utils.sbr" \ + "$(INTDIR)\Editor Undo.sbr" \ + "$(INTDIR)\EditorBuildings.sbr" \ + "$(INTDIR)\EditorItems.sbr" \ + "$(INTDIR)\EditorMapInfo.sbr" \ + "$(INTDIR)\EditorMercs.sbr" \ + "$(INTDIR)\EditorTerrain.sbr" \ + "$(INTDIR)\editscreen.sbr" \ + "$(INTDIR)\Item Statistics.sbr" \ + "$(INTDIR)\LoadScreen.sbr" \ + "$(INTDIR)\messagebox.sbr" \ + "$(INTDIR)\newsmooth.sbr" \ + "$(INTDIR)\popupmenu.sbr" \ + "$(INTDIR)\Road Smoothing.sbr" \ + "$(INTDIR)\Sector Summary.sbr" \ + "$(INTDIR)\selectwin.sbr" \ + "$(INTDIR)\SmartMethod.sbr" \ + "$(INTDIR)\smooth.sbr" \ + "$(INTDIR)\Smoothing Utils.sbr" + +"$(OUTDIR)\Editor.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Editor.lib" +LIB32_OBJS= \ + "$(INTDIR)\Cursor Modes.obj" \ + "$(INTDIR)\edit_sys.obj" \ + "$(INTDIR)\Editor Callbacks.obj" \ + "$(INTDIR)\Editor Modes.obj" \ + "$(INTDIR)\Editor Taskbar Creation.obj" \ + "$(INTDIR)\Editor Taskbar Utils.obj" \ + "$(INTDIR)\Editor Undo.obj" \ + "$(INTDIR)\EditorBuildings.obj" \ + "$(INTDIR)\EditorItems.obj" \ + "$(INTDIR)\EditorMapInfo.obj" \ + "$(INTDIR)\EditorMercs.obj" \ + "$(INTDIR)\EditorTerrain.obj" \ + "$(INTDIR)\editscreen.obj" \ + "$(INTDIR)\Item Statistics.obj" \ + "$(INTDIR)\LoadScreen.obj" \ + "$(INTDIR)\messagebox.obj" \ + "$(INTDIR)\newsmooth.obj" \ + "$(INTDIR)\popupmenu.obj" \ + "$(INTDIR)\Road Smoothing.obj" \ + "$(INTDIR)\Sector Summary.obj" \ + "$(INTDIR)\selectwin.obj" \ + "$(INTDIR)\SmartMethod.obj" \ + "$(INTDIR)\smooth.obj" \ + "$(INTDIR)\Smoothing Utils.obj" + +"$(OUTDIR)\Editor.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("Editor.dep") +!INCLUDE "Editor.dep" +!ELSE +!MESSAGE Warning: cannot find "Editor.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "Editor - Win32 Release" || "$(CFG)" == "Editor - Win32 Debug" || "$(CFG)" == "Editor - Win32 Release with Debug Info" || "$(CFG)" == "Editor - Win32 Bounds Checker" || "$(CFG)" == "Editor - Win32 Debug Demo" || "$(CFG)" == "Editor - Win32 Release Demo" || "$(CFG)" == "Editor - Win32 Demo Release with Debug Info" || "$(CFG)" == "Editor - Win32 Demo Bounds Checker" +SOURCE=".\Cursor Modes.cpp" + +"$(INTDIR)\Cursor Modes.obj" "$(INTDIR)\Cursor Modes.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\edit_sys.cpp + +"$(INTDIR)\edit_sys.obj" "$(INTDIR)\edit_sys.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Editor Callbacks.cpp" + +"$(INTDIR)\Editor Callbacks.obj" "$(INTDIR)\Editor Callbacks.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Editor Modes.cpp" + +"$(INTDIR)\Editor Modes.obj" "$(INTDIR)\Editor Modes.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Editor Taskbar Creation.cpp" + +"$(INTDIR)\Editor Taskbar Creation.obj" "$(INTDIR)\Editor Taskbar Creation.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Editor Taskbar Utils.cpp" + +"$(INTDIR)\Editor Taskbar Utils.obj" "$(INTDIR)\Editor Taskbar Utils.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Editor Undo.cpp" + +"$(INTDIR)\Editor Undo.obj" "$(INTDIR)\Editor Undo.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\EditorBuildings.cpp + +"$(INTDIR)\EditorBuildings.obj" "$(INTDIR)\EditorBuildings.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\EditorItems.cpp + +"$(INTDIR)\EditorItems.obj" "$(INTDIR)\EditorItems.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\EditorMapInfo.cpp + +"$(INTDIR)\EditorMapInfo.obj" "$(INTDIR)\EditorMapInfo.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\EditorMercs.cpp + +"$(INTDIR)\EditorMercs.obj" "$(INTDIR)\EditorMercs.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\EditorTerrain.cpp + +"$(INTDIR)\EditorTerrain.obj" "$(INTDIR)\EditorTerrain.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\editscreen.cpp + +"$(INTDIR)\editscreen.obj" "$(INTDIR)\editscreen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Item Statistics.cpp" + +"$(INTDIR)\Item Statistics.obj" "$(INTDIR)\Item Statistics.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\LoadScreen.cpp + +"$(INTDIR)\LoadScreen.obj" "$(INTDIR)\LoadScreen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\messagebox.cpp + +"$(INTDIR)\messagebox.obj" "$(INTDIR)\messagebox.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\newsmooth.cpp + +"$(INTDIR)\newsmooth.obj" "$(INTDIR)\newsmooth.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\popupmenu.cpp + +"$(INTDIR)\popupmenu.obj" "$(INTDIR)\popupmenu.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Road Smoothing.cpp" + +"$(INTDIR)\Road Smoothing.obj" "$(INTDIR)\Road Smoothing.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Sector Summary.cpp" + +"$(INTDIR)\Sector Summary.obj" "$(INTDIR)\Sector Summary.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\selectwin.cpp + +"$(INTDIR)\selectwin.obj" "$(INTDIR)\selectwin.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\SmartMethod.cpp + +"$(INTDIR)\SmartMethod.obj" "$(INTDIR)\SmartMethod.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\smooth.cpp + +"$(INTDIR)\smooth.obj" "$(INTDIR)\smooth.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Smoothing Utils.cpp" + +"$(INTDIR)\Smoothing Utils.obj" "$(INTDIR)\Smoothing Utils.sbr" : $(SOURCE) "$(INTDIR)" + + + +!ENDIF + diff --git a/Editor/Editor.vcproj b/Editor/Editor.vcproj new file mode 100644 index 00000000..cd1b70f6 --- /dev/null +++ b/Editor/Editor.vcproj @@ -0,0 +1,2321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Editor/EditorBuildings.cpp b/Editor/EditorBuildings.cpp new file mode 100644 index 00000000..79e78838 --- /dev/null +++ b/Editor/EditorBuildings.cpp @@ -0,0 +1,765 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "tiledef.h" + #include "edit_sys.h" + #include "sysutil.h" + #include "Font Control.h" + #include "renderworld.h" //ClearRenderFlags(); + #include "worldman.h" //HideStructOfGivenType() + #include "EditorDefines.h" + #include "EditorBuildings.h" + #include "EditorTerrain.h" //for access to TerrainTileDrawMode + #include "Render Fun.h" + #include "newsmooth.h" + #include "Editor Undo.h" + #include "Editor Taskbar Utils.h" + #include "Editor Modes.h" + #include "Smoothing Utils.h" + #include "Text Input.h" + #include "keys.h" + #include "environment.h" + #include "selectwin.h" + #include "Simple Render Utils.h" +#endif + +BOOLEAN fBuildingShowRoofs, fBuildingShowWalls, fBuildingShowRoomInfo; +UINT16 usCurrentMode; +UINT8 gubCurrRoomNumber; +UINT8 gubMaxRoomNumber; +BOOLEAN gfEditingDoor; + +//BEGINNNING OF BUILDING INITIALIZATION FUNCTIONS +void GameInitEditorBuildingInfo() +{ + fBuildingShowRoofs = TRUE; + fBuildingShowWalls = TRUE; + fBuildingShowRoomInfo = FALSE; + usCurrentMode = BUILDING_PLACE_WALLS; + gubCurrRoomNumber = gubMaxRoomNumber = 1; +} + +//BEGINNING OF BUILDING UTILITY FUNCTIONS +void UpdateRoofsView() +{ + INT32 x; + UINT16 usType; + for ( x = 0; x < WORLD_MAX; x++ ) + { + for ( usType = FIRSTROOF; usType <= LASTSLANTROOF; usType++ ) + { + HideStructOfGivenType( x, usType, (BOOLEAN)(!fBuildingShowRoofs) ); + } + } + gfRenderWorld = TRUE; +} + +void UpdateWallsView() +{ + INT32 cnt; + for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) + { + if ( fBuildingShowWalls ) + { + RemoveWallLevelnodeFlags( (INT16)cnt, LEVELNODE_HIDDEN ); + } + else + { + SetWallLevelnodeFlags( (INT16)cnt, LEVELNODE_HIDDEN ); + } + } + gfRenderWorld = TRUE; +} + +void UpdateBuildingsInfo() +{ + //print the headers on top of the columns + SetFont( SMALLCOMPFONT ); + SetFontForeground( FONT_RED ); + mprintfEditor( 112, 362, L"TOGGLE"); + mprintfEditor( 114, 372, L"VIEWS"); + SetFontForeground( FONT_YELLOW ); + mprintfEditor( 185, 362, L"SELECTION METHOD"); + SetFontForeground( FONT_LTGREEN ); + mprintfEditor( 290, 362, L"SMART METHOD"); + SetFontForeground( FONT_LTBLUE ); + mprintfEditor( 390, 362, L"BUILDING METHOD"); + SetFontForeground( FONT_GRAY2 ); + mprintfEditor( 437, 404, L"Room#" ); +} + +//Uses a recursive method to elimate adjacent tiles of structure information. +//The code will attempt to delete the current mapindex, then search using this method: +//1) if there isn't structure info here, return. +//2) if there is structure info here, delete it now. +//3) KillBuilding at x-1, y. +//4) KillBuilding at x , y-1. +//5) KillBuilding at x+1, y. +//6) KillBuilding at x , y+1. +void KillBuilding( UINT32 iMapIndex ) +{ + BOOLEAN fFound = FALSE; + + if( !gfBasement ) + fFound |= RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); + fFound |= RemoveAllLandsOfTypeRange( iMapIndex, FIRSTFLOOR, LASTFLOOR ); + + EraseBuilding( iMapIndex ); + gubWorldRoomInfo[ iMapIndex ] = 0; + + if( !fFound ) + { + if( gfBasement ) + RebuildRoof( iMapIndex, 0 ); + return; + } + + if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex - WORLD_COLS ) ) ) + KillBuilding( iMapIndex - WORLD_COLS ); + if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex + WORLD_COLS ) ) ) + KillBuilding( iMapIndex + WORLD_COLS ); + if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex + 1 ) ) ) + KillBuilding( iMapIndex + 1 ); + if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex - 1 ) ) ) + KillBuilding( iMapIndex - 1 ); + + if( gfBasement ) + RebuildRoof( iMapIndex, 0 ); +} + +BUILDINGLAYOUTNODE *gpBuildingLayoutList = NULL; +INT16 gsBuildingLayoutAnchorGridNo = -1; +extern void RemoveBuildingLayout(); + +void DeleteBuildingLayout() +{ + BUILDINGLAYOUTNODE *curr; + //Erases the cursors associated with them. + RemoveBuildingLayout(); + while( gpBuildingLayoutList ) + { + curr = gpBuildingLayoutList; + gpBuildingLayoutList = gpBuildingLayoutList->next; + MemFree( curr ); + } + gpBuildingLayoutList = NULL; + gsBuildingLayoutAnchorGridNo = -1; +} + +void BuildLayout( INT32 iMapIndex, INT32 iOffset ) +{ + BUILDINGLAYOUTNODE *curr; + //First, validate the gridno + iMapIndex += iOffset; + if( iMapIndex < 0 && iMapIndex >= WORLD_COLS*WORLD_ROWS ) + return; + //Now, check if there is a building here + if( !BuildingAtGridNo( iMapIndex ) ) + { + if( iOffset == 1 && !BuildingAtGridNo( iMapIndex - 1 ) ) + return; + if( iOffset == WORLD_COLS && !BuildingAtGridNo( iMapIndex - WORLD_COLS ) ) + return; + if( iOffset == -1 && !GetVerticalWall( iMapIndex ) ) + return; + if( iOffset == -WORLD_COLS && !GetHorizontalWall( iMapIndex ) ) + return; + } + //Now, check to make sure this gridno hasn't already been processed. + curr = gpBuildingLayoutList; + while( curr ) + { + if( (INT16)iMapIndex == curr->sGridNo ) + return; + curr = curr->next; + } + //Good, it hasn't, so process it and add it to the head of the list. + curr = (BUILDINGLAYOUTNODE*)MemAlloc( sizeof( BUILDINGLAYOUTNODE ) ); + Assert( curr ); + curr->sGridNo = (INT16)iMapIndex; + curr->next = gpBuildingLayoutList; + gpBuildingLayoutList = curr; + + //Use recursion to process the remainder. + BuildLayout( iMapIndex, -WORLD_COLS ); + BuildLayout( iMapIndex, -1 ); + BuildLayout( iMapIndex, 1 ); + BuildLayout( iMapIndex, WORLD_COLS ); +} + +//The first step is copying a building. After that, it either must be pasted or moved. +void CopyBuilding( INT32 iMapIndex ) +{ + AssertMsg( !gpBuildingLayoutList, "Error: Attempting to copy building multiple times." ); + + //First step is to determine if we have a building in the area that we click. If not, do nothing. + if( !BuildingAtGridNo( iMapIndex ) ) + return; + //Okay, a building does exist here to some undetermined capacity. + //Allocate the basic structure, then calculate the layout. The head node is + gpBuildingLayoutList = (BUILDINGLAYOUTNODE*)MemAlloc( sizeof( BUILDINGLAYOUTNODE ) ); + Assert( gpBuildingLayoutList ); + gpBuildingLayoutList->sGridNo = (INT16)iMapIndex; + gpBuildingLayoutList->next = NULL; + + //Set the anchor point for this building -- this is where the user clicked. + gsBuildingLayoutAnchorGridNo = (INT16)iMapIndex; + + //Now, recursively expand out while adding unique gridnos to our list. The recursion will + //terminate when complete. + BuildLayout( iMapIndex, -WORLD_COLS ); + BuildLayout( iMapIndex, -1 ); + BuildLayout( iMapIndex, 1 ); + BuildLayout( iMapIndex, WORLD_COLS ); + + //We have our layout. Now depending on the mode, we will either move the building or + //copy it. The layout automatically gets deleted as soon as the user releases the mouse + //button. +} + +//depending on the offset, we will either sort in increasing order, or decreasing order. +//This will prevent overlapping problems. +void SortBuildingLayout( INT32 iMapIndex ) +{ + BUILDINGLAYOUTNODE *head, *curr, *prev, *prevBest, *best; + INT32 iBestIndex; + head = NULL; + if( iMapIndex < gsBuildingLayoutAnchorGridNo ) + { //Forward sort (in increasing order) + while( gpBuildingLayoutList ) + { + iBestIndex = -1; + curr = gpBuildingLayoutList; + prev = NULL; + while( curr ) + { + if( iBestIndex < curr->sGridNo ) + { + iBestIndex = curr->sGridNo; + prevBest = prev; + best = curr; + } + prev = curr; + curr = curr->next; + } + //detach node from real list + if( prevBest ) + prevBest->next = best->next; + if( best == gpBuildingLayoutList ) + gpBuildingLayoutList = gpBuildingLayoutList->next; + //insert node into temp sorted list + best->next = head; + head = best; + } + } + else + { //Reverse sort (in decreasing order) + while( gpBuildingLayoutList ) + { + iBestIndex = 100000; + curr = gpBuildingLayoutList; + prev = NULL; + while( curr ) + { + if( iBestIndex > curr->sGridNo ) + { + iBestIndex = curr->sGridNo; + prevBest = prev; + best = curr; + } + prev = curr; + curr = curr->next; + } + //detach node from real list + if( prevBest ) + prevBest->next = best->next; + if( best == gpBuildingLayoutList ) + gpBuildingLayoutList = gpBuildingLayoutList->next; + //insert node into temp sorted list + best->next = head; + head = best; + } + } + //Now assign the newly sorted list back to the real list. + gpBuildingLayoutList = head; +} + +void PasteMapElementToNewMapElement( INT32 iSrcGridNo, INT32 iDstGridNo ) +{ + MAP_ELEMENT *pSrcMapElement; + LEVELNODE *pNode; + UINT16 usType; + + DeleteStuffFromMapTile( iDstGridNo ); + DeleteAllLandLayers( iDstGridNo ); + + //Get a pointer to the src mapelement + pSrcMapElement = &gpWorldLevelData[ iSrcGridNo ]; + + //Go through each levelnode, and paste the info into the new gridno + pNode = pSrcMapElement->pLandHead; + while( pNode ) + { + if( pNode == pSrcMapElement->pLandStart ) + gpWorldLevelData[ iDstGridNo ].pLandStart = AddLandToTail( iDstGridNo, pNode->usIndex ); + else + AddLandToTail( iDstGridNo, pNode->usIndex ); + pNode = pNode->pNext; + } + pNode = pSrcMapElement->pObjectHead; + while( pNode ) + { + AddObjectToTail( iDstGridNo, pNode->usIndex ); + pNode = pNode->pNext; + } + pNode = pSrcMapElement->pStructHead; + while( pNode ) + { + AddStructToTail( iDstGridNo, pNode->usIndex ); + pNode = pNode->pNext; + } + pNode = pSrcMapElement->pShadowHead; + while( pNode ) + { + AddShadowToTail( iDstGridNo, pNode->usIndex ); + pNode = pNode->pNext; + } + pNode = pSrcMapElement->pRoofHead; + while( pNode ) + { + AddRoofToTail( iDstGridNo, pNode->usIndex ); + pNode = pNode->pNext; + } + pNode = pSrcMapElement->pOnRoofHead; + while( pNode ) + { + AddOnRoofToTail( iDstGridNo, pNode->usIndex ); + pNode = pNode->pNext; + } + pNode = pSrcMapElement->pTopmostHead; + while( pNode ) + { + if( pNode->usIndex != FIRSTPOINTERS1 ) + AddTopmostToTail( iDstGridNo, pNode->usIndex ); + pNode = pNode->pNext; + } + for ( usType = FIRSTROOF; usType <= LASTSLANTROOF; usType++ ) + { + HideStructOfGivenType( iDstGridNo, usType, (BOOLEAN)(!fBuildingShowRoofs) ); + } +} + +void MoveBuilding( INT32 iMapIndex ) +{ + BUILDINGLAYOUTNODE *curr; + INT32 iOffset; + if( !gpBuildingLayoutList ) + return; + SortBuildingLayout( iMapIndex ); + iOffset = iMapIndex - gsBuildingLayoutAnchorGridNo; + //First time, set the undo gridnos to everything effected. + curr = gpBuildingLayoutList; + while( curr ) + { + AddToUndoList( curr->sGridNo ); + AddToUndoList( curr->sGridNo + iOffset ); + curr = curr->next; + } + //Now, move the building + curr = gpBuildingLayoutList; + while( curr ) + { + PasteMapElementToNewMapElement( curr->sGridNo, curr->sGridNo + iOffset ); + DeleteStuffFromMapTile( curr->sGridNo ); + curr = curr->next; + } + MarkWorldDirty(); +} + +void PasteBuilding( INT32 iMapIndex ) +{ + BUILDINGLAYOUTNODE *curr; + INT32 iOffset; + if( !gpBuildingLayoutList ) + return; + SortBuildingLayout( iMapIndex ); + iOffset = iMapIndex - gsBuildingLayoutAnchorGridNo; + curr = gpBuildingLayoutList; + //First time, set the undo gridnos to everything effected. + while( curr ) + { + AddToUndoList( curr->sGridNo ); + AddToUndoList( curr->sGridNo + iOffset ); + curr = curr->next; + } + //Now, paste the building (no smoothing) + curr = gpBuildingLayoutList; + while( curr ) + { + PasteMapElementToNewMapElement( curr->sGridNo, curr->sGridNo + iOffset ); + curr = curr->next; + } + MarkWorldDirty(); +} + +typedef struct ROOFNODE +{ + INT32 iMapIndex; + struct ROOFNODE *next; +}ROOFNODE; + +ROOFNODE *gpRoofList = NULL; + +void ReplaceRoof( INT32 iMapIndex, UINT16 usRoofType ) +{ + ROOFNODE *curr; + //First, validate the gridno + if( iMapIndex < 0 && iMapIndex >= WORLD_COLS*WORLD_ROWS ) + return; + //Now, check if there is a floor here + if( !FloorAtGridNo( iMapIndex ) ) + return; + //Now, check to make sure this gridno hasn't already been processed. + curr = gpRoofList; + while( curr ) + { + if( iMapIndex == curr->iMapIndex ) + return; + curr = curr->next; + } + //Good, it hasn't, so process it and add it to the head of the list. + curr = (ROOFNODE*)MemAlloc( sizeof( ROOFNODE ) ); + Assert( curr ); + curr->iMapIndex = iMapIndex; + curr->next = gpRoofList; + gpRoofList = curr; + + RebuildRoofUsingFloorInfo( iMapIndex, usRoofType ); + + //Use recursion to process the remainder. + ReplaceRoof( iMapIndex - WORLD_COLS, usRoofType ); + ReplaceRoof( iMapIndex + WORLD_COLS, usRoofType ); + ReplaceRoof( iMapIndex - 1, usRoofType ); + ReplaceRoof( iMapIndex + 1, usRoofType ); +} + +void ReplaceBuildingWithNewRoof( INT32 iMapIndex ) +{ + UINT16 usRoofType; + ROOFNODE *curr; + //Not in normal editor mode, then can't do it. + if( gfBasement || gfCaves ) + return; + //if we don't have a floor here, then we can't replace the roof! + if( !FloorAtGridNo( iMapIndex ) ) + return; + //Extract the selected roof type. + usRoofType = (UINT16)SelSingleNewRoof[ iCurBank ].uiObject; + + //now start building a linked list of all nodes visited -- start the first node. + gpRoofList = (ROOFNODE*)MemAlloc( sizeof( ROOFNODE ) ); + Assert( gpRoofList ); + gpRoofList->iMapIndex = iMapIndex; + gpRoofList->next = 0; + RebuildRoofUsingFloorInfo( iMapIndex, usRoofType ); + + //Use recursion to process the remainder. + ReplaceRoof( iMapIndex - WORLD_COLS, usRoofType ); + ReplaceRoof( iMapIndex + WORLD_COLS, usRoofType ); + ReplaceRoof( iMapIndex - 1, usRoofType ); + ReplaceRoof( iMapIndex + 1, usRoofType ); + + //Done, so delete the list. + while( gpRoofList ) + { + curr = gpRoofList; + gpRoofList = gpRoofList->next; + MemFree( curr ); + } + gpRoofList = NULL; +} + +//internal door editing vars. +INT32 iDoorMapIndex = 0; +enum{ + DOOR_BACKGROUND, + DOOR_OKAY, + DOOR_CANCEL, + DOOR_LOCKED, + NUM_DOOR_BUTTONS +}; +INT32 iDoorButton[ NUM_DOOR_BUTTONS ]; +MOUSE_REGION DoorRegion; +void DoorOkayCallback( GUI_BUTTON *btn, INT32 reason ); +void DoorCancelCallback( GUI_BUTTON *btn, INT32 reason ); +void DoorToggleLockedCallback( GUI_BUTTON *btn, INT32 reason ); + +extern BOOLEAN OpenableAtGridNo( UINT32 iMapIndex ); + +void InitDoorEditing( INT32 iMapIndex ) +{ + DOOR *pDoor; + if( !DoorAtGridNo( iMapIndex ) && !OpenableAtGridNo( iMapIndex ) ) + return; + gfEditingDoor = TRUE; + iDoorMapIndex = iMapIndex; + DisableEditorTaskbar(); + MSYS_DefineRegion( &DoorRegion, 0, 0, 640, 480, MSYS_PRIORITY_HIGH-2, 0, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + iDoorButton[ DOOR_BACKGROUND ] = + CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, 200, 130, 240, 100, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1, + BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); + DisableButton( iDoorButton[ DOOR_BACKGROUND ] ); + SpecifyDisabledButtonStyle( iDoorButton[ DOOR_BACKGROUND ], DISABLED_STYLE_NONE ); + iDoorButton[ DOOR_OKAY ] = + CreateTextButton(L"Okay", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + 330, 195, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + DoorOkayCallback ); + iDoorButton[ DOOR_CANCEL ] = + CreateTextButton(L"Cancel", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + 385, 195, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + DoorCancelCallback ); + InitTextInputModeWithScheme( DEFAULT_SCHEME ); + AddTextInputField( 210, 155, 25, 16, MSYS_PRIORITY_HIGH, L"0", 3, INPUTTYPE_NUMERICSTRICT ); + AddTextInputField( 210, 175, 25, 16, MSYS_PRIORITY_HIGH, L"0", 2, INPUTTYPE_NUMERICSTRICT ); + AddTextInputField( 210, 195, 25, 16, MSYS_PRIORITY_HIGH, L"0", 2, INPUTTYPE_NUMERICSTRICT ); + iDoorButton[ DOOR_LOCKED ] = + CreateCheckBoxButton( 210, 215, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_HIGH, DoorToggleLockedCallback ); + + pDoor = FindDoorInfoAtGridNo( iDoorMapIndex ); + if( pDoor ) + { + if( pDoor->fLocked ) + { + ButtonList[ iDoorButton[ DOOR_LOCKED ] ]->uiFlags |= BUTTON_CLICKED_ON; + } + SetInputFieldStringWithNumericStrictValue( 0, pDoor->ubLockID ); + SetInputFieldStringWithNumericStrictValue( 1, pDoor->ubTrapID ); + SetInputFieldStringWithNumericStrictValue( 2, pDoor->ubTrapLevel ); + } + else + { + ButtonList[ iDoorButton[ DOOR_LOCKED ] ]->uiFlags |= BUTTON_CLICKED_ON; + } +} + +void ExtractAndUpdateDoorInfo() +{ + LEVELNODE* pNode; + INT32 num; + DOOR door; + BOOLEAN fCursor = FALSE; + BOOLEAN fCursorExists = FALSE; + + memset( &door, 0, sizeof( DOOR ) ); + + door.sGridNo = (INT16)iDoorMapIndex; + + num = min( GetNumericStrictValueFromField( 0 ), NUM_LOCKS-1 ); + door.ubLockID = (UINT8)num; + SetInputFieldStringWithNumericStrictValue( 0, num ); + if( num >= 0 ) + fCursor = TRUE; + + num = min( max( GetNumericStrictValueFromField( 1 ), 0 ), 10 ); + door.ubTrapID = (UINT8)num; + SetInputFieldStringWithNumericStrictValue( 1, num ); + if( num ) + fCursor = TRUE; + + num = min( max( GetNumericStrictValueFromField( 2 ), 0 ), 20 ); + if( door.ubTrapID && !num ) + num = 1; //Can't have a trap without a traplevel! + door.ubTrapLevel = (UINT8)num; + SetInputFieldStringWithNumericStrictValue( 2, num ); + if( num ) + fCursor = TRUE; + + if( ButtonList[ iDoorButton[ DOOR_LOCKED ] ]->uiFlags & BUTTON_CLICKED_ON ) + { + door.fLocked = TRUE; + } + else + { + door.fLocked = FALSE; + } + + //Find out if we have a rotating key cursor (we will either add one or remove one) + pNode = gpWorldLevelData[ iDoorMapIndex ].pTopmostHead; + while( pNode ) + { + if( pNode->usIndex == ROTATINGKEY1 ) + { + fCursorExists = TRUE; + break; + } + pNode = pNode->pNext; + } + if( fCursor ) + { //we have a valid door, so add it (or replace existing) + if( !fCursorExists ) + AddTopmostToHead( iDoorMapIndex, ROTATINGKEY1 ); + //If the door already exists, the new information will replace it. + AddDoorInfoToTable( &door ); + } + else + { //if a door exists here, remove it. + if( fCursorExists ) + RemoveAllTopmostsOfTypeRange( iDoorMapIndex, ROTATINGKEY, ROTATINGKEY ); + RemoveDoorInfoFromTable( iDoorMapIndex ); + } + +} + +void FindNextLockedDoor() +{ + DOOR *pDoor; + INT32 i; + for( i = iDoorMapIndex + 1; i < WORLD_MAX; i++ ) + { + pDoor = FindDoorInfoAtGridNo( i ); + if( pDoor ) + { + CenterScreenAtMapIndex( i ); + iDoorMapIndex = i; + return; + } + } + for( i = 0; i <= iDoorMapIndex; i++ ) + { + pDoor = FindDoorInfoAtGridNo( i ); + if( pDoor ) + { + CenterScreenAtMapIndex( i ); + iDoorMapIndex = i; + return; + } + } +} + +void RenderDoorEditingWindow() +{ + InvalidateRegion( 200, 130, 440, 230 ); + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + SetFontShadow( FONT_NEARBLACK ); + SetFontBackground( 0 ); + mprintf( 210, 140, L"Editing lock attributes at map index %d.", iDoorMapIndex ); + + SetFontForeground( FONT_GRAY2 ); + mprintf( 238, 160, L"Lock ID" ); + mprintf( 238, 180, L"Trap Type" ); + mprintf( 238, 200, L"Trap Level" ); + mprintf( 238, 218, L"Locked" ); +} + +void KillDoorEditing() +{ + INT32 i; + EnableEditorTaskbar(); + MSYS_RemoveRegion( &DoorRegion ); + for( i = 0; i < NUM_DOOR_BUTTONS; i++ ) + RemoveButton( iDoorButton[ i ] ); + gfEditingDoor = FALSE; + KillTextInputMode(); +} + +void DoorOkayCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + ExtractAndUpdateDoorInfo(); + KillDoorEditing(); + } +} + +void DoorCancelCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + KillDoorEditing(); + } +} + +void DoorToggleLockedCallback( GUI_BUTTON *btn, INT32 reason ) +{ + //handled in ExtractAndUpdateDoorInfo(); +} + +void AddLockedDoorCursors() +{ + DOOR *pDoor; + INT i; + for( i = 0; i < gubNumDoors; i++ ) + { + pDoor = &DoorTable[ i ]; + AddTopmostToHead( pDoor->sGridNo, ROTATINGKEY1 ); + } +} + +void RemoveLockedDoorCursors() +{ + DOOR *pDoor; + INT i; + LEVELNODE* pNode; + LEVELNODE* pTemp; + for( i = 0; i < gubNumDoors; i++ ) + { + pDoor = &DoorTable[ i ]; + pNode = gpWorldLevelData[ pDoor->sGridNo ].pTopmostHead; + while( pNode ) + { + if( pNode->usIndex == ROTATINGKEY1 ) + { + pTemp = pNode; + pNode = pNode->pNext; + RemoveTopmost( pDoor->sGridNo, pTemp->usIndex ); + } + else + pNode = pNode->pNext; + } + } +} + +void SetupTextInputForBuildings() +{ + UINT16 str[4]; + InitTextInputModeWithScheme( DEFAULT_SCHEME ); + AddUserInputField( NULL ); //just so we can use short cut keys while not typing. + swprintf( str, L"%d", gubMaxRoomNumber ); + AddTextInputField( 410, 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); +} + +void ExtractAndUpdateBuildingInfo() +{ + UINT16 str[4]; + INT32 temp; + //extract light1 colors + temp = min( GetNumericStrictValueFromField( 1 ), 255 ); + if( temp != -1 ) + { + gubCurrRoomNumber = (UINT8)temp; + } + else + { + gubCurrRoomNumber = 0; + } + swprintf( str, L"%d", gubCurrRoomNumber ); + SetInputFieldStringWith16BitString( 1, str ); + SetActiveField( 0 ); +} + + + +#endif + + + + + + diff --git a/Editor/EditorBuildings.h b/Editor/EditorBuildings.h new file mode 100644 index 00000000..abb0431c --- /dev/null +++ b/Editor/EditorBuildings.h @@ -0,0 +1,67 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDITORBUILDINGS_H +#define __EDITORBUILDINGS_H + +#include "video.h" +#include "vobject_blitters.h" + +extern BOOLEAN fBuildingShowRoofs, fBuildingShowWalls, fBuildingShowRoomInfo; +extern UINT8 gubCurrRoomNumber; +extern UINT8 gubMaxRoomNumber; + +void SetupTextInputForBuildings(); +void ExtractAndUpdateBuildingInfo(); + +//Initialization routines +void GameInitEditorBuildingInfo(); +void InitEditorBuildingsToolbar(); + +//Selection method callbacks +//Building utility functions +void UpdateBuildingsInfo(); +void KillBuilding( UINT32 iMapIndex ); + + +typedef struct BUILDINGLAYOUTNODE +{ + struct BUILDINGLAYOUTNODE *next; + INT16 sGridNo; +}BUILDINGLAYOUTNODE; + +extern BUILDINGLAYOUTNODE *gpBuildingLayoutList; +extern INT16 gsBuildingLayoutAnchorGridNo; + +//The first step is copying a building. After that, it either must be pasted or moved. +void CopyBuilding( INT32 iMapIndex ); +void MoveBuilding( INT32 iMapIndex ); +void PasteBuilding( INT32 iMapIndex ); +void DeleteBuildingLayout(); + +void ReplaceBuildingWithNewRoof( INT32 iMapIndex ); +void UpdateWallsView(); +void UpdateRoofsView(); + +void InitDoorEditing( INT32 iMapIndex ); +void ExtractAndUpdateDoorInfo(); +void KillDoorEditing(); +void RenderDoorEditingWindow(); + +void AddLockedDoorCursors(); +void RemoveLockedDoorCursors(); +void FindNextLockedDoor(); + +extern BOOLEAN gfEditingDoor; + +extern UINT16 usCurrentMode; + +#endif + +#endif + + + + + + diff --git a/Editor/EditorDefines.h b/Editor/EditorDefines.h new file mode 100644 index 00000000..3dc36ce6 --- /dev/null +++ b/Editor/EditorDefines.h @@ -0,0 +1,264 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDITORDEFINES_H +#define __EDITORDEFINES_H + +#include "Types.h" +#include "Button Defines.h" + +enum +{ + TBAR_MODE_NONE, + TBAR_MODE_DRAW, + TBAR_MODE_ERASE, + TBAR_MODE_UNDO, + TBAR_MODE_EXIT_EDIT, + TBAR_MODE_QUIT_GAME, + TBAR_MODE_NEW_MAP, + TBAR_MODE_SAVE, + TBAR_MODE_LOAD, + TBAR_MODE_SET_BGRND, + TBAR_MODE_CHANGE_BRUSH, + TBAR_MODE_ERASE_OFF, + TBAR_MODE_FILL_AREA, + TBAR_MODE_FILL_AREA_OFF, + + TBAR_MODE_DRAW_DEBRIS, + TBAR_MODE_DRAW_BANKS, + TBAR_MODE_DRAW_MERC, + TBAR_MODE_DRAW_NPC1, + TBAR_MODE_DRAW_NPC2, + TBAR_MODE_DRAW_NPC3, + TBAR_MODE_DRAW_NPC4, + TBAR_MODE_DRAW_OSTRUCTS, + TBAR_MODE_DRAW_OSTRUCTS1, + TBAR_MODE_DRAW_OSTRUCTS2, + + TBAR_MODE_GET_WALL, + TBAR_MODE_GET_DOOR, + TBAR_MODE_GET_WINDOW, + TBAR_MODE_GET_ROOF, + TBAR_MODE_GET_BROKEN_WALL, + TBAR_MODE_GET_DECOR, + TBAR_MODE_GET_DECAL, + TBAR_MODE_GET_FLOOR, + TBAR_MODE_GET_TOILET, + TBAR_MODE_GET_OSTRUCTS, + TBAR_MODE_GET_OSTRUCTS1, + TBAR_MODE_GET_OSTRUCTS2, + TBAR_MODE_GET_FGRND_TILE, + TBAR_MODE_GET_BGRND_TILE, + TBAR_MODE_GET_DEBRIS, + TBAR_MODE_GET_BANKS, + TBAR_MODE_GET_ROADS, + TBAR_MODE_GET_ROOM, + TBAR_MODE_GET_NEW_ROOF, + TBAR_MODE_GET_TILE_TO_ROOM, + + TBAR_MODE_CHANGE_TILESET, + TBAR_MODE_CIVILIAN_GROUP, + TBAR_MODE_FAKE_LIGHTING, + TBAR_MODE_LIGHT_UP, + TBAR_MODE_LIGHT_DWN, + TBAR_MODE_DEC_DIFF, + TBAR_MODE_INC_DIFF, + + TBAR_MODE_RAISE_LAND, + TBAR_MODE_LOWER_LAND, + TBAR_MODE_DENS_UP, + TBAR_MODE_DENS_DWN, + + TBAR_MODE_MAKE_NEW_ROOM, + + TBAR_MODE_ITEM_WEAPONS, + TBAR_MODE_ITEM_AMMO, + TBAR_MODE_ITEM_ARMOUR, + TBAR_MODE_ITEM_EXPLOSIVES, + TBAR_MODE_ITEM_EQUIPMENT1, + TBAR_MODE_ITEM_EQUIPMENT2, + TBAR_MODE_ITEM_EQUIPMENT3, + TBAR_MODE_ITEM_TRIGGERS, + TBAR_MODE_ITEM_KEYS, +}; + +enum +{ + TASK_NONE, + TASK_TERRAIN, + TASK_BUILDINGS, + TASK_ITEMS, + TASK_MERCS, + TASK_MAPINFO, + TASK_OPTIONS +}; + +enum +{ + ACTION_NULL, + ACTION_SUB_INDEX_UP, + ACTION_SUB_INDEX_DWN, + ACTION_SET_NEW_BACKGROUND, + ACTION_EXIT_EDITOR, + ACTION_QUIT_GAME, + ACTION_NEXT_FGRND, + ACTION_SWITCH_SCRN, + ACTION_NEXT_LEVEL, + ACTION_NEXT_WALL, + ACTION_FILL_AREA, + ACTION_NEXT_DEBRIS, + ACTION_NEXT_DECAL, + ACTION_CHANGE_ELEV, + ACTION_PREV_SELECTIONTYPE, + ACTION_NEXT_SELECTIONTYPE, + ACTION_SET_FNAME, + ACTION_SAVE_MAP, + ACTION_LOAD_MAP, + ACTION_UNDO, + ACTION_NEXT_BANK, + ACTION_NEXT_ROAD, + ACTION_NEXT_CLIFF, + ACTION_SHADE_UP, + ACTION_SHADE_DWN, + ACTION_WALL_PASTE1, + ACTION_WALL_PASTE2, + ACTION_NEXT_STRUCT, + + ACTION_GET_ROOM, + ACTION_NEW_MAP, + + //using the selection method for getting objects for buildings + ACTION_GET_WALL, + ACTION_GET_DOOR, + ACTION_GET_WINDOW, + ACTION_GET_ROOF, + ACTION_GET_BROKEN_WALL, + ACTION_GET_DECOR, + ACTION_GET_DECAL, + ACTION_GET_FLOOR, + ACTION_GET_TOILET, + ACTION_GET_NEW_ROOF, + + ACTION_SET_MERC, + ACTION_QUICK_ERASE, + ACTION_HELPSCREEN, + ACTION_NEXT_STRUCT1, + ACTION_NEXT_STRUCT2, + ACTION_DRAW_BADMERC, + ACTION_EDIT_BADMERC, + ACTION_DRAW_GOODMERC, + ACTION_EDIT_GOODMERC, + ACTION_RAISE_LAND, + ACTION_LOWER_LAND, + ACTION_SET_WAYPOINT, + ACTION_ERASE_WAYPOINT, + ACTION_DENSITY_UP, + ACTION_DENSITY_DOWN, + + ACTION_COPY_MERC_PLACEMENT, + ACTION_PASTE_MERC_PLACEMENT, +}; + +enum +{ + DRAW_MODE_NOTHING, + //Terrain + DRAW_MODE_GROUND, + DRAW_MODE_NEW_GROUND, + DRAW_MODE_DEBRIS, + DRAW_MODE_BANKS, + DRAW_MODE_ROADS, + DRAW_MODE_OSTRUCTS, + DRAW_MODE_OSTRUCTS1, + DRAW_MODE_OSTRUCTS2, + //Selection method for buildings + DRAW_MODE_WALLS, + DRAW_MODE_DOORS, + DRAW_MODE_WINDOWS, + DRAW_MODE_ROOFS, + DRAW_MODE_NEWROOF, + DRAW_MODE_BROKEN_WALLS, + DRAW_MODE_DECOR, + DRAW_MODE_DECALS, + DRAW_MODE_FLOORS, + //Smart method for buildings + DRAW_MODE_SMART_WALLS, + DRAW_MODE_SMART_WINDOWS, + DRAW_MODE_SMART_DOORS, + DRAW_MODE_SMART_BROKEN_WALLS, + DRAW_MODE_DOORKEYS, + //Other stuff + DRAW_MODE_TOILET, + DRAW_MODE_ROOM, + DRAW_MODE_SAW_ROOM, + DRAW_MODE_ROOMNUM, + DRAW_MODE_CAVES, + DRAW_MODE_SLANTED_ROOF, + DRAW_MODE_KILL_BUILDING, + DRAW_MODE_COPY_BUILDING, + DRAW_MODE_MOVE_BUILDING, + DRAW_MODE_SHOW_TILESET, + DRAW_MODE_LIGHT, + DRAW_MODE_PLAYER, + DRAW_MODE_ENEMY, + DRAW_MODE_CREATURE, + DRAW_MODE_REBEL, + DRAW_MODE_CIVILIAN, + + DRAW_MODE_SCHEDULEACTION, + DRAW_MODE_SCHEDULECONFIRM, + + DRAW_MODE_EXITGRID, + DRAW_MODE_EXITGRID_QUEUE, + DRAW_MODE_NORTHPOINT, + DRAW_MODE_WESTPOINT, + DRAW_MODE_EASTPOINT, + DRAW_MODE_SOUTHPOINT, + DRAW_MODE_CENTERPOINT, + DRAW_MODE_ISOLATEDPOINT, + + DRAW_MODE_PLACE_ITEM, + DRAW_MODE_SELECT_BRUSH = 200, + DRAW_MODE_FILL_AREA, + DRAW_MODE_UNDO, + DRAW_MODE_ERASE = 1000 +}; + +extern INT32 iEditorButton[NUMBER_EDITOR_BUTTONS]; +extern INT32 iEditorToolbarState; +extern INT32 iDrawMode; +extern INT32 iCurrentAction; +extern INT32 iActionParam; +extern INT32 iEditAction; + +extern UINT16 gusLightLevel; +extern UINT16 gusLightLevelPercentage; +extern INT16 gsLightRadius; + +extern BOOLEAN gfRenderWorld; +extern BOOLEAN gfRenderTaskbar; +extern BOOLEAN gfShowTerrainTileButtons; +extern BOOLEAN gfRenderDrawingMode; + +extern BOOLEAN gfPendingBasement; +extern BOOLEAN gfPendingCaves; + +//When in merc-inventory mode, this flag is set when the user wishes to get an item, which requires hooking +//into the item editing features. It is defined here, so editoritems can get access to this mode which makes +//certain special cases. +extern BOOLEAN gfMercGetItem; + +//When actually editing item statistics, this value will be set, for the purposes of rendering, input, etc. +extern BOOLEAN gfShowItemStatsPanel; + +#define MERCPANEL_X 177 +#define MERCPANEL_Y 361 + +#endif +#endif + + + + + + diff --git a/Editor/EditorItems.cpp b/Editor/EditorItems.cpp new file mode 100644 index 00000000..9b35892c --- /dev/null +++ b/Editor/EditorItems.cpp @@ -0,0 +1,1641 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include + #include "tiledef.h" + #include "edit_sys.h" + #include "vsurface.h" + #include "vobject.h" + #include "mousesystem.h" + #include "Button System.h" + #include "wcheck.h" + #include "vsurface.h" + #include "input.h" + #include "sysutil.h" + #include "font.h" + #include "Font Control.h" + #include "editscreen.h" + #include "selectwin.h" + #include "video.h" + #include "vobject_blitters.h" + #include "interface panels.h" + #include "interface items.h" + #include "text.h" + #include "utilities.h" + #include "Action Items.h" + #include "World Items.h" + #include "EditorDefines.h" + #include "EditorItems.h" + #include "EditorMercs.h" + #include "weapons.h" + #include "Editor Taskbar Utils.h" + #include "wordwrap.h" + #include "Item Statistics.h" + #include "Simple Render Utils.h" + #include "worldman.h" + #include "random.h" + #include "Pits.h" + #include "keys.h" +#endif + +#define NUMBER_TRIGGERS 27 +#define PRESSURE_ACTION_ID (NUMBER_TRIGGERS - 1) + +extern ITEM_POOL *gpEditingItemPool; + +//Simply counts the number of items in the world. This is used for display purposes. +UINT16 CountNumberOfEditorPlacementsInWorld( UINT16 usEInfoIndex, UINT16 *pusQuantity ); //wrapper for the next three +UINT16 CountNumberOfItemPlacementsInWorld( UINT16 usItem, UINT16 *pusQuantity ); +UINT16 CountNumberOfItemsWithFrequency( UINT16 usItem, INT8 bFrequency ); +UINT16 CountNumberOfPressureActionsInWorld(); +UINT16 CountNumberOfKeysOfTypeInWorld( UINT8 ubKeyID ); + +//Finds and selects the next item when right clicking on an item type. Only works if the +//item actually exists in the world. +void FindNextItemOfSelectedType(); //wrapper for the next four +void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency ); +void SelectNextItemOfType( UINT16 usItem ); +void SelectNextPressureAction(); +void SelectNextKeyOfType( UINT8 ubKeyID ); + +INT32 giDefaultExistChance = 100; + +typedef struct IPListNode +{ + INT16 sGridNo; + struct IPListNode *next; +}IPListNode; + +IPListNode *pIPHead = NULL; + +IPListNode *gpCurrItemPoolNode = NULL; +ITEM_POOL *gpItemPool = NULL; + +void BuildItemPoolList() +{ + ITEM_POOL *temp; + IPListNode *tail; + UINT16 i; + KillItemPoolList(); + for( i = 0; i < WORLD_MAX; i++ ) + { + if( GetItemPool( i, &temp , 0) ) + { + if( !pIPHead ) + { + pIPHead = (IPListNode*)MemAlloc( sizeof( IPListNode ) ); + Assert( pIPHead ); + tail = pIPHead; + } + else + { + tail->next = (IPListNode*)MemAlloc( sizeof( IPListNode ) ); + Assert( tail->next ); + tail = tail->next; + } + ShowItemCursor( i ); + tail->sGridNo = i; + tail->next = NULL; + } + } + gpCurrItemPoolNode = pIPHead; + SpecifyItemToEdit( NULL, -1 ); +} + +void KillItemPoolList() +{ + IPListNode *pIPCurr; + pIPCurr = pIPHead; + while( pIPCurr ) + { + HideItemCursor( pIPCurr->sGridNo ); + pIPHead = pIPHead->next; + MemFree( pIPCurr ); + pIPCurr = pIPHead; + } + pIPHead = NULL; +} + +//Contains global information about the editor items +//May be expanded to encapsulate the entire editor later. +EditorItemsInfo eInfo; + +//Does some precalculations regarding the number of each item type, so that it +//isn't calculated every time a player changes categories. +void EntryInitEditorItemsInfo() +{ + INT32 i; + INVTYPE *item; + eInfo.uiBuffer = 0; + eInfo.fKill = 0; + eInfo.fActive = 0; + eInfo.sWidth = 0; + eInfo.sHeight = 0; + eInfo.sScrollIndex = 0; + eInfo.sSelItemIndex = 0; + eInfo.sHilitedItemIndex = -1; + eInfo.sNumItems = 0; + eInfo.pusItemIndex = NULL; + if( eInfo.fGameInit ) + { //This only gets called one time in game execution. + memset( &eInfo, 0, sizeof( EditorItemsInfo ) ); + eInfo.sHilitedItemIndex = -1; + eInfo.uiItemType = TBAR_MODE_ITEM_WEAPONS; + //Pre-calculate the number of each item type. + eInfo.sNumTriggers = NUMBER_TRIGGERS; + for( i=0; i < MAXITEMS; i++ ) + { + if ( Item[i].usItemClass == 0 ) + break; + item = &Item[i]; + //if( Item[i].fFlags & ITEM_NOT_EDITOR ) + // continue; + if( i == SWITCH || i == ACTION_ITEM ) + { + + } + else switch( item->usItemClass ) + { + case IC_GUN: + case IC_BLADE: + case IC_THROWN: + case IC_LAUNCHER: + case IC_THROWING_KNIFE: + eInfo.sNumWeapons++; + break; + case IC_PUNCH: + if ( i != NOTHING ) + { + eInfo.sNumWeapons++; + } + break; + case IC_AMMO: + eInfo.sNumAmmo++; + break; + case IC_ARMOUR: + eInfo.sNumArmour++; + break; + case IC_GRENADE: + case IC_BOMB: + eInfo.sNumExplosives++; + break; + case IC_MEDKIT: + case IC_KIT: + case IC_FACE: + case IC_MISC: + case IC_MONEY: + if( eInfo.sNumEquipment1 < 30 ) + eInfo.sNumEquipment1++; + else if( eInfo.sNumEquipment2 < 30 ) + eInfo.sNumEquipment2++; + else + eInfo.sNumEquipment3++; + break; + //case IC_KEY: + // eInfo.sNumKeys++; + // break; + } + } + eInfo.sNumKeys = NUM_KEYS; + } +} + +void InitEditorItemsInfo(UINT32 uiItemType) +{ + VSURFACE_DESC vs_desc; + UINT8 *pDestBuf, *pSrcBuf; + UINT32 uiSrcPitchBYTES, uiDestPitchBYTES; + INVTYPE *item; + SGPRect SaveRect, NewRect; + HVOBJECT hVObject; + UINT32 uiVideoObjectIndex; + UINT16 usUselessWidth, usUselessHeight; + INT16 sWidth, sOffset, sStart; + INT16 i, x, y; + UINT16 usCounter; + INT16 pStr[ 100 ];//, pStr2[ 100 ]; + UINT16 pItemName[SIZE_ITEM_NAME]; + UINT8 ubBitDepth; + BOOLEAN fTypeMatch; + INT32 iEquipCount = 0; + + // Check to make sure that there isn't already a valid eInfo + if( eInfo.fActive ) + { + if( eInfo.uiItemType == uiItemType ) + { //User clicked on the same item classification -- ignore + return; + } + else + { //User selected a different item classification -- delete it first. + ClearEditorItemsInfo(); + ClearTaskbarRegion( 100, 360, 480, 440 ); + } + } + else + { + //Clear the menu area, so that the buffer doesn't get corrupted. + ClearTaskbarRegion( 100, 360, 480, 440 ); + } + EnableEditorRegion( ITEM_REGION_ID ); + + eInfo.uiItemType = uiItemType; + eInfo.fActive = TRUE; + //Begin initialization of data. + switch(uiItemType) + { + case TBAR_MODE_ITEM_WEAPONS: + eInfo.sNumItems = eInfo.sNumWeapons; + eInfo.sScrollIndex = eInfo.sSaveWeaponsScrollIndex; + eInfo.sSelItemIndex = eInfo.sSaveSelWeaponsIndex; + break; + case TBAR_MODE_ITEM_AMMO: + eInfo.sNumItems = eInfo.sNumAmmo; + eInfo.sScrollIndex = eInfo.sSaveAmmoScrollIndex; + eInfo.sSelItemIndex = eInfo.sSaveSelAmmoIndex; + break; + case TBAR_MODE_ITEM_ARMOUR: + eInfo.sNumItems = eInfo.sNumArmour; + eInfo.sScrollIndex = eInfo.sSaveArmourScrollIndex; + eInfo.sSelItemIndex = eInfo.sSaveSelArmourIndex; + break; + case TBAR_MODE_ITEM_EXPLOSIVES: + eInfo.sNumItems = eInfo.sNumExplosives; + eInfo.sScrollIndex = eInfo.sSaveExplosivesScrollIndex; + eInfo.sSelItemIndex = eInfo.sSaveSelExplosivesIndex; + break; + case TBAR_MODE_ITEM_EQUIPMENT1: + eInfo.sNumItems = eInfo.sNumEquipment1; + eInfo.sScrollIndex = eInfo.sSaveEquipment1ScrollIndex; + eInfo.sSelItemIndex = eInfo.sSaveSelEquipment1Index; + break; + case TBAR_MODE_ITEM_EQUIPMENT2: + eInfo.sNumItems = eInfo.sNumEquipment2; + eInfo.sScrollIndex = eInfo.sSaveEquipment2ScrollIndex; + eInfo.sSelItemIndex = eInfo.sSaveSelEquipment2Index; + break; + case TBAR_MODE_ITEM_EQUIPMENT3: + eInfo.sNumItems = eInfo.sNumEquipment3; + eInfo.sScrollIndex = eInfo.sSaveEquipment3ScrollIndex; + eInfo.sSelItemIndex = eInfo.sSaveSelEquipment3Index; + break; + case TBAR_MODE_ITEM_TRIGGERS: + eInfo.sNumItems = eInfo.sNumTriggers; + eInfo.sScrollIndex = eInfo.sSaveTriggersScrollIndex; + eInfo.sSelItemIndex = eInfo.sSaveSelTriggersIndex; + break; + case TBAR_MODE_ITEM_KEYS: + eInfo.sNumItems = eInfo.sNumKeys; + eInfo.sScrollIndex = eInfo.sSaveKeysScrollIndex; + eInfo.sSelItemIndex = eInfo.sSaveSelKeysIndex; + break; + default: + //error + return; + } + //Allocate memory to store all the item pointers. + eInfo.pusItemIndex = (UINT16*)MemAlloc( sizeof(UINT16) * eInfo.sNumItems ); + + //Disable the appropriate scroll buttons based on the saved scroll index if applicable + //Left most scroll position + DetermineItemsScrolling(); + //calculate the width of the buffer based on the number of items. + //every pair of items (odd rounded up) requires 60 pixels for width. + //the minimum buffer size is 420. Height is always 80 pixels. + eInfo.sWidth = (eInfo.sNumItems > 12) ? ((eInfo.sNumItems+1)/2)*60 : 360; + eInfo.sHeight = 80; + // Create item buffer + GetCurrentVideoSettings( &usUselessWidth, &usUselessHeight, &ubBitDepth ); + vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; + vs_desc.usWidth = eInfo.sWidth; + vs_desc.usHeight = eInfo.sHeight; + vs_desc.ubBitDepth = ubBitDepth; + + //!!!Memory check. Create the item buffer + if(!AddVideoSurface( &vs_desc, &eInfo.uiBuffer )) + { + eInfo.fKill = TRUE; + eInfo.fActive = FALSE; + return; + } + + pDestBuf = LockVideoSurface(eInfo.uiBuffer, &uiDestPitchBYTES); + pSrcBuf = LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES); + + //copy a blank chunk of the editor interface to the new buffer. + for( i=0; ipETRLEObject[item->ubGraphicNum].usWidth; + sOffset = hVObject->pETRLEObject[item->ubGraphicNum].sOffsetX; + sStart = x + (60 - sWidth - sOffset*2) / 2; + + BltVideoObjectOutlineFromIndex( eInfo.uiBuffer, uiVideoObjectIndex, item->ubGraphicNum, sStart, y+2, 0, FALSE ); + //cycle through the various slot positions (0,0), (0,40), (60,0), (60,40), (120,0)... + if( y == 0 ) + { + y = 40; + } + else + { + y = 0; + x += 60; + } + } + } + else for( i = 0; i < eInfo.sNumItems; i++ ) + { + + fTypeMatch = FALSE; + while( usCounterusItemClass ) + { + case IC_GUN: + case IC_BLADE: + case IC_LAUNCHER: + case IC_THROWN: + case IC_THROWING_KNIFE: + fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_WEAPONS; + break; + case IC_PUNCH: + if ( i != NOTHING ) + { + fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_WEAPONS; + } + else + { + fTypeMatch = FALSE; + } + break; + case IC_AMMO: + fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_AMMO; + break; + case IC_ARMOUR: + fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_ARMOUR; + break; + case IC_GRENADE: + case IC_BOMB: + fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_EXPLOSIVES; + break; + case IC_MEDKIT: + case IC_KIT: + case IC_FACE: + case IC_MISC: + case IC_MONEY: + if( usCounter == ACTION_ITEM || usCounter == SWITCH ) + break; + if( iEquipCount < 30 ) + fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_EQUIPMENT1; + else if( iEquipCount < 60 ) + fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_EQUIPMENT2; + else + fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_EQUIPMENT3; + iEquipCount++; + break; + } + if( fTypeMatch ) + { + + uiVideoObjectIndex = GetInterfaceGraphicForItem( item ); + GetVideoObject( &hVObject, uiVideoObjectIndex ); + + //Store these item pointers for later when rendering selected items. + eInfo.pusItemIndex[i] = usCounter; + + SetFont(SMALLCOMPFONT); + SetFontForeground( FONT_MCOLOR_WHITE ); + SetFontDestBuffer( eInfo.uiBuffer, 0, 0, eInfo.sWidth, eInfo.sHeight, FALSE ); + + + if( eInfo.uiItemType != TBAR_MODE_ITEM_TRIGGERS ) + { + LoadItemInfo( usCounter, pItemName, NULL ); + swprintf( (wchar_t *)pStr, (wchar_t *)L"%s", pItemName ); + } + else + { + if( i == PRESSURE_ACTION_ID ) + { + swprintf( (wchar_t *)pStr, (wchar_t *)L"Pressure Action" ); + } + else if( i < 2 ) + { + if( usCounter == SWITCH ) + swprintf( (wchar_t *)pStr, (wchar_t *)L"Panic Trigger1" ); + else + swprintf( (wchar_t *)pStr, (wchar_t *)L"Panic Action1" ); + } + else if( i < 4 ) + { + if( usCounter == SWITCH ) + swprintf( (wchar_t *)pStr, (wchar_t *)L"Panic Trigger2" ); + else + swprintf( (wchar_t *)pStr, (wchar_t *)L"Panic Action2" ); + } + else if( i < 6 ) + { + if( usCounter == SWITCH ) + swprintf( (wchar_t *)pStr, (wchar_t *)L"Panic Trigger3" ); + else + swprintf( (wchar_t *)pStr, (wchar_t *)L"Panic Action3" ); + } + else + { + if( usCounter == SWITCH ) + swprintf( (wchar_t *)pStr, (wchar_t *)L"Trigger%d", (i-4)/2 ); + else + swprintf( (wchar_t *)pStr, (wchar_t *)L"Action%d", (i-4)/2 ); + } + } + DisplayWrappedString(x, (UINT16)(y+25), 60, 2, SMALLCOMPFONT, FONT_WHITE, (STR16)pStr, FONT_BLACK, TRUE, CENTER_JUSTIFIED ); + + //Calculate the center position of the graphic in a 60 pixel wide area. + sWidth = hVObject->pETRLEObject[item->ubGraphicNum].usWidth; + sOffset = hVObject->pETRLEObject[item->ubGraphicNum].sOffsetX; + sStart = x + (60 - sWidth - sOffset*2) / 2; + + if( sWidth ) + { + BltVideoObjectOutlineFromIndex( eInfo.uiBuffer, uiVideoObjectIndex, item->ubGraphicNum, sStart, y+2, 0, FALSE ); + } + //cycle through the various slot positions (0,0), (0,40), (60,0), (60,40), (120,0)... + if( y == 0 ) + { + y = 40; + } + else + { + y = 0; + x += 60; + } + } + usCounter++; + } + } + SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + SetClippingRect(&SaveRect); + gfRenderTaskbar = TRUE; +} + +void DetermineItemsScrolling() +{ + if( !eInfo.sScrollIndex ) + DisableEditorButton( ITEMS_LEFTSCROLL ); + else + EnableEditorButton( ITEMS_LEFTSCROLL ); + //Right most scroll position. Calculated by taking every pair of numItems rounded up, + //and subtracting 7 (because a scroll index 0 is disabled if there are <=12 items, + //index 1 for <=14 items, index 2 for <=16 items... + if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0 ) ) + DisableEditorButton( ITEMS_RIGHTSCROLL ); + else + EnableEditorButton( ITEMS_RIGHTSCROLL ); +} + +void RenderEditorItemsInfo() +{ + UINT8 *pDestBuf, *pSrcBuf; + UINT32 uiSrcPitchBYTES, uiDestPitchBYTES; + INVTYPE *item; + HVOBJECT hVObject; + UINT32 uiVideoObjectIndex; + INT16 i; + INT16 minIndex, maxIndex; + INT16 sWidth, sOffset, sStart, x, y; + UINT16 usNumItems; + UINT16 usQuantity; + + if(!eInfo.fActive) + { + return; + } + if( gusMouseXPos < 110 || gusMouseXPos > 480 || gusMouseYPos < 360 || gusMouseYPos > 440 ) + { //Mouse has moved out of the items display region -- so nothing can be highlighted. + eInfo.sHilitedItemIndex = -1; + } + pDestBuf = LockVideoSurface(FRAME_BUFFER, &uiDestPitchBYTES); + pSrcBuf = LockVideoSurface(eInfo.uiBuffer, &uiSrcPitchBYTES); + + //copy the items buffer to the editor bar + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 110, 360, 60*eInfo.sScrollIndex, 0, 360, 80 ); + + UnLockVideoSurface(eInfo.uiBuffer); + UnLockVideoSurface(FRAME_BUFFER); + + //calculate the min and max index that is currently shown. This determines + //if the highlighted and/or selected items are drawn with the outlines. + minIndex = eInfo.sScrollIndex * 2; + maxIndex = minIndex + 11; + + //draw the hilighted item if applicable. + if( eInfo.sHilitedItemIndex >= minIndex && eInfo.sHilitedItemIndex <= maxIndex ) + { + if( eInfo.pusItemIndex ) + { + item = &Item[eInfo.pusItemIndex[eInfo.sHilitedItemIndex]]; + uiVideoObjectIndex = GetInterfaceGraphicForItem( item ); + GetVideoObject( &hVObject, uiVideoObjectIndex ); + x = (eInfo.sHilitedItemIndex/2 - eInfo.sScrollIndex)*60 + 110; + y = 360 + (eInfo.sHilitedItemIndex % 2) * 40; + sWidth = hVObject->pETRLEObject[item->ubGraphicNum].usWidth; + sOffset = hVObject->pETRLEObject[item->ubGraphicNum].sOffsetX; + sStart = x + (60 - sWidth - sOffset*2) / 2; + if( sWidth ) + { + BltVideoObjectOutlineFromIndex( FRAME_BUFFER, uiVideoObjectIndex, item->ubGraphicNum, sStart, y+2, Get16BPPColor(FROMRGB(250, 250, 0)), TRUE ); + } + } + } + //draw the selected item + if( eInfo.sSelItemIndex >= minIndex && eInfo.sSelItemIndex <= maxIndex ) + { + if( eInfo.pusItemIndex ) + { + item = &Item[eInfo.pusItemIndex[eInfo.sSelItemIndex]]; + uiVideoObjectIndex = GetInterfaceGraphicForItem( item ); + GetVideoObject( &hVObject, uiVideoObjectIndex ); + x = (eInfo.sSelItemIndex/2 - eInfo.sScrollIndex)*60 + 110; + y = 360 + (eInfo.sSelItemIndex % 2) * 40; + sWidth = hVObject->pETRLEObject[item->ubGraphicNum].usWidth; + sOffset = hVObject->pETRLEObject[item->ubGraphicNum].sOffsetX; + sStart = x + (60 - sWidth - sOffset*2) / 2; + if( sWidth ) + { + BltVideoObjectOutlineFromIndex( FRAME_BUFFER, uiVideoObjectIndex, item->ubGraphicNum, sStart, y+2, Get16BPPColor(FROMRGB(250, 0, 0)), TRUE ); + } + } + } + //draw the numbers of each visible item that currently resides in the world. + maxIndex = min( maxIndex, eInfo.sNumItems-1 ); + for( i = minIndex; i <= maxIndex; i++ ) + { + usNumItems = CountNumberOfEditorPlacementsInWorld( i, &usQuantity ); + if( usNumItems ) + { + x = (i/2 - eInfo.sScrollIndex)*60 + 110; + y = 360 + (i % 2) * 40; + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + SetFontShadow( FONT_NEARBLACK ); + if( usNumItems == usQuantity ) + mprintf( x + 12, y + 4, L"%d", usNumItems ); + else + mprintf( x + 12, y + 4, L"%d(%d)", usNumItems, usQuantity ); + } + } +} + +void ClearEditorItemsInfo() +{ + if( eInfo.uiBuffer ) + { + DeleteVideoSurfaceFromIndex( eInfo.uiBuffer ); + eInfo.uiBuffer = 0; + } + if( eInfo.pusItemIndex ) + { + MemFree( eInfo.pusItemIndex ); + eInfo.pusItemIndex = NULL; + } + DisableEditorRegion( ITEM_REGION_ID ); + eInfo.fKill = 0; + eInfo.fActive = 0; + eInfo.sWidth = 0; + eInfo.sHeight = 0; + eInfo.sNumItems = 0; + //save the highlighted selections + switch( eInfo.uiItemType ) + { + case TBAR_MODE_ITEM_WEAPONS: + eInfo.sSaveSelWeaponsIndex = eInfo.sSelItemIndex; + eInfo.sSaveWeaponsScrollIndex = eInfo.sScrollIndex; + break; + case TBAR_MODE_ITEM_AMMO: + eInfo.sSaveSelAmmoIndex = eInfo.sSelItemIndex; + eInfo.sSaveAmmoScrollIndex = eInfo.sScrollIndex; + break; + case TBAR_MODE_ITEM_ARMOUR: + eInfo.sSaveSelArmourIndex = eInfo.sSelItemIndex; + eInfo.sSaveArmourScrollIndex = eInfo.sScrollIndex; + break; + case TBAR_MODE_ITEM_EXPLOSIVES: + eInfo.sSaveSelExplosivesIndex = eInfo.sSelItemIndex; + eInfo.sSaveExplosivesScrollIndex = eInfo.sScrollIndex; + break; + case TBAR_MODE_ITEM_EQUIPMENT1: + eInfo.sSaveSelEquipment1Index = eInfo.sSelItemIndex; + eInfo.sSaveEquipment1ScrollIndex = eInfo.sScrollIndex; + break; + case TBAR_MODE_ITEM_EQUIPMENT2: + eInfo.sSaveSelEquipment2Index = eInfo.sSelItemIndex; + eInfo.sSaveEquipment2ScrollIndex = eInfo.sScrollIndex; + break; + case TBAR_MODE_ITEM_EQUIPMENT3: + eInfo.sSaveSelEquipment3Index = eInfo.sSelItemIndex; + eInfo.sSaveEquipment3ScrollIndex = eInfo.sScrollIndex; + break; + case TBAR_MODE_ITEM_TRIGGERS: + eInfo.sSaveSelTriggersIndex = eInfo.sSelItemIndex; + eInfo.sSaveTriggersScrollIndex = eInfo.sScrollIndex; + break; + case TBAR_MODE_ITEM_KEYS: + eInfo.sSaveSelKeysIndex = eInfo.sSelItemIndex; + eInfo.sSaveKeysScrollIndex = eInfo.sScrollIndex; + break; + } +} + +void HandleItemsPanel( UINT16 usScreenX, UINT16 usScreenY, INT8 bEvent ) +{ + INT16 sIndex; + UINT16 usQuantity; + //Calc base index from scrolling index + sIndex = eInfo.sScrollIndex * 2; + //Determine if the index is in the first row or second row from mouse YPos. + if( usScreenY >= 400 ) + sIndex++; + //Add the converted mouse's XPos into a relative index; + //Calc: starting from 110, for every 60 pixels, add 2 to the index + sIndex += ((usScreenX-110)/60) * 2; + switch( bEvent ) + { + case GUI_MOVE_EVENT: + if( sIndex < eInfo.sNumItems ) + { + if( eInfo.sHilitedItemIndex != sIndex ) + gfRenderTaskbar = TRUE; + //this index will now highlight in yellow. + eInfo.sHilitedItemIndex = sIndex; + } + break; + case GUI_LCLICK_EVENT: + if( sIndex < eInfo.sNumItems ) + { + //this index will now highlight in red. + if( eInfo.sSelItemIndex != sIndex ) + gfRenderTaskbar = TRUE; + eInfo.sSelItemIndex = sIndex; + if( gfMercGetItem ) + { + gfMercGetItem = FALSE; + gusMercsNewItemIndex = eInfo.pusItemIndex[ eInfo.sSelItemIndex ]; + SetMercEditingMode( MERC_INVENTORYMODE ); + ClearEditorItemsInfo(); + } + } + break; + case GUI_RCLICK_EVENT: + if( gfMercGetItem ) + { + gfMercGetItem = FALSE; + gusMercsNewItemIndex = 0xffff; + SetMercEditingMode( MERC_INVENTORYMODE ); + ClearEditorItemsInfo(); + } + else if( sIndex < eInfo.sNumItems ) + { + eInfo.sSelItemIndex = sIndex; + gfRenderTaskbar = TRUE; + if( CountNumberOfEditorPlacementsInWorld( eInfo.sSelItemIndex, &usQuantity ) ) + { + FindNextItemOfSelectedType(); + } + } + break; + } +} + +void ShowItemCursor( INT32 iMapIndex ) +{ + LEVELNODE *pNode; + pNode = gpWorldLevelData[ iMapIndex ].pTopmostHead; + while( pNode ) + { + if( pNode->usIndex == SELRING ) + return; + pNode = pNode->pNext; + } + AddTopmostToTail( iMapIndex, SELRING1 ); +} + +void HideItemCursor( INT32 iMapIndex ) +{ + RemoveTopmost( iMapIndex, SELRING1 ); +} + +BOOLEAN TriggerAtGridNo( INT16 sGridNo ) +{ + ITEM_POOL *pItemPool; + if( !GetItemPool( sGridNo, &pItemPool, 0 ) ) + { + return FALSE; + } + while( pItemPool ) + { + if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == SWITCH ) + { + return TRUE; + } + pItemPool = pItemPool->pNext; + } + return FALSE; +} + + +void AddSelectedItemToWorld( INT16 sGridNo ) +{ + OBJECTTYPE tempObject; + OBJECTTYPE *pObject; + INVTYPE *pItem; + ITEM_POOL *pItemPool; + INT32 iItemIndex; + INT8 bVisibility = INVISIBLE; + BOOLEAN fFound = FALSE; + IPListNode *pIPCurr, *pIPPrev; + UINT16 usFlags; + + //Extract the currently selected item. + SpecifyItemToEdit( NULL, -1 ); + + //memset( &tempObject, 0, sizeof( OBJECTTYPE ) ); + if( eInfo.uiItemType == TBAR_MODE_ITEM_KEYS ) + { + CreateKeyObject( &tempObject, 1, (UINT8)eInfo.sSelItemIndex ); + } + else + { + CreateItem( eInfo.pusItemIndex[eInfo.sSelItemIndex], 100, &tempObject ); + } + usFlags = 0; + switch( tempObject.usItem ) + { + case MINE: + if ( bVisibility == BURIED ) + { + usFlags |= WORLD_ITEM_ARMED_BOMB; + } + break; + case MONEY: + case SILVER: + case GOLD: + tempObject.bStatus[0] = 100; + tempObject.uiMoneyAmount = 100 + Random( 19901 ); + break; + case OWNERSHIP: + tempObject.ubOwnerProfile = NO_PROFILE; + bVisibility = BURIED; + break; + case SWITCH: + if( TriggerAtGridNo( sGridNo ) ) + { //Restricted to one action per gridno. + return; + } + bVisibility = BURIED; + tempObject.bStatus[0] = 100; + tempObject.ubBombOwner = 1; + if( eInfo.sSelItemIndex < 2 ) + tempObject.bFrequency = PANIC_FREQUENCY; + else if( eInfo.sSelItemIndex < 4 ) + tempObject.bFrequency = PANIC_FREQUENCY_2; + else if( eInfo.sSelItemIndex < 6 ) + tempObject.bFrequency = PANIC_FREQUENCY_3; + else + tempObject.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2); + usFlags |= WORLD_ITEM_ARMED_BOMB; + break; + case ACTION_ITEM: + bVisibility = BURIED; + tempObject.bStatus[0] = 100; + tempObject.ubBombOwner = 1; + tempObject.bTrap = gbDefaultBombTrapLevel; + if( eInfo.sSelItemIndex < PRESSURE_ACTION_ID ) + { + tempObject.bDetonatorType = BOMB_REMOTE; + if( eInfo.sSelItemIndex < 2 ) + tempObject.bFrequency = PANIC_FREQUENCY; + else if( eInfo.sSelItemIndex < 4 ) + tempObject.bFrequency = PANIC_FREQUENCY_2; + else if( eInfo.sSelItemIndex < 6 ) + tempObject.bFrequency = PANIC_FREQUENCY_3; + else + tempObject.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2); + } + else + { + tempObject.bDetonatorType = BOMB_PRESSURE; + tempObject.bDelay = 0; + } + ChangeActionItem( &tempObject, gbActionItemIndex ); + tempObject.fFlags |= OBJECT_ARMED_BOMB; + if( gbActionItemIndex == ACTIONITEM_SMPIT ) + Add3X3Pit( sGridNo ); + else if( gbActionItemIndex == ACTIONITEM_LGPIT ) + Add5X5Pit( sGridNo ); + usFlags |= WORLD_ITEM_ARMED_BOMB; + break; + } + + pObject = InternalAddItemToPool( &sGridNo, &tempObject, bVisibility, 0, usFlags, 0, &iItemIndex ); + if( tempObject.usItem != OWNERSHIP ) + { + gWorldItems[ iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance); + } + else + { + gWorldItems[ iItemIndex ].ubNonExistChance = 0; + } + + pItem = &( Item[ pObject->usItem ] ); + if( pItem->usItemClass == IC_AMMO ) + { + if (Random( 2 )) + { + pObject->ubShotsLeft[0] = Magazine[ pItem->ubClassIndex ].ubMagSize; + } + else + { + pObject->ubShotsLeft[0] = (UINT8) Random( Magazine[ pItem->ubClassIndex ].ubMagSize ); + } + } + else + { + pObject->bStatus[0] = (INT8)(70 + Random( 26 )); + } + if( pItem->usItemClass & IC_GUN ) + { + if ( pObject->usItem == ROCKET_LAUNCHER ) + { + pObject->ubGunShotsLeft = 1; + } + else + { + pObject->ubGunShotsLeft = (UINT8)(Random( Weapon[ pObject->usItem ].ubMagSize )); + } + } + + if( !GetItemPool( sGridNo, &pItemPool, 0 ) ) + Assert( 0 ); + while( pItemPool ) + { + if( &(gWorldItems[ pItemPool->iItemIndex ].o) == pObject ) + { + fFound = TRUE; + //ShowSelectedItem(); + break; + } + pItemPool = pItemPool->pNext; + } + Assert( fFound ); + + gpItemPool = pItemPool; + + SpecifyItemToEdit( pObject, sGridNo ); + + //Get access to the itempool. + //search for a current node in list containing same mapindex + pIPCurr = pIPHead; + pIPPrev = NULL; + while( pIPCurr ) + { + pIPPrev = pIPCurr; + if( pIPCurr->sGridNo == sGridNo ) + { + //found one, so we don't need to add it + gpCurrItemPoolNode = pIPCurr; + return; + } + pIPCurr = pIPCurr->next; + } + //there isn't one, so we will add it now. + ShowItemCursor( sGridNo ); + if( pIPPrev ) + { + pIPPrev->next = (IPListNode*)MemAlloc( sizeof( IPListNode ) ); + Assert( pIPPrev->next ); + pIPPrev = pIPPrev->next; + pIPPrev->next = NULL; + pIPPrev->sGridNo = sGridNo; + gpCurrItemPoolNode = pIPPrev; + } + else + { + pIPHead = (IPListNode*)MemAlloc( sizeof( IPListNode ) ); + Assert( pIPHead ); + pIPHead->next = NULL; + pIPHead->sGridNo = sGridNo; + gpCurrItemPoolNode = pIPHead; + } +} + +void HandleRightClickOnItem( INT16 sGridNo ) +{ + ITEM_POOL *pItemPool; + IPListNode *pIPCurr; + + if( gsItemGridNo == sGridNo ) + { //Clicked on the same gridno as the selected item. Automatically select the next + //item in the same pool. + pItemPool = gpItemPool->pNext; + if( !pItemPool ) + { //currently selected item was last node, so select the head node even if it is the same. + GetItemPool( sGridNo, &pItemPool, 0 ); + } + } + else if( !GetItemPool( sGridNo, &pItemPool, 0 ) ) + { + //possibly relocate selected item to this gridno? + return; + } + + gpItemPool = pItemPool; + + //set up the item pool pointer to point to the same mapindex node + pIPCurr = pIPHead; + gpCurrItemPoolNode = NULL; + while( pIPCurr ) + { + if( pIPCurr->sGridNo == sGridNo ) + { + gpCurrItemPoolNode = pIPCurr; + break; + } + pIPCurr = pIPCurr->next; + } + Assert( gpCurrItemPoolNode ); + SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo ); +} + +extern void DeleteSelectedMercsItem(); + +void DeleteSelectedItem() +{ + SpecifyItemToEdit( NULL, -1 ); + //First, check to see if there even is a currently selected item. + if( iCurrentTaskbar == TASK_MERCS ) + { + DeleteSelectedMercsItem(); + return; + } + if( gpItemPool ) + { //Okay, we have a selected item... + INT16 sGridNo; + //save the mapindex + if( gpItemPool->pNext ) + { + SpecifyItemToEdit( &gWorldItems[ gpItemPool->pNext->iItemIndex ].o, gpItemPool->sGridNo ); + } + sGridNo = gpItemPool->sGridNo; + //remove the item + if( gWorldItems[ gpItemPool->iItemIndex ].o.usItem == ACTION_ITEM ) + { + if( gWorldItems[ gpItemPool->iItemIndex ].o.bActionValue == ACTION_ITEM_SMALL_PIT ) + Remove3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + else if( gWorldItems[ gpItemPool->iItemIndex ].o.bActionValue == ACTION_ITEM_LARGE_PIT ) + Remove5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + } + if( gpEditingItemPool == gpItemPool ) + gpEditingItemPool = NULL; + RemoveItemFromPool( sGridNo, gpItemPool->iItemIndex, 0 ); + gpItemPool = NULL; + //determine if there are still any items at this location + if( !GetItemPool( sGridNo, &gpItemPool , 0 ) ) + { //no items left, so remove the node from the list. + IPListNode *pIPPrev, *pIPCurr; + pIPCurr = pIPHead; + pIPPrev = NULL; + while( pIPCurr ) + { + if( pIPCurr->sGridNo == sGridNo ) + { + if( pIPPrev ) //middle of list + pIPPrev->next = pIPCurr->next; + else //head of list + pIPHead = pIPHead->next; + //move the curr item pool to the next one. + if( pIPCurr->next ) + gpCurrItemPoolNode = pIPCurr->next; + else + gpCurrItemPoolNode = pIPHead; + if( gpCurrItemPoolNode ) + { + GetItemPool( gpCurrItemPoolNode->sGridNo, &gpItemPool, 0 ); + Assert( gpItemPool ); + } + //remove node + HideItemCursor( sGridNo ); + MemFree( pIPCurr ); + pIPCurr = NULL; + return; + } + pIPPrev = pIPCurr; + pIPCurr = pIPCurr->next; + } + } + } +} + +void ShowSelectedItem() +{ + if( gpItemPool ) + { + gpItemPool->bVisible = INVISIBLE; + gWorldItems[ gpItemPool->iItemIndex ].bVisible = INVISIBLE; + } +} + +void HideSelectedItem() +{ + if( gpItemPool ) + { + gpItemPool->bVisible = HIDDEN_ITEM; + gWorldItems[ gpItemPool->iItemIndex ].bVisible = HIDDEN_ITEM; + } +} + +void SelectNextItemPool() +{ + if( !gpCurrItemPoolNode ) + return; +//remove the current hilight. + if( gpItemPool ) + { + MarkMapIndexDirty( gpItemPool->sGridNo ); + } + + //go to the next node. If at end of list, choose pIPHead + if( gpCurrItemPoolNode->next ) + gpCurrItemPoolNode = gpCurrItemPoolNode->next; + else + gpCurrItemPoolNode = pIPHead; + //get the item pool at this node's gridno. + GetItemPool( gpCurrItemPoolNode->sGridNo, &gpItemPool, 0 ); + MarkMapIndexDirty( gpItemPool->sGridNo ); + SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo ); + if( gsItemGridNo != -1 ) + { + CenterScreenAtMapIndex( gsItemGridNo ); + } +} + +void SelectNextItemInPool() +{ + if( gpItemPool ) + { + if( gpItemPool->pNext ) + { + gpItemPool = gpItemPool->pNext; + } + else + { + GetItemPool( gpItemPool->sGridNo, &gpItemPool, 0 ); + } + SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo ); + MarkWorldDirty(); + } +} + +void SelectPrevItemInPool() +{ + if( gpItemPool ) + { + if( gpItemPool->pPrev ) + { + gpItemPool = gpItemPool->pPrev; + } + else + { + GetItemPool( gpItemPool->sGridNo, &gpItemPool, 0 ); + while( gpItemPool->pNext ) + { + gpItemPool = gpItemPool->pNext; + } + } + SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo ); + MarkWorldDirty(); + } +} + + +void FindNextItemOfSelectedType() +{ + UINT16 usItem; + usItem = eInfo.pusItemIndex[ eInfo.sSelItemIndex ]; + if( usItem == ACTION_ITEM || usItem == SWITCH ) + { + if( eInfo.sSelItemIndex < PRESSURE_ACTION_ID ) + { + INT8 bFrequency; + if( eInfo.sSelItemIndex < 2 ) + bFrequency = PANIC_FREQUENCY; + else if( eInfo.sSelItemIndex < 4 ) + bFrequency = PANIC_FREQUENCY_2; + else if( eInfo.sSelItemIndex < 6 ) + bFrequency = PANIC_FREQUENCY_3; + else + bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2); + SelectNextTriggerWithFrequency( usItem, bFrequency ); + } + else + { + SelectNextPressureAction(); + } + } + else if( Item[ usItem ].usItemClass == IC_KEY ) + { + SelectNextKeyOfType( (UINT8)eInfo.sSelItemIndex ); + } + else + { + SelectNextItemOfType( usItem ); + } +} + +void SelectNextItemOfType( UINT16 usItem ) +{ + IPListNode *curr; + OBJECTTYPE *pObject; + if( gpItemPool ) + { + curr = pIPHead; + while( curr ) + { //skip quickly to the same gridno as the item pool + if( curr->sGridNo == gWorldItems[ gpItemPool->iItemIndex ].sGridNo ) + { + gpItemPool = gpItemPool->pNext; + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( pObject->usItem == usItem ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (another item in same itempool) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + break; + } + curr = curr->next; + } + while( curr ) + { //search to the end of the list + GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( pObject->usItem == usItem ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (found another item before reaching the end of the list) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + } + } + curr = pIPHead; + while( curr ) + { //search to the end of the list + GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( pObject->usItem == usItem ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (found first item in the list) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + } +} + +void SelectNextKeyOfType( UINT8 ubKeyID ) +{ + IPListNode *curr; + OBJECTTYPE *pObject; + if( gpItemPool ) + { + curr = pIPHead; + while( curr ) + { //skip quickly to the same gridno as the item pool + if( curr->sGridNo == gWorldItems[ gpItemPool->iItemIndex ].sGridNo ) + { + gpItemPool = gpItemPool->pNext; + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ubKeyID == ubKeyID ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (another item in same itempool) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + break; + } + curr = curr->next; + } + while( curr ) + { //search to the end of the list + GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ubKeyID == ubKeyID ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (found another item before reaching the end of the list) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + } + } + curr = pIPHead; + while( curr ) + { //search to the end of the list + GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ubKeyID == ubKeyID ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (found first item in the list) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + } +} + +void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency ) +{ + IPListNode *curr; + OBJECTTYPE *pObject; + if( gpItemPool ) + { + curr = pIPHead; + while( curr ) + { //skip quickly to the same gridno as the item pool + if( curr->sGridNo == gWorldItems[ gpItemPool->iItemIndex ].sGridNo ) + { + gpItemPool = gpItemPool->pNext; + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( pObject->usItem == usItem && pObject->bFrequency == bFrequency ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (another item in same itempool) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + break; + } + curr = curr->next; + } + while( curr ) + { //search to the end of the list + GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( pObject->usItem == usItem && pObject->bFrequency == bFrequency ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (found another item before reaching the end of the list) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + } + } + curr = pIPHead; + while( curr ) + { //search to the end of the list + GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( pObject->usItem == usItem && pObject->bFrequency == bFrequency ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (found first item in the list) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + } +} + +void SelectNextPressureAction() +{ + IPListNode *curr; + OBJECTTYPE *pObject; + if( gpItemPool ) + { + curr = pIPHead; + while( curr ) + { //skip quickly to the same gridno as the item pool + if( curr->sGridNo == gWorldItems[ gpItemPool->iItemIndex ].sGridNo ) + { + gpItemPool = gpItemPool->pNext; + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( pObject->usItem == ACTION_ITEM && pObject->bDetonatorType == BOMB_PRESSURE ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (another item in same itempool) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + break; + } + curr = curr->next; + } + while( curr ) + { //search to the end of the list + GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( pObject->usItem == ACTION_ITEM && pObject->bDetonatorType == BOMB_PRESSURE ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (found another item before reaching the end of the list) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + } + } + curr = pIPHead; + while( curr ) + { //search to the end of the list + GetItemPool( curr->sGridNo, &gpItemPool, 0 ); + while( gpItemPool ) + { + pObject = &gWorldItems[ gpItemPool->iItemIndex ].o; + if( pObject->usItem == ACTION_ITEM && pObject->bDetonatorType == BOMB_PRESSURE ) + { + SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + CenterScreenAtMapIndex( gsItemGridNo ); + return; //success! (found first item in the list) + } + gpItemPool = gpItemPool->pNext; + } + curr = curr->next; + } +} + +UINT16 CountNumberOfItemPlacementsInWorld( UINT16 usItem, UINT16 *pusQuantity ) +{ + ITEM_POOL *pItemPool; + IPListNode *pIPCurr; + INT16 num = 0; + *pusQuantity = 0; + pIPCurr = pIPHead; + while( pIPCurr ) + { + GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 ); + while( pItemPool ) + { + if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == usItem ) + { + num++; + *pusQuantity += gWorldItems[ pItemPool->iItemIndex ].o.ubNumberOfObjects; + } + pItemPool = pItemPool->pNext; + } + pIPCurr = pIPCurr->next; + } + return num; +} + +UINT16 CountNumberOfItemsWithFrequency( UINT16 usItem, INT8 bFrequency ) +{ + ITEM_POOL *pItemPool; + IPListNode *pIPCurr; + UINT16 num = 0; + pIPCurr = pIPHead; + while( pIPCurr ) + { + GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 ); + while( pItemPool ) + { + if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == usItem && + gWorldItems[ pItemPool->iItemIndex ].o.bFrequency == bFrequency ) + { + num++; + } + pItemPool = pItemPool->pNext; + } + pIPCurr = pIPCurr->next; + } + return num; +} + +UINT16 CountNumberOfPressureActionsInWorld() +{ + ITEM_POOL *pItemPool; + IPListNode *pIPCurr; + UINT16 num = 0; + pIPCurr = pIPHead; + while( pIPCurr ) + { + GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 ); + while( pItemPool ) + { + if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == ACTION_ITEM && + gWorldItems[ pItemPool->iItemIndex ].o.bDetonatorType == BOMB_PRESSURE ) + { + num++; + } + pItemPool = pItemPool->pNext; + } + pIPCurr = pIPCurr->next; + } + return num; +} + +UINT16 CountNumberOfEditorPlacementsInWorld( UINT16 usEInfoIndex, UINT16 *pusQuantity ) +{ + UINT16 usNumPlacements; + if( eInfo.uiItemType == TBAR_MODE_ITEM_TRIGGERS ) + { //find identical items with same frequency + INT8 bFrequency; + if( usEInfoIndex < PRESSURE_ACTION_ID ) + { + if( usEInfoIndex < 2 ) + bFrequency = PANIC_FREQUENCY; + else if( usEInfoIndex < 4 ) + bFrequency = PANIC_FREQUENCY_2; + else if( usEInfoIndex < 6 ) + bFrequency = PANIC_FREQUENCY_3; + else + bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (usEInfoIndex-4) / 2); + usNumPlacements = CountNumberOfItemsWithFrequency( eInfo.pusItemIndex[usEInfoIndex], bFrequency ); + *pusQuantity = usNumPlacements; + } + else + { + usNumPlacements = CountNumberOfPressureActionsInWorld(); + *pusQuantity = usNumPlacements; + } + } + else if( eInfo.uiItemType == TBAR_MODE_ITEM_KEYS ) + { + usNumPlacements = CountNumberOfKeysOfTypeInWorld( (UINT8)usEInfoIndex ); + *pusQuantity = usNumPlacements; + } + else + { + usNumPlacements = CountNumberOfItemPlacementsInWorld( eInfo.pusItemIndex[ usEInfoIndex], pusQuantity ); + } + return usNumPlacements; +} + +UINT16 CountNumberOfKeysOfTypeInWorld( UINT8 ubKeyID ) +{ + ITEM_POOL *pItemPool; + IPListNode *pIPCurr; + INT16 num = 0; + pIPCurr = pIPHead; + while( pIPCurr ) + { + GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 ); + while( pItemPool ) + { + if( Item[ gWorldItems[ pItemPool->iItemIndex ].o.usItem ].usItemClass == IC_KEY ) + { + if( gWorldItems[ pItemPool->iItemIndex ].o.ubKeyID == ubKeyID ) + { + num++; + } + } + pItemPool = pItemPool->pNext; + } + pIPCurr = pIPCurr->next; + } + return num; +} + +void DisplayItemStatistics() +{ + BOOLEAN fUseSelectedItem; + INT16 usItemIndex; + UINT16 pItemName[SIZE_ITEM_NAME]; + INVTYPE *pItem; + + if( !eInfo.fActive ) + { + return; + } + + //If there is nothing else currently highlited by the mouse, use the selected item. + fUseSelectedItem = eInfo.sHilitedItemIndex == -1 || eInfo.sHilitedItemIndex == eInfo.sSelItemIndex; + + SetFont( SMALLCOMPFONT ); + SetFontForeground( (UINT8)(fUseSelectedItem ? FONT_LTRED : FONT_YELLOW) ); + + //Extract all of the item information. + if( !eInfo.pusItemIndex ) + return; + usItemIndex = eInfo.pusItemIndex[ fUseSelectedItem ? eInfo.sSelItemIndex : eInfo.sHilitedItemIndex ]; + pItem = &Item[ usItemIndex ]; + LoadItemInfo( usItemIndex, pItemName, NULL ); + + mprintf( 50 - StringPixLength( pItemName , SMALLCOMPFONT )/2, 403, pItemName ); + mprintf( 2, 410, L"Status Info Line 1"); + mprintf( 2, 420, L"Status Info Line 2"); + mprintf( 2, 430, L"Status Info Line 3"); + mprintf( 2, 440, L"Status Info Line 4"); + mprintf( 2, 450, L"Status Info Line 5"); +} + + + +#endif + + + + + + diff --git a/Editor/EditorItems.h b/Editor/EditorItems.h new file mode 100644 index 00000000..84aa30e8 --- /dev/null +++ b/Editor/EditorItems.h @@ -0,0 +1,69 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDITORITEMS_H +#define __EDITORITEMS_H + +typedef struct{ + BOOLEAN fGameInit; //Used for initializing save variables the first time. + //This flag is initialize at + BOOLEAN fKill; //flagged for deallocation. + BOOLEAN fActive; //currently active + UINT16 *pusItemIndex; //a dynamic array of Item indices + UINT32 uiBuffer; //index of buffer + UINT32 uiItemType; //Weapons, ammo, armour, explosives, equipment + INT16 sWidth, sHeight; //width and height of buffer + INT16 sNumItems; //total number of items in the current class of item. + INT16 sSelItemIndex; //currently selected item index. + INT16 sHilitedItemIndex; + INT16 sScrollIndex; //current scroll index (0 is far left, 1 is next tile to the right, ...) + INT16 sSaveSelWeaponsIndex, sSaveSelAmmoIndex, sSaveSelArmourIndex, sSaveSelExplosivesIndex, + sSaveSelEquipment1Index, sSaveSelEquipment2Index, sSaveSelEquipment3Index, + sSaveSelTriggersIndex, sSaveSelKeysIndex; + INT16 sSaveWeaponsScrollIndex, sSaveAmmoScrollIndex, sSaveArmourScrollIndex, sSaveExplosivesScrollIndex, + sSaveEquipment1ScrollIndex, sSaveEquipment2ScrollIndex, sSaveEquipment3ScrollIndex, + sSaveTriggersScrollIndex, sSaveKeysScrollIndex; + INT16 sNumWeapons, sNumAmmo, sNumArmour, sNumExplosives, sNumEquipment1, sNumEquipment2, sNumEquipment3, + sNumTriggers, sNumKeys; +}EditorItemsInfo; + +extern EditorItemsInfo eInfo; + +void InitEditorItemsToolbar(); +void EntryInitEditorItemsInfo(); +void InitEditorItemsInfo(UINT32 uiItemType); +void RenderEditorItemsInfo(); +void ClearEditorItemsInfo(); +void DisplayItemStatistics(); +void DetermineItemsScrolling(); + +//User actions +void AddSelectedItemToWorld( INT16 sGridNo ); +void HandleRightClickOnItem( INT16 sGridNo ); +void DeleteSelectedItem(); +void ShowSelectedItem(); +void HideSelectedItem(); +void SelectNextItemPool(); +void SelectNextItemInPool(); +void SelectPrevItemInPool(); + +void KillItemPoolList(); +void BuildItemPoolList(); + +void HideItemCursor( INT32 iMapIndex ); +void ShowItemCursor( INT32 iMapIndex ); + +void SetEditorItemsTaskbarMode( UINT16 usNewMode ); + +void HandleItemsPanel( UINT16 usScreenX, UINT16 usScreenY, INT8 bEvent ); + +extern INT32 giDefaultExistChance; + +#endif +#endif + + + + + + diff --git a/Editor/EditorMapInfo.cpp b/Editor/EditorMapInfo.cpp new file mode 100644 index 00000000..668f1297 --- /dev/null +++ b/Editor/EditorMapInfo.cpp @@ -0,0 +1,300 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include + #include "tiledef.h" + #include "edit_sys.h" + #include "vsurface.h" + #include "vobject.h" + #include "mousesystem.h" + #include "Button System.h" + #include "wcheck.h" + #include "vsurface.h" + #include "line.h" + #include "input.h" + #include "sysutil.h" + #include "font.h" + #include "Font Control.h" + #include "editscreen.h" + #include "selectwin.h" + #include "video.h" + #include "vobject_blitters.h" + #include "interface panels.h" + #include "interface items.h" + #include "utilities.h" + #include "World Items.h" + #include "worldman.h" + #include "overhead.h" //GetSoldier + #include "renderworld.h" + #include "Animation Data.h" + #include "Animation Control.h" + #include "lighting.h" + #include "EditorDefines.h" + #include "EditorMercs.h" + #include "EditorTerrain.h" //for access to TerrainTileDrawMode + #include "Soldier Create.h" //The stuff that connects the editor generated information + #include "Soldier Init List.h" + #include "strategicmap.h" + #include "Soldier Add.h" + #include "Soldier Control.h" + #include "Soldier Profile Type.h" + #include "Soldier Profile.h" + #include "Text Input.h" + #include "Random.h" + #include "wordwrap.h" + #include "EditorItems.h" + #include "Editor Taskbar Utils.h" + #include "Exit Grids.h" + #include "Editor Undo.h" + #include "Item Statistics.h" + #include "Map Information.h" + #include "EditorMapInfo.h" + #include "environment.h" + #include "Simple Render Utils.h" +#endif + +INT8 gbDefaultLightType = PRIMETIME_LIGHT; + +SGPPaletteEntry gEditorLightColor; + +BOOLEAN gfEditorForceShadeTableRebuild = FALSE; + +void SetupTextInputForMapInfo() +{ + UINT16 str[10]; + + InitTextInputModeWithScheme( DEFAULT_SCHEME ); + + AddUserInputField( NULL ); //just so we can use short cut keys while not typing. + + //light rgb fields + swprintf( str, L"%d", gEditorLightColor.peRed ); + AddTextInputField( 10, 394, 25, 18, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gEditorLightColor.peGreen ); + AddTextInputField( 10, 414, 25, 18, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gEditorLightColor.peBlue ); + AddTextInputField( 10, 434, 25, 18, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + + swprintf( str, L"%d", gsLightRadius ); + AddTextInputField( 120, 394, 25, 18, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gusLightLevel ); + AddTextInputField( 120, 414, 25, 18, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); + + //Scroll restriction ID + if( !gMapInformation.ubRestrictedScrollID ) + swprintf( str, L"" ); + else + swprintf( str, L"%d", gMapInformation.ubRestrictedScrollID ); + AddTextInputField( 210, 420, 30, 20, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); + + //exit grid input fields + swprintf( str, L"%c%d", gExitGrid.ubGotoSectorY + 'A' - 1, gExitGrid.ubGotoSectorX ); + AddTextInputField( 338, 363, 30, 18, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_EXCLUSIVE_COORDINATE ); + swprintf( str, L"%d", gExitGrid.ubGotoSectorZ ); + AddTextInputField( 338, 383, 30, 18, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gExitGrid.usGridNo ); + AddTextInputField( 338, 403, 40, 18, MSYS_PRIORITY_NORMAL, str, 5, INPUTTYPE_NUMERICSTRICT ); +} + +void UpdateMapInfo() +{ + SetFont( FONT10ARIAL ); + SetFontShadow( FONT_NEARBLACK ); + + SetFontForeground( FONT_RED ); + mprintf( 38, 399, L"R"); + SetFontForeground( FONT_GREEN ); + mprintf( 38, 419, L"G"); + SetFontForeground( FONT_DKBLUE ); + mprintf( 38, 439, L"B"); + + SetFontForeground( FONT_YELLOW ); + mprintf( 65, 369, L"Prime" ); + mprintf( 65, 382, L"Night" ); + mprintf( 65, 397, L"24Hrs" ); + + SetFontForeground( FONT_YELLOW ); + mprintf( 148, 399, L"Radius"); + + if( !gfBasement && !gfCaves ) + SetFontForeground( FONT_DKYELLOW ); + mprintf( 148, 414, L"Underground" ); + mprintf( 148, 423, L"Light Level" ); + + SetFontForeground( FONT_YELLOW ); + mprintf( 230, 369, L"Outdoors" ); + mprintf( 230, 384, L"Basement" ); + mprintf( 230, 399, L"Caves" ); + + SetFontForeground( FONT_ORANGE ); + mprintf( 250, 420, L"Restricted" ); + mprintf( 250, 430, L"Scroll ID" ); + + SetFontForeground( FONT_YELLOW ); + mprintf( 368, 363, L"Destination"); + mprintf( 368, 372, L"Sector" ); + mprintf( 368, 383, L"Destination"); + mprintf( 368, 392, L"Bsmt. Level" ); + mprintf( 378, 403, L"Dest." ); + mprintf( 378, 412, L"GridNo" ); + SetFontForeground( FONT_RED ); +} + +void UpdateMapInfoFields() +{ + UINT16 str[10]; + //Update the text fields to reflect the validated values. + //light rgb fields + swprintf( str, L"%d", gEditorLightColor.peRed ); + SetInputFieldStringWith16BitString( 1, str ); + swprintf( str, L"%d", gEditorLightColor.peGreen ); + SetInputFieldStringWith16BitString( 2, str ); + swprintf( str, L"%d", gEditorLightColor.peBlue ); + SetInputFieldStringWith16BitString( 3, str ); + + swprintf( str, L"%d", gsLightRadius ); + SetInputFieldStringWith16BitString( 4, str ); + swprintf( str, L"%d", gusLightLevel ); + SetInputFieldStringWith16BitString( 5, str ); + + if( !gMapInformation.ubRestrictedScrollID ) + swprintf( str, L"" ); + else + swprintf( str, L"%d", gMapInformation.ubRestrictedScrollID ); + SetInputFieldStringWith16BitString( 6, str ); + + ApplyNewExitGridValuesToTextFields(); +} + +void ExtractAndUpdateMapInfo() +{ + UINT16 str[10]; + INT32 temp; + BOOLEAN fUpdateLight1 = FALSE; + //extract light1 colors + temp = min( GetNumericStrictValueFromField( 1 ), 255 ); + if( temp != -1 && temp != gEditorLightColor.peRed ) + { + fUpdateLight1 = TRUE; + gEditorLightColor.peRed = (UINT8)temp; + } + temp = min( GetNumericStrictValueFromField( 2 ), 255 ); + if( temp != -1 && temp != gEditorLightColor.peGreen ) + { + fUpdateLight1 = TRUE; + gEditorLightColor.peGreen = (UINT8)temp; + } + temp = min( GetNumericStrictValueFromField( 3 ), 255 ); + if( temp != -1 && temp != gEditorLightColor.peBlue ) + { + fUpdateLight1 = TRUE; + gEditorLightColor.peBlue = (UINT8)temp; + } + if( fUpdateLight1 ) + { + gfEditorForceShadeTableRebuild = TRUE; + LightSetColors( &gEditorLightColor, 1 ); + gfEditorForceShadeTableRebuild = FALSE; + } + + //extract radius + temp = max( min( GetNumericStrictValueFromField( 4 ), 8 ), 1 ); + if( temp != -1 ) + gsLightRadius = (INT16)temp; + temp = max( min( GetNumericStrictValueFromField( 5 ), 15 ), 1 ); + if( temp != -1 && temp != gusLightLevel ) + { + gusLightLevel = (UINT16)temp; + gfRenderWorld = TRUE; + ubAmbientLightLevel = (UINT8)(EDITOR_LIGHT_MAX - gusLightLevel); + LightSetBaseLevel( ubAmbientLightLevel ); + LightSpriteRenderAll(); + } + + temp = (INT8)GetNumericStrictValueFromField( 6 ); + if( temp == -1 ) + gMapInformation.ubRestrictedScrollID = 0; + else + gMapInformation.ubRestrictedScrollID = (UINT8)temp; + + //set up fields for exitgrid information + Get16BitStringFromField( 7, str ); + if( str[0] >= 'a' && str[0] <= 'z' ) + str[0] -= 32; //uppercase it! + if( str[0] >= 'A' && str[0] <= 'Z' && + str[1] >= '0' && str[1] <= '9' ) + { //only update, if coordinate is valid. + gExitGrid.ubGotoSectorY = (UINT8)(str[0] - 'A' + 1); + gExitGrid.ubGotoSectorX = (UINT8)(str[1] - '0'); + if( str[2] >= '0' && str[2] <= '9' ) + gExitGrid.ubGotoSectorX = (UINT8)(gExitGrid.ubGotoSectorX * 10 + str[2] - '0' ); + gExitGrid.ubGotoSectorX = (UINT8)max( min( gExitGrid.ubGotoSectorX, 16 ), 1 ); + gExitGrid.ubGotoSectorY = (UINT8)max( min( gExitGrid.ubGotoSectorY, 16 ), 1 ); + } + gExitGrid.ubGotoSectorZ = (UINT8)max( min( GetNumericStrictValueFromField( 8 ), 3 ), 0 ); + gExitGrid.usGridNo = (UINT16)max( min( GetNumericStrictValueFromField( 9 ), 25600 ), 0 ); + + UpdateMapInfoFields(); +} + +BOOLEAN ApplyNewExitGridValuesToTextFields() +{ + UINT16 str[10]; + //exit grid input fields + if( iCurrentTaskbar != TASK_MAPINFO ) + return FALSE; + swprintf( str, L"%c%d", gExitGrid.ubGotoSectorY + 'A' - 1, gExitGrid.ubGotoSectorX ); + SetInputFieldStringWith16BitString( 7, str ); + swprintf( str, L"%d", gExitGrid.ubGotoSectorZ ); + SetInputFieldStringWith16BitString( 8, str ); + swprintf( str, L"%d", gExitGrid.usGridNo ); + SetInputFieldStringWith16BitString( 9, str ); + SetActiveField( 0 ); + return TRUE; +} + +UINT16 usCurrentExitGridNo = 0; +void LocateNextExitGrid() +{ + EXITGRID ExitGrid; + UINT16 i; + for( i = usCurrentExitGridNo + 1; i < WORLD_MAX; i++ ) + { + if( GetExitGrid( i, &ExitGrid ) ) + { + usCurrentExitGridNo = i; + CenterScreenAtMapIndex( i ); + return; + } + } + for( i = 0; i < usCurrentExitGridNo; i++ ) + { + if( GetExitGrid( i, &ExitGrid ) ) + { + usCurrentExitGridNo = i; + CenterScreenAtMapIndex( i ); + return; + } + } +} + +void ChangeLightDefault( INT8 bLightType ) +{ + UnclickEditorButton( MAPINFO_PRIMETIME_LIGHT + gbDefaultLightType ); + gbDefaultLightType = bLightType; + ClickEditorButton( MAPINFO_PRIMETIME_LIGHT + gbDefaultLightType ); +} + +#endif + + + + + + diff --git a/Editor/EditorMapInfo.h b/Editor/EditorMapInfo.h new file mode 100644 index 00000000..56180b01 --- /dev/null +++ b/Editor/EditorMapInfo.h @@ -0,0 +1,35 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDITORMAPINFO_H +#define __EDITORMAPINFO_H + +void SetupTextInputForMapInfo(); +void UpdateMapInfo(); +void ExtractAndUpdateMapInfo(); +BOOLEAN ApplyNewExitGridValuesToTextFields(); +void UpdateMapInfoFields(); + +extern SGPPaletteEntry gEditorLightColor; + +extern BOOLEAN gfEditorForceShadeTableRebuild; + +void LocateNextExitGrid(); + +enum +{ + PRIMETIME_LIGHT, + NIGHTTIME_LIGHT, + ALWAYSON_LIGHT +}; +void ChangeLightDefault( INT8 bLightType ); +extern INT8 gbDefaultLightType; + +#endif +#endif + + + + + + diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp new file mode 100644 index 00000000..1183359e --- /dev/null +++ b/Editor/EditorMercs.cpp @@ -0,0 +1,3743 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include + #include "tiledef.h" + #include "edit_sys.h" + #include "vsurface.h" + #include "vobject.h" + #include "mousesystem.h" + #include "Button System.h" + #include "wcheck.h" + #include "vsurface.h" + #include "line.h" + #include "input.h" + #include "sysutil.h" + #include "font.h" + #include "Font Control.h" + #include "editscreen.h" + #include "selectwin.h" + #include "video.h" + #include "vobject_blitters.h" + #include "interface panels.h" + #include "interface items.h" + #include "text.h" + #include "utilities.h" + #include "World Items.h" + #include "worldman.h" + #include "overhead.h" //GetSoldier + #include "renderworld.h" + #include "Animation Data.h" + #include "Animation Control.h" + #include "EditorDefines.h" + #include "EditorMercs.h" + #include "EditorTerrain.h" //for access to TerrainTileDrawMode + #include "Soldier Create.h" //The stuff that connects the editor generated information + //to the saved map and the game itself. + #include "Inventory Choosing.h" + #include "Soldier Init List.h" + #include "strategicmap.h" + #include "Soldier Add.h" + #include "Soldier Control.h" + #include "Soldier Profile Type.h" + #include "Soldier Profile.h" + #include "Text Input.h" + #include "Random.h" + #include "wordwrap.h" + #include "EditorItems.h" + #include "Editor Taskbar Utils.h" + #include "Exit Grids.h" + #include "Editor Undo.h" + #include "Item Statistics.h" + #include "Simple Render Utils.h" + #include "Map Information.h" + #include "Isometric Utils.h" + #include "Render Dirty.h" + #include "popupmenu.h" + #include "Scheduling.h" + #include "Timer Control.h" +#endif + +extern void GetSoldierAboveGuyPositions( SOLDIERTYPE *pSoldier, INT16 *psX, INT16 *psY, BOOLEAN fRadio ); + +//-------------------------------------------------- +// NON_CIV_GROUP, +// REBEL_CIV_GROUP, +// KINGPIN_CIV_GROUP, +// SANMONA_ARMS_GROUP, +// ANGELS_GROUP, +// NUM_CIV_GROUPS +UINT16 gszCivGroupNames[ NUM_CIV_GROUPS ][ 20 ] = +{ + L"NONE", + L"REBEL", + L"KINGPIN", + L"SANMONA ARMS", + L"ANGELS", + + L"BEGGARS", + L"TOURISTS", + L"ALMA MIL", + L"DOCTORS", + L"COUPLE1", + + L"HICKS", + L"WARDEN", + L"JUNKYARD", + L"FACTORY KIDS", + L"QUEENS", + L"UNUSED15", + L"UNUSED16", + L"UNUSED17", + L"UNUSED18", + L"UNUSED19", +}; + +//-------------------------------------------------- + +// SCHEDULE_ACTION_NONE, +// SCHEDULE_ACTION_LOCKDOOR, +// SCHEDULE_ACTION_UNLOCKDOOR, +// SCHEDULE_ACTION_OPENDOOR, +// SCHEDULE_ACTION_CLOSEDOOR, +// SCHEDULE_ACTION_GRIDNO, +// SCHEDULE_ACTION_LEAVESECTOR, +// SCHEDULE_ACTION_ENTERSECTOR, +// SCHEDULE_ACTION_STAYINSECTOR, +// SCHEDULE_ACTION_SLEEP, +UINT16 gszScheduleActions[ NUM_SCHEDULE_ACTIONS ][20] = +{ + L"No action", + L"Lock door", + L"Unlock door", + L"Open door", + L"Close door", + L"Move to gridno", + L"Leave sector", + L"Enter sector", + L"Stay in sector", + L"Sleep", + L"Ignore this!" +}; + + +enum +{ + SCHEDULE_INSTRUCTIONS_NONE, + SCHEDULE_INSTRUCTIONS_DOOR1, + SCHEDULE_INSTRUCTIONS_DOOR2, + SCHEDULE_INSTRUCTIONS_GRIDNO, + SCHEDULE_INSTRUCTIONS_SLEEP, + NUM_SCHEDULE_INSTRUCTIONS +}; + +extern BOOLEAN gfSingleAction = FALSE; +BOOLEAN gfUseScheduleData2 = FALSE; +UINT8 gubCurrentScheduleActionIndex = 0; +SCHEDULENODE gCurrSchedule; +UINT8 gubScheduleInstructions = SCHEDULE_INSTRUCTIONS_NONE; +void DetermineScheduleEditability(); +void RenderCurrentSchedule(); +void UpdateScheduleInfo(); + +void ShowEditMercPalettes( SOLDIERTYPE *pSoldier ); +void ShowEditMercColorSet( UINT8 ubPaletteRep, INT16 sSet ); + +void ChangeBaseSoldierStats( SOLDIERTYPE *pSoldier ); +void AskDefaultDifficulty( void ); + +//internal merc inventory functions +void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ); +void RenderMercInventoryPanel(); +void SetDroppableCheckboxesBasedOnMercsInventory(); + +extern BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ); + +//array which keeps track of which item is in which slot. This is dependant on the selected merc, so +//these temp values must be updated when different mercs are selected, and reset when a merc detailed +//placement is created. +OBJECTTYPE *gpMercSlotItem[9] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; +//Because we only support these nine slots, they aren't continuous values, so this array helps +//processing functions by referring to this array to get the appropriate slot. +INT8 gbMercSlotTypes[9] = { HELMETPOS, VESTPOS, LEGPOS, HANDPOS, SECONDHANDPOS, + BIGPOCK1POS, BIGPOCK2POS, BIGPOCK3POS, BIGPOCK4POS }; +//returns the usItem index of specified slot in the currently selected merc. +#define GetSelectedMercSlotItemIndex( x ) (gpSelected->pDetailedPlacement->Inv[gbMercSlotTypes[x]].usItem) +#define GetSelectedMercSlot( x ) (&gpSelected->pDetailedPlacement->Inv[gbMercSlotTypes[x]]) +//values indicating which merc inventory slot is hilited and which slot is selected. +INT8 gbCurrHilite = -1; +INT8 gbCurrSelect = -1; +//when a new merc is selected, this function sets up all of the information for the slots, +//selections, and hilites. +void UpdateMercItemSlots(); + +//internal merc utility functions +void SetupTextInputForMercAttributes(); +void SetupTextInputForMercProfile(); +void SetupTextInputForMercSchedule(); +void ExtractAndUpdateMercAttributes(); +void ExtractAndUpdateMercProfile(); +void ExtractAndUpdateMercSchedule(); +void CalcStringForValue( UINT16 *str, INT32 iValue, UINT32 uiMax ); +void ChangeBodyType( INT8 bOffset ); //+1 or -1 only + +//internal merc variables +BASIC_SOLDIERCREATE_STRUCT gTempBasicPlacement; +SOLDIERCREATE_STRUCT gTempDetailedPlacement; + +INT16 gsSelectedMercID; +INT16 gsSelectedMercGridNo; +SOLDIERINITNODE *gpSelected; + +UINT8 gubCurrMercMode = MERC_TEAMMODE; +UINT8 gubPrevMercMode = MERC_NOMODE; +UINT8 gubLastDetailedMercMode = MERC_GENERALMODE; +INT8 gbDefaultOrders = STATIONARY; +INT8 gbDefaultAttitude = DEFENSIVE; +INT8 gbDefaultRelativeEquipmentLevel = 2; +INT8 gbDefaultRelativeAttributeLevel = 2; +INT8 gbDefaultDirection = NORTHWEST; +INT8 gubSoldierClass = SOLDIER_CLASS_ARMY; +UINT8 gubCivGroup = NON_CIV_GROUP; + +SOLDIERTYPE *pTempSoldier; +BOOLEAN gfRoofPlacement; + +//Below are all flags that have to do with editing detailed placement mercs: + +//Determines if the user is allowed to edit merc colors. User must specifically +//click on the checkbox by the colors to confirm that colors will be specified. If +//not, the colors will be randomly generated upon creation in the game. +BOOLEAN gfCanEditMercColors = FALSE; +//A rendering flag that is set whenever a full update of the merc editing information +//needs to be done. +BOOLEAN gfRenderMercInfo = FALSE; +//When the user specifies a profile index for the merc, all editing is disabled. This is +//because the profile contains all of the information. When this happens, all of the editing +//buttons are disabled, but you are allowed to view stats, inventory, etc., as well as specify +//orders, attitude, and direction. +BOOLEAN gfCanEditMercs = TRUE; +//When in inventory mode, this flag is set when the user wishes to get an item, which requires hooking +//into the item editing features. This is processed during the editor update, which in turn, sets the +//new mode. +BOOLEAN gfMercGetItem = FALSE; +//As soon as an item is selected, the items index is stored here, so the item can be copied into the +//slot for editing and rendering purposes. This is a temp store value only when leaving the editor items +//mode. +UINT16 gusMercsNewItemIndex = 0xffff; + +//old and probably obsolete +//BOOLEAN fMercEdUseLeftSide = FALSE; +//BOOLEAN fEditingMerc = FALSE; +//BOOLEAN fKeepWindowHidden = FALSE; +INT32 iEditMercPage = 1; +INT32 iEditMercEnd = -1; +INT32 iEditMercBkgrndArea = -1; +INT32 iEditMercLocation; +INT32 iEditStatTimer = 0; +INT32 iEditWhichStat = -1; +INT32 iEditMercMode = EDIT_MERC_NONE; +INT32 iEditMercColorPage = -1; +INT32 iEditMercStatPage = -1; +INT32 iEditMercFindButton = -1; +INT32 iEditMercSlotNumber; +INT32 iEditColorStart[EDIT_NUM_COLORS]; + +BOOLEAN gfShowPlayers = TRUE; +BOOLEAN gfShowEnemies = TRUE; +BOOLEAN gfShowCreatures = TRUE; +BOOLEAN gfShowRebels = TRUE; +BOOLEAN gfShowCivilians = TRUE; + +#define BASE_STAT_DEVIATION 7 +#define BASE_EXPLVL_DEVIATION 1 +#define BASE_PROTLVL_DEVIATION 0 +#define BASE_GUNTYPE_DEVIATION 4 +#define DEFAULT_DIFF 2 + +INT16 sCurBaseDiff = DEFAULT_DIFF; +BOOLEAN fAskForBaseDifficulty = TRUE; +UINT16 *zDiffNames[NUM_DIFF_LVLS] = { L"Wimp", L"Easy", L"Average", L"Tough", L"Steroid Users Only" }; +INT16 sBaseStat[NUM_DIFF_LVLS] = { 50, 60, 70, 80, 90 }; +INT16 sBaseExpLvl[NUM_DIFF_LVLS] = { 1, 3, 5, 7, 9 }; + +UINT16 *EditMercStat[12] = { L"Max Health",L"Cur Health",L"Strength", + L"Agility",L"Dexterity",L"Charisma", + L"Wisdom",L"Marksmanship",L"Explosives", + L"Medical",L"Scientific",L"Exp Level" }; + +#define NUM_MERC_ORDERS 8 +UINT16 *EditMercOrders[8] = { L"Stationary",L"On Guard",L"Close Patrol", + L"Far Patrol",L"Point Patrol",L"On Call", + L"Seek Enemy", L"Random Point Patrol"}; + +UINT16 *EditMercAttitudes[6] = { L"Defensive",L"Brave Loner",L"Brave Buddy", + L"Cunning Loner",L"Cunning Buddy", + L"Aggressive" }; + +//information for bodytypes. +#ifdef RANDOM + #undef RANDOM +#endif +#define RANDOM -1 +#define MAX_ENEMYTYPES 7 +//#define MAX_ENEMYRANDOMTYPES 5 +#define MAX_CREATURETYPES 8 +#define MAX_REBELTYPES 7 +#define MAX_CIVTYPES 18 +//#define MAX_CIVRANDOMTYPES 11 +INT8 bEnemyArray[MAX_ENEMYTYPES]={ RANDOM, REGMALE, BIGMALE, STOCKYMALE, REGFEMALE, TANK_NW, TANK_NE }; +INT8 bCreatureArray[MAX_CREATURETYPES]={ BLOODCAT, LARVAE_MONSTER, INFANT_MONSTER, YAF_MONSTER, YAM_MONSTER, ADULTFEMALEMONSTER, AM_MONSTER, QUEENMONSTER }; +INT8 bRebelArray[MAX_REBELTYPES]={ RANDOM, FATCIV, MANCIV, REGMALE, BIGMALE, STOCKYMALE, REGFEMALE }; +INT8 bCivArray[MAX_CIVTYPES]={ RANDOM, FATCIV, MANCIV, MINICIV, DRESSCIV, HATKIDCIV, KIDCIV, REGMALE, BIGMALE, STOCKYMALE, REGFEMALE, + HUMVEE, ELDORADO, ICECREAMTRUCK, JEEP, CRIPPLECIV, ROBOTNOWEAPON, COW }; +INT8 gbCurrCreature = BLOODCAT; + + + +BOOLEAN gfSaveBuffer = FALSE; +extern BASIC_SOLDIERCREATE_STRUCT gSaveBufferBasicPlacement; +extern SOLDIERCREATE_STRUCT gSaveBufferDetailedPlacement; +//void CopyMercPlacement(); // moved to header (jonathanl) +//void PasteMercPlacement(); // moved to header (jonathanl) + +void GameInitEditorMercsInfo() +{ + INT32 i; + //Initialize the placement list + InitSoldierInitList(); + gMapInformation.ubNumIndividuals = 0; + memset( &gCurrSchedule, 0, sizeof( SCHEDULENODE ) ); + for( i = 0; i < 4; i++ ) + { + gCurrSchedule.usTime[i] = 0xffff; + gCurrSchedule.usData1[i] = 0xffff; + gCurrSchedule.usData2[i] = 0xffff; + } +} + +void GameShutdownEditorMercsInfo() +{ + UseEditorAlternateList(); + KillSoldierInitList(); + UseEditorOriginalList(); + KillSoldierInitList(); +} + +void EntryInitEditorMercsInfo() +{ + INT32 x, iCurStart = 0; + iEditColorStart[0] = 0; + for ( x = 1; x < EDIT_NUM_COLORS; x++ ) + { + iCurStart += gubpNumReplacementsPerRange[ x - 1 ]; + iEditColorStart[x] = iCurStart; + } + gsSelectedMercID = -1; + gsSelectedMercGridNo = 0; + + gfCanEditMercs = TRUE; +} + +enum +{ + HAIR_PAL, + SKIN_PAL, + VEST_PAL, + PANTS_PAL +}; + +void ProcessMercEditing() +{ + UINT8 ubType, ubPaletteRep; + SOLDIERTYPE *pSoldier; + if ( iEditMercMode == EDIT_MERC_NONE ) + { + return; + } + GetSoldier( &pSoldier, gsSelectedMercID ); + + switch ( iEditMercMode ) + { + case EDIT_MERC_PREV_COLOR: + case EDIT_MERC_NEXT_COLOR: + // Handle changes to the merc colors + switch ( iEditWhichStat ) + { + case 0: + ubType = EDIT_COLOR_HEAD; + GetPaletteRepIndexFromID( pSoldier->HeadPal, &ubPaletteRep ); + + ubPaletteRep--; + if ( (ubPaletteRep < (UINT8)iEditColorStart[ubType]) || (ubPaletteRep > ((UINT8)iEditColorStart[ubType] + gubpNumReplacementsPerRange[ubType])) ) + ubPaletteRep = (UINT8)iEditColorStart[ubType] + gubpNumReplacementsPerRange[ubType] - 1; + + SET_PALETTEREP_ID( pSoldier->HeadPal, gpPalRep[ ubPaletteRep ].ID ); + sprintf( gpSelected->pDetailedPlacement->HeadPal, pSoldier->HeadPal ); + CreateSoldierPalettes( pSoldier ); + break; + case 1: + ubType = EDIT_COLOR_HEAD; + GetPaletteRepIndexFromID( pSoldier->HeadPal, &ubPaletteRep ); + + ubPaletteRep++; + if ( ubPaletteRep >= ((UINT8)iEditColorStart[ubType] + gubpNumReplacementsPerRange[ubType]) ) + ubPaletteRep = (UINT8)iEditColorStart[ubType]; + + SET_PALETTEREP_ID( pSoldier->HeadPal, gpPalRep[ ubPaletteRep ].ID ); + sprintf( gpSelected->pDetailedPlacement->HeadPal, pSoldier->HeadPal ); + CreateSoldierPalettes( pSoldier ); + break; + + case 2: + ubType = EDIT_COLOR_SKIN; + GetPaletteRepIndexFromID( pSoldier->SkinPal, &ubPaletteRep ); + + ubPaletteRep--; + if ( ubPaletteRep < (UINT8)iEditColorStart[ubType] ) + ubPaletteRep = (UINT8)iEditColorStart[ubType] + gubpNumReplacementsPerRange[ubType] - 1; + + SET_PALETTEREP_ID( pSoldier->SkinPal, gpPalRep[ ubPaletteRep ].ID ); + sprintf( gpSelected->pDetailedPlacement->SkinPal, pSoldier->SkinPal ); + CreateSoldierPalettes( pSoldier ); + break; + case 3: + ubType = EDIT_COLOR_SKIN; + GetPaletteRepIndexFromID( pSoldier->SkinPal, &ubPaletteRep ); + + ubPaletteRep++; + if ( ubPaletteRep >= ((UINT8)iEditColorStart[ubType] + gubpNumReplacementsPerRange[ubType]) ) + ubPaletteRep = (UINT8)iEditColorStart[ubType]; + + SET_PALETTEREP_ID( pSoldier->SkinPal, gpPalRep[ ubPaletteRep ].ID ); + sprintf( gpSelected->pDetailedPlacement->SkinPal, pSoldier->SkinPal ); + CreateSoldierPalettes( pSoldier ); + break; + + case 4: + ubType = EDIT_COLOR_VEST; + GetPaletteRepIndexFromID( pSoldier->VestPal, &ubPaletteRep ); + + ubPaletteRep--; + if ( ubPaletteRep < (UINT8)iEditColorStart[ubType] ) + ubPaletteRep = (UINT8)iEditColorStart[ubType] + gubpNumReplacementsPerRange[ubType] - 1; + + SET_PALETTEREP_ID( pSoldier->VestPal, gpPalRep[ ubPaletteRep ].ID ); + sprintf( gpSelected->pDetailedPlacement->VestPal, pSoldier->VestPal ); + CreateSoldierPalettes( pSoldier ); + break; + case 5: + ubType = EDIT_COLOR_VEST; + GetPaletteRepIndexFromID( pSoldier->VestPal, &ubPaletteRep ); + + ubPaletteRep++; + if ( ubPaletteRep >= ((UINT8)iEditColorStart[ubType] + gubpNumReplacementsPerRange[ubType]) ) + ubPaletteRep = (UINT8)iEditColorStart[ubType]; + + SET_PALETTEREP_ID( pSoldier->VestPal, gpPalRep[ ubPaletteRep ].ID ); + sprintf( gpSelected->pDetailedPlacement->VestPal, pSoldier->VestPal ); + CreateSoldierPalettes( pSoldier ); + break; + + case 6: + ubType = EDIT_COLOR_PANTS; + GetPaletteRepIndexFromID( pSoldier->PantsPal, &ubPaletteRep ); + + ubPaletteRep--; + if ( ubPaletteRep < (UINT8)iEditColorStart[ubType] ) + ubPaletteRep = (UINT8)iEditColorStart[ubType] + gubpNumReplacementsPerRange[ubType] - 1; + + SET_PALETTEREP_ID( pSoldier->PantsPal, gpPalRep[ ubPaletteRep ].ID ); + sprintf( gpSelected->pDetailedPlacement->PantsPal, pSoldier->PantsPal ); + CreateSoldierPalettes( pSoldier ); + break; + case 7: + ubType = EDIT_COLOR_PANTS; + GetPaletteRepIndexFromID( pSoldier->PantsPal, &ubPaletteRep ); + + ubPaletteRep++; + if ( ubPaletteRep >= ((UINT8)iEditColorStart[ubType] + gubpNumReplacementsPerRange[ubType]) ) + ubPaletteRep = (UINT8)iEditColorStart[ubType]; + + SET_PALETTEREP_ID( pSoldier->PantsPal, gpPalRep[ ubPaletteRep ].ID ); + sprintf( gpSelected->pDetailedPlacement->PantsPal, pSoldier->PantsPal ); + CreateSoldierPalettes( pSoldier ); + break; + } + iEditMercMode = EDIT_MERC_NONE; + break; + } +} + +void AddMercToWorld( INT32 iMapIndex ) +{ + SOLDIERTYPE *pSoldier; + INT32 i; + + memset( &gTempBasicPlacement, 0, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); + + gTempBasicPlacement.bBodyType = -1; + + //calculate specific information based on the team. + switch( iDrawMode ) + { + case DRAW_MODE_ENEMY: + gTempBasicPlacement.bTeam = ENEMY_TEAM; + gTempBasicPlacement.bBodyType = RANDOM; + gTempBasicPlacement.ubSoldierClass = gubSoldierClass; + break; + case DRAW_MODE_CREATURE: + gTempBasicPlacement.bTeam = CREATURE_TEAM; + gTempBasicPlacement.bBodyType = gbCurrCreature; + break; + case DRAW_MODE_REBEL: + gTempBasicPlacement.bTeam = MILITIA_TEAM; + gTempBasicPlacement.bBodyType = RANDOM; + break; + case DRAW_MODE_CIVILIAN: + gTempBasicPlacement.bTeam = CIV_TEAM; + gTempBasicPlacement.bBodyType = RANDOM; + gTempBasicPlacement.ubCivilianGroup = gubCivGroup; + if( giCurrentTilesetID == 1 ) //caves + { + gTempBasicPlacement.ubSoldierClass = SOLDIER_CLASS_MINER; + } + break; + } + + if( IsLocationSittable( iMapIndex, gfRoofPlacement ) ) + { + UINT8 ubID; + INT16 sSectorX, sSectorY; + SOLDIERINITNODE *pNode; + + GetCurrentWorldSector( &sSectorX, &sSectorY ); + + //Set up some general information. + gTempBasicPlacement.fDetailedPlacement = FALSE; + gTempBasicPlacement.fPriorityExistance = FALSE; + gTempBasicPlacement.usStartingGridNo = (UINT16)iMapIndex; + gTempBasicPlacement.bOrders = gbDefaultOrders; + gTempBasicPlacement.bAttitude = gbDefaultAttitude; + gTempBasicPlacement.bRelativeAttributeLevel = gbDefaultRelativeAttributeLevel; + gTempBasicPlacement.bRelativeEquipmentLevel = gbDefaultRelativeEquipmentLevel; + gTempBasicPlacement.bDirection = gbDefaultDirection; + + //Generate detailed placement information given the temp placement information. + CreateDetailedPlacementGivenBasicPlacementInfo( &gTempDetailedPlacement, &gTempBasicPlacement ); + + //Set the sector information -- probably unnecessary. + gTempDetailedPlacement.sSectorX = sSectorX; + gTempDetailedPlacement.sSectorY = sSectorY; + + //Create the soldier, but don't place it yet. + if ( pSoldier = TacticalCreateSoldier( &gTempDetailedPlacement, &ubID ) ) + { + pSoldier->bVisible = 1; + pSoldier->bLastRenderVisibleValue = 1; + //Set up the soldier in the list, so we can track the soldier in the + //future (saving, loading, strategic AI) + pNode = AddBasicPlacementToSoldierInitList( &gTempBasicPlacement ); + Assert( pNode ); + pNode->pSoldier = pSoldier; + + //Add the soldier to physically appear on the map now. + InternalAddSoldierToSector( ubID, FALSE, FALSE, 0, 0 ); + IndicateSelectedMerc( ubID ); + + //Move him to the roof if intended and possible. + if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) ) + { + gpSelected->pBasicPlacement->fOnRoof = TRUE; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->fOnRoof = TRUE; + SetSoldierHeight( gpSelected->pSoldier, 58.0 ); + } + UnclickEditorButtons( FIRST_MERCS_INVENTORY_BUTTON, LAST_MERCS_INVENTORY_BUTTON ); + for( i = FIRST_MERCS_INVENTORY_BUTTON; i <= LAST_MERCS_INVENTORY_BUTTON; i++ ) + { + SetEnemyDroppableStatus( gbMercSlotTypes[i-FIRST_MERCS_INVENTORY_BUTTON], FALSE ); + } + } + } +} + +void HandleRightClickOnMerc( INT32 iMapIndex ) +{ + SOLDIERINITNODE *pNode; + INT16 sThisMercID; + INT16 sCellX, sCellY; + + ConvertGridNoToCellXY( (INT16)iMapIndex, &sCellX, &sCellY ); + + sThisMercID = (INT16)IsMercHere( iMapIndex ); + + if ( sThisMercID != -1) + { + if ( gsSelectedMercID != sThisMercID ) + { // We want to edit a new merc (or different merc) + //We need to avoid the editing of player mercs. + pNode = FindSoldierInitNodeWithID( (UINT8)sThisMercID ); + if( !pNode ) + return; //this is a player merc (which isn't in the list), or an error in logic. + IndicateSelectedMerc( sThisMercID ); + } + } + else if( gsSelectedMercID != -1 && IsLocationSittable( iMapIndex, gfRoofPlacement ) )// We want to move the selected merc to this new location. + { + RemoveAllObjectsOfTypeRange( gsSelectedMercGridNo, CONFIRMMOVE, CONFIRMMOVE ); + EVENT_SetSoldierPosition( gpSelected->pSoldier, (FLOAT)(sCellX + 5), (FLOAT)(sCellY + 5) ); + if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) ) + { + gpSelected->pBasicPlacement->fOnRoof = TRUE; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->fOnRoof = TRUE; + SetSoldierHeight( gpSelected->pSoldier, 58.0 ); + } + else + { + gpSelected->pBasicPlacement->fOnRoof = FALSE; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->fOnRoof = FALSE; + SetSoldierHeight( gpSelected->pSoldier, 0.0 ); + } + gsSelectedMercGridNo = (INT16)iMapIndex; + gpSelected->pBasicPlacement->usStartingGridNo = gsSelectedMercGridNo; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->sInsertionGridNo = gsSelectedMercGridNo; + AddObjectToHead( gsSelectedMercGridNo, CONFIRMMOVE1 ); + } +} + +void ResetAllMercPositions() +{ + SOLDIERINITNODE *curr; + //Remove all of the alternate placements (editor takes precedence) + UseEditorAlternateList(); + curr = gSoldierInitHead; + while( curr ) + { + gpSelected = curr; + curr = curr->next; + RemoveSoldierNodeFromInitList( gpSelected ); + } + //Now, remove any existing original list mercs, then readd them. + UseEditorOriginalList(); + curr = gSoldierInitHead; + while( curr ) + { + if( curr->pSoldier ) + { + TacticalRemoveSoldier( curr->pSoldier->ubID ); + curr->pSoldier = NULL; + } + //usMapIndex = gpSelected->pBasicPlacement->usStartingGridNo; + //ConvertGridNoToCellXY( usMapIndex, &sCellX, &sCellY ); + //if( gpSelected->pSoldier ) + //{ + // EVENT_SetSoldierPosition( gpSelected->pSoldier, (FLOAT)(sCellX + 5), (FLOAT)(sCellY + 5) ); + // if( gpSelected->pBasicPlacement->fOnRoof ) + // SetSoldierHeight( gpSelected->pSoldier, 58.0 ); + // SetMercDirection( gpSelected->pBasicPlacement->bDirection ); + //} + curr = curr->next; + } + AddSoldierInitListTeamToWorld( ENEMY_TEAM, 255 ); + AddSoldierInitListTeamToWorld( CREATURE_TEAM, 255 ); + AddSoldierInitListTeamToWorld( MILITIA_TEAM, 255 ); + AddSoldierInitListTeamToWorld( CIV_TEAM, 255 ); + gpSelected = NULL; + gsSelectedMercID = -1; +} + +void AddMercWaypoint( UINT32 iMapIndex ) +{ + INT32 iNum; + // index 0 isn't used + if ( iActionParam == 0 ) + return; + + if ( gsSelectedMercID == -1 || (gsSelectedMercID <= (INT32)gTacticalStatus.Team[ OUR_TEAM ].bLastID) || gsSelectedMercID >= MAXMERCS ) + return; + + if ( iActionParam > gpSelected->pSoldier->bPatrolCnt ) + { + // Fill up missing waypoints with same value as new one + for(iNum = gpSelected->pSoldier->bPatrolCnt + 1; iNum <= iActionParam; iNum++) + { + gpSelected->pBasicPlacement->sPatrolGrid[iNum] = (INT16)iMapIndex; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->sPatrolGrid[iNum] = (INT16)iMapIndex; + gpSelected->pSoldier->usPatrolGrid[iNum] = (UINT16)iMapIndex; + } + + gpSelected->pBasicPlacement->bPatrolCnt = (INT8)iActionParam; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->bPatrolCnt = (INT8)iActionParam; + gpSelected->pSoldier->bPatrolCnt = (INT8) iActionParam; + gpSelected->pSoldier->bNextPatrolPnt = 1; + } + else + { + // Set this way point + gpSelected->pBasicPlacement->sPatrolGrid[iActionParam] = (INT16)iMapIndex; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->sPatrolGrid[iActionParam] = (INT16)iMapIndex; + gpSelected->pSoldier->usPatrolGrid[iActionParam] = (UINT16)iMapIndex; + } + gfRenderWorld = TRUE; +} + +void EraseMercWaypoint() +{ + INT32 iNum; + // index 0 isn't used + if ( iActionParam == 0 ) + return; + + if ( gsSelectedMercID == -1 || (gsSelectedMercID <= (INT32)gTacticalStatus.Team[ OUR_TEAM ].bLastID) || gsSelectedMercID >= MAXMERCS ) + return; + + // Fill up missing areas + if ( iActionParam > gpSelected->pSoldier->bPatrolCnt ) + return; + + for(iNum = iActionParam; iNum < gpSelected->pSoldier->bPatrolCnt; iNum++) + { + gpSelected->pBasicPlacement->sPatrolGrid[iNum] = gpSelected->pBasicPlacement->sPatrolGrid[iNum+1]; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->sPatrolGrid[iNum] = gpSelected->pDetailedPlacement->sPatrolGrid[iNum+1]; + gpSelected->pSoldier->usPatrolGrid[iNum] = gpSelected->pSoldier->usPatrolGrid[iNum+1]; + } + + gpSelected->pBasicPlacement->bPatrolCnt--; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->bPatrolCnt--; + gpSelected->pSoldier->bPatrolCnt--; + gfRenderWorld = TRUE; +} + + +//---------------------------------------------------------------------------------------------- +// ChangeBaseSoldierStats +// +// This functions changes the stats of a given merc (PC or NPC, though should only be used +// for NPC mercs) to reflect the base difficulty level selected. +// +void ChangeBaseSoldierStats( SOLDIERTYPE *pSoldier ) +{ + if ( pSoldier == NULL ) + return; + + pSoldier->bLifeMax = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->bLife = pSoldier->bLifeMax; + + pSoldier->bBleeding = 0; + pSoldier->bBreath = 100; + + pSoldier->bMarksmanship = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->bMedical = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->bMechanical = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->bExplosive = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->bAgility = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->bDexterity = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + + pSoldier->bStrength = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->bLeadership = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->bWisdom = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + pSoldier->bScientific = (UINT8)(sBaseStat[sCurBaseDiff] + (UINT16)(Random(BASE_STAT_DEVIATION * 2)-BASE_STAT_DEVIATION)); + + pSoldier->bExpLevel = (UINT8)sBaseExpLvl[sCurBaseDiff]; + pSoldier->bGunType = (INT8)Random(BASE_GUNTYPE_DEVIATION); + + pSoldier->bActionPoints = CalcActionPoints( pSoldier ); +} + + +//---------------------------------------------------------------------------------------------- +// DisplayEditMercWindow +// +// Displays the edit merc stat page while editing mercs. If the merc color editing page is +// to be displayed, this function will dispatch it instead. +// +void DisplayEditMercWindow( void ) +{ + INT32 iXPos, iYPos, iHeight, iWidth; + UINT16 usFillColorBack, usFillColorDark, usFillColorLight, usFillColorTextBk; + INT32 x, iXOff; + INT16 TempString[30]; + SOLDIERTYPE *pSoldier; + INT8 iEditStat[12]; + + usFillColorBack = 0; + + if ( gsSelectedMercID == -1 ) + { +// fEditingMerc = FALSE; +// DestroyEditMercWindow(); + return; + } + + + GetSoldier( &pSoldier, (INT16)gsSelectedMercID ); + +// usFillColorBack = GenericButtonFillColors[0]; + usFillColorDark = Get16BPPColor(FROMRGB(24, 61, 81)); + usFillColorLight = Get16BPPColor(FROMRGB(136, 138, 135)); + usFillColorTextBk = Get16BPPColor(FROMRGB(250, 240, 188)); + + iWidth = 266; + iHeight = 360; + iYPos = 0; + iXPos = 0; + + + // Main window + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos, iYPos, iXPos + iWidth, iYPos + iHeight, usFillColorLight ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 1, iYPos + 1, iXPos + iWidth, iYPos + iHeight, usFillColorDark ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 1, iYPos + 1, iXPos + iWidth - 1, iYPos + iHeight - 1, usFillColorBack ); + + SetFont( FONT12POINT1 ); + + // Name window + gprintf( iXPos + 128, iYPos + 3, L"Merc Name:" ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 128, iYPos + 16, iXPos + 128 + 104, iYPos + 16 + 19, usFillColorDark ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 17, iXPos + 128 + 104, iYPos + 17 + 19, usFillColorLight ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 17, iXPos + 128 + 103, iYPos + 17 + 18, usFillColorTextBk ); + iXOff = (105 - StringPixLength( pSoldier->name, FONT12POINT1 )) / 2; + gprintf( iXPos + 130 + iXOff, iYPos + 20, L"%s", pSoldier->name ); + + // Orders window + gprintf( iXPos + 128, iYPos + 38, L"Orders:" ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 128, iYPos + 51, iXPos + 128 + 104, iYPos + 51 + 19, usFillColorDark ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 52, iXPos + 128 + 104, iYPos + 52 + 19, usFillColorLight ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 52, iXPos + 128 + 103, iYPos + 52 + 18, usFillColorTextBk ); + iXOff = (105 - StringPixLength( EditMercOrders[pSoldier->bOrders], FONT12POINT1 )) / 2; + gprintf( iXPos + 130 + iXOff, iYPos + 55, L"%s", EditMercOrders[pSoldier->bOrders] ); + + // Combat window + gprintf( iXPos + 128, iYPos + 73, L"Combat Attitude:" ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 128, iYPos + 86, iXPos + 128 + 104, iYPos + 86 + 19, usFillColorDark ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 87, iXPos + 128 + 104, iYPos + 87 + 19, usFillColorLight ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 129, iYPos + 87, iXPos + 128 + 103, iYPos + 87 + 18, usFillColorTextBk ); + iXOff = (105 - StringPixLength( EditMercAttitudes[pSoldier->bAttitude], FONT12POINT1 )) / 2; + gprintf( iXPos + 130 + iXOff, iYPos + 90, L"%s", EditMercAttitudes[pSoldier->bAttitude] ); + + // Get stats + iEditStat[0] = pSoldier->bLifeMax; // 12 13 + iEditStat[1] = pSoldier->bLife; // 14 15 + iEditStat[2] = pSoldier->bStrength; // 16 17 + iEditStat[3] = pSoldier->bAgility; // 18 19 + iEditStat[4] = pSoldier->bDexterity; // 20 21 + iEditStat[5] = pSoldier->bLeadership; // 22 23 + iEditStat[6] = pSoldier->bWisdom; // 24 25 + iEditStat[7] = pSoldier->bMarksmanship; // 26 27 + iEditStat[8] = pSoldier->bExplosive; // 28 29 + iEditStat[9] = pSoldier->bMedical; // 30 31 + iEditStat[10] = pSoldier->bScientific; // 32 33 + iEditStat[11] = pSoldier->bExpLevel; // 34 35 + + // Stat value windows + for ( x = 0; x < 12; x++ ) + { + gprintf( iXPos + 6, iYPos + 114 + (20 * x), L"%s", EditMercStat[x] ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 116, iYPos + 110 + (20 * x), iXPos + 116 + 30, iYPos + 110 + (20 * x) + 19, usFillColorDark ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 117, iYPos + 111 + (20 * x), iXPos + 116 + 30, iYPos + 111 + (20 * x) + 19, usFillColorLight ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iXPos + 117, iYPos + 111 + (20 * x), iXPos + 116 + 29, iYPos + 111 + (20 * x) + 18, usFillColorTextBk ); + + swprintf( (wchar_t *)TempString, (wchar_t *)L"%d", iEditStat[x] ); + iXOff = (30 - StringPixLength( TempString, FONT12POINT1 )) / 2; + gprintf( iXPos + 118 + iXOff, iYPos + 114 + (20 * x), L"%s", TempString ); + } + +} + + + +//---------------------------------------------------------------------------------------------- +// IsMercHere +// +// Checks for a soldier at the given map coordinates. If there is one, it returns it's ID number, +// otherwise it returns -1. +// +INT32 IsMercHere( INT32 iMapIndex ) +{ + INT32 IDNumber; + INT32 RetIDNumber; + SOLDIERTYPE *pSoldier; + BOOLEAN fSoldierFound; + + RetIDNumber = -1; + fSoldierFound = FALSE; + for ( IDNumber = 0; IDNumber < MAX_NUM_SOLDIERS && !fSoldierFound; IDNumber++ ) + { + if ( GetSoldier( &pSoldier, (INT16)IDNumber ) ) + { + if ( pSoldier->sGridNo == (INT16)iMapIndex ) + { + fSoldierFound = TRUE; + RetIDNumber = IDNumber; + } + } + } + + return( RetIDNumber ); +} + + +//---------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------- +// The following are the button callback functions for the merc editing pages +//---------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------- + +void EditMercChangeToStatsPageCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_TO_STATS; + } +} + + +void EditMercChangeToColorPageCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_TO_COLOR; + } +} + +void EditMercDoneEditCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_DONE; + } +} + + +void EditMercBkgrndCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_DONE; + } +} + + +void EditMercPrevOrderCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_PREV_ORDER; + } +} + + +void EditMercNextOrderCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_NEXT_ORDER; + } +} + +void EditMercPrevAttCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_PREV_ATT; + } +} + +void EditMercNextAttCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_NEXT_ATT; + } +} + +void EditMercStatUpCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT32 iBtn; + + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditWhichStat = -1; + for ( iBtn = 0; iBtn < 36 && iEditWhichStat == -1; iBtn++ ) + { + if ( btn->IDNum == iEditorButton[iBtn] ) + iEditWhichStat = iBtn; + } + + if ( iEditWhichStat != -1 ) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_INC_STAT; + } + + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_NONE; + btn->uiFlags &= (~BUTTON_CLICKED_ON); + } +} + +void EditMercStatDwnCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT32 iBtn; + + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditWhichStat = -1; + for ( iBtn = 0; iBtn < 36 && iEditWhichStat == -1; iBtn++ ) + { + if ( btn->IDNum == iEditorButton[iBtn] ) + iEditWhichStat = iBtn; + } + + if ( iEditWhichStat != -1 ) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_DEC_STAT; + } + + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_NONE; + btn->uiFlags &= (~BUTTON_CLICKED_ON); + } +} + + +void EditMercSetDirCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT32 iBtn; + + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditWhichStat = -1; + for ( iBtn = 0; iBtn < 36 && iEditWhichStat == -1; iBtn++ ) + { + if ( btn->IDNum == iEditorButton[iBtn] ) + iEditWhichStat = iBtn; + } + + if ( iEditWhichStat != -1 ) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_SET_DIR; + } + + btn->uiFlags |= BUTTON_CLICKED_ON; + } +} + + +void EditMercCenterCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_FIND; + + btn->uiFlags |= BUTTON_CLICKED_ON; + } +} + + +void EditMercColorDwnCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT32 iBtn; + + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditWhichStat = -1; + for ( iBtn = 0; iBtn < 8 && iEditWhichStat == -1; iBtn++ ) + { + if ( btn->IDNum == iEditorButton[iBtn] ) + iEditWhichStat = iBtn; + } + + if ( iEditWhichStat != -1 ) + { + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_PREV_COLOR; + } + + btn->uiFlags |= BUTTON_CLICKED_ON; + } +} + +void MercsToggleColorModeCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) //button is checked + { + EnableEditorButtons( FIRST_MERCS_COLOR_BUTTON, LAST_MERCS_COLOR_BUTTON ); + gpSelected->pDetailedPlacement->fVisible = TRUE; + sprintf( gpSelected->pDetailedPlacement->HeadPal, gpSelected->pSoldier->HeadPal ); + sprintf( gpSelected->pDetailedPlacement->SkinPal, gpSelected->pSoldier->SkinPal ); + sprintf( gpSelected->pDetailedPlacement->VestPal, gpSelected->pSoldier->VestPal ); + sprintf( gpSelected->pDetailedPlacement->PantsPal, gpSelected->pSoldier->PantsPal ); + } + else //button is unchecked. + { + DisableEditorButtons( FIRST_MERCS_COLOR_BUTTON, LAST_MERCS_COLOR_BUTTON ); + gpSelected->pDetailedPlacement->fVisible = FALSE; + } + gfRenderMercInfo = TRUE; + gfRenderTaskbar = TRUE; + } +} + +void MercsSetColorsCallback( GUI_BUTTON *btn, INT32 reason ) +{ + INT32 iBtn; + if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iEditWhichStat = -1; + for ( iBtn = FIRST_MERCS_COLOR_BUTTON; iBtn <= LAST_MERCS_COLOR_BUTTON; iBtn++ ) + { + if ( btn->IDNum == iEditorButton[iBtn] ) + { + iEditWhichStat = iBtn - FIRST_MERCS_COLOR_BUTTON; + iEditStatTimer = 0; + iEditMercMode = EDIT_MERC_NEXT_COLOR; + gfRenderMercInfo = TRUE; + return; + } + } + } +} + +void MercsSetBodyTypeCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfRenderMercInfo = TRUE; + if( btn->IDNum == iEditorButton[ MERCS_BODYTYPE_DOWN ] ) + ChangeBodyType( 1 ); //next + else + ChangeBodyType( -1 ); //previous + } +} + +void EditMercDecDifficultyCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + + iEditorToolbarState = TBAR_MODE_DEC_DIFF; + } +} + + +void EditMercIncDifficultyCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + + iEditorToolbarState = TBAR_MODE_INC_DIFF; + } +} + + + + + +//---------------------------------------------------------------------------------------------- +// ShowEditMercPalettes +// +// Displays the palette of the given merc (used by the edit merc color page) +// +void ShowEditMercPalettes( SOLDIERTYPE *pSoldier ) +{ + UINT8 ubPaletteRep; + if( !pSoldier ) + ubPaletteRep = 0xff; + + if( pSoldier ) + { + if( !strlen( pSoldier->HeadPal ) ) + ubPaletteRep = 0xff; + else + GetPaletteRepIndexFromID( pSoldier->HeadPal, &ubPaletteRep ); + } + ShowEditMercColorSet( ubPaletteRep, 0 ); + + if( pSoldier ) + { + if( !strlen( pSoldier->SkinPal ) ) + ubPaletteRep = 0xff; + else + GetPaletteRepIndexFromID( pSoldier->SkinPal, &ubPaletteRep ); + } + ShowEditMercColorSet( ubPaletteRep, 1 ); + + if( pSoldier ) + { + if( !strlen( pSoldier->VestPal ) ) + ubPaletteRep = 0xff; + else + GetPaletteRepIndexFromID( pSoldier->VestPal, &ubPaletteRep ); + } + ShowEditMercColorSet( ubPaletteRep, 2 ); + + if( pSoldier ) + { + if( !strlen( pSoldier->VestPal ) ) + ubPaletteRep = 0xff; + else + GetPaletteRepIndexFromID( pSoldier->PantsPal, &ubPaletteRep ); + } + ShowEditMercColorSet( ubPaletteRep, 3 ); +} + + +//---------------------------------------------------------------------------------------------- +// ShowEditMercColorSet +// +// Displays a single palette set. (used by ShowEditMercPalettes) +// +void ShowEditMercColorSet( UINT8 ubPaletteRep, INT16 sSet ) +{ + UINT16 us16BPPColor, usFillColorDark, usFillColorLight; + UINT8 cnt1; + UINT8 ubSize; + INT16 sUnitSize; + INT16 sLeft, sTop, sRight, sBottom; + + if( ubPaletteRep == 0xff ) + ubSize = 16; + else + ubSize = gpPalRep[ ubPaletteRep ].ubPaletteSize; + + sUnitSize = 128 / (INT16)(ubSize); + + sTop = 364 + (sSet * 24); + sBottom = sTop + 20; + sLeft = 230; + sRight = 359; + + usFillColorDark = Get16BPPColor(FROMRGB(24, 61, 81)); + usFillColorLight = Get16BPPColor(FROMRGB(136, 138, 135)); + + // Draw color bar window area + ColorFillVideoSurfaceArea(FRAME_BUFFER, sLeft, sTop, sRight, sBottom, usFillColorDark ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, sLeft + 1, sTop + 1, sRight, sBottom, usFillColorLight ); + InvalidateRegion( sLeft, sTop, sRight, sBottom ); + + sTop++; + sBottom--; + sLeft++; + sRight = sLeft + sUnitSize; + + // Draw the color bar + for ( cnt1 = 0; cnt1 < ubSize; cnt1++ ) + { + if (cnt1 == (ubSize - 1) ) + sRight = 358; + if( ubPaletteRep == 0xff ) + us16BPPColor = Get16BPPColor( FROMRGB( (16 - cnt1)*10, (16 - cnt1)*10, (16 - cnt1)*10 ) ); + else + us16BPPColor = Get16BPPColor( FROMRGB( gpPalRep[ ubPaletteRep ].r[ cnt1 ], gpPalRep[ ubPaletteRep ].g[ cnt1 ], gpPalRep[ ubPaletteRep ].b[ cnt1 ] ) ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, sLeft, sTop, sRight, sBottom, us16BPPColor ); + + sLeft += sUnitSize; + sRight += sUnitSize; + } +} + + +//---------------------------------------------------------------------------------------------- +// DisplayWayPoints +// +// Displays the way points of the currently selected merc. +// +void DisplayWayPoints(void) +{ + INT16 sX,sY; + INT16 sXMapPos,sYMapPos; + INT16 sScreenX,sScreenY; + FLOAT ScrnX,ScrnY,dOffsetX,dOffsetY; + INT8 bPoint; + SOLDIERTYPE *pSoldier; + INT16 sGridNo; + + + if ( gsSelectedMercID == -1 || (gsSelectedMercID <= (INT32)gTacticalStatus.Team[ OUR_TEAM ].bLastID) || gsSelectedMercID >= MAXMERCS ) + return; + + GetSoldier( &pSoldier, (UINT16)gsSelectedMercID ); + if ( pSoldier == NULL || !pSoldier->bActive) + return; + + // point 0 is not used! + for ( bPoint = 1; bPoint <= pSoldier->bPatrolCnt; bPoint++ ) + { + // Get the next point + sGridNo = (INT16)pSoldier->usPatrolGrid[bPoint]; + + // Can we see it? + if ( !GridNoOnVisibleWorldTile( sGridNo ) ) + continue; + + if((sGridNo < 0) || (sGridNo > WORLD_MAX)) + continue; + + // Convert it's location to screen coordinates + ConvertGridNoToXY( sGridNo, &sXMapPos, &sYMapPos ); + + dOffsetX = (FLOAT)(sXMapPos * CELL_X_SIZE) - gsRenderCenterX; + dOffsetY = (FLOAT)(sYMapPos * CELL_Y_SIZE) - gsRenderCenterY; + + FloatFromCellToScreenCoordinates( dOffsetX, dOffsetY, &ScrnX, &ScrnY); + + sScreenX = ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ) + (INT16)ScrnX; + sScreenY = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) + (INT16)ScrnY; + + // Adjust for tiles height factor! + sScreenY -= gpWorldLevelData[sGridNo].sHeight; + // Bring it down a touch + sScreenY += 5; + + if( sScreenY <= 355 ) + { + // Shown it on screen! + SetFont(TINYFONT1); + if( pSoldier->bLevel == 1 ) + { + SetFontBackground( FONT_LTBLUE ); + sScreenY -= 68; + } + else + SetFontBackground( FONT_LTRED ); + SetFontForeground( FONT_WHITE ); + VarFindFontCenterCoordinates( sScreenX, sScreenY, 1, 1, TINYFONT1, &sX, &sY, L"%d", bPoint ); + mprintf(sX,sY,L"%d",bPoint); + } + } +} + + +void CreateEditMercWindow( void ) +{ + INT32 iXPos, iYPos, iHeight, iWidth; + INT32 x; + SOLDIERTYPE *pSoldier; + + iWidth = 266; + iHeight = 360; + iYPos = 0; + iXPos = 0; + + + GetSoldier( &pSoldier, (INT16)gsSelectedMercID ); + iEditMercLocation = (INT32)pSoldier->sGridNo; + gpWorldLevelData[ iEditMercLocation ].pObjectHead->ubShadeLevel = DEFAULT_SHADE_LEVEL; + + iEditMercBkgrndArea = CreateHotSpot((INT16)iXPos, (INT16)iYPos, (INT16)iWidth, (INT16)iHeight, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, EditMercBkgrndCallback ); + + iEditMercColorPage = CreateTextButton( L"Merc Colors", (INT16)FONT12POINT1, FONT_BLACK, FONT_BLACK, + BUTTON_USE_DEFAULT, (INT16)(iXPos + 183), (INT16)(iYPos + 315), 80, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercChangeToColorPageCallback ); + iEditMercEnd = CreateTextButton( L"Done", (INT16)FONT12POINT1, FONT_MCOLOR_BLACK, FONT_BLACK, + BUTTON_USE_DEFAULT, (INT16)(iXPos + 183), (INT16)(iYPos + 337), 80, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercDoneEditCallback ); + + // Disable color editing for PC Mercs + if ( (UINT16)gsSelectedMercID >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && (UINT16)gsSelectedMercID <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) + DisableButton( iEditMercColorPage ); + + iEditorButton[8] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 98), (INT16)(iYPos + 51), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercPrevOrderCallback ); + iEditorButton[9] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 233), (INT16)(iYPos + 51), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercNextOrderCallback ); + SetButtonFastHelpText( iEditorButton[8], L"Previous merc standing orders" ); + SetButtonFastHelpText( iEditorButton[9], L"Next merc standing orders" ); + + iEditorButton[10] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 98), (INT16)(iYPos + 86), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercPrevAttCallback ); + iEditorButton[11] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 233), (INT16)(iYPos + 86), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercNextAttCallback ); + SetButtonFastHelpText( iEditorButton[10], L"Previous merc combat attitude" ); + SetButtonFastHelpText( iEditorButton[11], L"Next merc combat attitude" ); + + iEditorButton[12] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 110), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[13] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 110), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[14] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 130), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[15] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 130), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[16] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 150), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[17] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 150), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[18] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 170), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[19] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 170), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[20] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 190), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[21] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 190), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[22] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 210), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[23] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 210), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[24] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 230), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[25] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 230), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[26] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 250), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[27] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 250), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[28] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 270), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[29] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 270), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[30] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 290), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[31] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 290), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[32] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 310), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[33] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 310), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + iEditorButton[34] = QuickCreateButton( giEditMercImage[0], (INT16)(iXPos + 86), (INT16)(iYPos + 330), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatDwnCallback ); + iEditorButton[35] = QuickCreateButton( giEditMercImage[1], (INT16)(iXPos + 146), (INT16)(iYPos + 330), BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, EditMercStatUpCallback ); + + for ( x = 12; x < 36; x += 2 ) + { + SetButtonFastHelpText( iEditorButton[x], L"Decrease merc stat" ); + SetButtonFastHelpText( iEditorButton[x + 1], L"Increase merc stat" ); + } +} +void SetMercOrders( INT8 bOrders ) +{ + gpSelected->pSoldier->bOrders = bOrders; + gpSelected->pBasicPlacement->bOrders = bOrders; + UnclickEditorButtons( FIRST_MERCS_ORDERS_BUTTON, LAST_MERCS_ORDERS_BUTTON ); + ClickEditorButton( FIRST_MERCS_ORDERS_BUTTON + bOrders ); + gbDefaultOrders = bOrders; +} + +void SetMercAttitude( INT8 bAttitude ) +{ + gpSelected->pSoldier->bAttitude = bAttitude; + gpSelected->pBasicPlacement->bAttitude = bAttitude; + UnclickEditorButtons( FIRST_MERCS_ATTITUDE_BUTTON, LAST_MERCS_ATTITUDE_BUTTON ); + ClickEditorButton( FIRST_MERCS_ATTITUDE_BUTTON + bAttitude ); + gbDefaultAttitude = bAttitude; +} + +void SetMercDirection( INT8 bDirection ) +{ + UnclickEditorButtons( FIRST_MERCS_DIRECTION_BUTTON, LAST_MERCS_DIRECTION_BUTTON ); + ClickEditorButton( FIRST_MERCS_DIRECTION_BUTTON + bDirection ); + + gbDefaultDirection = bDirection; + gpSelected->pBasicPlacement->bDirection = bDirection; + + // ATE: Changed these to call functions.... + EVENT_SetSoldierDirection( gpSelected->pSoldier, bDirection ); + EVENT_SetSoldierDesiredDirection( gpSelected->pSoldier, bDirection ); + + ConvertAniCodeToAniFrame( gpSelected->pSoldier, 0 ); +} + +void SetMercRelativeEquipment( INT8 bLevel ) +{ + gpSelected->pBasicPlacement->bRelativeEquipmentLevel = bLevel; + + UnclickEditorButtons( FIRST_MERCS_REL_EQUIPMENT_BUTTON, LAST_MERCS_REL_EQUIPMENT_BUTTON ); + ClickEditorButton( FIRST_MERCS_REL_EQUIPMENT_BUTTON + bLevel ); + gbDefaultRelativeEquipmentLevel = bLevel; +} + +void SetMercRelativeAttributes( INT8 bLevel ) +{ + gpSelected->pBasicPlacement->bRelativeAttributeLevel = bLevel; + //We also have to modify the existing soldier incase the user wishes to enter game. + ModifySoldierAttributesWithNewRelativeLevel( gpSelected->pSoldier, bLevel ); + + UnclickEditorButtons( FIRST_MERCS_REL_ATTRIBUTE_BUTTON, LAST_MERCS_REL_ATTRIBUTE_BUTTON ); + ClickEditorButton( FIRST_MERCS_REL_ATTRIBUTE_BUTTON + bLevel ); + gbDefaultRelativeAttributeLevel = bLevel; +} + +void IndicateSelectedMerc( INT16 sID ) +{ + SOLDIERINITNODE *prev; + INT8 bTeam; + + //If we are trying to select a merc that is already selected, ignore. + if( sID >= 0 && sID == gsSelectedMercGridNo ) + return; + + //first remove the cursor of the previous merc. + //NOTE: It doesn't matter what the value is, even if a merc isn't selected. + //There is no need to validate the gridNo value, because it is always valid. + RemoveAllObjectsOfTypeRange( gsSelectedMercGridNo, CONFIRMMOVE, CONFIRMMOVE ); + + //This is very important, because clearing the merc editing mode actually, + //updates the edited merc. If this call isn't here, it is possible to update the + //newly selected merc with the wrong information. + SetMercEditingMode( MERC_NOMODE ); + + bTeam = -1; + + //determine selection method + switch( sID ) + { + case SELECT_NEXT_MERC: + prev = gpSelected; + if( gsSelectedMercID == -1 || !gpSelected ) + { //if no merc selected, then select the first one in list. + gpSelected = gSoldierInitHead; + } + else + { //validate this merc in the list. + if( gpSelected->next ) + { //select the next merc in the list + gpSelected = gpSelected->next; + } + else + { //we are at the end of the list, so select the first merc in the list. + gpSelected = gSoldierInitHead; + } + } + if( !gpSelected ) //list is empty + { + SetMercEditability( TRUE ); + SetMercEditingMode( MERC_TEAMMODE ); + return; + } + while( gpSelected != prev ) + { + if( !gpSelected ) + { + gpSelected = gSoldierInitHead; + continue; + } + if( gpSelected->pSoldier && gpSelected->pSoldier->bVisible == 1 ) + { //we have found a visible soldier, so select him. + break; + } + gpSelected = gpSelected->next; + } + //we have a valid merc now. + break; + case SELECT_NO_MERC: + SetMercEditability( TRUE ); + gpSelected = NULL; + gsSelectedMercID = -1; + gsSelectedGridNo = 0; + SetMercEditingMode( MERC_TEAMMODE ); + return; //we already deselected the previous merc. + case SELECT_NEXT_ENEMY: + bTeam = ENEMY_TEAM; + break; + case SELECT_NEXT_CREATURE: + bTeam = CREATURE_TEAM; + break; + case SELECT_NEXT_REBEL: + bTeam = MILITIA_TEAM; + break; + case SELECT_NEXT_CIV: + bTeam = CIV_TEAM; + break; + default: + //search for the merc with the specific ID. + gpSelected = FindSoldierInitNodeWithID( (UINT8)sID ); + if( !gpSelected ) + { + gsSelectedMercID = -1; + gsSelectedGridNo = 0; + SetMercEditability( TRUE ); + SetMercEditingMode( MERC_TEAMMODE ); + return; //Invalid merc ID. + } + break; + } + if( bTeam != -1 ) + { //We are searching for the next occurence of a particular team. + prev = gpSelected; + if( gsSelectedMercID == -1 || !gpSelected ) + { //if no merc selected, then select the first one in list. + gpSelected = gSoldierInitHead; + } + else + { //validate this merc in the list. + if( gpSelected->next ) + { //select the next merc in the list + gpSelected = gpSelected->next; + } + else + { //we are at the end of the list, so select the first merc in the list. + gpSelected = gSoldierInitHead; + } + } + if( !gpSelected ) //list is empty + { + SetMercEditability( TRUE ); + SetMercEditingMode( MERC_TEAMMODE ); + return; + } + while( gpSelected != prev ) + { + if( !gpSelected ) + { + gpSelected = gSoldierInitHead; + continue; + } + if( gpSelected->pSoldier && gpSelected->pSoldier->bVisible == 1 && gpSelected->pSoldier->bTeam == bTeam ) + { //we have found a visible soldier on the desired team, so select him. + break; + } + gpSelected = gpSelected->next; + } + if( !gpSelected ) + return; + if( gpSelected == prev ) + { //we have cycled through the list already, so choose the same guy (if he is on the desired team)... + if( !gpSelected->pSoldier || gpSelected->pSoldier->bVisible != 1 || gpSelected->pSoldier->bTeam != bTeam ) + { + SetMercEditability( TRUE ); + SetMercEditingMode( MERC_TEAMMODE ); + return; + } + } + } + //if we made it this far, then we have a new merc cursor indicator to draw. + if( gpSelected->pSoldier ) + gsSelectedMercGridNo = gpSelected->pSoldier->sGridNo; + else + { + SetMercEditability( TRUE ); + SetMercEditingMode( MERC_TEAMMODE ); + return; + } + gsSelectedMercID = gpSelected->pSoldier->ubID; + AddObjectToHead( gsSelectedMercGridNo, CONFIRMMOVE1 ); + + //If the merc has a valid profile, then turn off editability + if( gpSelected->pDetailedPlacement ) + SetMercEditability( (BOOLEAN)(gpSelected->pDetailedPlacement->ubProfile == NO_PROFILE) ); + else + SetMercEditability( TRUE ); + + if( sID < 0 ) + { //We want to center the screen on the next merc, and update the interface. + gsRenderCenterX = (INT16)gpSelected->pSoldier->dXPos; + gsRenderCenterY = (INT16)gpSelected->pSoldier->dYPos; + gfRenderWorld = TRUE; + } + + //update the merc item slots to reflect what the merc currently has. + UpdateMercItemSlots(); + + //Whatever the case, we want to update the gui to press the appropriate buttons + //depending on the merc's attributes. + //Click the appropriate team button + UnclickEditorButton( MERCS_ENEMY ); + UnclickEditorButton( MERCS_CREATURE ); + UnclickEditorButton( MERCS_REBEL ); + UnclickEditorButton( MERCS_CIVILIAN ); + switch( gpSelected->pSoldier->bTeam ) + { + case ENEMY_TEAM: ClickEditorButton( MERCS_ENEMY ); iDrawMode = DRAW_MODE_ENEMY; break; + case CREATURE_TEAM: ClickEditorButton( MERCS_CREATURE ); iDrawMode = DRAW_MODE_CREATURE; break; + case MILITIA_TEAM: ClickEditorButton( MERCS_REBEL ); iDrawMode = DRAW_MODE_REBEL; break; + case CIV_TEAM: ClickEditorButton( MERCS_CIVILIAN ); iDrawMode = DRAW_MODE_CIVILIAN; break; + } + //Update the editing mode + if( gpSelected->pDetailedPlacement ) + SetMercEditingMode( gubLastDetailedMercMode ); + else + SetMercEditingMode( MERC_BASICMODE ); + //Determine which team button to press. + gfRenderMercInfo = TRUE; + //These calls will set the proper button states, even though it redundantly + //assigns the soldier with the same orders/attitude. + SetMercOrders( gpSelected->pSoldier->bOrders ); + SetMercAttitude( gpSelected->pSoldier->bAttitude ); + SetMercDirection( gpSelected->pSoldier->bDirection ); + if( gpSelected->pBasicPlacement->fPriorityExistance ) + ClickEditorButton( MERCS_PRIORITYEXISTANCE_CHECKBOX ); + else + UnclickEditorButton( MERCS_PRIORITYEXISTANCE_CHECKBOX ); + if( gpSelected->pBasicPlacement->fHasKeys ) + ClickEditorButton( MERCS_HASKEYS_CHECKBOX ); + else + UnclickEditorButton( MERCS_HASKEYS_CHECKBOX ); + if( gpSelected->pSoldier->ubProfile == NO_PROFILE ) + { + SetMercRelativeEquipment( gpSelected->pBasicPlacement->bRelativeEquipmentLevel ); + SetMercRelativeAttributes( gpSelected->pBasicPlacement->bRelativeAttributeLevel ); + SetEnemyColorCode( gpSelected->pBasicPlacement->ubSoldierClass ); + } + if( iDrawMode == DRAW_MODE_CIVILIAN ) + { + ChangeCivGroup( gpSelected->pSoldier->ubCivilianGroup ); + } +} + +void DeleteSelectedMerc() +{ + if( gsSelectedMercID != -1 ) + { + RemoveSoldierNodeFromInitList( gpSelected ); + gpSelected = NULL; + gsSelectedMercID = -1; + gfRenderWorld = TRUE; + if( TextInputMode() ) + KillTextInputMode(); + IndicateSelectedMerc( SELECT_NO_MERC ); + } +} + +void SetupTextInputForMercProfile() +{ + UINT16 str[4]; + INT16 sNum; + + InitTextInputModeWithScheme( DEFAULT_SCHEME ); + + sNum = gpSelected->pDetailedPlacement->ubProfile; + if( sNum == NO_PROFILE ) + str[0] = '\0'; + else + CalcStringForValue( str, gpSelected->pDetailedPlacement->ubProfile, NUM_PROFILES ); + AddTextInputField( 200, 430, 30, 20, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + +} + +void SetupTextInputForMercAttributes() +{ + UINT16 str[4]; + + InitTextInputModeWithScheme( DEFAULT_SCHEME ); + + CalcStringForValue( str, gpSelected->pDetailedPlacement->bExpLevel, 100 ); + AddTextInputField( 200, 365, 20, 15, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bLife, 100 ); + AddTextInputField( 200, 390, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bLifeMax, 100 ); + AddTextInputField( 200, 415, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bMarksmanship, 100 ); + AddTextInputField( 200, 440, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bStrength, 100 ); + AddTextInputField( 300, 365, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bAgility, 100 ); + AddTextInputField( 300, 390, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bDexterity, 100 ); + AddTextInputField( 300, 415, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bWisdom, 100 ); + AddTextInputField( 300, 440, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bLeadership, 100 ); + AddTextInputField( 400, 365, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bExplosive, 100 ); + AddTextInputField( 400, 390, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bMedical, 100 ); + AddTextInputField( 400, 415, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bMechanical, 100 ); + AddTextInputField( 400, 440, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + CalcStringForValue( str, gpSelected->pDetailedPlacement->bMorale, 100 ); + AddTextInputField( 500, 365, 20, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + + if( !gfCanEditMercs ) + DisableAllTextFields(); +} + +//In the merc editing, all detailed placement values for generated attributes are set to -1. +//When making a generated attribute static, we then set the value to its applicable value. +//This function is similar to the itoa function except that -1 is converted to a null string. +void CalcStringForValue( UINT16 *str, INT32 iValue, UINT32 uiMax ) +{ + if( iValue < 0 ) //a blank string is determined by a negative value. + str[0] = '\0'; + else if( (UINT32)iValue > uiMax ) //higher than max attribute value, so convert it to the max. + swprintf( str, L"%d", uiMax ); + else //this is a valid static value, so convert it to a string. + swprintf( str, L"%d", iValue ); +} + +void ExtractAndUpdateMercAttributes() +{ + //If we have just deleted the merc's detailed placement in the editor, we don't + //need to extract the information + if( !gpSelected->pDetailedPlacement ) + return; + + //It just so happens that GetNumericStrict...() will return -1 for any blank fields. + //-1 values in the detailed placement work nicely, because that signifies that specific + //field isn't static. Any other value becomes static, and static values override any + //generated values. + gpSelected->pDetailedPlacement->bExpLevel = (INT8)min( GetNumericStrictValueFromField( 0 ), 100 ); + gpSelected->pDetailedPlacement->bLife = (INT8)min( GetNumericStrictValueFromField( 1 ), 100 ); + gpSelected->pDetailedPlacement->bLifeMax = (INT8)min( GetNumericStrictValueFromField( 2 ), 100 ); + gpSelected->pDetailedPlacement->bMarksmanship = (INT8)min( GetNumericStrictValueFromField( 3 ), 100 ); + gpSelected->pDetailedPlacement->bStrength = (INT8)min( GetNumericStrictValueFromField( 4 ), 100 ); + gpSelected->pDetailedPlacement->bAgility = (INT8)min( GetNumericStrictValueFromField( 5 ), 100 ); + gpSelected->pDetailedPlacement->bDexterity = (INT8)min( GetNumericStrictValueFromField( 6 ), 100 ); + gpSelected->pDetailedPlacement->bWisdom = (INT8)min( GetNumericStrictValueFromField( 7 ), 100 ); + gpSelected->pDetailedPlacement->bLeadership = (INT8)min( GetNumericStrictValueFromField( 8 ), 100 ); + gpSelected->pDetailedPlacement->bExplosive = (INT8)min( GetNumericStrictValueFromField( 9 ), 100 ); + gpSelected->pDetailedPlacement->bMedical = (INT8)min( GetNumericStrictValueFromField( 10 ), 100 ); + gpSelected->pDetailedPlacement->bMechanical = (INT8)min( GetNumericStrictValueFromField( 11 ), 100 ); + gpSelected->pDetailedPlacement->bMorale = (INT8)min( GetNumericStrictValueFromField( 11 ), 100 ); + + //make sure that experience level ranges between 1 and 9 + if( gpSelected->pDetailedPlacement->bExpLevel != -1 ) + gpSelected->pDetailedPlacement->bExpLevel = max( min( gpSelected->pDetailedPlacement->bExpLevel , 9 ), 1 ); + + //no such thing as a life max of 0 + if( !gpSelected->pDetailedPlacement->bLifeMax ) + gpSelected->pDetailedPlacement->bLifeMax = 1; + + //make sure the life doesn't exceed the maxlife... + if( gpSelected->pDetailedPlacement->bLifeMax != -1 && gpSelected->pDetailedPlacement->bLife != -1 && + gpSelected->pDetailedPlacement->bLife > gpSelected->pDetailedPlacement->bLifeMax ) + gpSelected->pDetailedPlacement->bLife = gpSelected->pDetailedPlacement->bLifeMax; + + //update the soldier + UpdateSoldierWithStaticDetailedInformation( gpSelected->pSoldier, gpSelected->pDetailedPlacement ); +} + +void ExtractAndUpdateMercProfile() +{ + INT16 sNum; + static INT16 sPrev = NO_PROFILE; + + //If we have just deleted the merc's detailed placement in the editor, we don't + //need to extract the information + if( !gpSelected->pDetailedPlacement ) + return; + + //if the string is blank, returning -1, then set the value to NO_PROFILE + //because ubProfile is unsigned. + sNum = (INT16)min( GetNumericStrictValueFromField( 0 ), NUM_PROFILES ); + if( sNum == -1 ) + { + gpSelected->pDetailedPlacement->ubProfile = NO_PROFILE; + gpSelected->pDetailedPlacement->fCopyProfileItemsOver = FALSE; + SetMercEditability( TRUE ); + } + else if( sPrev != sNum ) + { + gpSelected->pDetailedPlacement->ubProfile = (UINT8)sNum; + gpSelected->pDetailedPlacement->fCopyProfileItemsOver = TRUE; + gpSelected->pBasicPlacement->fPriorityExistance = TRUE; + ClickEditorButton( MERCS_PRIORITYEXISTANCE_CHECKBOX ); + SetMercEditability( FALSE ); + } + else + return; + + UpdateSoldierWithStaticDetailedInformation( gpSelected->pSoldier, gpSelected->pDetailedPlacement ); + if( gpSelected->pSoldier->bTeam == CIV_TEAM ) + { + ChangeCivGroup( gpSelected->pSoldier->ubCivilianGroup ); + } +} + +void SetupTextInputForMercSchedule() +{ + InitTextInputModeWithScheme( DEFAULT_SCHEME ); + AddUserInputField( NULL ); + AddTextInputField( 268, 373, 36, 16, MSYS_PRIORITY_NORMAL, L"", 6, INPUTTYPE_EXCLUSIVE_24HOURCLOCK ); + SetExclusive24HourTimeValue( 1, gCurrSchedule.usTime[0] ); + AddTextInputField( 268, 394, 36, 16, MSYS_PRIORITY_NORMAL, L"", 6, INPUTTYPE_EXCLUSIVE_24HOURCLOCK ); + SetExclusive24HourTimeValue( 2, gCurrSchedule.usTime[1] ); + AddTextInputField( 268, 415, 36, 16, MSYS_PRIORITY_NORMAL, L"", 6, INPUTTYPE_EXCLUSIVE_24HOURCLOCK ); + SetExclusive24HourTimeValue( 3, gCurrSchedule.usTime[2] ); + AddTextInputField( 268, 436, 36, 16, MSYS_PRIORITY_NORMAL, L"", 6, INPUTTYPE_EXCLUSIVE_24HOURCLOCK ); + SetExclusive24HourTimeValue( 4, gCurrSchedule.usTime[3] ); +} + +void ExtractAndUpdateMercSchedule() +{ + INT32 i; + BOOLEAN fValidSchedule = FALSE; + BOOLEAN fScheduleNeedsUpdate = FALSE; + SCHEDULENODE *pNext = NULL; + if( !gpSelected ) + return; + //extract all of the fields into a temp schedulenode. + //memset( &gScheduleNode, 0, sizeof( SCHEDULENODE ) ); + for( i = 0; i < 4; i++ ) + { + gCurrSchedule.usTime[i] = GetExclusive24HourTimeValueFromField( (UINT8)(i+1) ); + gCurrSchedule.ubAction[i] = (UINT8)MSYS_GetBtnUserData( ButtonList[ iEditorButton[ MERCS_SCHEDULE_ACTION1 + i ]], 0 ); + if( gCurrSchedule.ubAction[i] ) + fValidSchedule = TRUE; + } + + if( !gpSelected->pSoldier->ubScheduleID ) + { //The soldier doesn't actually have a schedule yet, so create one if necessary (not blank) + if( fValidSchedule ) + { //create a new schedule + if( SortSchedule( &gCurrSchedule ) ) + fScheduleNeedsUpdate = TRUE; + CopyScheduleToList( &gCurrSchedule, gpSelected ); + ShowEditorButton( MERCS_GLOWSCHEDULE ); + HideEditorButton( MERCS_SCHEDULE ); + } + } + else + { + SCHEDULENODE *pSchedule; + pSchedule = GetSchedule( gpSelected->pSoldier->ubScheduleID ); + if( !pSchedule ) + { + gpSelected->pSoldier->ubScheduleID = 0; + gpSelected->pDetailedPlacement->ubScheduleID = 0; + HideEditorButton( MERCS_GLOWSCHEDULE ); + ShowEditorButton( MERCS_SCHEDULE ); + return; + } + if( fValidSchedule ) + { //overwrite the existing schedule with the new one. + gCurrSchedule.ubScheduleID = gpSelected->pSoldier->ubScheduleID; + if( SortSchedule( &gCurrSchedule ) ) + fScheduleNeedsUpdate = TRUE; + pNext = pSchedule->next; + memcpy( pSchedule, &gCurrSchedule, sizeof( SCHEDULENODE ) ); + pSchedule->next = pNext; + } + else + { //remove the existing schedule, as the new one is blank. + DeleteSchedule( pSchedule->ubScheduleID ); + gpSelected->pSoldier->ubScheduleID = 0; + gpSelected->pDetailedPlacement->ubScheduleID = 0; + HideEditorButton( MERCS_GLOWSCHEDULE ); + ShowEditorButton( MERCS_SCHEDULE ); + } + } + if( fScheduleNeedsUpdate ) + { //The schedule was sorted, so update the gui. + UpdateScheduleInfo(); + } + SetActiveField( 0 ); +} + +void ExtractCurrentMercModeInfo( BOOLEAN fKillTextInputMode ) +{ + //This happens if we deleted a merc + if( gsSelectedMercID == -1 ) + return; + //Extract and update mercs via text fields if applicable + switch( gubCurrMercMode ) + { + case MERC_ATTRIBUTEMODE: + ExtractAndUpdateMercAttributes(); + break; + case MERC_PROFILEMODE: + ExtractAndUpdateMercProfile(); + break; + case MERC_SCHEDULEMODE: + ExtractAndUpdateMercSchedule(); + break; + default: + fKillTextInputMode = FALSE; + break; + } + if( fKillTextInputMode ) + KillTextInputMode(); +} + +void InitDetailedPlacementForMerc() +{ + Assert( !gpSelected->pDetailedPlacement ); + + gpSelected->pDetailedPlacement = (SOLDIERCREATE_STRUCT*)MemAlloc(sizeof(SOLDIERCREATE_STRUCT)); + + Assert( gpSelected->pDetailedPlacement ); + + gpSelected->pBasicPlacement->fDetailedPlacement = TRUE; + gpSelected->pBasicPlacement->fPriorityExistance = FALSE; + CreateStaticDetailedPlacementGivenBasicPlacementInfo( gpSelected->pDetailedPlacement, gpSelected->pBasicPlacement ); + + ClearCurrentSchedule(); + + //update the soldier + UpdateSoldierWithStaticDetailedInformation ( gpSelected->pSoldier, gpSelected->pDetailedPlacement ); +} + +void KillDetailedPlacementForMerc() +{ + Assert( gpSelected->pDetailedPlacement ); + MemFree( gpSelected->pDetailedPlacement ); + gpSelected->pDetailedPlacement = NULL; + gpSelected->pBasicPlacement->fDetailedPlacement = FALSE; + SetMercEditability( TRUE ); +} + + +void ChangeBodyType( INT8 bOffset ) //+1 or -1 only +{ + INT8 *pbArray; + INT32 iMax, x; + INT32 iIndex; + + gfRenderTaskbar = TRUE; + gfRenderMercInfo = TRUE; + //verify that we have a proper offset ( only +-1 allowed ) + Assert( bOffset == -1 || bOffset == 1 ); + //get access to information depending on the team + switch( gpSelected->pBasicPlacement->bTeam ) + { + case ENEMY_TEAM: + pbArray = bEnemyArray; + iMax = MAX_ENEMYTYPES; + break; + case CREATURE_TEAM: + pbArray = bCreatureArray; + iMax = MAX_CREATURETYPES; + break; + case MILITIA_TEAM: + pbArray = bRebelArray; + iMax = MAX_REBELTYPES; + break; + case CIV_TEAM: + pbArray = bCivArray; + iMax = MAX_CIVTYPES; + break; + } + //find the matching bodytype index within the array. + for( x = 0; x < iMax; x++ ) + { + iIndex = pbArray[ x ]; + if( iIndex == gpSelected->pBasicPlacement->bBodyType ) + break; + } + Assert( iIndex == gpSelected->pBasicPlacement->bBodyType ); + //now we have a match, so go to the next element (depending on offset value) + x += bOffset; + if( x >= iMax ) + x = 0; + else if( x < 0 ) + x = iMax-1; + iIndex = pbArray[ x ]; + //Set the new bodytype into the and update the soldier info + if( iIndex != -1 ) + { + gpSelected->pSoldier->ubBodyType = (UINT8)iIndex; + //Set the flags based on the bodytype + gpSelected->pSoldier->uiStatusFlags &= ~(SOLDIER_VEHICLE | SOLDIER_ROBOT | SOLDIER_ANIMAL | SOLDIER_MONSTER); + switch( gpSelected->pSoldier->ubBodyType ) + { + case ADULTFEMALEMONSTER: + case AM_MONSTER: + case YAF_MONSTER: + case YAM_MONSTER: + case LARVAE_MONSTER: + case INFANT_MONSTER: + case QUEENMONSTER: + gpSelected->pSoldier->uiStatusFlags |= SOLDIER_MONSTER; + break; + case BLOODCAT: + case COW: + case CROW: + gpSelected->pSoldier->uiStatusFlags |= SOLDIER_ANIMAL; + break; + case ROBOTNOWEAPON: + gpSelected->pSoldier->uiStatusFlags |= SOLDIER_ROBOT; + break; + case HUMVEE: + case ELDORADO: + case ICECREAMTRUCK: + case JEEP: + case TANK_NW: + case TANK_NE: + gpSelected->pSoldier->uiStatusFlags |= SOLDIER_VEHICLE; + break; + } + SetSoldierAnimationSurface( gpSelected->pSoldier, gpSelected->pSoldier->usAnimState ); + } + //Update the placement's info as well. + gpSelected->pBasicPlacement->bBodyType = (INT8)iIndex; + if( gpSelected->pDetailedPlacement ) + { + gpSelected->pDetailedPlacement->bBodyType = (INT8)iIndex; + } + if( gpSelected->pSoldier->bTeam == CREATURE_TEAM ) + { + gbCurrCreature = (INT8)iIndex; + AssignCreatureInventory( gpSelected->pSoldier ); + } + CreateSoldierPalettes( gpSelected->pSoldier ); +} + +void SetMercEditability( BOOLEAN fEditable ) +{ + gfRenderMercInfo = TRUE; + if( fEditable == gfCanEditMercs ) + return; + gfCanEditMercs = fEditable; + if( gfCanEditMercs ) + { //enable buttons to allow editing + EnableEditorButtons( MERCS_EQUIPMENT_BAD, MERCS_ATTRIBUTES_GREAT ); + EnableEditorButtons( FIRST_MERCS_COLORMODE_BUTTON, LAST_MERCS_COLORMODE_BUTTON ); + if( gpSelected && gpSelected->pDetailedPlacement && !gpSelected->pDetailedPlacement->fVisible ) + UnclickEditorButton( MERCS_TOGGLECOLOR_BUTTON ); + EnableEditorButton( MERCS_PRIORITYEXISTANCE_CHECKBOX ); + EnableEditorButton( MERCS_CIVILIAN_GROUP ); + } + else + { //disable buttons to prevent editing + DisableEditorButtons( MERCS_EQUIPMENT_BAD, MERCS_ATTRIBUTES_GREAT ); + DisableEditorButtons( FIRST_MERCS_COLORMODE_BUTTON, LAST_MERCS_COLORMODE_BUTTON ); + ClickEditorButton( MERCS_TOGGLECOLOR_BUTTON ); + DisableEditorButton( MERCS_PRIORITYEXISTANCE_CHECKBOX ); + DisableEditorButton( MERCS_CIVILIAN_GROUP ); + } +} + + +//There are 4 exclusive entry points in a map. Only one of each type can exist on a +//map, and these points are used to validate the map by attempting to connect the four +//points together. If one of the points is isolated, then the map will be rejected. It +//isn't necessary to specify all four points. You wouldn't want to specify a north point if +//there isn't going to be any traversing to adjacent maps from that side. +void SpecifyEntryPoint( UINT32 iMapIndex ) +{ + INT16 *psEntryGridNo; + BOOLEAN fErasing = FALSE; + if( iDrawMode >= DRAW_MODE_ERASE ) + { + iDrawMode -= DRAW_MODE_ERASE; + fErasing = TRUE; + } + switch( iDrawMode ) + { + case DRAW_MODE_NORTHPOINT: psEntryGridNo = &gMapInformation.sNorthGridNo; break; + case DRAW_MODE_WESTPOINT: psEntryGridNo = &gMapInformation.sWestGridNo; break; + case DRAW_MODE_EASTPOINT: psEntryGridNo = &gMapInformation.sEastGridNo; break; + case DRAW_MODE_SOUTHPOINT: psEntryGridNo = &gMapInformation.sSouthGridNo; break; + case DRAW_MODE_CENTERPOINT: psEntryGridNo = &gMapInformation.sCenterGridNo; break; + case DRAW_MODE_ISOLATEDPOINT: psEntryGridNo = &gMapInformation.sIsolatedGridNo; break; + default: return; + } + if( !fErasing ) + { + if( *psEntryGridNo >= 0 ) + { + AddToUndoList( *psEntryGridNo ); + RemoveAllTopmostsOfTypeRange( *psEntryGridNo, FIRSTPOINTERS, FIRSTPOINTERS ); + } + *psEntryGridNo = (UINT16)iMapIndex; + ValidateEntryPointGridNo( psEntryGridNo ); + AddToUndoList( *psEntryGridNo ); + AddTopmostToTail( *psEntryGridNo, FIRSTPOINTERS2 ); + } + else + { + UINT16 usDummy; + if( TypeExistsInTopmostLayer( iMapIndex, FIRSTPOINTERS, &usDummy ) ) + { + AddToUndoList( iMapIndex ); + RemoveAllTopmostsOfTypeRange( iMapIndex, FIRSTPOINTERS, FIRSTPOINTERS ); + *psEntryGridNo = -1; + } + //restore the drawmode + iDrawMode += DRAW_MODE_ERASE; + } +} + +void SetMercEditingMode( UINT8 ubNewMode ) +{ + //We need to update the taskbar for the buttons that were erased. + gfRenderTaskbar = TRUE; + + //set up the new mode values. + if( gubCurrMercMode >= MERC_GENERALMODE ) + gubLastDetailedMercMode = gubCurrMercMode; + + //Depending on the mode we were just in, we may want to extract and update the + //merc first. Then we change modes... + ExtractCurrentMercModeInfo( TRUE ); + + //Change modes now. + gubPrevMercMode = gubCurrMercMode; + gubCurrMercMode = ubNewMode; + + //Hide all of the merc buttons except the team buttons which are static. + HideEditorButtons( FIRST_MERCS_BASICMODE_BUTTON, LAST_MERCS_BUTTON ); + + switch( gubPrevMercMode ) + { + case MERC_GETITEMMODE: + EnableEditorButtons( TAB_TERRAIN, TAB_OPTIONS ); + HideEditorButtons( FIRST_MERCS_GETITEM_BUTTON, LAST_MERCS_GETITEM_BUTTON ); + AddNewItemToSelectedMercsInventory( TRUE ); + break; + case MERC_INVENTORYMODE: + HideItemStatsPanel(); + DisableEditorRegion( MERC_REGION_ID ); + break; + case MERC_GENERALMODE: + EnableEditorButton( MERCS_APPEARANCE ); + break; + case MERC_SCHEDULEMODE: + //ClearCurrentSchedule(); + break; + } + + //If we leave the merc tab, then we want to update editable fields such as + //attributes, which was just handled above, then turn everything off, and exit. + if( ubNewMode == MERC_NOMODE ) + { + HideEditorButtons( FIRST_MERCS_BUTTON, LAST_MERCS_TEAMMODE_BUTTON ); + HideEditorButtons( MERCS_SCHEDULE, MERCS_GLOWSCHEDULE ); + return; + } + if( gubPrevMercMode == MERC_NOMODE || gubPrevMercMode == MERC_GETITEMMODE ) + { + ShowEditorButtons( FIRST_MERCS_BUTTON, LAST_MERCS_TEAMMODE_BUTTON ); + } + + //Release the currently selected merc if you just selected a new team. + if( gsSelectedMercID != -1 && ubNewMode == MERC_TEAMMODE ) + { + //attempt to weed out conditions where we select a team that matches the currently + //selected merc. We don't want to deselect him in this case. + if( gpSelected->pSoldier->bTeam == ENEMY_TEAM && iDrawMode == DRAW_MODE_ENEMY || + gpSelected->pSoldier->bTeam == CREATURE_TEAM && iDrawMode == DRAW_MODE_CREATURE || + gpSelected->pSoldier->bTeam == MILITIA_TEAM && iDrawMode == DRAW_MODE_REBEL || + gpSelected->pSoldier->bTeam == CIV_TEAM && iDrawMode == DRAW_MODE_CIVILIAN ) + { //Same team, so don't deselect merc. Instead, keep the previous editing mode + //because we are still editing this merc. + gubCurrMercMode = gubPrevMercMode; + //if we don't have a detailed placement, auto set to basic mode. + if( !gpSelected->pDetailedPlacement ) + gubCurrMercMode = MERC_BASICMODE; + } + else + { + //Different teams, so deselect the current merc and the detailed checkbox if applicable. + IndicateSelectedMerc( SELECT_NO_MERC ); + ShowEditorButtons( FIRST_MERCS_BUTTON, LAST_MERCS_TEAMMODE_BUTTON ); + UnclickEditorButton( MERCS_DETAILEDCHECKBOX ); + } + } + + ShowButton( iEditorButton[ MERCS_NEXT ] ); + if( gsSelectedMercID != -1 ) + ShowButton( iEditorButton[ MERCS_DELETE ] ); + + if( gubCurrMercMode > MERC_TEAMMODE ) + { //Add the basic buttons if applicable. + ShowEditorButtons( FIRST_MERCS_BASICMODE_BUTTON, LAST_MERCS_BASICMODE_BUTTON ); + } + if( gubCurrMercMode > MERC_BASICMODE ) + { //Add the detailed buttons if applicable. + ClickEditorButton( MERCS_DETAILEDCHECKBOX ); + ShowEditorButtons( FIRST_MERCS_PRIORITYMODE_BUTTON, LAST_MERCS_PRIORITYMODE_BUTTON ); + } + else + UnclickEditorButton( MERCS_DETAILEDCHECKBOX ); + //Now we are setting up the button states for the new mode, as well as show the + //applicable buttons for the detailed placement modes. + if( gubCurrMercMode == MERC_APPEARANCEMODE && iDrawMode == DRAW_MODE_CREATURE || + gubCurrMercMode == MERC_SCHEDULEMODE && iDrawMode != DRAW_MODE_CIVILIAN ) + { + gubCurrMercMode = MERC_GENERALMODE; + } + switch( gubCurrMercMode ) + { + case MERC_GETITEMMODE: + DisableEditorButtons( TAB_TERRAIN, TAB_OPTIONS ); + EnableEditorButton( TAB_MERCS ); + HideEditorButtons( FIRST_MERCS_BUTTON, LAST_MERCS_TEAMMODE_BUTTON ); + HideEditorButtons( MERCS_SCHEDULE, MERCS_GLOWSCHEDULE ); + ShowEditorButtons( FIRST_MERCS_GETITEM_BUTTON, LAST_MERCS_GETITEM_BUTTON ); + InitEditorItemsInfo( eInfo.uiItemType ); + ClickEditorButton( ITEMS_WEAPONS + eInfo.uiItemType - TBAR_MODE_ITEM_WEAPONS ); + break; + case MERC_INVENTORYMODE: + UpdateMercItemSlots(); + ShowItemStatsPanel(); + if( gbCurrSelect == -1 ) + SpecifyItemToEdit( NULL, -1 ); + else + SpecifyItemToEdit( gpMercSlotItem[ gbCurrSelect ], -1 ); + HideEditorButtons( MERCS_DELETE, MERCS_NEXT ); + ShowEditorButtons( FIRST_MERCS_INVENTORY_BUTTON, LAST_MERCS_INVENTORY_BUTTON ); + EnableEditorRegion( MERC_REGION_ID ); + UnclickEditorButtons( FIRST_MERCS_PRIORITYMODE_BUTTON, LAST_MERCS_PRIORITYMODE_BUTTON ); + ClickEditorButton( MERCS_INVENTORY ); + break; + case MERC_BASICMODE: + ShowEditorButtons( FIRST_MERCS_GENERAL_BUTTON, LAST_MERCS_GENERAL_BUTTON ); + if( iDrawMode == DRAW_MODE_CREATURE ) + { //Set up alternate general mode. This one doesn't allow you to specify relative attributes + //but requires you to specify a body type. + HideEditorButtons( FIRST_MERCS_REL_EQUIPMENT_BUTTON, LAST_MERCS_REL_EQUIPMENT_BUTTON ); + ShowEditorButtons( FIRST_MERCS_BODYTYPE_BUTTON, LAST_MERCS_BODYTYPE_BUTTON ); + } + if( iDrawMode != DRAW_MODE_ENEMY ) + HideEditorButtons( FIRST_MERCS_COLORCODE_BUTTON, LAST_MERCS_COLORCODE_BUTTON ); + if( iDrawMode == DRAW_MODE_CIVILIAN ) + ShowEditorButton( MERCS_CIVILIAN_GROUP ); + break; + case MERC_GENERALMODE: + ShowEditorButtons( FIRST_MERCS_GENERAL_BUTTON, LAST_MERCS_GENERAL_BUTTON ); + UnclickEditorButtons( FIRST_MERCS_PRIORITYMODE_BUTTON, LAST_MERCS_PRIORITYMODE_BUTTON ); + ClickEditorButton( MERCS_GENERAL ); + if( iDrawMode == DRAW_MODE_CREATURE ) + { //Set up alternate general mode. This one doesn't allow you to specify relative equipment + //but requires you to specify a body type. + HideEditorButtons( FIRST_MERCS_REL_EQUIPMENT_BUTTON, LAST_MERCS_REL_EQUIPMENT_BUTTON ); + ShowEditorButtons( FIRST_MERCS_BODYTYPE_BUTTON, LAST_MERCS_BODYTYPE_BUTTON ); + DisableEditorButton( MERCS_APPEARANCE ); + } + if( iDrawMode != DRAW_MODE_ENEMY ) + HideEditorButtons( FIRST_MERCS_COLORCODE_BUTTON, LAST_MERCS_COLORCODE_BUTTON ); + if( iDrawMode == DRAW_MODE_CIVILIAN ) + ShowEditorButton( MERCS_CIVILIAN_GROUP ); + break; + case MERC_ATTRIBUTEMODE: + UnclickEditorButtons( FIRST_MERCS_PRIORITYMODE_BUTTON, LAST_MERCS_PRIORITYMODE_BUTTON ); + ClickEditorButton( MERCS_ATTRIBUTES ); + SetupTextInputForMercAttributes(); + break; + case MERC_APPEARANCEMODE: + ShowEditorButtons( FIRST_MERCS_COLORMODE_BUTTON, LAST_MERCS_COLORMODE_BUTTON ); + UnclickEditorButtons( FIRST_MERCS_PRIORITYMODE_BUTTON, LAST_MERCS_PRIORITYMODE_BUTTON ); + ClickEditorButton( MERCS_APPEARANCE ); + if( gfCanEditMercs && gpSelected && gpSelected->pDetailedPlacement ) + { + if( !gpSelected->pDetailedPlacement->fVisible ) + { + UnclickEditorButton( MERCS_TOGGLECOLOR_BUTTON ); + DisableEditorButtons( FIRST_MERCS_COLOR_BUTTON, LAST_MERCS_COLOR_BUTTON ); + } + else + { + ClickEditorButton( MERCS_TOGGLECOLOR_BUTTON ); + EnableEditorButtons( FIRST_MERCS_COLOR_BUTTON, LAST_MERCS_COLOR_BUTTON ); + } + } + break; + case MERC_PROFILEMODE: + UnclickEditorButtons( FIRST_MERCS_PRIORITYMODE_BUTTON, LAST_MERCS_PRIORITYMODE_BUTTON ); + ClickEditorButton( MERCS_PROFILE ); + SetupTextInputForMercProfile(); + break; + case MERC_SCHEDULEMODE: + ShowEditorButtons( MERCS_SCHEDULE_ACTION1, MERCS_SCHEDULE_VARIANCE4 ); + ShowEditorButton( MERCS_SCHEDULE_CLEAR ); + UnclickEditorButtons( FIRST_MERCS_PRIORITYMODE_BUTTON, LAST_MERCS_PRIORITYMODE_BUTTON ); + ClickEditorButton( MERCS_SCHEDULE ); + SetupTextInputForMercSchedule(); + UpdateScheduleInfo(); + DetermineScheduleEditability(); + } + //Show or hide the schedule buttons + if( gpSelected && gubCurrMercMode != MERC_GETITEMMODE ) + { + if( gpSelected->pDetailedPlacement && gpSelected->pDetailedPlacement->ubScheduleID ) + { + HideEditorButton( MERCS_SCHEDULE ); + ShowEditorButton( MERCS_GLOWSCHEDULE ); + } + else + { + HideEditorButton( MERCS_GLOWSCHEDULE ); + if( gpSelected->pDetailedPlacement ) + { + ShowEditorButton( MERCS_SCHEDULE ); + if( gpSelected->pSoldier->bTeam == CIV_TEAM ) + EnableEditorButton( MERCS_SCHEDULE ); + else + DisableEditorButton( MERCS_SCHEDULE ); + } + else + { + HideEditorButton( MERCS_SCHEDULE ); + } + } + } + else + { + HideEditorButtons( MERCS_SCHEDULE, MERCS_GLOWSCHEDULE ); + } +} + +void DisplayBodyTypeInfo() +{ + UINT16 str[20]; + switch( gpSelected->pBasicPlacement->bBodyType ) + { + case RANDOM: swprintf( str, L"Random" ); break; + case REGMALE: swprintf( str, L"Reg Male" ); break; + case BIGMALE: swprintf( str, L"Big Male" ); break; + case STOCKYMALE: swprintf( str, L"Stocky Male" ); break; + case REGFEMALE: swprintf( str, L"Reg Female" ); break; + case TANK_NE: swprintf( str, L"NE Tank" ); break; + case TANK_NW: swprintf( str, L"NW Tank" ); break; + case FATCIV: swprintf( str, L"Fat Civilian" ); break; + case MANCIV: swprintf( str, L"M Civilian" ); break; + case MINICIV: swprintf( str, L"Miniskirt" ); break; + case DRESSCIV: swprintf( str, L"F Civilian" ); break; + case HATKIDCIV: swprintf( str, L"Kid w/ Hat" ); break; + case HUMVEE: swprintf( str, L"Humvee" ); break; + case ELDORADO: swprintf( str, L"Eldorado" ); break; + case ICECREAMTRUCK: swprintf( str, L"Icecream Truck" ); break; + case JEEP: swprintf( str, L"Jeep" ); break; + case KIDCIV: swprintf( str, L"Kid Civilian" ); break; + case COW: swprintf( str, L"Domestic Cow" ); break; + case CRIPPLECIV: swprintf( str, L"Cripple" ); break; + case ROBOTNOWEAPON: swprintf( str, L"Unarmed Robot" ); break; + case LARVAE_MONSTER: swprintf( str, L"Larvae" ); break; + case INFANT_MONSTER: swprintf( str, L"Infant" ); break; + case YAF_MONSTER: swprintf( str, L"Yng F Monster" ); break; + case YAM_MONSTER: swprintf( str, L"Yng M Monster" ); break; + case ADULTFEMALEMONSTER: swprintf( str, L"Adt F Monster" ); break; + case AM_MONSTER: swprintf( str, L"Adt M Monster" ); break; + case QUEENMONSTER: swprintf( str, L"Queen Monster" ); break; + case BLOODCAT: swprintf( str, L"Bloodcat" ); break; + } + DrawEditorInfoBox( str, FONT10ARIAL, 490, 364, 70, 20 ); +} + +void UpdateMercsInfo() +{ + if( !gfRenderMercInfo ) + return; + + //We are rendering it now, so signify that it has been done, so + //it doesn't get rendered every frame. + gfRenderMercInfo = FALSE; + + switch( gubCurrMercMode ) + { + case MERC_GETITEMMODE: + RenderEditorItemsInfo(); + break; + case MERC_INVENTORYMODE: + if( gfMercGetItem ) + SetMercEditingMode( MERC_GETITEMMODE ); + else + RenderMercInventoryPanel(); + break; + case MERC_BASICMODE: + case MERC_GENERALMODE: + BltVideoObjectFromIndex( FRAME_BUFFER, guiExclamation, 0, 188, 362, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, guiKeyImage, 0, 186, 387, VO_BLT_SRCTRANSPARENCY, NULL ); + SetFont( SMALLCOMPFONT ); + SetFontForeground( FONT_YELLOW ); + SetFontShadow( FONT_NEARBLACK ); + mprintf( 240, 363, L" --=ORDERS=-- "); + mprintf( 240, 419, L"--=ATTITUDE=--"); + if( iDrawMode == DRAW_MODE_CREATURE ) + { + DisplayBodyTypeInfo(); + SetFont( SMALLCOMPFONT ); + SetFontForeground( FONT_LTBLUE ); + mprintf( 493, 416, L"RELATIVE"); + mprintf( 480, 422, L"ATTRIBUTES"); + } + else + { + SetFontForeground( FONT_LTGREEN ); + mprintf( 480, 363, L"RELATIVE"); + mprintf( 480, 371, L"EQUIPMENT"); + SetFontForeground( FONT_LTBLUE ); + mprintf( 530, 363, L"RELATIVE"); + mprintf( 530, 371, L"ATTRIBUTES"); + } + if( iDrawMode == DRAW_MODE_ENEMY ) + { + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + mprintf( 590, 411, L"Army" ); + mprintf( 590, 425, L"Admin" ); + mprintf( 590, 439, L"Elite" ); + } + break; + case MERC_ATTRIBUTEMODE: + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + SetFontShadow( FONT_NEARBLACK ); + mprintf( 225, 370, L"Exp. Level"); + mprintf( 225, 395, L"Life"); + mprintf( 225, 420, L"LifeMax"); + mprintf( 225, 445, L"Marksmanship"); + mprintf( 325, 370, L"Strength"); + mprintf( 325, 395, L"Agility"); + mprintf( 325, 420, L"Dexterity"); + mprintf( 325, 445, L"Wisdom"); + mprintf( 425, 370, L"Leadership"); + mprintf( 425, 395, L"Explosives"); + mprintf( 425, 420, L"Medical"); + mprintf( 425, 445, L"Mechanical"); + mprintf( 525, 370, L"Morale"); + break; + case MERC_APPEARANCEMODE: + SetFont( FONT10ARIAL ); + if( gpSelected->pDetailedPlacement->fVisible || gpSelected->pDetailedPlacement->ubProfile != NO_PROFILE ) + SetFontForeground( FONT_YELLOW ); + else + SetFontForeground( FONT_DKYELLOW ); + SetFontShadow( FONT_NEARBLACK ); + + mprintf( 396, 364, L"Hair color:"); + mprintf( 396, 388, L"Skin color:"); + mprintf( 396, 412, L"Vest color:"); + mprintf( 396, 436, L"Pant color:"); + + SetFont( SMALLCOMPFONT ); + SetFontForeground( FONT_BLACK ); + if( gpSelected->pDetailedPlacement->fVisible || gpSelected->pDetailedPlacement->ubProfile != NO_PROFILE ) + { + mprintfEditor( 396, 374, L"%S ", gpSelected->pSoldier->HeadPal ); + mprintfEditor( 396, 398, L"%S ", gpSelected->pSoldier->SkinPal ); + mprintfEditor( 396, 422, L"%S ", gpSelected->pSoldier->VestPal ); + mprintfEditor( 396, 446, L"%S ", gpSelected->pSoldier->PantsPal ); + ShowEditMercPalettes( gpSelected->pSoldier ); + } + else + { + mprintf( 396, 374, L"RANDOM"); + mprintf( 396, 398, L"RANDOM"); + mprintf( 396, 422, L"RANDOM"); + mprintf( 396, 446, L"RANDOM"); + ShowEditMercPalettes( NULL ); //will display grey scale to signify random + } + DisplayBodyTypeInfo(); + break; + case MERC_PROFILEMODE: + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + SetFontShadow( FONT_NEARBLACK ); + { //scope trick + UINT16 tempStr[500]; + swprintf( tempStr, L"%s%s%s%s%s%d.", + L"By specifying a profile index, all of the information will be extracted from the profile ", + L"and override any values that you have edited. It will also disable the editing features ", + L"though, you will still be able to view stats, etc. Pressing ENTER will automatically ", + L"extract the number you have typed. A blank field will clear the profile. The current ", + L"number of profiles range from 0 to ", NUM_PROFILES ); + DisplayWrappedString(180, 370, 400, 2, FONT10ARIAL, 146, tempStr, FONT_BLACK, FALSE, LEFT_JUSTIFIED ); + SetFont( FONT12POINT1 ); + if( gpSelected->pDetailedPlacement->ubProfile == NO_PROFILE ) + { + SetFontForeground( FONT_GRAY3 ); + mprintfEditor( 240, 435, L"Current Profile: n/a "); + } + else + { + SetFontForeground( FONT_WHITE ); + ClearTaskbarRegion( 240, 435, 580, 445 ); + mprintf( 240, 435, L"Current Profile: %s", gMercProfiles[ gpSelected->pDetailedPlacement->ubProfile ].zName ); + } + } + break; + case MERC_SCHEDULEMODE: + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_WHITE ); + SetFontShadow( FONT_NEARBLACK ); + switch( gpSelected->pSoldier->bOrders ) + { + case STATIONARY: mprintf( 430, 363, L"STATIONARY" ); break; + case ONCALL: mprintf( 430, 363, L"ON CALL" ); break; + case ONGUARD: mprintf( 430, 363, L"ON GUARD" ); break; + case SEEKENEMY: mprintf( 430, 363, L"SEEK ENEMY" ); break; + case CLOSEPATROL: mprintf( 430, 363, L"CLOSE PATROL" ); break; + case FARPATROL: mprintf( 430, 363, L"FAR PATROL" ); break; + case POINTPATROL: mprintf( 430, 363, L"POINT PATROL" ); break; + case RNDPTPATROL: mprintf( 430, 363, L"RND PT PATROL" ); break; + } + SetFontForeground( FONT_YELLOW ); + mprintf( 186, 363, L"Action" ); + mprintf( 268, 363, L"Time" ); + mprintf( 309, 363, L"V" ); + mprintf( 331, 363, L"GridNo 1" ); + mprintf( 381, 363, L"GridNo 2" ); + mprintf( 172, 376, L"1)" ); + mprintf( 172, 397, L"2)" ); + mprintf( 172, 418, L"3)" ); + mprintf( 172, 439, L"4)" ); + if( gubScheduleInstructions ) + { + UINT16 str[255]; + UINT16 keyword[10] = L""; + ColorFillVideoSurfaceArea( FRAME_BUFFER, 431, 388, 590, 450, Get16BPPColor( FROMRGB( 32, 45, 72 ) ) ); + switch( gCurrSchedule.ubAction[ gubCurrentScheduleActionIndex ] ) + { + case SCHEDULE_ACTION_LOCKDOOR: swprintf( keyword, L"lock" ); break; + case SCHEDULE_ACTION_UNLOCKDOOR: swprintf( keyword, L"unlock" ); break; + case SCHEDULE_ACTION_OPENDOOR: swprintf( keyword, L"open" ); break; + case SCHEDULE_ACTION_CLOSEDOOR: swprintf( keyword, L"close" ); break; + } + switch( gubScheduleInstructions ) + { + case SCHEDULE_INSTRUCTIONS_DOOR1: + swprintf( str, L"Click on the gridno adjacent to the door that you wish to %s.", keyword ); + break; + case SCHEDULE_INSTRUCTIONS_DOOR2: + swprintf( str, L"Click on the gridno where you wish to move after you %s the door.", keyword ); + break; + case SCHEDULE_INSTRUCTIONS_GRIDNO: + swprintf( str, L"Click on the gridno where you wish to move to." ); + break; + case SCHEDULE_INSTRUCTIONS_SLEEP: + swprintf( str, L"Click on the gridno where you wish to sleep at. Person will automatically return to original position after waking up." ); + default: + return; + } + wcscat( str, L" Hit ESC to abort entering this line in the schedule." ); + DisplayWrappedString( 436, 392, 149, 2, FONT10ARIAL, FONT_YELLOW, str, FONT_BLACK, FALSE, LEFT_JUSTIFIED ); + } + break; + } +} + +//When a detailed placement merc is in the inventory panel, there is a overall region +//blanketing this panel. As the user moves the mouse around and clicks, etc., this function +//is called by the region callback functions to handle these cases. The event types are defined +//in Editor Taskbar Utils.h. Here are the internal functions... + +SGPRect mercRects[9] = +{ + { 75, 0, 104, 19 }, //head + { 75, 22, 104, 41 }, //body + { 76, 73, 105, 92 }, //legs + { 26, 43, 78, 62 }, //left hand + { 104, 42, 156, 61 }, //right hand + { 180, 6, 232, 25 }, //pack 1 + { 180, 29, 232, 48 }, //pack 2 + { 180, 52, 232, 71 }, //pack 3 + { 180, 75, 232, 94 } //pack 4 +}; + + +BOOLEAN PointInRect( SGPRect *pRect, INT32 x, INT32 y ) +{ + return( x >= pRect->iLeft && x <= pRect->iRight && y >= pRect->iTop && y <= pRect->iBottom ); +} + +void DrawRect( SGPRect *pRect, INT16 color ) +{ + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); + RectangleDraw( TRUE, pRect->iLeft+MERCPANEL_X, pRect->iTop+MERCPANEL_Y, pRect->iRight+MERCPANEL_X, pRect->iBottom+MERCPANEL_Y, color, pDestBuf ); + UnLockVideoSurface( FRAME_BUFFER ); + //InvalidateRegion( pRect->iLeft+175, pRect->iTop+361, pRect->iRight+176, pRect->iBottom+362 ); +} + +void RenderSelectedMercsInventory() +{ + INT32 i; + UINT8 *pSrc, *pDst; + INT32 xp, yp; + UINT32 uiSrcPitchBYTES, uiDstPitchBYTES; + UINT16 pItemName[100]; + UINT8 ubFontColor; + if( gsSelectedMercID == -1 ) + return; + for( i = 0; i < 9; i++ ) + { + if( gpMercSlotItem[i] ) + { //Render the current image. + xp = mercRects[ i ].iLeft + 4 + MERCPANEL_X; + yp = mercRects[ i ].iTop + MERCPANEL_Y; + pDst = LockVideoSurface( FRAME_BUFFER, &uiDstPitchBYTES ); + pSrc = LockVideoSurface( guiMercInvPanelBuffers[i], &uiSrcPitchBYTES ); + Blt16BPPTo16BPPTrans( (UINT16*)pDst, uiDstPitchBYTES, + (UINT16 *)pSrc, uiSrcPitchBYTES, xp, yp, 0, 0, i<3 ? 22 : 44, 15, 0 ); + UnLockVideoSurface( FRAME_BUFFER ); + UnLockVideoSurface( guiMercInvPanelBuffers[i] ); + LoadItemInfo( gpMercSlotItem[i]->usItem, pItemName, NULL ); + //Render the text + switch( i ) + { + case 2: //legs (to the right of the box, but move it down to make room for right hand text) + xp = mercRects[i].iRight + 2; + yp = mercRects[i].iTop + 8; + break; + case 3: //left hand (underneath box and to the left -- obscurred by checkbox) + xp = mercRects[i].iLeft - 20; + yp = mercRects[i].iBottom + 2; + break; + case 4: //right hand (underneath box) + xp = mercRects[i].iLeft; + yp = mercRects[i].iBottom + 2; + break; + default: //normal cases (to the right of the box) + xp = mercRects[i].iRight + 2; + yp = mercRects[i].iTop; + break; + } + xp += MERCPANEL_X; + yp += MERCPANEL_Y; + SetFont( SMALLCOMPFONT ); + if( i == gbCurrSelect ) + ubFontColor = FONT_LTRED; + else if( i == gbCurrHilite ) + ubFontColor = FONT_YELLOW; + else + ubFontColor = FONT_WHITE; + DisplayWrappedString( (UINT16)xp, (UINT16)yp, 60, 2, SMALLCOMPFONT, ubFontColor, pItemName, 0, FALSE, LEFT_JUSTIFIED ); + } + } +} + +void DeleteSelectedMercsItem() +{ + if( gbCurrSelect != -1 ) + { + gusMercsNewItemIndex = 0; + AddNewItemToSelectedMercsInventory( TRUE ); + } +} + +//This function does two main things: +// 1) Allows a new item to be created via usItem and assigned to the currently selected merc. +// 2) Converts the image from interface size to the smaller panel used by the editor. The slots +// in the editor are approximately 80% of that size. This involves scaling calculations. These +// images are saved in individual slots are are blitted to the screen during rendering, not here. +// NOTE: Step one can be skipped (when selecting an existing merc). By setting the +void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ) +{ + UINT32 uiVideoObjectIndex; + UINT32 uiSrcID, uiDstID; + HVOBJECT hVObject; + ETRLEObject *pObject; + INVTYPE *item; + SGPRect SrcRect, DstRect; + INT32 iSrcWidth, iSrcHeight; + INT32 iDstWidth, iDstHeight; + float rScalar, rWidthScalar, rHeightScalar; + BOOLEAN fUnDroppable; + + if( fCreate ) + { + /* + if( gpMercSlotItem[ gbCurrSelect ] && gpMercSlotItem[ gbCurrSelect ]->usItem == gusMercsNewItemIndex ) + { //User selected same item, so ignore. + gusMercsNewItemIndex = 0xffff; + return; + } + */ + if( gusMercsNewItemIndex == 0xffff ) + { //User selected no item, so ignore. + return; + } + //Create the item, and set up the slot. + fUnDroppable = gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].fFlags & OBJECT_UNDROPPABLE ? TRUE : FALSE; + + if ( Item[ gusMercsNewItemIndex ].usItemClass == IC_KEY ) + { + CreateKeyObject( &gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ], 1, (UINT8) eInfo.sSelItemIndex ); + } + else + { + CreateItem( gusMercsNewItemIndex, 100, &gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ] ); + } + if( fUnDroppable ) + { + gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].fFlags |= OBJECT_UNDROPPABLE; + } + + //randomize the status on non-ammo items. + if( !(Item[ gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].usItem ].usItemClass & IC_AMMO) ) + gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].bStatus[0] = (INT8)(80 + Random( 21 )); + + if( gusMercsNewItemIndex ) + { + gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ].fFlags |= OBJECT_NO_OVERWRITE; + } + } + //allow the slot to point to the selected merc's inventory for editing/rendering purposes. + gpMercSlotItem[ gbCurrSelect ] = &gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ gbCurrSelect ] ]; + + if( !fCreate ) + { //it is possible to have a null item which we don't want to blit! Also, we need to set the + //new item index, so that it can extract the item's image using that. + gusMercsNewItemIndex = gpMercSlotItem[ gbCurrSelect ]->usItem; + if( !gpMercSlotItem[ gbCurrSelect ] ) + return; + } + //GOAL: + //From here on, we are going to first render the new item into a temp buffer, then crop the image in + //the buffer and scale it down to fit into it's associated slot in the panel (which on average will + //require scaling the item by 80%). We have to do a bunch of calculations to override the offsets, etc. + //Each slot has it's own smaller version buffer, and this is what gets drawn when the rendering happens. + + //assign the buffers + uiSrcID = guiMercTempBuffer; + uiDstID = guiMercInvPanelBuffers[ gbCurrSelect ]; + + //build the rects + iDstWidth = gbCurrSelect < 3 ? MERCINV_SMSLOT_WIDTH : MERCINV_LGSLOT_WIDTH; + iDstHeight = MERCINV_SLOT_HEIGHT; + SrcRect.iLeft = 0; + SrcRect.iTop = 0; + SrcRect.iRight = 60; + SrcRect.iBottom = 25; + DstRect.iLeft = 0; + DstRect.iTop = 0; + DstRect.iRight = iDstWidth; + DstRect.iBottom = iDstHeight; + + //clear both buffers (fill with black to erase previous graphic) + ColorFillVideoSurfaceArea( uiSrcID, SrcRect.iLeft, SrcRect.iTop, SrcRect.iRight, SrcRect.iBottom, 0 ); + ColorFillVideoSurfaceArea( uiDstID, DstRect.iLeft, DstRect.iTop, DstRect.iRight, DstRect.iBottom, 0 ); + + //if the index is 0, then there is no item. + if( !gusMercsNewItemIndex ) + return; + + //now draw the fullsize item into the temp buffer + item = &Item[ gusMercsNewItemIndex ]; + uiVideoObjectIndex = GetInterfaceGraphicForItem( item ); + GetVideoObject( &hVObject, uiVideoObjectIndex ); + BltVideoObjectOutlineFromIndex( uiSrcID, uiVideoObjectIndex, item->ubGraphicNum, 0, 0, 0, FALSE ); + + //crop the source image + pObject = &hVObject->pETRLEObject[ item->ubGraphicNum ]; + iSrcWidth = pObject->usWidth; + iSrcHeight = pObject->usHeight; + SrcRect.iLeft += pObject->sOffsetX; + SrcRect.iRight = SrcRect.iLeft + iSrcWidth; + SrcRect.iTop += pObject->sOffsetY; + SrcRect.iBottom = SrcRect.iTop + iSrcHeight; + + //if the source image width is less than 30 (small slot), then modify the DstRect. + if( iSrcWidth < 30 ) + iDstWidth = MERCINV_SMSLOT_WIDTH; + else + iDstWidth = MERCINV_LGSLOT_WIDTH; + + //compare the sizes of the cropped image to the destination buffer size, and calculate the + //scalar value. It is possible to have scalars > 1.0, in which case, we change it to 1.0 and + //use the other value. + rWidthScalar = (float)iDstWidth/(float)iSrcWidth; + if( rWidthScalar > 1.0 ) + rWidthScalar = 1.0; + rHeightScalar = (float)iDstHeight/(float)iSrcHeight; + if( rHeightScalar > 1.0 ) + rHeightScalar = 1.0; + + //determine which scalar to use. + if( rWidthScalar == 1.0 ) + rScalar = rHeightScalar; + else if( rHeightScalar == 1.0 ) + rScalar = rWidthScalar ; + else + rScalar = max( rWidthScalar, rHeightScalar ); + + //apply the scalar to the destination width and height + iDstWidth = (INT32)( iSrcWidth * rScalar ); + iDstHeight = (INT32)( iSrcHeight * rScalar ); + + //sometimes it is possible to scale too big, so clip if applicable + if( iDstWidth > MERCINV_LGSLOT_WIDTH ) + iDstWidth = MERCINV_LGSLOT_WIDTH; + else if( gbCurrSelect < 3 && iDstWidth > MERCINV_SMSLOT_WIDTH ) + iDstWidth = MERCINV_SMSLOT_WIDTH; + if( iDstHeight > MERCINV_SLOT_HEIGHT ) + iDstHeight = MERCINV_SLOT_HEIGHT; + + //use the new width and height values to calculate the new dest rect (center the item) + DstRect.iLeft = (DstRect.iRight - DstRect.iLeft - iDstWidth) / 2; + DstRect.iRight = DstRect.iLeft + iDstWidth; + DstRect.iTop = (DstRect.iBottom - DstRect.iTop - iDstHeight) / 2; + DstRect.iBottom = DstRect.iTop + iDstHeight; + + //scale the item down to the smaller buffer. + BltStretchVideoSurface( uiDstID, uiSrcID, 0, 0, VO_BLT_SRCTRANSPARENCY, &SrcRect, &DstRect ); + + //invalidate the mercs new item index + gusMercsNewItemIndex = 0xffff; +} + +void RenderMercInventoryPanel() +{ + INT32 x; + //Draw the graphical panel + BltVideoObjectFromIndex( FRAME_BUFFER, guiMercInventoryPanel, 0, MERCPANEL_X, MERCPANEL_Y, VO_BLT_SRCTRANSPARENCY, NULL ); + //Mark the buttons dirty, so they don't disappear. + for( x = FIRST_MERCS_INVENTORY_BUTTON; x <= LAST_MERCS_INVENTORY_BUTTON; x++ ) + { + MarkAButtonDirty( iEditorButton[ x ] ); + } + RenderButtons(); + if( gbCurrHilite != -1 ) + DrawRect( &mercRects[ gbCurrHilite ], Get16BPPColor( FROMRGB( 200, 200, 0 ) ) ); + if( gbCurrSelect != -1 ) + DrawRect( &mercRects[ gbCurrSelect ], Get16BPPColor( FROMRGB( 200, 0, 0 ) ) ); + RenderSelectedMercsInventory(); + InvalidateRegion( MERCPANEL_X, MERCPANEL_Y, 475, 460 ); + UpdateItemStatsPanel(); +} + + +//This function is called by the move and click callback functions for the region blanketing the +//9 slots in the inventory panel. It passes the event type as well as the relative x and y positions +//which are processed here. This basically checks for new changes in hilighting and selections, which +//will set the rendering flag, and getitem flag if the user wishes to choose an item. +void HandleMercInventoryPanel( INT16 sX, INT16 sY, INT8 bEvent ) +{ + INT8 x; + if( !gfCanEditMercs && bEvent == GUI_RCLICK_EVENT ) + { //if we are dealing with a profile merc, we can't allow editing + //of items, but we can look at them. So, treat all right clicks + //as if they were left clicks. + bEvent = GUI_LCLICK_EVENT; + } + switch( bEvent ) + { + case GUI_MOVE_EVENT: + //user is moving the mouse around the panel, so determine which slot + //needs to be hilighted yellow. + for( x = 0; x < 9; x++ ) + { + if( PointInRect( &mercRects[x], sX, sY ) ) + { + if( gbCurrHilite != x ) //only render if the slot isn't the same one. + gfRenderMercInfo = TRUE; + gbCurrHilite = x; + return; + } + } + //if we don't find a valid slot, then we need to turn it off. + if( gbCurrHilite != -1 ) + { //only turn off if it isn't already off. This avoids unecessary rendering. + gbCurrHilite = -1; + gfRenderMercInfo = TRUE; + } + break; + case GUI_LCLICK_EVENT: + case GUI_RCLICK_EVENT: + //The user has clicked in the inventory panel. Determine if he clicked in + //a slot. Left click selects the slot for editing, right clicking enables + //the user to choose an item for that slot. + for( x = 0; x < 9; x++ ) + { + if( PointInRect( &mercRects[x], sX, sY ) ) + { + if( gbCurrSelect != x ) //only if it isn't the same slot. + { + gfRenderMercInfo = TRUE; + if( bEvent == GUI_LCLICK_EVENT ) + SpecifyItemToEdit( gpMercSlotItem[ x ], -1 ); + } + if( bEvent == GUI_RCLICK_EVENT ) //user r-clicked, so enable item choosing + gfMercGetItem = TRUE; + gbCurrSelect = x; + return; + } + } + break; + } +} + +void UpdateMercItemSlots() +{ + INT8 x; + if( !gpSelected->pDetailedPlacement ) + { + for( x = 0; x < 9; x++ ) + { + gpMercSlotItem[ x ] = NULL; + } + } + else + { + if( gpSelected->pDetailedPlacement->ubProfile != NO_PROFILE ) + { + memcpy( gpSelected->pDetailedPlacement->Inv, gpSelected->pSoldier->inv, sizeof( OBJECTTYPE ) * NUM_INV_SLOTS ); + } + for( x = 0; x < 9; x++ ) + { + //Set the curr select and the addnewitem function will handle the rest, including rebuilding + //the nine slot buffers, etc. + gbCurrSelect = x; + AddNewItemToSelectedMercsInventory( FALSE ); + } + } + SetDroppableCheckboxesBasedOnMercsInventory(); + SpecifyItemToEdit( NULL, -1 ); + gbCurrSelect = -1; + gbCurrHilite = -1; +} + +void SetDroppableCheckboxesBasedOnMercsInventory() +{ + OBJECTTYPE *pItem; + INT32 i; + if( gpSelected && gpSelected->pDetailedPlacement ) + { + for( i = 0; i < 9; i++ ) + { + pItem = &gpSelected->pDetailedPlacement->Inv[ gbMercSlotTypes[ i ] ]; + if( pItem->fFlags & OBJECT_UNDROPPABLE ) + { //check box is clear + UnclickEditorButton( MERCS_HEAD_SLOT + i ); + } + else + { + ClickEditorButton( MERCS_HEAD_SLOT + i ); + } + } + } +} + +void SetEnemyColorCode( UINT8 ubColorCode ) +{ + if( gpSelected->pDetailedPlacement && gpSelected->pDetailedPlacement->ubProfile != NO_PROFILE ) + return; + + UnclickEditorButtons( FIRST_MERCS_COLORCODE_BUTTON, LAST_MERCS_COLORCODE_BUTTON ); + switch( ubColorCode ) + { + case SOLDIER_CLASS_ARMY: + gpSelected->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ARMY; + gubSoldierClass = SOLDIER_CLASS_ARMY; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->ubSoldierClass = SOLDIER_CLASS_ARMY; + SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "REDVEST" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "GREENPANTS" ); + ClickEditorButton( MERCS_ARMY_CODE ); + break; + case SOLDIER_CLASS_ADMINISTRATOR: + gpSelected->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ADMINISTRATOR; + gubSoldierClass = SOLDIER_CLASS_ADMINISTRATOR; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->ubSoldierClass = SOLDIER_CLASS_ADMINISTRATOR; + ClickEditorButton( MERCS_ADMIN_CODE ); + SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "BLUEVEST" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "BLUEPANTS" ); + break; + case SOLDIER_CLASS_ELITE: + gpSelected->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ELITE; + gubSoldierClass = SOLDIER_CLASS_ELITE; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->ubSoldierClass = SOLDIER_CLASS_ELITE; + SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "BLACKSHIRT" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "BLACKPANTS" ); + ClickEditorButton( MERCS_ELITE_CODE ); + break; + case SOLDIER_CLASS_MINER: + //will probably never get called + gpSelected->pBasicPlacement->ubSoldierClass = SOLDIER_CLASS_ELITE; + gubSoldierClass = SOLDIER_CLASS_MINER; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->ubSoldierClass = SOLDIER_CLASS_ELITE; + SET_PALETTEREP_ID( gpSelected->pSoldier->VestPal, "greyVEST" ); + SET_PALETTEREP_ID( gpSelected->pSoldier->PantsPal, "BEIGEPANTS" ); + break; + + default: + return; + } + CreateSoldierPalettes( gpSelected->pSoldier ); +} + +void SetEnemyDroppableStatus( UINT32 uiSlot, BOOLEAN fDroppable ) +{ + if( gpSelected ) + { + if( fDroppable ) + { + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->Inv[ uiSlot ].fFlags &= (~OBJECT_UNDROPPABLE); + if( gpSelected->pSoldier ) + gpSelected->pSoldier->inv[ uiSlot ].fFlags &= (~OBJECT_UNDROPPABLE); + } + else + { + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->Inv[ uiSlot ].fFlags |= OBJECT_UNDROPPABLE; + if( gpSelected->pSoldier ) + gpSelected->pSoldier->inv[ uiSlot ].fFlags |= OBJECT_UNDROPPABLE; + } + } + if( gbCurrSelect != -1 && uiSlot == (UINT32)gbMercSlotTypes[ gbCurrSelect ] ) + { + if( gpMercSlotItem[ gbCurrSelect ]->usItem == NOTHING ) + SpecifyItemToEdit( gpMercSlotItem[ gbCurrSelect ], -1 ); + } +} + +void ChangeCivGroup( UINT8 ubNewCivGroup ) +{ + Assert( ubNewCivGroup < NUM_CIV_GROUPS ); + if( gubCivGroup == ubNewCivGroup ) + return; + gubCivGroup = ubNewCivGroup; + if( gpSelected && gpSelected->pSoldier ) + { + gpSelected->pBasicPlacement->ubCivilianGroup = gubCivGroup; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->ubCivilianGroup = gubCivGroup; + gpSelected->pSoldier->ubCivilianGroup = gubCivGroup; + } + //Adjust the text on the button + SpecifyButtonText( iEditorButton[ MERCS_CIVILIAN_GROUP ], gszCivGroupNames[ gubCivGroup ] ); +} + +void RenderMercStrings() +{ + SOLDIERTYPE *pSoldier; + INT16 sXPos, sYPos; + INT16 sX, sY; + UINT16 *pStr; + SOLDIERINITNODE *curr; + UINT16 str[50]; + + curr = gSoldierInitHead; + while( curr ) + { + if( curr->pSoldier && curr->pSoldier->bVisible == 1 ) + { //Render the health text + pSoldier = curr->pSoldier; + GetSoldierAboveGuyPositions( pSoldier, &sXPos, &sYPos, FALSE ); + // Display name + SetFont( TINYFONT1 ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( FONT_WHITE ); + if ( pSoldier->ubProfile != NO_PROFILE ) + { + FindFontCenterCoordinates( sXPos, sYPos, (INT16)(80 ), 1, pSoldier->name, TINYFONT1, &sX, &sY ); + if( sY < 352 ) + { + gprintfdirty( sX, sY, pSoldier->name ); + mprintf( sX, sY, pSoldier->name ); + } + sYPos += 10; + + pStr = GetSoldierHealthString( pSoldier ); + + SetFont( TINYFONT1 ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( FONT_RED ); + + FindFontCenterCoordinates( sXPos, sYPos, 80, 1, pStr, TINYFONT1, &sX, &sY ); + if( sY < 352 ) + { + gprintfdirty( sX, sY, pStr ); + mprintf( sX, sY, pStr ); + } + sYPos += 10; + + SetFontForeground( FONT_GRAY2 ); + swprintf( str, L"Slot #%d", pSoldier->ubID ); + FindFontCenterCoordinates( sXPos, sYPos, 80, 1, str, TINYFONT1, &sX, &sY ); + if( sY < 352 ) + { + gprintfdirty( sX, sY, str ); + mprintf( sX, sY, str ); + } + sYPos += 10; + } + else + { + pStr = GetSoldierHealthString( pSoldier ); + + SetFont( TINYFONT1 ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( FONT_RED ); + + FindFontCenterCoordinates( sXPos, sYPos, 80, 1, pStr, TINYFONT1, &sX, &sY ); + if( sY < 352 ) + { + gprintfdirty( sX, sY, pStr ); + mprintf( sX, sY, pStr ); + } + sYPos += 10; + + SetFontForeground( FONT_GRAY2 ); + swprintf( str, L"Slot #%d", pSoldier->ubID ); + FindFontCenterCoordinates( sXPos, sYPos, 80, 1, str, TINYFONT1, &sX, &sY ); + if( sY < 352 ) + { + gprintfdirty( sX, sY, str ); + mprintf( sX, sY, str ); + } + sYPos += 10; + } + if( curr->pBasicPlacement->bOrders == RNDPTPATROL || curr->pBasicPlacement->bOrders == POINTPATROL ) + { //make sure the placement has at least one waypoint. + if( !curr->pBasicPlacement->bPatrolCnt ) + { + if( GetJA2Clock() % 1000 < 500 ) + SetFontForeground( FONT_DKRED ); + else + SetFontForeground( FONT_RED ); + swprintf( str, L"Patrol orders with no waypoints" ); + FindFontCenterCoordinates( sXPos, sYPos, 80, 1, str, TINYFONT1, &sX, &sY ); + if( sY < 352 ) + { + gprintfdirty( sX, sY, str ); + mprintf( sX, sY, str ); + } + sYPos += 10; + } + } + else if( curr->pBasicPlacement->bPatrolCnt ) + { + if( GetJA2Clock() % 1000 < 500 ) + SetFontForeground( FONT_DKRED ); + else + SetFontForeground( FONT_RED ); + swprintf( str, L"Waypoints with no patrol orders" ); + FindFontCenterCoordinates( sXPos, sYPos, 80, 1, str, TINYFONT1, &sX, &sY ); + if( sY < 352 ) + { + gprintfdirty( sX, sY, str ); + mprintf( sX, sY, str ); + } + sYPos += 10; + } + } + curr = curr->next; + } + if( gubCurrMercMode == MERC_SCHEDULEMODE ) + { + RenderCurrentSchedule(); + } +} + +void SetMercTeamVisibility( INT8 bTeam, BOOLEAN fVisible ) +{ + SOLDIERINITNODE *curr; + INT8 bVisible; + curr = gSoldierInitHead; + bVisible = fVisible ? 1 : -1; + while( curr ) + { + if( curr->pBasicPlacement->bTeam == bTeam ) + { + if( curr->pSoldier ) + { + curr->pSoldier->bLastRenderVisibleValue = bVisible; + curr->pSoldier->bVisible = bVisible; + } + } + curr = curr->next; + } + if( gpSelected && gpSelected->pSoldier && gpSelected->pSoldier->bTeam == bTeam && !fVisible ) + { + IndicateSelectedMerc( SELECT_NO_MERC ); + } +} + +void DetermineScheduleEditability() +{ + INT32 i; + EnableEditorButtons( MERCS_SCHEDULE_ACTION1, MERCS_SCHEDULE_DATA4B ); + EnableTextFields( 1, 4 ); + for( i = 0; i < 4; i++ ) + { + switch( gCurrSchedule.ubAction[i] ) + { + case SCHEDULE_ACTION_NONE: + case SCHEDULE_ACTION_LEAVESECTOR: + EnableEditorButton( MERCS_SCHEDULE_ACTION1 + i ); + EnableEditorButton( MERCS_SCHEDULE_VARIANCE1 + i ); + HideEditorButton( MERCS_SCHEDULE_DATA1A + i ); + HideEditorButton( MERCS_SCHEDULE_DATA1B + i ); + break; + case SCHEDULE_ACTION_LOCKDOOR: + case SCHEDULE_ACTION_UNLOCKDOOR: + case SCHEDULE_ACTION_OPENDOOR: + case SCHEDULE_ACTION_CLOSEDOOR: + EnableEditorButton( MERCS_SCHEDULE_ACTION1 + i ); + EnableEditorButton( MERCS_SCHEDULE_VARIANCE1 + i ); + ShowEditorButton( MERCS_SCHEDULE_DATA1A + i ); + ShowEditorButton( MERCS_SCHEDULE_DATA1B + i ); + EnableEditorButton( MERCS_SCHEDULE_DATA1A + i ); + EnableEditorButton( MERCS_SCHEDULE_DATA1B + i ); + break; + case SCHEDULE_ACTION_GRIDNO: + case SCHEDULE_ACTION_ENTERSECTOR: + case SCHEDULE_ACTION_SLEEP: + EnableEditorButton( MERCS_SCHEDULE_ACTION1 + i ); + EnableEditorButton( MERCS_SCHEDULE_VARIANCE1 + i ); + ShowEditorButton( MERCS_SCHEDULE_DATA1A + i ); + HideEditorButton( MERCS_SCHEDULE_DATA1B + i ); + EnableEditorButton( MERCS_SCHEDULE_DATA1A + i ); + break; + case SCHEDULE_ACTION_STAYINSECTOR: + DisableTextField( (UINT8)(i+1) ); + EnableEditorButton( MERCS_SCHEDULE_ACTION1 + i ); + DisableEditorButton( MERCS_SCHEDULE_VARIANCE1 + i ); + HideEditorButton( MERCS_SCHEDULE_DATA1A + i ); + HideEditorButton( MERCS_SCHEDULE_DATA1B + i ); + break; + } + } +} + +void CancelCurrentScheduleAction() +{ + UpdateScheduleAction( SCHEDULE_ACTION_NONE ); + DetermineScheduleEditability(); +} + +void RegisterCurrentScheduleAction( INT32 iMapIndex ) +{ + UINT16 str[6]; + MarkWorldDirty(); + swprintf( str, L"%d", iMapIndex ); + if( gfUseScheduleData2 ) + { + if( gfSingleAction ) + return; + iDrawMode = DRAW_MODE_PLAYER + gpSelected->pBasicPlacement->bTeam; + gCurrSchedule.usData2[ gubCurrentScheduleActionIndex ] = (UINT16)iMapIndex; + SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_DATA1B + gubCurrentScheduleActionIndex ], str ); + DetermineScheduleEditability(); + gubScheduleInstructions = SCHEDULE_INSTRUCTIONS_NONE; + gfRenderTaskbar = TRUE; + gfUseScheduleData2 = FALSE; + } + else + { + switch( gCurrSchedule.ubAction[ gubCurrentScheduleActionIndex ] ) + { + case SCHEDULE_ACTION_LOCKDOOR: + case SCHEDULE_ACTION_UNLOCKDOOR: + case SCHEDULE_ACTION_OPENDOOR: + case SCHEDULE_ACTION_CLOSEDOOR: + if( gfSingleAction ) + { + gfSingleAction = FALSE; + gubScheduleInstructions = SCHEDULE_INSTRUCTIONS_NONE; + gfRenderTaskbar = TRUE; + DetermineScheduleEditability(); + break; + } + DisableEditorButton( MERCS_SCHEDULE_DATA1A + gubCurrentScheduleActionIndex ); + EnableEditorButton( MERCS_SCHEDULE_DATA1B + gubCurrentScheduleActionIndex ); + gfUseScheduleData2 = TRUE; + iDrawMode = DRAW_MODE_SCHEDULEACTION; + gubScheduleInstructions = SCHEDULE_INSTRUCTIONS_DOOR2; + gfRenderTaskbar = TRUE; + break; + case SCHEDULE_ACTION_GRIDNO: + case SCHEDULE_ACTION_ENTERSECTOR: + case SCHEDULE_ACTION_SLEEP: + iDrawMode = DRAW_MODE_PLAYER + gpSelected->pBasicPlacement->bTeam; + DetermineScheduleEditability(); + gubScheduleInstructions = SCHEDULE_INSTRUCTIONS_NONE; + gfRenderTaskbar = TRUE; + break; + case SCHEDULE_ACTION_LEAVESECTOR: + case SCHEDULE_ACTION_STAYINSECTOR: + case SCHEDULE_ACTION_NONE: + break; + } + gCurrSchedule.usData1[ gubCurrentScheduleActionIndex ] = (UINT16)iMapIndex; + SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_DATA1A + gubCurrentScheduleActionIndex ], str ); + } +} + +void StartScheduleAction() +{ + switch( gCurrSchedule.ubAction[ gubCurrentScheduleActionIndex ] ) + { + case SCHEDULE_ACTION_NONE: + EnableEditorButtons( MERCS_SCHEDULE_ACTION1, MERCS_SCHEDULE_DATA4B ); + EnableTextFields( 1, 4 ); + gubScheduleInstructions = SCHEDULE_INSTRUCTIONS_NONE; + gfRenderTaskbar = TRUE; + gCurrSchedule.usData1[ gubCurrentScheduleActionIndex ] = 0xffff; + gCurrSchedule.usData2[ gubCurrentScheduleActionIndex ] = 0xffff; + break; + case SCHEDULE_ACTION_LOCKDOOR: + case SCHEDULE_ACTION_UNLOCKDOOR: + case SCHEDULE_ACTION_OPENDOOR: + case SCHEDULE_ACTION_CLOSEDOOR: + //First disable everything -- its easier that way. + ShowEditorButton( MERCS_SCHEDULE_DATA1A + gubCurrentScheduleActionIndex ); + ShowEditorButton( MERCS_SCHEDULE_DATA1B + gubCurrentScheduleActionIndex ); + DisableEditorButtons( MERCS_SCHEDULE_ACTION1, MERCS_SCHEDULE_DATA4B ); + DisableTextFields( 1, 4 ); + EnableEditorButton( MERCS_SCHEDULE_DATA1A + gubCurrentScheduleActionIndex ); + gfUseScheduleData2 = FALSE; + iDrawMode = DRAW_MODE_SCHEDULEACTION; + gubScheduleInstructions = SCHEDULE_INSTRUCTIONS_DOOR1; + gfRenderTaskbar = TRUE; + break; + case SCHEDULE_ACTION_GRIDNO: + case SCHEDULE_ACTION_ENTERSECTOR: + case SCHEDULE_ACTION_SLEEP: + ShowEditorButton( MERCS_SCHEDULE_DATA1A + gubCurrentScheduleActionIndex ); + HideEditorButton( MERCS_SCHEDULE_DATA1B + gubCurrentScheduleActionIndex ); + DisableEditorButtons( MERCS_SCHEDULE_ACTION1, MERCS_SCHEDULE_DATA4B ); + DisableTextFields( 1, 4 ); + EnableEditorButton( MERCS_SCHEDULE_DATA1A + gubCurrentScheduleActionIndex ); + gfUseScheduleData2 = FALSE; + iDrawMode = DRAW_MODE_SCHEDULEACTION; + gubScheduleInstructions = SCHEDULE_INSTRUCTIONS_GRIDNO; + gfRenderTaskbar = TRUE; + gCurrSchedule.usData2[ gubCurrentScheduleActionIndex ] = 0xffff; + break; + case SCHEDULE_ACTION_LEAVESECTOR: + case SCHEDULE_ACTION_STAYINSECTOR: + gubScheduleInstructions = SCHEDULE_INSTRUCTIONS_NONE; + gfRenderTaskbar = TRUE; + gCurrSchedule.usData1[ gubCurrentScheduleActionIndex ] = 0xffff; + gCurrSchedule.usData2[ gubCurrentScheduleActionIndex ] = 0xffff; + break; + } + MarkWorldDirty(); +} + +void UpdateScheduleAction( UINT8 ubNewAction ) +{ + gCurrSchedule.ubAction[ gubCurrentScheduleActionIndex ] = ubNewAction; + SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_ACTION1 + gubCurrentScheduleActionIndex ], + gszScheduleActions[ ubNewAction ] ); + MSYS_SetBtnUserData( iEditorButton[ MERCS_SCHEDULE_ACTION1 + gubCurrentScheduleActionIndex ], 0, ubNewAction ); + //Now, based on this action, disable the other buttons + StartScheduleAction(); + gfSingleAction = FALSE; +} + +// 0:1A, 1:1B, 2:2A, 3:2B, ... +void FindScheduleGridNo( UINT8 ubScheduleData ) +{ + INT32 iMapIndex; + switch( ubScheduleData ) + { + case 0: //1a + iMapIndex = gCurrSchedule.usData1[0]; + break; + case 1: //1b + iMapIndex = gCurrSchedule.usData2[0]; + break; + case 2: //2a + iMapIndex = gCurrSchedule.usData1[1]; + break; + case 3: //2b + iMapIndex = gCurrSchedule.usData2[1]; + break; + case 4: //3a + iMapIndex = gCurrSchedule.usData1[2]; + break; + case 5: //3b + iMapIndex = gCurrSchedule.usData2[2]; + break; + case 6: //4a + iMapIndex = gCurrSchedule.usData1[3]; + break; + case 7: //4b + iMapIndex = gCurrSchedule.usData2[3]; + break; + default: + AssertMsg( 0, "FindScheduleGridNo passed incorrect dataID." ); + } + if( iMapIndex != 0xffff ) + { + CenterScreenAtMapIndex( iMapIndex ); + } +} + +void ClearCurrentSchedule() +{ + UINT8 i; + memset( &gCurrSchedule, 0, sizeof( SCHEDULENODE ) ); + for( i = 0; i < 4; i++ ) + { + MSYS_SetBtnUserData( iEditorButton[ MERCS_SCHEDULE_ACTION1 + i ], 0, 0 ); + SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_ACTION1 + i ], L"No action" ); + gCurrSchedule.usTime[i] = 0xffff; + SetExclusive24HourTimeValue( (UINT8)(i+1), gCurrSchedule.usTime[ i ] ); //blanks the field + gCurrSchedule.usData1[i] = 0xffff; + SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_DATA1A + i ], L"" ); + gCurrSchedule.usData2[i] = 0xffff; + SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_DATA1B + i ], L"" ); + } + //Remove the variance stuff + gCurrSchedule.usFlags = 0; + UnclickEditorButtons( MERCS_SCHEDULE_VARIANCE1, MERCS_SCHEDULE_VARIANCE4 ); + + gubCurrentScheduleActionIndex = 0; + DetermineScheduleEditability(); + gfRenderTaskbar = TRUE; + MarkWorldDirty(); +} + +void RenderCurrentSchedule() +{ + FLOAT dOffsetX, dOffsetY; + FLOAT ScrnX, ScrnY; + INT32 i; + INT32 iMapIndex; + INT16 sXMapPos, sYMapPos; + INT16 sScreenX, sScreenY; + INT16 sX, sY; + UINT16 str[ 3 ]; + for( i = 0; i < 8; i++ ) + { + if( i % 2 ) + iMapIndex = gCurrSchedule.usData2[ i / 2 ]; + else + iMapIndex = gCurrSchedule.usData1[ i / 2 ]; + + if( iMapIndex == 0xffff ) + continue; + + // Convert it's location to screen coordinates + ConvertGridNoToXY( (INT16)iMapIndex, &sXMapPos, &sYMapPos ); + + dOffsetX = (FLOAT)(sXMapPos * CELL_X_SIZE) - gsRenderCenterX; + dOffsetY = (FLOAT)(sYMapPos * CELL_Y_SIZE) - gsRenderCenterY; + + FloatFromCellToScreenCoordinates( dOffsetX, dOffsetY, &ScrnX, &ScrnY); + + sScreenX = ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ) + (INT16)ScrnX; + sScreenY = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) + (INT16)ScrnY; + + // Adjust for tiles height factor! + sScreenY -= gpWorldLevelData[ iMapIndex ].sHeight; + // Bring it down a touch + sScreenY += 5; + + if( sScreenY <= 355 ) + { + // Shown it on screen! + SetFont(TINYFONT1); + SetFontBackground( FONT_LTKHAKI ); + SetFontForeground( FONT_WHITE ); + swprintf( str, L"%d%c", i/2 + 1, 'A' + (i%2) ); + VarFindFontCenterCoordinates( sScreenX, sScreenY, 1, 1, TINYFONT1, &sX, &sY, str ); + mprintf( sX, sY, str ); + } + } +} + +void UpdateScheduleInfo() +{ + INT32 i; + SCHEDULENODE *pSchedule; + UINT16 str[6]; + if( gpSelected->pSoldier->ubScheduleID ) + { + pSchedule = GetSchedule( gpSelected->pSoldier->ubScheduleID ); + if( !pSchedule ) + { + return; + } + for( i = 0; i < 4; i++ ) + { //Update the text and buttons + MSYS_SetBtnUserData( iEditorButton[ MERCS_SCHEDULE_ACTION1 + i ], 0, pSchedule->ubAction[i] ); + SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_ACTION1 + i ], gszScheduleActions[ pSchedule->ubAction[i] ] ); + swprintf( str, L"" ); + if( pSchedule->usData1[i] != 0xffff ) + swprintf( str, L"%d", pSchedule->usData1[i] ); + SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_DATA1A + i ], str ); + swprintf( str, L"" ); + if( pSchedule->usData2[i] != 0xffff ) + swprintf( str, L"%d", pSchedule->usData2[i] ); + SpecifyButtonText( iEditorButton[ MERCS_SCHEDULE_DATA1B + i ], str ); + if( gubCurrMercMode == MERC_SCHEDULEMODE ) + { //Update the text input fields too! + SetExclusive24HourTimeValue( (UINT8)(i+1), pSchedule->usTime[i] ); + } + } + + //Check or uncheck the checkbox buttons based on the schedule's status. + UnclickEditorButtons( MERCS_SCHEDULE_VARIANCE1, MERCS_SCHEDULE_VARIANCE4 ); + if( pSchedule->usFlags & SCHEDULE_FLAGS_VARIANCE1 ) + ClickEditorButton( MERCS_SCHEDULE_VARIANCE1 ); + if( pSchedule->usFlags & SCHEDULE_FLAGS_VARIANCE2 ) + ClickEditorButton( MERCS_SCHEDULE_VARIANCE2 ); + if( pSchedule->usFlags & SCHEDULE_FLAGS_VARIANCE3 ) + ClickEditorButton( MERCS_SCHEDULE_VARIANCE3 ); + if( pSchedule->usFlags & SCHEDULE_FLAGS_VARIANCE4 ) + ClickEditorButton( MERCS_SCHEDULE_VARIANCE4 ); + + //Copy the schedule over to the current global schedule used for editing purposes. + memcpy( &gCurrSchedule, pSchedule, sizeof( SCHEDULENODE ) ); + DetermineScheduleEditability(); + } + else + { + ClearCurrentSchedule(); + } +} + +BASIC_SOLDIERCREATE_STRUCT gSaveBufferBasicPlacement; +SOLDIERCREATE_STRUCT gSaveBufferDetailedPlacement; + +void CopyMercPlacement( INT32 iMapIndex ) +{ + if( gsSelectedMercID == -1 ) + { + ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, L"Placement not copied because no placement selected." ); + return; + } + gfSaveBuffer = TRUE; + memcpy( &gSaveBufferBasicPlacement, gpSelected->pBasicPlacement, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); + if( gSaveBufferBasicPlacement.fDetailedPlacement ) + { + memcpy( &gSaveBufferDetailedPlacement, gpSelected->pDetailedPlacement, sizeof( SOLDIERCREATE_STRUCT ) ); + } + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Placement copied." ); +} + +void PasteMercPlacement( INT32 iMapIndex ) +{ + SOLDIERTYPE *pSoldier; + SOLDIERCREATE_STRUCT tempDetailedPlacement; + INT32 i; + + if( !gfSaveBuffer ) + { + ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, L"Placement not pasted as no placement is saved in buffer." ); + return; + } + + memcpy( &gTempBasicPlacement, &gSaveBufferBasicPlacement, sizeof( BASIC_SOLDIERCREATE_STRUCT ) ); + + gTempBasicPlacement.bBodyType = -1; + + //calculate specific information based on the team. + switch( iDrawMode ) + { + case DRAW_MODE_ENEMY: + gTempBasicPlacement.bTeam = ENEMY_TEAM; + gTempBasicPlacement.bBodyType = RANDOM; + gTempBasicPlacement.ubSoldierClass = gubSoldierClass; + break; + case DRAW_MODE_CREATURE: + gTempBasicPlacement.bTeam = CREATURE_TEAM; + gTempBasicPlacement.bBodyType = gbCurrCreature; + break; + case DRAW_MODE_REBEL: + gTempBasicPlacement.bTeam = MILITIA_TEAM; + gTempBasicPlacement.bBodyType = RANDOM; + break; + case DRAW_MODE_CIVILIAN: + gTempBasicPlacement.bTeam = CIV_TEAM; + gTempBasicPlacement.bBodyType = RANDOM; + gTempBasicPlacement.ubCivilianGroup = gubCivGroup; + if( giCurrentTilesetID == 1 ) //caves + { + gTempBasicPlacement.ubSoldierClass = SOLDIER_CLASS_MINER; + } + break; + } + + if( IsLocationSittable( iMapIndex, gfRoofPlacement ) ) + { + UINT8 ubID; + INT16 sSectorX, sSectorY; + SOLDIERINITNODE *pNode; + + GetCurrentWorldSector( &sSectorX, &sSectorY ); + + //Set up some general information. + //gTempBasicPlacement.fDetailedPlacement = TRUE; + gTempBasicPlacement.usStartingGridNo = (UINT16)iMapIndex; + + //Generate detailed placement information given the temp placement information. + if( gTempBasicPlacement.fDetailedPlacement ) + { + memcpy( &gTempDetailedPlacement, &gSaveBufferDetailedPlacement, sizeof( SOLDIERCREATE_STRUCT ) ); + } + else + { + CreateDetailedPlacementGivenBasicPlacementInfo( &gTempDetailedPlacement, &gTempBasicPlacement ); + } + + //Set the sector information -- probably unnecessary. + gTempDetailedPlacement.sSectorX = sSectorX; + gTempDetailedPlacement.sSectorY = sSectorY; + + if( gTempBasicPlacement.fDetailedPlacement ) + { + CreateDetailedPlacementGivenStaticDetailedPlacementAndBasicPlacementInfo( &tempDetailedPlacement, &gTempDetailedPlacement, &gTempBasicPlacement ); + } + else + { + memcpy( &tempDetailedPlacement, &gTempDetailedPlacement, sizeof( SOLDIERCREATE_STRUCT ) ); + } + + //Create the soldier, but don't place it yet. + if ( pSoldier = TacticalCreateSoldier( &tempDetailedPlacement, &ubID ) ) + { + pSoldier->bVisible = 1; + pSoldier->bLastRenderVisibleValue = 1; + //Set up the soldier in the list, so we can track the soldier in the + //future (saving, loading, strategic AI) + pNode = AddBasicPlacementToSoldierInitList( &gTempBasicPlacement ); + Assert( pNode ); + pNode->pSoldier = pSoldier; + if( gSaveBufferBasicPlacement.fDetailedPlacement ) + { //Add the static detailed placement information in the same newly created node as the basic placement. + //read static detailed placement from file + //allocate memory for new static detailed placement + gTempBasicPlacement.fDetailedPlacement = TRUE; + gTempBasicPlacement.fPriorityExistance = gSaveBufferBasicPlacement.fPriorityExistance; + pNode->pDetailedPlacement = (SOLDIERCREATE_STRUCT*)MemAlloc( sizeof( SOLDIERCREATE_STRUCT ) ); + if( !pNode->pDetailedPlacement ) + { + AssertMsg( 0, "Failed to allocate memory for new detailed placement in PasteMercPlacement." ); + return; + } + //copy the file information from temp var to node in list. + memcpy( pNode->pDetailedPlacement, &gSaveBufferDetailedPlacement, sizeof( SOLDIERCREATE_STRUCT ) ); + } + + //Add the soldier to physically appear on the map now. + InternalAddSoldierToSector( ubID, FALSE, FALSE, 0, 0 ); + IndicateSelectedMerc( ubID ); + + //Move him to the roof if intended and possible. + if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) ) + { + gpSelected->pBasicPlacement->fOnRoof = TRUE; + if( gpSelected->pDetailedPlacement ) + gpSelected->pDetailedPlacement->fOnRoof = TRUE; + SetSoldierHeight( gpSelected->pSoldier, 58.0 ); + } + UnclickEditorButtons( FIRST_MERCS_INVENTORY_BUTTON, LAST_MERCS_INVENTORY_BUTTON ); + for( i = FIRST_MERCS_INVENTORY_BUTTON; i <= LAST_MERCS_INVENTORY_BUTTON; i++ ) + { + SetEnemyDroppableStatus( gbMercSlotTypes[i-FIRST_MERCS_INVENTORY_BUTTON], FALSE ); + } + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Placement pasted." ); + } + else + { + ScreenMsg( FONT_MCOLOR_LTRED, MSG_INTERFACE, L"Placement not pasted as the maximum number of placements for this team is already used." ); + } + } +} + + +#endif + + + + + + diff --git a/Editor/EditorMercs.h b/Editor/EditorMercs.h new file mode 100644 index 00000000..65aea52a --- /dev/null +++ b/Editor/EditorMercs.h @@ -0,0 +1,156 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR + +#ifndef __EDITORMERCS_H +#define __EDITORMERCS_H + +//Merc editing modes. These are used to determine which buttons to show and hide. +enum +{ + MERC_NOMODE, //used for shutting down mercs tab, to extract any changed information + + MERC_GETITEMMODE, //when selecting a specific piece of inventory from inventorymode + + MERC_TEAMMODE, //selecting a team with no merc selected. + MERC_BASICMODE, //basic placement mode + + MERC_GENERALMODE, //detailed placement mode for general information and NPC info + MERC_ATTRIBUTEMODE, //detailed placement mode for specifying attributes + MERC_INVENTORYMODE, //detailed placement mode for specifying inventory + MERC_APPEARANCEMODE, //detailed placement mode for specifying appearance + MERC_PROFILEMODE, //specifying a valid profile index will generate the merc automatically. + MERC_SCHEDULEMODE, //specifying a schedule for that particular individual +}; + +extern UINT8 gubCurrMercMode, gubPrevMercMode; + +#define EDIT_NUM_COLORS 4 +#define EDIT_COLOR_HEAD 0 +#define EDIT_COLOR_PANTS 1 +#define EDIT_COLOR_SKIN 2 +#define EDIT_COLOR_VEST 3 +#define EDIT_MERC_NONE 0 +#define EDIT_MERC_DEC_STAT 1 +#define EDIT_MERC_INC_STAT 2 +#define EDIT_MERC_PREV_ORDER 3 +#define EDIT_MERC_NEXT_ORDER 4 +#define EDIT_MERC_PREV_ATT 5 +#define EDIT_MERC_NEXT_ATT 6 +#define EDIT_MERC_SET_DIR 7 +#define EDIT_MERC_FIND 8 +#define EDIT_MERC_DONE 9 +#define EDIT_MERC_TO_COLOR 10 +#define EDIT_MERC_TO_STATS 11 +#define EDIT_MERC_PREV_COLOR 12 +#define EDIT_MERC_NEXT_COLOR 13 + +#define NUM_MERC_BUTTONS 40 + +#define NUM_DIFF_LVLS 5 + +extern UINT16 *zDiffNames[NUM_DIFF_LVLS]; +extern INT16 sCurBaseDiff; +extern INT16 gsSelectedMercID; +extern INT16 gsSelectedMercGridNo; +extern UINT8 gubCurrMercMode; + +enum _ForUseWithIndicateSelectedMerc +{ + SELECT_NEXT_CREATURE = -7, + SELECT_NEXT_REBEL = -6, + SELECT_NEXT_CIV = -5, + SELECT_NEXT_ENEMY = -4, + SELECT_NEXT_TEAMMATE = -3, + SELECT_NEXT_MERC = -2, + SELECT_NO_MERC = -1 + // >= 0 select merc with matching ID +}; + +void IndicateSelectedMerc( INT16 sID ); + +void GameInitEditorMercsInfo(); +void GameShutdownEditorMercsInfo(); +void EntryInitEditorMercsInfo(); +void UpdateMercsInfo(); + +void ProcessMercEditing(); +void AddMercToWorld( INT32 iMapIndex ); +void HandleRightClickOnMerc( INT32 iMapIndex ); +void SetMercEditingMode( UINT8 ubNewMode ); + +void ResetAllMercPositions(); + +void EraseMercWaypoint(); +void AddMercWaypoint( UINT32 iMapIndex ); + +void SetEnemyColorCode( UINT8 ubColorCode ); + +void SpecifyEntryPoint( UINT32 iMapIndex ); + +//Modify stats of current soldiers +void SetMercOrders( INT8 bOrders ); +void SetMercAttitude( INT8 bAttitude ); +void SetMercDirection( INT8 bDirection ); +void SetMercRelativeEquipment( INT8 bLevel ); +void SetMercRelativeAttributes( INT8 bLevel ); + +void DeleteSelectedMerc(); + +void CreateEditMercWindow( void ); +void DisplayEditMercWindow( void ); +INT32 IsMercHere( INT32 iMapIndex ); + +void ExtractCurrentMercModeInfo( BOOLEAN fKillTextInputMode ); + +void SetMercEditability( BOOLEAN fEditable ); + +void HandleMercInventoryPanel( INT16 sX, INT16 sY, INT8 bEvent ); + +extern UINT16 gusMercsNewItemIndex; +extern BOOLEAN gfRenderMercInfo; + +void ChangeCivGroup( UINT8 ubNewCivGroup ); + +#define MERCINV_LGSLOT_WIDTH 48 +#define MERCINV_SMSLOT_WIDTH 24 +#define MERCINV_SLOT_HEIGHT 18 + +extern BOOLEAN gfRoofPlacement; + +extern void SetEnemyDroppableStatus( UINT32 uiSlot, BOOLEAN fDroppable ); + +void RenderMercStrings(); + +extern BOOLEAN gfShowPlayers; +extern BOOLEAN gfShowEnemies; +extern BOOLEAN gfShowCreatures; +extern BOOLEAN gfShowRebels; +extern BOOLEAN gfShowCivilians; +void SetMercTeamVisibility( INT8 bTeam, BOOLEAN fVisible ); + +extern UINT8 gubCurrentScheduleActionIndex; +extern BOOLEAN gfSingleAction; +extern BOOLEAN gfUseScheduleData2; + +void UpdateScheduleAction( UINT8 ubNewAction ); +void FindScheduleGridNo( UINT8 ubScheduleData ); +void ClearCurrentSchedule(); +void CancelCurrentScheduleAction(); +void RegisterCurrentScheduleAction( INT32 iMapIndex ); +void StartScheduleAction(); + +void InitDetailedPlacementForMerc(); +void KillDetailedPlacementForMerc(); + +void CopyMercPlacement( INT32 iMapIndex ); +void PasteMercPlacement( INT32 iMapIndex ); + +#endif +#endif + + + + + + diff --git a/Editor/EditorTerrain.cpp b/Editor/EditorTerrain.cpp new file mode 100644 index 00000000..8b71f681 --- /dev/null +++ b/Editor/EditorTerrain.cpp @@ -0,0 +1,284 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include + #include "tiledef.h" + #include "edit_sys.h" + #include "vsurface.h" + #include "vobject.h" + #include "mousesystem.h" + #include "Button System.h" + #include "wcheck.h" + #include "vsurface.h" + #include "input.h" + #include "sysutil.h" + #include "font.h" + #include "Font Control.h" + #include "editscreen.h" + #include "selectwin.h" + #include "video.h" + #include "vobject_blitters.h" + #include "interface panels.h" + #include "utilities.h" + #include "World Items.h" + #include "EditorDefines.h" + #include "EditorTerrain.h" + #include "Editor Taskbar Utils.h" + #include "Cursor Modes.h" + #include "english.h" +#endif + +BOOLEAN gfShowTerrainTileButtons; +UINT8 ubTerrainTileButtonWeight[NUM_TERRAIN_TILE_REGIONS]; +UINT16 usTotalWeight; +BOOLEAN fPrevShowTerrainTileButtons = TRUE; +BOOLEAN fUseTerrainWeights = FALSE; +INT32 TerrainTileSelected = 0, TerrainForegroundTile, TerrainBackgroundTile; +INT32 TerrainTileDrawMode = TERRAIN_TILES_NODRAW; + +void EntryInitEditorTerrainInfo() +{ + //ResetTerrainTileWeights(); + if( !fUseTerrainWeights ) + { + ResetTerrainTileWeights(); + } +} + +void ResetTerrainTileWeights() +{ + INT8 x; + for( x=0; x < NUM_TERRAIN_TILE_REGIONS; x++ ) + { + ubTerrainTileButtonWeight[x] = 0; + } + usTotalWeight = 0; + fUseTerrainWeights = FALSE; + gfRenderTaskbar = TRUE; +} + +void HideTerrainTileButtons() +{ + INT8 x; + if( gfShowTerrainTileButtons ) + { + for( x = BASE_TERRAIN_TILE_REGION_ID; x < NUM_TERRAIN_TILE_REGIONS; x++ ) + { + DisableEditorRegion( x ); + } + gfShowTerrainTileButtons=FALSE; + } +} + +void ShowTerrainTileButtons() +{ + INT8 x; + if( !gfShowTerrainTileButtons ) + { + for( x = BASE_TERRAIN_TILE_REGION_ID; x < NUM_TERRAIN_TILE_REGIONS; x++ ) + { + EnableEditorRegion( x ); + } + gfShowTerrainTileButtons=TRUE; + } +} + +void RenderTerrainTileButtons() +{ + // If needed, display the ground tile images + if(gfShowTerrainTileButtons) + { + UINT16 usFillColorDark, usFillColorLight, usFillColorRed; + UINT16 x, usX, usX2, usY, usY2; + + usFillColorDark = Get16BPPColor(FROMRGB(24, 61, 81)); + usFillColorLight = Get16BPPColor(FROMRGB(136, 138, 135)); + usFillColorRed = Get16BPPColor(FROMRGB(255, 0, 0)); + + usY = 369; + usY2 = 391; + + SetFont( SMALLCOMPFONT ); + SetFontForeground( FONT_YELLOW ); + + for( x = 0; x < NUM_TERRAIN_TILE_REGIONS; x++ ) + { + usX = 261 + (x * 42); + usX2 = usX + 42; + + if ( x == CurrentPaste && !fUseTerrainWeights ) + { + ColorFillVideoSurfaceArea(ButtonDestBuffer , usX, usY, usX2, usY2, usFillColorRed); + } + else + { + ColorFillVideoSurfaceArea(ButtonDestBuffer, usX, usY, usX2, usY2, usFillColorDark); + ColorFillVideoSurfaceArea(ButtonDestBuffer, usX + 1, usY + 1, usX2, usY2, usFillColorLight); + } + ColorFillVideoSurfaceArea(ButtonDestBuffer, usX + 1, usY + 1, usX2 - 1, usY2 - 1, 0); + + SetObjectShade( gTileDatabase[gTileTypeStartIndex[x]].hTileSurface, DEFAULT_SHADE_LEVEL ); + BltVideoObject(ButtonDestBuffer, gTileDatabase[gTileTypeStartIndex[x]].hTileSurface, 0, (usX + 1), (usY + 1), + VO_BLT_SRCTRANSPARENCY, NULL); + + if( fUseTerrainWeights ) + { + mprintf( usX+2, usY+2, L"%d", ubTerrainTileButtonWeight[ x ] ); + } + } + } +} + +//This callback is used for each of the terrain tile buttons. The userData[0] field +//contains the terrain button's index value. +void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + gfRenderTaskbar = TRUE; + TerrainTileSelected = MSYS_GetRegionUserData(reg,0); + if(TerrainTileDrawMode == TERRAIN_TILES_FOREGROUND ) + { + TerrainForegroundTile = TerrainTileSelected; + CurrentPaste = (UINT16)TerrainForegroundTile; + //iEditorToolbarState = TBAR_MODE_DRAW; + if( _KeyDown( SHIFT ) ) + { + fUseTerrainWeights = TRUE; + } + if( fUseTerrainWeights ) + { + //SHIFT+LEFTCLICK adds weight to the selected terrain tile. + if( ubTerrainTileButtonWeight[ TerrainTileSelected ] < 10 ) + { + ubTerrainTileButtonWeight[ TerrainTileSelected ]++; + usTotalWeight++; + } + } + else + { //Regular LEFTCLICK selects only that terrain tile. + //When total weight is 0, then the only selected tile is drawn. + ResetTerrainTileWeights(); + } + } + else if(TerrainTileDrawMode == TERRAIN_TILES_BACKGROUND ) + { + TerrainBackgroundTile = TerrainTileSelected; + iEditorToolbarState = TBAR_MODE_SET_BGRND; + } + } + if(reason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + gfRenderTaskbar = TRUE; + TerrainTileSelected = MSYS_GetRegionUserData( reg, 0 ); + if(TerrainTileDrawMode == TERRAIN_TILES_FOREGROUND ) + { + TerrainForegroundTile = TerrainTileSelected; + iEditorToolbarState = TBAR_MODE_DRAW; + if( ubTerrainTileButtonWeight[ TerrainTileSelected ] ) + { + ubTerrainTileButtonWeight[ TerrainTileSelected ]--; + usTotalWeight--; + } + } + } +} + +void ChooseWeightedTerrainTile() +{ + UINT16 x, usWeight; + INT16 sRandomNum; + if(!usTotalWeight) + { //Not in the weighted mode. CurrentPaste will already contain the selected tile. + return; + } + sRandomNum = rand() % usTotalWeight; + x = NUM_TERRAIN_TILE_REGIONS; + for( x = 0; x < NUM_TERRAIN_TILE_REGIONS; x++ ) + { + usWeight = ubTerrainTileButtonWeight[ x ]; + sRandomNum -= usWeight; + if( sRandomNum <= 0 && usWeight ) + { + CurrentPaste = x; + return; + } + } +} + + +UINT32 guiSearchType; +// TODO: change this variable name if not too time consuming (jonathanl) +extern UINT32 count; // symbol exist already in gamescreen.cpp, this is a REALLY bad global symbol name!!! (jonathanl) +UINT32 maxCount=0, calls=0; + +void Fill( INT32 x, INT32 y ) +{ + INT32 iMapIndex; + UINT32 uiCheckType; + + count++; + calls++; + + if( count > maxCount ) + maxCount = count; + + iMapIndex = y * WORLD_COLS + x; + if( !GridNoOnVisibleWorldTile( (INT16)iMapIndex ) ) + { + count--; + return; + } + GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex , &uiCheckType ); + if( guiSearchType == uiCheckType ) + PasteTextureCommon( iMapIndex ); + else + { + count--; + return; + } + + if( y > 0 ) + Fill( x, y-1 ); + if( y < WORLD_ROWS - 1 ) + Fill( x, y+1 ); + if( x > 0 ) + Fill( x-1, y ); + if( x < WORLD_COLS - 1 ) + Fill( x+1, y ); + count--; +} + + +void TerrainFill( UINT32 iMapIndex ) +{ + INT16 sX, sY; + //determine what we should be looking for to replace... + GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &guiSearchType ); + + //check terminating conditions + if( guiSearchType == CurrentPaste ) + return; + + ConvertGridNoToXY( (INT16)iMapIndex, &sX, &sY ); + + count = 0; + + Fill( sX, sY ); + +} + + +#endif + + + + + + diff --git a/Editor/EditorTerrain.h b/Editor/EditorTerrain.h new file mode 100644 index 00000000..f4def4fd --- /dev/null +++ b/Editor/EditorTerrain.h @@ -0,0 +1,43 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDITORTERRAIN_H +#define __EDITORTERRAIN_H + +#define TERRAIN_TILES_NODRAW 0 +#define TERRAIN_TILES_FOREGROUND 1 +#define TERRAIN_TILES_BACKGROUND 2 +//Andrew, could you figure out what the hell mode this is??? +//It somehow links terrain tiles with lights and buildings. +#define TERRAIN_TILES_BRETS_STRANGEMODE 3 + +//Soon to be added to an editor struct +extern UINT16 usTotalWeight; +extern BOOLEAN fPrevShowTerrainTileButtons; +extern BOOLEAN fUseTerrainWeights; +extern INT32 TerrainTileSelected, TerrainForegroundTile,TerrainBackgroundTile; +extern INT32 TerrainTileDrawMode; + +void EntryInitEditorTerrainInfo(); +void InitEditorTerrainToolbar(); +void CreateTerrainTileButtons(); +void DeleteTerrainTileButtons(); +void RenderTerrainTileButtons(); + +void ResetTerrainTileWeights(); +void ShowTerrainTileButtons(); +void HideTerrainTileButtons(); + +void ChooseWeightedTerrainTile(); + +void TerrainFill( UINT32 iMapIndex ); + +#endif + +#endif + + + + + + diff --git a/Editor/Item Statistics.cpp b/Editor/Item Statistics.cpp new file mode 100644 index 00000000..0bab0d90 --- /dev/null +++ b/Editor/Item Statistics.cpp @@ -0,0 +1,1541 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include + #include + #include "types.h" + #include "mousesystem.h" + #include "Button System.h" + #include "font control.h" + #include "EditorDefines.h" + #include "Editor Taskbar Utils.h" + #include "EditorMercs.h" + #include "EditorItems.h" + #include "Item Statistics.h" + #include "Text Input.h" + #include "Action Items.h" + #include "Item types.h" + #include "video.h" + #include "Simple Render Utils.h" + #include "Weapons.h" + #include "Items.h" + #include "editscreen.h" + #include "Random.h" + #include "Handle Items.h" + #include "World Items.h" + #include "PopupMenu.h" + #include "pits.h" +#endif + +INT32 giBothCheckboxButton = -1; +INT32 giRealisticCheckboxButton = -1; +INT32 giSciFiCheckboxButton = -1; +INT32 giAlarmTriggerButton = -1; +INT32 giOwnershipGroupButton = -1; + +UINT16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ] = +{ + L"Klaxon Mine", + L"Flare Mine", + L"Teargas Explosion", + L"Stun Explosion", + L"Smoke Explosion", + L"Mustard Gas", + L"Land Mine", + L"Open Door", + L"Close Door", + L"3x3 Hidden Pit", + L"5x5 Hidden Pit", + L"Small Explosion", + L"Medium Explosion", + L"Large Explosion", + L"Toggle Door", + L"Toggle Action1s", + L"Toggle Action2s", + L"Toggle Action3s", + L"Toggle Action4s", + L"Enter Brothel", + L"Exit Brothel", + L"Kingpin Alarm", + L"Sex with Prostitute", + L"Reveal Room", + L"Local Alarm", + L"Global Alarm", + L"Klaxon Sound", + L"Unlock door", + L"Toggle lock", + L"Untrap door", + L"Tog pressure items", + L"Museum alarm", + L"Bloodcat alarm", + L"Big teargas", +}; + +UINT16* GetActionItemName( OBJECTTYPE *pItem ) +{ + if( !pItem || pItem->usItem != ACTION_ITEM ) + return NULL; + if( pItem->bActionValue != ACTION_ITEM_BLOW_UP ) + { + switch( pItem->bActionValue ) + { + case ACTION_ITEM_OPEN_DOOR: return gszActionItemDesc[ ACTIONITEM_OPEN ]; + case ACTION_ITEM_CLOSE_DOOR: return gszActionItemDesc[ ACTIONITEM_CLOSE ]; + case ACTION_ITEM_SMALL_PIT: return gszActionItemDesc[ ACTIONITEM_SMPIT ]; + case ACTION_ITEM_LARGE_PIT: return gszActionItemDesc[ ACTIONITEM_LGPIT ]; + case ACTION_ITEM_TOGGLE_DOOR: return gszActionItemDesc[ ACTIONITEM_TOGGLE_DOOR ]; + case ACTION_ITEM_TOGGLE_ACTION1: return gszActionItemDesc[ ACTIONITEM_TOGGLE_ACTION1 ]; + case ACTION_ITEM_TOGGLE_ACTION2: return gszActionItemDesc[ ACTIONITEM_TOGGLE_ACTION2 ]; + case ACTION_ITEM_TOGGLE_ACTION3: return gszActionItemDesc[ ACTIONITEM_TOGGLE_ACTION3 ]; + case ACTION_ITEM_TOGGLE_ACTION4: return gszActionItemDesc[ ACTIONITEM_TOGGLE_ACTION4 ]; + case ACTION_ITEM_ENTER_BROTHEL: return gszActionItemDesc[ ACTIONITEM_ENTER_BROTHEL ]; + case ACTION_ITEM_EXIT_BROTHEL: return gszActionItemDesc[ ACTIONITEM_EXIT_BROTHEL ]; + case ACTION_ITEM_KINGPIN_ALARM: return gszActionItemDesc[ ACTIONITEM_KINGPIN_ALARM ]; + case ACTION_ITEM_SEX: return gszActionItemDesc[ ACTIONITEM_SEX ]; + case ACTION_ITEM_REVEAL_ROOM: return gszActionItemDesc[ ACTIONITEM_REVEAL_ROOM ]; + case ACTION_ITEM_LOCAL_ALARM: return gszActionItemDesc[ ACTIONITEM_LOCAL_ALARM ]; + case ACTION_ITEM_GLOBAL_ALARM: return gszActionItemDesc[ ACTIONITEM_GLOBAL_ALARM ]; + case ACTION_ITEM_KLAXON: return gszActionItemDesc[ ACTIONITEM_KLAXON ]; + case ACTION_ITEM_UNLOCK_DOOR: return gszActionItemDesc[ ACTIONITEM_UNLOCK_DOOR ]; + case ACTION_ITEM_TOGGLE_LOCK: return gszActionItemDesc[ ACTIONITEM_TOGGLE_LOCK ]; + case ACTION_ITEM_UNTRAP_DOOR: return gszActionItemDesc[ ACTIONITEM_UNTRAP_DOOR ]; + case ACTION_ITEM_TOGGLE_PRESSURE_ITEMS: return gszActionItemDesc[ ACTIONITEM_TOGGLE_PRESSURE_ITEMS ]; + case ACTION_ITEM_MUSEUM_ALARM: return gszActionItemDesc[ ACTIONITEM_MUSEUM_ALARM ]; + case ACTION_ITEM_BLOODCAT_ALARM: return gszActionItemDesc[ ACTIONITEM_BLOODCAT_ALARM ]; + default: return NULL; + } + } + else switch( pItem->usBombItem ) + { + case STUN_GRENADE: return gszActionItemDesc[ ACTIONITEM_STUN ]; + case SMOKE_GRENADE: return gszActionItemDesc[ ACTIONITEM_SMOKE ]; + case TEARGAS_GRENADE: return gszActionItemDesc[ ACTIONITEM_TEARGAS ]; + case MUSTARD_GRENADE: return gszActionItemDesc[ ACTIONITEM_MUSTARD ]; + case HAND_GRENADE: return gszActionItemDesc[ ACTIONITEM_SMALL ]; + case TNT: return gszActionItemDesc[ ACTIONITEM_MEDIUM ]; + case C4: return gszActionItemDesc[ ACTIONITEM_LARGE ]; + case MINE: return gszActionItemDesc[ ACTIONITEM_MINE ]; + case TRIP_FLARE: return gszActionItemDesc[ ACTIONITEM_FLARE ]; + case TRIP_KLAXON: return gszActionItemDesc[ ACTIONITEM_TRIP_KLAXON ]; + case BIG_TEAR_GAS: return gszActionItemDesc[ ACTIONITEM_BIG_TEAR_GAS ]; + default: return NULL; + } +} + +enum +{ + SILENCER_ATTACHMENT_BUTTON, + SNIPERSCOPE_ATTACHMENT_BUTTON, + LASERSCOPE_ATTACHMENT_BUTTON, + BIPOD_ATTACHMENT_BUTTON, + DUCKBILL_ATTACHMENT_BUTTON, + GLAUNCHER_ATTACHMENT_BUTTON, + NUM_ATTACHMENT_BUTTONS +}; +UINT32 guiAttachmentButton[ NUM_ATTACHMENT_BUTTONS ]; +BOOLEAN gfAttachment[ NUM_ATTACHMENT_BUTTONS ]; +void ToggleAttachment( GUI_BUTTON *btn, INT32 reason ); + +UINT32 guiCeramicPlatesButton; +BOOLEAN gfCeramicPlates; +void ToggleCeramicPlates( GUI_BUTTON *btn, INT32 reason ); + +UINT32 guiDetonatorButton; +BOOLEAN gfDetonator; +void ToggleDetonator( GUI_BUTTON *btn, INT32 reason ); + +UINT32 guiActionItemButton; +void ActionItemCallback( GUI_BUTTON *btn, INT32 reason ); +INT8 gbActionItemIndex = ACTIONITEM_MEDIUM; +INT8 gbDefaultBombTrapLevel = 9; + +void RemoveBombFromWorldByItemIndex( INT32 iItemIndex ); + +enum +{ + EDITING_NOTHING, + EDITING_NOT_YET_IMPLEMENTED, + EDITING_DROPPABLE, + EDITING_GUNS, + EDITING_AMMO, + EDITING_ARMOUR, + EDITING_EQUIPMENT, + EDITING_EXPLOSIVES, + EDITING_MONEY, + EDITING_ACTIONITEMS, + EDITING_TRIGGERS, + EDITING_KEYS, + EDITING_OWNERSHIP, +}; + +INT8 gbEditingMode = EDITING_NOTHING; + +OBJECTTYPE *gpItem = NULL; +BOOLEAN gfShowItemStatsPanel; +INT16 gsItemGridNo; + +ITEM_POOL *gpEditingItemPool = NULL; +extern ITEM_POOL *gpItemPool; + +void SetupGameTypeFlags(); +void RemoveGameTypeFlags(); + +void SetupGunGUI(); +void ExtractAndUpdateGunGUI(); +void RemoveGunGUI(); + +void SetupAmmoGUI(); +void ExtractAndUpdateAmmoGUI(); +void RemoveAmmoGUI(); + +void SetupArmourGUI(); +void ExtractAndUpdateArmourGUI(); +void RemoveArmourGUI(); + +void SetupEquipGUI(); +void ExtractAndUpdateEquipGUI(); +void RemoveEquipGUI(); + +void SetupExplosivesGUI(); +void ExtractAndUpdateExplosivesGUI(); +void RemoveExplosivesGUI(); + +void SetupTriggersGUI(); +void ExtractAndUpdateTriggersGUI(); +void RemoveTriggersGUI(); + +void SetupActionItemsGUI(); +void ExtractAndUpdateActionItemsGUI(); +void RemoveActionItemsGUI(); + +void SetupMoneyGUI(); +void ExtractAndUpdateMoneyGUI(); +void RemoveMoneyGUI(); + +void SetupOwnershipGUI(); +void ExtractAndUpdateOwnershipGUI(); +void RemoveOwnershipGUI(); +void OwnershipGroupButtonCallback( GUI_BUTTON *btn, INT32 reason ); + +void SetupKeysGUI(); +void ExtractAndUpdateKeysGUI(); +void RemoveKeysGUI(); + + +void ReEvaluateAttachmentStatii(); + +void ShowItemStatsPanel() +{ + ShowEditorButtons( FIRST_ITEMSTATS_BUTTON, LAST_ITEMSTATS_BUTTON ); + if( iCurrentTaskbar == TASK_MERCS || !gpItem ) + HideEditorButton( ITEMSTATS_HIDDEN_BTN ); + gfShowItemStatsPanel = TRUE; +} + +void HideItemStatsPanel() +{ + HideEditorButtons( FIRST_ITEMSTATS_BUTTON, LAST_ITEMSTATS_BUTTON ); + SpecifyItemToEdit( NULL, -1 ); + gfShowItemStatsPanel = FALSE; +} + +void EnableItemStatsPanel() +{ + +} + +void DisableItemStatsPanel() +{ + +} + +void ExecuteItemStatsCmd( UINT8 ubAction ) +{ + switch( ubAction ) + { + case ITEMSTATS_APPLY: + if( gpItem && gpItem->usItem == ACTION_ITEM ) + { + ExtractAndUpdateActionItemsGUI(); + } + else if( gpItem && gpItem->usItem == SWITCH ) + { + ExtractAndUpdateTriggersGUI(); + } + else if( gpItem && gpItem->usItem == OWNERSHIP ) + { + ExtractAndUpdateOwnershipGUI(); + } + else switch( gbEditingMode ) + { + case EDITING_GUNS: ExtractAndUpdateGunGUI(); break; + case EDITING_AMMO: ExtractAndUpdateAmmoGUI(); break; + case EDITING_ARMOUR: ExtractAndUpdateArmourGUI(); break; + case EDITING_EQUIPMENT: ExtractAndUpdateEquipGUI(); break; + case EDITING_EXPLOSIVES: ExtractAndUpdateExplosivesGUI(); break; + case EDITING_MONEY: ExtractAndUpdateMoneyGUI(); break; + case EDITING_KEYS: ExtractAndUpdateKeysGUI(); break; + } + SetActiveField( 0 ); + gfRenderTaskbar = TRUE; + break; + case ITEMSTATS_CANCEL: + SpecifyItemToEdit( gpItem, gsItemGridNo ); + SetActiveField( 0 ); + break; + case ITEMSTATS_DEFAULT: + break; + case ITEMSTATS_DELETE: + DeleteSelectedItem(); + break; + case ITEMSTATS_SHOW: + ShowSelectedItem(); + break; + case ITEMSTATS_HIDE: + HideSelectedItem(); + break; + } +} + +void RemoveItemGUI() +{ + if( !gpItem ) + return; + if( TextInputMode() ) + KillTextInputMode(); + HideEditorButton( ITEMSTATS_HIDDEN_BTN ); + RemoveGameTypeFlags(); + if( gpItem && gpItem->usItem == ACTION_ITEM ) + { + RemoveActionItemsGUI(); + } + else if( gpItem && gpItem->usItem == SWITCH ) + { + RemoveTriggersGUI(); + } + else if( gpItem && gpItem->usItem == OWNERSHIP ) + { + RemoveOwnershipGUI(); + } + else switch( gbEditingMode ) + { + case EDITING_GUNS: RemoveGunGUI(); break; + case EDITING_AMMO: RemoveAmmoGUI(); break; + case EDITING_ARMOUR: RemoveArmourGUI(); break; + case EDITING_EQUIPMENT: RemoveEquipGUI(); break; + case EDITING_EXPLOSIVES: RemoveExplosivesGUI(); break; + case EDITING_MONEY: RemoveMoneyGUI(); break; + case EDITING_KEYS: RemoveKeysGUI(); break; + } +} + +void SpecifyItemToEdit( OBJECTTYPE *pItem, INT32 iMapIndex ) +{ + //Set the global item pointer to point to the new item + if( gpItem == pItem ) + return; + if( gpItem != pItem ) + { + ExecuteItemStatsCmd( ITEMSTATS_APPLY ); + RemoveItemGUI(); + gpItem = pItem; + if( gpItemPool ) + { + gpEditingItemPool = gpItemPool; + } + gsItemGridNo = (INT16)iMapIndex; + } + else + RemoveItemGUI(); + + gfRenderTaskbar = TRUE; + + if( !gpItem ) + { + //Hide all edit features. + gbEditingMode = EDITING_NOTHING; + gsItemGridNo = -1; + return; + } + + //Setup the text mode + InitTextInputModeWithScheme( DEFAULT_SCHEME ); + + if( iCurrentTaskbar == TASK_ITEMS ) + ShowEditorButton( ITEMSTATS_HIDDEN_BTN ); + + //Determine the type of item so that we can determine the dynamic editing mode. + AddUserInputField( NULL ); + + SetupGameTypeFlags(); + + if( Item[ gpItem->usItem ].usItemClass == IC_MONEY ) + { + gbEditingMode = EDITING_MONEY; + SetupMoneyGUI(); + } + else if( gpItem->usItem == ACTION_ITEM ) + { + gbEditingMode = EDITING_ACTIONITEMS; + SetupActionItemsGUI(); + HideEditorButton( ITEMSTATS_HIDDEN_BTN ); + } + else if( gpItem->usItem == SWITCH ) + { + gbEditingMode = EDITING_TRIGGERS; + SetupTriggersGUI(); + HideEditorButton( ITEMSTATS_HIDDEN_BTN ); + } + else if( gpItem->usItem == OWNERSHIP ) + { + gbEditingMode = EDITING_OWNERSHIP; + SetupOwnershipGUI(); + HideEditorButton( ITEMSTATS_HIDDEN_BTN ); + } + else switch( Item[ gpItem->usItem ].usItemClass ) + { + case IC_GUN: + gbEditingMode = EDITING_GUNS; + SetupGunGUI(); + break; + case IC_AMMO: + gbEditingMode = EDITING_AMMO; + SetupAmmoGUI(); + break; + case IC_ARMOUR: + gbEditingMode = EDITING_ARMOUR; + SetupArmourGUI(); + break; + case IC_MEDKIT: + case IC_KIT: + case IC_MISC: + case IC_FACE: + case IC_BLADE: + case IC_LAUNCHER: + case IC_THROWING_KNIFE: + case IC_MONEY: + gbEditingMode = EDITING_EQUIPMENT; + SetupEquipGUI(); + break; + case IC_THROWN: + case IC_GRENADE: + case IC_EXPLOSV: + case IC_BOMB: + gbEditingMode = EDITING_EXPLOSIVES; + SetupExplosivesGUI(); + break; + case IC_KEY: + gbEditingMode = EDITING_KEYS; + SetupKeysGUI(); + break; + case IC_PUNCH: + if ( gpItem->usItem != NOTHING) + { + gbEditingMode = EDITING_EQUIPMENT; + SetupEquipGUI(); + break; + } + // else fall through and act as nothing + case IC_NONE: + gbEditingMode = EDITING_NOTHING; + if( !(gpItem->fFlags & OBJECT_UNDROPPABLE) ) + gbEditingMode = EDITING_DROPPABLE; + break; + default: + gbEditingMode = EDITING_NOT_YET_IMPLEMENTED; + break; + } + if( gpItemPool ) + { + if( gWorldItems[ gpItemPool->iItemIndex ].bVisible == INVISIBLE ) + { + UnclickEditorButton( ITEMSTATS_HIDDEN_BTN ); + ShowSelectedItem(); + } + else + { + ClickEditorButton( ITEMSTATS_HIDDEN_BTN ); + HideSelectedItem(); + } + } +} + +//called from the taskbar renderer. +void UpdateItemStatsPanel() +{ + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_GRAY2 ); + SetFontShadow( FONT_NEARBLACK ); + SetFontBackground( FONT_BLACK ); + if( gpItem && iCurrentTaskbar == TASK_ITEMS && + gbEditingMode != EDITING_TRIGGERS && gbEditingMode != EDITING_ACTIONITEMS ) + { + mprintf( 500, 366, L"Toggle hide flag" ); + } + SetFontForeground( FONT_YELLOW ); + switch( gbEditingMode ) + { + case EDITING_NOTHING: + if( iCurrentTaskbar == TASK_ITEMS ) + mprintf( 520, 400, L"No item selected." ); + else + { + mprintf( 500, 390, L"Slot available for" ); + mprintf( 500, 400, L"random generation." ); + } + return; + case EDITING_KEYS: + if( !gpEditingItemPool ) + { + mprintf( 500, 400, L"Keys not editable." ); + return; + } + break; + case EDITING_OWNERSHIP: + mprintf( 512, 384, L"ProfileID of owner" ); + return; + case EDITING_NOT_YET_IMPLEMENTED: + mprintf( 500, 400, L"Item class not implemented." ); + return; + case EDITING_DROPPABLE: + mprintf( 500, 400, L"Slot locked as empty."); + return; + case EDITING_GUNS: + mprintf( 512, 384, L"Status" ); + mprintf( 512, 404, L"Rounds" ); + mprintf( 512, 424, L"Trap Level" ); + break; + case EDITING_AMMO: + mprintf( 512, 384, L"Quantity" ); + mprintf( 512, 404, L"Trap Level" ); + break; + case EDITING_ARMOUR: + case EDITING_EQUIPMENT: + mprintf( 512, 384, L"Status" ); + mprintf( 512, 404, L"Trap Level" ); + break; + case EDITING_EXPLOSIVES: + mprintf( 512, 380, L"Status" ); + mprintf( 512, 404, L"Quantity" ); + mprintf( 512, 424, L"Trap Level" ); + break; + case EDITING_MONEY: + mprintf( 532, 384, L"Dollars" ); + break; + case EDITING_ACTIONITEMS: + mprintf( 512, 369, L"Status" ); + mprintf( 512, 389, L"Trap Level" ); + break; + case EDITING_TRIGGERS: + mprintf( 512, 369, L"Trap Level"); + mprintf( 512, 389, L"Tolerance" ); + if( gpEditingItemPool && gpItem->bFrequency >= PANIC_FREQUENCY_3 && gpItem->bFrequency <= PANIC_FREQUENCY ) + mprintf( 500, 407, L"Alarm Trigger" ); + break; + } + if( gpEditingItemPool ) + { + INT32 iPercent = 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance; + if( iPercent == 100 ) + SetFontForeground( FONT_YELLOW ); + else if( iPercent >= 50 ) + SetFontForeground( FONT_ORANGE ); + else + SetFontForeground( FONT_RED ); + mprintf( 512, 444, L"Exist Chance" ); + mprintf( 587, 366, L"B" ); + mprintf( 609, 366, L"R" ); + mprintf( 630, 366, L"S" ); + } + InvalidateRegion( 477, 362, 161, 97 ); +} + +void RealisticOnlyCheckboxCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + ButtonList[ giRealisticCheckboxButton ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY); + ButtonList[ giSciFiCheckboxButton ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ giSciFiCheckboxButton ]->uiFlags |= BUTTON_DIRTY; + ButtonList[ giBothCheckboxButton ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ giBothCheckboxButton ]->uiFlags |= BUTTON_DIRTY; + gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags &= ~(WORLD_ITEM_REALISTIC_ONLY | WORLD_ITEM_SCIFI_ONLY); + gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags |= WORLD_ITEM_REALISTIC_ONLY; + } +} + +void SciFiOnlyCheckboxCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + ButtonList[ giRealisticCheckboxButton ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ giRealisticCheckboxButton ]->uiFlags |= BUTTON_DIRTY; + ButtonList[ giSciFiCheckboxButton ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY); + ButtonList[ giBothCheckboxButton ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ giBothCheckboxButton ]->uiFlags |= BUTTON_DIRTY; + gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags &= ~(WORLD_ITEM_REALISTIC_ONLY | WORLD_ITEM_SCIFI_ONLY); + gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags |= WORLD_ITEM_SCIFI_ONLY; + } +} + +void BothModesCheckboxCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + ButtonList[ giRealisticCheckboxButton ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ giRealisticCheckboxButton ]->uiFlags |= BUTTON_DIRTY; + ButtonList[ giSciFiCheckboxButton ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ giSciFiCheckboxButton ]->uiFlags |= BUTTON_DIRTY; + ButtonList[ giBothCheckboxButton ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY); + gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags &= ~(WORLD_ITEM_REALISTIC_ONLY | WORLD_ITEM_SCIFI_ONLY); + } +} + +void SetupGameTypeFlags() +{ + if( gpEditingItemPool ) + { + giBothCheckboxButton = + CreateCheckBoxButton( 573, 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, BothModesCheckboxCallback ); + SetButtonFastHelpText( giBothCheckboxButton, L"Item appears in both Sci-Fi and Realistic modes. (|B)" ); + giRealisticCheckboxButton = + CreateCheckBoxButton( 595, 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, RealisticOnlyCheckboxCallback ); + SetButtonFastHelpText( giRealisticCheckboxButton, L"Item appears in |Realistic mode only." ); + giSciFiCheckboxButton = + CreateCheckBoxButton( 616, 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, SciFiOnlyCheckboxCallback ); + SetButtonFastHelpText( giSciFiCheckboxButton, L"Item appears in |Sci-Fi mode only." ); + + if( gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags & WORLD_ITEM_REALISTIC_ONLY ) + ButtonList[ giRealisticCheckboxButton ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY); + else if( gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags & WORLD_ITEM_SCIFI_ONLY ) + ButtonList[ giSciFiCheckboxButton ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY); + else + ButtonList[ giBothCheckboxButton ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY); + } +} + +void RemoveGameTypeFlags() +{ + if( giBothCheckboxButton != -1 ) + { + RemoveButton( giBothCheckboxButton ); + giBothCheckboxButton = -1; + } + if( giRealisticCheckboxButton != -1 ) + { + RemoveButton( giRealisticCheckboxButton ); + giRealisticCheckboxButton = -1; + } + if( giSciFiCheckboxButton != -1 ) + { + RemoveButton( giSciFiCheckboxButton ); + giSciFiCheckboxButton = -1; + } +} + +void SetupGunGUI() +{ + UINT16 str[20]; + INT16 yp; + memset( gfAttachment, 0, NUM_ATTACHMENT_BUTTONS ); + swprintf( str, L"%d", gpItem->bGunStatus ); + AddTextInputField( 485, 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gpItem->ubGunShotsLeft ); + AddTextInputField( 485, 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gpItem->bTrap ); + AddTextInputField( 485, 420, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); + if( gpEditingItemPool ) + { + swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); + AddTextInputField( 485, 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + } + //Attachments are a dynamic part of guns. None, some, or all attachments could be available + //for a particular weapon. Show only the ones that we can apply to this gun. + yp = 383; + guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] = -1; + if( ValidAttachment( SILENCER, gpItem->usItem ) ) + { + guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] = + CreateTextButton( L"SILENCER", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); + yp += 14; + if( FindAttachment( gpItem, SILENCER ) != -1 ) + { + ButtonList[ guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; + gfAttachment[0] = TRUE; + } + } + guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] = -1; + if( ValidAttachment( SNIPERSCOPE, gpItem->usItem ) ) + { + guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] = + CreateTextButton( L"SNIPERSCOPE", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); + yp += 14; + if( FindAttachment( gpItem, SNIPERSCOPE ) != -1 ) + { + ButtonList[ guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; + gfAttachment[1] = TRUE; + } + } + guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] = -1; + if( ValidAttachment( LASERSCOPE, gpItem->usItem ) ) + { + guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] = + CreateTextButton( L"LASERSCOPE", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); + yp += 14; + if( FindAttachment( gpItem, LASERSCOPE ) != -1 ) + { + ButtonList[ guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; + gfAttachment[2] = TRUE; + } + } + guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] = -1; + if( ValidAttachment( BIPOD, gpItem->usItem ) ) + { + guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] = + CreateTextButton( L"BIPOD", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); + yp += 14; + if( FindAttachment( gpItem, BIPOD ) != -1 ) + { + ButtonList[ guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; + gfAttachment[3] = TRUE; + } + } + guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] = -1; + if( ValidAttachment( DUCKBILL, gpItem->usItem ) ) + { + guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] = + CreateTextButton( L"DUCKBILL", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); + yp += 14; + if( FindAttachment( gpItem, DUCKBILL ) != -1 ) + { + ButtonList[ guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; + gfAttachment[4] = TRUE; + } + } + guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] = -1; + if( ValidAttachment( UNDER_GLAUNCHER, gpItem->usItem ) ) + { + guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] = + CreateTextButton( L"G-LAUNCHER", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment ); + yp += 14; + if( FindAttachment( gpItem, UNDER_GLAUNCHER ) != -1 ) + { + ButtonList[ guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; + gfAttachment[5] = TRUE; + } + } + ReEvaluateAttachmentStatii(); +} + +void RemoveGunGUI() +{ + INT32 i; + for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ ) + { + if( guiAttachmentButton[ i ] != -1 ) + { + RemoveButton( guiAttachmentButton[ i ] ); + guiAttachmentButton[ i ] = -1; + } + } +} + +void ExtractAndUpdateGunGUI() +{ + INT32 i; + //Update the gun status + i = GetNumericStrictValueFromField( 1 ); + if( i == -1 ) + i = 20 + Random( 81 ); + else + i = min( i, 100 ); + gpItem->bGunStatus = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 1, i ); + //Update the ammo + i = GetNumericStrictValueFromField( 2 ); + if( i == -1 ) + i = Random( 1 + Weapon[ gpItem->usItem ].ubMagSize ); + else + i = min( i, Weapon[ gpItem->usItem ].ubMagSize ); + gpItem->ubGunShotsLeft = (UINT8)i; + SetInputFieldStringWithNumericStrictValue( 2, i ); + //Update the trap level + i = GetNumericStrictValueFromField( 3 ); + i = ( i == -1 ) ? 0 : min( i, 20 ); + gpItem->bTrap = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 3, i ); + if( gpEditingItemPool ) + { + giDefaultExistChance = GetNumericStrictValueFromField( 4 ); + giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) ); + gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance ); + SetInputFieldStringWithNumericStrictValue( 4, giDefaultExistChance ); + } +} + +void SetupAmmoGUI() +{ + UINT16 str[20]; + swprintf( str, L"%d", gpItem->ubNumberOfObjects ); + AddTextInputField( 485, 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gpItem->bTrap ); + AddTextInputField( 485, 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); + if( gpEditingItemPool ) + { + swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); + AddTextInputField( 485, 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + } +} + +void RemoveAmmoGUI() +{ + //nothing to remove +} + +void ExtractAndUpdateAmmoGUI() +{ + INT32 i; + //Update the number of clips + i = GetNumericStrictValueFromField( 1 ); + if( i == -1 ) + i = 1 + Random( Item[ gpItem->usItem ].ubPerPocket ); + else + i = max( 1, min( i, Item[ gpItem->usItem ].ubPerPocket ) ); + gpItem->ubNumberOfObjects = (UINT8)i; + SetInputFieldStringWithNumericStrictValue( 1, i ); + CreateItems( gpItem->usItem, 100, gpItem->ubNumberOfObjects, gpItem ); + //Update the trap level + i = GetNumericStrictValueFromField( 2 ); + i = ( i == -1 ) ? 0 : min( i, 20 ); + gpItem->bTrap = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 2, i ); + if( gpEditingItemPool ) + { + giDefaultExistChance = GetNumericStrictValueFromField( 3 ); + giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) ); + gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance ); + SetInputFieldStringWithNumericStrictValue( 3, giDefaultExistChance ); + } +} + +void SetupArmourGUI() +{ + UINT16 str[20]; + swprintf( str, L"%d", gpItem->bStatus[0] ); + AddTextInputField( 485, 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gpItem->bTrap ); + AddTextInputField( 485, 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); + if( gpEditingItemPool ) + { + swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); + AddTextInputField( 485, 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + } + + guiCeramicPlatesButton = -1; + if( ValidAttachment( CERAMIC_PLATES, gpItem->usItem ) ) + { + guiCeramicPlatesButton = + CreateTextButton( L"CERAMIC PLATES", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 558, 375, 72, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleCeramicPlates ); + if( FindAttachment( gpItem, CERAMIC_PLATES ) != -1 ) + { + ButtonList[ guiCeramicPlatesButton ]->uiFlags |= BUTTON_CLICKED_ON; + gfCeramicPlates = TRUE; + } + } +} + +void RemoveArmourGUI() +{ + if( guiCeramicPlatesButton != -1 ) + { + RemoveButton( guiCeramicPlatesButton ); + guiCeramicPlatesButton = -1; + } +} + +void ExtractAndUpdateArmourGUI() +{ + INT32 i; + //Update the armour status + i = GetNumericStrictValueFromField( 1 ); + if( i == -1 ) + i = 20 + Random( 81 ); + else + i = min( i, 100 ); + gpItem->bStatus[0] = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 1, i ); + //Update the trap level + i = GetNumericStrictValueFromField( 2 ); + i = ( i == -1 ) ? 0 : min( i, 20 ); + gpItem->bTrap = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 2, i ); + if( gpEditingItemPool ) + { + giDefaultExistChance = GetNumericStrictValueFromField( 3 ); + giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) ); + gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance ); + SetInputFieldStringWithNumericStrictValue( 3, giDefaultExistChance ); + } +} + +void SetupEquipGUI() +{ + UINT16 str[20]; + swprintf( str, L"%d", gpItem->bStatus[0] ); + AddTextInputField( 485, 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gpItem->bTrap ); + AddTextInputField( 485, 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); + if( gpEditingItemPool ) + { + swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); + AddTextInputField( 485, 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + } +} + +void RemoveEquipGUI() +{ + //nothing to remove +} + +void ExtractAndUpdateEquipGUI() +{ + INT32 i; + //Update the equipment status + i = GetNumericStrictValueFromField( 1 ); + if( i == -1 ) + i = 20 + Random( 81 ); + else + i = min( i, 100 ); + gpItem->bStatus[0] = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 1, i ); + //Update the trap level + i = GetNumericStrictValueFromField( 2 ); + i = ( i == -1 ) ? 0 : min( i, 20 ); + gpItem->bTrap = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 2, i ); + if( gpEditingItemPool ) + { + giDefaultExistChance = GetNumericStrictValueFromField( 3 ); + giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) ); + gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance ); + SetInputFieldStringWithNumericStrictValue( 3, giDefaultExistChance ); + } +} + +void SetupExplosivesGUI() +{ + UINT16 str[20]; + INT16 yp; + swprintf( str, L"%d", gpItem->bStatus[0] ); + AddTextInputField( 485, 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gpItem->ubNumberOfObjects ); + AddTextInputField( 485, 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT ); + if( Item[ gpItem->usItem ].ubPerPocket == 1 ) + { + DisableTextField( 2 ); + } + swprintf( str, L"%d", gpItem->bTrap ); + AddTextInputField( 485, 420, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); + if( gpEditingItemPool ) + { + swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); + AddTextInputField( 485, 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + } + yp = 375; + gfDetonator = FALSE; + guiDetonatorButton = -1; + if( ValidAttachment( DETONATOR, gpItem->usItem ) ) + { + guiDetonatorButton = + CreateTextButton( L"DETONATOR", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleDetonator ); + yp += 14; + if( FindAttachment( gpItem, DETONATOR ) != -1 ) + { + ButtonList[ guiDetonatorButton ]->uiFlags |= BUTTON_CLICKED_ON; + gfDetonator = TRUE; + } + } +} + +void RemoveExplosivesGUI() +{ + if( guiDetonatorButton != -1 ) + { + RemoveButton( guiDetonatorButton ); + guiDetonatorButton = -1; + } +} + +void ExtractAndUpdateExplosivesGUI() +{ + INT32 i; + //Update the explosives status + i = GetNumericStrictValueFromField( 1 ); + if( i == -1 ) + i = 20 + Random( 81 ); + else + i = min( i, 100 ); + gpItem->bStatus[0] = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 1, i ); + //Update the quantity + if( Item[ gpItem->usItem ].ubPerPocket > 1 ) + { + i = GetNumericStrictValueFromField( 2 ); + if( i == -1 ) + i = 1 + Random( Item[ gpItem->usItem ].ubPerPocket ); + else + i = max( 1, min( i, Item[ gpItem->usItem ].ubPerPocket ) ); + gpItem->ubNumberOfObjects = (UINT8)i; + SetInputFieldStringWithNumericStrictValue( 2, i ); + CreateItems( gpItem->usItem, gpItem->bStatus[0], gpItem->ubNumberOfObjects, gpItem ); + } + //Update the trap level + i = GetNumericStrictValueFromField( 3 ); + i = ( i == -1 ) ? 0 : min( i, 20 ); + gpItem->bTrap = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 3, i ); + if( gpEditingItemPool ) + { + giDefaultExistChance = GetNumericStrictValueFromField( 4 ); + giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) ); + gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance ); + SetInputFieldStringWithNumericStrictValue( 4, giDefaultExistChance ); + } +} + +void SetupMoneyGUI() +{ + UINT16 str[20]; + swprintf( str, L"%d", gpItem->uiMoneyAmount ); + AddTextInputField( 485, 380, 45, 15, MSYS_PRIORITY_NORMAL, str, 5, INPUTTYPE_NUMERICSTRICT ); + if( gpEditingItemPool ) + { + swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); + AddTextInputField( 485, 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + } +} + +void ExtractAndUpdateMoneyGUI() +{ + INT32 i; + //Update the amount of cash + i = GetNumericStrictValueFromField( 1 ); + if( i == -1 ) + i = Random( 20000 ); + else + i = max( 1, min( i, 20000 ) ); + gpItem->uiMoneyAmount = i; + gpItem->bStatus[0] = 100; + SetInputFieldStringWithNumericStrictValue( 1, i ); + if( gpEditingItemPool ) + { + giDefaultExistChance = GetNumericStrictValueFromField( 2 ); + giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) ); + gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance ); + SetInputFieldStringWithNumericStrictValue( 2, giDefaultExistChance ); + } +} + +void RemoveMoneyGUI() +{ + +} + +void SetupOwnershipGUI() +{ + UINT16 str[20]; + swprintf( str, L"%d", gpItem->ubOwnerProfile ); + AddTextInputField( 485, 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + giOwnershipGroupButton = + CreateTextButton( gszCivGroupNames[ gpItem->ubOwnerCivGroup ], SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 485, 415, 80, 25, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, OwnershipGroupButtonCallback ); +} + +void OwnershipGroupButtonCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + InitPopupMenu( btn->IDNum, OWNERSHIPGROUP_POPUP, DIR_UPLEFT ); + } +} + +void SetOwnershipGroup( UINT8 ubNewGroup ) +{ + gpItem->ubOwnerCivGroup = ubNewGroup; + SpecifyButtonText( giOwnershipGroupButton, gszCivGroupNames[ ubNewGroup ] ); +} + +void ExtractAndUpdateOwnershipGUI() +{ + INT32 i; + //Update the amount of cash + i = GetNumericStrictValueFromField( 1 ); + if( i == -1 ) + i = Random( 0 ); + else + i = max( 0, min( i, 255 ) ); + gpItem->ubOwnerProfile = (UINT8)i; + SetInputFieldStringWithNumericStrictValue( 1, i ); +} + +void RemoveOwnershipGUI() +{ + if( giOwnershipGroupButton != -1 ) + { + RemoveButton( giOwnershipGroupButton ); + giOwnershipGroupButton = -1; + } +} + +void SetupKeysGUI() +{ + UINT16 str[20]; + if( gpEditingItemPool ) + { + swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); + AddTextInputField( 485, 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + } +} + +void ExtractAndUpdateKeysGUI() +{ + if( gpEditingItemPool ) + { + giDefaultExistChance = GetNumericStrictValueFromField( 1 ); + giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) ); + gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance ); + SetInputFieldStringWithNumericStrictValue( 1, giDefaultExistChance ); + } +} + +void RemoveKeysGUI() +{ + +} + +void SetupActionItemsGUI() +{ + UINT16 str[4]; + UINT16 *pStr; + swprintf( str, L"%d", gpItem->bStatus[0] ); + AddTextInputField( 485, 365, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gpItem->bTrap ); + AddTextInputField( 485, 385, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT ); + if( gpEditingItemPool ) + { + swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); + AddTextInputField( 485, 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + } + pStr = GetActionItemName( gpItem ); + guiActionItemButton = + CreateTextButton( pStr, FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 510, 410, 100, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ActionItemCallback ); +} + +void ExtractAndUpdateActionItemsGUI() +{ + INT32 i; + //Update the equipment status + i = GetNumericStrictValueFromField( 1 ); + if( i == -1 ) + i = 20 + Random( 81 ); + else + i = min( i, 100 ); + gpItem->bStatus[0] = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 1, i ); + //Update the trap level + i = GetNumericStrictValueFromField( 2 ); + i = ( i == -1 ) ? 0 : min( i, 20 ); + if( i != gpItem->bTrap ) + gbDefaultBombTrapLevel = (INT8)i; + gpItem->bTrap = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 2, i ); + + if( gpEditingItemPool ) + { + giDefaultExistChance = GetNumericStrictValueFromField( 3 ); + giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) ); + gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance ); + SetInputFieldStringWithNumericStrictValue( 3, giDefaultExistChance ); + } +} + +void RemoveActionItemsGUI() +{ + if( guiActionItemButton != -1 ) + { + RemoveButton( guiActionItemButton ); + guiActionItemButton = -1; + } +} + +void AlarmTriggerCheckboxCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + gpItem->fFlags |= OBJECT_ALARM_TRIGGER; + else + gpItem->fFlags &= ~OBJECT_ALARM_TRIGGER; + } +} + +void SetupTriggersGUI() +{ + UINT16 str[4]; + swprintf( str, L"%d", gpItem->bTrap ); + AddTextInputField( 485, 365, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + swprintf( str, L"%d", gpItem->ubTolerance ); + AddTextInputField( 485, 385, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + if( gpEditingItemPool ) + { + swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance ); + AddTextInputField( 485, 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT ); + if( gpItem->bFrequency <= PANIC_FREQUENCY && gpItem->bFrequency >= PANIC_FREQUENCY_3 ) + { + giAlarmTriggerButton = + CreateCheckBoxButton( 485, 405, "EDITOR//smCheckBox.sti", MSYS_PRIORITY_NORMAL, AlarmTriggerCheckboxCallback ); + SetButtonFastHelpText( giAlarmTriggerButton, L"If the panic trigger is an alarm trigger,\nenemies won't attempt to use it if they\nare already aware of your presence."); + if( gpItem->fFlags & OBJECT_ALARM_TRIGGER ) + ButtonList[ giAlarmTriggerButton ]->uiFlags |= BUTTON_CLICKED_ON; + } + } +} + +void ExtractAndUpdateTriggersGUI() +{ + INT32 i; + //Update the trap level + i = GetNumericStrictValueFromField( 1 ); + i = ( i == -1 ) ? 0 : min( i, 20 ); + gpItem->bTrap = (INT8)i; + SetInputFieldStringWithNumericStrictValue( 1, i ); + + i = GetNumericStrictValueFromField( 2 ); + i = ( i == -1 ) ? 0 : max( 0, min( i, 99 ) ); + gpItem->ubTolerance = (UINT8)i; + SetInputFieldStringWithNumericStrictValue( 2, i ); + + if( gpEditingItemPool ) + { + giDefaultExistChance = GetNumericStrictValueFromField( 3 ); + giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) ); + gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance ); + SetInputFieldStringWithNumericStrictValue( 3, giDefaultExistChance ); + } +} + +void RemoveTriggersGUI() +{ + if( gpEditingItemPool && gpItem->bFrequency <= PANIC_FREQUENCY && gpItem->bFrequency >= PANIC_FREQUENCY_3 ) + { + if( giAlarmTriggerButton != -1 ) + { + RemoveButton( giAlarmTriggerButton ); + giAlarmTriggerButton = -1; + } + } +} + +void ToggleAttachment( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + INT32 i; + UINT16 usAttachment; + OBJECTTYPE temp; + for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ ) + { //Loop through and find the button that was just modified + switch( i ) + { + case 0: usAttachment = SILENCER; break; + case 1: usAttachment = SNIPERSCOPE; break; + case 2: usAttachment = LASERSCOPE; break; + case 3: usAttachment = BIPOD; break; + case 4: usAttachment = DUCKBILL; break; + case 5: usAttachment = UNDER_GLAUNCHER; break; + } + if( guiAttachmentButton[ i ] != -1 && btn == ButtonList[ guiAttachmentButton[ i ] ] ) + { //Found it, now check the state of the button. + if( !gfAttachment[ i ] ) + { + gfAttachment[ i ] = TRUE; + btn->uiFlags |= BUTTON_CLICKED_ON; + CreateItem( usAttachment, gpItem->bGunStatus, &temp ); + AttachObject( NULL, gpItem, &temp ); + } + else + { //Button is out, so remove the attachment + INT8 slot; + gfAttachment[ i ] = FALSE; + btn->uiFlags &= ~BUTTON_CLICKED_ON; + slot = FindAttachment( gpItem, usAttachment ); + if( slot != -1 ) + RemoveAttachment( gpItem, slot, &temp ); + } + } + } + ReEvaluateAttachmentStatii(); + } +} + +void ToggleCeramicPlates( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + OBJECTTYPE temp; + gfCeramicPlates ^= TRUE; + if( gfCeramicPlates ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + CreateItem( CERAMIC_PLATES, gpItem->bStatus[0], &temp ); + AttachObject( NULL, gpItem, &temp ); + } + else + { + INT8 slot; + btn->uiFlags &= ~BUTTON_CLICKED_ON; + slot = FindAttachment( gpItem, CERAMIC_PLATES ); + if( slot != -1 ) + RemoveAttachment( gpItem, slot, &temp ); + } + } +} + +void ToggleDetonator( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + OBJECTTYPE temp; + if( !gfDetonator ) + { + gfDetonator = TRUE; + btn->uiFlags |= BUTTON_CLICKED_ON; + CreateItem( DETONATOR, gpItem->bStatus[0], &temp ); + AttachObject( NULL, gpItem, &temp ); + } + else + { //Button is out, so remove the attachment + INT8 slot; + gfDetonator = FALSE; + btn->uiFlags &= ~BUTTON_CLICKED_ON; + slot = FindAttachment( gpItem, DETONATOR ); + if( slot != -1 ) + RemoveAttachment( gpItem, slot, &temp ); + } + } +} + +void ActionItemCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + InitPopupMenu( guiActionItemButton, ACTIONITEM_POPUP, DIR_UPLEFT ); + } +} + +void ChangeActionItem( OBJECTTYPE *pItem, INT8 bActionItemIndex ) +{ + pItem->usItem = ACTION_ITEM; + pItem->bActionValue = ACTION_ITEM_BLOW_UP; + switch( bActionItemIndex ) + { + case ACTIONITEM_TRIP_KLAXON: + pItem->usBombItem = TRIP_KLAXON; + break; + case ACTIONITEM_FLARE: + pItem->usBombItem = TRIP_FLARE; + break; + case ACTIONITEM_TEARGAS: + pItem->usBombItem = TEARGAS_GRENADE; + break; + case ACTIONITEM_STUN: + pItem->usBombItem = STUN_GRENADE; + break; + case ACTIONITEM_SMOKE: + pItem->usBombItem = SMOKE_GRENADE; + break; + case ACTIONITEM_MUSTARD: + pItem->usBombItem = MUSTARD_GRENADE; + break; + case ACTIONITEM_MINE: + pItem->usBombItem = MINE; + break; + case ACTIONITEM_OPEN: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_OPEN_DOOR; + break; + case ACTIONITEM_CLOSE: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_CLOSE_DOOR; + break; + case ACTIONITEM_UNLOCK_DOOR: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_UNLOCK_DOOR; + break; + case ACTIONITEM_TOGGLE_LOCK: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_TOGGLE_LOCK; + break; + case ACTIONITEM_UNTRAP_DOOR: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_UNTRAP_DOOR; + break; + case ACTIONITEM_TOGGLE_PRESSURE_ITEMS: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_TOGGLE_PRESSURE_ITEMS; + break; + case ACTIONITEM_SMPIT: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_SMALL_PIT; + break; + case ACTIONITEM_LGPIT: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_LARGE_PIT; + break; + case ACTIONITEM_TOGGLE_DOOR: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_TOGGLE_DOOR; + break; + case ACTIONITEM_TOGGLE_ACTION1: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION1; + break; + case ACTIONITEM_TOGGLE_ACTION2: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION2; + break; + case ACTIONITEM_TOGGLE_ACTION3: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION3; + break; + case ACTIONITEM_TOGGLE_ACTION4: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_TOGGLE_ACTION4; + break; + case ACTIONITEM_ENTER_BROTHEL: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_ENTER_BROTHEL; + break; + case ACTIONITEM_EXIT_BROTHEL: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_EXIT_BROTHEL; + break; + case ACTIONITEM_KINGPIN_ALARM: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_KINGPIN_ALARM; + break; + case ACTIONITEM_SEX: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_SEX; + break; + case ACTIONITEM_REVEAL_ROOM: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_REVEAL_ROOM; + break; + case ACTIONITEM_LOCAL_ALARM: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_LOCAL_ALARM; + break; + case ACTIONITEM_GLOBAL_ALARM: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_GLOBAL_ALARM; + break; + case ACTIONITEM_KLAXON: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_KLAXON; + break; + case ACTIONITEM_SMALL: + pItem->usBombItem = HAND_GRENADE; + break; + case ACTIONITEM_MEDIUM: + pItem->usBombItem = TNT; + break; + case ACTIONITEM_LARGE: + pItem->usBombItem = C4; + break; + case ACTIONITEM_MUSEUM_ALARM: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_MUSEUM_ALARM; + break; + case ACTIONITEM_BLOODCAT_ALARM: + pItem->usBombItem = NOTHING; + pItem->bActionValue = ACTION_ITEM_BLOODCAT_ALARM; + break; + case ACTIONITEM_BIG_TEAR_GAS: + pItem->usBombItem = BIG_TEAR_GAS; + break; + + } +} + +void UpdateActionItem( INT8 bActionItemIndex ) +{ + gbActionItemIndex = bActionItemIndex; //used for future new actionitems as the default. + + if( !gpItemPool || !gpItem ) + return; + + //If the previous item was a pit, remove it before changing it + if( gpItem->usItem == ACTION_ITEM ) + { + if( gpItem->bActionValue == ACTION_ITEM_SMALL_PIT ) + Remove3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + else if( gpItem->bActionValue == ACTION_ITEM_LARGE_PIT ) + Remove5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + } + + ChangeActionItem( gpItem, gbActionItemIndex ); + SpecifyButtonText( guiActionItemButton, GetActionItemName( gpItem ) ); + + //If the new item is a pit, add it so we can see how it looks. + if( gpItem->usItem == ACTION_ITEM ) + { + if( gpItem->bActionValue == ACTION_ITEM_SMALL_PIT ) + Add3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + else if( gpItem->bActionValue == ACTION_ITEM_LARGE_PIT ) + Add5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo ); + } +} + +void ReEvaluateAttachmentStatii() +{ + INT32 i; + UINT16 usAttachment; + for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ ) + { + if( guiAttachmentButton[ i ] != -1 && !( ButtonList[ guiAttachmentButton[ i ] ]->uiFlags & BUTTON_CLICKED_ON ) ) + { //if button exists and button isn't clicked + switch( i ) + { + case 0: usAttachment = SILENCER; break; + case 1: usAttachment = SNIPERSCOPE; break; + case 2: usAttachment = LASERSCOPE; break; + case 3: usAttachment = BIPOD; break; + case 4: usAttachment = DUCKBILL; break; + case 5: usAttachment = UNDER_GLAUNCHER; break; + } + if( ValidItemAttachment( gpItem, usAttachment, TRUE ) ) + EnableButton( guiAttachmentButton[ i ] ); + else + DisableButton( guiAttachmentButton[ i ] ); + } + } +} + + +#endif diff --git a/Editor/Item Statistics.h b/Editor/Item Statistics.h new file mode 100644 index 00000000..ee987289 --- /dev/null +++ b/Editor/Item Statistics.h @@ -0,0 +1,97 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __ITEM_STATISTICS_H +#define __ITEM_STATISTICS_H + +#include "Item Types.h" + +//Handles the dynamic changing of text input fields and button modes depending on the currently edited +//item. Both the merc's inventory panel, and the items tab use the same code to accomplish this. + +//Set if we are editing items from the items tab. Otherwise, it is assumed that we are +//editing items from the merc's inventory panel. +extern BOOLEAN gfItemEditingMode; + +//Set if we need to update the panel. +extern BOOLEAN gfRenderItemStatsPanel; + +void SpecifyItemToEdit( OBJECTTYPE *pItem, INT32 iMapIndex ); + +void ShowItemStatsPanel(); +void HideItemStatsPanel(); +void EnableItemStatsPanel(); +void DisableItemStatsPanel(); + +//called from the taskbar renderer. +void UpdateItemStatsPanel(); + +enum +{ + ITEMSTATS_APPLY, + ITEMSTATS_CANCEL, + ITEMSTATS_DEFAULT, + ITEMSTATS_DELETE, + ITEMSTATS_HIDE, + ITEMSTATS_SHOW, +}; +void ExecuteItemStatsCmd( UINT8 ubAction ); + +extern OBJECTTYPE *gpItem; +extern INT16 gsItemGridNo; + +//enumerations for all of the different action items. Used by the popup menu for +//changing the type of action item. When modified, an equivalent text array must be +//changed as well. +enum +{ + ACTIONITEM_TRIP_KLAXON, + ACTIONITEM_FLARE, + ACTIONITEM_TEARGAS, + ACTIONITEM_STUN, + ACTIONITEM_SMOKE, + ACTIONITEM_MUSTARD, + ACTIONITEM_MINE, + ACTIONITEM_OPEN, + ACTIONITEM_CLOSE, + ACTIONITEM_SMPIT, + ACTIONITEM_LGPIT, + ACTIONITEM_SMALL, //grenade + ACTIONITEM_MEDIUM, //TNT + ACTIONITEM_LARGE, //C4 + ACTIONITEM_TOGGLE_DOOR, + ACTIONITEM_TOGGLE_ACTION1, + ACTIONITEM_TOGGLE_ACTION2, + ACTIONITEM_TOGGLE_ACTION3, + ACTIONITEM_TOGGLE_ACTION4, + ACTIONITEM_ENTER_BROTHEL, + ACTIONITEM_EXIT_BROTHEL, + ACTIONITEM_KINGPIN_ALARM, + ACTIONITEM_SEX, + ACTIONITEM_REVEAL_ROOM, + ACTIONITEM_LOCAL_ALARM, + ACTIONITEM_GLOBAL_ALARM, + ACTIONITEM_KLAXON, + ACTIONITEM_UNLOCK_DOOR, + ACTIONITEM_TOGGLE_LOCK, + ACTIONITEM_UNTRAP_DOOR, + ACTIONITEM_TOGGLE_PRESSURE_ITEMS, + ACTIONITEM_MUSEUM_ALARM, + ACTIONITEM_BLOODCAT_ALARM, + ACTIONITEM_BIG_TEAR_GAS, + NUM_ACTIONITEMS +}; +extern UINT16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ]; +//Returns a pointer to one of the above string array. +extern UINT16* GetActionItemName( OBJECTTYPE *pItem ); +//Called by the popup menu, when a selection is made. +extern void UpdateActionItem( INT8 bActionItemIndex ); +//Changes an action item into the type specified by the ACTIONITEM enumeration. +extern void ChangeActionItem( OBJECTTYPE *pItem, INT8 bActionItemIndex ); +extern INT8 gbActionItemIndex; +extern INT8 gbDefaultBombTrapLevel; + +extern void SetOwnershipGroup( UINT8 ubNewGroup ); + +#endif +#endif diff --git a/Editor/LoadScreen.cpp b/Editor/LoadScreen.cpp new file mode 100644 index 00000000..c1c43db0 --- /dev/null +++ b/Editor/LoadScreen.cpp @@ -0,0 +1,1174 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include + #include "Font Control.h" + #include "renderworld.h" + #include "render dirty.h" + #include "loadscreen.h" + #include "selectwin.h" + #include "EditorDefines.h" + #include "messagebox.h" + #include "Text Input.h" + #include "Soldier Create.h" + #include "Soldier Init List.h" + #include "EditorBuildings.h" + #include "Editor Taskbar Utils.h" + #include "Editor Undo.h" + #include "editscreen.h" + #include "strategicmap.h" + #include "Editor Modes.h" + #include "Map Information.h" + #include "Sys Globals.h" + #include "Sector Summary.h" + #include "newsmooth.h" + #include "Simple Render Utils.h" + #include "Animated ProgressBar.h" + #include "EditorMercs.h" + #include "lighting.h" + #include "EditorMapInfo.h" + #include "environment.h" + #include "edit_sys.h" + #include "EditorItems.h" + #include "english.h" + #include "gameloop.h" + #include "message.h" + #include "pits.h" + #include "Item Statistics.h" + #include "Scheduling.h" +#endif + +//=========================================================================== + +BOOLEAN gfErrorCatch = FALSE; +UINT16 gzErrorCatchString[ 256 ] = L""; +INT32 giErrorCatchMessageBox = 0; + +extern void RemoveMercsInSector(); + +enum{ + DIALOG_NONE, + DIALOG_SAVE, + DIALOG_LOAD, + DIALOG_CANCEL, + DIALOG_DELETE +}; + +extern UINT16 Counter; + +//Hook into the text input code. These callbacks help give back control, so we +//can use the dialog interface in conjunction with the +void FDlgOkCallback( GUI_BUTTON *butn, INT32 reason ); +void FDlgCancelCallback( GUI_BUTTON *butn, INT32 reason ); +void FDlgUpCallback( GUI_BUTTON *butn, INT32 reason ); +void FDlgDwnCallback( GUI_BUTTON *butn, INT32 reason ); +void FDlgNamesCallback( GUI_BUTTON *butn, INT32 reason ); +void UpdateWorldInfoCallback( GUI_BUTTON *b, INT32 reason ); +void FileDialogModeCallback( UINT8 ubID, BOOLEAN fEntering ); + +UINT32 ProcessLoadSaveScreenMessageBoxResult(); +BOOLEAN RemoveFromFDlgList( FDLG_LIST **head, FDLG_LIST *node ); + +void DrawFileDialog(); +void HandleMainKeyEvents( InputAtom *pEvent ); +void SetTopFileToLetter( UINT16 usLetter ); + +INT32 iTotalFiles; +INT32 iTopFileShown; +INT32 iCurrFileShown; +INT32 iLastFileClicked; +INT32 iLastClickTime; + +UINT16 gzFilename[31]; + +FDLG_LIST *FileList = NULL; + +INT32 iFDlgState = DIALOG_NONE; +BOOLEAN gfDestroyFDlg = FALSE; +INT32 iFileDlgButtons[7]; + +BOOLEAN gfLoadError; +BOOLEAN gfReadOnly; +BOOLEAN gfFileExists; +BOOLEAN gfIllegalName; +BOOLEAN gfDeleteFile; +BOOLEAN gfNoFiles; + +UINT16 zOrigName[60]; +GETFILESTRUCT FileInfo; + +BOOLEAN fEnteringLoadSaveScreen = TRUE; +BOOLEAN gfPassedSaveCheck = FALSE; + +MOUSE_REGION BlanketRegion; + +CHAR8 gszCurrFilename[80]; + +enum{ + IOSTATUS_NONE, + INITIATE_MAP_SAVE, + SAVING_MAP, + INITIATE_MAP_LOAD, + LOADING_MAP +}; +INT8 gbCurrentFileIOStatus; //1 init saving message, 2 save, 3 init loading message, 4 load, 0 none +UINT32 ProcessFileIO(); + +//BOOLEAN fSavingFile; +extern UINT16 gusLightLevel, gusSavedLightLevel; +UINT32 LoadSaveScreenInit(void) +{ + gfUpdateSummaryInfo = TRUE; + fEnteringLoadSaveScreen = TRUE; + return TRUE; +} + +UINT32 LoadSaveScreenShutdown(void) +{ + return TRUE; +} + +void LoadSaveScreenEntry() +{ + fEnteringLoadSaveScreen = FALSE; + gbCurrentFileIOStatus = IOSTATUS_NONE; + + gfReadOnly = FALSE; + gfFileExists = FALSE; + gfLoadError = FALSE; + gfIllegalName = FALSE; + gfDeleteFile = FALSE; + gfNoFiles = FALSE; + + // setup filename dialog box + // (*.dat and *.map) as file filter + + // If user clicks on a filename in the window, then turn off string focus and re-init the string with the new name. + // If user hits ENTER or presses OK, then continue with the file loading/saving + + if( FileList ) + TrashFDlgList( FileList ); + + iTopFileShown = iTotalFiles = 0; + if( GetFileFirst("MAPS\\*.dat", &FileInfo) ) + { + FileList = AddToFDlgList( FileList, &FileInfo ); + iTotalFiles++; + while( GetFileNext(&FileInfo) ) + { + FileList = AddToFDlgList( FileList, &FileInfo ); + iTotalFiles++; + } + GetFileClose(&FileInfo); + } + + swprintf( zOrigName, L"%s Map (*.dat)", iCurrentAction == ACTION_SAVE_MAP ? L"Save" : L"Load" ); + + swprintf( gzFilename, L"%S", gubFilename ); + + CreateFileDialog( zOrigName ); + + if( !iTotalFiles ) + { + gfNoFiles = TRUE; + if( iCurrentAction == ACTION_LOAD_MAP ) + DisableButton( iFileDlgButtons[0] ); + } + + iLastFileClicked = -1; + iLastClickTime = 0; + +} + +UINT32 ProcessLoadSaveScreenMessageBoxResult() +{ + FDLG_LIST *curr, *temp; + gfRenderWorld = TRUE; + RemoveMessageBox(); + if( gfIllegalName ) + { + fEnteringLoadSaveScreen = TRUE; + RemoveFileDialog(); + MarkWorldDirty(); + return gfMessageBoxResult ? LOADSAVE_SCREEN : EDIT_SCREEN; + } + if( gfDeleteFile ) + { + if( gfMessageBoxResult ) + { //delete file + INT32 x; + curr = FileList; + for( x = 0; x < iCurrFileShown && x < iTotalFiles && curr; x++ ) + { + curr = curr->pNext; + } + if( curr ) + { + if( gfReadOnly ) + { + FileClearAttributes( gszCurrFilename ); + gfReadOnly = FALSE; + } + FileDelete( gszCurrFilename ); + + //File is deleted so redo the text fields so they show the + //next file in the list. + temp = curr->pNext; + if( !temp ) + temp = curr->pPrev; + if( !temp ) + wcscpy( gzFilename, L"" ); + else + swprintf( gzFilename, L"%S", temp->FileInfo.zFileName ); + if( ValidFilename() ) + { + SetInputFieldStringWith16BitString( 0, gzFilename ); + } + else + { + SetInputFieldStringWith16BitString( 0, L"" ); + wcscpy( gzFilename, L"" ); + } + RemoveFromFDlgList( &FileList, curr ); + iTotalFiles--; + if( !iTotalFiles ) + { + gfNoFiles = TRUE; + if( iCurrentAction == ACTION_LOAD_MAP ) + DisableButton( iFileDlgButtons[0] ); + } + if( iCurrFileShown >= iTotalFiles ) + iCurrFileShown--; + if( iCurrFileShown < iTopFileShown ) + iTopFileShown -= 8; + if( iTopFileShown < 0 ) + iTopFileShown = 0; + } + } + MarkWorldDirty(); + RenderWorld(); + gfDeleteFile = FALSE; + iFDlgState = DIALOG_NONE; + return LOADSAVE_SCREEN; + } + if( gfLoadError ) + { + fEnteringLoadSaveScreen = TRUE; + return gfMessageBoxResult ? LOADSAVE_SCREEN : EDIT_SCREEN; + } + if( gfReadOnly ) + { //file is readonly. Result will determine if the file dialog stays up. + fEnteringLoadSaveScreen = TRUE; + RemoveFileDialog(); + return gfMessageBoxResult ? LOADSAVE_SCREEN : EDIT_SCREEN; + } + if( gfFileExists ) + { + if( gfMessageBoxResult ) + { //okay to overwrite file + RemoveFileDialog(); + gbCurrentFileIOStatus = INITIATE_MAP_SAVE; + return LOADSAVE_SCREEN; + } + fEnteringLoadSaveScreen = TRUE; + RemoveFileDialog(); + return EDIT_SCREEN ; + } + Assert( 0 ); + return LOADSAVE_SCREEN; +} + +UINT32 LoadSaveScreenHandle(void) +{ + FDLG_LIST *FListNode; + INT32 x; + InputAtom DialogEvent; + + if( fEnteringLoadSaveScreen ) + { + LoadSaveScreenEntry(); + } + + if( gbCurrentFileIOStatus ) //loading or saving map + { + UINT32 uiScreen; + uiScreen = ProcessFileIO(); + if( uiScreen == EDIT_SCREEN && gbCurrentFileIOStatus == LOADING_MAP ) + RemoveProgressBar( 0 ); + return uiScreen; + } + + if( gubMessageBoxStatus ) + { + if( MessageBoxHandled() ) + return ProcessLoadSaveScreenMessageBoxResult(); + return LOADSAVE_SCREEN; + } + + //handle all key input. + while( DequeueEvent(&DialogEvent) ) + { + if( !HandleTextInput(&DialogEvent) && (DialogEvent.usEvent == KEY_DOWN || DialogEvent.usEvent == KEY_REPEAT) ) + { + HandleMainKeyEvents( &DialogEvent ); + } + } + + DrawFileDialog(); + + // Skip to first filename to show + FListNode = FileList; + for(x=0;xpNext; + } + + // Show up to 8 filenames in the window + SetFont( FONT12POINT1 ); + if( gfNoFiles ) + { + SetFontForeground( FONT_LTRED ); + SetFontBackground( 142 ); + mprintf( 226, 126, L"NO FILES IN \\MAPS DIRECTORY" ); + } + else for(x=iTopFileShown;x<(iTopFileShown+8) && xFileInfo.zFileName); + FListNode = FListNode->pNext; + } + + RenderAllTextFields(); + + InvalidateScreen(); + + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + + switch( iFDlgState ) + { + case DIALOG_CANCEL: + RemoveFileDialog(); + fEnteringLoadSaveScreen = TRUE; + return EDIT_SCREEN; + case DIALOG_DELETE: + sprintf( gszCurrFilename, "MAPS\\%S", gzFilename ); + if( GetFileFirst(gszCurrFilename, &FileInfo) ) + { + UINT16 str[40]; + if( FileInfo.uiFileAttribs & (FILE_IS_READONLY|FILE_IS_HIDDEN|FILE_IS_SYSTEM) ) + { + swprintf( str, L" Delete READ-ONLY file %s? ", gzFilename ); + gfReadOnly = TRUE; + } + else + swprintf( str, L" Delete file %s? ", gzFilename ); + gfDeleteFile = TRUE; + CreateMessageBox( str ); + } + return LOADSAVE_SCREEN; + case DIALOG_SAVE: + if( !ExtractFilenameFromFields() ) + { + CreateMessageBox( L" Illegal filename. Try another filename? " ); + gfIllegalName = TRUE; + iFDlgState = DIALOG_NONE; + return LOADSAVE_SCREEN; + } + sprintf( gszCurrFilename, "MAPS\\%S", gzFilename ); + if ( FileExists( gszCurrFilename ) ) + { + gfFileExists = TRUE; + gfReadOnly = FALSE; + if( GetFileFirst(gszCurrFilename, &FileInfo) ) + { + if( FileInfo.uiFileAttribs & (FILE_IS_READONLY|FILE_IS_DIRECTORY|FILE_IS_HIDDEN|FILE_IS_SYSTEM|FILE_IS_OFFLINE|FILE_IS_TEMPORARY) ) + gfReadOnly = TRUE; + GetFileClose(&FileInfo); + } + if( gfReadOnly ) + CreateMessageBox( L" File is read only! Choose a different name? " ); + else + CreateMessageBox( L" File exists, Overwrite? " ); + return( LOADSAVE_SCREEN ); + } + RemoveFileDialog(); + gbCurrentFileIOStatus = INITIATE_MAP_SAVE; + return LOADSAVE_SCREEN ; + case DIALOG_LOAD: + if( !ExtractFilenameFromFields() ) + { + CreateMessageBox( L" Illegal filename. Try another filename? " ); + gfIllegalName = TRUE; + iFDlgState = DIALOG_NONE; + return LOADSAVE_SCREEN; + } + RemoveFileDialog(); + CreateProgressBar( 0, 118, 183, 522, 202 ); + DefineProgressBarPanel( 0, 65, 79, 94, 100, 155, 540, 235 ); + swprintf( zOrigName, L"Loading map: %s", gzFilename ); + SetProgressBarTitle( 0, zOrigName, BLOCKFONT2, FONT_RED, FONT_NEARBLACK ); + gbCurrentFileIOStatus = INITIATE_MAP_LOAD; + return LOADSAVE_SCREEN ; + default: + iFDlgState = DIALOG_NONE; + } + iFDlgState = DIALOG_NONE; + return LOADSAVE_SCREEN ; +} + + +void CreateFileDialog( UINT16 *zTitle ) +{ + + iFDlgState = DIALOG_NONE; + + DisableEditorTaskbar(); + + MSYS_DefineRegion( &BlanketRegion, 0, 0, gsVIEWPORT_END_X, gsVIEWPORT_END_Y, MSYS_PRIORITY_HIGH - 5, 0, 0, 0 ); + + //Okay and cancel buttons + iFileDlgButtons[0] = CreateTextButton( L"Okay", FONT12POINT1, FONT_BLACK, FONT_BLACK, + BUTTON_USE_DEFAULT, 354, 225, 50, 30, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, FDlgOkCallback ); + iFileDlgButtons[1] = CreateTextButton( L"Cancel", FONT12POINT1, FONT_BLACK, FONT_BLACK, + BUTTON_USE_DEFAULT, 406, 225, 50, 30, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, FDlgCancelCallback ); + + //Scroll buttons + iFileDlgButtons[2] = CreateSimpleButton( 426,92,"EDITOR//uparrow.sti", BUTTON_NO_TOGGLE, + MSYS_PRIORITY_HIGH, FDlgUpCallback ); + iFileDlgButtons[3] = CreateSimpleButton( 426,182,"EDITOR//downarrow.sti", BUTTON_NO_TOGGLE, + MSYS_PRIORITY_HIGH, FDlgDwnCallback ); + + //File list window + iFileDlgButtons[4] = CreateHotSpot( (179+4), (69+3), (179+4+240), (69+120+3), MSYS_PRIORITY_HIGH-1, BUTTON_NO_CALLBACK, FDlgNamesCallback); + //Title button + iFileDlgButtons[5] = CreateTextButton(zTitle, HUGEFONT, FONT_LTKHAKI, FONT_DKKHAKI, + BUTTON_USE_DEFAULT,179,39,281,30,BUTTON_NO_TOGGLE, + MSYS_PRIORITY_HIGH-2,BUTTON_NO_CALLBACK,BUTTON_NO_CALLBACK); + DisableButton(iFileDlgButtons[5]); + SpecifyDisabledButtonStyle( iFileDlgButtons[5], DISABLED_STYLE_NONE ); + + iFileDlgButtons[6] = -1; + if( iCurrentAction == ACTION_SAVE_MAP ) + { //checkboxes + //The update world info checkbox + iFileDlgButtons[6] = CreateCheckBoxButton( 183, 229, "EDITOR//smcheckbox.sti", MSYS_PRIORITY_HIGH, UpdateWorldInfoCallback ); + if( gfUpdateSummaryInfo ) + ButtonList[ iFileDlgButtons[6] ]->uiFlags |= BUTTON_CLICKED_ON; + } + + //Add the text input fields + InitTextInputModeWithScheme( DEFAULT_SCHEME ); + //field 1 (filename) + AddTextInputField( /*233*/183, 195, 190, 20, MSYS_PRIORITY_HIGH, gzFilename, 30, INPUTTYPE_EXCLUSIVE_DOSFILENAME ); + //field 2 -- user field that allows mouse/key interaction with the filename list + AddUserInputField( FileDialogModeCallback ); + +} + +void UpdateWorldInfoCallback( GUI_BUTTON *b, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + gfUpdateSummaryInfo = b->uiFlags & BUTTON_CLICKED_ON ? TRUE : FALSE; +} + +//This is a hook into the text input code. This callback is called whenever the user is currently +//editing text, and presses Tab to transfer to the file dialog mode. When this happens, we set the text +//field to the currently selected file in the list which is already know. +void FileDialogModeCallback( UINT8 ubID, BOOLEAN fEntering ) +{ + INT32 x; + FDLG_LIST *FListNode; + if( fEntering ) + { + // Skip to first filename + FListNode = FileList; + for(x=0;xpNext; + } + // Find the already selected filename + for(x = iTopFileShown; x < iTopFileShown + 8 && x < iTotalFiles && FListNode != NULL; x++ ) + { + if( iCurrFileShown == (x-iTopFileShown) ) + { + FListNode->FileInfo.zFileName[30] = 0; + SetInputFieldStringWith8BitString( 0, (UINT8 *)FListNode->FileInfo.zFileName ); + return; + } + FListNode = FListNode->pNext; + } + } +} + +void RemoveFileDialog(void) +{ + INT32 x; + + MSYS_RemoveRegion( &BlanketRegion ); + + for(x=0; x<6; x++) + { + RemoveButton(iFileDlgButtons[x]); + } + + if( iFileDlgButtons[6] != -1 ) + { + RemoveButton( iFileDlgButtons[6] ); + } + + TrashFDlgList( FileList ); + FileList = NULL; + + InvalidateScreen( ); + + EnableEditorTaskbar(); + KillTextInputMode(); + MarkWorldDirty(); + RenderWorld(); + EndFrameBufferRender(); +} + +void DrawFileDialog(void) +{ + ColorFillVideoSurfaceArea(FRAME_BUFFER, 179, 69, (179+281), 261, Get16BPPColor(FROMRGB(136, 138, 135)) ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, 180, 70, (179+281), 261, Get16BPPColor(FROMRGB(24, 61, 81)) ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, 180, 70, (179+280), 260, Get16BPPColor(FROMRGB(65, 79, 94)) ); + + ColorFillVideoSurfaceArea(FRAME_BUFFER, (179+4), (69+3), (179+4+240), (69+123), Get16BPPColor(FROMRGB(24, 61, 81)) ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, (179+5), (69+4), (179+4+240), (69+123), Get16BPPColor(FROMRGB(136, 138, 135)) ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, (179+5), (69+4), (179+3+240), (69+122), Get16BPPColor(FROMRGB(250, 240, 188)) ); + + MarkButtonsDirty(); + RenderButtons(); + RenderButtonsFastHelp(); + + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_LTKHAKI ); + SetFontShadow( FONT_DKKHAKI ); + SetFontBackground( FONT_BLACK ); + mprintf( 183, 217, L"Filename" ); + + if( iFileDlgButtons[6] != -1 ) + { + mprintf( 200, 231, L"Update world info" ); + } +} + +//The callback calls this function passing the relative y position of where +//the user clicked on the hot spot. +void SelectFileDialogYPos( UINT16 usRelativeYPos ) +{ + INT16 sSelName; + INT32 x; + FDLG_LIST *FListNode; + + sSelName = usRelativeYPos / 15; + + //This is a field in the text editmode, but clicked via mouse. + SetActiveField( 1 ); + + // Skip to first filename + FListNode = FileList; + for(x=0;xpNext; + } + + for(x=iTopFileShown;x<(iTopFileShown+8) && xFileInfo.zFileName[30] = 0; + swprintf( gzFilename, L"%S", FListNode->FileInfo.zFileName ); + if( ValidFilename() ) + { + SetInputFieldStringWith16BitString( 0, gzFilename ); + } + else + { + SetInputFieldStringWith16BitString( 0, L"" ); + wcscpy( gzFilename, L"" ); + } + + RenderInactiveTextField( 0 ); + + //Calculate and process any double clicking... + iCurrClickTime = GetJA2Clock(); + if( iCurrClickTime - iLastClickTime < 400 && x == iLastFileClicked ) + { //Considered a double click, so activate load/save this filename. + gfDestroyFDlg = TRUE; + iFDlgState = iCurrentAction == ACTION_SAVE_MAP ? DIALOG_SAVE : DIALOG_LOAD; + } + iLastClickTime = iCurrClickTime; + iLastFileClicked = x; + } + FListNode = FListNode->pNext; + } +} + +FDLG_LIST *AddToFDlgList(FDLG_LIST *pList, GETFILESTRUCT *pInfo) +{ + FDLG_LIST *pNode; + + // Add to start of list + if ( pList == NULL ) + { + pNode = (FDLG_LIST *)MemAlloc( sizeof(FDLG_LIST) ); + pNode->FileInfo = *pInfo; + pNode->pPrev = pNode->pNext = NULL; + return(pNode); + } + + // Add and sort alphabetically without regard to case -- function limited to 10 chars comparison + if ( stricmp(pList->FileInfo.zFileName, pInfo->zFileName ) > 0 ) + { + // pInfo is smaller than pList (i.e. Insert before) + pNode = (FDLG_LIST *)MemAlloc( sizeof(FDLG_LIST) ); + pNode->FileInfo = *pInfo; + pNode->pNext = pList; + pNode->pPrev = pList->pPrev; + pList->pPrev = pNode; + return(pNode); + } + else + { + pList->pNext = AddToFDlgList( pList->pNext, pInfo ); + pList->pNext->pPrev = pList; + } + return(pList); +} + +BOOLEAN RemoveFromFDlgList( FDLG_LIST **head, FDLG_LIST *node ) +{ + FDLG_LIST *curr; + curr = *head; + while( curr ) + { + if( curr == node ) + { + if( *head == node ) + *head = (*head)->pNext; + if( curr->pPrev ) + curr->pPrev->pNext = curr->pNext; + if( curr->pNext ) + curr->pNext->pPrev = curr->pPrev; + MemFree( node ); + node = NULL; + return TRUE; + } + curr = curr->pNext; + } + return FALSE; //wasn't deleted +} + +void TrashFDlgList(FDLG_LIST *pList) +{ + FDLG_LIST *pNode; + + while(pList != NULL) + { + pNode = pList; + pList = pList->pNext; + MemFree(pNode); + } +} + +void SetTopFileToLetter( UINT16 usLetter ) +{ + UINT32 x; + FDLG_LIST *curr; + FDLG_LIST *prev; + UINT16 usNodeLetter; + + // Skip to first filename + x = 0; + curr = prev = FileList; + while( curr ) + { + usNodeLetter = curr->FileInfo.zFileName[0]; //first letter of filename. + if( usNodeLetter < 'a' ) + usNodeLetter += 32; //convert uppercase to lower case A=65, a=97 + if( usLetter <= usNodeLetter ) + break; + prev = curr; + curr = curr->pNext; + x++; + } + if( FileList ) + { + iCurrFileShown = x; + iTopFileShown = x; + if( iTopFileShown > iTotalFiles - 7 ) + iTopFileShown = iTotalFiles - 7; + SetInputFieldStringWith8BitString( 0, (UINT8 *)prev->FileInfo.zFileName ); + } +} + +void HandleMainKeyEvents( InputAtom *pEvent ) +{ + INT32 iPrevFileShown = iCurrFileShown; + //Replace Alt-x press with ESC. + if( pEvent->usKeyState & ALT_DOWN && pEvent->usParam == 'x' ) + pEvent->usParam = ESC; + switch( pEvent->usParam ) + { + case ENTER: + if( gfNoFiles && iCurrentAction == ACTION_LOAD_MAP ) + break; + gfDestroyFDlg = TRUE; + iFDlgState = iCurrentAction == ACTION_SAVE_MAP ? DIALOG_SAVE : DIALOG_LOAD; + break; + case ESC: + gfDestroyFDlg = TRUE; + iFDlgState = DIALOG_CANCEL; + break; + case PGUP: + if( iTopFileShown > 7 ) + { + iTopFileShown -= 7; + iCurrFileShown -= 7; + } + else + { + iTopFileShown = 0; + iCurrFileShown = 0; + } + break; + case PGDN: + iTopFileShown += 7; + iCurrFileShown += 7; + if( iTopFileShown > iTotalFiles-7 ) + iTopFileShown = iTotalFiles - 7; + if( iCurrFileShown >= iTotalFiles ) + iCurrFileShown = iTotalFiles - 1; + break; + case UPARROW: + if( iCurrFileShown > 0 ) + iCurrFileShown--; + if( iTopFileShown > iCurrFileShown ) + iTopFileShown = iCurrFileShown; + break; + case DNARROW: + iCurrFileShown++; + if( iCurrFileShown >= iTotalFiles ) + iCurrFileShown = iTotalFiles - 1; + else if( iTopFileShown < iCurrFileShown-7 ) + iTopFileShown++; + break; + case HOME: + case CTRL_HOME: + iTopFileShown = 0; + iCurrFileShown = 0; + break; + case END: + case CTRL_END: + iTopFileShown = iTotalFiles-7; + iCurrFileShown = iTotalFiles-1; + break; + case DEL: + iFDlgState = DIALOG_DELETE; + break; + default: + //This case handles jumping the file list to display the file with the letter pressed. + if( pEvent->usParam >= 'a' && pEvent->usParam <= 'z' || + pEvent->usParam >= 'A' && pEvent->usParam <= 'Z' ) + { + if( pEvent->usParam >= 'A' && pEvent->usParam <= 'Z' ) //convert upper case to lower case + pEvent->usParam += 32; // A = 65, a = 97 (difference of 32) + SetTopFileToLetter( (UINT16)pEvent->usParam ); + } + break; + } + //Update the text field if the file value has changed. + if( iCurrFileShown != iPrevFileShown ) + { + INT32 x; + FDLG_LIST *curr; + x = 0; + curr = FileList; + while( curr && x != iCurrFileShown ) + { + curr = curr->pNext; + x++; + } + if( curr ) + { + SetInputFieldStringWith8BitString( 0, (UINT8 *)curr->FileInfo.zFileName ); + swprintf( gzFilename, L"%S", curr->FileInfo.zFileName ); + } + } +} + +//editor doesn't care about the z value. It uses it's own methods. +void SetGlobalSectorValues( UINT16 *szFilename ) +{ + UINT16 *pStr; + if( ValidCoordinate() ) + { + //convert the coordinate string into into the actual global sector coordinates. + if( gzFilename[0] >= 'A' && gzFilename[0] <= 'P' ) + gWorldSectorY = gzFilename[0] - 'A' + 1; + else + gWorldSectorY = gzFilename[0] - 'a' + 1; + if( gzFilename[1] == '1' && gzFilename[2] >= '0' && gzFilename[2] <= '6' ) + gWorldSectorX = ( gzFilename[1] - 0x30 ) * 10 + ( gzFilename[2] - 0x30 ); + else + gWorldSectorX = ( gzFilename[1] - 0x30 ); + pStr = wcsstr( gzFilename, L"_b" ); + if( pStr ) + { + if( pStr[ 2 ] >= '1' && pStr[ 2 ] <= '3' ) + { + gbWorldSectorZ = (INT8)(pStr[ 2 ] - 0x30); + } + } + } + else + { + gWorldSectorX = -1; + gWorldSectorY = -1; + gbWorldSectorZ = 0; + } +} + +void InitErrorCatchDialog() +{ + SGPRect CenteringRect= {0, 0, 639, 479 }; + + // do message box and return + giErrorCatchMessageBox = DoMessageBox( MSG_BOX_BASIC_STYLE, gzErrorCatchString, + EDIT_SCREEN, MSG_BOX_FLAG_OK, NULL, &CenteringRect ); + gfErrorCatch = FALSE; +} + +//Because loading and saving the map takes a few seconds, we want to post a message +//on the screen and then update it which requires passing the screen back to the main loop. +//When we come back for the next frame, we then actually save or load the map. So this +//process takes two full screen cycles. +UINT32 ProcessFileIO() +{ + INT16 usStartX, usStartY; + UINT8 ubNewFilename[50]; + switch( gbCurrentFileIOStatus ) + { + case INITIATE_MAP_SAVE: //draw save message + StartFrameBufferRender( ); + SaveFontSettings(); + SetFont( HUGEFONT ); + SetFontForeground( FONT_LTKHAKI ); + SetFontShadow( FONT_DKKHAKI ); + SetFontBackground( 0 ); + swprintf( zOrigName, L"Saving map: %s", gzFilename ); + usStartX = 320 - StringPixLength( zOrigName, LARGEFONT1 ) / 2; + usStartY = 180 - GetFontHeight( LARGEFONT1 ) / 2; + mprintf( usStartX, usStartY, zOrigName ); + + InvalidateScreen( ); + EndFrameBufferRender( ); + gbCurrentFileIOStatus = SAVING_MAP; + return LOADSAVE_SCREEN; + case SAVING_MAP: //save map + sprintf( (char *)ubNewFilename, "%S", gzFilename ); + RaiseWorldLand(); + if( gfShowPits ) + RemoveAllPits(); + OptimizeSchedules(); + if ( !SaveWorld( ubNewFilename ) ) + { + if( gfErrorCatch ) + { + InitErrorCatchDialog(); + return EDIT_SCREEN; + } + return ERROR_SCREEN; + } + if( gfShowPits ) + AddAllPits(); + + SetGlobalSectorValues( gzFilename ); + + if( gfGlobalSummaryExists ) + UpdateSectorSummary( gzFilename, gfUpdateSummaryInfo ); + + iCurrentAction = ACTION_NULL; + gbCurrentFileIOStatus = IOSTATUS_NONE; + gfRenderWorld = TRUE; + gfRenderTaskbar = TRUE; + fEnteringLoadSaveScreen = TRUE; + RestoreFontSettings(); + if( gfErrorCatch ) + { + InitErrorCatchDialog(); + return EDIT_SCREEN; + } + if( gMapInformation.ubMapVersion != gubMinorMapVersion ) + ScreenMsg( FONT_MCOLOR_RED, MSG_ERROR, L"Map data has just been corrupted!!! What did you just do? KM : 0" ); + return EDIT_SCREEN; + case INITIATE_MAP_LOAD: //draw load message + SaveFontSettings(); + gbCurrentFileIOStatus = LOADING_MAP; + if( gfEditMode && iCurrentTaskbar == TASK_MERCS ) + IndicateSelectedMerc( SELECT_NO_MERC ); + SpecifyItemToEdit( NULL, -1 ); + return LOADSAVE_SCREEN; + case LOADING_MAP: //load map + DisableUndo(); + sprintf( (char *)ubNewFilename, "%S", gzFilename ); + + RemoveMercsInSector( ); + + if( !LoadWorld( ubNewFilename ) ) + { //Want to override crash, so user can do something else. + EnableUndo(); + SetPendingNewScreen( LOADSAVE_SCREEN ); + gbCurrentFileIOStatus = IOSTATUS_NONE; + gfGlobalError = FALSE; + gfLoadError = TRUE; + //RemoveButton( iTempButton ); + CreateMessageBox( L" Error loading file. Try another filename?" ); + return LOADSAVE_SCREEN; + } + SetGlobalSectorValues( gzFilename ); + + RestoreFontSettings(); + + //Load successful, update necessary information. + + //ATE: Any current mercs are transfered here... + //UpdateMercsInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + + AddSoldierInitListTeamToWorld( ENEMY_TEAM, 255 ); + AddSoldierInitListTeamToWorld( CREATURE_TEAM, 255 ); + AddSoldierInitListTeamToWorld( MILITIA_TEAM, 255 ); + AddSoldierInitListTeamToWorld( CIV_TEAM, 255 ); + iCurrentAction = ACTION_NULL; + gbCurrentFileIOStatus = IOSTATUS_NONE; + if( !gfCaves && !gfBasement ) + { + gusLightLevel = 12; + if( ubAmbientLightLevel != 4 ) + { + ubAmbientLightLevel = 4; + LightSetBaseLevel( ubAmbientLightLevel ); + } + } + else + gusLightLevel = (UINT16)(EDITOR_LIGHT_MAX - ubAmbientLightLevel ); + gEditorLightColor = gpLightColors[ 0 ]; + gfRenderWorld = TRUE; + gfRenderTaskbar = TRUE; + fEnteringLoadSaveScreen = TRUE; + InitJA2SelectionWindow(); + ShowEntryPoints(); + EnableUndo(); + RemoveAllFromUndoList(); + SetEditorSmoothingMode( gMapInformation.ubEditorSmoothingType ); + if( gMapInformation.ubEditorSmoothingType == SMOOTHING_CAVES ) + AnalyseCaveMapForStructureInfo(); + + AddLockedDoorCursors(); + gubCurrRoomNumber = gubMaxRoomNumber; + UpdateRoofsView(); + UpdateWallsView(); + ShowLightPositionHandles(); + SetMercTeamVisibility( ENEMY_TEAM, gfShowEnemies ); + SetMercTeamVisibility( CREATURE_TEAM, gfShowCreatures ); + SetMercTeamVisibility( MILITIA_TEAM, gfShowRebels ); + SetMercTeamVisibility( CIV_TEAM, gfShowCivilians ); + BuildItemPoolList(); + if( gfShowPits ) + AddAllPits(); + + if( iCurrentTaskbar == TASK_MAPINFO ) + { //We have to temporarily remove the current textinput mode, + //update the disabled text field values, then restore the current + //text input fields. + SaveAndRemoveCurrentTextInputMode(); + UpdateMapInfoFields(); + RestoreSavedTextInputMode(); + } + return EDIT_SCREEN; + } + gbCurrentFileIOStatus = IOSTATUS_NONE; + return LOADSAVE_SCREEN; +} + +//LOADSCREEN +void FDlgNamesCallback( GUI_BUTTON *butn, INT32 reason ) +{ + if( reason & (MSYS_CALLBACK_REASON_LBUTTON_UP) ) + { + SelectFileDialogYPos( butn->Area.RelativeYPos ); + } +} + + +void FDlgOkCallback( GUI_BUTTON *butn, INT32 reason ) +{ + if( reason & (MSYS_CALLBACK_REASON_LBUTTON_UP) ) + { + gfDestroyFDlg = TRUE; + iFDlgState = iCurrentAction == ACTION_SAVE_MAP ? DIALOG_SAVE : DIALOG_LOAD; + } +} + +void FDlgCancelCallback( GUI_BUTTON *butn, INT32 reason ) +{ + if( reason & (MSYS_CALLBACK_REASON_LBUTTON_UP) ) + { + gfDestroyFDlg = TRUE; + iFDlgState = DIALOG_CANCEL; + } +} + +void FDlgUpCallback( GUI_BUTTON *butn, INT32 reason ) +{ + if( reason & (MSYS_CALLBACK_REASON_LBUTTON_UP) ) + { + if(iTopFileShown > 0) + iTopFileShown--; + } +} + +void FDlgDwnCallback( GUI_BUTTON *butn, INT32 reason ) +{ + if( reason & (MSYS_CALLBACK_REASON_LBUTTON_UP) ) + { + if( (iTopFileShown+7) < iTotalFiles ) + iTopFileShown++; + } +} + +BOOLEAN ExtractFilenameFromFields() +{ + Get16BitStringFromField( 0, gzFilename ); + return ValidFilename(); +} + +BOOLEAN ValidCoordinate() +{ + if( gzFilename[0] >= 'A' && gzFilename[0] <= 'P' || + gzFilename[0] >= 'a' && gzFilename[0] <='p' ) + { + UINT16 usTotal; + if( gzFilename[1] == '1' && gzFilename[2] >= '0' && gzFilename[2] <= '6' ) + { + usTotal = ( gzFilename[1] - 0x30 ) * 10 + ( gzFilename[2] - 0x30 ); + } + else if( gzFilename[1] >= '1' && gzFilename[1] <= '9') + { + if( gzFilename[2] < '0' || gzFilename[2] > '9' ) + { + usTotal = ( gzFilename[1] - 0x30 ); + } + else + { + return FALSE; + } + } + if( usTotal >= 1 && usTotal <= 16 ) + { + return TRUE; + } + } + return FALSE; +} + +BOOLEAN ValidFilename() +{ + UINT16 *pDest; + if( gzFilename[0] != '\0' )// ; <----- I really think they didn't mean this!! (jonathanl) + { + pDest = wcsstr( gzFilename, L".dat" ); + if( !pDest ) + pDest = wcsstr( gzFilename, L".DAT" ); + if( pDest && pDest != gzFilename && pDest[4] == '\0' ) + return TRUE; + } + return FALSE; +} + +BOOLEAN ExternalLoadMap( UINT16 *szFilename ) +{ + Assert( szFilename ); + if( !wcslen( szFilename ) ) + return FALSE; + wcscpy( gzFilename, szFilename ); + if( !ValidFilename() ) + return FALSE; + gbCurrentFileIOStatus = INITIATE_MAP_LOAD; + ProcessFileIO(); //always returns loadsave_screen and changes iostatus to loading_map. + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + RefreshScreen( NULL ); + if( ProcessFileIO() == EDIT_SCREEN ) + return TRUE; + return FALSE; +} + +BOOLEAN ExternalSaveMap( UINT16 *szFilename ) +{ + Assert( szFilename ); + if( !wcslen( szFilename ) ) + return FALSE; + wcscpy( gzFilename, szFilename ); + if( !ValidFilename() ) + return FALSE; + gbCurrentFileIOStatus = INITIATE_MAP_SAVE; + if( ProcessFileIO() == ERROR_SCREEN ) + return FALSE; + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + RefreshScreen( NULL ); + if( ProcessFileIO() == EDIT_SCREEN ) + return TRUE; + return FALSE; +} + +#else //non-editor version + +#include "types.h" +#include "screenids.h" + +UINT32 LoadSaveScreenInit() +{ + return TRUE ; +} + +UINT32 LoadSaveScreenHandle( ) +{ + //If this screen ever gets set, then this is a bad thing -- endless loop + return ERROR_SCREEN ; +} + +UINT32 LoadSaveScreenShutdown( ) +{ + return TRUE ; +} + +#endif + + + + + + + diff --git a/Editor/LoadScreen.h b/Editor/LoadScreen.h new file mode 100644 index 00000000..88d6dd58 --- /dev/null +++ b/Editor/LoadScreen.h @@ -0,0 +1,60 @@ +#include "BuildDefines.h" +#include "Fileman.h" + +#ifdef JA2EDITOR + +#ifndef _JA2_LOAD_SCREEN_ +#define _JA2_LOAD_SCREEN_ + +typedef struct _FDLG_LIST_TAG +{ + GETFILESTRUCT FileInfo; + struct _FDLG_LIST_TAG *pNext; + struct _FDLG_LIST_TAG *pPrev; +} FDLG_LIST; + +extern FDLG_LIST *AddToFDlgList(FDLG_LIST *pList, GETFILESTRUCT *pInfo); + +extern void TrashFDlgList(FDLG_LIST *pList); + +extern INT32 iFDlgState; +extern INT32 iFDlgSelectedSlot; + +extern BOOLEAN gfAskForName; +extern BOOLEAN gfCreatedFDlg; +extern BOOLEAN gfDestroyFDlg; + +UINT32 WaitForFileName( void ); +void RemoveFileDialog(void); +void CreateFileDialog( UINT16 *zTitle ); + +void SelectFileDialogYPos( UINT16 usRelativeYPos ); + + +void BuildFilenameWithCoordinate(); +void BuildCoordinateWithFilename(); +BOOLEAN ExtractFilenameFromFields(); +BOOLEAN ValidCoordinate(); +BOOLEAN ValidFilename(); + +BOOLEAN ExternalLoadMap( UINT16 *szFilename ); +BOOLEAN ExternalSaveMap( UINT16 *szFilename ); + +extern BOOLEAN gfErrorCatch; +extern UINT16 gzErrorCatchString[ 256 ]; + +#endif +#endif + + + + + + + + + + + + + diff --git a/Editor/Road Smoothing.cpp b/Editor/Road Smoothing.cpp new file mode 100644 index 00000000..bde53202 --- /dev/null +++ b/Editor/Road Smoothing.cpp @@ -0,0 +1,450 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "types.h" + #include "Road Smoothing.h" + #include "tiledat.h" + #include "worlddef.h" + #include "worldman.h" +#endif + + +typedef struct MACROSTRUCT +{ + INT16 sMacroID; + INT16 sOffset; +}MACROSTRUCT; +//road macros + +//These define the macros for the 32 road pieces. The column contains the macro ID and +//the second contains the gridno offset from the anchor position (where the user clicks in the world to +//place the road). The actual index of the array refers to the offset from ROADPIECE001. +MACROSTRUCT gRoadMacros[] = +{ + //left 1 + {L1, -2 }, + {L1, -162 }, + {L1, -322 }, + {L1, -1 }, + {L1, -161 }, + {L1, -321 }, + {L1, 0 }, + {L1, -160 }, + {L1, -320 }, + //right 1 + {R1, -2 }, + {R1, -162 }, + {R1, -322 }, + {R1, -1 }, + {R1, -161 }, + {R1, -321 }, + {R1, 0 }, + {R1, -160 }, + {R1, -320 }, + //bottom 1 + {B1, -2 }, + {B1, -162 }, + {B1, -322 }, + {B1, -1 }, + {B1, -161 }, + {B1, -321 }, + {B1, 0 }, + {B1, -160 }, + {B1, -320 }, + //top 1 + {T1, -2 }, + {T1, -162 }, + {T1, -322 }, + {T1, -1 }, + {T1, -161 }, + {T1, -321 }, + {T1, 0 }, + {T1, -160 }, + {T1, -320 }, + //top half of top-right corner + {TTR, -4 }, + {TTR, -164 }, + {TTR, -324 }, + {TTR, -3 }, + {TTR, -163 }, + {TTR, -323 }, + {TTR, -2 }, + {TTR, -162 }, + {TTR, -1 }, + {TTR, -161 }, + {TTR, 0 }, + //bottom half of top-right corner + {BTR, -5 }, + {BTR, -165 }, + {BTR, -325 }, + {BTR, -4 }, //50 + {BTR, -164 }, + {BTR, -324 }, + {BTR, -3 }, + {BTR, -163 }, + {BTR, -323 }, + {BTR, -2 }, + {BTR, -162 }, + {BTR, -322 }, + {BTR, -1 }, + {BTR, -161 }, + {BTR, -321 }, + {BTR, 0 }, + {BTR, -160 }, + //left half of bottom-left corner + {LBL, -322 }, + {LBL, -482 }, + {LBL, -642 }, + {LBL, -161 }, + {LBL, -321 }, + {LBL, -481 }, + {LBL, -641 }, + {LBL, 0 }, + {LBL, -160 }, + {LBL, -320 }, + {LBL, -480 }, + {LBL, -640 }, + //right half of bottom-left corner + {RBL, -162 }, + {RBL, -322 }, + {RBL, -482 }, + {RBL, -642 }, + {RBL, -802 }, + {RBL, -1 }, + {RBL, -161 }, + {RBL, -321 }, + {RBL, -481 }, + {RBL, -641 }, + {RBL, -801 }, + {RBL, 0 }, + {RBL, -160 }, + {RBL, -320 }, + {RBL, -480 }, + {RBL, -640 }, + {RBL, -800 }, + //left half of the top-left corner + {LTL, -2 }, + {LTL, -162 }, + {LTL, -322 }, + {LTL, -1 }, + {LTL, -161 }, + {LTL, -321 }, + {LTL, -481 }, + {LTL, 0 }, //100 + {LTL, -160 }, + {LTL, -320 }, + {LTL, -480 }, + {LTL, -640 }, + //right half of top-left corner + {RTL, -2 }, + {RTL, -162 }, + {RTL, -322 }, + {RTL, -482 }, + {RTL, -642 }, + {RTL, -802 }, + {RTL, -1 }, + {RTL, -161 }, + {RTL, -321 }, + {RTL, -481 }, + {RTL, -641 }, + {RTL, -801 }, + {RTL, 0 }, + {RTL, -160 }, + {RTL, -320 }, + {RTL, -480 }, + {RTL, -640 }, + {RTL, -800 }, + //right half of top-left corner + {RBR, 159 }, + {RBR, -1 }, + {RBR, -161 }, + {RBR, -321 }, + {RBR, -481 }, + {RBR, -641 }, + {RBR, 0 }, + {RBR, -160 }, + {RBR, -320 }, + {RBR, -480 }, + {RBR, -640 }, + {RBR, -159 }, + {RBR, -319 }, + {RBR, -479 }, + {RBR, -639 }, + //right half of top-left corner + {LBR, 158 }, + {LBR, -2 }, + {LBR, -162 }, + {LBR, -322 }, + {LBR, -482 }, + {LBR, -642 }, + {LBR, 159 }, + {LBR, -1 }, + {LBR, -161 }, + {LBR, -321 }, + {LBR, -481 }, + {LBR, -641 }, + {LBR, 160 }, //150 + {LBR, 0 }, + {LBR, -160 }, + {LBR, -320 }, + {LBR, -480 }, + {LBR, -640 }, + //left 2 + {L2, -2 }, + {L2, -162 }, + {L2, -322 }, + {L2, -1 }, + {L2, -161 }, + {L2, -321 }, + {L2, 0 }, + {L2, -160 }, + {L2, -320 }, + //right 2 + {R2, -2 }, + {R2, -162 }, + {R2, -322 }, + {R2, -1 }, + {R2, -161 }, + {R2, -321 }, + {R2, 0 }, + {R2, -160 }, + {R2, -320 }, + //left 3 + {L3, -2 }, + {L3, -162 }, + {L3, -322 }, + {L3, -1 }, + {L3, -161 }, + {L3, -321 }, + {L3, 0 }, + {L3, -160 }, + {L3, -320 }, + //right 3 + {R3, -2 }, + {R3, -162 }, + {R3, -322 }, + {R3, -1 }, + {R3, -161 }, + {R3, -321 }, + {R3, 0 }, + {R3, -160 }, + {R3, -320 }, + //bottom 2 + {B2, -2 }, + {B2, -162 }, + {B2, -322 }, + {B2, -1 }, + {B2, -161 }, + {B2, -321 }, + {B2, 0 }, + {B2, -160 }, + {B2, -320 }, //200 + //top 2 + {T2, -2 }, + {T2, -162 }, + {T2, -322 }, + {T2, -1 }, + {T2, -161 }, + {T2, -321 }, + {T2, 0 }, + {T2, -160 }, + {T2, -320 }, + //bottom 3 + {B3, -2 }, + {B3, -162 }, + {B3, -322 }, + {B3, -1 }, + {B3, -161 }, + {B3, -321 }, + {B3, 0 }, + {B3, -160 }, + {B3, -320 }, + //top 3 + {T3, -2 }, + {T3, -162 }, + {T3, -322 }, + {T3, -1 }, + {T3, -161 }, + {T3, -321 }, + {T3, 0 }, + {T3, -160 }, + {T3, -320 }, + //bottom interior + {BI, -2 }, + {BI, -162 }, + {BI, -322 }, + {BI, -1 }, + {BI, -161 }, + {BI, -321 }, + {BI, 0 }, + {BI, -160 }, + {BI, -320 }, + //left interior + {LI, -2 }, + {LI, -162 }, + {LI, -322 }, + {LI, -1 }, + {LI, -161 }, + {LI, -321 }, + {LI, 0 }, + {LI, -160 }, + {LI, -320 }, + //top interior + {TI, -2 }, + {TI, -162 }, + {TI, -322 }, + {TI, -1 }, + {TI, -161 }, //250 + {TI, -321 }, + {TI, 0 }, + {TI, -160 }, + {TI, -320 }, + //right interior + {RI, -2 }, //0 + {RI, -162 }, + {RI, -322 }, + {RI, -1 }, + {RI, -161 }, + {RI, -321 }, + {RI, 0 }, + {RI, -160 }, + {RI, -320 }, + //left 4 + {L4, -2 }, + {L4, -162 }, + {L4, -322 }, + {L4, -1 }, + {L4, -161 }, + {L4, -321 }, + {L4, 0 }, + {L4, -160 }, + {L4, -320 }, + //right 4 + {R4, -2 }, + {R4, -162 }, + {R4, -322 }, + {R4, -1 }, + {R4, -161 }, + {R4, -321 }, + {R4, 0 }, + {R4, -160 }, + {R4, -320 }, + //bottom 4 + {B4, -2 }, + {B4, -162 }, + {B4, -322 }, + {B4, -1 }, + {B4, -161 }, + {B4, -321 }, + {B4, 0 }, + {B4, -160 }, + {B4, -320 }, + //top 4 + {T4, -2 }, + {T4, -162 }, + {T4, -322 }, + {T4, -1 }, + {T4, -161 }, + {T4, -321 }, + {T4, 0 }, + {T4, -160 }, + {T4, -320 }, + //right edge (end of road) + {RE, 0 }, + {RE, -160 }, + {RE, -320 }, + //left edge + {LE, 0 }, + {LE, -160 }, + {LE, -320 }, + //bottom edge + {BE, -2 }, + {BE, -1 }, + {BE, 0 }, + //top edge + {TE, -2 }, + {TE, -1 }, + {TE, 0 } +}; + +INT16 gsRoadMacroStartIndex[ NUM_ROAD_MACROS ]; + +//A simple optimization function that calculates the first index in the large database for +//the particular macro ID. +void InitializeRoadMacros() +{ + INT16 i, end; + INT16 sMacro = 0; + end = sizeof( gRoadMacros ) / 4; + for( i = 0; i < end; i++ ) + { + if( i >= sizeof( gRoadMacros ) / sizeof( MACROSTRUCT ) ) + { + i = i; + } + if( gRoadMacros[ i ].sMacroID == sMacro ) + { + gsRoadMacroStartIndex[ sMacro ] = i; + sMacro++; + } + } +// i = ROADPIECES001; +} + +//Road macros vary in size from 3 gridnos to 18 gridnos. Using the anchor gridno based off of the original +//road system, this function will place the new macro (consisting of multiple road pieces in multiple +//gridnos). +void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID ) +{ + INT32 i; + UINT16 usTileIndex; + i = gsRoadMacroStartIndex[ iMacroID ]; + while( gRoadMacros[ i ].sMacroID == iMacroID ) + { + AddToUndoList( iMapIndex + gRoadMacros[ i ].sOffset ); + RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES ); + GetTileIndexFromTypeSubIndex( ROADPIECES, (UINT16)(i+1) , &usTileIndex ); + AddObjectToHead( iMapIndex + gRoadMacros[ i ].sOffset, usTileIndex ); + i++; + } +} + +//The old road system used multi-tiled roads as a single image. The new road system has taken these large +//pieces and chopped them up into single tiled images (to mitigate lighting problems). Some of the larger +//road pieces turned into 18 smaller pieces. So this function will go analyse the world, and replaces any +//locations containing the original road tile information, delete it, and replace it by inserting it's +//equivalent macro. +void ReplaceObsoleteRoads() +{ + INT32 i; + INT32 iMacro; + LEVELNODE *pObject; + BOOLEAN fRoadExistsAtGridNo; + for( i = 0; i < WORLD_MAX; i++ ) + { + pObject = gpWorldLevelData[ i ].pObjectHead; + fRoadExistsAtGridNo = FALSE; + while( pObject ) + { + if( pObject->usIndex >= FIRSTROAD1 && pObject->usIndex <= FIRSTROAD32 ) + { + fRoadExistsAtGridNo = TRUE; + iMacro = pObject->usIndex - FIRSTROAD1; + PlaceRoadMacroAtGridNo( i, iMacro ); + } + pObject = pObject->pNext; + } + if( fRoadExistsAtGridNo ) + { + RemoveAllObjectsOfTypeRange( i, FIRSTROAD, FIRSTROAD ); + } + } +} + +#endif diff --git a/Editor/Road Smoothing.h b/Editor/Road Smoothing.h new file mode 100644 index 00000000..b7a39efa --- /dev/null +++ b/Editor/Road Smoothing.h @@ -0,0 +1,64 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR + +#ifndef __ROAD_SMOOTHING_H +#define __ROAD_SMOOTHING_H + +//There are the 32 macro definitions that make up all of the road pieces. These enumerations +//match up exactly to the previous road system order of graphics (FIRSTROAD1 - FIRSTROAD32) +enum +{ + L1, //left 1 -- this is a left straight-away edge + R1, //right 1 + B1, //bottom 1 + T1, //top 1 + TTR, //top top-right corner piece (the top part of the top-right corner) + BTR, //bottom top-right corner piece (the bottom part of the top-right corner) + LBL, //left bottom-left corner piece + RBL, //right bottom-left corner piece + LTL, //left top-left corner piece + RTL, //right top-left corner piece + RBR, //right bottom-right corner piece + LBR, //left bottom-right corner piece + L2, //left 2 (variation of the left 1) + R2, //right 2 + L3, //left 3 + R3, //right 3 + B2, //bottom 2 + T2, //top 2 + B3, //bottom 3 + T3, //top 3 + BI, //bottom intersection (piece connecting bottom to right) + LI, //left intersection (piece connecting left to bottom ) + TI, //top intersection (piece connecting top to left) + RI, //right intersection (piece connection right to top) + L4, //left 4 + R4, //right 4 + B4, //bottom 4 + T4, //top 4 + RE, //right edge (end of road) + LE, //left edge + BE, //bottom edge + TE, //top edge + NUM_ROAD_MACROS +}; + +//The old road system used multi-tiled roads as a single image. The new road system has taken these large +//pieces and chopped them up into single tiled images (to mitigate lighting problems). Some of the larger +//road pieces turned into 18 smaller pieces. So this function will go analyse the world, and replaces any +//locations containing the original road tile information, delete it, and replace it by inserting it's +//equivalent macro. +void ReplaceObsoleteRoads(); + +//Road macros vary in size from 3 gridnos to 18 gridnos. Using the anchor gridno based off of the original +//road system, this function will place the new macro (consisting of multiple road pieces in multiple +//gridnos). +void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID ); + +void InitializeRoadMacros(); + + +#endif + +#endif \ No newline at end of file diff --git a/Editor/Sector Summary.cpp b/Editor/Sector Summary.cpp new file mode 100644 index 00000000..b4d5fe74 --- /dev/null +++ b/Editor/Sector Summary.cpp @@ -0,0 +1,3101 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + + +#ifndef PRECOMPILEDHEADERS + #include + #include "types.h" + #include "Sector Summary.h" + #include "Timer Control.h" + #include "vsurface.h" + #include "Button System.h" + #include "Font Control.h" + #include "Simple Render Utils.h" + #include "Editor Taskbar Utils.h" + #include "line.h" + #include "input.h" + #include "vobject_blitters.h" + #include "loadscreen.h" + #include "Text Input.h" + #include "mousesystem.h" + #include "strategicmap.h" + #include "Fileman.h" + #include "Exit Grids.h" + #include "Map Information.h" + #include "Summary Info.h" + #include "Animated ProgressBar.h" + #include "worlddef.h" + #include "worlddat.h" + #include "EditorDefines.h" + #include "editscreen.h" + #include "english.h" + #include "World Items.h" + #include "text.h" +#endif + +extern BOOLEAN gfOverheadMapDirty; + +#define MAP_SIZE 208 +#define MAP_LEFT 417 +#define MAP_TOP 15 +#define MAP_RIGHT (MAP_LEFT+MAP_SIZE) +#define MAP_BOTTOM (MAP_TOP+MAP_SIZE) + +enum{ + PRE_ALPHA, + ALPHA, + DEMO, + BETA, + RELEASE +}; +UINT16 gszVersionType[5][10] = { L"Pre-Alpha", L"Alpha", L"Demo", L"Beta", L"Release" }; +#define GLOBAL_SUMMARY_STATE RELEASE + +//Regular masks +#define GROUND_LEVEL_MASK 0x01 +#define BASEMENT1_LEVEL_MASK 0x02 +#define BASEMENT2_LEVEL_MASK 0x04 +#define BASEMENT3_LEVEL_MASK 0x08 +#define ALL_LEVELS_MASK 0x0f +//Alternate masks +#define ALTERNATE_GROUND_MASK 0x10 +#define ALTERNATE_B1_MASK 0x20 +#define ALTERNATE_B2_MASK 0x40 +#define ALTERNATE_B3_MASK 0x80 +#define ALTERNATE_LEVELS_MASK 0xf0 + +void ExtractTempFilename(); + +INT32 giCurrLevel; + +BOOLEAN gfOutdatedDenied; +UINT16 gusNumEntriesWithOutdatedOrNoSummaryInfo; + +void UpdateMasterProgress(); +BOOLEAN gfUpdatingNow; +UINT16 gusTotal, gusCurrent; + +BOOLEAN gfMustForceUpdateAllMaps = FALSE; +UINT16 gusNumberOfMapsToBeForceUpdated = 0; +BOOLEAN gfMajorUpdate = FALSE; + +void LoadSummary( UINT8 *pSector, UINT8 ubLevel, FLOAT dMajorMapVersion ); +void RegenerateSummaryInfoForAllOutdatedMaps(); + +void SetupItemDetailsMode( BOOLEAN fAllowRecursion ); + +INT32 giCurrentViewLevel = ALL_LEVELS_MASK; + +BOOLEAN gbSectorLevels[16][16]; +BOOLEAN gfGlobalSummaryLoaded = FALSE; + +SUMMARYFILE *gpSectorSummary[16][16][8]; +SUMMARYFILE *gpCurrentSectorSummary; + +MOUSE_REGION MapRegion; + +extern INT8 gbMercSlotTypes[9]; + +extern void UpdateSummaryInfo( SUMMARYFILE *pSummary ); + +void SummaryOkayCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryToggleGridCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryToggleProgressCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryToggleLevelCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryLoadMapCallback( GUI_BUTTON *btn, INT32 reason ); +void SummarySaveMapCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryOverrideCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryNewGroundLevelCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryNewBasementLevelCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryNewCaveLevelCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryUpdateCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryToggleAlternateCallback( GUI_BUTTON *btn, INT32 reason ); +void SummarySciFiCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryRealCallback( GUI_BUTTON *btn, INT32 reason ); +void SummaryEnemyCallback( GUI_BUTTON *btn, INT32 reason ); +void MapMoveCallback( MOUSE_REGION *reg, INT32 reason ); +void MapClickCallback( MOUSE_REGION *reg, INT32 reason ); + +//Set if there is an existing global summary. The first time this is run on your computer, it +//will not exist, and will have to be generated before this will be set. +BOOLEAN gfGlobalSummaryExists; +//If you don't wish to create a global summary, you can deny it. This safely locks the system +//from generating one. +BOOLEAN gfDeniedSummaryCreation; +//Set whenever the entire display is to be marked dirty. +BOOLEAN gfRenderSummary; +//Used externally to determine if the summary window is up or not. +BOOLEAN gfSummaryWindowActive; +//When set, the summary window stays up until told otherwise. When clear, the summary will disappear +//when the assigned key (F5) is released. The latter mode is initiated when F5 is held down for longer +//than .4 seconds, and is useful for quickly looking at the information in the current map being edited. +BOOLEAN gfPersistantSummary; +//When set, a grid is overlayed on top of the sector. This grid defines each of the 256 sectors. It is +//on by default. +BOOLEAN gfRenderGrid; +//When set, parts of the map are darkened, showing that those sectors don't exist in the currently selected +//layer. When clear, the entire map is shown in full color. +BOOLEAN gfRenderProgress; +//When set, only the map section is rerendered. +extern BOOLEAN gfRenderMap; // symbol already declared globally in AI Viewer.cpp (jonathanl) +//Set whenever the ctrl key is held down. This is used in conjunction with gfFileIO to determine whether the +//selected sector is to be saved instead of loaded when clear. +BOOLEAN gfCtrlPressed; +//When set, it is time to load or save the selected sector. If gfCtrlPressed is set, the the map is saved, +//instead of loaded. It is impossible to load a map that doesn't exist. +BOOLEAN gfFileIO; +//When set, then we are overriding the ability to use normal methods for selecting sectors for saving and +//loading. Immediately upon entering the text input mode; for the temp file; then we are assuming that +//the user will type in a name that doesn't follow standard naming conventions for the purposes of the +//campaign editor. This is useful for naming a temp file for saving or loading. +BOOLEAN gfTempFile; +//When set, only the alternate version of the maps will be displayed. This is used for alternate maps in +//particular sectors, such as the SkyRider quest which could be located at one of four maps randomly. If +//that particular map is chosen, then the alternate map will be used. +BOOLEAN gfAlternateMaps = FALSE; + + +enum +{ + ITEMMODE_SCIFI, + ITEMMODE_REAL, + ITEMMODE_ENEMY, +}; +UINT8 gubSummaryItemMode = ITEMMODE_SCIFI; + +BOOLEAN gfItemDetailsMode = FALSE; + +WORLDITEM *gpWorldItemsSummaryArray = NULL; +UINT16 gusWorldItemsSummaryArraySize = 0; +OBJECTTYPE *gpPEnemyItemsSummaryArray = NULL; +UINT16 gusPEnemyItemsSummaryArraySize = 0; +OBJECTTYPE *gpNEnemyItemsSummaryArray = NULL; +UINT16 gusNEnemyItemsSummaryArraySize = 0; + +BOOLEAN gfSetupItemDetailsMode = TRUE; + +BOOLEAN gfUpdateSummaryInfo; + +UINT16 usNumSummaryFilesOutOfDate; + +BOOLEAN gfMapFileDirty; + +//Override status. Hide is when there is nothing to override, readonly, when checked is to override a +//readonly status file, so that you can write to it, and overwrite, when checked, allows you to save, +//replacing the existing file. These states are not persistant, which forces the user to check the +//box before saving. +enum{ INACTIVE, READONLY, OVERWRITE }; +UINT8 gubOverrideStatus; +//Set when the a new sector/level is selected, forcing the user to reselect the override status. +BOOLEAN gfOverrideDirty; +//The state of the override button, true if overriden intended. +BOOLEAN gfOverride; + +//The sector coordinates of the map currently loaded in memory (blue) +INT16 gsSectorX, gsSectorY; +//The layer of the sector that is currently loaded in memory. +INT32 gsSectorLayer; +//The sector coordinates of the mouse position (yellow) +extern INT16 gsHiSectorX; // symbol already declared globally in AI Viewer.cpp (jonathanl) +extern INT16 gsHiSectorY; // symbol already declared globally in AI Viewer.cpp (jonathanl) +//The sector coordinates of the selected sector (red) +extern INT16 gsSelSectorX; // symbol already declared globally in AI Viewer.cpp (jonathanl) +extern INT16 gsSelSectorY; // symbol already declared globally in AI Viewer.cpp (jonathanl) + +//Used to determine how long the F5 key has been held down for to determine whether or not the +//summary is going to be persistant or not. +UINT32 giInitTimer; + +UINT16 gszFilename[40]; +UINT16 gszTempFilename[21]; +UINT16 gszDisplayName[21]; + +void CalculateOverrideStatus(); + +enum{ + SUMMARY_BACKGROUND, + SUMMARY_OKAY, + SUMMARY_GRIDCHECKBOX, + SUMMARY_PROGRESSCHECKBOX, + SUMMARY_ALL, + SUMMARY_G, + SUMMARY_B1, + SUMMARY_B2, + SUMMARY_B3, + SUMMARY_ALTERNATE, + SUMMARY_LOAD, + SUMMARY_SAVE, + SUMMARY_OVERRIDE, +#if 0 + SUMMARY_NEW_GROUNDLEVEL, + SUMMARY_NEW_BASEMENTLEVEL, + SUMMARY_NEW_CAVELEVEL, +#endif + SUMMARY_UPDATE, + SUMMARY_SCIFI, + SUMMARY_REAL, + SUMMARY_ENEMY, + NUM_SUMMARY_BUTTONS +}; +INT32 iSummaryButton[ NUM_SUMMARY_BUTTONS ]; + +void CreateSummaryWindow() +{ + INT32 i; + + if( !gfGlobalSummaryLoaded ) + { + LoadGlobalSummary(); + gfGlobalSummaryLoaded = TRUE; + } + + if( gfSummaryWindowActive ) + return; + + DisableEditorTaskbar(); + DisableAllTextFields(); + + GetCurrentWorldSector( &gsSectorX, &gsSectorY ); + gsSelSectorX = gsSectorX; + gsSelSectorY = gsSectorY; + gfSummaryWindowActive = TRUE; + gfPersistantSummary = FALSE; + giInitTimer = GetJA2Clock(); + gfDeniedSummaryCreation = FALSE; + gfRenderSummary = TRUE; + if( gfWorldLoaded ) + gfMapFileDirty = TRUE; + //Create all of the buttons here + iSummaryButton[ SUMMARY_BACKGROUND ] = + CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, 0, 0, 640, 360, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1, + BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); + SpecifyDisabledButtonStyle( iSummaryButton[ SUMMARY_BACKGROUND ], DISABLED_STYLE_NONE ); + DisableButton( iSummaryButton[ SUMMARY_BACKGROUND ] ); + + iSummaryButton[ SUMMARY_OKAY ] = + CreateTextButton(L"Okay", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + 585, 325, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + SummaryOkayCallback ); + //GiveButtonDefaultStatus( iSummaryButton[ SUMMARY_OKAY ], DEFAULT_STATUS_WINDOWS95 ); + + iSummaryButton[ SUMMARY_GRIDCHECKBOX ] = + CreateCheckBoxButton( MAP_LEFT, ( INT16 ) ( MAP_BOTTOM + 5 ), "EDITOR//smcheckbox.sti", MSYS_PRIORITY_HIGH, SummaryToggleGridCallback ); + ButtonList[ iSummaryButton[ SUMMARY_GRIDCHECKBOX ] ]->uiFlags |= BUTTON_CLICKED_ON; + gfRenderGrid = TRUE; + + iSummaryButton[ SUMMARY_PROGRESSCHECKBOX ] = + CreateCheckBoxButton( ( INT16 ) ( MAP_LEFT + 50 ), ( INT16 ) ( MAP_BOTTOM + 5 ), "EDITOR//smcheckbox.sti", MSYS_PRIORITY_HIGH, SummaryToggleProgressCallback ); + ButtonList[ iSummaryButton[ SUMMARY_PROGRESSCHECKBOX ] ]->uiFlags |= BUTTON_CLICKED_ON; + gfRenderProgress = TRUE; + + iSummaryButton[ SUMMARY_ALL ] = + CreateTextButton( L"A", SMALLCOMPFONT, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + MAP_LEFT+110, MAP_BOTTOM+5, 16, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + SummaryToggleLevelCallback ); + if( giCurrentViewLevel == ALL_LEVELS_MASK || giCurrentViewLevel == ALTERNATE_LEVELS_MASK ) + ButtonList[ iSummaryButton[ SUMMARY_ALL ] ]->uiFlags |= BUTTON_CLICKED_ON; + iSummaryButton[ SUMMARY_G ] = + CreateTextButton( L"G", SMALLCOMPFONT, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + MAP_LEFT+128, MAP_BOTTOM+5, 16, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + SummaryToggleLevelCallback ); + if( giCurrentViewLevel == GROUND_LEVEL_MASK || giCurrentViewLevel == ALTERNATE_GROUND_MASK ) + ButtonList[ iSummaryButton[ SUMMARY_G ] ]->uiFlags |= BUTTON_CLICKED_ON; + iSummaryButton[ SUMMARY_B1 ] = + CreateTextButton( L"B1", SMALLCOMPFONT, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + MAP_LEFT+146, MAP_BOTTOM+5, 16, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + SummaryToggleLevelCallback ); + if( giCurrentViewLevel == BASEMENT1_LEVEL_MASK || giCurrentViewLevel == ALTERNATE_B1_MASK ) + ButtonList[ iSummaryButton[ SUMMARY_B1 ] ]->uiFlags |= BUTTON_CLICKED_ON; + iSummaryButton[ SUMMARY_B2 ] = + CreateTextButton( L"B2", SMALLCOMPFONT, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + MAP_LEFT+164, MAP_BOTTOM+5, 16, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + SummaryToggleLevelCallback ); + if( giCurrentViewLevel == BASEMENT2_LEVEL_MASK || giCurrentViewLevel == ALTERNATE_B2_MASK ) + ButtonList[ iSummaryButton[ SUMMARY_B2 ] ]->uiFlags |= BUTTON_CLICKED_ON; + iSummaryButton[ SUMMARY_B3 ] = + CreateTextButton( L"B3", SMALLCOMPFONT, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + MAP_LEFT+182, MAP_BOTTOM+5, 16, 16, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + SummaryToggleLevelCallback ); + if( giCurrentViewLevel == BASEMENT3_LEVEL_MASK || giCurrentViewLevel == ALTERNATE_B3_MASK ) + ButtonList[ iSummaryButton[ SUMMARY_B3 ] ]->uiFlags |= BUTTON_CLICKED_ON; + + iSummaryButton[ SUMMARY_ALTERNATE ] = + CreateCheckBoxButton( MAP_LEFT, ( INT16 ) ( MAP_BOTTOM + 25 ), "EDITOR//smcheckbox.sti", MSYS_PRIORITY_HIGH, SummaryToggleAlternateCallback ); + if( gfAlternateMaps ) + ButtonList[ iSummaryButton[ SUMMARY_ALTERNATE ] ]->uiFlags |= BUTTON_CLICKED_ON; + + iSummaryButton[ SUMMARY_LOAD ] = + CreateTextButton( L"LOAD", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + MAP_LEFT, MAP_BOTTOM+45, 50, 26, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + SummaryLoadMapCallback ); + iSummaryButton[ SUMMARY_SAVE ] = + CreateTextButton( L"SAVE", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + MAP_LEFT+55, MAP_BOTTOM+45, 50, 26, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + SummarySaveMapCallback ); + iSummaryButton[ SUMMARY_OVERRIDE ] = + CreateCheckBoxButton( ( INT16 ) ( MAP_LEFT + 110 ), ( INT16 ) ( MAP_BOTTOM + 59 ), "EDITOR\\smcheckbox.sti", MSYS_PRIORITY_HIGH, SummaryOverrideCallback ); + + +#if 0 + iSummaryButton[ SUMMARY_NEW_GROUNDLEVEL ] = + CreateSimpleButton( MAP_LEFT, MAP_BOTTOM+58, "EDITOR\\new.sti", BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, SummaryNewGroundLevelCallback ); + SetButtonFastHelpText( iSummaryButton[ SUMMARY_NEW_GROUNDLEVEL ], L"New map" ); + iSummaryButton[ SUMMARY_NEW_BASEMENTLEVEL ] = + CreateSimpleButton( MAP_LEFT+32, MAP_BOTTOM+58, "EDITOR\\new.sti", BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, SummaryNewBasementLevelCallback ); + SetButtonFastHelpText( iSummaryButton[ SUMMARY_NEW_BASEMENTLEVEL ], L"New basement" ); + iSummaryButton[ SUMMARY_NEW_CAVELEVEL ] = + CreateSimpleButton( MAP_LEFT+64, MAP_BOTTOM+58, "EDITOR\\new.sti", BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, SummaryNewCaveLevelCallback ); + SetButtonFastHelpText( iSummaryButton[ SUMMARY_NEW_CAVELEVEL ], L"New cave level" ); +#endif + + + iSummaryButton[ SUMMARY_UPDATE ] = + CreateTextButton( L"Update", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT, + 255, 15, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, + SummaryUpdateCallback ); + + iSummaryButton[ SUMMARY_REAL ] = + CreateCheckBoxButton( 350, 47, "EDITOR\\radiobutton.sti", MSYS_PRIORITY_HIGH, SummaryRealCallback ); + iSummaryButton[ SUMMARY_SCIFI ] = + CreateCheckBoxButton( 376, 47, "EDITOR\\radiobutton.sti", MSYS_PRIORITY_HIGH, SummarySciFiCallback ); + iSummaryButton[ SUMMARY_ENEMY ] = + CreateCheckBoxButton( 350, 60, "EDITOR\\radiobutton.sti", MSYS_PRIORITY_HIGH, SummaryEnemyCallback ); + + //SetButtonFastHelpText( iSummaryButton[ SUMMARY_SCIFI ], L"Display items that appear in SciFi mode." ); + //SetButtonFastHelpText( iSummaryButton[ SUMMARY_REAL ], L"Display items that appear in Realistic mode." ); + switch( gubSummaryItemMode ) + { + case ITEMMODE_SCIFI: + ButtonList[ iSummaryButton[ SUMMARY_SCIFI ] ]->uiFlags |= BUTTON_CLICKED_ON; + break; + case ITEMMODE_REAL: + ButtonList[ iSummaryButton[ SUMMARY_REAL ] ]->uiFlags |= BUTTON_CLICKED_ON; + break; + case ITEMMODE_ENEMY: + ButtonList[ iSummaryButton[ SUMMARY_ENEMY ] ]->uiFlags |= BUTTON_CLICKED_ON; + break; + } + + //Init the textinput field. + InitTextInputModeWithScheme( DEFAULT_SCHEME ); + AddUserInputField( NULL ); //just so we can use short cut keys while not typing. + AddTextInputField( MAP_LEFT+112, MAP_BOTTOM+75, 100, 18, MSYS_PRIORITY_HIGH, L"", 20, INPUTTYPE_EXCLUSIVE_DOSFILENAME ); + + for( i = 1; i < NUM_SUMMARY_BUTTONS; i++ ) + HideButton( iSummaryButton[ i ] ); + + MSYS_DefineRegion( &MapRegion, MAP_LEFT, MAP_TOP, MAP_RIGHT, MAP_BOTTOM, MSYS_PRIORITY_HIGH, 0, + MapMoveCallback, MapClickCallback ); + MSYS_DisableRegion( &MapRegion ); + + //if( gfItemDetailsMode ) +// { + gfItemDetailsMode = FALSE; + // gfSetupItemDetailsMode = TRUE; + //} + if( !gfWorldLoaded ) + { + gfConfirmExitFirst = FALSE; + ReleaseSummaryWindow(); + DisableButton( iSummaryButton[ SUMMARY_OKAY ] ); + DisableButton( iSummaryButton[ SUMMARY_SAVE ] ); + } + if( gfAutoLoadA9 ) + { + gfAutoLoadA9++; + gsSelSectorX = 9; + gsSelSectorY = 1; + gpCurrentSectorSummary = gpSectorSummary[ 8 ][ 0 ][ 0 ]; + ButtonList[ iSummaryButton[ SUMMARY_LOAD ] ]->uiFlags |= BUTTON_CLICKED_ON; + } +} + +void AutoLoadMap() +{ + SummaryLoadMapCallback( ButtonList[ iSummaryButton[ SUMMARY_LOAD ] ], MSYS_CALLBACK_REASON_LBUTTON_UP ); + if( gfWorldLoaded ) + DestroySummaryWindow(); + gfAutoLoadA9 = FALSE; + gfConfirmExitFirst = TRUE; +} + +void ReleaseSummaryWindow() +{ + INT32 i; + UINT32 uiCurrTimer; + if( !gfSummaryWindowActive || gfPersistantSummary ) + return; + uiCurrTimer = GetJA2Clock(); + if( !gfWorldLoaded || uiCurrTimer - giInitTimer < 400 ) + { //make window persistant + for( i = 1; i < NUM_SUMMARY_BUTTONS; i++ ) + ShowButton( iSummaryButton[ i ] ); + HideButton( iSummaryButton[ SUMMARY_UPDATE ] ); + HideButton( iSummaryButton[ SUMMARY_OVERRIDE ] ); + HideButton( iSummaryButton[ SUMMARY_REAL ] ); + HideButton( iSummaryButton[ SUMMARY_SCIFI ] ); + HideButton( iSummaryButton[ SUMMARY_ENEMY ] ); + MSYS_EnableRegion( &MapRegion ); + gfPersistantSummary = TRUE; + gfOverrideDirty = TRUE; + gfRenderSummary = TRUE; + } + else + { + DestroySummaryWindow(); + } +} + +void DestroySummaryWindow() +{ + INT32 i; + if( !gfSummaryWindowActive ) + return; + for( i = 0; i < NUM_SUMMARY_BUTTONS; i++ ) + { + RemoveButton( iSummaryButton[ i ] ); + } + + MSYS_RemoveRegion( &MapRegion ); + + gfSummaryWindowActive = FALSE; + gfPersistantSummary = FALSE; + MarkWorldDirty(); + KillTextInputMode(); + EnableEditorTaskbar(); + EnableAllTextFields(); + + if( gpWorldItemsSummaryArray ) + { + MemFree( gpWorldItemsSummaryArray ); + gpWorldItemsSummaryArray = NULL; + gusWorldItemsSummaryArraySize = 0; + } + if( gpPEnemyItemsSummaryArray ) + { + MemFree( gpPEnemyItemsSummaryArray ); + gpPEnemyItemsSummaryArray = NULL; + gusPEnemyItemsSummaryArraySize = 0; + } + if( gpNEnemyItemsSummaryArray ) + { + MemFree( gpNEnemyItemsSummaryArray ); + gpNEnemyItemsSummaryArray = NULL; + gusNEnemyItemsSummaryArraySize = 0; + } + if( gfWorldLoaded ) + { + gfConfirmExitFirst = TRUE; + } +} + +void RenderSectorInformation() +{ + //UINT16 str[ 100 ]; + MAPCREATE_STRUCT *m; + SUMMARYFILE *s; + UINT8 ePoints = 0; + UINT16 usLine = 35; + INT32 iOverall; + + SetFont( FONT10ARIAL ); + SetFontShadow( FONT_NEARBLACK ); + + s = gpCurrentSectorSummary; + m = &gpCurrentSectorSummary->MapInfo; + + if( m->sNorthGridNo != -1 ) + ePoints++; + if( m->sEastGridNo != -1 ) + ePoints++; + if( m->sSouthGridNo != -1 ) + ePoints++; + if( m->sWestGridNo != -1 ) + ePoints++; + if( m->sCenterGridNo != -1 ) + ePoints++; + if( m->sIsolatedGridNo != -1 ) + ePoints++; + //start at 10,35 + SetFontForeground( FONT_ORANGE ); + mprintf( 10, 32, L"Tileset: %s", gTilesets[ s->ubTilesetID ].zName ); + if( m->ubMapVersion < 10 ) + SetFontForeground( FONT_RED ); + mprintf( 10, 42, L"Version Info: Summary: 1.%02d, Map: %d.%02d", s->ubSummaryVersion, (INT32)s->dMajorMapVersion, m->ubMapVersion ); + SetFontForeground( FONT_GRAY2 ); + mprintf( 10, 55, L"Number of items: %d", s->usNumItems ); + mprintf( 10, 65, L"Number of lights: %d", s->usNumLights ); + mprintf( 10, 75, L"Number of entry points: %d", ePoints ); + if( ePoints ) + { + INT32 x; + x = 140; + mprintf( x, 75, L"(" ); + x += StringPixLength( L"(", FONT10ARIAL ) + 2; + if( m->sNorthGridNo != -1 ) { mprintf( x, 75, L"N" ); x += StringPixLength( L"N", FONT10ARIAL ) + 2; } + if( m->sEastGridNo != -1 ) { mprintf( x, 75, L"E" ); x += StringPixLength( L"E", FONT10ARIAL ) + 2; } + if( m->sSouthGridNo != -1 ) { mprintf( x, 75, L"S" ); x += StringPixLength( L"S", FONT10ARIAL ) + 2; } + if( m->sWestGridNo != -1 ) { mprintf( x, 75, L"W" ); x += StringPixLength( L"W", FONT10ARIAL ) + 2; } + if( m->sCenterGridNo != -1 ) { mprintf( x, 75, L"C" ); x += StringPixLength( L"C", FONT10ARIAL ) + 2; } + if( m->sIsolatedGridNo != -1 ) { mprintf( x, 75, L"I" ); x += StringPixLength( L"I", FONT10ARIAL ) + 2; } + mprintf( x, 75, L")" ); + } + mprintf( 10, 85, L"Number of rooms: %d", s->ubNumRooms ); + mprintf( 10, 95, L"Total map population: %d", m->ubNumIndividuals ); + mprintf( 20, 105, L"Enemies: %d", s->EnemyTeam.ubTotal ); + mprintf( 30, 115, L"Admins: %d", s->ubNumAdmins ); + if( s->ubNumAdmins ) + mprintf( 100, 115, L"(%d detailed, %d profile -- %d have priority existance)", s->ubAdminDetailed, s->ubAdminProfile, s->ubAdminExistance ); + mprintf( 30, 125, L"Troops: %d", s->ubNumTroops ); + if( s->ubNumTroops ) + mprintf( 100, 125, L"(%d detailed, %d profile -- %d have priority existance)", s->ubTroopDetailed, s->ubTroopProfile, s->ubTroopExistance ); + mprintf( 30, 135, L"Elites: %d", s->ubNumElites ); + if( s->ubNumElites ) + mprintf( 100, 135, L"(%d detailed, %d profile -- %d have priority existance)", s->ubEliteDetailed, s->ubEliteProfile, s->ubEliteExistance ); + mprintf( 20, 145, L"Civilians: %d", s->CivTeam.ubTotal ); + if( s->CivTeam.ubTotal ) + mprintf( 100, 145, L"(%d detailed, %d profile -- %d have priority existance)", s->CivTeam.ubDetailed, s->CivTeam.ubProfile, s->CivTeam.ubExistance ); + if( s->ubSummaryVersion >= 9 ) + { + mprintf( 30, 155, L"Humans: %d", s->CivTeam.ubTotal - s->ubCivCows - s->ubCivBloodcats ); + mprintf( 30, 165, L"Cows: %d", s->ubCivCows ); + mprintf( 30, 175, L"Bloodcats: %d", s->ubCivBloodcats ); + } + mprintf( 20, 185, L"Creatures: %d", s->CreatureTeam.ubTotal ); + if( s->ubSummaryVersion >= 9 ) + { + mprintf( 30, 195, L"Monsters: %d", s->CreatureTeam.ubTotal - s->CreatureTeam.ubNumAnimals ); + mprintf( 30, 205, L"Bloodcats: %d", s->CreatureTeam.ubNumAnimals ); + } + mprintf( 10, 215, L"Number of locked and/or trapped doors: %d", s->ubNumDoors ); + mprintf( 20, 225, L"Locked: %d", s->ubNumDoorsLocked ); + mprintf( 20, 235, L"Trapped: %d", s->ubNumDoorsTrapped ); + mprintf( 20, 245, L"Locked & Trapped: %d", s->ubNumDoorsLockedAndTrapped ); + if( s->ubSummaryVersion >= 8 ) + mprintf( 10, 255, L"Civilians with schedules: %d", s->ubCivSchedules ); + if( s->ubSummaryVersion >= 10 ) + { + if( s->fTooManyExitGridDests ) + { + SetFontForeground( FONT_RED ); + mprintf( 10, 265, L"Too many exit grid destinations (more than 4)..."); + } + else + { + UINT8 i; + UINT8 ubNumInvalid = 0; + for( i = 0; i < 4; i++ ) + { + if( s->fInvalidDest[i] ) + ubNumInvalid++; + } + if( ubNumInvalid ) + { + SetFontForeground( FONT_RED ); + mprintf( 10, 265, L"ExitGrids: %d (%d with a long distance destination)", s->ubNumExitGridDests, ubNumInvalid ); + } + else switch( s->ubNumExitGridDests ) + { + case 0: + mprintf( 10, 265, L"ExitGrids: none" ); + break; + case 1: + mprintf( 10, 265, L"ExitGrids: 1 destination using %d exitgrids", s->usExitGridSize[0] ); + break; + case 2: + mprintf( 10, 265, L"ExitGrids: 2 -- 1) Qty: %d, 2) Qty: %d", s->usExitGridSize[0], s->usExitGridSize[1] ); + break; + case 3: + mprintf( 10, 265, L"ExitGrids: 3 -- 1) Qty: %d, 2) Qty: %d, 3) Qty: %d", + s->usExitGridSize[0], s->usExitGridSize[1], s->usExitGridSize[2] ); + break; + case 4: + mprintf( 10, 265, L"ExitGrids: 3 -- 1) Qty: %d, 2) Qty: %d, 3) Qty: %d, 4) Qty: %d", + s->usExitGridSize[0], s->usExitGridSize[1], s->usExitGridSize[2], s->usExitGridSize[3] ); + break; + } + } + } + iOverall = - ( 2 * s->EnemyTeam.ubBadA ) - s->EnemyTeam.ubPoorA + s->EnemyTeam.ubGoodA + ( 2 * s->EnemyTeam.ubGreatA ); + usLine = 275; + mprintf( 10, usLine, L"Enemy Relative Attributes: %d bad, %d poor, %d norm, %d good, %d great (%+d Overall)", + s->EnemyTeam.ubBadA, + s->EnemyTeam.ubPoorA, + s->EnemyTeam.ubAvgA, + s->EnemyTeam.ubGoodA, + s->EnemyTeam.ubGreatA, + iOverall ); + iOverall = - ( 2 * s->EnemyTeam.ubBadE ) - s->EnemyTeam.ubPoorE + s->EnemyTeam.ubGoodE + ( 2 * s->EnemyTeam.ubGreatE ); + usLine += 10; + mprintf( 10, usLine, L"Enemy Relative Equipment: %d bad, %d poor, %d norm, %d good, %d great (%+d Overall)", + s->EnemyTeam.ubBadE, + s->EnemyTeam.ubPoorE, + s->EnemyTeam.ubAvgE, + s->EnemyTeam.ubGoodE, + s->EnemyTeam.ubGreatE, + iOverall ); + usLine += 10; + if( s->ubSummaryVersion >= 11 ) + { + if( s->ubEnemiesReqWaypoints ) + { + SetFontForeground( FONT_RED ); + mprintf( 10, usLine, L"%d placements have patrol orders without any waypoints defined.", s->ubEnemiesReqWaypoints ); + usLine += 10; + } + } + if( s->ubSummaryVersion >= 13 ) + { + if( s->ubEnemiesHaveWaypoints ) + { + SetFontForeground( FONT_RED ); + mprintf( 10, usLine, L"%d placements have waypoints, but without any patrol orders.", s->ubEnemiesHaveWaypoints ); + usLine += 10; + } + } + if( s->ubSummaryVersion >= 12 ) + { + if( s->usWarningRoomNums ) + { + SetFontForeground( FONT_RED ); + mprintf( 10, usLine, L"%d gridnos have questionable room numbers. Please validate.", s->usWarningRoomNums ); + } + } +} + +//2) CODE TRIGGER/ACTION NAMES +void RenderItemDetails() +{ + FLOAT dAvgExistChance, dAvgStatus; + OBJECTTYPE *pItem; + INT32 index, i; + UINT16 str[100]; + UINT32 uiQuantity, uiExistChance, uiStatus; + UINT32 uiTriggerQuantity[8], uiActionQuantity[8], uiTriggerExistChance[8], uiActionExistChance[8]; + UINT32 xp, yp; + INT8 bFreqIndex; + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_GRAY2 ); + SetFontShadow( FONT_NEARBLACK ); + mprintf( 364, 49, L"R" ); + mprintf( 390, 49, L"S" ); + mprintf( 364, 62, L"Enemy" ); + yp = 20; + xp = 5; + if( gubSummaryItemMode != ITEMMODE_ENEMY && gpWorldItemsSummaryArray ) + { + memset( uiTriggerQuantity, 0, 32 ); + memset( uiActionQuantity, 0, 32 ); + memset( uiTriggerExistChance, 0, 32 ); + memset( uiActionExistChance, 0, 32 ); + for( index = 1; index < MAXITEMS; index++ ) + { + if ( Item[index].usItemClass == 0 ) + break; + uiQuantity = 0; + uiExistChance = 0; + uiStatus = 0; + for( i = 0; i < gusWorldItemsSummaryArraySize; i++ ) + { + if( index == SWITCH || index == ACTION_ITEM ) + { + if( gpWorldItemsSummaryArray[ i ].o.usItem == index ) + { + if( gubSummaryItemMode == ITEMMODE_SCIFI && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_REALISTIC_ONLY) || + gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) ) + { + pItem = &gpWorldItemsSummaryArray[ i ].o; + if( !pItem->bFrequency ) + bFreqIndex = 7; + else if( pItem->bFrequency == PANIC_FREQUENCY ) + bFreqIndex = 0; + else if( pItem->bFrequency == PANIC_FREQUENCY_2 ) + bFreqIndex = 1; + else if( pItem->bFrequency == PANIC_FREQUENCY_3 ) + bFreqIndex = 2; + else if( pItem->bFrequency == FIRST_MAP_PLACED_FREQUENCY + 1 ) + bFreqIndex = 3; + else if( pItem->bFrequency == FIRST_MAP_PLACED_FREQUENCY + 2 ) + bFreqIndex = 4; + else if( pItem->bFrequency == FIRST_MAP_PLACED_FREQUENCY + 3 ) + bFreqIndex = 5; + else if( pItem->bFrequency == FIRST_MAP_PLACED_FREQUENCY + 4 ) + bFreqIndex = 6; + else + continue; + if( index == SWITCH ) + { + uiTriggerQuantity[ bFreqIndex ]++; + uiTriggerExistChance[ bFreqIndex ] += 100 - gpWorldItemsSummaryArray[ i ].ubNonExistChance; + } + else + { + uiActionQuantity[ bFreqIndex ]++; + uiActionExistChance[ bFreqIndex ] += 100 - gpWorldItemsSummaryArray[ i ].ubNonExistChance; + } + } + } + continue; + } + if( gpWorldItemsSummaryArray[ i ].o.usItem == index ) + { + if( gubSummaryItemMode == ITEMMODE_SCIFI && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_REALISTIC_ONLY) || + gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) ) + { + pItem = &gpWorldItemsSummaryArray[ i ].o; + uiExistChance += (100 - gpWorldItemsSummaryArray[ i ].ubNonExistChance) * pItem->ubNumberOfObjects; + uiStatus += pItem->bStatus[0]; + uiQuantity += pItem->ubNumberOfObjects; + } + } + } + if( uiQuantity ) + { + if( !(yp % 20) ) + SetFontForeground( FONT_LTKHAKI ); + else + SetFontForeground( FONT_GRAY2 ); + //calc averages + dAvgExistChance = (FLOAT)(uiExistChance / 100.0); + dAvgStatus = uiStatus / (FLOAT)uiQuantity; + //Display stats. + LoadShortNameItemInfo( (UINT16)index, str ); + mprintf( xp, yp, L"%s", str ); + mprintf( xp + 85, yp, L"%3.02f", dAvgExistChance ); + mprintf( xp + 110, yp, L"@ %3.02f%%", dAvgStatus ); + yp += 10; + if( yp >= 355 ) + { + xp += 170; + yp = 20; + if( xp >= 300 ) + { + SetFontForeground( FONT_RED ); + mprintf( 350, 350, L"TOO MANY ITEMS TO DISPLAY!"); + return; + } + } + } + } + //Now list the number of actions/triggers of each type + for( i = 0; i < 8; i++ ) + { + if( uiTriggerQuantity[i] || uiActionQuantity[i] ) + { + if( i == 7 ) + SetFontForeground( FONT_DKYELLOW ); + else if( !uiTriggerQuantity[i] || !uiActionQuantity[i] ) + SetFontForeground( FONT_RED ); + else + SetFontForeground( 77 ); + switch( i ) + { + case 0: swprintf( str, L"Panic1" ); break; + case 1: swprintf( str, L"Panic2" ); break; + case 2: swprintf( str, L"Panic3" ); break; + case 3: swprintf( str, L"Norm1" ); break; + case 4: swprintf( str, L"Norm2" ); break; + case 5: swprintf( str, L"Norm3" ); break; + case 6: swprintf( str, L"Norm4" ); break; + case 7: swprintf( str, L"Pressure Actions" ); break; + } + if( i < 7 ) + { + dAvgExistChance = (FLOAT)(uiTriggerExistChance[i] / 100.0); + dAvgStatus = (FLOAT)(uiActionExistChance[i] / 100.0); + mprintf( xp, yp, L"%s: %3.02f trigger(s), %3.02f action(s)", str, dAvgExistChance, dAvgStatus ); + } + else + { + dAvgExistChance = (FLOAT)(uiActionExistChance[i] / 100.0); + mprintf( xp, yp, L"%s: %3.02f", str, dAvgExistChance ); + } + yp += 10; + if( yp >= 355 ) + { + xp += 170; + yp = 20; + if( xp >= 300 ) + { + SetFontForeground( FONT_RED ); + mprintf( 350, 350, L"TOO MANY ITEMS TO DISPLAY!"); + return; + } + } + } + } + } + else if( gubSummaryItemMode == ITEMMODE_ENEMY ) + { + + SetFontForeground( FONT_YELLOW ); + mprintf( xp, yp, L"PRIORITY ENEMY DROPPED ITEMS" ); + yp += 10; + + //Do the priority existance guys first + if( !gpPEnemyItemsSummaryArray ) + { + SetFontForeground( FONT_DKYELLOW ); + mprintf( xp, yp, L"None" ); + yp += 10; + } + else for( index = 1; index < MAXITEMS; index++ ) + { + if ( Item[index].usItemClass == 0 ) + break; + uiQuantity = 0; + uiExistChance = 0; + uiStatus = 0; + for( i = 0; i < gusPEnemyItemsSummaryArraySize; i++ ) + { + if( gpPEnemyItemsSummaryArray[ i ].usItem == index ) + { + pItem = &gpPEnemyItemsSummaryArray[ i ]; + uiExistChance += 100 * pItem->ubNumberOfObjects; + uiStatus += pItem->bStatus[0]; + uiQuantity += pItem->ubNumberOfObjects; + } + } + if( uiQuantity ) + { + if( !(yp % 20) ) + SetFontForeground( FONT_LTKHAKI ); + else + SetFontForeground( FONT_GRAY2 ); + //calc averages + dAvgExistChance = (FLOAT)(uiExistChance / 100.0); + dAvgStatus = uiStatus / (FLOAT)uiQuantity; + //Display stats. + LoadShortNameItemInfo( (UINT16)index, str ); + mprintf( xp, yp, L"%s", str ); + mprintf( xp + 85, yp, L"%3.02f", dAvgExistChance ); + mprintf( xp + 110, yp, L"@ %3.02f%%", dAvgStatus ); + yp += 10; + if( yp >= 355 ) + { + xp += 170; + yp = 20; + if( xp >= 300 ) + { + SetFontForeground( FONT_RED ); + mprintf( 350, 350, L"TOO MANY ITEMS TO DISPLAY!"); + return; + } + } + } + } + + yp += 5; + + SetFontForeground( FONT_YELLOW ); + mprintf( xp, yp, L"NORMAL ENEMY DROPPED ITEMS" ); + yp += 10; + if( yp >= 355 ) + { + xp += 170; + yp = 20; + if( xp >= 300 ) + { + SetFontForeground( FONT_RED ); + mprintf( 350, 350, L"TOO MANY ITEMS TO DISPLAY!"); + return; + } + } + + //Do the priority existance guys first + if( !gpNEnemyItemsSummaryArray ) + { + SetFontForeground( FONT_DKYELLOW ); + mprintf( xp, yp, L"None" ); + yp += 10; + } + for( index = 1; index < MAXITEMS; index++ ) + { + if ( Item[index].usItemClass == 0 ) + break; + uiQuantity = 0; + uiExistChance = 0; + uiStatus = 0; + for( i = 0; i < gusNEnemyItemsSummaryArraySize; i++ ) + { + if( gpNEnemyItemsSummaryArray[ i ].usItem == index ) + { + pItem = &gpNEnemyItemsSummaryArray[ i ]; + uiExistChance += 100 * pItem->ubNumberOfObjects; + uiStatus += pItem->bStatus[0]; + uiQuantity += pItem->ubNumberOfObjects; + } + } + if( uiQuantity ) + { + if( !(yp % 20) ) + SetFontForeground( FONT_LTKHAKI ); + else + SetFontForeground( FONT_GRAY2 ); + //calc averages + dAvgExistChance = (FLOAT)(uiExistChance / 100.0); + dAvgStatus = uiStatus / (FLOAT)uiQuantity; + //Display stats. + LoadShortNameItemInfo( (UINT16)index, str ); + mprintf( xp, yp, L"%s", str ); + mprintf( xp + 85, yp, L"%3.02f", dAvgExistChance ); + mprintf( xp + 110, yp, L"@ %3.02f%%", dAvgStatus ); + yp += 10; + if( yp >= 355 ) + { + xp += 170; + yp = 20; + if( xp >= 300 ) + { + SetFontForeground( FONT_RED ); + mprintf( 350, 350, L"TOO MANY ITEMS TO DISPLAY!"); + return; + } + } + } + } + + + + } + else + { + SetFontForeground( FONT_RED ); + mprintf( 5, 50, L"ERROR: Can't load the items for this map. Reason unknown." ); + } +} + +void RenderSummaryWindow() +{ + UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + SGPRect ClipRect; + INT32 i, x, y; + if( (GetActiveFieldID() == 1 ) != gfTempFile ) + { + gfTempFile ^= 1; + SetInputFieldStringWith16BitString( 1, L"" ); + gfRenderSummary = TRUE; + } + if( gfTempFile ) //constantly extract the temp filename for updating purposes. + ExtractTempFilename(); + if( gfRenderSummary ) + { + gfRenderSummary = FALSE; + gfRenderMap = TRUE; + for( i = 1; i < NUM_SUMMARY_BUTTONS; i++ ) + { + MarkAButtonDirty( iSummaryButton[ i ] ); + } + + DrawButton( iSummaryButton[ SUMMARY_BACKGROUND ] ); + InvalidateRegion( 0, 0, 640, 360 ); + + SetFont( BLOCKFONT2 ); + SetFontForeground( FONT_LTKHAKI ); + SetFontShadow( FONT_DKKHAKI ); + SetFontBackground( 0 ); + if( !gfItemDetailsMode ) + { + mprintf( 10, 5, L"CAMPAIGN EDITOR -- %s Version 1.%02d", + gszVersionType[ GLOBAL_SUMMARY_STATE ], GLOBAL_SUMMARY_VERSION ); + } + + //This section builds the proper header to be displayed for an existing global summary. + if( !gfWorldLoaded ) + { + SetFontForeground( FONT_RED ); + SetFontShadow( FONT_NEARBLACK ); + mprintf( 270, 5, L"(NO MAP LOADED)."); + } + SetFont( FONT10ARIAL ); + SetFontShadow( FONT_NEARBLACK ); + if( gfGlobalSummaryExists ) + { + UINT16 str[100]; + BOOLEAN fSectorSummaryExists = FALSE; + if( gusNumEntriesWithOutdatedOrNoSummaryInfo && !gfOutdatedDenied ) + { + DisableButton( iSummaryButton[ SUMMARY_LOAD ] ); + SetFontForeground( FONT_YELLOW ); + mprintf( 10, 20, L"You currently have %d outdated maps.", gusNumEntriesWithOutdatedOrNoSummaryInfo); + mprintf( 10, 30, L"The more maps that need to be updated, the longer it takes. It'll take "); + mprintf( 10, 40, L"approximately 4 minutes on a P200MMX to analyse 100 maps, so"); + mprintf( 10, 50, L"depending on your computer, it may vary."); + SetFontForeground( FONT_LTRED ); + mprintf( 10, 65, L"Do you wish to regenerate info for ALL these maps at this time (y/n)?" ); + } + else if( !gsSelSectorX && !gsSectorX || gfTempFile ) + { + DisableButton( iSummaryButton[ SUMMARY_LOAD ] ); + SetFontForeground( FONT_LTRED ); + mprintf( 10, 20, L"There is no sector currently selected." ); + if( gfTempFile ) + { + SetFontForeground( FONT_YELLOW ); + mprintf( 10, 30, L"Entering a temp file name that doesn't follow campaign editor conventions..." ); + goto SPECIALCASE_LABEL; //OUCH!!! + } + else if( !gfWorldLoaded ) + { + SetFontForeground( FONT_YELLOW ); + mprintf( 10, 30, L"You need to either load an existing map or create a new map before being" ); + mprintf( 10, 40, L"able to enter the editor, or you can quit (ESC or Alt+x)."); + } + } + else + { + //Build sector string + if( gsSelSectorX ) + x = gsSelSectorX - 1, y = gsSelSectorY - 1; + else + x = gsSectorX - 1, y = gsSectorY - 1; + swprintf( str, L"%c%d", y + 'A', x + 1 ); + swprintf( gszFilename, str ); + giCurrLevel = giCurrentViewLevel; + switch( giCurrentViewLevel ) + { + case ALL_LEVELS_MASK: + //search for the highest level + fSectorSummaryExists = TRUE; + if( gbSectorLevels[x][y] & GROUND_LEVEL_MASK ) + giCurrLevel = GROUND_LEVEL_MASK; + else if( gbSectorLevels[x][y] & BASEMENT1_LEVEL_MASK ) + giCurrLevel = BASEMENT1_LEVEL_MASK; + else if( gbSectorLevels[x][y] & BASEMENT2_LEVEL_MASK ) + giCurrLevel = BASEMENT2_LEVEL_MASK; + else if( gbSectorLevels[x][y] & BASEMENT3_LEVEL_MASK ) + giCurrLevel = BASEMENT3_LEVEL_MASK; + else + fSectorSummaryExists = FALSE; + break; + case ALTERNATE_LEVELS_MASK: + //search for the highest alternate level + fSectorSummaryExists = TRUE; + if( gbSectorLevels[x][y] & ALTERNATE_GROUND_MASK ) + giCurrLevel = ALTERNATE_GROUND_MASK; + else if( gbSectorLevels[x][y] & ALTERNATE_B1_MASK ) + giCurrLevel = ALTERNATE_B1_MASK; + else if( gbSectorLevels[x][y] & ALTERNATE_B2_MASK ) + giCurrLevel = ALTERNATE_B2_MASK; + else if( gbSectorLevels[x][y] & ALTERNATE_B3_MASK ) + giCurrLevel = ALTERNATE_B3_MASK; + else + fSectorSummaryExists = FALSE; + break; + case GROUND_LEVEL_MASK: + if( gbSectorLevels[x][y] & GROUND_LEVEL_MASK ) + fSectorSummaryExists = TRUE; + break; + case BASEMENT1_LEVEL_MASK: + if( gbSectorLevels[x][y] & BASEMENT1_LEVEL_MASK ) + fSectorSummaryExists = TRUE; + break; + case BASEMENT2_LEVEL_MASK: + if( gbSectorLevels[x][y] & BASEMENT2_LEVEL_MASK ) + fSectorSummaryExists = TRUE; + break; + case BASEMENT3_LEVEL_MASK: + if( gbSectorLevels[x][y] & BASEMENT3_LEVEL_MASK ) + fSectorSummaryExists = TRUE; + break; + case ALTERNATE_GROUND_MASK: + if( gbSectorLevels[x][y] & ALTERNATE_GROUND_MASK ) + fSectorSummaryExists = TRUE; + break; + case ALTERNATE_B1_MASK: + if( gbSectorLevels[x][y] & ALTERNATE_B1_MASK ) + fSectorSummaryExists = TRUE; + break; + case ALTERNATE_B2_MASK: + if( gbSectorLevels[x][y] & ALTERNATE_B2_MASK ) + fSectorSummaryExists = TRUE; + break; + case ALTERNATE_B3_MASK: + if( gbSectorLevels[x][y] & ALTERNATE_B3_MASK ) + fSectorSummaryExists = TRUE; + break; + } + if( gbSectorLevels[x][y] ) + { + switch( giCurrLevel ) + { + case GROUND_LEVEL_MASK: + giCurrLevel = 0; + wcscat( str, L", ground level" ); + gpCurrentSectorSummary = gpSectorSummary[x][y][0]; + break; + case BASEMENT1_LEVEL_MASK: + giCurrLevel = 1; + wcscat( str, L", underground level 1" ); + gpCurrentSectorSummary = gpSectorSummary[x][y][1]; + break; + case BASEMENT2_LEVEL_MASK: + giCurrLevel = 2; + wcscat( str, L", underground level 2" ); + gpCurrentSectorSummary = gpSectorSummary[x][y][2]; + break; + case BASEMENT3_LEVEL_MASK: + giCurrLevel = 3; + wcscat( str, L", underground level 3" ); + gpCurrentSectorSummary = gpSectorSummary[x][y][3]; + break; + case ALTERNATE_GROUND_MASK: + giCurrLevel = 4; + wcscat( str, L", alternate G level" ); + gpCurrentSectorSummary = gpSectorSummary[x][y][4]; + break; + case ALTERNATE_B1_MASK: + giCurrLevel = 5; + wcscat( str, L", alternate B1 level" ); + gpCurrentSectorSummary = gpSectorSummary[x][y][5]; + break; + case ALTERNATE_B2_MASK: + giCurrLevel = 6; + wcscat( str, L", alternate B2 level" ); + gpCurrentSectorSummary = gpSectorSummary[x][y][6]; + break; + case ALTERNATE_B3_MASK: + giCurrLevel = 7; + wcscat( str, L", alternate B3 level" ); + gpCurrentSectorSummary = gpSectorSummary[x][y][7]; + break; + } + } + else + { + DisableButton( iSummaryButton[ SUMMARY_LOAD ] ); + } + if( fSectorSummaryExists ) + { + switch( giCurrLevel ) + { + case 0: wcscat( gszFilename, L".dat" ); break; + case 1: wcscat( gszFilename, L"_b1.dat" ); break; + case 2: wcscat( gszFilename, L"_b2.dat" ); break; + case 3: wcscat( gszFilename, L"_b3.dat" ); break; + case 4: wcscat( gszFilename, L"_a.dat" ); break; + case 5: wcscat( gszFilename, L"_b1_a.dat" ); break; + case 6: wcscat( gszFilename, L"_b2_a.dat" ); break; + case 7: wcscat( gszFilename, L"_b3_a.dat" ); break; + } + swprintf( gszDisplayName, gszFilename ); + EnableButton( iSummaryButton[ SUMMARY_LOAD ] ); + if( gpCurrentSectorSummary ) + { + if( gpCurrentSectorSummary->ubSummaryVersion < GLOBAL_SUMMARY_VERSION ) + ShowButton( iSummaryButton[ SUMMARY_UPDATE ] ); + else + HideButton( iSummaryButton[ SUMMARY_UPDATE ] ); + if( !gfAlternateMaps ) + SetFontForeground( FONT_YELLOW ); + else + SetFontForeground( FONT_LTBLUE ); + if( gfItemDetailsMode ) + { + if( gfSetupItemDetailsMode ) + { + SetupItemDetailsMode( TRUE ); + gfSetupItemDetailsMode = FALSE; + } + mprintf( 10, 5, L"ITEM DETAILS -- sector %s", str ); + RenderItemDetails(); + } + else + { + mprintf( 10, 20, L"Summary Information for sector %s:", str ); + HideButton( iSummaryButton[ SUMMARY_REAL ] ); + HideButton( iSummaryButton[ SUMMARY_SCIFI ] ); + HideButton( iSummaryButton[ SUMMARY_ENEMY ] ); + RenderSectorInformation(); + } + } + else + { + SetFontForeground( FONT_RED ); + if( gfItemDetailsMode ) + { + mprintf( 10, 5, L"Summary Information for sector %s" , str ); + mprintf( 10, 15, L"does not exist." ); + } + else + { + mprintf( 10, 20, L"Summary Information for sector %s" , str ); + mprintf( 10, 30, L"does not exist." ); + } + ShowButton( iSummaryButton[ SUMMARY_UPDATE ] ); + } + } + else + { + if( !gfAlternateMaps ) + SetFontForeground( FONT_ORANGE ); + else + { + SetFontForeground( FONT_DKBLUE ); + SetFontShadow( 0 ); + } + if( gfItemDetailsMode ) + mprintf( 10, 5, L"No information exists for sector %s.", str ); + else + mprintf( 10, 20, L"No information exists for sector %s.", str ); + SetFontShadow( FONT_NEARBLACK ); + + switch( giCurrentViewLevel ) + { + case ALL_LEVELS_MASK: + case GROUND_LEVEL_MASK: wcscat( gszFilename, L".dat" ); break; + case BASEMENT1_LEVEL_MASK: wcscat( gszFilename, L"_b1.dat" ); break; + case BASEMENT2_LEVEL_MASK: wcscat( gszFilename, L"_b2.dat" ); break; + case BASEMENT3_LEVEL_MASK: wcscat( gszFilename, L"_b3.dat" ); break; + case ALTERNATE_LEVELS_MASK: + case ALTERNATE_GROUND_MASK: wcscat( gszFilename, L"_a.dat" ); break; + case ALTERNATE_B1_MASK: wcscat( gszFilename, L"_b1_a.dat" ); break; + case ALTERNATE_B2_MASK: wcscat( gszFilename, L"_b2_a.dat" ); break; + case ALTERNATE_B3_MASK: wcscat( gszFilename, L"_b3_a.dat" ); break; + } + swprintf( gszDisplayName, gszFilename ); + DisableButton( iSummaryButton[ SUMMARY_LOAD ] ); + } + SPECIALCASE_LABEL: + if( gfOverrideDirty && gfPersistantSummary ) + CalculateOverrideStatus(); + if( gubOverrideStatus == INACTIVE ) + { + if( !gfAlternateMaps ) + SetFontForeground( FONT_LTKHAKI ); + else + SetFontForeground( FONT_LTBLUE ); + mprintf( MAP_LEFT+110, MAP_BOTTOM+55, L"FILE: %s", gszDisplayName ); + } + else //little higher to make room for the override checkbox and text. + { + if( !gfAlternateMaps ) + SetFontForeground( FONT_LTKHAKI ); + else + SetFontForeground( FONT_LTBLUE ); + mprintf( MAP_LEFT+110, MAP_BOTTOM+46, L"FILE: %s", gszDisplayName ); + if( gubOverrideStatus == READONLY ) + { + SetFontForeground( (UINT8)(gfOverride ? FONT_YELLOW : FONT_LTRED) ); + mprintf( MAP_LEFT+124, MAP_BOTTOM+61, L"Override READONLY" ); + } + else + { + SetFontForeground( (UINT8)(gfOverride ? FONT_YELLOW: FONT_ORANGE ) ); + mprintf( MAP_LEFT+124, MAP_BOTTOM+61, L"Overwrite File"); + } + } + } + } + else if( !gfDeniedSummaryCreation ) + { + SetFontForeground( FONT_GRAY1 ); + mprintf( 10, 20, L"You currently have no summary data. By creating one, you will be able to keep track" ); + mprintf( 10, 30, L"of information pertaining to all of the sectors you edit and save. The creation process" ); + mprintf( 10, 40, L"will analyse all maps in your \\MAPS directory, and generate a new one. This could" ); + mprintf( 10, 50, L"take a few minutes depending on how many valid maps you have. Valid maps are" ); + mprintf( 10, 60, L"maps following the proper naming convention from a1.dat - p16.dat. Underground maps" ); + mprintf( 10, 70, L"are signified by appending _b1 to _b3 before the .dat (ex: a9_b1.dat). "); + SetFontForeground( FONT_LTRED ); + mprintf( 10, 85, L"Do you wish to do this now (y/n)?" ); + } + else + { + SetFontForeground( FONT_LTRED ); + mprintf( 10, 20, L"No summary info. Creation denied." ); + } + + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_GRAY3 ); + mprintf( MAP_LEFT + 15, MAP_BOTTOM + 7, L"Grid" ); + mprintf( MAP_LEFT + 65, MAP_BOTTOM + 7, L"Progress" ); + mprintf( MAP_LEFT + 15, MAP_BOTTOM + 27, L"Use Alternate Maps" ); + //Draw the mode tabs + SetFontForeground( FONT_YELLOW ); + mprintf( 354, 18, L"Summary" ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); + RectangleDraw( TRUE, 350, 15, 405, 28, 0, pDestBuf ); + UnLockVideoSurface( FRAME_BUFFER ); + ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 351, 16, 404, 27 ); + if( gpCurrentSectorSummary ) + /*&& gpCurrentSectorSummary->usNumItems || + gpPEnemyItemsSummaryArray && gusPEnemyItemsSummaryArraySize || + gpNEnemyItemsSummaryArray && gusNEnemyItemsSummaryArraySize )*/ + { + SetFontForeground( FONT_YELLOW ); + } + else + { + SetFontForeground( FONT_RED ); + } + mprintf( 354, 33, L"Items" ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); + RectangleDraw( TRUE, 350, 30, 405, 43, 0, pDestBuf ); + UnLockVideoSurface( FRAME_BUFFER ); + if( gpCurrentSectorSummary ) + /*&& gpCurrentSectorSummary->usNumItems || + gpPEnemyItemsSummaryArray && gusPEnemyItemsSummaryArraySize || + gpNEnemyItemsSummaryArray && gusNEnemyItemsSummaryArraySize ) + */ + { + ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 351, 31, 404, 42 ); + } + else + { + ShadowVideoSurfaceRect( FRAME_BUFFER, 351, 31, 404, 42 ); + } + SetFontForeground( FONT_GRAY2 ); + } + + RenderButtons(); + + if( gfRenderMap ) + { + gfRenderMap = FALSE; + BltVideoObjectFromIndex( FRAME_BUFFER, guiOmertaMap, 0, MAP_LEFT-2, MAP_TOP-2, VO_BLT_SRCTRANSPARENCY, NULL ); + InvalidateRegion( MAP_LEFT-1, MAP_TOP-1, MAP_RIGHT+1, MAP_BOTTOM+1 ); + //Draw the coordinates + SetFont( SMALLCOMPFONT ); + SetFontForeground( FONT_BLACK ); + for( y = 0; y < 16; y++ ) + { + mprintf( MAP_LEFT-8, MAP_TOP+4+y*13, L"%c", 65 + y ); + } + for( x = 1; x <= 16; x++ ) + { + UINT16 str[3]; + swprintf( str, L"%d", x ); + mprintf( MAP_LEFT+x*13-(13+StringPixLength( str, SMALLCOMPFONT ))/2, MAP_TOP-8, str ); + } + if( gfRenderGrid ) + { + UINT16 pos; + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); + for( i = 1; i <= 15; i++ ) + { + //draw vertical lines + pos = (UINT16)(i * 13 + MAP_LEFT); + LineDraw( TRUE, pos, MAP_TOP, pos, MAP_BOTTOM-1, 0, pDestBuf ); + //draw horizontal lines + pos = (UINT16)(i * 13 + MAP_TOP); + LineDraw( TRUE, MAP_LEFT, pos, MAP_RIGHT-1, pos, 0, pDestBuf ); + } + UnLockVideoSurface( FRAME_BUFFER ); + } + if( gfRenderProgress ) + { + UINT8 ubNumUndergroundLevels; + UINT16 str[2]; + for( y = 0; y < 16; y++ ) + { + ClipRect.iTop = MAP_TOP + y*13; + ClipRect.iBottom = ClipRect.iTop + 12; + for( x = 0; x < 16; x++ ) + { + if( giCurrentViewLevel == ALL_LEVELS_MASK ) + { + ubNumUndergroundLevels = 0; + if( gbSectorLevels[x][y] & BASEMENT1_LEVEL_MASK ) ubNumUndergroundLevels++; + if( gbSectorLevels[x][y] & BASEMENT2_LEVEL_MASK ) ubNumUndergroundLevels++; + if( gbSectorLevels[x][y] & BASEMENT3_LEVEL_MASK ) ubNumUndergroundLevels++; + if( ubNumUndergroundLevels ) + { //display the number of underground levels. If there + //is no ground level, then it'll be shadowed. + SetFont( SMALLCOMPFONT ); + SetFontForeground( FONT_YELLOW ); + swprintf( str, L"%d", ubNumUndergroundLevels ); + mprintf( MAP_LEFT + x*13 + 4, ClipRect.iTop + 4, str ); + } + if( gbSectorLevels[x][y] & GROUND_LEVEL_MASK ) + { + if( !gfItemDetailsMode || !gpSectorSummary[x][y][0] || gpSectorSummary[x][y][0]->usNumItems ) + continue; + } + } + else if( giCurrentViewLevel == ALTERNATE_LEVELS_MASK ) + { + ubNumUndergroundLevels = 0; + if( gbSectorLevels[x][y] & ALTERNATE_B1_MASK ) ubNumUndergroundLevels++; + if( gbSectorLevels[x][y] & ALTERNATE_B2_MASK ) ubNumUndergroundLevels++; + if( gbSectorLevels[x][y] & ALTERNATE_B3_MASK ) ubNumUndergroundLevels++; + if( ubNumUndergroundLevels ) + { //display the number of underground levels. If there + //is no ground level, then it'll be shadowed. + SetFont( SMALLCOMPFONT ); + SetFontForeground( FONT_YELLOW ); + swprintf( str, L"%d", ubNumUndergroundLevels ); + mprintf( MAP_LEFT + x*13 + 4, ClipRect.iTop + 4, str ); + } + if( gbSectorLevels[x][y] & ALTERNATE_GROUND_MASK ) + { + if( !gfItemDetailsMode || !gpSectorSummary[x][y][4] || gpSectorSummary[x][y][4]->usNumItems ) + continue; + } + } + else if( gbSectorLevels[x][y] & giCurrentViewLevel ) + { + if( !gfItemDetailsMode || !gpSectorSummary[x][y][giCurrLevel] || gpSectorSummary[x][y][giCurrLevel]->usNumItems ) + continue; + } + ClipRect.iLeft = MAP_LEFT + x*13; + ClipRect.iRight = ClipRect.iLeft + 12; + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + Blt16BPPBufferShadowRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect ); + if( giCurrentViewLevel == BASEMENT1_LEVEL_MASK || + giCurrentViewLevel == BASEMENT2_LEVEL_MASK || + giCurrentViewLevel == BASEMENT3_LEVEL_MASK || + giCurrentViewLevel == ALTERNATE_B1_MASK || + giCurrentViewLevel == ALTERNATE_B2_MASK || + giCurrentViewLevel == ALTERNATE_B3_MASK ) + Blt16BPPBufferShadowRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect ); + UnLockVideoSurface( FRAME_BUFFER ); + } + } + } + } + + if( gfGlobalSummaryExists ) + { + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); + //Render the grid for the map currently residing in memory (blue). + if( gfWorldLoaded && !gfTempFile && gsSectorX ) + { + x = MAP_LEFT + (gsSectorX-1) * 13 + 1; + y = MAP_TOP + (gsSectorY-1) * 13 + 1; + RectangleDraw( TRUE, x, y, x+11, y+11, Get16BPPColor( FROMRGB( 50, 50, 200 ) ), pDestBuf ); + } + + //Render the grid for the sector currently in focus (red). + if( gsSelSectorX > 0 && !gfTempFile ) + { + x = MAP_LEFT + (gsSelSectorX-1) * 13 ; + y = MAP_TOP + (gsSelSectorY-1) * 13 ; + RectangleDraw( TRUE, x, y, x+13, y+13, Get16BPPColor( FROMRGB( 200, 50, 50 ) ), pDestBuf ); + } + + //Render the grid for the sector if the mouse is over it (yellow). + if( gsHiSectorX > 0 ) + { + x = MAP_LEFT + (gsHiSectorX-1) * 13 - 1; + y = MAP_TOP + (gsHiSectorY-1) * 13 - 1; + RectangleDraw( TRUE, x, y, x+15, y+15, Get16BPPColor( FROMRGB( 200, 200, 50 ) ), pDestBuf ); + } + UnLockVideoSurface( FRAME_BUFFER ); + } + //Check to see if the user clicked on one of the hot spot mode change areas. + if( gfLeftButtonState ) + { + if( !gfItemDetailsMode ) + { + if( gpCurrentSectorSummary ) + /*&& gpCurrentSectorSummary->usNumItems || + gpPEnemyItemsSummaryArray && gusPEnemyItemsSummaryArraySize || + gpNEnemyItemsSummaryArray && gusNEnemyItemsSummaryArraySize )*/ + { + if( gusMouseXPos >= 350 && gusMouseYPos >= 30 && gusMouseXPos <= 404 && gusMouseYPos <= 42 ) + { + gfItemDetailsMode = TRUE; + gfSetupItemDetailsMode = TRUE; + gfRenderSummary = TRUE; + } + } + } + else if( gfItemDetailsMode && gusMouseXPos >= 350 && gusMouseYPos >= 15 && gusMouseXPos <= 404 && gusMouseYPos <= 27 ) + { + gfItemDetailsMode = FALSE; + gfRenderSummary = TRUE; + } + } +} + +void UpdateSectorSummary( UINT16 *gszFilename, BOOLEAN fUpdate ) +{ + UINT16 str[50]; + UINT8 szCoord[40]; + UINT16 *ptr; + INT16 x, y; + + gfRenderSummary = TRUE; + //Extract the sector + if( gszFilename[2] < L'0' || gszFilename[2] > L'9' ) + x = gszFilename[1] - L'0'; + else + x = (gszFilename[1] - L'0') * 10 + gszFilename[2] - L'0'; + if( gszFilename[0] >= 'a' ) + y = gszFilename[0] - L'a' + 1; + else + y = gszFilename[0] - L'A' + 1; + gfMapFileDirty = FALSE; + + //Validate that the values extracted are in fact a sector + if( x < 1 || x > 16 || y < 1 || y > 16 ) + return; + gsSectorX = gsSelSectorX = x; + gsSectorY = gsSelSectorY = y; + + //The idea here is to get a pointer to the filename's period, then + //focus on the character previous to it. If it is a 1, 2, or 3, then + //the filename was in a basement level. Otherwise, it is a ground level. + ptr = wcsstr( gszFilename, L"_a.dat" ); + if( ptr ) + { + ptr = wcsstr( gszFilename, L"_b" ); + if( ptr && ptr[2] >= '1' && ptr[2] <= '3' && ptr[5] == '.' ) + { //it's a alternate basement map + switch( ptr[2] ) + { + case '1': + gsSectorLayer = ALTERNATE_B1_MASK; + giCurrLevel = 5; + break; + case '2': + gsSectorLayer = ALTERNATE_B2_MASK; + giCurrLevel = 6; + break; + case '3': + gsSectorLayer = ALTERNATE_B3_MASK; + giCurrLevel = 7; + break; + } + } + else + { + gsSectorLayer = ALTERNATE_GROUND_MASK; + giCurrLevel = 4; + } + } + else + { + ptr = wcsstr( gszFilename, L"_b" ); + if( ptr && ptr[2] >= '1' && ptr[2] <= '3' && ptr[3] == '.' ) + { //it's a alternate basement map + switch( ptr[2] ) + { + case '1': + gsSectorLayer = BASEMENT1_LEVEL_MASK; + giCurrLevel = 1; + break; + case '2': + gsSectorLayer = BASEMENT2_LEVEL_MASK; + giCurrLevel = 2; + break; + case '3': + gsSectorLayer = BASEMENT3_LEVEL_MASK; + giCurrLevel = 3; + break; + } + } + else + { + gsSectorLayer = GROUND_LEVEL_MASK; + giCurrLevel = 0; + } + } + + giCurrentViewLevel = gsSectorLayer; + if( !(gbSectorLevels[gsSectorX-1][gsSectorY-1] & gsSectorLayer) ) + { + //new sector map saved, so update the global file. + gbSectorLevels[gsSectorX-1][gsSectorY-1] |= gsSectorLayer; + } + + if( fUpdate ) + { + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_LTKHAKI ); + SetFontShadow( FONT_NEARBLACK ); + swprintf( str, L"Analyzing map: %s...", gszFilename ); + + if( gfSummaryWindowActive ) + { + mprintf( MAP_LEFT, MAP_BOTTOM+100, str ); + InvalidateRegion( MAP_LEFT, MAP_BOTTOM+100, MAP_LEFT+150, MAP_BOTTOM+110 ); + CreateProgressBar( 0, MAP_LEFT, MAP_BOTTOM+110, MAP_LEFT+140, MAP_BOTTOM+120 ); + } + else + { + mprintf( 320 - StringPixLength( str, FONT10ARIAL )/2, 190, str ); + InvalidateRegion( 200, 190, 400, 200 ); + CreateProgressBar( 0, 250, 200, 390, 210 ); + } + + sprintf( (char *)szCoord, "%S", gszFilename ); + if( gsSectorX > 9 ) + szCoord[3] = '\0'; + else + szCoord[2] = '\0'; + gusNumEntriesWithOutdatedOrNoSummaryInfo++; + EvaluateWorld( szCoord, (UINT8)giCurrLevel ); + + RemoveProgressBar( 0 ); + } + else + gusNumEntriesWithOutdatedOrNoSummaryInfo++; +} + +void SummaryOkayCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + DestroySummaryWindow(); + } +} + +void SummaryToggleGridCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfRenderGrid = (BOOLEAN)(btn->uiFlags & BUTTON_CLICKED_ON); + gfRenderMap = TRUE; + } +} + +void SummaryToggleAlternateCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + giCurrentViewLevel <<= 4; + gfAlternateMaps = TRUE; + } + else + { + giCurrentViewLevel >>= 4; + gfAlternateMaps = FALSE; + } + gfRenderSummary = TRUE; + } +} + +void SummarySciFiCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + ButtonList[ iSummaryButton[ SUMMARY_SCIFI ] ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY); + ButtonList[ iSummaryButton[ SUMMARY_REAL ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ iSummaryButton[ SUMMARY_REAL ] ]->uiFlags |= BUTTON_DIRTY; + ButtonList[ iSummaryButton[ SUMMARY_ENEMY ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ iSummaryButton[ SUMMARY_ENEMY ] ]->uiFlags |= BUTTON_DIRTY; + gubSummaryItemMode = ITEMMODE_SCIFI; + gfRenderSummary = TRUE; + } +} + +void SummaryRealCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + ButtonList[ iSummaryButton[ SUMMARY_SCIFI ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ iSummaryButton[ SUMMARY_SCIFI ] ]->uiFlags |= BUTTON_DIRTY; + ButtonList[ iSummaryButton[ SUMMARY_REAL ] ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY); + ButtonList[ iSummaryButton[ SUMMARY_ENEMY ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ iSummaryButton[ SUMMARY_ENEMY ] ]->uiFlags |= BUTTON_DIRTY; + gubSummaryItemMode = ITEMMODE_REAL; + gfRenderSummary = TRUE; + } +} + +void SummaryEnemyCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + ButtonList[ iSummaryButton[ SUMMARY_SCIFI ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ iSummaryButton[ SUMMARY_SCIFI ] ]->uiFlags |= BUTTON_DIRTY; + ButtonList[ iSummaryButton[ SUMMARY_REAL ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ iSummaryButton[ SUMMARY_REAL ] ]->uiFlags |= BUTTON_DIRTY; + ButtonList[ iSummaryButton[ SUMMARY_ENEMY ] ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY); + gubSummaryItemMode = ITEMMODE_ENEMY; + gfRenderSummary = TRUE; + } +} + +void SummaryToggleProgressCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfRenderProgress = (BOOLEAN)(btn->uiFlags & BUTTON_CLICKED_ON); + gfRenderMap = TRUE; + } +} + +#include "Tile Surface.h" + +void PerformTest() +{ +#if 0 + OutputDebugString( "PERFORMING A NEW TEST -------------------------------------------------\n" ); + memset( gbDefaultSurfaceUsed, 0, sizeof( gbDefaultSurfaceUsed ) ); + giCurrentTilesetID = -1; + switch( Random( 3 ) ) + { + case 0: + LoadWorld( "J9.dat" ); + break; + case 1: + LoadWorld( "J9_b1.dat" ); + break; + case 2: + LoadWorld( "J9_b2.dat" ); + break; + } +#endif +} + + +BOOLEAN HandleSummaryInput( InputAtom *pEvent ) +{ + if( !gfSummaryWindowActive ) + return FALSE; + gfCtrlPressed = pEvent->usKeyState & CTRL_DOWN; + if( !HandleTextInput( pEvent ) && pEvent->usEvent == KEY_DOWN || pEvent->usEvent == KEY_REPEAT ) + { + INT32 x; + switch( pEvent->usParam ) + { + case ESC: + if( !gfWorldLoaded ) + { + DestroySummaryWindow(); + pEvent->usParam = 'x'; + pEvent->usKeyState |= ALT_DOWN; + gfOverheadMapDirty = TRUE; + return FALSE; + } + case ENTER: + if( GetActiveFieldID() == 1 ) + SelectNextField(); + else if( gfWorldLoaded ) + DestroySummaryWindow(); + break; + case F6: + PerformTest(); + break; + case F7: + for( x = 0; x < 10; x++ ) + PerformTest(); + break; + case F8: + for( x = 0; x < 100; x++ ) + PerformTest(); + break; + case 'y':case 'Y': + if( gusNumEntriesWithOutdatedOrNoSummaryInfo && !gfOutdatedDenied ) + { + gfRenderSummary = TRUE; + RegenerateSummaryInfoForAllOutdatedMaps(); + } + if( !gfGlobalSummaryExists && !gfDeniedSummaryCreation ) + { + gfGlobalSummaryExists = TRUE; + CreateGlobalSummary(); + gfRenderSummary = TRUE; + } + break; + case 'n':case 'N': + if( gusNumEntriesWithOutdatedOrNoSummaryInfo && !gfOutdatedDenied ) + { + gfOutdatedDenied = TRUE; + gfRenderSummary = TRUE; + } + if( !gfGlobalSummaryExists && !gfDeniedSummaryCreation ) + { + gfDeniedSummaryCreation = TRUE; + gfRenderSummary = TRUE; + } + break; + case 'x': + if (pEvent->usKeyState & ALT_DOWN ) + { + DestroySummaryWindow(); + return FALSE; + } + break; + case RIGHTARROW: + gfRenderSummary = TRUE; + if( !gsSelSectorY ) + gsSelSectorY = 1; + gsSelSectorX++; + if( gsSelSectorX > 16 ) + gsSelSectorX = 1; + break; + case LEFTARROW: + gfRenderSummary = TRUE; + if( !gsSelSectorY ) + gsSelSectorY = 1; + gsSelSectorX--; + if( gsSelSectorX < 1 ) + gsSelSectorX = 16; + break; + case UPARROW: + gfRenderSummary = TRUE; + if( !gsSelSectorX ) + gsSelSectorX = 1; + gsSelSectorY--; + if( gsSelSectorY < 1 ) + gsSelSectorY = 16; + break; + case DNARROW: + gfRenderSummary = TRUE; + if( !gsSelSectorX ) + gsSelSectorX = 1; + gsSelSectorY++; + if( gsSelSectorY > 16 ) + gsSelSectorY = 1; + break; + case SHIFT_LEFTARROW: + + break; + case SHIFT_RIGHTARROW: + + break; + } + } + else if( pEvent->usEvent == KEY_UP ) + { //for releasing modes requiring persistant state keys + switch( pEvent->usParam ) + { + case F5: + ReleaseSummaryWindow(); + break; + } + } + return TRUE; +} + +void CreateGlobalSummary() +{ + FILE *fp; + STRING512 Dir; + STRING512 ExecDir; + + OutputDebugString( "Generating GlobalSummary Information...\n" ); + + gfGlobalSummaryExists = FALSE; + //Set current directory to JA2\DevInfo which contains all of the summary data + GetExecutableDirectory( ExecDir ); + sprintf( Dir, "%s\\DevInfo", ExecDir ); + + // Snap: save current directory + //GetFileManCurrentDirectory( DataDir ); + + //Directory doesn't exist, so create it, and continue. + if( !MakeFileManDirectory( Dir ) ) + AssertMsg( 0, "Can't create new directory, JA2\\DevInfo for summary information." ); + if( !SetFileManCurrentDirectory( Dir ) ) + AssertMsg( 0, "Can't set to new directory, JA2\\DevInfo for summary information." ); + //Generate a simple readme file. + fp = fopen( "readme.txt", "w" ); + Assert( fp ); + fprintf( fp, "%s\n%s\n", "This information is used in conjunction with the editor.", + "This directory or it's contents shouldn't be included with final release." ); + fclose( fp ); + + // Snap: Restore the data directory once we are finished. + //SetFileManCurrentDirectory( DataDir ); + //sprintf( Dir, "%s\\Data", ExecDir ); + //SetFileManCurrentDirectory( Dir ); + + LoadGlobalSummary(); + RegenerateSummaryInfoForAllOutdatedMaps(); + gfRenderSummary = TRUE; + + OutputDebugString( "GlobalSummary Information generated successfully.\n" ); +} + +void MapMoveCallback( MOUSE_REGION *reg, INT32 reason ) +{ + static INT16 gsPrevX = 0, gsPrevY = 0; + //calc current sector highlighted. + if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + gsPrevX = gsHiSectorX = 0; + gsPrevY = gsHiSectorY = 0; + gfRenderMap = TRUE; + return; + } + gsHiSectorX = min( (reg->RelativeXPos / 13) + 1, 16 ); + gsHiSectorY = min( (reg->RelativeYPos / 13) + 1, 16 ); + if( gsPrevX != gsHiSectorX || gsPrevY != gsHiSectorY ) + { + gsPrevX = gsHiSectorX; + gsPrevY = gsHiSectorY; + gfRenderMap = TRUE; + } +} + +void MapClickCallback( MOUSE_REGION *reg, INT32 reason ) +{ + static INT16 sLastX = -1, sLastY = -1; + static INT32 iLastClickTime = 0; + //calc current sector selected. + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( GetActiveFieldID() == 1 ) + { + gsSelSectorX = 0; + SelectNextField(); + } + gsSelSectorX = min( (reg->RelativeXPos / 13) + 1, 16 ); + gsSelSectorY = min( (reg->RelativeYPos / 13) + 1, 16 ); + if( gsSelSectorX != sLastX || gsSelSectorY != sLastY ) + { //clicked in a new sector + gfOverrideDirty = TRUE; + sLastX = gsSelSectorX; + sLastY = gsSelSectorY; + iLastClickTime = GetJA2Clock(); + switch( giCurrentViewLevel ) + { + case ALL_LEVELS_MASK: + if( gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 0 ] ) + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 0 ]; + else if( gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 1 ] ) + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 1 ]; + else if( gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 2 ] ) + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 2 ]; + else if( gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 3 ] ) + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 3 ]; + else + gpCurrentSectorSummary = NULL; + break; + case GROUND_LEVEL_MASK: //already pointing to the correct level + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 0 ]; + break; + case BASEMENT1_LEVEL_MASK: + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 1 ]; + break; + case BASEMENT2_LEVEL_MASK: + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 2 ]; + break; + case BASEMENT3_LEVEL_MASK: + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 3 ]; + break; + case ALTERNATE_LEVELS_MASK: + if( gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 4 ] ) + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 4 ]; + else if( gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 5 ] ) + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 5 ]; + else if( gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 6 ] ) + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 6 ]; + else if( gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 7 ] ) + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 7 ]; + else + gpCurrentSectorSummary = NULL; + break; + case ALTERNATE_GROUND_MASK: //already pointing to the correct level + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 4 ]; + break; + case ALTERNATE_B1_MASK: + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 5 ]; + break; + case ALTERNATE_B2_MASK: + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 6 ]; + break; + case ALTERNATE_B3_MASK: + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ 7 ]; + break; + } + if( gpWorldItemsSummaryArray ) + { + MemFree( gpWorldItemsSummaryArray ); + gpWorldItemsSummaryArray = NULL; + gusWorldItemsSummaryArraySize = 0; + } + if( gfItemDetailsMode ) + { + if( gpCurrentSectorSummary ) + /*&& gpCurrentSectorSummary->usNumItems || + gpPEnemyItemsSummaryArray && gusPEnemyItemsSummaryArraySize || + gpNEnemyItemsSummaryArray && gusNEnemyItemsSummaryArraySize )*/ + { + gfSetupItemDetailsMode = TRUE; + } + } + } + else + { //clicked in same sector, check for double click + INT32 iNewClickTime = GetJA2Clock(); + if( iNewClickTime - iLastClickTime < 400 ) + { + gfFileIO = TRUE; + } + iLastClickTime = iNewClickTime; + } + gfRenderSummary = TRUE; + } +} + +void SummaryToggleLevelCallback( GUI_BUTTON *btn, INT32 reason ) +{ + INT8 i; + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( GetActiveFieldID() == 1 ) + SelectNextField(); + gfRenderSummary = TRUE; + for( i = SUMMARY_ALL; i <= SUMMARY_B3; i++ ) + { + if( btn->IDNum == iSummaryButton[ i ] ) + { + switch( i ) + { + case SUMMARY_ALL: + giCurrentViewLevel = ALL_LEVELS_MASK; + break; + case SUMMARY_G: + giCurrentViewLevel = GROUND_LEVEL_MASK; + break; + case SUMMARY_B1: + giCurrentViewLevel = BASEMENT1_LEVEL_MASK; + break; + case SUMMARY_B2: + giCurrentViewLevel = BASEMENT2_LEVEL_MASK; + break; + case SUMMARY_B3: + giCurrentViewLevel = BASEMENT3_LEVEL_MASK; + break; + } + if( gfAlternateMaps ) + giCurrentViewLevel <<= 4; + } + else + { + ButtonList[ iSummaryButton[ i ] ]->uiFlags &= (~BUTTON_CLICKED_ON); + } + } + } +} + +void SummaryLoadMapCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT16 *ptr; + UINT16 str[ 50 ]; + gfRenderSummary = TRUE; + + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_LTKHAKI ); + SetFontShadow( FONT_NEARBLACK ); + + //swprintf( str, L"Loading map: %s...", gszDisplayName ); + //mprintf( MAP_LEFT, MAP_BOTTOM+100, str ); + //InvalidateRegion( MAP_LEFT, MAP_BOTTOM+100, MAP_LEFT+150, MAP_BOTTOM+110 ); + + CreateProgressBar( 0, MAP_LEFT+5, MAP_BOTTOM+110, 573, MAP_BOTTOM+120 ); + + DefineProgressBarPanel( 0, 65, 79, 94, MAP_LEFT, 318, 578, 356 ); + swprintf( str, L"Loading map: %s", gszDisplayName ); + SetProgressBarTitle( 0, str, BLOCKFONT2, FONT_RED, FONT_NEARBLACK ); + SetProgressBarMsgAttributes( 0, SMALLCOMPFONT, FONT_BLACK, FONT_BLACK ); + + if( ExternalLoadMap( gszDisplayName ) ) + { + EnableButton( iSummaryButton[ SUMMARY_OKAY ] ); + gsSectorX = gsSelSectorX; + gsSectorY = gsSelSectorY; + gfOverrideDirty = TRUE; + gfMapFileDirty = FALSE; + } + RemoveProgressBar( 0 ); + ptr = wcsstr( gszDisplayName, L"_b" ); + if( !ptr || ptr[3] != L'.' ) + { + gsSectorLayer = GROUND_LEVEL_MASK; + giCurrLevel = 0; + } + else + { + switch( ptr[2] - L'0' ) + { + case 1: gsSectorLayer = BASEMENT1_LEVEL_MASK; break; + case 2: gsSectorLayer = BASEMENT2_LEVEL_MASK; break; + case 3: gsSectorLayer = BASEMENT3_LEVEL_MASK; break; + default: gsSectorLayer = GROUND_LEVEL_MASK; break; + } + } + } +} + +void SummarySaveMapCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfRenderSummary = TRUE; + if( gubOverrideStatus == INACTIVE || gfOverride == TRUE ) + { + if( gubOverrideStatus == READONLY ) + { + UINT8 filename[40]; + sprintf( (char *)filename, "MAPS\\%S", gszDisplayName ); + FileClearAttributes( (STR)filename ); + } + if( ExternalSaveMap( gszDisplayName ) ) + { + if( gsSelSectorX && gsSelSectorY ) + { + gsSectorX = gsSelSectorX; + gsSectorY = gsSelSectorY; + gfMapFileDirty = FALSE; + gfOverrideDirty = TRUE; + } + } + } + } +} + +void SummaryOverrideCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfOverride ^= TRUE; + gfRenderSummary = TRUE; + if( gfOverride ) + EnableButton( iSummaryButton[ SUMMARY_SAVE ] ); + else + DisableButton( iSummaryButton[ SUMMARY_SAVE ] ); + } +} + +void CalculateOverrideStatus() +{ + GETFILESTRUCT FileInfo; + UINT8 szFilename[40]; + gfOverrideDirty = FALSE; + gfOverride = FALSE; + if( gfTempFile ) + { + UINT8 *ptr; + sprintf( (char *)szFilename, "MAPS\\%S", gszTempFilename ); + if( strlen( szFilename ) == 5 ) + strcat( szFilename, "test.dat" ); + ptr = (UINT8 *) strstr( szFilename, "." ); + if( !ptr ) + strcat( szFilename, ".dat" ); + else + sprintf( (char *)ptr, ".dat" ); + } + else + sprintf( (char *)szFilename, "MAPS\\%S", gszFilename ); + swprintf( gszDisplayName, L"%S", &(szFilename[5]) ); + if( GetFileFirst( (CHAR8 *)szFilename, &FileInfo) ) + { + if( gfWorldLoaded ) + { + if( FileInfo.uiFileAttribs & ( FILE_IS_READONLY | FILE_IS_SYSTEM ) ) + gubOverrideStatus = READONLY; + else + gubOverrideStatus = OVERWRITE; + ShowButton( iSummaryButton[ SUMMARY_OVERRIDE ] ); + ButtonList[ iSummaryButton[ SUMMARY_OVERRIDE ] ]->uiFlags &= (~BUTTON_CLICKED_ON); + GetFileClose(&FileInfo); + DisableButton( iSummaryButton[ SUMMARY_SAVE ] ); + } + if( gfTempFile ) + EnableButton( iSummaryButton[ SUMMARY_LOAD ] ); + } + else + { + gubOverrideStatus = INACTIVE; + HideButton( iSummaryButton[ SUMMARY_OVERRIDE ] ); + if( gfWorldLoaded ) + EnableButton( iSummaryButton[ SUMMARY_SAVE ] ); + } +} + +void LoadGlobalSummary() +{ + HWFILE hfile; + STRING512 DataDir; + STRING512 ExecDir; + STRING512 DevInfoDir; + STRING512 MapsDir; + UINT32 uiNumBytesRead; + FLOAT dMajorVersion; + INT32 x,y; + UINT8 szFilename[40]; + UINT8 szSector[6]; + + OutputDebugString( "Executing LoadGlobalSummary()...\n" ); + + // Snap: save current directory + GetFileManCurrentDirectory( DataDir ); + + gfMustForceUpdateAllMaps = FALSE; + gusNumberOfMapsToBeForceUpdated = 0; + gfGlobalSummaryExists = FALSE; + //Set current directory to JA2\DevInfo which contains all of the summary data + GetExecutableDirectory( ExecDir ); + sprintf( DevInfoDir, "%s\\DevInfo", ExecDir ); + sprintf( MapsDir, "%s\\Maps", DataDir ); + + //Check to make sure we have a DevInfo directory. If we don't create one! + if( !SetFileManCurrentDirectory( DevInfoDir ) ) + { + OutputDebugString( "LoadGlobalSummary() aborted -- doesn't exist on this local computer.\n"); + return; + } + + //TEMP + FileDelete( "_global.sum" ); + + gfGlobalSummaryExists = TRUE; + + //Analyse all sectors to see if matching maps exist. For any maps found, the information + //will be stored in the gbSectorLevels array. Also, it attempts to load summaries for those + //maps. If the summary information isn't found, then the occurrences are recorded and reported + //to the user when finished to give the option to generate them. + for( y = 0; y < 16; y++ ) + { + for( x = 0; x < 16; x++ ) + { + gbSectorLevels[x][y] = 0; + sprintf( (char *)szSector, "%c%d", 'A' + y, x + 1 ); + + //main ground level + sprintf( (char *)szFilename, "%c%d.dat", 'A' + y, x + 1 ); + SetFileManCurrentDirectory( MapsDir ); + hfile = FileOpen( (STR)szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + SetFileManCurrentDirectory( DevInfoDir ); + if( hfile ) + { + gbSectorLevels[x][y] |= GROUND_LEVEL_MASK; + FileRead( hfile, &dMajorVersion, sizeof( FLOAT ), &uiNumBytesRead ); + FileClose( hfile ); + LoadSummary( szSector, 0, dMajorVersion ); + } + else + { + sprintf( (char *)szFilename, "%s.sum", szSector ); + FileDelete( (STR)szFilename ); + } + //main B1 level + sprintf( (char *)szFilename, "%c%d_b1.dat", 'A' + y, x + 1 ); + SetFileManCurrentDirectory( MapsDir ); + hfile = FileOpen( (STR)szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + SetFileManCurrentDirectory( DevInfoDir ); + if( hfile ) + { + gbSectorLevels[x][y] |= BASEMENT1_LEVEL_MASK; + FileRead( hfile, &dMajorVersion, sizeof( FLOAT ), &uiNumBytesRead ); + FileClose( hfile ); + LoadSummary( szSector, 1, dMajorVersion ); + } + else + { + sprintf( (char *)szFilename, "%s_b1.sum", szSector ); + FileDelete( (STR)szFilename ); + } + //main B2 level + sprintf( (char *)szFilename, "%c%d_b2.dat", 'A' + y, x + 1 ); + SetFileManCurrentDirectory( MapsDir ); + hfile = FileOpen( (STR)szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + SetFileManCurrentDirectory( DevInfoDir ); + if( hfile ) + { + gbSectorLevels[x][y] |= BASEMENT2_LEVEL_MASK; + FileRead( hfile, &dMajorVersion, sizeof( FLOAT ), &uiNumBytesRead ); + FileClose( hfile ); + LoadSummary( szSector, 2, dMajorVersion ); + } + else + { + sprintf( (char *)szFilename, "%s_b2.sum", szSector ); + FileDelete( (STR)szFilename ); + } + //main B3 level + sprintf( (char *)szFilename, "%c%d_b3.dat", 'A' + y, x + 1 ); + SetFileManCurrentDirectory( MapsDir ); + hfile = FileOpen( (STR)szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + SetFileManCurrentDirectory( DevInfoDir ); + if( hfile ) + { + gbSectorLevels[x][y] |= BASEMENT3_LEVEL_MASK; + FileRead( hfile, &dMajorVersion, sizeof( FLOAT ), &uiNumBytesRead ); + FileClose( hfile ); + LoadSummary( szSector, 3, dMajorVersion ); + } + else + { + sprintf( (char *)szFilename, "%s_b3.sum", szSector ); + FileDelete( (STR)szFilename ); + } + //alternate ground level + sprintf( (char *)szFilename, "%c%d_a.dat", 'A' + y, x + 1 ); + SetFileManCurrentDirectory( MapsDir ); + hfile = FileOpen( (STR)szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + SetFileManCurrentDirectory( DevInfoDir ); + if( hfile ) + { + gbSectorLevels[x][y] |= ALTERNATE_GROUND_MASK; + FileRead( hfile, &dMajorVersion, sizeof( FLOAT ), &uiNumBytesRead ); + FileClose( hfile ); + LoadSummary( szSector, 4, dMajorVersion ); + } + else + { + sprintf( (char *)szFilename, "%s_a.sum", szSector ); + FileDelete( (STR)szFilename ); + } + //alternate B1 level + sprintf( (char *)szFilename, "%c%d_b1_a.dat", 'A' + y, x + 1 ); + SetFileManCurrentDirectory( MapsDir ); + hfile = FileOpen( (STR)szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + SetFileManCurrentDirectory( DevInfoDir ); + if( hfile ) + { + gbSectorLevels[x][y] |= ALTERNATE_B1_MASK; + FileRead( hfile, &dMajorVersion, sizeof( FLOAT ), &uiNumBytesRead ); + FileClose( hfile ); + LoadSummary( szSector, 5, dMajorVersion ); + } + else + { + sprintf( (char *)szFilename, "%s_b1_a.sum", szSector ); + FileDelete( (STR)szFilename ); + } + //alternate B2 level + sprintf( (char *)szFilename, "%c%d_b2_a.dat", 'A' + y, x + 1 ); + SetFileManCurrentDirectory( MapsDir ); + hfile = FileOpen( (STR)szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + SetFileManCurrentDirectory( DevInfoDir ); + if( hfile ) + { + gbSectorLevels[x][y] |= ALTERNATE_B2_MASK; + FileRead( hfile, &dMajorVersion, sizeof( FLOAT ), &uiNumBytesRead ); + FileClose( hfile ); + LoadSummary( szSector, 6, dMajorVersion ); + } + else + { + sprintf( (char *)szFilename, "%s_b2_a.sum", szSector ); + FileDelete( (STR)szFilename ); + } + //alternate B3 level + sprintf( (char *)szFilename, "%c%d_b3_a.dat", 'A' + y, x + 1 ); + SetFileManCurrentDirectory( MapsDir ); + hfile = FileOpen( (STR)szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + SetFileManCurrentDirectory( DevInfoDir ); + if( hfile ) + { + gbSectorLevels[x][y] |= ALTERNATE_B1_MASK;; + FileRead( hfile, &dMajorVersion, sizeof( FLOAT ), &uiNumBytesRead ); + FileClose( hfile ); + LoadSummary( szSector, 7, dMajorVersion ); + } + else + { + sprintf( (char *)szFilename, "%s_b3_a.sum", szSector ); + FileDelete( (STR)szFilename ); + } + } + OutputDebugString( (LPCSTR)String("Sector Row %c complete... \n", y + 'A') ); + } + + // Snap: Restore the data directory once we are finished. + SetFileManCurrentDirectory( DataDir ); + + //sprintf( MapsDir, "%s\\Data", ExecDir ); + //SetFileManCurrentDirectory( MapsDir ); + + if( gfMustForceUpdateAllMaps ) + { + OutputDebugString( (LPCSTR)String( "A MAJOR MAP UPDATE EVENT HAS BEEN DETECTED FOR %d MAPS!!!!.\n", gusNumberOfMapsToBeForceUpdated ) ); + } + + + OutputDebugString( "LoadGlobalSummary() finished...\n" ); +} + +void GenerateSummaryList() +{ + FILE *fp; + STRING512 DataDir; + STRING512 ExecDir; + STRING512 Dir; + + // Snap: save current directory + GetFileManCurrentDirectory( DataDir ); + + //Set current directory to JA2\DevInfo which contains all of the summary data + GetExecutableDirectory( ExecDir ); + sprintf( Dir, "%s\\DevInfo", ExecDir ); + if( !SetFileManCurrentDirectory( Dir ) ) + { + //Directory doesn't exist, so create it, and continue. + if( !MakeFileManDirectory( Dir ) ) + AssertMsg( 0, "Can't create new directory, JA2\\DevInfo for summary information." ); + if( !SetFileManCurrentDirectory( Dir ) ) + AssertMsg( 0, "Can't set to new directory, JA2\\DevInfo for summary information." ); + //Generate a simple readme file. + fp = fopen( "readme.txt", "w" ); + Assert( fp ); + fprintf( fp, "%s\n%s\n", "This information is used in conjunction with the editor.", + "This directory or it's contents shouldn't be included with final release." ); + fclose( fp ); + } + + + // Snap: Restore the data directory once we are finished. + SetFileManCurrentDirectory( DataDir ); + //Set current directory back to data directory! + //sprintf( Dir, "%s\\Data", ExecDir ); + //SetFileManCurrentDirectory( Dir ); +} + +void WriteSectorSummaryUpdate( UINT8 *puiFilename, UINT8 ubLevel, SUMMARYFILE *pSummaryFileInfo ) +{ + FILE *fp; + STRING512 DataDir; + STRING512 ExecDir; + STRING512 Dir; + UINT8 *ptr; + INT8 x, y; + + // Snap: save current directory + GetFileManCurrentDirectory( DataDir ); + + //Set current directory to JA2\DevInfo which contains all of the summary data + GetExecutableDirectory( ExecDir ); + sprintf( Dir, "%s\\DevInfo", ExecDir ); + if( !SetFileManCurrentDirectory( Dir ) ) + AssertMsg( 0, "JA2\\DevInfo folder not found and should exist!"); + + ptr = (UINT8 *) strstr( puiFilename, ".dat" ); + if( !ptr ) + AssertMsg( 0, "Illegal sector summary filename."); + sprintf( (char *)ptr, ".sum" ); + + //write the summary information + fp = fopen( (const char *)puiFilename, "wb" ); + Assert( fp ); + fwrite( pSummaryFileInfo, 1, sizeof( SUMMARYFILE ), fp ); + fclose( fp ); + + gusNumEntriesWithOutdatedOrNoSummaryInfo--; + UpdateMasterProgress(); + + //extract the sector information out of the filename. + if( puiFilename[0] >= 'a' ) + y = puiFilename[0] - 'a'; + else + y = puiFilename[0] - 'A'; + if( puiFilename[2] < '0' || puiFilename[2] > '9' ) + x = puiFilename[ 1 ] - '0' - 1; + else + x = (puiFilename[ 1 ] - '0') * 10 + puiFilename[ 2 ] - '0' - 1; + + gpSectorSummary[x][y][ubLevel] = pSummaryFileInfo; + + // Snap: Restore the data directory once we are finished. + SetFileManCurrentDirectory( DataDir ); + //Set current directory back to data directory! + //sprintf( Dir, "%s\\Data", ExecDir ); + //SetFileManCurrentDirectory( Dir ); +} + +void SummaryNewGroundLevelCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gfPendingBasement = FALSE; + gfPendingCaves = FALSE; + if( gfWorldLoaded ) + { + iCurrentAction = ACTION_NEW_MAP; + } + else + { + CreateNewMap(); + } + } +} + +void SummaryNewBasementLevelCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + + } +} + +void SummaryNewCaveLevelCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + + } +} + +void LoadSummary( UINT8 *pSector, UINT8 ubLevel, FLOAT dMajorMapVersion ) +{ + UINT8 filename[40]; + SUMMARYFILE temp; + INT32 x, y; + FILE *fp; + sprintf( (char *)filename, (const char *)pSector ); + if( ubLevel % 4 ) + { + UINT8 str[4]; + sprintf( (char *)str, "_b%d", ubLevel % 4 ); + strcat( filename, str ); + } + if( ubLevel >= 4 ) + { + strcat( filename, "_a" ); + } + strcat( filename, ".sum" ); + + fp = fopen( (const char *)filename, "rb" ); + if( !fp ) + { + gusNumEntriesWithOutdatedOrNoSummaryInfo++; + return; + } + fread( &temp, 1, sizeof( SUMMARYFILE ), fp ); + if( temp.ubSummaryVersion < MINIMUMVERSION || dMajorMapVersion < gdMajorMapVersion ) + { + gusNumberOfMapsToBeForceUpdated++; + gfMustForceUpdateAllMaps = TRUE; + } + temp.dMajorMapVersion = dMajorMapVersion; + UpdateSummaryInfo( &temp ); + //even if the info is outdated (but existing), allocate the structure, but indicate that the info + //is bad. + y = pSector[0] - 'A'; + if( pSector[2] >= '0' && pSector[2] <= '9' ) + x = (pSector[1] - '0') * 10 + pSector[2] - '0' - 1; + else + x = pSector[1] - '0' - 1; + if( gpSectorSummary[x][y][ubLevel] ) + { + MemFree( gpSectorSummary[x][y][ubLevel] ); + gpSectorSummary[x][y][ubLevel] = NULL; + } + gpSectorSummary[x][y][ubLevel] = (SUMMARYFILE*)MemAlloc( sizeof( SUMMARYFILE ) ); + if( gpSectorSummary[x][y][ubLevel] ) + memcpy( gpSectorSummary[x][y][ubLevel], &temp, sizeof( SUMMARYFILE ) ); + if( gpSectorSummary[x][y][ubLevel]->ubSummaryVersion < GLOBAL_SUMMARY_VERSION ) + gusNumEntriesWithOutdatedOrNoSummaryInfo++; + + fclose( fp ); +} + + +double MasterStart, MasterEnd; + +void UpdateMasterProgress() +{ + if( gfUpdatingNow && gusTotal ) + { + MasterStart = (gusCurrent / (double)gusTotal) * 100.0; + gusCurrent++; + MasterEnd = (gusCurrent / (double)gusTotal) * 100.0; + if( gfMajorUpdate ) + { + SetRelativeStartAndEndPercentage( 2, (UINT16)MasterStart, (UINT16)MasterEnd, NULL ); + RenderProgressBar( 2, 0 ); + } + else + SetRelativeStartAndEndPercentage( 1, (UINT16)MasterStart, (UINT16)MasterEnd, NULL ); + } +} + +void ReportError( UINT8 *pSector, UINT8 ubLevel ) +{ + static INT32 yp = 180; + UINT16 str[40]; + UINT16 temp[10]; + + //Make sure the file exists... if not, then return false + swprintf( str, L"%S", pSector ); + if( ubLevel % 4 ) + { + swprintf( temp, L"_b%d.dat", ubLevel % 4 ); + wcscat( str, temp ); + } + mprintf( 10, yp, L"Skipping update for %s. Probably due to tileset conflicts...", str ); + InvalidateScreen(); + yp++; +} + + +void RegenerateSummaryInfoForAllOutdatedMaps() +{ + INT32 x, y; + UINT8 str[40]; + SUMMARYFILE *pSF; + //CreateProgressBar( 0, 20, 120, 300, 132 ); //slave (individual) + //CreateProgressBar( 1, 20, 100, 300, 112 ); //master (total) + //DefineProgressBarPanel( 0, 65, 79, 94, 10, 80, 310, 152 ); + CreateProgressBar( 0, 20, 100, 300, 112 ); //master (total) + DefineProgressBarPanel( 0, 65, 79, 94, 10, 80, 310, 132 ); + SetProgressBarTitle( 0, L"Generating map information", BLOCKFONT2, FONT_RED, FONT_NEARBLACK ); + SetProgressBarMsgAttributes( 0, SMALLCOMPFONT, FONT_BLACK, FONT_BLACK ); + gfUpdatingNow = TRUE; + + gusCurrent = 0; + gusTotal = gusNumEntriesWithOutdatedOrNoSummaryInfo; + UpdateMasterProgress(); + + for( y = 0; y < 16; y++ ) for( x = 0; x < 16; x++ ) + { + sprintf( (char *)str, "%c%d", y + 'A', x + 1 ); + if( gbSectorLevels[x][y] & GROUND_LEVEL_MASK ) + { + pSF = gpSectorSummary[x][y][0]; + if( !pSF || pSF->ubSummaryVersion != GLOBAL_SUMMARY_VERSION ) + if( !EvaluateWorld( str, 0 ) ) + ReportError( str, 0 ); + } + if( gbSectorLevels[x][y] & BASEMENT1_LEVEL_MASK ) + { + pSF = gpSectorSummary[x][y][1]; + if( !pSF || pSF->ubSummaryVersion != GLOBAL_SUMMARY_VERSION ) + if( !EvaluateWorld( str, 1 ) ) + ReportError( str, 1 ); + } + if( gbSectorLevels[x][y] & BASEMENT2_LEVEL_MASK ) + { + pSF = gpSectorSummary[x][y][2]; + if( !pSF || pSF->ubSummaryVersion != GLOBAL_SUMMARY_VERSION ) + if( !EvaluateWorld( str, 2 ) ) + ReportError( str, 2 ); + } + if( gbSectorLevels[x][y] & BASEMENT3_LEVEL_MASK ) + { + pSF = gpSectorSummary[x][y][3]; + if( !pSF || pSF->ubSummaryVersion != GLOBAL_SUMMARY_VERSION ) + if( !EvaluateWorld( str, 3 ) ) + ReportError( str, 3 ); + } + if( gbSectorLevels[x][y] & ALTERNATE_GROUND_MASK ) + { + pSF = gpSectorSummary[x][y][4]; + if( !pSF || pSF->ubSummaryVersion != GLOBAL_SUMMARY_VERSION ) + if( !EvaluateWorld( str, 4 ) ) + ReportError( str, 4 ); + } + if( gbSectorLevels[x][y] & ALTERNATE_B1_MASK ) + { + pSF = gpSectorSummary[x][y][5]; + if( !pSF || pSF->ubSummaryVersion != GLOBAL_SUMMARY_VERSION ) + if( !EvaluateWorld( str, 5 ) ) + ReportError( str, 5 ); + } + if( gbSectorLevels[x][y] & ALTERNATE_B2_MASK ) + { + pSF = gpSectorSummary[x][y][6]; + if( !pSF || pSF->ubSummaryVersion != GLOBAL_SUMMARY_VERSION ) + if( !EvaluateWorld( str, 6 ) ) + ReportError( str, 6 ); + } + if( gbSectorLevels[x][y] & ALTERNATE_B3_MASK ) + { + pSF = gpSectorSummary[x][y][7]; + if( !pSF || pSF->ubSummaryVersion != GLOBAL_SUMMARY_VERSION ) + if( !EvaluateWorld( str, 7 ) ) + ReportError( str, 7 ); + } + } + RemoveProgressBar( 0 ); + RemoveProgressBar( 1 ); + gfUpdatingNow = FALSE; +} + +void SummaryUpdateCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT8 str[40]; + CreateProgressBar( 0, 20, 100, 300, 112 ); //slave (individual) + DefineProgressBarPanel( 0, 65, 79, 94, 10, 80, 310, 132 ); + SetProgressBarTitle( 0, L"Generating map summary", BLOCKFONT2, FONT_RED, FONT_NEARBLACK ); + SetProgressBarMsgAttributes( 0, SMALLCOMPFONT, FONT_BLACK, FONT_BLACK ); + + if( gpCurrentSectorSummary ) + { + MemFree( gpCurrentSectorSummary ); + gpCurrentSectorSummary = NULL; + } + + sprintf( (char *)str, "%c%d", gsSelSectorY + 'A' - 1, gsSelSectorX ); + EvaluateWorld( str, (UINT8)giCurrLevel ); + + gpSectorSummary[ gsSelSectorX ][ gsSelSectorY ][ giCurrLevel ] = gpCurrentSectorSummary; + + gfRenderSummary = TRUE; + + RemoveProgressBar( 0 ); + } +} + +void ExtractTempFilename() +{ + UINT16 str[40]; + Get16BitStringFromField( 1, str ); + if( wcscmp( gszTempFilename, str ) ) + { + wcscpy( gszTempFilename, str ); + gfRenderSummary = TRUE; + gfOverrideDirty = TRUE; + } + if( !wcslen( str ) ) + swprintf( gszDisplayName, L"test.dat" ); +} + +void ApologizeOverrideAndForceUpdateEverything() +{ + INT32 x, y; + UINT16 str[ 50 ]; + UINT8 name[50]; + SUMMARYFILE *pSF; + //Create one huge assed button + gfMajorUpdate = TRUE; + iSummaryButton[ SUMMARY_BACKGROUND ] = + CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, 0, 0, 640, 480, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1, + BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK ); + SpecifyDisabledButtonStyle( iSummaryButton[ SUMMARY_BACKGROUND ], DISABLED_STYLE_NONE ); + DisableButton( iSummaryButton[ SUMMARY_BACKGROUND ] ); + //Draw it + DrawButton( iSummaryButton[ SUMMARY_BACKGROUND ] ); + InvalidateRegion( 0, 0, 640, 480 ); + SetFont( HUGEFONT ); + SetFontForeground( FONT_RED ); + SetFontShadow( FONT_NEARBLACK ); + swprintf( str, L"MAJOR VERSION UPDATE" ); + mprintf( 320 - StringPixLength( str, HUGEFONT )/2, 105, str ); + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + swprintf( str, L"There are %d maps requiring a major version update.", gusNumberOfMapsToBeForceUpdated ); + mprintf( 320 - StringPixLength( str, FONT10ARIAL )/2, 130, str ); + + CreateProgressBar( 2, 120, 170, 520, 202 ); + DefineProgressBarPanel( 2, 65, 79, 94, 100, 150, 540, 222 ); + SetProgressBarTitle( 2, L"Updating all outdated maps", BLOCKFONT2, FONT_RED, 0 ); + SetProgressBarMsgAttributes( 2, SMALLCOMPFONT, FONT_BLACK, FONT_BLACK ); + + gusCurrent = 0; + gusTotal = gusNumberOfMapsToBeForceUpdated; + gfUpdatingNow = TRUE; + UpdateMasterProgress(); + + for( y = 0; y < 16; y++ ) for( x = 0; x < 16; x++ ) + { + sprintf( (char *)name, "%c%d", y + 'A', x + 1 ); + if( gbSectorLevels[x][y] & GROUND_LEVEL_MASK ) + { + pSF = gpSectorSummary[x][y][0]; + if( !pSF || pSF->ubSummaryVersion < MINIMUMVERSION || pSF->dMajorMapVersion < gdMajorMapVersion ) + { + gpCurrentSectorSummary = pSF; + if( !EvaluateWorld( name, 0 ) ) + return; + } + } + if( gbSectorLevels[x][y] & BASEMENT1_LEVEL_MASK ) + { + pSF = gpSectorSummary[x][y][1]; + if( !pSF || pSF->ubSummaryVersion < MINIMUMVERSION || pSF->dMajorMapVersion < gdMajorMapVersion ) + { + gpCurrentSectorSummary = pSF; + if( !EvaluateWorld( name, 1 ) ) + return; + } + } + if( gbSectorLevels[x][y] & BASEMENT2_LEVEL_MASK ) + { + pSF = gpSectorSummary[x][y][2]; + if( !pSF || pSF->ubSummaryVersion < MINIMUMVERSION || pSF->dMajorMapVersion < gdMajorMapVersion ) + { + gpCurrentSectorSummary = pSF; + if( !EvaluateWorld( name, 2 ) ) + return; + } + } + if( gbSectorLevels[x][y] & BASEMENT3_LEVEL_MASK ) + { + pSF = gpSectorSummary[x][y][3]; + if( !pSF || pSF->ubSummaryVersion < MINIMUMVERSION || pSF->dMajorMapVersion < gdMajorMapVersion ) + { + gpCurrentSectorSummary = pSF; + if( !EvaluateWorld( name, 3 ) ) + return; + } + } + if( gbSectorLevels[x][y] & ALTERNATE_GROUND_MASK ) + { + pSF = gpSectorSummary[x][y][4]; + if( !pSF || pSF->ubSummaryVersion < MINIMUMVERSION || pSF->dMajorMapVersion < gdMajorMapVersion ) + { + gpCurrentSectorSummary = pSF; + if( !EvaluateWorld( name, 4 ) ) + return; + } + } + if( gbSectorLevels[x][y] & ALTERNATE_B1_MASK ) + { + pSF = gpSectorSummary[x][y][5]; + if( !pSF || pSF->ubSummaryVersion < MINIMUMVERSION || pSF->dMajorMapVersion < gdMajorMapVersion ) + { + gpCurrentSectorSummary = pSF; + if( !EvaluateWorld( name, 5 ) ) + return; + } + } + if( gbSectorLevels[x][y] & ALTERNATE_B2_MASK ) + { + pSF = gpSectorSummary[x][y][6]; + if( !pSF || pSF->ubSummaryVersion < MINIMUMVERSION || pSF->dMajorMapVersion < gdMajorMapVersion ) + { + gpCurrentSectorSummary = pSF; + if( !EvaluateWorld( name, 6 ) ) + return; + } + } + if( gbSectorLevels[x][y] & ALTERNATE_B3_MASK ) + { + pSF = gpSectorSummary[x][y][7]; + if( !pSF || pSF->ubSummaryVersion < MINIMUMVERSION || pSF->dMajorMapVersion < gdMajorMapVersion ) + { + gpCurrentSectorSummary = pSF; + if( !EvaluateWorld( name, 7 ) ) + return; + } + } + } + + EvaluateWorld( (UINT8 *)"p3_m.dat", 0 ); + + RemoveProgressBar( 2 ); + gfUpdatingNow = FALSE; + InvalidateScreen(); + + RemoveButton( iSummaryButton[ SUMMARY_BACKGROUND ] ); + gfMajorUpdate = FALSE; + gfMustForceUpdateAllMaps = FALSE; + gusNumberOfMapsToBeForceUpdated = 0; +} + +void SetupItemDetailsMode( BOOLEAN fAllowRecursion ) +{ + HWFILE hfile; + UINT32 uiNumBytesRead; + UINT32 uiNumItems; + UINT8 szFilename[40]; + BASIC_SOLDIERCREATE_STRUCT basic; + SOLDIERCREATE_STRUCT priority; + INT32 i, j; + UINT16 usNumItems; + OBJECTTYPE *pItem; + UINT16 usPEnemyIndex, usNEnemyIndex; + + //Clear memory for all the item summaries loaded + if( gpWorldItemsSummaryArray ) + { + MemFree( gpWorldItemsSummaryArray ); + gpWorldItemsSummaryArray = NULL; + gusWorldItemsSummaryArraySize = 0; + } + if( gpPEnemyItemsSummaryArray ) + { + MemFree( gpPEnemyItemsSummaryArray ); + gpPEnemyItemsSummaryArray = NULL; + gusPEnemyItemsSummaryArraySize = 0; + } + if( gpNEnemyItemsSummaryArray ) + { + MemFree( gpNEnemyItemsSummaryArray ); + gpNEnemyItemsSummaryArray = NULL; + gusNEnemyItemsSummaryArraySize = 0; + } + + if( !gpCurrentSectorSummary->uiNumItemsPosition ) + { //Don't have one, so generate them + if( gpCurrentSectorSummary->ubSummaryVersion == GLOBAL_SUMMARY_VERSION ) + gusNumEntriesWithOutdatedOrNoSummaryInfo++; + SummaryUpdateCallback( ButtonList[ iSummaryButton[ SUMMARY_UPDATE ] ], MSYS_CALLBACK_REASON_LBUTTON_UP ); + gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1 ][ gsSelSectorY - 1 ][ giCurrLevel ]; + } + //Open the original map for the sector + sprintf( (char *)szFilename, "MAPS\\%S", gszFilename ); + hfile = FileOpen( (STR)szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + if( !hfile ) + { //The file couldn't be found! + return; + } + //Now fileseek directly to the file position where the number of world items are stored + if( !FileSeek( hfile, gpCurrentSectorSummary->uiNumItemsPosition, FILE_SEEK_FROM_START ) ) + { //Position couldn't be found! + FileClose( hfile ); + return; + } + //Now load the number of world items from the map. + FileRead( hfile, &uiNumItems, 4, &uiNumBytesRead ); + if( uiNumBytesRead != 4 ) + { //Invalid situation. + FileClose( hfile ); + return; + } + //Now compare this number with the number the summary thinks we should have. If they are different, + //the the summary doesn't match the map. What we will do is force regenerate the map so that they do + //match + if( uiNumItems != gpCurrentSectorSummary->usNumItems && fAllowRecursion ) + { + FileClose( hfile ); + gpCurrentSectorSummary->uiNumItemsPosition = 0; + SetupItemDetailsMode( FALSE ); + return; + } + //Passed the gauntlet, so now allocate memory for it, and load all the world items into this array. + ShowButton( iSummaryButton[ SUMMARY_SCIFI ] ); + ShowButton( iSummaryButton[ SUMMARY_REAL ] ); + ShowButton( iSummaryButton[ SUMMARY_ENEMY ] ); + gpWorldItemsSummaryArray = (WORLDITEM*)MemAlloc( sizeof( WORLDITEM ) * uiNumItems ); + gusWorldItemsSummaryArraySize = gpCurrentSectorSummary->usNumItems; + FileRead( hfile, gpWorldItemsSummaryArray, sizeof( WORLDITEM ) * uiNumItems, &uiNumBytesRead ); + + //NOW, do the enemy's items! + //We need to do two passes. The first pass simply processes all the enemies and counts all the droppable items + //keeping track of two different values. The first value is the number of droppable items that come off of + //enemy detailed placements, the other counter keeps track of the number of droppable items that come off of + //normal enemy placements. After doing this, the memory is allocated for the tables that will store all the item + //summary information, then the second pass will repeat the process, except it will record the actual items. + + //PASS #1 + if( !FileSeek( hfile, gpCurrentSectorSummary->uiEnemyPlacementPosition, FILE_SEEK_FROM_START ) ) + { //Position couldn't be found! + FileClose( hfile ); + return; + } + for( i = 0; i < gpCurrentSectorSummary->MapInfo.ubNumIndividuals ; i++ ) + { + FileRead( hfile, &basic, sizeof( BASIC_SOLDIERCREATE_STRUCT ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( BASIC_SOLDIERCREATE_STRUCT ) ) + { //Invalid situation. + FileClose( hfile ); + return; + } + if( basic.fDetailedPlacement ) + { //skip static priority placement + FileRead( hfile, &priority, sizeof( SOLDIERCREATE_STRUCT ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( SOLDIERCREATE_STRUCT ) ) + { //Invalid situation. + FileClose( hfile ); + return; + } + } + else + { //non detailed placements don't have items, so skip + continue; + } + if( basic.bTeam == ENEMY_TEAM ) + { + //Count the items that this enemy placement drops + usNumItems = 0; + for( j = 0; j < 9; j++ ) + { + pItem = &priority.Inv[ gbMercSlotTypes[ j ] ]; + if( pItem->usItem != NOTHING && !( pItem->fFlags & OBJECT_UNDROPPABLE ) ) + { + usNumItems++; + } + } + if( basic.fPriorityExistance ) + { + gusPEnemyItemsSummaryArraySize += usNumItems; + } + else + { + gusNEnemyItemsSummaryArraySize += usNumItems; + } + } + } + + //Pass 1 completed, so now allocate enough space to hold all the items + if( gusPEnemyItemsSummaryArraySize ) + { + gpPEnemyItemsSummaryArray = (OBJECTTYPE*)MemAlloc( sizeof( OBJECTTYPE ) * gusPEnemyItemsSummaryArraySize ); + memset( gpPEnemyItemsSummaryArray, 0, sizeof( OBJECTTYPE ) * gusPEnemyItemsSummaryArraySize ); + } + if( gusNEnemyItemsSummaryArraySize ) + { + gpNEnemyItemsSummaryArray = (OBJECTTYPE*)MemAlloc( sizeof( OBJECTTYPE ) * gusNEnemyItemsSummaryArraySize ); + memset( gpNEnemyItemsSummaryArray, 0, sizeof( OBJECTTYPE ) * gusNEnemyItemsSummaryArraySize ); + } + + //PASS #2 + //During this pass, simply copy all the data instead of counting it, now that we have already done so. + usPEnemyIndex = usNEnemyIndex = 0; + if( !FileSeek( hfile, gpCurrentSectorSummary->uiEnemyPlacementPosition, FILE_SEEK_FROM_START ) ) + { //Position couldn't be found! + FileClose( hfile ); + return; + } + for( i = 0; i < gpCurrentSectorSummary->MapInfo.ubNumIndividuals ; i++ ) + { + FileRead( hfile, &basic, sizeof( BASIC_SOLDIERCREATE_STRUCT ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( BASIC_SOLDIERCREATE_STRUCT ) ) + { //Invalid situation. + FileClose( hfile ); + return; + } + if( basic.fDetailedPlacement ) + { //skip static priority placement + FileRead( hfile, &priority, sizeof( SOLDIERCREATE_STRUCT ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( SOLDIERCREATE_STRUCT ) ) + { //Invalid situation. + FileClose( hfile ); + return; + } + } + else + { //non detailed placements don't have items, so skip + continue; + } + if( basic.bTeam == ENEMY_TEAM ) + { + //Copy the items that this enemy placement drops + usNumItems = 0; + for( j = 0; j < 9; j++ ) + { + pItem = &priority.Inv[ gbMercSlotTypes[ j ] ]; + if( pItem->usItem != NOTHING && !( pItem->fFlags & OBJECT_UNDROPPABLE ) ) + { + if( basic.fPriorityExistance ) + { + memcpy( &(gpPEnemyItemsSummaryArray[ usPEnemyIndex ]), pItem, sizeof( OBJECTTYPE ) ); + usPEnemyIndex++; + } + else + { + memcpy( &(gpNEnemyItemsSummaryArray[ usNEnemyIndex ]), pItem, sizeof( OBJECTTYPE ) ); + usNEnemyIndex++; + } + } + } + } + } + FileClose( hfile ); +} + +UINT8 GetCurrentSummaryVersion() +{ + if( gpCurrentSectorSummary ) + { + return gpCurrentSectorSummary->MapInfo.ubMapVersion; + } + return 0; +} + +#endif diff --git a/Editor/Sector Summary.h b/Editor/Sector Summary.h new file mode 100644 index 00000000..7d90fe12 --- /dev/null +++ b/Editor/Sector Summary.h @@ -0,0 +1,35 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __SECTOR_SUMMARY_H +#define __SECTOR_SUMMARY_H + +//This function can be very time consuming as it loads every map file with a valid +//coordinate name, analyses it, and builds a new global summary file. +void CreateGlobalSummary(); + +void CreateSummaryWindow(); +void ReleaseSummaryWindow(); +void DestroySummaryWindow(); +void RenderSummaryWindow(); +void LoadWorldInfo(); + +void UpdateSectorSummary( UINT16 *gszFilename, BOOLEAN fUpdate ); + +void SaveGlobalSummary(); +void LoadGlobalSummary(); + +extern BOOLEAN gfGlobalSummaryExists; + +extern BOOLEAN gfSummaryWindowActive; + +extern BOOLEAN gSectorExists[16][16]; + +extern UINT16 gusNumEntriesWithOutdatedOrNoSummaryInfo; + +extern BOOLEAN gfUpdateSummaryInfo; + +extern UINT8 GetCurrentSummaryVersion(); + +#endif +#endif \ No newline at end of file diff --git a/Editor/SmartMethod.cpp b/Editor/SmartMethod.cpp new file mode 100644 index 00000000..b02d47d0 --- /dev/null +++ b/Editor/SmartMethod.cpp @@ -0,0 +1,628 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "worlddef.h" //LEVELNODE def + #include "worldman.h" //ReplaceStructIndex + #include "SmartMethod.h" + #include "Smoothing Utils.h" + #include "Editor Undo.h" +#endif + +UINT8 gubDoorUIValue = 0; +UINT8 gubWindowUIValue = 0; +UINT8 gubWallUIValue = FIRSTWALL; +UINT8 gubBrokenWallUIValue = 0; + +void CalcSmartWallDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ) +{ + *pusUseIndex = 0; + *pusObjIndex = gubWallUIValue; +} + +void CalcSmartDoorDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ) +{ + *pusUseIndex = 4 * ( gubDoorUIValue % 2 ); //open or closed -- odd or even + *pusObjIndex = FIRSTDOOR + gubDoorUIValue / 2; +} + +void CalcSmartWindowDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ) +{ + *pusUseIndex = 44 + gubWindowUIValue; //first exterior top right oriented window + *pusObjIndex = FIRSTWALL; +} + +void CalcSmartBrokenWallDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ) +{ + switch( gubBrokenWallUIValue ) + { + case 0:case 1: *pusUseIndex = 49 + gubBrokenWallUIValue; break; + case 3: *pusUseIndex = 62; break; + case 4: *pusUseIndex = 64; break; + } + *pusObjIndex = FIRSTWALL; +} + +UINT16 CalcSmartWindowIndex( UINT16 usWallOrientation ) +{ + return (UINT16)(33 + usWallOrientation*3 + gubWindowUIValue); +} + +UINT16 CalcSmartDoorIndex( UINT16 usWallOrientation ) +{ + //convert the orientation values as the graphics are in reverse order + //orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4 + //door graphics order: INSIDE_TOP_LEFT=15, INSIDE_TOP_RIGHT=10, OUTSIDE_TOP_LEFT=5, OUTSIDE_TOP_RIGHT=0 + usWallOrientation = (4 - usWallOrientation) * 5; + //4 * (gubDoorUIValue%2) evaluates to +4 if the door is open, 0 if closed + return (UINT16)( 1 + usWallOrientation + 4 * (gubDoorUIValue % 2) ); +} + +UINT16 CalcSmartDoorType() +{ + return (UINT16)( FIRSTDOOR + gubDoorUIValue / 2 ); +} + +UINT16 CalcSmartBrokenWallIndex( UINT16 usWallOrientation ) +{ + if( gubBrokenWallUIValue == 2 ) //the hole in the wall + return 0xffff; + if( gubBrokenWallUIValue < 2 ) //broken walls + { + //convert the orientation value as the graphics are in a different order. + //orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4 + // 4 6 8 10 + //door graphics order: INSIDE_TOP_LEFT=4, INSIDE_TOP_RIGHT=6, OUTSIDE_TOP_LEFT=0, OUTSIDE_TOP_RIGHT=2 + usWallOrientation = usWallOrientation * 2 + 2; + usWallOrientation -= usWallOrientation > 6 ? 8 : 0; + return (UINT16)( usWallOrientation + 48 + gubBrokenWallUIValue ); + } + + //cracked and smudged walls + + //convert the orientation value as the graphics are in a different order. + //orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4 + //door graphics order: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=5, OUTSIDE_TOP_RIGHT=6 + usWallOrientation += usWallOrientation > 1 ? 2 : 0; + usWallOrientation += gubBrokenWallUIValue == 4 ? 2 : 0; //smudged type which is 2 index values higher. + return (UINT16)( usWallOrientation + 57 ); +} + +void IncSmartWallUIValue() +{ + gubWallUIValue += gubWallUIValue < LASTWALL ? 1 : -3; +} + +void DecSmartWallUIValue() +{ + gubWallUIValue -= gubWallUIValue > FIRSTWALL ? 1 : -3; +} + +void IncSmartDoorUIValue() +{ + gubDoorUIValue += gubDoorUIValue < 7 ? 1 : -7; +} + +void DecSmartDoorUIValue() +{ + gubDoorUIValue -= gubDoorUIValue > 0 ? 1 : -7; +} + +void IncSmartWindowUIValue() +{ + gubWindowUIValue += gubWindowUIValue < 2 ? 1 : -2; +} + +void DecSmartWindowUIValue() +{ + gubWindowUIValue -= gubWindowUIValue > 0 ? 1 : -2; +} + +void IncSmartBrokenWallUIValue() +{ + gubBrokenWallUIValue += gubBrokenWallUIValue < 4 ? 1 : -4; +} + +void DecSmartBrokenWallUIValue() +{ + gubBrokenWallUIValue -= gubBrokenWallUIValue > 0 ? 1 : -4; +} + +BOOLEAN CalcWallInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallType, UINT16 *pusIndex ) +{ + return FALSE; +} + +BOOLEAN CalcDoorInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusDoorType, UINT16 *pusIndex ) +{ + LEVELNODE *pWall = NULL; + UINT16 usWallOrientation; + pWall = GetVerticalWall( iMapIndex ); + if( pWall ) + { + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + *pusIndex = CalcSmartDoorIndex( usWallOrientation ) - 1; + *pusDoorType = CalcSmartDoorType(); + return TRUE; + } + pWall = GetHorizontalWall( iMapIndex ); + if( pWall ) + { + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + *pusIndex = CalcSmartDoorIndex( usWallOrientation ) - 1; + *pusDoorType = CalcSmartDoorType(); + return TRUE; + } + return FALSE; +} + +BOOLEAN CalcWindowInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallType, UINT16 *pusIndex ) +{ + LEVELNODE *pWall = NULL; + UINT32 uiTileType; + UINT16 usWallOrientation; + + pWall = GetVerticalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + *pusWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + //We want to be able to replace doors with a window, however, the doors do not + //contain the wall type, so we have to search for the nearest wall to extract it. + *pusWallType = SearchForWallType( iMapIndex ); + } + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + *pusIndex = CalcSmartWindowIndex( usWallOrientation ) - 1; + return TRUE; + } + pWall = GetHorizontalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + *pusWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + //We want to be able to replace doors with a window, however, the doors do not + //contain the wall type, so we have to search for the nearest wall to extract it. + *pusWallType = SearchForWallType( iMapIndex ); + } + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + *pusIndex = CalcSmartWindowIndex( usWallOrientation ) - 1; + return TRUE; + } + return FALSE; +} + +BOOLEAN CalcBrokenWallInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallType, UINT16 *pusIndex ) +{ + LEVELNODE *pWall = NULL; + UINT32 uiTileType; + UINT16 usWallOrientation; + + if( gubBrokenWallUIValue == 2 ) //the hole in the wall + { + *pusWallType = 0xffff; + *pusIndex = 0xffff; //but it won't draw it. + return TRUE; + } + + pWall = GetVerticalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + *pusWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + //We want to be able to replace doors with a walltype, however, the doors do not + //contain the wall type, so we have to search for the nearest wall to extract it. + *pusWallType = SearchForWallType( iMapIndex ); + } + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + *pusIndex = CalcSmartBrokenWallIndex( usWallOrientation ) - 1; + return TRUE; + } + pWall = GetHorizontalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + *pusWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + //We want to be able to replace doors with a walltype, however, the doors do not + //contain the wall type, so we have to search for the nearest wall to extract it. + *pusWallType = SearchForWallType( iMapIndex ); + } + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + *pusIndex = CalcSmartBrokenWallIndex( usWallOrientation ) - 1; + return TRUE; + } + return FALSE; +} + + +//This is a very difficult function to document properly. The reason being is that it is sooo +//subliminal by nature. I have thought up of priorities and choose the best piece to draw based +//on the surrounding conditions. Here are the priorities which are referenced below via comments: +//A) If there is currently a bottom piece and a right piece, immediately exit. +//B) We are currently over a bottom piece. Now, we don't automatically want to draw a right piece here +// for multiple reasons. First, the UI will be too quick and place bottom and right pieces for every +// place the user clicks, which isn't what we want. Therefore, we look to see if there is a right +// piece in the y-1 gridno. It would then make sense to place a right piece down here. Regardless, +// if we encounter a bottom piece here, we will exit. +//C) This is the counterpart to B, but we are looking at a current right piece, and are determining if +// we should place a bottom piece based on another bottom piece existing in the x-1 gridno. +//D) Now, we analyse the neighboring tiles and determine the orientations that would add weight to the +// current tile either towards drawing a horizontal piece or a vertical piece. +//E) Now that we have the information, we give the highest priority to any weights that match the current +// wall piece type selected by the user. Based on that, we will only consider the best match of the +// type and use it. If there are no matches on type, we continue. +//F) We failed to find weights matching the current wall type, but before we give up using the user's wall +// type, there are two more cases. When there is a bottom wall in the y+1 position or a right wall in +// the x+1 position. If there are matching walls, there, then we draw two pieces to connect the current +// gridno with the respective position. +void PasteSmartWall( UINT32 iMapIndex ) +{ + static BOOLEAN fWallAlone = FALSE; + static UINT32 iAloneMapIndex = 0x8000; + UINT16 usWallType; + + //These are the counters for the walls of each type + UINT16 usNumV[4]={0,0,0,0}; //vertical wall weights + UINT16 usNumH[4]={0,0,0,0}; //horizontal wall weights + + //*A* See above documentation + if( GetVerticalWall( iMapIndex ) && GetHorizontalWall( iMapIndex ) ) + return; + //*B* See above documentation + usWallType = GetHorizontalWallType( iMapIndex ); + if( usWallType ) + { + if( usWallType == gubWallUIValue ) + { + usWallType = GetVerticalWallType( iMapIndex - WORLD_COLS ); + if( usWallType == gubWallUIValue ) + { + if( FloorAtGridNo( iMapIndex + 1 ) ) + BuildWallPiece( iMapIndex, EXTERIOR_RIGHT, gubWallUIValue ); + else + BuildWallPiece( iMapIndex, INTERIOR_RIGHT, gubWallUIValue ); + return; + } + usWallType = GetHorizontalWallType( iMapIndex - WORLD_COLS ); + if( usWallType == gubWallUIValue ) + { + if( FloorAtGridNo( iMapIndex + 1 ) ) + { + BuildWallPiece( iMapIndex, EXTERIOR_RIGHT, gubWallUIValue ); + if( !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) ) + ChangeVerticalWall( iMapIndex, INTERIOR_EXTENDED ); + } + else + { + BuildWallPiece( iMapIndex, INTERIOR_RIGHT, gubWallUIValue ); + if( !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) ) + ChangeVerticalWall( iMapIndex, EXTERIOR_EXTENDED ); + } + } + } + return; + } + //*C* See above documentation + usWallType = GetVerticalWallType( iMapIndex ); + if( usWallType ) + { + if( usWallType == gubWallUIValue ) + { + usWallType = GetHorizontalWallType( iMapIndex - 1 ); + if( usWallType == gubWallUIValue ) + { + if( FloorAtGridNo( iMapIndex + WORLD_COLS ) ) + BuildWallPiece( iMapIndex, EXTERIOR_BOTTOM, gubWallUIValue ); + else + BuildWallPiece( iMapIndex, INTERIOR_BOTTOM, gubWallUIValue ); + } + } + return; + } + //*D* See above documentation + //Evaluate left adjacent tile + if( usWallType = GetVerticalWallType( iMapIndex - 1 ) ) + usNumH[ usWallType - FIRSTWALL ]++; + if( usWallType = GetHorizontalWallType( iMapIndex - 1 ) ) + usNumH[ usWallType - FIRSTWALL ]++; + //Evaluate right adjacent tile + if( usWallType = GetHorizontalWallType( iMapIndex + 1 ) ) + usNumH[ usWallType - FIRSTWALL ]++; + //Evaluate upper adjacent tile + if( usWallType = GetVerticalWallType( iMapIndex - WORLD_COLS ) ) + usNumV[ usWallType - FIRSTWALL ]++; + if( usWallType = GetHorizontalWallType( iMapIndex - WORLD_COLS ) ) + usNumV[ usWallType - FIRSTWALL ]++; + //Evaluate lower adjacent tile + if( usWallType = GetVerticalWallType( iMapIndex + WORLD_COLS ) ) + usNumV[ usWallType - FIRSTWALL ]++; + //*E* See above documentation + if( usNumV[gubWallUIValue - FIRSTWALL] | usNumH[gubWallUIValue - FIRSTWALL] ) + { + if( usNumV[gubWallUIValue - FIRSTWALL] >= usNumH[gubWallUIValue - FIRSTWALL] ) + { + if( FloorAtGridNo( iMapIndex + 1 ) ) + { //inside + BuildWallPiece( iMapIndex, EXTERIOR_RIGHT, gubWallUIValue ); + //Change to extended piece if it is a new top right corner to cover the end part. + if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) + && !GetVerticalWall( iMapIndex - WORLD_COLS ) ) + ChangeVerticalWall( iMapIndex, INTERIOR_EXTENDED ); + else if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) + && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) ) + { + ChangeVerticalWall( iMapIndex, INTERIOR_EXTENDED ); + EraseHorizontalWall( iMapIndex - WORLD_COLS ); + } + } + else + { //outside + BuildWallPiece( iMapIndex, INTERIOR_RIGHT, gubWallUIValue ); + if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) + && !GetVerticalWall( iMapIndex - WORLD_COLS ) ) + ChangeVerticalWall( iMapIndex, EXTERIOR_EXTENDED ); + else if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) + && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) ) + { + ChangeVerticalWall( iMapIndex, EXTERIOR_EXTENDED ); + EraseHorizontalWall( iMapIndex - WORLD_COLS ); + } + } + } + else + { + if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) + && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) ) + EraseVerticalWall( iMapIndex - 1); + if( FloorAtGridNo( iMapIndex + WORLD_COLS ) ) + { //inside + BuildWallPiece( iMapIndex, EXTERIOR_BOTTOM, gubWallUIValue ); + if( GetVerticalWall( iMapIndex + WORLD_COLS ) ) + ChangeVerticalWall( iMapIndex + WORLD_COLS, INTERIOR_EXTENDED ); + if( GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) && !GetVerticalWall( iMapIndex - 1 ) ) + ChangeVerticalWall( iMapIndex + WORLD_COLS - 1, INTERIOR_EXTENDED ); + else if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) + && FloorAtGridNo( iMapIndex ) ) + ChangeVerticalWall( iMapIndex - 1, INTERIOR_BOTTOMEND ); + } + else + { //outside + BuildWallPiece( iMapIndex, INTERIOR_BOTTOM, gubWallUIValue ); + if( GetVerticalWall( iMapIndex + WORLD_COLS ) ) + ChangeVerticalWall( iMapIndex + WORLD_COLS, EXTERIOR_EXTENDED ); + if( GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) && !GetVerticalWall( iMapIndex - 1 ) ) + ChangeVerticalWall( iMapIndex + WORLD_COLS - 1, EXTERIOR_EXTENDED ); + else if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) + && FloorAtGridNo( iMapIndex ) ) + ChangeVerticalWall( iMapIndex - 1, EXTERIOR_BOTTOMEND ); + } + } + return; + } + //*F* See above documentation + usWallType = GetHorizontalWallType( iMapIndex + WORLD_COLS ); + if( usWallType == gubWallUIValue ) + { + if( !GetHorizontalWall( iMapIndex + WORLD_COLS - 1 ) ) + EraseHorizontalWall( iMapIndex + WORLD_COLS ); + if( FloorAtGridNo( iMapIndex + 1 ) ) + { //inside + BuildWallPiece( iMapIndex + WORLD_COLS, EXTERIOR_RIGHT, gubWallUIValue ); + BuildWallPiece( iMapIndex, EXTERIOR_RIGHT, gubWallUIValue ); + if( !GetVerticalWall( iMapIndex + WORLD_COLS * 2 ) && FloorAtGridNo( iMapIndex + WORLD_COLS * 2 + 1 ) ) + ChangeVerticalWall( iMapIndex + WORLD_COLS, INTERIOR_BOTTOMEND ); + else //override the damn other smoothing. + ChangeVerticalWall( iMapIndex + WORLD_COLS, INTERIOR_R ); + } + else + { //outside + BuildWallPiece( iMapIndex + WORLD_COLS, INTERIOR_RIGHT, gubWallUIValue ); + BuildWallPiece( iMapIndex, INTERIOR_RIGHT, gubWallUIValue ); + if( !GetVerticalWall( iMapIndex + WORLD_COLS * 2 ) && !FloorAtGridNo( iMapIndex + WORLD_COLS * 2 + 1 ) ) + ChangeVerticalWall( iMapIndex + WORLD_COLS, EXTERIOR_BOTTOMEND ); + else //override the damn other smoothing. + ChangeVerticalWall( iMapIndex + WORLD_COLS, EXTERIOR_R ); + } + return; + } + usWallType = GetVerticalWallType( iMapIndex + 1 ); + if( usWallType == gubWallUIValue ) + { + if(FloorAtGridNo( iMapIndex + WORLD_COLS ) ) + { //inside + BuildWallPiece( iMapIndex + 1, EXTERIOR_BOTTOM, gubWallUIValue ); + BuildWallPiece( iMapIndex, EXTERIOR_BOTTOM, gubWallUIValue ); + if( !GetVerticalWall( iMapIndex - WORLD_COLS + 1 ) ) + { + EraseVerticalWall( iMapIndex + 1 ); + ChangeVerticalWall( iMapIndex + WORLD_COLS + 1, INTERIOR_EXTENDED ); + } + if( !GetVerticalWall( iMapIndex + WORLD_COLS + 1) ) + { + if( !GetHorizontalWall( iMapIndex - WORLD_COLS + 1) && !GetVerticalWall( iMapIndex - WORLD_COLS + 1 ) + && GetHorizontalWall( iMapIndex - WORLD_COLS + 2 ) ) + ChangeVerticalWall( iMapIndex + 1, INTERIOR_EXTENDED ); + else + ChangeVerticalWall( iMapIndex + 1, INTERIOR_BOTTOMEND ); + } + } + else + { //outside + BuildWallPiece( iMapIndex + 1, INTERIOR_BOTTOM, gubWallUIValue ); + BuildWallPiece( iMapIndex, INTERIOR_BOTTOM, gubWallUIValue ); + if( !GetVerticalWall( iMapIndex - WORLD_COLS + 1 ) ) + { + EraseVerticalWall( iMapIndex + 1 ); + ChangeVerticalWall( iMapIndex + WORLD_COLS + 1, EXTERIOR_EXTENDED ); + } + if( !GetVerticalWall( iMapIndex + WORLD_COLS + 1) ) + { + if( !GetHorizontalWall( iMapIndex - WORLD_COLS + 1) && !GetVerticalWall( iMapIndex - WORLD_COLS + 1 ) + && GetHorizontalWall( iMapIndex - WORLD_COLS + 2 ) ) + ChangeVerticalWall( iMapIndex + 1, EXTERIOR_EXTENDED ); + else + ChangeVerticalWall( iMapIndex + 1, EXTERIOR_BOTTOMEND ); + } + } + return; + } + //Check for the highest weight value. +} + +void PasteSmartDoor( UINT32 iMapIndex ) +{ + LEVELNODE *pWall = NULL; + UINT16 usTileIndex; + UINT16 usDoorType; + UINT16 usIndex; + UINT16 usWallOrientation; + + if( pWall = GetVerticalWall( iMapIndex ) ) + { + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + usIndex = CalcSmartDoorIndex( usWallOrientation ); + usDoorType = CalcSmartDoorType(); + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( usDoorType, usIndex, &usTileIndex ); + ReplaceStructIndex( iMapIndex, pWall->usIndex, usTileIndex ); + } + if( pWall = GetHorizontalWall( iMapIndex ) ) + { + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + usIndex = CalcSmartDoorIndex( usWallOrientation ); + usDoorType = CalcSmartDoorType(); + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( usDoorType, usIndex, &usTileIndex ); + ReplaceStructIndex( iMapIndex, pWall->usIndex, usTileIndex ); + } +} + +void PasteSmartWindow( UINT32 iMapIndex ) +{ + UINT16 usNewWallIndex; + + LEVELNODE *pWall = NULL; + UINT32 uiTileType; + UINT16 usWallType; + UINT16 usIndex; + UINT16 usWallOrientation; + + pWall = GetVerticalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + usWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + //We want to be able to replace doors with a window, however, the doors do not + //contain the wall type, so we have to search for the nearest wall to extract it. + usWallType = SearchForWallType( iMapIndex ); + } + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + usIndex = CalcSmartWindowIndex( usWallOrientation ); + //Calculate the new graphic for the window type selected. + + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( usWallType, usIndex, &usNewWallIndex ); + ReplaceStructIndex( iMapIndex, pWall->usIndex, usNewWallIndex ); + } + pWall = GetHorizontalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + usWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + //We want to be able to replace doors with a window, however, the doors do not + //contain the wall type, so we have to search for the nearest wall to extract it. + usWallType = SearchForWallType( iMapIndex ); + } + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + usIndex = CalcSmartWindowIndex( usWallOrientation ); + //Calculate the new graphic for the window type selected. + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( usWallType, usIndex, &usNewWallIndex ); + ReplaceStructIndex( iMapIndex, pWall->usIndex, usNewWallIndex ); + } +} + +void PasteSmartBrokenWall( UINT32 iMapIndex ) +{ + UINT16 usNewWallIndex; + + LEVELNODE *pWall; + UINT32 uiTileType; + UINT16 usWallType; + UINT16 usIndex; + UINT16 usWallOrientation; + + pWall = GetVerticalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + usWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + usWallType = SearchForWallType( iMapIndex ); + } + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + usIndex = CalcSmartBrokenWallIndex( usWallOrientation ); + if( usIndex == 0xffff ) + { + AddToUndoList( iMapIndex ); + RemoveStruct( iMapIndex, pWall->usIndex ); + } + else + { + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( usWallType, usIndex, &usNewWallIndex ); + ReplaceStructIndex( iMapIndex, pWall->usIndex, usNewWallIndex ); + } + } + pWall = GetHorizontalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + usWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + //We want to be able to replace doors with a window, however, the doors do not + //contain the wall type, so we have to search for the nearest wall to extract it. + usWallType = SearchForWallType( iMapIndex ); + } + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + usIndex = CalcSmartBrokenWallIndex( usWallOrientation ); + if( usIndex == 0xffff ) + { + AddToUndoList( iMapIndex ); + RemoveStruct( iMapIndex, pWall->usIndex ); + } + else + { + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( usWallType, usIndex, &usNewWallIndex ); + ReplaceStructIndex( iMapIndex, pWall->usIndex, usNewWallIndex ); + } + //Calculate the new graphic for the window type selected. + } +} + +#endif + + + + + + diff --git a/Editor/SmartMethod.h b/Editor/SmartMethod.h new file mode 100644 index 00000000..4317ee0a --- /dev/null +++ b/Editor/SmartMethod.h @@ -0,0 +1,48 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __SMARTMETHOD_H +#define __SMARTMETHOD_H + +void CalcSmartWallDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ); +void CalcSmartDoorDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ); +void CalcSmartWindowDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ); +void CalcSmartBrokenWallDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex ); + +UINT16 CalcSmartWindowIndex( UINT16 usWallOrientation ); +UINT16 CalcSmartDoorIndex( UINT16 usWallOrientation ); +UINT16 CalcSmartBrokenWallIndex( UINT16 usWallOrientation ); +UINT16 CalcSmartDoorType(); + +void IncSmartWallUIValue(); +void DecSmartWallUIValue(); +void IncSmartDoorUIValue(); +void DecSmartDoorUIValue(); +void IncSmartWindowUIValue(); +void DecSmartWindowUIValue(); +void IncSmartBrokenWallUIValue(); +void DecSmartBrokenWallUIValue(); + +BOOLEAN CalcWallInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallType, UINT16 *pusIndex ); +BOOLEAN CalcDoorInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusDoorType, UINT16 *pusIndex ); +BOOLEAN CalcWindowInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallType, UINT16 *pusIndex ); +BOOLEAN CalcBrokenWallInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallType, UINT16 *pusIndex ); + +void PasteSmartWall( UINT32 iMapIndex ); +void PasteSmartDoor( UINT32 iMapIndex ); +void PasteSmartWindow( UINT32 iMapIndex ); +void PasteSmartBrokenWall( UINT32 iMapIndex ); + +extern UINT8 gubDoorUIValue; +extern UINT8 gubWindowUIValue; +extern UINT8 gubWallUIValue; +extern UINT8 gubBrokenWallUIValue; + +#endif +#endif + + + + + + diff --git a/Editor/Smoothing Utils.cpp b/Editor/Smoothing Utils.cpp new file mode 100644 index 00000000..6e3278df --- /dev/null +++ b/Editor/Smoothing Utils.cpp @@ -0,0 +1,469 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include + #include "worlddef.h" //for LEVELNODE def + #include "worldman.h" //for RemoveXXXX() + #include "Isometric Utils.h" //for GridNoOnVisibleWorldTile() + #include "SmartMethod.h" + #include "Smoothing Utils.h" + #include "Editor Undo.h" + #include "EditorDefines.h" + #include "edit_sys.h" + #include "environment.h" +#endif + +extern UINT16 PickAWallPiece( UINT16 usWallPieceType ); + +//This method isn't foolproof, but because erasing large areas of buildings could result in +//multiple wall types for each building. When processing the region, it is necessary to +//calculate the roof type by searching for the nearest roof tile. +UINT16 SearchForWallType( UINT32 iMapIndex ) +{ + UINT32 uiTileType; + LEVELNODE *pWall; + INT16 sOffset; + INT16 x, y, sRadius = 0; + if( gfBasement ) + { + UINT16 usWallType; + usWallType = GetRandomIndexByRange( FIRSTWALL, LASTWALL ); + if( usWallType == 0xffff ) + usWallType = FIRSTWALL; + return usWallType; + } + while( sRadius < 32 ) + { + //NOTE: start at the higher y value and go negative because it is possible to have another + // structure type one tile north, but not one tile south -- so it'll find the correct wall first. + for( y = sRadius; y >= -sRadius; y-- ) for( x = -sRadius; x <= sRadius; x++ ) + { + if( abs(x) == abs(sRadius) || abs(y) == abs(sRadius) ) + { + sOffset = y * WORLD_COLS + x; + if( !GridNoOnVisibleWorldTile( (INT16)(iMapIndex + sOffset) ) ) + { + continue; + } + pWall = gpWorldLevelData[ iMapIndex + sOffset ].pStructHead; + while( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + if( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL ) + { //found a roof, so return its type. + return (UINT16)uiTileType; + } + //if( uiTileType >= FIRSTWINDOW && uiTileType <= LASTWINDOW ) + //{ //Window types can be converted to a wall type. + // return (UINT16)(FIRSTWALL + uiTileType - FIRSTWINDOW ); + //} + pWall = pWall->pNext; + } + } + } + sRadius++; + } + return 0xffff; +} + +//This method isn't foolproof, but because erasing large areas of buildings could result in +//multiple roof types for each building. When processing the region, it is necessary to +//calculate the roof type by searching for the nearest roof tile. +UINT16 SearchForRoofType( UINT32 iMapIndex ) +{ + UINT32 uiTileType; + LEVELNODE *pRoof; + INT16 x, y, sRadius = 0; + INT16 sOffset; + while( sRadius < 32 ) + { + for( y = -sRadius; y <= sRadius; y++ ) for( x = -sRadius; x <= sRadius; x++ ) + { + if( abs(x) == abs(sRadius) || abs(y) == abs(sRadius) ) + { + sOffset = y * WORLD_COLS + x; + if( !GridNoOnVisibleWorldTile( (INT16)(iMapIndex + sOffset) ) ) + { + continue; + } + pRoof = gpWorldLevelData[ iMapIndex + sOffset ].pRoofHead; + while( pRoof ) + { + GetTileType( pRoof->usIndex, &uiTileType ); + if( uiTileType >= FIRSTROOF && uiTileType <= LASTROOF ) + { //found a roof, so return its type. + return (UINT16)uiTileType; + } + pRoof = pRoof->pNext; + } + } + } + sRadius++; + } + return 0xffff; +} + +BOOLEAN RoofAtGridNo( UINT32 iMapIndex ) +{ + LEVELNODE *pRoof; + UINT32 uiTileType; + pRoof = gpWorldLevelData[ iMapIndex ].pRoofHead; + // Look through all objects and Search for type + while( pRoof ) + { + if ( pRoof->usIndex != NO_TILE ) + { + GetTileType( pRoof->usIndex, &uiTileType ); + if ( uiTileType >= FIRSTROOF && uiTileType <= SECONDSLANTROOF ) + return TRUE; + pRoof = pRoof->pNext; + } + } + return FALSE; +} + +BOOLEAN BuildingAtGridNo( UINT32 iMapIndex ) +{ + if( RoofAtGridNo( iMapIndex ) ) + return TRUE; + if( FloorAtGridNo( iMapIndex ) ) + return TRUE; + return FALSE; +} + +BOOLEAN ValidDecalPlacement( UINT32 iMapIndex ) +{ + if( GetVerticalWall( iMapIndex ) || GetHorizontalWall( iMapIndex ) + || GetVerticalFence( iMapIndex ) || GetHorizontalFence( iMapIndex ) ) + return TRUE; + return FALSE; +} + +LEVELNODE* GetVerticalWall( UINT32 iMapIndex ) +{ + LEVELNODE *pStruct; + UINT32 uiTileType; + UINT16 usWallOrientation; + pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; + while( pStruct ) + { + if ( pStruct->usIndex != NO_TILE ) + { + GetTileType( pStruct->usIndex, &uiTileType ); + if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL || + uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + GetWallOrientation( pStruct->usIndex, &usWallOrientation ); + if( usWallOrientation == INSIDE_TOP_RIGHT || usWallOrientation == OUTSIDE_TOP_RIGHT ) + { + return pStruct; + } + } + } + pStruct = pStruct->pNext; + } + return NULL; +} + +LEVELNODE* GetHorizontalWall( UINT32 iMapIndex ) +{ + LEVELNODE *pStruct; + UINT32 uiTileType; + UINT16 usWallOrientation; + pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; + while( pStruct ) + { + if ( pStruct->usIndex != NO_TILE ) + { + GetTileType( pStruct->usIndex, &uiTileType ); + if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL || + uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + GetWallOrientation( pStruct->usIndex, &usWallOrientation ); + if( usWallOrientation == INSIDE_TOP_LEFT || usWallOrientation == OUTSIDE_TOP_LEFT ) + { + return pStruct; + } + } + } + pStruct = pStruct->pNext; + } + return NULL; +} + +UINT16 GetVerticalWallType( UINT32 iMapIndex ) +{ + LEVELNODE *pWall; + UINT32 uiTileType; + pWall = GetVerticalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + uiTileType = SearchForWallType( iMapIndex ); + return (UINT16)uiTileType; + } + return 0; +} + +UINT16 GetHorizontalWallType( UINT32 iMapIndex ) +{ + LEVELNODE *pWall; + UINT32 uiTileType; + pWall = GetHorizontalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + uiTileType = SearchForWallType( iMapIndex ); + return (UINT16)uiTileType; + } + return 0; +} + +LEVELNODE* GetVerticalFence( UINT32 iMapIndex ) +{ + LEVELNODE *pStruct; + UINT32 uiTileType; + UINT16 usWallOrientation; + pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; + while( pStruct ) + { + if ( pStruct->usIndex != NO_TILE ) + { + GetTileType( pStruct->usIndex, &uiTileType ); + if ( uiTileType == FENCESTRUCT ) + { + GetWallOrientation( pStruct->usIndex, &usWallOrientation ); + if( usWallOrientation == INSIDE_TOP_RIGHT || usWallOrientation == OUTSIDE_TOP_RIGHT ) + { + return pStruct; + } + } + } + pStruct = pStruct->pNext; + } + return NULL; +} + +LEVELNODE* GetHorizontalFence( UINT32 iMapIndex ) +{ + LEVELNODE *pStruct; + UINT32 uiTileType; + UINT16 usWallOrientation; + pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; + while( pStruct ) + { + if ( pStruct->usIndex != NO_TILE ) + { + GetTileType( pStruct->usIndex, &uiTileType ); + if ( uiTileType == FENCESTRUCT ) + { + GetWallOrientation( pStruct->usIndex, &usWallOrientation ); + if( usWallOrientation == INSIDE_TOP_LEFT || usWallOrientation == OUTSIDE_TOP_LEFT ) + { + return pStruct; + } + } + } + pStruct = pStruct->pNext; + } + return NULL; +} + +void EraseHorizontalWall( UINT32 iMapIndex ) +{ + LEVELNODE *pWall; + pWall = GetHorizontalWall( iMapIndex ); + if( pWall ) + { + AddToUndoList( iMapIndex ); + RemoveStruct( iMapIndex, pWall->usIndex ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + } +} + +void EraseVerticalWall( UINT32 iMapIndex ) +{ + LEVELNODE *pWall; + pWall = GetVerticalWall( iMapIndex ); + if( pWall ) + { + AddToUndoList( iMapIndex ); + RemoveStruct( iMapIndex, pWall->usIndex ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + } +} + +void ChangeHorizontalWall( UINT32 iMapIndex, UINT16 usNewPiece ) +{ + LEVELNODE *pWall; + UINT32 uiTileType; + UINT16 usTileIndex; + INT16 sIndex; + pWall = GetHorizontalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + if( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL ) + { //Okay, we have the wall, now change it's type. + sIndex = PickAWallPiece( usNewPiece ); + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( uiTileType, sIndex, &usTileIndex ); + ReplaceStructIndex( iMapIndex, pWall->usIndex, usTileIndex ); + } + } +} + +void ChangeVerticalWall( UINT32 iMapIndex, UINT16 usNewPiece ) +{ + LEVELNODE *pWall; + UINT32 uiTileType; + UINT16 usTileIndex; + INT16 sIndex; + pWall = GetVerticalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + if( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL ) + { //Okay, we have the wall, now change it's type. + sIndex = PickAWallPiece( usNewPiece ); + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( uiTileType, sIndex, &usTileIndex ); + ReplaceStructIndex( iMapIndex, pWall->usIndex, usTileIndex ); + } + } +} + +void RestoreWalls( UINT32 iMapIndex ) +{ + LEVELNODE *pWall = NULL; + UINT32 uiTileType; + UINT16 usWallType; + UINT16 usWallOrientation; + UINT8 ubSaveWallUIValue; + BOOLEAN fDone = FALSE; + + pWall = GetHorizontalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + usWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + usWallType = SearchForWallType( iMapIndex ); + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + AddToUndoList( iMapIndex ); + RemoveStruct( iMapIndex, pWall->usIndex ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + switch( usWallOrientation ) + { + case OUTSIDE_TOP_LEFT: + BuildWallPiece( iMapIndex, INTERIOR_BOTTOM, usWallType ); + break; + case INSIDE_TOP_LEFT: + BuildWallPiece( iMapIndex, EXTERIOR_BOTTOM, usWallType ); + break; + } + fDone = TRUE; + } + pWall = GetVerticalWall( iMapIndex ); + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + usWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + usWallType = SearchForWallType( iMapIndex ); + GetWallOrientation( pWall->usIndex, &usWallOrientation ); + AddToUndoList( iMapIndex ); + RemoveStruct( iMapIndex, pWall->usIndex ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + switch( usWallOrientation ) + { + case OUTSIDE_TOP_RIGHT: + BuildWallPiece( iMapIndex, INTERIOR_RIGHT, usWallType ); + break; + case INSIDE_TOP_RIGHT: + BuildWallPiece( iMapIndex, EXTERIOR_RIGHT, usWallType ); + break; + } + fDone = TRUE; + } + if( fDone ) + { + return; + } + //we are in a special case here. The user is attempting to restore a wall, though nothing + //is here. We will hook into the smart wall method by tricking it into using the local wall + //type, but only if we have adjacent walls. + fDone = FALSE; + if( pWall = GetHorizontalWall( iMapIndex - 1 ) ) + fDone = TRUE; + if( !fDone && (pWall = GetHorizontalWall( iMapIndex + 1 )) ) + fDone = TRUE; + if( !fDone && (pWall = GetVerticalWall( iMapIndex - WORLD_COLS )) ) + fDone = TRUE; + if( !fDone && (pWall = GetVerticalWall( iMapIndex + WORLD_COLS )) ) + fDone = TRUE; + if( !fDone ) + return; + //found a wall. Let's back up the current wall value, and restore it after pasting a smart wall. + if( pWall ) + { + GetTileType( pWall->usIndex, &uiTileType ); + usWallType = (UINT16)uiTileType; + if( uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + usWallType = SearchForWallType( iMapIndex ); + if( usWallType != 0xffff ) + { + ubSaveWallUIValue = gubWallUIValue; //save the wall UI value. + gubWallUIValue = (UINT8)usWallType; //trick the UI value + PasteSmartWall( iMapIndex ); //paste smart wall with fake UI value + gubWallUIValue = ubSaveWallUIValue; //restore the real UI value. + } + } +} + +UINT16 GetWallClass( LEVELNODE *pWall ) +{ + UINT16 row, col, rowVariants; + UINT16 usWallIndex; + if( !pWall ) + return 0xffff; + GetSubIndexFromTileIndex( pWall->usIndex, &usWallIndex ); + for ( row = 0; row < NUM_WALL_TYPES; row++ ) + { + rowVariants = gbWallTileLUT[row][0]; + for( col = 1; col <= rowVariants; col++ ) + { + if( usWallIndex == gbWallTileLUT[row][col] ) + { + return row; //row is the wall class + } + } + } + return 0xffff; +} + +UINT16 GetVerticalWallClass( UINT16 iMapIndex ) +{ + LEVELNODE *pWall; + if( pWall = GetVerticalWall( iMapIndex ) ) + return GetWallClass( pWall ); + return 0xffff; +} + +UINT16 GetHorizontalWallClass( UINT16 iMapIndex ) +{ + LEVELNODE *pWall; + if( pWall = GetVerticalWall( iMapIndex ) ) + return GetWallClass( pWall ); + return 0xffff; +} + +#endif \ No newline at end of file diff --git a/Editor/Smoothing Utils.h b/Editor/Smoothing Utils.h new file mode 100644 index 00000000..5040b060 --- /dev/null +++ b/Editor/Smoothing Utils.h @@ -0,0 +1,65 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __SMOOTHING_UTILS_H +#define __SMOOTHING_UTILS_H + +#include "worlddef.h" + +//Use these values when specifically replacing a wall with new type. +enum { //Wall tile types + INTERIOR_L, //interior wall with a top left orientation + INTERIOR_R, //interior wall with a top right orientation + EXTERIOR_L, //exterior wall with a top left orientation + EXTERIOR_R, //exterior wall with a top right orientation + INTERIOR_CORNER, //special interior end piece with top left orientation. + //The rest of these walls are special wall tiles for top right orientations. + INTERIOR_BOTTOMEND, //interior wall for bottom corner + EXTERIOR_BOTTOMEND, //exterior wall for bottom corner + INTERIOR_EXTENDED, //extended interior wall for top corner + EXTERIOR_EXTENDED, //extended exterior wall for top corner + INTERIOR_EXTENDED_BOTTOMEND, //extended interior wall for both top and bottom corners. + EXTERIOR_EXTENDED_BOTTOMEND, //extended exterior wall for both top and bottom corners. + NUM_WALL_TYPES +}; + +//Use these values when passing a ubWallPiece to BuildWallPieces. +enum { + NO_WALLS, + INTERIOR_TOP, + INTERIOR_BOTTOM, + INTERIOR_LEFT, + INTERIOR_RIGHT, + EXTERIOR_TOP, + EXTERIOR_BOTTOM, + EXTERIOR_LEFT, + EXTERIOR_RIGHT, +}; + +//in newsmooth.c +extern INT8 gbWallTileLUT[NUM_WALL_TYPES][7]; +extern void EraseWalls( UINT32 iMapIndex ); +extern void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType ); +//in Smoothing Utils +void RestoreWalls( UINT32 iMapIndex ); +UINT16 SearchForRoofType( UINT32 iMapIndex ); +UINT16 SearchForWallType( UINT32 iMapIndex ); +BOOLEAN RoofAtGridNo( UINT32 iMapIndex ); +BOOLEAN BuildingAtGridNo( UINT32 iMapIndex ); +LEVELNODE* GetHorizontalWall( UINT32 iMapIndex ); +LEVELNODE* GetVerticalWall( UINT32 iMapIndex ); +LEVELNODE* GetVerticalFence( UINT32 iMapIndex ); +LEVELNODE* GetHorizontalFence( UINT32 iMapIndex ); +UINT16 GetHorizontalWallType( UINT32 iMapIndex ); +UINT16 GetVerticalWallType( UINT32 iMapIndex ); +void EraseHorizontalWall( UINT32 iMapIndex ); +void EraseVerticalWall( UINT32 iMapIndex ); +void ChangeHorizontalWall( UINT32 iMapIndex, UINT16 usNewPiece ); +void ChangeVerticalWall( UINT32 iMapIndex, UINT16 usNewPiece ); +UINT16 GetWallClass( LEVELNODE *pWall ); +UINT16 GetVerticalWallClass( UINT16 iMapIndex ); +UINT16 GetHorizontalWallClass( UINT16 iMapIndex ); +BOOLEAN ValidDecalPlacement( UINT32 iMapIndex ); + +#endif +#endif \ No newline at end of file diff --git a/Editor/Summary Info.h b/Editor/Summary Info.h new file mode 100644 index 00000000..fa85744b --- /dev/null +++ b/Editor/Summary Info.h @@ -0,0 +1,109 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __SUMMARY_INFO_H +#define __SUMMARY_INFO_H + +#include "Types.h" + +#define GLOBAL_SUMMARY_VERSION 14 +#define MINIMUMVERSION 7 + +typedef struct TEAMSUMMARY +{ + UINT8 ubTotal; + UINT8 ubDetailed; + UINT8 ubProfile; + UINT8 ubExistance; + UINT8 ubNumAnimals; + UINT8 ubBadA, ubPoorA, ubAvgA, ubGoodA, ubGreatA; //attributes + UINT8 ubBadE, ubPoorE, ubAvgE, ubGoodE, ubGreatE; //equipment +}TEAMSUMMARY; //15 bytes + +typedef struct SUMMARYFILE +{ + //start version 1 + UINT8 ubSummaryVersion; + UINT8 ubSpecial; + UINT16 usNumItems; + UINT16 usNumLights; + MAPCREATE_STRUCT MapInfo; + TEAMSUMMARY EnemyTeam; + TEAMSUMMARY CreatureTeam; + TEAMSUMMARY RebelTeam; + TEAMSUMMARY CivTeam; + UINT8 ubNumDoors; + UINT8 ubNumDoorsLocked; + UINT8 ubNumDoorsTrapped; + UINT8 ubNumDoorsLockedAndTrapped; + //start version 2 + UINT8 ubTilesetID; + UINT8 ubNumRooms; + //start version 3 + UINT8 ubNumElites; + UINT8 ubNumAdmins; + UINT8 ubNumTroops; + //start version 4 + UINT8 ubEliteDetailed; + UINT8 ubAdminDetailed; + UINT8 ubTroopDetailed; + //start version 5 + UINT8 ubEliteProfile; + UINT8 ubAdminProfile; + UINT8 ubTroopProfile; + //start version 6 + UINT8 ubEliteExistance; + UINT8 ubAdminExistance; + UINT8 ubTroopExistance; + //start version 7 + FLOAT dMajorMapVersion; + //start version 8 + UINT8 ubCivSchedules; + //start version 9 + UINT8 ubCivCows; + UINT8 ubCivBloodcats; + // //----- + // 190 + //start version 10 + EXITGRID ExitGrid[4]; //5*4 // 20 + UINT16 usExitGridSize[4]; //2*4 // 8 + BOOLEAN fInvalidDest[4]; // 4 + UINT8 ubNumExitGridDests; // 1 + BOOLEAN fTooManyExitGridDests; // 1 + // //----- + // // 224 + //start version 11 + UINT8 ubEnemiesReqWaypoints; // 1 + // //----- + // 225 + //start version 12 + UINT16 usWarningRoomNums; // 2 + // 227 + //start version 13 + UINT8 ubEnemiesHaveWaypoints; // 1 + UINT32 uiNumItemsPosition; // 4 + //----- + // 232 + //start version 14 + UINT32 uiEnemyPlacementPosition; // 4 + //----- + // 236 + + + UINT8 ubPadding[164]; // 164 + // //----- + // 400 total bytes +}SUMMARYFILE; + +extern BOOLEAN gfAutoLoadA9; + +extern BOOLEAN EvaluateWorld( UINT8 * pSector, UINT8 ubLevel ); + +extern void WriteSectorSummaryUpdate( UINT8 *puiFilename, UINT8 ubLevel, SUMMARYFILE *pSummaryFileInfo ); + +extern BOOLEAN gfMustForceUpdateAllMaps; +extern BOOLEAN gfMajorUpdate; +void ApologizeOverrideAndForceUpdateEverything(); + +#endif +#endif diff --git a/Editor/edit_sys.cpp b/Editor/edit_sys.cpp new file mode 100644 index 00000000..f150beec --- /dev/null +++ b/Editor/edit_sys.cpp @@ -0,0 +1,1446 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "worlddef.h" + #include "worldman.h" + #include "smooth.h" + #include "newsmooth.h" + #include "edit_sys.h" + #include "editscreen.h" + #include "selectwin.h" + #include "EditorTerrain.h" + #include "EditorBuildings.h" + #include "EditorMercs.h" + #include "EditorDefines.h" + #include "Smoothing Utils.h" + #include "Cursor Modes.h" + #include "Render Fun.h" + #include "Isometric Utils.h" + #include "Editor Undo.h" + #include "Exit Grids.h" + #include "environment.h" + #include "Simple Render Utils.h" + #include "Road Smoothing.h" +#endif + +BOOLEAN PasteHigherTextureFromRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ubRadius ); +BOOLEAN PasteExistingTexture( UINT32 iMapIndex, UINT16 usIndex ); +BOOLEAN PasteExistingTextureFromRadius( INT32 iMapIndex, UINT16 usIndex, UINT8 ubRadius ); +BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ubRadius, BOOLEAN fReplace ); + +void PasteTextureEx( INT16 sGridNo, UINT16 usType ); +void PasteTextureFromRadiusEx( INT16 sGridNo, UINT16 usType, UINT8 ubRadius ); + + +BOOLEAN gfWarning = FALSE; + +BOOLEAN gfDoFill = FALSE; +UINT16 CurrentPaste = NO_TILE; +UINT16 gDebrisPaste = NO_TILE; +UINT16 gChangeElevation = FALSE; +UINT16 CurrentStruct = NO_TILE; +UINT32 gDoBanks = NO_BANKS; +UINT32 gDoCliffs = NO_CLIFFS; + + + +//--------------------------------------------------------------------------------------------------------------- +// QuickEraseMapTile +// +// Performs ersing operation when the DEL key is hit in the editor +// +void QuickEraseMapTile( UINT32 iMapIndex ) +{ + if ( iMapIndex >= 0x8000 ) + return; + AddToUndoList( iMapIndex ); + DeleteStuffFromMapTile( iMapIndex ); + MarkWorldDirty(); +} + + +//--------------------------------------------------------------------------------------------------------------- +// DeleteStuffFromMapTile +// +// Common delete function for both QuickEraseMapTile and EraseMapTile +// +void DeleteStuffFromMapTile( UINT32 iMapIndex ) +{ + //UINT16 usUseIndex; + //UINT16 usType; + //UINT32 uiCheckType; + //UINT16 usDummy; + + //GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &uiCheckType ); + //RemoveLand( iMapIndex, gpWorldLevelData[ iMapIndex ].pLandHead->usIndex ); + //SmoothTerrainRadius( iMapIndex, uiCheckType, 1, TRUE ); + + RemoveExitGridFromWorld( iMapIndex ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTTEXTURE, WIREFRAMES ); + RemoveAllObjectsOfTypeRange( iMapIndex, FIRSTTEXTURE, WIREFRAMES ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTTEXTURE, WIREFRAMES ); + RemoveAllLandsOfTypeRange( iMapIndex, FIRSTTEXTURE, WIREFRAMES ); + RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, WIREFRAMES ); + RemoveAllOnRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, WIREFRAMES ); + RemoveAllTopmostsOfTypeRange( iMapIndex, FIRSTTEXTURE, WIREFRAMES ); + PasteRoomNumber( iMapIndex, 0 ); +} + + +//--------------------------------------------------------------------------------------------------------------- +// EraseMapTile +// +// Generic tile erasing function. Erases things from the world depending on the current drawing mode +// +void EraseMapTile( UINT32 iMapIndex ) +{ + INT32 iEraseMode; + UINT32 uiCheckType; + if ( iMapIndex >= 0x8000 ) + return; + + // Figure out what it is we are trying to erase + iEraseMode = iDrawMode - DRAW_MODE_ERASE; + + switch ( iEraseMode ) + { + case DRAW_MODE_NORTHPOINT: + case DRAW_MODE_WESTPOINT: + case DRAW_MODE_EASTPOINT: + case DRAW_MODE_SOUTHPOINT: + case DRAW_MODE_CENTERPOINT: + case DRAW_MODE_ISOLATEDPOINT: + SpecifyEntryPoint( iMapIndex ); + break; + case DRAW_MODE_EXITGRID: + AddToUndoList( iMapIndex ); + RemoveExitGridFromWorld( iMapIndex ); + RemoveTopmost( (UINT16)iMapIndex, FIRSTPOINTERS8 ); + break; + case DRAW_MODE_GROUND: + // Is there ground on this tile? if not, get out o here + if ( gpWorldLevelData[ iMapIndex ].pLandHead == NULL ) + break; + + // is there only 1 ground tile here? if so, get out o here + if ( gpWorldLevelData[ iMapIndex ].pLandHead->pNext == NULL ) + break; + AddToUndoList( iMapIndex ); + GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &uiCheckType ); + RemoveLand( iMapIndex, gpWorldLevelData[ iMapIndex ].pLandHead->usIndex ); + SmoothTerrainRadius( iMapIndex, uiCheckType, 1, TRUE ); + break; + case DRAW_MODE_OSTRUCTS: + case DRAW_MODE_OSTRUCTS1: + case DRAW_MODE_OSTRUCTS2: + AddToUndoList( iMapIndex ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTOSTRUCT, LASTOSTRUCT ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTVEHICLE, SECONDVEHICLE ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTDEBRISSTRUCT, SECONDDEBRISSTRUCT ); + RemoveAllStructsOfTypeRange( iMapIndex, NINTHOSTRUCT, TENTHOSTRUCT ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTLARGEEXPDEBRIS, SECONDLARGEEXPDEBRIS ); + RemoveAllObjectsOfTypeRange( iMapIndex, DEBRIS2MISC, DEBRIS2MISC ); + RemoveAllObjectsOfTypeRange( iMapIndex, ANOTHERDEBRIS, ANOTHERDEBRIS ); + break; + case DRAW_MODE_DEBRIS: + AddToUndoList( iMapIndex ); + RemoveAllObjectsOfTypeRange( iMapIndex, DEBRISROCKS, LASTDEBRIS ); + RemoveAllObjectsOfTypeRange( iMapIndex, DEBRIS2MISC, DEBRIS2MISC ); + RemoveAllObjectsOfTypeRange( iMapIndex, ANOTHERDEBRIS, ANOTHERDEBRIS ); + break; + case DRAW_MODE_BANKS: + AddToUndoList( iMapIndex ); + RemoveAllObjectsOfTypeRange( iMapIndex, FIRSTROAD, LASTROAD ); + // Note, for this routine, cliffs are considered a subset of banks + RemoveAllStructsOfTypeRange( iMapIndex, ANIOSTRUCT, ANIOSTRUCT ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTCLIFF, LASTBANKS ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTCLIFFSHADOW, LASTCLIFFSHADOW ); + RemoveAllObjectsOfTypeRange( iMapIndex, FIRSTCLIFFHANG, LASTCLIFFHANG ); + RemoveAllStructsOfTypeRange( iMapIndex, FENCESTRUCT, FENCESTRUCT ); + RemoveAllShadowsOfTypeRange( iMapIndex, FENCESHADOW, FENCESHADOW ); + break; + case DRAW_MODE_FLOORS: + AddToUndoList( iMapIndex ); + RemoveAllLandsOfTypeRange( iMapIndex, FIRSTFLOOR, LASTFLOOR ); + break; + case DRAW_MODE_ROOFS: + case DRAW_MODE_NEWROOF: + AddToUndoList( iMapIndex ); + RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); + RemoveAllOnRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); + break; + case DRAW_MODE_WALLS: + case DRAW_MODE_DOORS: + case DRAW_MODE_WINDOWS: + case DRAW_MODE_BROKEN_WALLS: + AddToUndoList( iMapIndex ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTDOOR, LASTDOOR ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTDOORSHADOW, LASTDOORSHADOW ); + break; + case DRAW_MODE_DECOR: + case DRAW_MODE_DECALS: + case DRAW_MODE_ROOM: + case DRAW_MODE_TOILET: + AddToUndoList( iMapIndex ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALLDECAL, LASTWALLDECAL ); + RemoveAllStructsOfTypeRange( iMapIndex, FIFTHWALLDECAL, EIGTHWALLDECAL ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTDECORATIONS, LASTDECORATIONS ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTISTRUCT, LASTISTRUCT ); + RemoveAllStructsOfTypeRange( iMapIndex, FIFTHISTRUCT, EIGHTISTRUCT ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTSWITCHES, FIRSTSWITCHES ); + break; + case DRAW_MODE_CAVES: + AddToUndoList( iMapIndex ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + break; + case DRAW_MODE_ROOMNUM: + PasteRoomNumber( iMapIndex, 0 ); + break; + case DRAW_MODE_ROADS: + RemoveAllObjectsOfTypeRange( iMapIndex, ROADPIECES, ROADPIECES ); + break; + default: + //DeleteStuffFromMapTile( iMapIndex ); + break; + } +} + + +//--------------------------------------------------------------------------------------------------------------- +// PasteDebris +// +// Place some "debris" on the map at the current mouse coordinates. This function is called repeatedly if +// the current brush size is larger than 1 tile. +// +void PasteDebris( UINT32 iMapIndex ) +{ + UINT16 usUseIndex; + UINT16 usUseObjIndex; + INT32 iRandSelIndex; + + // Get selection list for debris + pSelList = SelDebris; + pNumSelList = &iNumDebrisSelected; + + if ( iMapIndex < 0x8000 ) + { + AddToUndoList( iMapIndex ); + + // Remove any debris that is currently at this map location + if ( gpWorldLevelData[ iMapIndex ].pObjectHead != NULL ) + { + RemoveAllObjectsOfTypeRange( iMapIndex, ANOTHERDEBRIS, FIRSTPOINTERS - 1 ); + } + + // Get a random debris from current selection + iRandSelIndex = GetRandomSelection( ); + if ( iRandSelIndex != -1 ) + { + // Add debris to the world + usUseIndex = pSelList[ iRandSelIndex ].usIndex; + usUseObjIndex = (UINT16)pSelList[ iRandSelIndex ].uiObject; + + AddObjectToTail( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); + } + } +} + + +void PasteSingleWall( UINT32 iMapIndex ) +{ + pSelList = SelSingleWall; + pNumSelList = &iNumWallsSelected; + PasteSingleWallCommon( iMapIndex ); +} + +void PasteSingleDoor( UINT32 iMapIndex ) +{ + pSelList = SelSingleDoor; + pNumSelList = &iNumDoorsSelected; + PasteSingleWallCommon( iMapIndex ); +} + +void PasteSingleWindow( UINT32 iMapIndex ) +{ + pSelList = SelSingleWindow; + pNumSelList = &iNumWindowsSelected; + PasteSingleWallCommon( iMapIndex ); +} + +void PasteSingleRoof( UINT32 iMapIndex ) +{ + pSelList = SelSingleRoof; + pNumSelList = &iNumRoofsSelected; + PasteSingleWallCommon( iMapIndex ); +} + +void PasteRoomNumber( UINT32 iMapIndex, UINT8 ubRoomNumber ) +{ + if( gubWorldRoomInfo[ iMapIndex ] != ubRoomNumber ) + { + AddToUndoList( iMapIndex ); + gubWorldRoomInfo[ iMapIndex ] = ubRoomNumber; + } +} + +void PasteSingleBrokenWall( UINT32 iMapIndex ) +{ + UINT16 usIndex, usObjIndex, usTileIndex, usWallOrientation; + + pSelList = SelSingleBrokenWall; + pNumSelList = &iNumBrokenWallsSelected; + + usIndex = pSelList[ iCurBank ].usIndex; + usObjIndex = (UINT16)pSelList[ iCurBank ].uiObject; + usTileIndex = GetTileIndexFromTypeSubIndex( usObjIndex, usIndex, &usTileIndex ); + GetWallOrientation( usTileIndex, &usWallOrientation ); + if( usWallOrientation == INSIDE_TOP_LEFT || usWallOrientation == INSIDE_TOP_RIGHT ) + EraseHorizontalWall( iMapIndex ); + else + EraseVerticalWall( iMapIndex ); + + PasteSingleWallCommon( iMapIndex ); +} + +void PasteSingleDecoration( UINT32 iMapIndex ) +{ + pSelList = SelSingleDecor; + pNumSelList = &iNumDecorSelected; + PasteSingleWallCommon( iMapIndex ); +} + +void PasteSingleDecal( UINT32 iMapIndex ) +{ + pSelList = SelSingleDecal; + pNumSelList = &iNumDecalsSelected; + PasteSingleWallCommon( iMapIndex ); +} + +void PasteSingleFloor( UINT32 iMapIndex ) +{ + pSelList = SelSingleFloor; + pNumSelList = &iNumFloorsSelected; + PasteSingleWallCommon( iMapIndex ); +} + +void PasteSingleToilet( UINT32 iMapIndex ) +{ + pSelList = SelSingleToilet; + pNumSelList = &iNumToiletsSelected; + PasteSingleWallCommon( iMapIndex ); +} + +//--------------------------------------------------------------------------------------------------------------- +// PasteSingleWallCommon +// +// Common paste routine for PasteSingleWall, PasteSingleDoor, PasteSingleDecoration, and +// PasteSingleDecor (above). +// +void PasteSingleWallCommon( UINT32 iMapIndex ) +{ + UINT16 usUseIndex; + UINT16 usUseObjIndex; + UINT16 usTempIndex; + + if ( iMapIndex < 0x8000 ) + { + AddToUndoList( iMapIndex ); + + usUseIndex = pSelList[ iCurBank ].usIndex; + usUseObjIndex = (UINT16)pSelList[ iCurBank ].uiObject; + + // TEMP STUFF FOR ONROOF THINGS! + if ( (usUseObjIndex >= FIRSTONROOF) && (usUseObjIndex <= SECONDONROOF ) ) + { + // Add to onroof section! + AddOnRoofToTail( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); + + if ( gTileDatabase[ (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ].sBuddyNum != -1 ) + { + AddOnRoofToTail( iMapIndex, gTileDatabase[ (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ].sBuddyNum ); + } + return; + } + + // Make sure A-frames are on roof level! + if ( ( usUseIndex >= WALL_AFRAME_START && usUseIndex <= WALL_AFRAME_END ) ) + { + AddRoofToTail( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); + return; + } + + if ( (usUseObjIndex >= FIRSTDOOR) && (usUseObjIndex <= LASTDOOR) ) + { + // PLace shadow for doors + if( !gfBasement ) + AddExclusiveShadow( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex - FIRSTDOOR + FIRSTDOORSHADOW ] + usUseIndex ) ); + } + + // Is it a wall? + if ( ((usUseObjIndex >= FIRSTWALL) && (usUseObjIndex <= LASTWALL)) ) + { + // ATE If it is a wall shadow, place differenty! + if ( usUseIndex == 29 || usUseIndex == 30 ) + { + if( !gfBasement ) + AddExclusiveShadow( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); + } + else + { + // Slap down wall/window/door/decoration (no smoothing) + AddWallToStructLayer( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex), TRUE ); + } + } + // Is it a door/window/decoration? + else if ( ( (usUseObjIndex >= FIRSTDOOR) && (usUseObjIndex <= LASTDOOR)) || + ((usUseObjIndex >= FIRSTDECORATIONS) && (usUseObjIndex <= LASTDECORATIONS)) ) + { + // Slap down wall/window/door/decoration (no smoothing) + AddWallToStructLayer( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex), TRUE ); + } + else if ( ((usUseObjIndex >= FIRSTROOF) && (usUseObjIndex <= LASTROOF)) || + ((usUseObjIndex >= FIRSTSLANTROOF) && (usUseObjIndex <= LASTSLANTROOF)) ) + { + // Put a roof on this tile (even if nothing else is here) + RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTROOF, LASTROOF ); + AddRoofToTail( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); + } + else if ( (usUseObjIndex >= FIRSTFLOOR) && (usUseObjIndex <= LASTFLOOR) ) + { + // Drop a floor on this tile + if ( TypeExistsInLandLayer( iMapIndex, usUseObjIndex, &usTempIndex ) ) + RemoveLand( iMapIndex, usTempIndex ); + + AddLandToHead( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); + } + else if( usUseObjIndex >= FIRSTWALLDECAL && usUseObjIndex <= LASTWALLDECAL || + usUseObjIndex >= FIFTHWALLDECAL && usUseObjIndex <= EIGTHWALLDECAL ) + { + // Plop a decal here + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALLDECAL, LASTWALLDECAL ); + RemoveAllStructsOfTypeRange( iMapIndex, FIFTHWALLDECAL, EIGTHWALLDECAL ); + + AddStructToTail( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) ); + } + else if ( usUseObjIndex >= FIRSTISTRUCT && usUseObjIndex <= LASTISTRUCT || + usUseObjIndex >= FIFTHISTRUCT && usUseObjIndex <= EIGHTISTRUCT ) + { + AddStructToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) ); + } + else if( usUseObjIndex == FIRSTSWITCHES ) + { + AddStructToTail( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) ); + } + + } +} + + +//--------------------------------------------------------------------------------------------------------------- +// GetRandomIndexByRange +// +// Returns a randomly picked object index given the current selection list, and the type or types of objects we want +// from that list. If no such objects are in the list, we return 0xffff (-1). +UINT16 GetRandomIndexByRange( UINT16 usRangeStart, UINT16 usRangeEnd ) +{ + UINT16 usPickList[50]; + UINT16 usNumInPickList; + UINT16 usWhich; + UINT16 usObject; + // Get a list of valid object to select from + usNumInPickList = 0; + for ( usWhich = 0; usWhich < *pNumSelList; usWhich++ ) + { + usObject = (UINT16)pSelList[ usWhich ].uiObject; + if ( (usObject >= usRangeStart) && (usObject <= usRangeEnd) ) + { + usPickList[ usNumInPickList ] = usObject; + usNumInPickList++; + } + } + return ( usNumInPickList ) ? usPickList[ rand() % usNumInPickList ] : 0xffff; +} + +UINT16 GetRandomTypeByRange( UINT16 usRangeStart, UINT16 usRangeEnd ) +{ + UINT16 usPickList[50]; + UINT16 usNumInPickList; + UINT16 i; + UINT16 usObject; + UINT32 uiType; + // Get a list of valid object to select from + usNumInPickList = 0; + for ( i = 0; i < *pNumSelList; i++ ) + { + usObject = (UINT16)pSelList[ i ].uiObject; + if ( (usObject >= usRangeStart) && (usObject <= usRangeEnd) ) + { + GetTileType( usObject, &uiType ); + usPickList[ usNumInPickList ] = (UINT16)uiType; + usNumInPickList++; + } + } + return ( usNumInPickList ) ? usPickList[ rand() % usNumInPickList ] : 0xffff; +} + + +//--------------------------------------------------------------------------------------------------------------- +// PasteStructure (See also PasteStructure1, PasteStructure2, and PasteStructureCommon) +// +// Puts a structure (trees, trucks, etc.) into the world +// +void PasteStructure( UINT32 iMapIndex ) +{ + pSelList = SelOStructs; + pNumSelList = &iNumOStructsSelected; + + PasteStructureCommon( iMapIndex ); +} + +//--------------------------------------------------------------------------------------------------------------- +// PasteStructure1 (See also PasteStructure, PasteStructure2, and PasteStructureCommon) +// +// Puts a structure (trees, trucks, etc.) into the world +// +void PasteStructure1( UINT32 iMapIndex ) +{ + pSelList = SelOStructs1; + pNumSelList = &iNumOStructs1Selected; + + PasteStructureCommon( iMapIndex ); +} + +//--------------------------------------------------------------------------------------------------------------- +// PasteStructure2 (See also PasteStructure, PasteStructure1, and PasteStructureCommon) +// +// Puts a structure (trees, trucks, etc.) into the world +// +void PasteStructure2( UINT32 iMapIndex ) +{ + pSelList = SelOStructs2; + pNumSelList = &iNumOStructs2Selected; + + PasteStructureCommon( iMapIndex ); +} + + +//--------------------------------------------------------------------------------------------------------------- +// PasteStructureCommon +// +// This is the main (common) structure pasting function. The above three wrappers are only required because they +// each use different selection lists. Other than that, they are COMPLETELY identical. +// +void PasteStructureCommon( UINT32 iMapIndex ) +{ + BOOLEAN fDoPaste = FALSE; + UINT32 fHeadType; + UINT16 usUseIndex; + UINT16 usUseObjIndex; + INT32 iRandSelIndex; + BOOLEAN fOkayToAdd; + + if ( iMapIndex < 0x8000 ) + { + /* + if ( gpWorldLevelData[ iMapIndex ].pStructHead != NULL ) + { + fDoPaste = FALSE; + } + else + { + // Nothing is here, paste + fDoPaste = TRUE; + } +*/ + if ( /*fDoPaste &&*/ iMapIndex < 0x8000 ) + { + iRandSelIndex = GetRandomSelection( ); + if ( iRandSelIndex == -1 ) + { + return; + } + + AddToUndoList( iMapIndex ); + + usUseIndex = pSelList[ iRandSelIndex ].usIndex; + usUseObjIndex = (UINT16)pSelList[ iRandSelIndex ].uiObject; + + // Check with Structure Database (aka ODB) if we can put the object here! + fOkayToAdd = OkayToAddStructureToWorld( (INT16)iMapIndex, 0, gTileDatabase[ (gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ].pDBStructureRef, INVALID_STRUCTURE_ID ); + if ( fOkayToAdd || (gTileDatabase[ (gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ].pDBStructureRef == NULL) ) + { + // Actual structure info is added by the functions below + AddStructToHead( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); + // For now, adjust to shadows by a hard-coded amount, + + // Add mask if in long grass + GetLandHeadType( iMapIndex, &fHeadType ); + } + } + } + else if ( CurrentStruct == ERASE_TILE && iMapIndex < 0x8000 ) + { + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTOSTRUCT, LASTOSTRUCT ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTSHADOW, LASTSHADOW ); + } +} + + +//--------------------------------------------------------------------------------------------------------------- +// PasteBanks +// +// Places a river bank or cliff into the world +// +void PasteBanks( UINT32 iMapIndex, UINT16 usStructIndex , BOOLEAN fReplace) +{ + BOOLEAN fDoPaste = FALSE; + UINT16 usUseIndex; + UINT16 usUseObjIndex; + UINT16 usIndex; + + pSelList = SelBanks; + pNumSelList = &iNumBanksSelected; + + usUseIndex = pSelList[ iCurBank ].usIndex; + usUseObjIndex = (UINT16)pSelList[ iCurBank ].uiObject; + + if ( iMapIndex < 0x8000 ) + { + fDoPaste = TRUE; + + if ( gpWorldLevelData[ iMapIndex ].pStructHead != NULL ) + { + // CHECK IF THE SAME TILE IS HERE + if ( gpWorldLevelData[ iMapIndex ].pStructHead->usIndex == (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) ) + { + fDoPaste = FALSE; + } + } + else + { + // Nothing is here, paste + fDoPaste = TRUE; + } + + if ( fDoPaste ) + { + + usIndex = gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex; + + AddToUndoList( iMapIndex ); + + { + if ( usUseObjIndex == FIRSTROAD ) + { + AddObjectToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) ); + } + else + { + AddStructToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) ); + // Add shadows + if ( !gfBasement && usUseObjIndex == FIRSTCLIFF ) + { + //AddShadowToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex - FIRSTCLIFF + FIRSTCLIFFSHADOW ] + usUseIndex ) ); + AddObjectToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex - FIRSTCLIFF + FIRSTCLIFFHANG ] + usUseIndex ) ); + } + } + } + } + } +} + +void PasteRoads( UINT32 iMapIndex ) +{ + UINT16 usUseIndex; + + pSelList = SelRoads; + pNumSelList = &iNumRoadsSelected; + + usUseIndex = pSelList[ iCurBank ].usIndex; + + PlaceRoadMacroAtGridNo( iMapIndex, usUseIndex ); +} + +//--------------------------------------------------------------------------------------------------------------- +// PasteTexture +// +// Puts a ground texture in the world. Ground textures are then "smoothed" in order to blend the edges with one +// another. The current drawing brush also affects this function. +// +void PasteTexture( UINT32 iMapIndex ) +{ + ChooseWeightedTerrainTile(); //Kris + PasteTextureCommon( iMapIndex ); +} + +//--------------------------------------------------------------------------------------------------------------- +// PasteTextureCommon +// +// The PasteTexture function calls this one to actually put a ground tile down. If the brush size is larger than +// one tile, then the above function will call this one and indicate that they should all be placed into the undo +// stack as the same undo command. +// +void PasteTextureCommon( UINT32 iMapIndex ) +{ + UINT8 ubLastHighLevel; + UINT16 usTileIndex; + //UINT16 Dummy; + + if ( CurrentPaste != NO_TILE && iMapIndex < 0x8000 ) + { + + // Set undo, then set new + AddToUndoList( iMapIndex ); + + if ( CurrentPaste == DEEPWATERTEXTURE ) + { + // IF WE ARE PASTING DEEP WATER AND WE ARE NOT OVER WATER, IGNORE! + if ( TypeExistsInLandLayer( iMapIndex, REGWATERTEXTURE, &usTileIndex ) ) + { + if ( !gTileDatabase[ usTileIndex ].ubFullTile ) + { + return; + } + } + else + { + return; + } + } + + // Don't draw over floors + if ( TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, FOURTHFLOOR, &usTileIndex ) ) + { + return; + } + + + + // Compare heights and do appropriate action + if ( AnyHeigherLand( iMapIndex, CurrentPaste, &ubLastHighLevel ) ) + { + // Here we do the following: + // - Remove old type from layer + // - Smooth World with old type + // - Add a 3 by 3 square of new type at head + // - Smooth World with new type + PasteHigherTexture( iMapIndex, CurrentPaste ); + + } + else + { + PasteTextureEx( (INT16)iMapIndex, CurrentPaste ); + SmoothTerrainRadius( iMapIndex, CurrentPaste, 1, TRUE ); + } + } +} + + +//--------------------------------------------------------------------------------------------------------------- +// PasteHigherTexture +// +// Some ground textures should be placed "above" others. That is, grass needs to be placed "above" sand etc. +// This function performs the appropriate actions. +// +void PasteHigherTexture( UINT32 iMapIndex, UINT32 fNewType ) +{ + UINT16 NewTile; + UINT8 ubLastHighLevel; + UINT32 *puiDeletedTypes = NULL; + UINT8 ubNumTypes; + UINT8 cnt; + + // Here we do the following: + // - Remove old type from layer + // - Smooth World with old type + // - Add a 3 by 3 square of new type at head + // - Smooth World with new type + + //if ( iMapIndex < 0x8000 && TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, LASTFLOOR, &NewTile ) ) + //ATE: DONOT DO THIS!!!!!!! - I know what was intended - not to draw over floors - this + // I don't know is the right way to do it! + //return; + + + if ( iMapIndex < 0x8000 && AnyHeigherLand( iMapIndex, fNewType, &ubLastHighLevel )) + { + AddToUndoList( iMapIndex ); + + // - For all heigher level, remove + RemoveHigherLandLevels( iMapIndex, fNewType, &puiDeletedTypes, &ubNumTypes ); + + // Set with a radius of 1 and smooth according to height difference + SetLowerLandIndexWithRadius( iMapIndex, fNewType, 1 , TRUE ); + + // Smooth all deleted levels + for ( cnt = 0; cnt < ubNumTypes; cnt++ ) + { + SmoothTerrainRadius( iMapIndex, puiDeletedTypes[ cnt ], 1, TRUE ); + } + + MemFree( puiDeletedTypes ); + + } + else if ( iMapIndex < 0x8000 ) + { + AddToUndoList( iMapIndex ); + + GetTileIndexFromTypeSubIndex( fNewType, REQUIRES_SMOOTHING_TILE, &NewTile ); + SetLandIndex( iMapIndex, NewTile, fNewType, FALSE ); + + // Smooth item then adding here + SmoothTerrain( iMapIndex, fNewType, &NewTile, FALSE ); + + if ( NewTile != NO_TILE ) + { + // Change tile + SetLandIndex( iMapIndex, NewTile, fNewType, FALSE ); + } + } +} + + +//--------------------------------------------------------------------------------------------------------------- +// PasteHigherTextureFromRadius +// +// Like above function except it performs it's operation on a redial area. +// +BOOLEAN PasteHigherTextureFromRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ubRadius ) +{ + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; + INT32 iNewIndex; + INT32 iXPos,iYPos; + + // Determine start and end indicies and num rows + sTop = ubRadius; + sBottom = -ubRadius; + sLeft = -ubRadius; + sRight = ubRadius; + + iXPos = (iMapIndex % WORLD_COLS); + iYPos = (iMapIndex - iXPos) / WORLD_COLS; + + if ( (iXPos + (INT32)sLeft) < 0 ) + sLeft = (INT16)(-iXPos); + + if ( (iXPos + (INT32)sRight) >= WORLD_COLS ) + sRight = (INT16)(WORLD_COLS - iXPos - 1); + + if ( (iYPos + (INT32)sTop) >= WORLD_ROWS ) + sTop = (INT16)(WORLD_ROWS - iYPos - 1); + + if ( (iYPos + (INT32)sBottom) < 0 ) + sBottom = (INT16)(-iYPos); + + if ( iMapIndex >= 0x8000 ) + return (FALSE); + + for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) + { + for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) + { + iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2; + + PasteHigherTexture( iNewIndex, uiNewType ); + } + } + + return( TRUE ); +} + + +//--------------------------------------------------------------------------------------------------------------- +// PasteExistingTexture +// +BOOLEAN PasteExistingTexture( UINT32 iMapIndex, UINT16 usIndex ) +{ + UINT32 uiNewType; + UINT16 usNewIndex; + //UINT16 Dummy; + + // If here, we want to make, esentially, what is a type in + // a level other than TOP-MOST the TOP-MOST level. + // We should: + // - remove what was top-most + // - re-adjust the world to reflect missing top-most peice + + if ( iMapIndex >= 0x8000 ) + return ( FALSE ); + + //if ( TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, LASTFLOOR, &Dummy ) ) + // return( FALSE ); + + // Get top tile index + // Remove all land peices except + GetTileType( usIndex, &uiNewType ); + + DeleteAllLandLayers( iMapIndex ); + + // ADD BASE LAND AT LEAST! + usNewIndex = (UINT16)(rand( ) % 10 ); + + // Adjust for type + usNewIndex += gTileTypeStartIndex[ gCurrentBackground ]; + + // Set land index + AddLandToHead( iMapIndex, usNewIndex ); + + SetLandIndex( iMapIndex, usIndex, uiNewType, FALSE ); + + // ATE: Set this land peice to require smoothing again! + SmoothAllTerrainTypeRadius( iMapIndex, 2, TRUE ); + + return( TRUE ); +} + + +//--------------------------------------------------------------------------------------------------------------- +// PasteExistingTextureFromRadius +// +// As above, but on a radial area +// +BOOLEAN PasteExistingTextureFromRadius( INT32 iMapIndex, UINT16 usIndex, UINT8 ubRadius ) +{ + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; + INT32 iNewIndex; + INT32 leftmost; + + // Determine start end end indicies and num rows + sTop = ubRadius; + sBottom = -ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; + + if ( iMapIndex >= 0x8000 ) + return ( FALSE ); + + for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) + { + + leftmost = ( ( iMapIndex + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS; + + for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) + { + iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2; + + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + { + AddToUndoList( iMapIndex ); + PasteExistingTexture( iNewIndex, usIndex ); + } + + } + } + + return( TRUE ); +} + + +//--------------------------------------------------------------------------------------------------------------- +// SetLowerLandIndexWithRadius +// +// Puts a land index "under" an existing ground texture. Affects a radial area. +// +BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ubRadius, BOOLEAN fReplace ) +{ + UINT16 usTempIndex; + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; + INT32 iNewIndex; + BOOLEAN fDoPaste = FALSE; + INT32 leftmost; + UINT8 ubLastHighLevel; + UINT32 *puiSmoothTiles = NULL; + INT16 sNumSmoothTiles = 0; + UINT16 usTemp; + UINT16 NewTile; //,Dummy; + + // Determine start end end indicies and num rows + sTop = ubRadius; + sBottom = -ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; + + if ( iMapIndex >= 0x8000 ) + return ( FALSE ); + + for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) + { + + leftmost = ( ( iMapIndex + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS; + + for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) + { + iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2; + + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + { + + if ( fReplace ) + { + fDoPaste = TRUE; + } + else + { + if ( TypeExistsInLandLayer( iNewIndex, uiNewType, &usTempIndex ) ) + { + fDoPaste = TRUE; + } + } + + //if ( fDoPaste && !TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, LASTFLOOR, &Dummy ) ) + if ( fDoPaste ) + { + if ( iMapIndex == iNewIndex ) + { + AddToUndoList( iMapIndex ); + + // Force middle one to NOT smooth, and set to random 'full' tile + usTemp = ( rand( ) % 10 ) + 1; + GetTileIndexFromTypeSubIndex( uiNewType, usTemp, &NewTile ); + SetLandIndex( iNewIndex, NewTile, uiNewType, FALSE ); + } + else if ( AnyHeigherLand( iNewIndex, uiNewType, &ubLastHighLevel ) ) + { + AddToUndoList( iMapIndex ); + + // Force middle one to NOT smooth, and set to random 'full' tile + usTemp = ( rand( ) % 10 ) + 1; + GetTileIndexFromTypeSubIndex( uiNewType, usTemp, &NewTile ); + SetLandIndex( iNewIndex, NewTile, uiNewType, FALSE ); + } + else + { + AddToUndoList( iMapIndex ); + + // Set tile to 'smooth target' tile + GetTileIndexFromTypeSubIndex( uiNewType, REQUIRES_SMOOTHING_TILE, &NewTile ); + SetLandIndex( iNewIndex, NewTile, uiNewType, FALSE ); + + // If we are top-most, add to smooth list + sNumSmoothTiles++; + puiSmoothTiles = (UINT32 *) MemRealloc( puiSmoothTiles, sNumSmoothTiles * sizeof( UINT32 ) ); + puiSmoothTiles[ sNumSmoothTiles-1 ] = iNewIndex; + } + } + } + } + } + + // Once here, smooth any tiles that need it + if ( sNumSmoothTiles > 0 ) + { + for ( cnt1 = 0; cnt1 < sNumSmoothTiles; cnt1++ ) + { + + SmoothTerrainRadius( puiSmoothTiles[ cnt1 ], uiNewType, 10, FALSE ); + + } + MemFree( puiSmoothTiles ); + } + + return( TRUE ); +} + +// ATE FIXES +void PasteTextureEx( INT16 sGridNo, UINT16 usType ) +{ + UINT16 usIndex; + UINT8 ubTypeLevel; + UINT16 NewTile; + + // CHECK IF THIS TEXTURE EXISTS! + if ( TypeExistsInLandLayer( sGridNo, usType, &usIndex ) ) + { + if ( GetTypeLandLevel( sGridNo, usType, &ubTypeLevel ) ) + { + // If top-land , do not change + if ( ubTypeLevel != LANDHEAD ) + { + PasteExistingTexture( sGridNo, usIndex ); + } + } + } + else + { + + // Fill with just first tile, smoothworld() will pick proper piece later + GetTileIndexFromTypeSubIndex( usType, REQUIRES_SMOOTHING_TILE, &NewTile ); + + SetLandIndex( sGridNo, NewTile, usType, FALSE ); + } + +} + + +void PasteTextureFromRadiusEx( INT16 sGridNo, UINT16 usType, UINT8 ubRadius ) +{ + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; + INT32 iNewIndex; + INT32 leftmost; + + // Determine start end end indicies and num rows + sTop = ubRadius; + sBottom = -ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; + + if ( sGridNo >= 0x8000 ) + return; + + for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) + { + + leftmost = ( ( sGridNo + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS; + + for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) + { + iNewIndex = sGridNo + ( WORLD_COLS * cnt1 ) + cnt2; + + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + { + PasteTextureEx( sGridNo, usType ); + } + + } + } + + return; +} + + +// FUNCTION TO GIVE NEAREST GRIDNO OF A CLIFF +#define LAND_DROP_1 FIRSTCLIFF1 +#define LAND_DROP_2 FIRSTCLIFF11 +#define LAND_DROP_3 FIRSTCLIFF12 +#define LAND_DROP_4 FIRSTCLIFF15 +#define LAND_DROP_5 FIRSTCLIFF8 +void RaiseWorldLand( ) +{ + INT32 cnt; + UINT32 sTempGridNo; + LEVELNODE *pStruct; + TILE_ELEMENT *pTileElement; + BOOLEAN fRaise; + BOOLEAN fRaiseSet; + BOOLEAN fSomethingRaised = FALSE; + UINT8 ubLoop; + UINT16 usIndex; + BOOLEAN fStopRaise = FALSE; + INT32 iCounterA = 0, iCounterB = 0; + INT32 iStartNumberOfRaises = 0; + INT32 iNumberOfRaises = 0; + BOOLEAN fAboutToRaise = FALSE; + + fRaise=FALSE; + fRaiseSet=FALSE; + + for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) + { + gpWorldLevelData[cnt].uiFlags &= (~MAPELEMENT_RAISE_LAND_START ); + gpWorldLevelData[cnt].uiFlags &= (~MAPELEMENT_RAISE_LAND_END ); + + } + + for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) + { + + // Get Structure levelnode + pStruct = gpWorldLevelData[ cnt ].pStructHead; + gpWorldLevelData[cnt].sHeight=0; + + while( pStruct ) + { + pTileElement = &(gTileDatabase[ pStruct->usIndex ]); + if (pTileElement->fType==FIRSTCLIFF) + { + fSomethingRaised = TRUE; + // DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff found at count=%d",cnt)); + if( pTileElement->ubNumberOfTiles > 1 ) + { + // DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff has %d children", pTileElement->ubNumberOfTiles)); + for (ubLoop = 0; ubLoop < pTileElement->ubNumberOfTiles; ubLoop++) + { + usIndex=pStruct->usIndex; + // need means to turn land raising on and off based on the tile ID and the offset in the + // tile database when reading into the mapsystem + // turning off of land raising can only be done + // presently by CLIFF object/tileset 1 + // so simply detect this tile set and turn off instead of on + // element 1 is 12 tiles and is unique + + sTempGridNo = cnt + pTileElement->pTileLocData[ubLoop].bTileOffsetX + pTileElement->pTileLocData[ubLoop].bTileOffsetY * WORLD_COLS; + // Check for valid gridno + if ( OutOfBounds( (INT16)cnt, (INT16)sTempGridNo ) ) + { + continue; + } + //if (pTileElement->ubNumberOfTiles==10) + if((usIndex==LAND_DROP_1)||(usIndex==LAND_DROP_2) ||(usIndex==LAND_DROP_4)) + { + gpWorldLevelData[sTempGridNo].uiFlags &= (~MAPELEMENT_RAISE_LAND_START ); + gpWorldLevelData[sTempGridNo].uiFlags |= MAPELEMENT_RAISE_LAND_END; + } + else if( ( usIndex==LAND_DROP_5 ) && ( ubLoop == 4 ) ) + { + gpWorldLevelData[sTempGridNo].uiFlags &= (~MAPELEMENT_RAISE_LAND_START ); + gpWorldLevelData[sTempGridNo].uiFlags |= MAPELEMENT_RAISE_LAND_END; + if( !( gpWorldLevelData[sTempGridNo + 1 ].uiFlags & MAPELEMENT_RAISE_LAND_START ) ) + { + gpWorldLevelData[sTempGridNo + 1].uiFlags |= MAPELEMENT_RAISE_LAND_START; + } + } + else if( ( usIndex== LAND_DROP_3 ) && ( ( ubLoop == 0 ) || ( ubLoop == 1 ) || ( ubLoop == 2 )) ) + { + gpWorldLevelData[sTempGridNo].uiFlags &= (~MAPELEMENT_RAISE_LAND_START ); + gpWorldLevelData[sTempGridNo].uiFlags |= MAPELEMENT_RAISE_LAND_END; + } + else + { + gpWorldLevelData[sTempGridNo].uiFlags |= MAPELEMENT_RAISE_LAND_START; + } + } + } + else + { + if( usIndex==LAND_DROP_3 ) + { + gpWorldLevelData[cnt].uiFlags &= (~MAPELEMENT_RAISE_LAND_START ); + gpWorldLevelData[cnt].uiFlags |= MAPELEMENT_RAISE_LAND_END; + } + else + { + //if (pTileElement->ubNumberOfTiles==10) + if(usIndex==LAND_DROP_1) + { + gpWorldLevelData[cnt].uiFlags &= (~MAPELEMENT_RAISE_LAND_START ); + gpWorldLevelData[cnt].uiFlags |= MAPELEMENT_RAISE_LAND_END; + } + else + gpWorldLevelData[cnt].uiFlags |= MAPELEMENT_RAISE_LAND_START; + } + } + } + pStruct=pStruct->pNext; + } + } + + if (fSomethingRaised == FALSE) + { + // no cliffs + return; + } + + // run through again, this pass is for placing raiselandstart in rows that have raiseland end but no raiselandstart + for (cnt=WORLD_MAX-1; cnt >=0 ; cnt--) + { + if(cnt%WORLD_ROWS==WORLD_ROWS-1) + { + // start of new row + fRaiseSet=FALSE; + } + if (gpWorldLevelData[cnt].uiFlags&MAPELEMENT_RAISE_LAND_START) + { + fRaiseSet=TRUE; + } + else if((gpWorldLevelData[cnt].uiFlags&MAPELEMENT_RAISE_LAND_END)&&(!fRaiseSet)) + { + // there is a dropoff without a rise. + // back up and set beginning to raiseland start + gpWorldLevelData[cnt+((WORLD_ROWS-1)-(cnt%WORLD_ROWS))].uiFlags &= (~MAPELEMENT_RAISE_LAND_END ); + gpWorldLevelData[cnt+((WORLD_ROWS-1)-(cnt%WORLD_ROWS))].uiFlags|=MAPELEMENT_RAISE_LAND_START; + if(cnt+((WORLD_ROWS-1)-(cnt%WORLD_ROWS))-WORLD_ROWS >0) + { + gpWorldLevelData[cnt+((WORLD_ROWS-1)-(cnt%WORLD_ROWS))-WORLD_ROWS].uiFlags &= (~MAPELEMENT_RAISE_LAND_END ); + gpWorldLevelData[cnt+((WORLD_ROWS-1)-(cnt%WORLD_ROWS))-WORLD_ROWS].uiFlags|=MAPELEMENT_RAISE_LAND_START; + } + fRaiseSet=TRUE; + } + } + fRaiseSet=FALSE; + // Look for a cliff face that is along either the lower edge or the right edge of the map, this is used for a special case fill + // start at y=159, x= 80 and go to x=159, y=80 + + // now check along x=159, y=80 to x=80, y=0 + for (cnt=( ( WORLD_COLS * WORLD_ROWS ) - ( WORLD_ROWS / 2 ) * ( WORLD_ROWS - 2 ) - 1 ); cnt >WORLD_ROWS-1 ; cnt-=(WORLD_ROWS+1)) + { + if( fAboutToRaise == TRUE ) + { + fRaiseSet=TRUE; + fAboutToRaise = FALSE; + } + + if ((gpWorldLevelData[cnt].uiFlags&MAPELEMENT_RAISE_LAND_START)||(gpWorldLevelData[cnt-1].uiFlags&MAPELEMENT_RAISE_LAND_START)||(gpWorldLevelData[ cnt + 1 ].uiFlags&MAPELEMENT_RAISE_LAND_START)) + { + fAboutToRaise = TRUE; + fRaiseSet = FALSE; + } + else if((gpWorldLevelData[cnt].uiFlags&MAPELEMENT_RAISE_LAND_END)||(gpWorldLevelData[cnt-1].uiFlags&MAPELEMENT_RAISE_LAND_END) || ( gpWorldLevelData[cnt+1].uiFlags&MAPELEMENT_RAISE_LAND_END) ) + { + fRaiseSet=FALSE; + } + if (fRaiseSet) + { + gpWorldLevelData[cnt+((WORLD_ROWS-1)-(cnt%WORLD_ROWS))].uiFlags|=MAPELEMENT_RAISE_LAND_START; + //gpWorldLevelData[cnt].uiFlags|=MAPELEMENT_RAISE_LAND_START; + //gpWorldLevelData[cnt-1].uiFlags|=MAPELEMENT_RAISE_LAND_START; + //DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Land Raise start at count: %d is raised",cnt )); + //DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Land Raise start at count: %d is raised",cnt - 1 )); + } + } + + //fRaiseSet = FALSE; + + // Now go through the world, starting at x=max(x) and y=max(y) and work backwards + // if a cliff is found turn raise flag on, if the end of a screen is found, turn off + // the system uses world_cord=x+y*(row_size) + + + for (cnt=WORLD_MAX-1; cnt >= 0; cnt--) + { + // reset the RAISE to FALSE + // End of the row + if ( !(cnt % WORLD_ROWS) ) + { + iNumberOfRaises = 0; + iStartNumberOfRaises = 0; + } + + if( ( gpWorldLevelData[cnt].uiFlags & MAPELEMENT_RAISE_LAND_END ) ) + { + if( cnt > 1 ) + { + if( ( !( gpWorldLevelData[ cnt - 1 ].uiFlags & MAPELEMENT_RAISE_LAND_END) && !( gpWorldLevelData[ cnt - 2 ].uiFlags & MAPELEMENT_RAISE_LAND_END ) ) ) + { + iNumberOfRaises--; + } + } + } + else if( gpWorldLevelData[cnt].uiFlags & MAPELEMENT_RAISE_LAND_START ) + { + // check tile before and after, if either are raise land flagged, then don't increment number of + // raises + if( cnt < WORLD_MAX - 2 ) + { + if( ( !( gpWorldLevelData[ cnt + 1 ].uiFlags & MAPELEMENT_RAISE_LAND_START) && !( gpWorldLevelData[ cnt + 2 ].uiFlags & MAPELEMENT_RAISE_LAND_START ) ) ) + { + iNumberOfRaises++; + } + } + } + + // look at number of raises.. if negative, then we have more downs than ups, restart row with raises + 1; + // now raise land of any tile while the flag is on + if( iNumberOfRaises < 0 ) + { + // something wrong, reset cnt + iStartNumberOfRaises++; + cnt += WORLD_ROWS - cnt % WORLD_ROWS; + iNumberOfRaises = iStartNumberOfRaises; + continue; + } + + if( iNumberOfRaises >= 0 ) + { + //DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Land Raise start at count: %d is raised",cnt )); + gpWorldLevelData[cnt].sHeight=iNumberOfRaises * WORLD_CLIFF_HEIGHT; + } + } + + for (cnt=WORLD_MAX-1; cnt >= 0; cnt--) + { + if( ( cnt < WORLD_MAX - WORLD_ROWS ) && ( cnt > WORLD_ROWS ) ) + { + if( ( gpWorldLevelData[cnt + WORLD_ROWS ].sHeight == gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) && ( gpWorldLevelData[ cnt ].sHeight!= gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) ) + { + gpWorldLevelData[cnt].sHeight = gpWorldLevelData[cnt + WORLD_ROWS ].sHeight; + } + else if( ( gpWorldLevelData[ cnt ].sHeight > gpWorldLevelData[cnt - WORLD_ROWS ].sHeight )&& ( gpWorldLevelData[cnt + WORLD_ROWS ].sHeight != gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) && ( gpWorldLevelData[cnt ].sHeight > gpWorldLevelData[cnt + WORLD_ROWS ].sHeight ) ) + { + if( gpWorldLevelData[cnt - WORLD_ROWS ].sHeight > gpWorldLevelData[cnt + WORLD_ROWS ].sHeight ) + { + gpWorldLevelData[ cnt ].sHeight = gpWorldLevelData[cnt - WORLD_ROWS ].sHeight; + } + else + { + gpWorldLevelData[ cnt ].sHeight = gpWorldLevelData[cnt + WORLD_ROWS ].sHeight; + } + } + } + } + +//*/ + +} + +void EliminateObjectLayerRedundancy() +{ + INT32 i, numRoads, numAnothers; + UINT32 uiType; + LEVELNODE *pObject, *pValidRoad, *pValidAnother; + UINT16 usIndex; + + for( i = 0; i < WORLD_MAX; i++ ) + { //Eliminate all but the last ROADPIECE and ANOTHERDEBRIS + pObject = gpWorldLevelData[ i ].pObjectHead; + pValidRoad = pValidAnother = NULL; + numRoads = numAnothers = 0; + while( pObject ) + { + GetTileType( pObject->usIndex, &uiType ); + if( uiType == ROADPIECES ) + { //keep track of the last valid road piece, and count the total + pValidRoad = pObject; + numRoads++; + } + else if( uiType == ANOTHERDEBRIS ) + { //keep track of the last valid another debris, and count the total + pValidAnother = pObject; + numAnothers++; + } + pObject = pObject->pNext; + } + if( pValidRoad && numRoads > 1 ) + { //we have more than two roadpieces on the same gridno, so get rid of them, replacing it + //with the visible one. + usIndex = pValidRoad->usIndex; + RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES ); + AddObjectToHead( i, usIndex ); + } + if( pValidAnother && numAnothers > 1 ) + { //we have more than two anotherdebris on the same gridno, so get rid of them, replacing it + //with the visible one. + usIndex = pValidAnother->usIndex; + RemoveAllObjectsOfTypeRange( i, ANOTHERDEBRIS, ANOTHERDEBRIS ); + AddObjectToHead( i, usIndex ); + } + } +} + + +#endif //JA2EDITOR + + + + + + diff --git a/Editor/edit_sys.h b/Editor/edit_sys.h new file mode 100644 index 00000000..bea3566e --- /dev/null +++ b/Editor/edit_sys.h @@ -0,0 +1,80 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __EDIT_SYS_H +#define __EDIT_SYS_H + +#define SMALLBRUSH 0 +#define MEDIUMBRUSH 1 +#define LARGEBRUSH 2 + +#define NO_BANKS 0 +#define DRAW_BANKS 1 +#define DRAW_BANK_WATER 2 +#define DRAW_ERASE 3 + +#define NO_CLIFFS 0 +#define DRAW_CLIFFS 1 +#define DRAW_CLIFF_LAND 2 + +extern BOOLEAN gfWarning; + +extern BOOLEAN gfDoFill; +extern UINT16 CurrentPaste; +extern UINT16 gDebrisPaste; +extern UINT16 gChangeElevation; +extern UINT16 CurrentStruct; +extern UINT32 gDoBanks; +extern UINT32 gDoCliffs; + +void EraseMapTile( UINT32 iMapIndex ); +void QuickEraseMapTile( UINT32 iMapIndex ); +void DeleteStuffFromMapTile( UINT32 iMapIndex ); + +void PasteDebris( UINT32 iMapIndex ); + +void PasteStructure( UINT32 iMapIndex ); +void PasteStructure1( UINT32 iMapIndex ); +void PasteStructure2( UINT32 iMapIndex ); +void PasteStructureCommon( UINT32 iMapIndex ); + +void PasteSingleWall( UINT32 iMapIndex ); +void PasteSingleDoor( UINT32 iMapIndex ); +void PasteSingleWindow( UINT32 iMapIndex ); +void PasteSingleRoof( UINT32 iMapIndex ); +void PasteSingleBrokenWall( UINT32 iMapIndex ); +void PasteSingleDecoration( UINT32 iMapIndex ); +void PasteSingleDecal( UINT32 iMapIndex ); +void PasteSingleFloor( UINT32 iMapIndex ); +void PasteSingleToilet( UINT32 iMapIndex ); +void PasteRoomNumber( UINT32 iMapIndex, UINT8 ubRoomNumber ); + +void PasteSingleWallCommon( UINT32 iMapIndex ); + +UINT16 GetRandomIndexByRange( UINT16 usRangeStart, UINT16 usRangeEnd ); +UINT16 GetRandomTypeByRange( UINT16 usRangeStart, UINT16 usRangeEnd ); + +void PasteFloor( UINT32 iMapIndex, UINT16 usFloorIndex , BOOLEAN fReplace); + +void PasteBanks( UINT32 iMapIndex, UINT16 usStructIndex, BOOLEAN fReplace ); +void PasteRoads( UINT32 iMapIndex ); +void PasteCliffs( UINT32 iMapIndex, UINT16 usStructIndex , BOOLEAN fReplace); + +void PasteTexture( UINT32 iMapIndex ); +void PasteTextureCommon( UINT32 iMapIndex ); + +void PasteHigherTexture( UINT32 iMapIndex, UINT32 fNewType ); + +void RaiseWorldLand(); + +void EliminateObjectLayerRedundancy(); + + +#endif +#endif + + + + + + diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp new file mode 100644 index 00000000..7349b01b --- /dev/null +++ b/Editor/editscreen.cpp @@ -0,0 +1,3842 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "sgp.h" + #include "vobject.h" + #include "worlddef.h" + #include "renderworld.h" + #include "input.h" + #include "smooth.h" + #include "worldman.h" + #include "edit_sys.h" + #include "screenids.h" + #include "editscreen.h" + #include "sys globals.h" + #include "SmartMethod.h" + #include "selectwin.h" + #include "Interface.h" + #include "lighting.h" + #include "Interactive Tiles.h" + #include "overhead types.h" + #include "Overhead.h" + #include "Soldier Control.h" + #include "Handle UI.h" + #include "Event Pump.h" + #include "world items.h" + #include "loadscreen.h" + #include "render dirty.h" + #include "isometric utils.h" + #include "message.h" + #include "render fun.h" + #include "popupmenu.h" + #include "overhead map.h" + #include "EditorDefines.h" + #include "EditorTerrain.h" + #include "EditorBuildings.h" + #include "EditorItems.h" + #include "EditorMercs.h" + #include "EditorMapInfo.h" + #include "newsmooth.h" + #include "Smoothing Utils.h" + #include "messagebox.h" + #include "Soldier Create.h" + #include "Soldier Init List.h" + #include "Text Input.h" + #include "Cursor Modes.h" + #include "Editor Taskbar Utils.h" + #include "Editor Modes.h" + #include "Editor Undo.h" + #include "Exit Grids.h" + #include "Item Statistics.h" + #include "Map Information.h" + #include "Sector Summary.h" + #include "Game Clock.h" + #include "Game Init.h" + #include "environment.h" + #include "Simple Render Utils.h" + #include "Map Edgepoints.h" + #include "line.h" + #include "english.h" + #include "random.h" + #include "scheduling.h" + #include "Road Smoothing.h" + #include "strategicmap.h" + #include "message.h" + #include "pits.h" + #include "Inventory Choosing.h" + #include "Music Control.h" + #include "Soldier Profile.h" +#endif + + +extern CHAR8 *szMusicList[NUM_MUSIC]; + +BOOLEAN gfCorruptMap = FALSE; +BOOLEAN gfCorruptSchedules = FALSE; +BOOLEAN gfProfileDataLoaded = FALSE; + +extern void RemoveMercsInSector(); +extern void ReverseSchedules(); +extern void ClearAllSchedules(); + +extern UINT32 guiCurUICursor; + +void DrawObjectsBasedOnSelectionRegion(); +UINT32 ProcessEditscreenMessageBoxResponse(); + +void ReloadMap(); + +//defined in sector summary.c +extern BOOLEAN HandleSummaryInput( InputAtom *pEvent ); + +GUI_BUTTON *gpPersistantButton; + +// These are global variables used by the main game loop + +UINT32 guiSaveTacticalStatusFlags; //saves the tactical status flags when entering the editor. + +BOOLEAN gfAutoLoadA9 = FALSE; +//new vars added by Kris +BOOLEAN gfRenderWorld = FALSE; +BOOLEAN gfRenderTaskbar = FALSE; +BOOLEAN gfRenderDrawingMode = FALSE; +BOOLEAN gfFirstPlacement = TRUE; +BOOLEAN gfPendingBasement = FALSE; +BOOLEAN gfPendingCaves = FALSE; +BOOLEAN gfNeedToInitGame = FALSE; +BOOLEAN gfScheduleReversalPending = FALSE; +BOOLEAN gfRemoveLightsPending = FALSE; +BOOLEAN gfScheduleClearPending = FALSE; +BOOLEAN gfConfirmExitFirst = TRUE; +BOOLEAN gfConfirmExitPending = FALSE; +BOOLEAN gfIntendOnEnteringEditor = FALSE; + +//original +extern UINT8 gubFilename[ 200 ]; +INT16 gsBanksSubIndex = 0; +INT16 gsOldBanksSubIndex = 1; +INT16 gsCliffsSubIndex = 0; +INT16 gsOldCliffsSubIndex = 1; +BOOLEAN gfSwitchScreen = FALSE; +BOOLEAN gDoTest = FALSE; +BOOLEAN gDoTest2 = FALSE; +FLOAT gShadePercent = (FLOAT)0.65; +INT16 gusCurrentRoofType = ONELEVELTYPEONEROOF; + +UINT16 gusLightLevel = 0; +UINT16 gusGameLightLevel = 0; +UINT16 gusSavedLightLevel = 0; +BOOLEAN gfFakeLights = FALSE; + +INT16 gsLightRadius = 5; + +BOOLEAN gfOldDoVideoScroll; // Saved for returning to previous settings +UINT8 gubOldCurScrollSpeedID; // Saved for returning to previous settings + +INT32 iOldTaskMode = TASK_OPTIONS; + +INT32 iTaskMode = TASK_NONE; + +INT32 iEditorTBarButton[NUMBER_EDITOR_BUTTONS]; // For Toolbars + +BOOLEAN gfMercResetUponEditorEntry; + + +BOOLEAN fHelpScreen = FALSE; + +BOOLEAN fDontUseRandom = FALSE; + +INT32 TestButtons[10]; + +LEVELNODE *gCursorNode = NULL; +//LEVELNODE *gBasicCursorNode = NULL; +INT16 gsCursorGridNo; + +INT32 giMusicID = 0; + +void EraseWorldData( ); + +BOOLEAN EditModeInit( void ); +BOOLEAN EditModeShutdown( void ); +void EnsureStatusOfEditorButtons(); + + +extern BOOLEAN fAllDone; +extern DisplayList Selection; + +extern void DisableButtonHelpTextRestore(); +extern void EnableButtonHelpTextRestore(); + +void UpdateLastActionBeforeLeaving(); + +BOOLEAN gfEditorDirty = TRUE; + +BOOLEAN fRaiseHeight = FALSE; + +INT32 iDrawMode = DRAW_MODE_NOTHING; +INT32 iCurrentAction,iActionParam; +INT32 iEditAction = ACTION_NULL; + +INT32 iEditorButton[NUMBER_EDITOR_BUTTONS]; +INT32 iEditorToolbarState; +INT32 iJA2ToolbarLastWallState; + +INT32 iCurrentTaskbar; + +UINT16 iCurBankMapIndex; + +InputAtom EditorInputEvent; +BOOLEAN fBeenWarned = FALSE; +BOOLEAN fEditModeFirstTime = TRUE; +BOOLEAN fFirstTimeInEditModeInit = TRUE; +BOOLEAN fSelectionWindow = FALSE; +BOOLEAN gfRealGunNut = TRUE; + +INT16 sGridX, sGridY; +UINT32 iMapIndex; +BOOLEAN fNewMap = FALSE; + +INT32 iPrevDrawMode = DRAW_MODE_NOTHING; +UINT16 PrevCurrentPaste = FIRSTTEXTURE; +INT32 gPrevCurrentBackground = FIRSTTEXTURE; +INT32 iPrevJA2ToolbarState = TBAR_MODE_NONE; +INT32 PrevTerrainTileDrawMode = TERRAIN_TILES_NODRAW; + +UINT16 gusEditorTaskbarColor; +UINT16 gusEditorTaskbarHiColor; +UINT16 gusEditorTaskbarLoColor; + +void CreateGotoGridNoUI(); +void RemoveGotoGridNoUI(); +BOOLEAN gfGotoGridNoUI = FALSE; +INT32 guiGotoGridNoUIButtonID; +MOUSE_REGION GotoGridNoUIRegion; + +//---------------------------------------------------------------------------------------------- +// EditScreenInit +// +// This function is called once at SGP (and game) startup +// +UINT32 EditScreenInit(void) +{ + gfFakeLights = FALSE; + + eInfo.fGameInit = TRUE; + GameInitEditorBuildingInfo(); + GameInitEditorMercsInfo(); + + //Set the editor colors. + //gusEditorTaskbarColor = 9581; + //gusEditorTaskbarColor = Get16BPPColor( FROMRGB( 72, 88, 104 ) ); + //gusEditorTaskbarHiColor = Get16BPPColor( FROMRGB( 136, 138, 135 ) ); + //gusEditorTaskbarLoColor = Get16BPPColor( FROMRGB( 24, 61, 81 ) ); + + gusEditorTaskbarColor = Get16BPPColor( FROMRGB( 65, 79, 94 ) ); + gusEditorTaskbarHiColor = Get16BPPColor( FROMRGB( 122, 124, 121 ) ); + gusEditorTaskbarLoColor = Get16BPPColor( FROMRGB( 22, 55, 73 ) ); + + InitClipboard(); + + InitializeRoadMacros(); + + InitArmyGunTypes(); + + return TRUE; +} + + +//---------------------------------------------------------------------------------------------- +// EditScreenShutdown +// +// This function is called once at shutdown of the game +// +UINT32 EditScreenShutdown(void) +{ + GameShutdownEditorMercsInfo(); + RemoveAllFromUndoList(); + KillClipboard(); + return TRUE; +} + + +//---------------------------------------------------------------------------------------------- +// EditModeInit +// +// Editor's Init code. Called each time we enter edit mode from the game. +// +BOOLEAN EditModeInit( void ) +{ + UINT32 x; + INT32 i; + SGPPaletteEntry LColors[2]; + + OutputDebugString( "Entering editor mode...\n" ); + + + gfRealGunNut = gGameOptions.fGunNut; + gGameOptions.fGunNut = TRUE; + + + if( !gfProfileDataLoaded ) + LoadMercProfiles(); + + ClearTacticalMessageQueue( ); + + PauseGame(); + fEditModeFirstTime = FALSE; + + DisableButtonHelpTextRestore(); + + if( fFirstTimeInEditModeInit ) + { + if( gfWorldLoaded ) + InitJA2SelectionWindow(); + fFirstTimeInEditModeInit = FALSE; + } + + //Initialize editor specific stuff for each Taskbar. + EntryInitEditorTerrainInfo(); + EntryInitEditorItemsInfo(); + EntryInitEditorMercsInfo(); + + LightGetColors( LColors ); + gEditorLightColor = LColors[0]; + + //essentially, we are turning the game off so the game doesn't process in conjunction with the + //editor. + guiSaveTacticalStatusFlags = (gTacticalStatus.uiFlags & ~DEMOMODE); + gTacticalStatus.uiFlags &= ~REALTIME; + gTacticalStatus.uiFlags |= TURNBASED | SHOW_ALL_ITEMS; + gTacticalStatus.uiTimeOfLastInput = GetJA2Clock(); + gTacticalStatus.uiTimeSinceDemoOn = gTacticalStatus.uiTimeOfLastInput; + gTacticalStatus.fGoingToEnterDemo = FALSE; + + //Remove the radar from the interface. + RemoveCurrentTacticalPanelButtons( ); + MSYS_DisableRegion(&gRadarRegion); + + CreateEditorTaskbar(); + + //Hide all of the buttons here. DoTaskbar() will handle the + //showing and hiding of the buttons. + for( x = LAST_EDITORTAB_BUTTON+1; x < NUMBER_EDITOR_BUTTONS; x++ ) + HideButton( iEditorButton[x] ); + + iEditorToolbarState = iPrevJA2ToolbarState; + iDrawMode = iPrevDrawMode; + CurrentPaste = PrevCurrentPaste; + gCurrentBackground = gPrevCurrentBackground; + + iCurrentTaskbar = TASK_NONE; + iTaskMode = iOldTaskMode; + + DoTaskbar(); + + fDontUseRandom = FALSE; + fSelectionWindow = FALSE; + + // Set renderer to ignore redundency + gTacticalStatus.uiFlags |= NOHIDE_REDUNDENCY; + + fHelpScreen = FALSE; + + gfEditMode = TRUE; + fNewMap = FALSE; + + gfEditingDoor = FALSE; + + gusGameLightLevel = LightGetAmbient(); + if( !gfBasement && !gfCaves ) + gusLightLevel = 12;//EDITOR_LIGHT_MAX - (UINT16)LightGetAmbient(); + else + gusLightLevel = EDITOR_LIGHT_MAX - (UINT16)LightGetAmbient(); + + if( gfFakeLights ) + { + gusSavedLightLevel = gusLightLevel; + gusLightLevel = EDITOR_LIGHT_FAKE; + ClickEditorButton( MAPINFO_TOGGLE_FAKE_LIGHTS ); + } + + gfRenderWorld = TRUE; + gfRenderTaskbar = TRUE; + + //Reset the corruption detection flags. + gfCorruptMap = FALSE; + gfCorruptSchedules = FALSE; + + // save old scrolling mode, set renderer to not use video scroll + gfOldDoVideoScroll = gfDoVideoScroll; + gubOldCurScrollSpeedID = gubCurScrollSpeedID; + /// set new ones + + gfRoofPlacement = FALSE; + + EnableUndo(); + + RemoveMercsInSector( ); + if( gfWorldLoaded ) + { + gfConfirmExitFirst = TRUE; + ShowEntryPoints(); + PrepareSchedulesForEditorEntry(); + if( gfMercResetUponEditorEntry ) + { + UseEditorOriginalList(); + ResetAllMercPositions(); + } + else + UseEditorAlternateList(); + BuildItemPoolList(); + SetEditorSmoothingMode( gMapInformation.ubEditorSmoothingType ); + AddLockedDoorCursors(); + + for( i = 0; i < MAX_LIGHT_SPRITES; i++ ) + { + if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE && !(LightSprites[ i ].uiFlags & (LIGHT_SPR_ON|MERC_LIGHT) ) ) + { + LightSpritePower( i, TRUE ); + } + } + + if( gfShowPits ) + { + AddAllPits(); + } + + LightSetBaseLevel( (UINT8)(EDITOR_LIGHT_MAX - gusLightLevel) ); + ShowLightPositionHandles(); + LightSpriteRenderAll(); + } + else + { + OutputDebugString( "Creating summary window...\n" ); + CreateSummaryWindow(); + gfNeedToInitGame = TRUE; + } + + SetMercTeamVisibility( ENEMY_TEAM, gfShowEnemies ); + SetMercTeamVisibility( CREATURE_TEAM, gfShowCreatures ); + SetMercTeamVisibility( MILITIA_TEAM, gfShowRebels ); + SetMercTeamVisibility( CIV_TEAM, gfShowCivilians ); + + // remove mouse region for pause of game + RemoveMouseRegionForPauseOfClock( ); + + gfIntendOnEnteringEditor = FALSE; + + OutputDebugString( "Finished entering editor mode...\n" ); + + return(TRUE); +} + + +//---------------------------------------------------------------------------------------------- +// EditModeShutdown +// +// The above function's counterpart. Called when exiting the editor back to the game. +BOOLEAN EditModeShutdown( void ) +{ + if( gfConfirmExitFirst ) + { + gfConfirmExitPending = TRUE; + CreateMessageBox( L"Exit editor?" ); + return FALSE; + } + + gfEditMode = FALSE; + fEditModeFirstTime = TRUE; + + UpdateLastActionBeforeLeaving(); + + DeleteEditorTaskbar(); + + // create clock mouse region for clock pause + CreateMouseRegionForPauseOfClock( CLOCK_REGION_START_X, CLOCK_REGION_START_Y ); + + iOldTaskMode = iCurrentTaskbar; + gTacticalStatus.uiFlags = guiSaveTacticalStatusFlags; + + RemoveLightPositionHandles( ); + + MapOptimize(); + + RemoveCursors(); + + fHelpScreen = FALSE; + // Set render back to normal mode + gTacticalStatus.uiFlags &= ~(NOHIDE_REDUNDENCY | SHOW_ALL_ITEMS); + UpdateRoofsView( ); + UpdateWallsView( ); + // Invalidate all redundency checks + InvalidateWorldRedundency(); + + + // If false lighting is on in the editor, turn it off! + if ( gfFakeLights ) + { + gusLightLevel = gusSavedLightLevel; + } + + LightSpriteRenderAll(); + + if( gfWorldLoaded ) + { + ClearRenderFlags( RENDER_FLAG_SAVEOFF ); + MarkWorldDirty(); + RenderWorld( ); + } + + InvalidateScreen( ); + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender( ); + + MSYS_EnableRegion(&gRadarRegion); + CreateCurrentTacticalPanelButtons( ); + + // Make sure to turn off demo mode! + gTacticalStatus.uiTimeOfLastInput = GetJA2Clock(); + gTacticalStatus.uiTimeSinceDemoOn = GetJA2Clock(); + gTacticalStatus.fGoingToEnterDemo = FALSE; + + // RETURN TO PREVIOUS SCROLL MODE + gfDoVideoScroll = gfOldDoVideoScroll; + gubCurScrollSpeedID = gubOldCurScrollSpeedID; + + + DisableUndo(); + + SetFontShadow( DEFAULT_SHADOW ); + + + if( gfWorldLoaded ) + { + CompileWorldMovementCosts(); + RaiseWorldLand(); + CompileInteractiveTiles(); + HideEntryPoints(); + KillItemPoolList(); + PrepareSchedulesForEditorExit(); + RemoveAllObjectsOfTypeRange( gsSelectedMercGridNo, CONFIRMMOVE, CONFIRMMOVE ); + RemoveLockedDoorCursors(); + if( gfShowPits ) + { + RemoveAllPits(); + } + } + + EnableButtonHelpTextRestore(); + + if( gfNeedToInitGame ) + { + InitStrategicLayer(); + WarpGameTime( 1 , WARPTIME_PROCESS_EVENTS_NORMALLY ); //to avoid helicopter setup + gfNeedToInitGame = FALSE; + } + else + { + if( !gfBasement && !gfCaves ) + LightSetBaseLevel( (UINT8)gusGameLightLevel ); + UpdateMercsInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + } + + gGameOptions.fGunNut = gfRealGunNut; + + DeleteBuildingLayout(); + + HideExitGrids(); + + UnPauseGame(); + + return TRUE; +} + +//---------------------------------------------------------------------------------------------- +// SetBackgroundTexture +// +// Forces all land on the map to have the same ground texture. +// +void SetBackgroundTexture( ) +{ + int cnt; + UINT16 usIndex, Dummy; + + for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) + { + // Erase old layers + RemoveAllLandsOfTypeRange( cnt, FIRSTTEXTURE, DEEPWATERTEXTURE ); + + // Add level + usIndex = (UINT16)(rand( ) % 10 ); + + // Adjust for type + usIndex += gTileTypeStartIndex[ gCurrentBackground ]; + + // Set land index + if( TypeRangeExistsInLandLayer( cnt, FIRSTFLOOR, LASTFLOOR, &Dummy ) ) + AddLandToTail( cnt, usIndex ); //show the land below the floor. + else + AddLandToHead( cnt, usIndex ); //no floor so no worries. + } +} + + +//---------------------------------------------------------------------------------------------- +// DoWindowSelection +// +// Displays the selection window and handles it's exit condition. Used by WaitForSelectionWindow +// +BOOLEAN DoWindowSelection( void ) +{ + RenderSelectionWindow( ); + RenderButtonsFastHelp( ); + if ( fAllDone ) + { + switch ( iDrawMode ) + { + case DRAW_MODE_WALLS: + case DRAW_MODE_DOORS: + case DRAW_MODE_WINDOWS: + case DRAW_MODE_ROOFS: + case DRAW_MODE_BROKEN_WALLS: + case DRAW_MODE_DECOR: + case DRAW_MODE_DECALS: + case DRAW_MODE_FLOORS: + case DRAW_MODE_TOILET: + case DRAW_MODE_ROOM: + case DRAW_MODE_NEWROOF: + case DRAW_MODE_OSTRUCTS: + case DRAW_MODE_OSTRUCTS1: + case DRAW_MODE_OSTRUCTS2: + case DRAW_MODE_DEBRIS: + case DRAW_MODE_BANKS: + case DRAW_MODE_ROADS: + break; + default: + iDrawMode = DRAW_MODE_NOTHING; + break; + } + RemoveJA2SelectionWindow( ); + return ( TRUE ); + } + return ( FALSE ); +} + + +//Whenever the mouse attaches an object to the cursor, it has to be removed, so it doesn't stay +//in the world. +void RemoveTempMouseCursorObject( void ) +{ + if ( iCurBankMapIndex < 0x8000 ) + { + ForceRemoveStructFromTail( iCurBankMapIndex ); + gCursorNode = NULL; + } + +} + +//Whenever the editor wishes to show an object in the world, it will temporarily attach it to +//the mouse cursor, to indicate what is about to be drawn. +BOOLEAN DrawTempMouseCursorObject(void) +{ + INT16 sMouseX_M, sMouseY_M; + UINT16 usUseIndex; + UINT16 usUseObjIndex; + + switch ( iDrawMode ) + { + case DRAW_MODE_ROOM: + pSelList = SelRoom; + pNumSelList = &iNumRoomsSelected; + return FALSE; //a special case where we just want to get the info and not display a cursor. + case DRAW_MODE_NEWROOF: + pSelList = SelSingleNewRoof; + pNumSelList = &iNumNewRoofsSelected; + break; + case DRAW_MODE_WALLS: + pSelList = SelSingleWall; + pNumSelList = &iNumWallsSelected; + break; + case DRAW_MODE_DOORS: + pSelList = SelSingleDoor; + pNumSelList = &iNumDoorsSelected; + break; + case DRAW_MODE_WINDOWS: + pSelList = SelSingleWindow; + pNumSelList = &iNumWindowsSelected; + break; + case DRAW_MODE_ROOFS: + pSelList = SelSingleRoof; + pNumSelList = &iNumRoofsSelected; + break; + case DRAW_MODE_BROKEN_WALLS: + pSelList = SelSingleBrokenWall; + pNumSelList = &iNumBrokenWallsSelected; + break; + case DRAW_MODE_DECOR: + pSelList = SelSingleDecor; + pNumSelList = &iNumDecorSelected; + break; + case DRAW_MODE_DECALS: + pSelList = SelSingleDecal; + pNumSelList = &iNumDecalsSelected; + break; + case DRAW_MODE_FLOORS: + pSelList = SelSingleFloor; + pNumSelList = &iNumFloorsSelected; + break; + case DRAW_MODE_TOILET: + pSelList = SelSingleToilet; + pNumSelList = &iNumToiletsSelected; + break; + case DRAW_MODE_BANKS: + pSelList = SelBanks; + pNumSelList = &iNumBanksSelected; + break; + case DRAW_MODE_ROADS: + pSelList = SelRoads; + pNumSelList = &iNumRoadsSelected; + break; + case DRAW_MODE_OSTRUCTS: + pSelList = SelOStructs; + pNumSelList = &iNumOStructsSelected; + break; + case DRAW_MODE_OSTRUCTS1: + pSelList = SelOStructs1; + pNumSelList = &iNumOStructs1Selected; + break; + case DRAW_MODE_OSTRUCTS2: + pSelList = SelOStructs2; + pNumSelList = &iNumOStructs2Selected; + break; + case DRAW_MODE_DEBRIS: + pSelList = SelDebris; + pNumSelList = &iNumDebrisSelected; + break; + } + + if ( GetMouseXY( &sMouseX_M, &sMouseY_M ) ) + { + if ( (iCurBankMapIndex = MAPROWCOLTOPOS( sMouseY_M, sMouseX_M )) < 0x8000 ) + { + + //Hook into the smart methods to override the selection window methods. + if( iDrawMode == DRAW_MODE_SMART_WALLS ) + { + if( !CalcWallInfoUsingSmartMethod( iCurBankMapIndex, &usUseObjIndex, &usUseIndex ) ) + { + return FALSE; + } + } + else if( iDrawMode == DRAW_MODE_SMART_DOORS ) + { + if( !CalcDoorInfoUsingSmartMethod( iCurBankMapIndex, &usUseObjIndex, &usUseIndex ) ) + { + return FALSE; + } + } + else if( iDrawMode == DRAW_MODE_SMART_WINDOWS ) + { + if( !CalcWindowInfoUsingSmartMethod( iCurBankMapIndex, &usUseObjIndex, &usUseIndex ) ) + { + return FALSE; + } + } + else if( iDrawMode == DRAW_MODE_SMART_BROKEN_WALLS ) + { + if( !CalcBrokenWallInfoUsingSmartMethod( iCurBankMapIndex, &usUseObjIndex, &usUseIndex ) ) + { + return FALSE; + } + if( usUseObjIndex == 0xffff || usUseIndex == 0xffff ) + { + return FALSE; + } + } + else + { + usUseIndex = pSelList[ iCurBank ].usIndex; + usUseObjIndex = (UINT16)pSelList[ iCurBank ].uiObject; + } + gCursorNode = ForceStructToTail( iCurBankMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) ); + // ATE: Set this levelnode as dynamic! + gCursorNode->uiFlags |= LEVELNODE_DYNAMIC; + return( TRUE ); + } + else + return( FALSE ); + } + + return( FALSE ); +} + + +//Displays the current drawing object in the small, lower left window of the editor's toolbar. +void ShowCurrentDrawingMode( void ) +{ + SGPRect ClipRect, NewRect; + INT32 iShowMode; + UINT16 usUseIndex; + UINT16 usObjIndex; + INT32 iStartX = 50; + INT32 iStartY = 440; + INT32 iPicHeight, iPicWidth; + INT16 sTempOffsetX; + INT16 sTempOffsetY; + ETRLEObject *pETRLEObject; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + UINT16 usFillColor; + INT32 iIndexToUse; + + // Set up a clipping rectangle for the display window. + NewRect.iLeft = 0; + NewRect.iTop = 400; + NewRect.iRight = 100; + NewRect.iBottom = 458; + + GetClippingRect(&ClipRect); + SetClippingRect(&NewRect); + + // Clear it out + ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 400, 100, 458, 0 ); + + iShowMode = iDrawMode; + if ( iDrawMode >= DRAW_MODE_ERASE ) + iShowMode -= DRAW_MODE_ERASE; + + usUseIndex = usObjIndex = 0xffff; + + iIndexToUse = 0; + if ( fDontUseRandom ) + iIndexToUse = iCurBank; + + // Select object to be displayed depending on the current editing mode. + switch ( iShowMode ) + { + case DRAW_MODE_ROOM: + case DRAW_MODE_SLANTED_ROOF: + if ( iNumWallsSelected > 0 ) + { + usUseIndex = SelRoom[0].usIndex; + usObjIndex = (UINT16)SelRoom[0].uiObject; + } + break; + + case DRAW_MODE_GROUND: + case (DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA): + usUseIndex = 0; + usObjIndex = CurrentPaste; + break; + + case DRAW_MODE_OSTRUCTS: + if ( iNumOStructsSelected > 0 ) + { + usUseIndex = SelOStructs[ iIndexToUse ].usIndex; + usObjIndex = (UINT16)SelOStructs[ iIndexToUse ].uiObject; + } + break; + + case DRAW_MODE_OSTRUCTS1: + if ( iNumOStructs1Selected > 0 ) + { + usUseIndex = SelOStructs1[ iIndexToUse ].usIndex; + usObjIndex = (UINT16)SelOStructs1[ iIndexToUse ].uiObject; + } + break; + + case DRAW_MODE_OSTRUCTS2: + if ( iNumOStructs2Selected > 0 ) + { + usUseIndex = SelOStructs2[ iIndexToUse ].usIndex; + usObjIndex = (UINT16)SelOStructs2[ iIndexToUse ].uiObject; + } + break; + + case DRAW_MODE_DEBRIS: + if ( iNumDebrisSelected > 0 ) + { + usUseIndex = SelDebris[ iIndexToUse ].usIndex; + usObjIndex = (UINT16)SelDebris[ iIndexToUse ].uiObject; + } + break; + + case DRAW_MODE_BANKS: + if ( iNumBanksSelected > 0 ) + { + usUseIndex = SelBanks[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelBanks[ iCurBank ].uiObject; + } + break; + + case DRAW_MODE_ROADS: + if ( iNumRoadsSelected > 0 ) + { + usUseIndex = SelRoads[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelRoads[ iCurBank ].uiObject; + } + break; + + case DRAW_MODE_WALLS: + if ( iNumWallsSelected > 0 ) + { + usUseIndex = SelSingleWall[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelSingleWall[ iCurBank ].uiObject; + } + break; + case DRAW_MODE_DOORS: + if ( iNumDoorsSelected > 0 ) + { + usUseIndex = SelSingleDoor[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelSingleDoor[ iCurBank ].uiObject; + } + break; + case DRAW_MODE_WINDOWS: + if( iNumWindowsSelected > 0 ) + { + usUseIndex = SelSingleWindow[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelSingleWindow[ iCurBank ].uiObject; + } + break; + case DRAW_MODE_ROOFS: + if ( iNumRoofsSelected > 0 ) + { + usUseIndex = SelSingleRoof[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelSingleRoof[ iCurBank ].uiObject; + } + break; + case DRAW_MODE_NEWROOF: + if( iNumNewRoofsSelected > 0 ) + { + usUseIndex = SelSingleNewRoof[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelSingleNewRoof[ iCurBank ].uiObject; + } + break; + case DRAW_MODE_BROKEN_WALLS: + if ( iNumBrokenWallsSelected > 0 ) + { + usUseIndex = SelSingleBrokenWall[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelSingleBrokenWall[ iCurBank ].uiObject; + } + break; + case DRAW_MODE_DECOR: + if ( iNumDecorSelected > 0 ) + { + usUseIndex = SelSingleDecor[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelSingleDecor[ iCurBank ].uiObject; + } + break; + case DRAW_MODE_DECALS: + if ( iNumDecalsSelected > 0 ) + { + usUseIndex = SelSingleDecal[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelSingleDecal[ iCurBank ].uiObject; + } + break; + case DRAW_MODE_FLOORS: + if ( iNumFloorsSelected > 0 ) + { + usUseIndex = SelSingleFloor[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelSingleFloor[ iCurBank ].uiObject; + } + break; + case DRAW_MODE_TOILET: + if( iNumToiletsSelected > 0 ) + { + usUseIndex = SelSingleToilet[ iCurBank ].usIndex; + usObjIndex = (UINT16)SelSingleToilet[ iCurBank ].uiObject; + } + break; + case DRAW_MODE_SMART_WALLS: + if ( GetMouseXY( &sGridX, &sGridY ) ) + { + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + if( CalcWallInfoUsingSmartMethod( iMapIndex, &usObjIndex, &usUseIndex ) ) + break; + } + CalcSmartWallDefault( &usObjIndex, &usUseIndex ); + break; + case DRAW_MODE_SMART_DOORS: + if ( GetMouseXY( &sGridX, &sGridY ) ) + { + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + if( CalcDoorInfoUsingSmartMethod( iMapIndex, &usObjIndex, &usUseIndex ) ) + break; + } + CalcSmartDoorDefault( &usObjIndex, &usUseIndex ); + break; + case DRAW_MODE_SMART_WINDOWS: + if ( GetMouseXY( &sGridX, &sGridY ) ) + { + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + if( CalcWindowInfoUsingSmartMethod( iMapIndex, &usObjIndex, &usUseIndex ) ) + break; + } + CalcSmartWindowDefault( &usObjIndex, &usUseIndex ); + break; + case DRAW_MODE_SMART_BROKEN_WALLS: + if ( GetMouseXY( &sGridX, &sGridY ) ) + { + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + if( CalcBrokenWallInfoUsingSmartMethod( iMapIndex, &usObjIndex, &usUseIndex ) ) + break; + } + CalcSmartBrokenWallDefault( &usObjIndex, &usUseIndex ); + break; + + case DRAW_MODE_PLACE_ITEM: + DisplayItemStatistics(); + break; + } + + // If we actually have something to draw, draw it + if ( (usUseIndex != 0xffff) && (usObjIndex != 0xffff) ) + { + pETRLEObject = &(gTileDatabase[gTileTypeStartIndex[usObjIndex]].hTileSurface->pETRLEObject[usUseIndex]); + + iPicWidth = (INT32)pETRLEObject->usWidth; + iPicHeight = (INT32)pETRLEObject->usHeight; + + // Center the picture in the display window. + iStartX = ( 100 - iPicWidth ) / 2; + iStartY = ( 60 - iPicHeight ) / 2; + + // We have to store the offset data in temp variables before zeroing them and blitting + sTempOffsetX = pETRLEObject->sOffsetX; + sTempOffsetY = pETRLEObject->sOffsetY; + + // Set the offsets used for blitting to 0 + pETRLEObject->sOffsetX = 0; + pETRLEObject->sOffsetY = 0; + + SetObjectShade( gTileDatabase[gTileTypeStartIndex[usObjIndex]].hTileSurface, DEFAULT_SHADE_LEVEL ); + BltVideoObject( FRAME_BUFFER, gTileDatabase[gTileTypeStartIndex[usObjIndex]].hTileSurface, + usUseIndex, (0 + iStartX), (400 + iStartY), + VO_BLT_SRCTRANSPARENCY, NULL); + + pETRLEObject->sOffsetX = sTempOffsetX; + pETRLEObject->sOffsetY = sTempOffsetY; + } + + // Set the color for the window's border. Blueish color = Normal, Red = Fake lighting is turned on + usFillColor = GenericButtonFillColors[0]; + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + if(gbPixelDepth==16) + RectangleDraw( FALSE, 0, 400, 99, 458, usFillColor, pDestBuf ); + else if(gbPixelDepth==8) + RectangleDraw8( FALSE, 0, 400, 99, 458, usFillColor, pDestBuf ); + + UnLockVideoSurface( FRAME_BUFFER ); + + InvalidateRegion( 0, 400, 100, 458 ); + SetClippingRect(&ClipRect); +} + + + +//---------------------------------------------------------------------------------------------- +// HandleJA2ToolbarSelection +// +// Select action to be taken based on user's toolbar selection. +// +void HandleJA2ToolbarSelection( void ) +{ + BOOLEAN fPrevState; + + fPrevState = gfRenderTaskbar; + gfRenderTaskbar = TRUE; + + switch (iEditorToolbarState) + { + + case TBAR_MODE_SET_BGRND: + iCurrentAction = ACTION_SET_NEW_BACKGROUND; + break; + + case TBAR_MODE_DENS_DWN: + iCurrentAction = ACTION_DENSITY_DOWN; + break; + + case TBAR_MODE_DENS_UP: + iCurrentAction = ACTION_DENSITY_UP; + break; + + case TBAR_MODE_RAISE_LAND: + iCurrentAction = ACTION_RAISE_LAND; + break; + + case TBAR_MODE_LOWER_LAND: + iCurrentAction = ACTION_LOWER_LAND; + break; + + case TBAR_MODE_DEC_DIFF: + if ( sCurBaseDiff > 0 ) + sCurBaseDiff--; + break; + + case TBAR_MODE_INC_DIFF: + if ( sCurBaseDiff < 4 ) + sCurBaseDiff++; + break; + + case TBAR_MODE_FAKE_LIGHTING: + gfFakeLights ^= TRUE; + if ( gfFakeLights ) + { + gusSavedLightLevel = gusLightLevel; + gusLightLevel = EDITOR_LIGHT_FAKE; + } + else + gusLightLevel = gusSavedLightLevel; + LightSetBaseLevel( (UINT8)(EDITOR_LIGHT_MAX - gusLightLevel) ); + LightSpriteRenderAll(); + break; + + case TBAR_MODE_CHANGE_TILESET: + InitPopupMenu( iEditorButton[OPTIONS_CHANGE_TILESET], CHANGETSET_POPUP, DIR_UPRIGHT ); + break; + + case TBAR_MODE_CIVILIAN_GROUP: + InitPopupMenu( iEditorButton[MERCS_CIVILIAN_GROUP], CHANGECIVGROUP_POPUP, DIR_UPLEFT ); + break; + + case TBAR_MODE_GET_WALL: + iCurrentAction = ACTION_GET_WALL; + iDrawMode = DRAW_MODE_WALLS; + break; + case TBAR_MODE_GET_DOOR: + iCurrentAction = ACTION_GET_DOOR; + iDrawMode = DRAW_MODE_DOORS; + break; + case TBAR_MODE_GET_WINDOW: + iCurrentAction = ACTION_GET_WINDOW; + iDrawMode = DRAW_MODE_WINDOWS; + break; + case TBAR_MODE_GET_ROOF: + iCurrentAction = ACTION_GET_ROOF; + iDrawMode = DRAW_MODE_ROOFS; + break; + case TBAR_MODE_GET_BROKEN_WALL: + iCurrentAction = ACTION_GET_BROKEN_WALL; + iDrawMode = DRAW_MODE_BROKEN_WALLS; + break; + case TBAR_MODE_GET_DECOR: + iCurrentAction = ACTION_GET_DECOR; + iDrawMode = DRAW_MODE_DECOR; + break; + case TBAR_MODE_GET_DECAL: + iCurrentAction = ACTION_GET_DECAL; + iDrawMode = DRAW_MODE_DECALS; + break; + case TBAR_MODE_GET_FLOOR: + iCurrentAction = ACTION_GET_FLOOR; + iDrawMode = DRAW_MODE_FLOORS; + break; + case TBAR_MODE_GET_TOILET: + iCurrentAction = ACTION_GET_TOILET; + iDrawMode = DRAW_MODE_TOILET; + break; + case TBAR_MODE_GET_ROOM: + iCurrentAction = ACTION_GET_ROOM; + break; + case TBAR_MODE_GET_NEW_ROOF: + iCurrentAction = ACTION_GET_NEW_ROOF; + iDrawMode = DRAW_MODE_NEWROOF; + break; + + case TBAR_MODE_FILL_AREA: + iDrawMode = DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA; + ClickEditorButton( TERRAIN_FGROUND_TEXTURES ); + TerrainTileDrawMode = TERRAIN_TILES_FOREGROUND; + break; + + case TBAR_MODE_FILL_AREA_OFF: + iDrawMode = DRAW_MODE_GROUND; + ClickEditorButton( TERRAIN_FGROUND_TEXTURES ); + TerrainTileDrawMode = TERRAIN_TILES_FOREGROUND; + break; + + case TBAR_MODE_GET_BANKS: + iCurrentAction = ACTION_NEXT_BANK; + iDrawMode = DRAW_MODE_BANKS; + break; + + case TBAR_MODE_GET_ROADS: + iCurrentAction = ACTION_NEXT_ROAD; + iDrawMode = DRAW_MODE_ROADS; + break; + + case TBAR_MODE_DRAW_BANKS: + iCurrentAction = ACTION_NULL; + iDrawMode = DRAW_MODE_BANKS; + break; + + case TBAR_MODE_GET_DEBRIS: + iCurrentAction = ACTION_NEXT_DEBRIS; + iDrawMode = DRAW_MODE_DEBRIS; + break; + + case TBAR_MODE_DRAW_DEBRIS: + iCurrentAction = ACTION_NULL; + iDrawMode = DRAW_MODE_DEBRIS; + break; + + case TBAR_MODE_GET_OSTRUCTS: + iCurrentAction = ACTION_NEXT_STRUCT; + iDrawMode = DRAW_MODE_OSTRUCTS; + break; + + case TBAR_MODE_DRAW_OSTRUCTS: + iCurrentAction = ACTION_NULL; + iDrawMode = DRAW_MODE_OSTRUCTS; + break; + + case TBAR_MODE_GET_OSTRUCTS1: + iCurrentAction = ACTION_NEXT_STRUCT1; + iDrawMode = DRAW_MODE_OSTRUCTS1; + break; + + case TBAR_MODE_DRAW_OSTRUCTS1: + iCurrentAction = ACTION_NULL; + iDrawMode = DRAW_MODE_OSTRUCTS1; + break; + + case TBAR_MODE_GET_OSTRUCTS2: + iCurrentAction = ACTION_NEXT_STRUCT2; + iDrawMode = DRAW_MODE_OSTRUCTS2; + break; + + case TBAR_MODE_DRAW_OSTRUCTS2: + iCurrentAction = ACTION_NULL; + iDrawMode = DRAW_MODE_OSTRUCTS2; + break; + + case TBAR_MODE_EXIT_EDIT: + iCurrentAction = ACTION_EXIT_EDITOR; + break; + + case TBAR_MODE_QUIT_GAME: + iCurrentAction = ACTION_QUIT_GAME; + break; + + case TBAR_MODE_SAVE: + iCurrentAction = ACTION_SAVE_MAP; + break; + + case TBAR_MODE_LOAD: + iCurrentAction = ACTION_LOAD_MAP; + break; + + case TBAR_MODE_UNDO: + iCurrentAction = ACTION_UNDO; + break; + + case TBAR_MODE_CHANGE_BRUSH: + iCurrentAction = ACTION_NEXT_SELECTIONTYPE; + break; + + case TBAR_MODE_ERASE: + switch ( iDrawMode ) + { + case DRAW_MODE_EXITGRID: + case DRAW_MODE_LIGHT: + case DRAW_MODE_GROUND: + case DRAW_MODE_OSTRUCTS: + case DRAW_MODE_OSTRUCTS1: + case DRAW_MODE_OSTRUCTS2: + case DRAW_MODE_DEBRIS: + case DRAW_MODE_BANKS: + case DRAW_MODE_ROADS: + + case DRAW_MODE_WALLS: + case DRAW_MODE_DOORS: + case DRAW_MODE_WINDOWS: + case DRAW_MODE_ROOFS: + case DRAW_MODE_BROKEN_WALLS: + case DRAW_MODE_DECALS: + case DRAW_MODE_DECOR: + case DRAW_MODE_FLOORS: + case DRAW_MODE_TOILET: + + case DRAW_MODE_ROOM: + case DRAW_MODE_SLANTED_ROOF: + case DRAW_MODE_ROOMNUM: + iDrawMode += DRAW_MODE_ERASE; + break; + } + break; + + case TBAR_MODE_ERASE_OFF: + if ( iDrawMode >= DRAW_MODE_ERASE ) + iDrawMode -= DRAW_MODE_ERASE; + break; + + case TBAR_MODE_NEW_MAP: + iCurrentAction = ACTION_NEW_MAP; + break; + + case TBAR_MODE_ITEM_WEAPONS: + case TBAR_MODE_ITEM_AMMO: + case TBAR_MODE_ITEM_ARMOUR: + case TBAR_MODE_ITEM_EXPLOSIVES: + case TBAR_MODE_ITEM_EQUIPMENT1: + case TBAR_MODE_ITEM_EQUIPMENT2: + case TBAR_MODE_ITEM_EQUIPMENT3: + case TBAR_MODE_ITEM_TRIGGERS: + case TBAR_MODE_ITEM_KEYS: + //Set up the items by type. + InitEditorItemsInfo(iEditorToolbarState); + if( gubCurrMercMode != MERC_GETITEMMODE ) + iDrawMode = DRAW_MODE_PLACE_ITEM; + break; + case TBAR_MODE_NONE: + iCurrentAction = ACTION_NULL; + gfRenderTaskbar = fPrevState; + break; + default: + iCurrentAction = ACTION_NULL; + iDrawMode = DRAW_MODE_NOTHING; + gfRenderTaskbar = fPrevState; + break; + } + iEditorToolbarState = TBAR_MODE_NONE; +} + +//---------------------------------------------------------------------------------------------- +// HandleKeyboardShortcuts +// +// Select action to be taken based on the user's current key press (if any) +// + +extern INT8 gbCurrSelect; +extern void DeleteSelectedMercsItem(); +void HandleKeyboardShortcuts( ) +{ + static INT32 iSavedMode; + static BOOLEAN fShowTrees = TRUE; + while( DequeueEvent( &EditorInputEvent ) ) + { + if( !HandleSummaryInput( &EditorInputEvent ) && !HandleTextInput( &EditorInputEvent ) && EditorInputEvent.usEvent == KEY_DOWN ) + { + if( gfGotoGridNoUI ) + { + switch( EditorInputEvent.usParam ) + { + case ESC: + SetInputFieldStringWith16BitString( 0, L"" ); + RemoveGotoGridNoUI(); + break; + case ENTER: + RemoveGotoGridNoUI(); + break; + case 'x': + if( EditorInputEvent.usKeyState & ALT_DOWN ) + { + SetInputFieldStringWith16BitString( 0, L"" ); + RemoveGotoGridNoUI(); + iCurrentAction = ACTION_QUIT_GAME; + } + break; + } + } + else switch( EditorInputEvent.usParam ) + { + case HOME: + gfFakeLights ^= TRUE; + if ( gfFakeLights ) + { + gusSavedLightLevel = gusLightLevel; + gusLightLevel = EDITOR_LIGHT_FAKE; + ClickEditorButton( MAPINFO_TOGGLE_FAKE_LIGHTS ); + } + else + { + gusLightLevel = gusSavedLightLevel; + UnclickEditorButton( MAPINFO_TOGGLE_FAKE_LIGHTS ); + } + LightSetBaseLevel( (UINT8)(EDITOR_LIGHT_MAX - gusLightLevel) ); + LightSpriteRenderAll(); + break; + + case SPACE: + if( iCurrentTaskbar == TASK_MERCS ) + IndicateSelectedMerc( SELECT_NEXT_MERC ); + else if( iCurrentTaskbar == TASK_ITEMS ) + SelectNextItemPool(); + else if( gfShowTerrainTileButtons && fUseTerrainWeights ) + ResetTerrainTileWeights(); + else + LightSpriteRenderAll(); + break; + + case INSERT: + if ( iDrawMode == DRAW_MODE_GROUND ) + { + iDrawMode += DRAW_MODE_FILL_AREA; + ClickEditorButton( TERRAIN_FILL_AREA ); + iEditorToolbarState = TBAR_MODE_FILL_AREA; + } + else if ( iDrawMode == (DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA) ) + { + iDrawMode -= DRAW_MODE_FILL_AREA; + UnclickEditorButton( TERRAIN_FILL_AREA ); + iEditorToolbarState = TBAR_MODE_FILL_AREA_OFF; + } + break; + case ENTER: + if( gfEditingDoor ) + { + ExtractAndUpdateDoorInfo(); + KillDoorEditing(); + } + else if( iCurrentTaskbar == TASK_MERCS && gsSelectedMercID != -1 ) + ExtractCurrentMercModeInfo( FALSE ); + else if( iCurrentTaskbar == TASK_MAPINFO ) + ExtractAndUpdateMapInfo(); + else if( iCurrentTaskbar == TASK_BUILDINGS ) + ExtractAndUpdateBuildingInfo(); + else if( gfShowItemStatsPanel && EditingText() ) + ExecuteItemStatsCmd( ITEMSTATS_APPLY ); + break; + + case BACKSPACE: + iCurrentAction = ACTION_UNDO; + break; + + case DEL: + if( iCurrentTaskbar == TASK_ITEMS ) + DeleteSelectedItem(); + else if( gsSelectedMercID != -1 ) + { + if( gubCurrMercMode == MERC_INVENTORYMODE && gbCurrSelect != -1 ) + { + DeleteSelectedMercsItem(); + gbCurrSelect = -1; + gfRenderTaskbar = TRUE; + } + else + DeleteSelectedMerc(); + } + else + iCurrentAction = ACTION_QUICK_ERASE; + break; + + case ESC: + if ( InOverheadMap() ) + { + KillOverheadMap(); + } + if( iDrawMode == DRAW_MODE_SCHEDULEACTION ) + { + CancelCurrentScheduleAction(); + } + else if( gfMercGetItem ) + { //cancel getting an item for the merc. + gfMercGetItem = FALSE; + gusMercsNewItemIndex = 0xffff; + SetMercEditingMode( MERC_INVENTORYMODE ); + ClearEditorItemsInfo(); + } + else if( gfShowItemStatsPanel && EditingText() ) + ExecuteItemStatsCmd( ITEMSTATS_CANCEL ); + else if( gfEditingDoor ) + KillDoorEditing(); + else + iCurrentAction = ACTION_EXIT_EDITOR; + break; + + //Select next/prev terrain tile to draw with. + case SHIFT_LEFTARROW: + CurrentPaste -= ( gfShowTerrainTileButtons && CurrentPaste > 0 ) ? 1 : 0; + break; + case SHIFT_RIGHTARROW: + CurrentPaste += ( gfShowTerrainTileButtons && CurrentPaste < 8 ) ? 1 : 0; + break; + + case PGUP: + if( iCurrentTaskbar == TASK_MERCS && !fBuildingShowRoofs ) + { + gfRoofPlacement = TRUE; + fBuildingShowRoofs = TRUE; + UpdateRoofsView(); + gfRenderWorld = TRUE; + } + else switch( iDrawMode ) + { + case DRAW_MODE_SMART_WALLS: DecSmartWallUIValue(); break; + case DRAW_MODE_SMART_DOORS: DecSmartDoorUIValue(); break; + case DRAW_MODE_SMART_WINDOWS: DecSmartWindowUIValue(); break; + case DRAW_MODE_SMART_BROKEN_WALLS: DecSmartBrokenWallUIValue(); break; + case DRAW_MODE_PLACE_ITEM: SelectPrevItemInPool(); break; + default: iCurrentAction = ACTION_SUB_INDEX_UP; break; + } + gfRenderDrawingMode = TRUE; + break; + case PGDN: + if( iCurrentTaskbar == TASK_MERCS && fBuildingShowRoofs ) + { + gfRoofPlacement = FALSE; + fBuildingShowRoofs = FALSE; + UpdateRoofsView(); + gfRenderWorld = TRUE; + } + else switch( iDrawMode ) + { + case DRAW_MODE_SMART_WALLS: IncSmartWallUIValue(); break; + case DRAW_MODE_SMART_DOORS: IncSmartDoorUIValue(); break; + case DRAW_MODE_SMART_WINDOWS: IncSmartWindowUIValue(); break; + case DRAW_MODE_SMART_BROKEN_WALLS: IncSmartBrokenWallUIValue(); break; + case DRAW_MODE_PLACE_ITEM: SelectNextItemInPool(); break; + default: iCurrentAction = ACTION_SUB_INDEX_DWN; break; + } + gfRenderDrawingMode = TRUE; + break; + + case F1: + gfRenderWorld = TRUE; + gfRenderTaskbar = TRUE; + break; + + case F2: + if (EditorInputEvent.usKeyState & ALT_DOWN ) + { + ReloadMap(); + } + break; + + case F3: + if( EditorInputEvent.usKeyState & CTRL_DOWN ) + { + ReplaceObsoleteRoads(); + MarkWorldDirty(); + } + break; + + case F4: + MusicPlay( giMusicID ); + ScreenMsg( FONT_YELLOW, MSG_DEBUG, L"%S", szMusicList[giMusicID] ); + giMusicID++; + if( giMusicID >= NUM_MUSIC ) + giMusicID = 0; + break; + + case F5: + UpdateLastActionBeforeLeaving(); + CreateSummaryWindow(); + break; + + case F6: + break; + + case F7: + if( gfBasement ) + { + INT32 i; + UINT16 usRoofIndex, usRoofType, usTileIndex; + pSelList = SelSingleRoof; + pNumSelList = &iNumRoofsSelected; + usRoofType = GetRandomIndexByRange( FIRSTROOF, LASTROOF ); + if( usRoofType == 0xffff ) + usRoofType = FIRSTROOF; + for( i = 0; i < WORLD_MAX; i++ ) + { + if( gubWorldRoomInfo[ i ] ) + { + AddToUndoList( i ); + RemoveAllRoofsOfTypeRange( i, FIRSTTEXTURE, LASTITEM ); + RemoveAllOnRoofsOfTypeRange( i, FIRSTTEXTURE, LASTITEM ); + RemoveAllShadowsOfTypeRange( i, FIRSTROOF, LASTSLANTROOF ); + usRoofIndex = 9 + ( rand() % 3 ); + GetTileIndexFromTypeSubIndex( usRoofType, usRoofIndex, &usTileIndex ); + AddRoofToHead( i, usTileIndex ); + } + } + MarkWorldDirty(); + } + break; + + case F8: + SmoothAllTerrainWorld(); + break; + + case F9: + break; + case F10: + CreateMessageBox( L"Are you sure you wish to remove all lights?" ); + gfRemoveLightsPending = TRUE; + break; + case F11: + CreateMessageBox( L"Are you sure you wish to reverse the schedules?" ); + gfScheduleReversalPending = TRUE; + break; + case F12: + CreateMessageBox( L"Are you sure you wish to clear all of the schedules?" ); + gfScheduleClearPending = TRUE; + break; + + case '[': + iCurrentAction = ACTION_DENSITY_DOWN; + break; + + case ']': + iCurrentAction = ACTION_DENSITY_UP; + break; + + case '+': + //if ( iDrawMode == DRAW_MODE_SHOW_TILESET ) + // iCurrentAction = ACTION_MLIST_DWN; + //else + iCurrentAction = ACTION_SHADE_UP; + break; + + case '-': + //if ( iDrawMode == DRAW_MODE_SHOW_TILESET ) + // iCurrentAction = ACTION_MLIST_UP; + iCurrentAction = ACTION_SHADE_DWN; + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if ( iCurrentTaskbar == TASK_MERCS ) + { + if ( iDrawMode >= DRAW_MODE_ERASE ) + iCurrentAction = ACTION_ERASE_WAYPOINT; + else + iCurrentAction = ACTION_SET_WAYPOINT; + iActionParam = EditorInputEvent.usParam - '0'; + } + else + { + iCurrentAction = ACTION_SET_FNAME; + iActionParam = EditorInputEvent.usParam - '0'; + } + break; + + case 'a': + iCurrentAction = ACTION_PREV_SELECTIONTYPE; + break; + case 'b': + if ( iCurrentTaskbar != TASK_BUILDINGS ) + { + iTaskMode = TASK_BUILDINGS; + DoTaskbar(); + } + + if( CheckForSlantRoofs() ) + iDrawMode = DRAW_MODE_SLANTED_ROOF; + else + { + gusSelectionType = gusSavedBuildingSelectionType; + iDrawMode = DRAW_MODE_ROOM; + } + if( gfCaves ) + SetEditorBuildingTaskbarMode( BUILDING_CAVE_DRAWING ); + else + SetEditorBuildingTaskbarMode( BUILDING_NEW_ROOM ); + TerrainTileDrawMode = TERRAIN_TILES_BRETS_STRANGEMODE; + break; + case 'c': + if( EditorInputEvent.usKeyState & CTRL_DOWN && iCurrentTaskbar == TASK_MERCS ) + { + iCurrentAction = ACTION_COPY_MERC_PLACEMENT; + } + break; + + case 'd': // debris + if( iCurrentTaskbar != TASK_TERRAIN ) + { + iTaskMode = TASK_TERRAIN; + DoTaskbar(); + } + + iCurrentAction = ACTION_NULL; + iDrawMode = DRAW_MODE_DEBRIS; + ClickEditorButton( TERRAIN_PLACE_DEBRIS ); + iEditorToolbarState = TBAR_MODE_DRAW_DEBRIS; + TerrainTileDrawMode = TERRAIN_TILES_NODRAW; + break; + case 'e': + if ( iDrawMode >= DRAW_MODE_ERASE ) + { + iDrawMode -= DRAW_MODE_ERASE; + } + else + { + switch ( iDrawMode ) + { + case DRAW_MODE_NORTHPOINT: + case DRAW_MODE_WESTPOINT: + case DRAW_MODE_EASTPOINT: + case DRAW_MODE_SOUTHPOINT: + case DRAW_MODE_CENTERPOINT: + case DRAW_MODE_ISOLATEDPOINT: + case DRAW_MODE_EXITGRID: + case DRAW_MODE_LIGHT: + case DRAW_MODE_GROUND: + case DRAW_MODE_OSTRUCTS: + case DRAW_MODE_OSTRUCTS1: + case DRAW_MODE_OSTRUCTS2: + case DRAW_MODE_DEBRIS: + case DRAW_MODE_BANKS: + case DRAW_MODE_ROADS: + case DRAW_MODE_WALLS: + case DRAW_MODE_DOORS: + case DRAW_MODE_WINDOWS: + case DRAW_MODE_ROOFS: + case DRAW_MODE_BROKEN_WALLS: + case DRAW_MODE_DECOR: + case DRAW_MODE_DECALS: + case DRAW_MODE_FLOORS: + case DRAW_MODE_TOILET: + case DRAW_MODE_ROOM: + case DRAW_MODE_SLANTED_ROOF: + case DRAW_MODE_ROOMNUM: + iDrawMode += DRAW_MODE_ERASE; + break; + } + } + break; + case 'f': + gbFPSDisplay = !gbFPSDisplay; + DisableFPSOverlay( (BOOLEAN)!gbFPSDisplay ); + break; + case 'g': // ground + if( EditorInputEvent.usKeyState & CTRL_DOWN ) + { + CreateGotoGridNoUI(); + } + else + { + if ( iCurrentTaskbar != TASK_TERRAIN ) + { + iTaskMode = TASK_TERRAIN; + DoTaskbar(); + } + iCurrentAction = ACTION_NULL; + SetEditorTerrainTaskbarMode( TERRAIN_FGROUND_TEXTURES ); + } + break; + + case 'h': + if( fBuildingShowRoofs ^= 1 ) + ClickEditorButton( BUILDING_TOGGLE_ROOF_VIEW ); + else + UnclickEditorButton( BUILDING_TOGGLE_ROOF_VIEW ); + UpdateRoofsView(); + break; + + case 'i': + if( !InOverheadMap() ) + GoIntoOverheadMap(); + else + KillOverheadMap(); + break; + + case 'l': + if (EditorInputEvent.usKeyState & CTRL_DOWN ) + { + UpdateLastActionBeforeLeaving(); + iCurrentAction = ACTION_LOAD_MAP; + break; + } + if ( iCurrentTaskbar != TASK_TERRAIN ) + { + iTaskMode = TASK_TERRAIN; + DoTaskbar(); + } + break; + case 'n': + if( fBuildingShowRoomInfo ^= 1 ) + { + SetRenderFlags( RENDER_FLAG_ROOMIDS ); + ClickEditorButton( BUILDING_TOGGLE_INFO_VIEW ); + } + else + { + ClearRenderFlags( RENDER_FLAG_ROOMIDS ); + UnclickEditorButton( BUILDING_TOGGLE_INFO_VIEW ); + } + break; + case 'o': + if ( iCurrentTaskbar != TASK_TERRAIN ) + { + iTaskMode = TASK_TERRAIN; + DoTaskbar(); + } + iCurrentAction = ACTION_NULL; + iDrawMode = DRAW_MODE_OSTRUCTS2; + ClickEditorButton( TERRAIN_PLACE_MISC ); + iEditorToolbarState = TBAR_MODE_DRAW_OSTRUCTS2; + break; + case 'r': // rocks + if ( iCurrentTaskbar != TASK_TERRAIN ) + { + iTaskMode = TASK_TERRAIN; + DoTaskbar(); + } + iCurrentAction = ACTION_NULL; + iDrawMode = DRAW_MODE_OSTRUCTS1; + ClickEditorButton( TERRAIN_PLACE_ROCKS ); + iEditorToolbarState = TBAR_MODE_DRAW_OSTRUCTS1; + break; + case 's': + if (EditorInputEvent.usKeyState & CTRL_DOWN ) + { + iCurrentAction = ACTION_SAVE_MAP; + } + break; + case 't': // Trees + if ( iCurrentTaskbar != TASK_TERRAIN ) + { + iTaskMode = TASK_TERRAIN; + DoTaskbar(); + } + iCurrentAction = ACTION_NULL; + iDrawMode = DRAW_MODE_OSTRUCTS; + ClickEditorButton( TERRAIN_PLACE_TREES ); + iEditorToolbarState = TBAR_MODE_DRAW_OSTRUCTS; + break; + case 'T': + if ( fShowTrees ) + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Removing Treetops" ); + WorldHideTrees( ); + } + else + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Showing Treetops" ); + WorldShowTrees( ); + } + fShowTrees = !fShowTrees; + + break; + case 'u': + RaiseWorldLand(); + break; + case 'w': // walls (full building) + if( fBuildingShowWalls ^= 1 ) + ClickEditorButton( BUILDING_TOGGLE_WALL_VIEW ); + else + UnclickEditorButton( BUILDING_TOGGLE_WALL_VIEW ); + UpdateWallsView(); + break; + case 'v': + if( EditorInputEvent.usKeyState & CTRL_DOWN && iCurrentTaskbar == TASK_MERCS ) + { + iCurrentAction = ACTION_PASTE_MERC_PLACEMENT; + } + break; + + case 'x': + if (EditorInputEvent.usKeyState & ALT_DOWN ) + { + if( InOverheadMap() ) + KillOverheadMap(); + if( gfEditingDoor ) + KillDoorEditing(); + iCurrentAction = ACTION_QUIT_GAME; + return; + } + break; + case 'z': + iCurrentAction = ACTION_NEXT_SELECTIONTYPE; + break; + case ',': + gusSelectionType = LINESELECTION; + gusPreserveSelectionWidth--; + if( !gusPreserveSelectionWidth ) + gusPreserveSelectionWidth = 8; + gfRenderTaskbar = TRUE; + break; + case '.': + gusSelectionType = LINESELECTION; + gusPreserveSelectionWidth++; + if( gusPreserveSelectionWidth > 8 ) + gusPreserveSelectionWidth = 1; + gfRenderTaskbar = TRUE; + default: + iCurrentAction = ACTION_NULL; + break; + } + } + } +} + + + +//---------------------------------------------------------------------------------------------- +// PerformSelectedAction +// +// Perform the current user selected action, if any (or at least set things up for doing that) +// +UINT32 PerformSelectedAction( void ) +{ + UINT32 uiRetVal; + + uiRetVal = EDIT_SCREEN; + + switch ( iCurrentAction ) + { + case ACTION_DENSITY_DOWN: + DecreaseSelectionDensity(); + break; + case ACTION_DENSITY_UP: + IncreaseSelectionDensity(); + break; + + case ACTION_ERASE_WAYPOINT: + EraseMercWaypoint(); + break; + + case ACTION_SET_WAYPOINT: + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + AddMercWaypoint( iMapIndex ); + break; + + case ACTION_RAISE_LAND: + RaiseWorldLand(); + break; + + case ACTION_HELPSCREEN: + DisableEditorTaskbar( ); + fHelpScreen = TRUE; + fAllDone = FALSE; + break; + + case ACTION_QUICK_ERASE: + if ( (gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA) && GetMouseXY( &sGridX, &sGridY ) ) + { + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + + if ( iMapIndex < 0x8000 ) + { + QuickEraseMapTile( iMapIndex ); + } + } + break; + + case ACTION_QUIT_GAME: + gfProgramIsRunning = FALSE; + case ACTION_EXIT_EDITOR: + if( EditModeShutdown( ) ) + { + iPrevJA2ToolbarState = iEditorToolbarState; + iPrevDrawMode = iDrawMode; + PrevCurrentPaste = CurrentPaste; + gPrevCurrentBackground = gCurrentBackground; + fFirstTimeInGameScreen = TRUE; + return GAME_SCREEN; + } + return EDIT_SCREEN; + case ACTION_GET_WALL: + case ACTION_GET_DOOR: + case ACTION_GET_WINDOW: + case ACTION_GET_ROOF: + case ACTION_GET_NEW_ROOF: + case ACTION_GET_BROKEN_WALL: + case ACTION_GET_DECOR: + case ACTION_GET_DECAL: + case ACTION_GET_FLOOR: + case ACTION_GET_TOILET: + case ACTION_GET_ROOM: + switch( iCurrentAction ) + { + case ACTION_GET_WALL: CreateJA2SelectionWindow( SELWIN_SINGLEWALL ); break; + case ACTION_GET_DOOR: CreateJA2SelectionWindow( SELWIN_SINGLEDOOR ); break; + case ACTION_GET_WINDOW: CreateJA2SelectionWindow( SELWIN_SINGLEWINDOW ); break; + case ACTION_GET_ROOF: CreateJA2SelectionWindow( SELWIN_SINGLEROOF ); break; + case ACTION_GET_NEW_ROOF: CreateJA2SelectionWindow( SELWIN_SINGLENEWROOF ); break; + case ACTION_GET_BROKEN_WALL:CreateJA2SelectionWindow( SELWIN_SINGLEBROKENWALL );break; + case ACTION_GET_DECOR: CreateJA2SelectionWindow( SELWIN_SINGLEDECOR ); break; + case ACTION_GET_DECAL: CreateJA2SelectionWindow( SELWIN_SINGLEDECAL ); break; + case ACTION_GET_FLOOR: CreateJA2SelectionWindow( SELWIN_SINGLEFLOOR ); break; + case ACTION_GET_TOILET: CreateJA2SelectionWindow( SELWIN_SINGLETOILET ); break; + case ACTION_GET_ROOM: CreateJA2SelectionWindow( SELWIN_ROOM ); break; + } + fSelectionWindow = TRUE; + fAllDone = FALSE; + break; + + case ACTION_NEW_MAP: + fNewMap = TRUE; + if( gfPendingBasement ) + CreateMessageBox( L"Delete current map and start a new basement level?" ); + else if( gfPendingCaves ) + CreateMessageBox( L"Delete current map and start a new cave level?" ); + else + CreateMessageBox( L"Delete current map and start a new outdoor level?" ); + break; + + case ACTION_SET_NEW_BACKGROUND: + if (!fBeenWarned) + CreateMessageBox( L" Wipe out ground textures? " ); + else + { + gCurrentBackground = TerrainBackgroundTile; + SetBackgroundTexture( ); + fBeenWarned = FALSE; + } + break; + + case ACTION_SUB_INDEX_UP: + gusSelectionType = SMALLSELECTION; + switch ( iDrawMode ) + { + case DRAW_MODE_BANKS: + if ( iNumBanksSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumBanksSelected; + break; + case DRAW_MODE_ROADS: + if ( iNumRoadsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumRoadsSelected; + break; + case DRAW_MODE_WALLS: + if ( iNumWallsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumWallsSelected; + break; + case DRAW_MODE_DOORS: + if ( iNumDoorsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumDoorsSelected; + break; + case DRAW_MODE_WINDOWS: + if ( iNumWindowsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumWindowsSelected; + break; + case DRAW_MODE_ROOFS: + if( iNumRoofsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumRoofsSelected; + break; + case DRAW_MODE_BROKEN_WALLS: + if( iNumBrokenWallsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumBrokenWallsSelected; + break; + case DRAW_MODE_DECOR: + if ( iNumDecorSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumDecorSelected; + break; + case DRAW_MODE_DECALS: + if ( iNumDecalsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumDecalsSelected; + break; + case DRAW_MODE_FLOORS: + if( iNumFloorsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumFloorsSelected; + break; + case DRAW_MODE_TOILET: + if( iNumToiletsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumToiletsSelected; + break; + case DRAW_MODE_NEWROOF: + if( iNumNewRoofsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumNewRoofsSelected; + break; + case DRAW_MODE_OSTRUCTS: + fDontUseRandom = TRUE; + if ( iNumOStructsSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumOStructsSelected; + break; + + case DRAW_MODE_OSTRUCTS1: + fDontUseRandom = TRUE; + if ( iNumOStructs1Selected > 0 ) + iCurBank = (iCurBank + 1) % iNumOStructs1Selected; + break; + + case DRAW_MODE_OSTRUCTS2: + fDontUseRandom = TRUE; + if ( iNumOStructs2Selected > 0 ) + iCurBank = (iCurBank + 1) % iNumOStructs2Selected; + break; + + case DRAW_MODE_DEBRIS: + fDontUseRandom = TRUE; + if ( iNumDebrisSelected > 0 ) + iCurBank = (iCurBank + 1) % iNumDebrisSelected; + break; + } + break; + + case ACTION_SUB_INDEX_DWN: + gusSelectionType = SMALLSELECTION; + switch ( iDrawMode ) + { + case DRAW_MODE_BANKS: + if ( iNumBanksSelected > 0 ) + iCurBank = (iCurBank + (iNumBanksSelected - 1)) % iNumBanksSelected; + break; + case DRAW_MODE_ROADS: + if ( iNumRoadsSelected > 0 ) + iCurBank = (iCurBank + (iNumRoadsSelected - 1)) % iNumRoadsSelected; + break; + case DRAW_MODE_WALLS: + if ( iNumWallsSelected > 0 ) + iCurBank = (iCurBank + (iNumWallsSelected - 1)) % iNumWallsSelected; + break; + case DRAW_MODE_DOORS: + if ( iNumDoorsSelected > 0 ) + iCurBank = (iCurBank + (iNumDoorsSelected - 1)) % iNumDoorsSelected; + break; + case DRAW_MODE_WINDOWS: + if ( iNumWindowsSelected > 0 ) + iCurBank = (iCurBank + (iNumWindowsSelected - 1)) % iNumWindowsSelected; + break; + case DRAW_MODE_ROOFS: + if( iNumRoofsSelected > 0 ) + iCurBank = (iCurBank + (iNumRoofsSelected - 1)) % iNumRoofsSelected; + break; + case DRAW_MODE_BROKEN_WALLS: + if ( iNumBrokenWallsSelected > 0 ) + iCurBank = (iCurBank + (iNumBrokenWallsSelected - 1)) % iNumBrokenWallsSelected; + break; + case DRAW_MODE_DECOR: + if ( iNumDecorSelected > 0 ) + iCurBank = (iCurBank + (iNumDecorSelected - 1)) % iNumDecorSelected; + break; + case DRAW_MODE_DECALS: + if ( iNumDecalsSelected > 0 ) + iCurBank = (iCurBank + (iNumDecalsSelected - 1)) % iNumDecalsSelected; + break; + case DRAW_MODE_FLOORS: + if( iNumFloorsSelected > 0 ) + iCurBank = (iCurBank + (iNumFloorsSelected - 1)) % iNumFloorsSelected; + break; + case DRAW_MODE_TOILET: + if( iNumToiletsSelected > 0 ) + iCurBank = (iCurBank + (iNumToiletsSelected - 1)) % iNumToiletsSelected; + break; + case DRAW_MODE_NEWROOF: + if( iNumNewRoofsSelected > 0 ) + iCurBank = (iCurBank + (iNumNewRoofsSelected - 1)) % iNumNewRoofsSelected; + break; + case DRAW_MODE_OSTRUCTS: + fDontUseRandom = TRUE; + if ( iNumOStructsSelected > 0 ) + iCurBank = (iCurBank + (iNumOStructsSelected - 1)) % iNumOStructsSelected; + break; + + case DRAW_MODE_OSTRUCTS1: + fDontUseRandom = TRUE; + if ( iNumOStructs1Selected > 0 ) + iCurBank = (iCurBank + (iNumOStructs1Selected - 1)) % iNumOStructs1Selected; + break; + + case DRAW_MODE_OSTRUCTS2: + fDontUseRandom = TRUE; + if ( iNumOStructs2Selected > 0 ) + iCurBank = (iCurBank + (iNumOStructs2Selected - 1)) % iNumOStructs2Selected; + break; + + case DRAW_MODE_DEBRIS: + fDontUseRandom = TRUE; + if ( iNumDebrisSelected > 0 ) + iCurBank = (iCurBank + (iNumDebrisSelected - 1)) % iNumDebrisSelected; + break; + } + break; + case ACTION_NEXT_FGRND: + break; + + case ACTION_NEXT_DEBRIS: + CreateJA2SelectionWindow( SELWIN_DEBRIS ); + fSelectionWindow = TRUE; + fAllDone = FALSE; + break; + + case ACTION_PREV_SELECTIONTYPE: + gusSelectionType--; + if( gusSelectionType > AREASELECTION ) + gusSelectionType = AREASELECTION; + gfRenderTaskbar = TRUE; + break; + case ACTION_NEXT_SELECTIONTYPE: + gusSelectionType++; + if( gusSelectionType > AREASELECTION ) + gusSelectionType = SMALLSELECTION; + gfRenderTaskbar = TRUE; + break; + + case ACTION_COPY_MERC_PLACEMENT: + GetMouseXY( &sGridX, &sGridY ); + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + CopyMercPlacement( iMapIndex ); + break; + case ACTION_PASTE_MERC_PLACEMENT: + GetMouseXY( &sGridX, &sGridY ); + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + PasteMercPlacement( iMapIndex ); + break; + + case ACTION_SAVE_MAP: + UpdateLastActionBeforeLeaving(); + return LOADSAVE_SCREEN; + + case ACTION_LOAD_MAP: + UpdateLastActionBeforeLeaving(); + return LOADSAVE_SCREEN; + + case ACTION_UNDO: + ExecuteUndoList( ); + gfRenderWorld = TRUE; + break; + + case ACTION_NEXT_BANK: + CreateJA2SelectionWindow( SELWIN_BANKS ); + fSelectionWindow = TRUE; + fAllDone = FALSE; + break; + + case ACTION_NEXT_ROAD: + CreateJA2SelectionWindow( SELWIN_ROADS ); + fSelectionWindow = TRUE; + fAllDone = FALSE; + break; + + case ACTION_SHADE_UP: + if ( EditorInputEvent.usKeyState & SHIFT_DOWN ) + { + gShadePercent+= (FLOAT).05; + } + else + { + gShadePercent+= (FLOAT).01; + } + + if ( gShadePercent > 1 ) + { + gShadePercent = (FLOAT)0; + } + SetShadeTablePercent( gShadePercent ); + break; + + case ACTION_SHADE_DWN: + if ( EditorInputEvent.usKeyState & SHIFT_DOWN ) + { + gShadePercent-= (FLOAT).05; + } + else + { + gShadePercent-= (FLOAT).01; + } + + if ( gShadePercent < 0 ) + { + gShadePercent = (FLOAT)1; + } + SetShadeTablePercent( gShadePercent ); + break; + + case ACTION_WALL_PASTE1: // Doors //** Changes needed + GetMouseXY( &sGridX, &sGridY ); + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + + AddWallToStructLayer( iMapIndex, FIRSTWALL18, TRUE ); + break; + + case ACTION_WALL_PASTE2: // Windows //** Changes Needed + GetMouseXY( &sGridX, &sGridY ); + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + + AddWallToStructLayer( iMapIndex, FIRSTWALL19, TRUE ); + break; + + case ACTION_NEXT_STRUCT: + CreateJA2SelectionWindow( SELWIN_OSTRUCTS ); + fSelectionWindow = TRUE; + fAllDone = FALSE; + break; + + case ACTION_NEXT_STRUCT1: + CreateJA2SelectionWindow( SELWIN_OSTRUCTS1 ); + fSelectionWindow = TRUE; + fAllDone = FALSE; + break; + + case ACTION_NEXT_STRUCT2: + CreateJA2SelectionWindow( SELWIN_OSTRUCTS2 ); + fSelectionWindow = TRUE; + fAllDone = FALSE; + break; + + default: + break; + } + + return( uiRetVal ); +} + +void CreateNewMap() +{ + if( gfSummaryWindowActive ) + DestroySummaryWindow(); + + if( !gfWorldLoaded ) + LoadMapTileset( 0 ); + + LightReset(); + NewWorld( ); + if( gfPendingBasement ) + { + UINT32 i; + UINT16 usIndex; + for ( i = 0; i < WORLD_MAX; i++ ) + { + // Set land index 9 + 3 variants + GetTileIndexFromTypeSubIndex( FIRSTROOF, (UINT16)(9 + Random(3)), &usIndex ); + AddRoofToHead( i, usIndex ); + } + SetEditorSmoothingMode( SMOOTHING_BASEMENT ); + } + else if( gfPendingCaves ) + { + UINT32 i; + UINT16 usIndex; + for ( i = 0; i < WORLD_MAX; i++ ) + { + //Set up the default cave here. + GetTileIndexFromTypeSubIndex( FIRSTWALL, (UINT16)(60 + Random(6)), &usIndex ); + AddCave( i, usIndex ); + } + SetEditorSmoothingMode( SMOOTHING_CAVES ); + } + else + SetEditorSmoothingMode( SMOOTHING_NORMAL ); + fNewMap = FALSE; + RemoveAllFromUndoList( ); + UseEditorAlternateList(); + KillSoldierInitList(); + UseEditorOriginalList(); + KillSoldierInitList(); + HideEntryPoints(); + gMapInformation.sNorthGridNo = -1; + gMapInformation.sSouthGridNo = -1; + gMapInformation.sWestGridNo = -1; + gMapInformation.sEastGridNo = -1; +} + + +UINT32 ProcessEditscreenMessageBoxResponse() +{ + RemoveMessageBox(); + gfRenderWorld = TRUE; + if( gfConfirmExitPending ) + { + gfConfirmExitPending = FALSE; + if( gfMessageBoxResult ) + { + gfConfirmExitFirst = FALSE; + iEditorToolbarState = TBAR_MODE_EXIT_EDIT; + } + return EDIT_SCREEN; + } + if( !gfMessageBoxResult ) + return EDIT_SCREEN; + if( gfRemoveLightsPending ) + { + INT32 i; + LightReset(); + for( i = 0; i < WORLD_MAX; i++ ) + { + RemoveAllObjectsOfTypeRange( i, GOODRING, GOODRING ); + } + MarkWorldDirty(); + LightSetBaseLevel( (UINT8)(15 - ubAmbientLightLevel) ); + gfRemoveLightsPending = FALSE; + } + if( gfScheduleReversalPending ) + { + IndicateSelectedMerc( SELECT_NO_MERC ); + ReverseSchedules(); + gfScheduleReversalPending = FALSE; + } + else if( gfScheduleClearPending ) + { + IndicateSelectedMerc( SELECT_NO_MERC ); + ClearAllSchedules(); + gfScheduleClearPending = FALSE; + } + if( fNewMap ) + { + CreateNewMap(); + return EDIT_SCREEN; + } + else if( iDrawMode == DRAW_MODE_NEW_GROUND ) + { + gCurrentBackground = TerrainBackgroundTile; + SetBackgroundTexture( ); + SetEditorTerrainTaskbarMode( TERRAIN_FGROUND_TEXTURES ); + return EDIT_SCREEN; + } + return EDIT_SCREEN; +} + + +//---------------------------------------------------------------------------------------------- +// WaitForHelpScreenResponse +// +// Displays a help screen and waits for the user to wisk it away. +// +UINT32 WaitForHelpScreenResponse( void ) +{ + InputAtom DummyEvent; + BOOLEAN fLeaveScreen; + + ColorFillVideoSurfaceArea(FRAME_BUFFER, 50, 50, 590, 310, + Get16BPPColor(FROMRGB(136, 138, 135)) ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, 51, 51, 590, 310, + Get16BPPColor(FROMRGB(24, 61, 81)) ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, 51, 51, 589, 309, + GenericButtonFillColors[0]); + + SetFont( gp12PointFont1 ); + + gprintf( 55, 55, L"HOME" ); + gprintf( 205, 55, L"Toggle fake editor lighting ON/OFF" ); + + gprintf( 55, 67, L"INSERT" ); + gprintf( 205, 67, L"Toggle fill mode ON/OFF" ); + + gprintf( 55, 79, L"BKSPC" ); + gprintf( 205, 79, L"Undo last change" ); + + gprintf( 55, 91, L"DEL" ); + gprintf( 205, 91, L"Quick erase object under mouse cursor" ); + + gprintf( 55, 103, L"ESC" ); + gprintf( 205, 103, L"Exit editor" ); + + gprintf( 55, 115, L"PGUP/PGDN" ); + gprintf( 205, 115, L"Change object to be pasted" ); + + gprintf( 55, 127, L"F1" ); + gprintf( 205, 127, L"This help screen" ); + + gprintf( 55, 139, L"F10" ); + gprintf( 205, 139, L"Save current map" ); + + gprintf( 55, 151, L"F11" ); + gprintf( 205, 151, L"Load map as current" ); + + gprintf( 55, 163, L"+/-" ); + gprintf( 205, 163, L"Change shadow darkness by .01" ); + + gprintf( 55, 175, L"SHFT +/-" ); + gprintf( 205, 175, L"Change shadow darkness by .05" ); + + gprintf( 55, 187, L"0 - 9" ); + gprintf( 205, 187, L"Change map/tileset filename" ); + + gprintf( 55, 199, L"b" ); + gprintf( 205, 199, L"Change brush size" ); + + gprintf( 55, 211, L"d" ); + gprintf( 205, 211, L"Draw debris" ); + + gprintf( 55, 223, L"o" ); + gprintf( 205, 223, L"Draw obstacle" ); + + gprintf( 55, 235, L"r" ); + gprintf( 205, 235, L"Draw rocks" ); + + gprintf( 55, 247, L"t" ); + gprintf( 205, 247, L"Toggle trees display ON/OFF" ); + + gprintf( 55, 259, L"g" ); + gprintf( 205, 259, L"Draw ground textures" ); + + gprintf( 55, 271, L"w" ); + gprintf( 205, 271, L"Draw building walls" ); + + gprintf( 55, 283, L"e" ); + gprintf( 205, 283, L"Toggle erase mode ON/OFF" ); + + gprintf( 55, 295, L"h" ); + gprintf( 205, 295, L"Toggle roofs ON/OFF" ); + + + fLeaveScreen = FALSE; + + while (DequeueEvent(&DummyEvent) == TRUE) + { + if ( DummyEvent.usEvent == KEY_DOWN ) + { + switch( DummyEvent.usParam ) + { + case SPACE: + case ESC: + case ENTER: + case F1: + fLeaveScreen = TRUE; + break; + } + } + } + + + if ( (_LeftButtonDown) || (_RightButtonDown) || fLeaveScreen ) + { + fHelpScreen = FALSE; + + while( DequeueEvent( &DummyEvent ) ) + continue; + + EnableEditorTaskbar(); + } + + InvalidateScreen( ); + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + + return( EDIT_SCREEN ); +} + + + +//---------------------------------------------------------------------------------------------- +// WaitForSelectionWindowResponse +// +// Handles all keyboard input and display for a selection window. +// +UINT32 WaitForSelectionWindowResponse( void ) +{ + InputAtom DummyEvent; + + while (DequeueEvent(&DummyEvent) == TRUE) + { + if ( DummyEvent.usEvent == KEY_DOWN ) + { + switch( DummyEvent.usParam ) + { + case SPACE: + ClearSelectionList(); + break; + + case DNARROW: + ScrollSelWinDown(); + break; + + case UPARROW: + ScrollSelWinUp(); + break; + + case ESC: + RestoreSelectionList(); + case ENTER: + fAllDone = TRUE; + break; + } + } + } + + if ( DoWindowSelection( ) ) + { + fSelectionWindow = FALSE; + ShutdownJA2SelectionWindow( ); + // Quick hack to trash the mouse event queue. + while( DequeueEvent( &DummyEvent ) ) + continue; + + iCurBank = 0; + + if( iDrawMode == DRAW_MODE_SLANTED_ROOF || iDrawMode == DRAW_MODE_ROOM ) + { + if( CheckForSlantRoofs() ) + iDrawMode = DRAW_MODE_SLANTED_ROOF; + } + InvalidateScreen( ); + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender( ); + } + else + { + DisplaySelectionWindowGraphicalInformation(); + InvalidateScreen( ); + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender( ); + } + + return( EDIT_SCREEN ); +} + + + +//---------------------------------------------------------------------------------------------- +// FindTilesetComments +// +// Retrieves the file comments from the master list for the current tileset +// +void FindTilesetComments(void) +{ +} + + +//---------------------------------------------------------------------------------------------- +// GetMasterList +// +// Loads the master list for the tileset comments +// +void GetMasterList(void) +{ +} + + +//---------------------------------------------------------------------------------------------- +// ShowCurrentSlotSurface +// +// Displays the image of the currently highlighted tileset slot if it's a video surface. +// (usually a 16 bit image) +// +void ShowCurrentSlotSurface( UINT32 vSurface, INT32 iWindow ) +{ + SGPRect ClipRect, WinRect; + INT32 iStartX; + INT32 iStartY; + INT32 iPicHeight, iPicWidth; + HVSURFACE hvSurface; + INT32 iWinWidth, iWinHeight; + blt_vs_fx vSfx; + + WinRect.iLeft = (iWindow == 0) ? (336) : (488); + WinRect.iTop = 211; + WinRect.iRight = (iWindow == 0) ? (485) : (637); + WinRect.iBottom = 399; + + ColorFillVideoSurfaceArea(FRAME_BUFFER, WinRect.iLeft - 1, WinRect.iTop - 1, + WinRect.iRight + 1, WinRect.iBottom + 1, + Get16BPPColor(FROMRGB(128, 0, 0)) ); + + iWinWidth = WinRect.iRight - WinRect.iLeft; + iWinHeight = WinRect.iBottom - WinRect.iTop; + + GetVideoSurface( &hvSurface, vSurface ); + + iPicWidth = (INT32)hvSurface->usWidth; + iPicHeight = (INT32)hvSurface->usHeight; + + if ( iPicWidth > iWinWidth ) + { + ClipRect.iLeft = (iPicWidth - iWinWidth) / 2; + ClipRect.iRight = ClipRect.iLeft + iWinWidth - 1; + iStartX = WinRect.iLeft; + } + else + { + ClipRect.iLeft = 0; + ClipRect.iRight = iPicWidth - 1; + iStartX = ((iWinWidth - iPicWidth) / 2) + WinRect.iLeft; + } + + if ( iPicHeight > iWinHeight ) + { + ClipRect.iTop = (iPicHeight - iWinHeight) / 2; + ClipRect.iBottom = ClipRect.iTop + iWinHeight - 1; + iStartY = WinRect.iTop; + } + else + { + ClipRect.iTop = 0; + ClipRect.iBottom = iPicHeight - 1; + iStartY = ((iWinHeight - iPicHeight) / 2) + WinRect.iTop; + } + + vSfx.SrcRect = ClipRect; + BltVideoSurface( FRAME_BUFFER, vSurface, 0, + iStartX, iStartY, + VS_BLT_SRCSUBRECT, &vSfx ); +} + + +//---------------------------------------------------------------------------------------------- +// ShowCurrentSlotImage +// +// Displays the image of the currently highlighted tileset slot image. Usually this is for +// 8 bit image (.STI) files +// +void ShowCurrentSlotImage( HVOBJECT hVObj, INT32 iWindow ) +{ + SGPRect ClipRect, NewRect; + INT32 iStartX; + INT32 iStartY; + INT32 iPicHeight, iPicWidth; + INT16 sTempOffsetX; + INT16 sTempOffsetY; + ETRLEObject *pETRLEObject; + INT32 iWinWidth, iWinHeight; + + NewRect.iLeft = (iWindow == 0) ? (336) : (488); + NewRect.iTop = 211; + NewRect.iRight = (iWindow == 0) ? (485) : (637); + NewRect.iBottom = 399; + + iWinWidth = NewRect.iRight - NewRect.iLeft; + iWinHeight = NewRect.iBottom - NewRect.iTop; + + GetClippingRect(&ClipRect); + SetClippingRect(&NewRect); + + pETRLEObject = &(hVObj->pETRLEObject[0]); + + iPicWidth = (INT32)pETRLEObject->usWidth; + iPicHeight = (INT32)pETRLEObject->usHeight; + + iStartX = ( (iWinWidth - iPicWidth) / 2 ) + NewRect.iLeft; + iStartY = ( (iWinHeight - iPicHeight) / 2 ) + NewRect.iTop; + + // We have to store the offset data in temp variables before zeroing them and blitting + sTempOffsetX = pETRLEObject->sOffsetX; + sTempOffsetY = pETRLEObject->sOffsetY; + + // Set the offsets used for blitting to 0 + pETRLEObject->sOffsetX = 0; + pETRLEObject->sOffsetY = 0; + + SetObjectShade( hVObj, DEFAULT_SHADE_LEVEL ); + BltVideoObject( FRAME_BUFFER, hVObj, 0, (iStartX), (iStartY), + VO_BLT_SRCTRANSPARENCY, NULL); + + pETRLEObject->sOffsetX = sTempOffsetX; + pETRLEObject->sOffsetY = sTempOffsetY; + + SetClippingRect(&ClipRect); +} + +//---------------------------------------------------------------------------------------------- +// PlaceLight +// +// Creates and places a light of selected radius and color into the world. +// +BOOLEAN PlaceLight( INT16 sRadius, INT16 iMapX, INT16 iMapY, INT16 sType ) +{ + INT32 iLightHandle; + UINT8 ubIntensity; + STRING512 Filename; + INT32 iMapIndex; + UINT16 usTmpIndex; + + sprintf( Filename, "L-R%02d.LHT", sRadius ); + + // Attempt to create light + if ( (iLightHandle = LightSpriteCreate( Filename, sType )) == (-1) ) + { + // Couldn't load file because it doesn't exist. So let's make the file + ubIntensity = (UINT8)((float)sRadius / LIGHT_DECAY); + if ( (iLightHandle = LightCreateOmni( ubIntensity, sRadius )) == (-1) ) + { + // Can't create light template + DebugMsg(TOPIC_GAME, DBG_LEVEL_1, String("PlaceLight: Can't create light template for radius %d",sRadius) ); + return( FALSE ); + } + + if ( !LightSave( iLightHandle, Filename ) ) + { + // Can't save light template + DebugMsg(TOPIC_GAME, DBG_LEVEL_1, String("PlaceLight: Can't save light template for radius %d",sRadius) ); + return( FALSE ); + } + + if ( (iLightHandle = LightSpriteCreate( Filename, sType )) == (-1) ) + { + // Can't create sprite + DebugMsg(TOPIC_GAME, DBG_LEVEL_1, String("PlaceLight: Can't create light sprite of radius %d",sRadius) ); + return( FALSE ); + } + } + + if ( !LightSpritePower( iLightHandle, TRUE ) ) + { + // Can't turn this light on + DebugMsg(TOPIC_GAME, DBG_LEVEL_1, String("PlaceLight: Can't turn on light %d",iLightHandle) ); + return( FALSE ); + } + + if ( !LightSpritePosition( iLightHandle, iMapX, iMapY ) ) + { + // Can't set light's position + DebugMsg(TOPIC_GAME, DBG_LEVEL_1, String("PlaceLight: Can't set light position for light %d",iLightHandle) ); + return( FALSE ); + } + + switch( gbDefaultLightType ) + { + case PRIMETIME_LIGHT: + LightSprites[ iLightHandle ].uiFlags |= LIGHT_PRIMETIME; + break; + case NIGHTTIME_LIGHT: + LightSprites[ iLightHandle ].uiFlags |= LIGHT_NIGHTTIME; + break; + } + + iMapIndex = ((INT32)iMapY * WORLD_COLS) + (INT32)iMapX; + if ( !TypeExistsInObjectLayer( iMapIndex, GOODRING, &usTmpIndex ) ) + { + AddObjectToHead( iMapIndex, GOODRING1 ); + gpWorldLevelData[ iMapIndex ].pObjectHead->ubShadeLevel = DEFAULT_SHADE_LEVEL; + } + + AddLightToUndoList( iMapIndex, 0, 0 ); + + return( TRUE ); +} + + +//---------------------------------------------------------------------------------------------- +// RemoveLight +// +// Removes (erases) all lights at a given map tile location. Lights that are attached to a merc +// are not deleted. +// +// Returns TRUE if deleted the light, otherwise, returns FALSE. +// i.e. FALSE is not an error condition! +// +BOOLEAN RemoveLight( INT16 iMapX, INT16 iMapY ) +{ + INT32 iCount; + UINT16 cnt; + SOLDIERTYPE *pSoldier; + BOOLEAN fSoldierLight; + BOOLEAN fRemovedLight; + INT32 iMapIndex; + UINT32 uiLastLightType; + UINT8 *pLastLightName; + + fRemovedLight = FALSE; + + // Check all lights if any at this given position + for(iCount=0; iCount < MAX_LIGHT_SPRITES; iCount++) + { + if(LightSprites[iCount].uiFlags & LIGHT_SPR_ACTIVE) + { + if ( LightSprites[iCount].iX == iMapX && LightSprites[iCount].iY == iMapY ) + { + // Found a light, so let's see if it belong to a merc! + fSoldierLight = FALSE; + for ( cnt = 0; cnt < MAX_NUM_SOLDIERS && !fSoldierLight; cnt++ ) + { + if ( GetSoldier( &pSoldier, cnt ) ) + { + if ( pSoldier->iLight == iCount ) + fSoldierLight = TRUE; + } + } + + if ( !fSoldierLight ) + { + // Ok, it's not a merc's light so kill it! + pLastLightName = (UINT8 *) LightSpriteGetTypeName( iCount ); + uiLastLightType = LightSprites[iCount].uiLightType; + LightSpritePower( iCount, FALSE ); + LightSpriteDestroy( iCount ); + fRemovedLight = TRUE; + iMapIndex = ((INT32)iMapY * WORLD_COLS) + (INT32)iMapX; + RemoveAllObjectsOfTypeRange( iMapIndex, GOODRING, GOODRING ); + } + } + } + } + if( fRemovedLight ) + { + UINT16 usRadius; + //Assuming that the light naming convention doesn't change, then this following conversion + //should work. Basically, the radius values aren't stored in the lights, so I have pull + //the radius out of the filename. Ex: L-RO5.LHT + usRadius = pLastLightName[4] - 0x30; + AddLightToUndoList( iMapIndex, usRadius, (UINT8)uiLastLightType ); + } + + return( fRemovedLight ); +} + + +//---------------------------------------------------------------------------------------------- +// ShowLightPositionHandles +// +// For all lights that are in the world (except lights attached to mercs), this function places +// a marker at it's location for editing purposes. +// +void ShowLightPositionHandles( void ) +{ + INT32 iCount; + INT32 iMapIndex; + UINT16 cnt; + UINT16 usTmpIndex; + SOLDIERTYPE *pSoldier; + BOOLEAN fSoldierLight; + + // Check all lights and place a position handle there! + for(iCount=0; iCount < MAX_LIGHT_SPRITES; iCount++) + { + if(LightSprites[iCount].uiFlags & LIGHT_SPR_ACTIVE) + { + // Found a light, so let's see if it belong to a merc! + fSoldierLight = FALSE; + for ( cnt = 0; cnt < MAX_NUM_SOLDIERS && !fSoldierLight; cnt++ ) + { + if ( GetSoldier( &pSoldier, cnt ) ) + { + if ( pSoldier->iLight == iCount ) + fSoldierLight = TRUE; + } + } + + if ( !fSoldierLight ) + { + iMapIndex = ((INT32)LightSprites[iCount].iY * WORLD_COLS) + (INT32)LightSprites[iCount].iX; + if ( !TypeExistsInObjectLayer( iMapIndex, GOODRING, &usTmpIndex ) ) + { + AddObjectToHead( iMapIndex, GOODRING1 ); + gpWorldLevelData[ iMapIndex ].pObjectHead->ubShadeLevel = DEFAULT_SHADE_LEVEL; + } + } + } + } +} + + +//---------------------------------------------------------------------------------------------- +// RemoveLightPositionHandles +// +// Scans through all light currently in the world and removes any light markers that may be present. +// +void RemoveLightPositionHandles( void ) +{ + INT32 iCount; + INT32 iMapIndex; + UINT16 cnt; + SOLDIERTYPE *pSoldier; + BOOLEAN fSoldierLight; + + // Check all lights and remove the position handle there! + for(iCount=0; iCount < MAX_LIGHT_SPRITES; iCount++) + { + if(LightSprites[iCount].uiFlags & LIGHT_SPR_ACTIVE) + { + // Found a light, so let's see if it belong to a merc! + fSoldierLight = FALSE; + for ( cnt = 0; cnt < MAX_NUM_SOLDIERS && !fSoldierLight; cnt++ ) + { + if ( GetSoldier( &pSoldier, cnt ) ) + { + if ( pSoldier->iLight == iCount ) + fSoldierLight = TRUE; + } + } + + if ( !fSoldierLight ) + { + iMapIndex = ((INT32)LightSprites[iCount].iY * WORLD_COLS) + (INT32)LightSprites[iCount].iX; + RemoveAllObjectsOfTypeRange( iMapIndex, GOODRING, GOODRING ); + } + } + } +} + + +//---------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------- +// End of button callback functions +//---------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------------------------- +// CheckForSlantRoofs +// +// Verifies whether there are any slant roofs selected in the "multiwall" or "room" selection list. +// if so, and no flat roofs were selected, then we return TRUE, otherwise we return FALSE. +// +// This function is used to determine if we should force the area selection of rooms to handle +// slant roofs (which require at least one side to be exactly 8 tiles wide) +// +BOOLEAN CheckForSlantRoofs( void ) +{ + UINT16 usCheck; + + pSelList = SelRoom; + pNumSelList = &iNumRoomsSelected; + + usCheck = GetRandomIndexByRange( FIRSTROOF, LASTROOF ); + if ( usCheck != 0xffff ) + return( FALSE ); + + usCheck = GetRandomIndexByRange( FIRSTSLANTROOF, LASTSLANTROOF ); + return ( usCheck != 0xffff ); +} + + + +//---------------------------------------------------------------------------------------------- +// MapOptimize +// +// Runs through all map locations, and if it's outside the visible world, then we remove +// EVERYTHING from it since it will never be seen! +// +// If it can be seen, then we remove all extraneous land tiles. We find the tile that has the first +// FULL TILE indicator, and delete anything that may come after it (it'll never be seen anyway) +// +// Doing the above has shown to free up about 1.1 Megs on the default map. Deletion of non-viewable +// land pieces alone gained us about 600 K of memory. +// +void MapOptimize(void) +{ +#if 0 + INT16 gridno; + LEVELNODE *start, *head, *end, *node, *temp; + MAP_ELEMENT *pMapTile; + BOOLEAN fFound, fChangedHead, fChangedTail; + + for( gridno = 0; gridno < WORLD_MAX; gridno++ ) + { + if ( !GridNoOnVisibleWorldTile( gridno ) ) + { + // Tile isn't in viewable area so trash everything in it + TrashMapTile( gridno ); + } + else + { + // Tile is in viewable area so try to optimize any extra land pieces + pMapTile = &gpWorldLevelData[ gridno ]; + + node = start = pMapTile->pLandStart; + head = pMapTile->pLandHead; + + if ( start == NULL ) + node = start = head; + + end = pMapTile->pLandTail; + + fChangedHead = fChangedTail = fFound = FALSE; + while ( !fFound && node != NULL ) + { + if ( gTileDatabase[node->usIndex].ubFullTile == 1 ) + fFound = TRUE; + else + node = node->pNext; + } + + if(fFound) + { + // Delete everything up to the start node +/* +// Not having this means we still keep the smoothing + + while( head != start && head != NULL ) + { + fChangedHead = TRUE; + temp = head->pNext; + MemFree( head ); + head = temp; + if ( head ) + head->pPrev = NULL; + } +*/ + + // Now delete from the end to "node" + while( end != node && end != NULL ) + { + fChangedTail = TRUE; + temp = end->pPrev; + MemFree( end ); + end = temp; + if ( end ) + end->pNext = NULL; + } + + if ( fChangedHead ) + pMapTile->pLandHead = head; + + if ( fChangedTail ) + pMapTile->pLandTail = end; + } + } + } + +#endif +} + + + +//---------------------------------------------------------------------------------------------- +// CheckForFences +// +// Verifies whether the selection list has only fence pieces. If so, turns off random selection +// for that selection list. +// +// if ANY piece other than a fence piece exists in the selection list, then we want to keep +// random selections. +// +BOOLEAN CheckForFences( void ) +{ + UINT16 usCheck; + BOOLEAN fFence; + TILE_ELEMENT *T; + + pSelList = SelOStructs2; + pNumSelList = &iNumOStructs2Selected; + + fFence = TRUE; + + for ( usCheck = 0; usCheck < iNumOStructs2Selected; usCheck++ ) + { + T = &gTileDatabase[gTileTypeStartIndex[pSelList[usCheck].uiObject]]; + if ( T->pDBStructureRef == NULL ) + fFence = FALSE; + else if ( !(T->pDBStructureRef->pDBStructure->fFlags & STRUCTURE_ANYFENCE) ) + fFence = FALSE; + } + + return( fFence ); +} + +void EnsureStatusOfEditorButtons() +{ + if ( iDrawMode >= DRAW_MODE_ERASE ) + { + ClickEditorButton( TERRAIN_TOGGLE_ERASEMODE ); + ClickEditorButton( BUILDING_TOGGLE_ERASEMODE ); + ClickEditorButton( MAPINFO_TOGGLE_ERASEMODE ); + } + else + { + UnclickEditorButton( TERRAIN_TOGGLE_ERASEMODE ); + UnclickEditorButton( BUILDING_TOGGLE_ERASEMODE ); + UnclickEditorButton( MAPINFO_TOGGLE_ERASEMODE ); + } + + //disable erase buttons if drawing caves + if( iDrawMode == DRAW_MODE_CAVES || iDrawMode == DRAW_MODE_NEWROOF ) + DisableEditorButton( BUILDING_TOGGLE_ERASEMODE ); + else + EnableEditorButton( BUILDING_TOGGLE_ERASEMODE ); + + // Ensure that the fill button is on or off depending on our current mode + if ( iDrawMode == (DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA) ) + ClickEditorButton( TERRAIN_FILL_AREA ); + else + UnclickEditorButton( TERRAIN_FILL_AREA ); + + // Make sure that the fake-lighting button is down if appropriate + if ( gfFakeLights ) + ClickEditorButton( MAPINFO_TOGGLE_FAKE_LIGHTS ); + else + UnclickEditorButton( MAPINFO_TOGGLE_FAKE_LIGHTS ); +} + +void HandleMouseClicksInGameScreen() +{ + EXITGRID dummy={0,0,0,0}; + INT16 sX, sY; + BOOLEAN fPrevState; + if( !GetMouseXY( &sGridX, &sGridY ) ) + return; + if( iCurrentTaskbar == TASK_OPTIONS || iCurrentTaskbar == TASK_NONE ) + { //if in taskbar modes which don't process clicks in the world. + return; + } + if( !(gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) ) + { //if mouse cursor not in the game screen. + return; + } + + iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); + + fPrevState = gfRenderWorld; + + if( _LeftButtonDown ) + { + gfRenderWorld = TRUE; + // Are we trying to erase something? + if ( iDrawMode >= DRAW_MODE_ERASE ) + { + // Erasing can have a brush size larger than 1 tile + for ( sY = (INT16)gSelectRegion.iTop; sY <= (INT16)gSelectRegion.iBottom; sY++ ) + { + for ( sX = (INT16)gSelectRegion.iLeft; sX <= (INT16)gSelectRegion.iRight; sX++ ) + { + if ( iDrawMode == (DRAW_MODE_LIGHT + DRAW_MODE_ERASE) ) + { + RemoveLight( sX, sY ); + } + else + EraseMapTile( MAPROWCOLTOPOS( sY, sX ) ); + } + } + + if( iDrawMode == DRAW_MODE_LIGHT + DRAW_MODE_ERASE ) + LightSpriteRenderAll(); // To adjust building's lighting + return; + } + + switch ( iDrawMode ) + { + case DRAW_MODE_SCHEDULEACTION: + if( IsLocationSittableExcludingPeople( iMapIndex, FALSE ) ) + { + iDrawMode = DRAW_MODE_SCHEDULECONFIRM; + gfFirstPlacement = FALSE; + } + break; + case DRAW_MODE_NORTHPOINT: + case DRAW_MODE_WESTPOINT: + case DRAW_MODE_EASTPOINT: + case DRAW_MODE_SOUTHPOINT: + case DRAW_MODE_CENTERPOINT: + case DRAW_MODE_ISOLATEDPOINT: + SpecifyEntryPoint( iMapIndex ); + break; + + case DRAW_MODE_ENEMY: + case DRAW_MODE_CREATURE: + case DRAW_MODE_REBEL: + case DRAW_MODE_CIVILIAN: + // Handle adding mercs to the world + if( gfFirstPlacement ) + { + AddMercToWorld( iMapIndex ); + gfFirstPlacement = FALSE; + } + break; + + case DRAW_MODE_LIGHT: + // Add a normal light to the world + if( gfFirstPlacement ) + { + PlaceLight( gsLightRadius, sGridX, sGridY, 0 ); + gfFirstPlacement = FALSE; + } + break; + + case DRAW_MODE_SAW_ROOM: + case DRAW_MODE_ROOM: + case DRAW_MODE_CAVES: + if( gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION ) + ProcessAreaSelection( TRUE ); + break; + case DRAW_MODE_NEWROOF: + ReplaceBuildingWithNewRoof( iMapIndex ); + break; + + case DRAW_MODE_WALLS: PasteSingleWall( iMapIndex ); break; + case DRAW_MODE_DOORS: PasteSingleDoor( iMapIndex ); break; + case DRAW_MODE_WINDOWS: PasteSingleWindow( iMapIndex ); break; + case DRAW_MODE_ROOFS: PasteSingleRoof( iMapIndex ); break; + case DRAW_MODE_BROKEN_WALLS: PasteSingleBrokenWall( iMapIndex ); break; + case DRAW_MODE_DECOR: PasteSingleDecoration( iMapIndex ); break; + case DRAW_MODE_DECALS: + if( ValidDecalPlacement( iMapIndex ) ) + PasteSingleDecal( iMapIndex ); + break; + case DRAW_MODE_TOILET: PasteSingleToilet( iMapIndex ); break; + case DRAW_MODE_SMART_WALLS: PasteSmartWall( iMapIndex ); break; + case DRAW_MODE_SMART_DOORS: PasteSmartDoor( iMapIndex ); break; + case DRAW_MODE_SMART_WINDOWS: PasteSmartWindow( iMapIndex ); break; + case DRAW_MODE_SMART_BROKEN_WALLS: PasteSmartBrokenWall( iMapIndex ); break; + case DRAW_MODE_EXITGRID: + case DRAW_MODE_FLOORS: + case DRAW_MODE_GROUND: + case DRAW_MODE_OSTRUCTS: + case DRAW_MODE_OSTRUCTS1: + case DRAW_MODE_OSTRUCTS2: + case DRAW_MODE_DEBRIS: + if( gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION ) + { + DrawObjectsBasedOnSelectionRegion(); + } + else + gfRenderWorld = fPrevState; + break; + case DRAW_MODE_DOORKEYS: + InitDoorEditing( iMapIndex ); + break; + case DRAW_MODE_KILL_BUILDING: + KillBuilding( iMapIndex ); + break; + case DRAW_MODE_COPY_BUILDING: + case DRAW_MODE_MOVE_BUILDING: + if( gfFirstPlacement ) + { + CopyBuilding( iMapIndex ); + gfFirstPlacement = FALSE; + } + gfRenderWorld = fPrevState; + break; + case DRAW_MODE_BANKS: + PasteBanks( iMapIndex, gsBanksSubIndex, TRUE ); + break; + case DRAW_MODE_ROADS: + PasteRoads( iMapIndex ); + break; + case (DRAW_MODE_GROUND + DRAW_MODE_FILL_AREA): + TerrainFill( iMapIndex ); + //BeginFill( iMapIndex ); + break; + case DRAW_MODE_PLACE_ITEM: + if( gfFirstPlacement ) + { + AddSelectedItemToWorld( (UINT16)iMapIndex ); + gfFirstPlacement = FALSE; + } + break; + default: + gfRenderWorld = fPrevState; + break; + } + } + else if ( _RightButtonDown ) + { + gfRenderWorld = TRUE; + switch( iDrawMode ) + { + // Handle right clicking on a merc (for editing/moving him) + case DRAW_MODE_ENEMY: + case DRAW_MODE_CREATURE: + case DRAW_MODE_REBEL: + case DRAW_MODE_CIVILIAN: + HandleRightClickOnMerc( iMapIndex ); + break; + case DRAW_MODE_PLACE_ITEM: + HandleRightClickOnItem( (UINT16)iMapIndex ); + break; + + // Handle the right clicks in the main window to bring up the appropriate selection window + case DRAW_MODE_WALLS: iEditorToolbarState = TBAR_MODE_GET_WALL; break; + case DRAW_MODE_DOORS: iEditorToolbarState = TBAR_MODE_GET_DOOR; break; + case DRAW_MODE_WINDOWS: iEditorToolbarState = TBAR_MODE_GET_WINDOW; break; + case DRAW_MODE_ROOFS: iEditorToolbarState = TBAR_MODE_GET_ROOF; break; + case DRAW_MODE_BROKEN_WALLS: iEditorToolbarState = TBAR_MODE_GET_BROKEN_WALL; break; + case DRAW_MODE_DECOR: iEditorToolbarState = TBAR_MODE_GET_DECOR; break; + case DRAW_MODE_DECALS: iEditorToolbarState = TBAR_MODE_GET_DECAL; break; + case DRAW_MODE_FLOORS: iEditorToolbarState = TBAR_MODE_GET_FLOOR; break; + case DRAW_MODE_TOILET: iEditorToolbarState = TBAR_MODE_GET_TOILET; break; + + case DRAW_MODE_ROOM: iEditorToolbarState = TBAR_MODE_GET_ROOM; break; + case DRAW_MODE_NEWROOF: iEditorToolbarState = TBAR_MODE_GET_NEW_ROOF; break; + case DRAW_MODE_SLANTED_ROOF: iEditorToolbarState = TBAR_MODE_GET_ROOM; break; + case DRAW_MODE_DEBRIS: iEditorToolbarState = TBAR_MODE_GET_DEBRIS; break; + case DRAW_MODE_OSTRUCTS: iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS; break; + case DRAW_MODE_OSTRUCTS1: iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS1; break; + case DRAW_MODE_OSTRUCTS2: iEditorToolbarState = TBAR_MODE_GET_OSTRUCTS2; break; + case DRAW_MODE_BANKS: iEditorToolbarState = TBAR_MODE_GET_BANKS; break; + case DRAW_MODE_ROADS: iEditorToolbarState = TBAR_MODE_GET_ROADS; break; + + case DRAW_MODE_CAVES: + if( gusSelectionType >= SMALLSELECTION && gusSelectionType <= XLARGESELECTION ) + ProcessAreaSelection( FALSE ); + break; + + case DRAW_MODE_SMART_WALLS: + EraseWalls( iMapIndex ); + break; + case DRAW_MODE_SMART_BROKEN_WALLS: + case DRAW_MODE_SMART_WINDOWS: + case DRAW_MODE_SMART_DOORS: + RestoreWalls( iMapIndex ); + break; + case DRAW_MODE_EXITGRID: + if( GetExitGrid( (UINT16)iMapIndex, &gExitGrid ) ) + ApplyNewExitGridValuesToTextFields(); + break; + default: + gfRenderWorld = fPrevState; + break; + } + } + else if( !_LeftButtonDown && !gfFirstPlacement ) + { + switch( iDrawMode ) + { + case DRAW_MODE_SCHEDULECONFIRM: + if( IsLocationSittableExcludingPeople( iMapIndex, FALSE ) ) + { + RegisterCurrentScheduleAction( iMapIndex ); + } + break; + case DRAW_MODE_COPY_BUILDING: + PasteBuilding( iMapIndex ); + break; + case DRAW_MODE_MOVE_BUILDING: + MoveBuilding( iMapIndex ); + break; + } + } +} + +BOOLEAN DoIRenderASpecialMouseCursor() +{ + INT16 sMouseX_M, sMouseY_M; + + // Draw basic mouse + if ( GetMouseXY( &sMouseX_M, &sMouseY_M ) ) + { + if ( (gsCursorGridNo = MAPROWCOLTOPOS( sMouseY_M, sMouseX_M )) < 0x8000 ) + { + // Add basic cursor + //gBasicCursorNode = AddTopmostToTail( gsCursorGridNo, FIRSTPOINTERS1 ); + } + } + + if ( iCurrentTaskbar != TASK_OPTIONS ) + { + switch ( iDrawMode ) + { + case DRAW_MODE_OSTRUCTS2: + if(CheckForFences()) + fDontUseRandom = TRUE; + case DRAW_MODE_DEBRIS: // These only show if you first hit PGUP/PGDOWN keys + case DRAW_MODE_OSTRUCTS: + case DRAW_MODE_OSTRUCTS1: + if(!fDontUseRandom) + break; + case DRAW_MODE_BANKS: + case DRAW_MODE_ROADS: + case DRAW_MODE_WALLS: + case DRAW_MODE_DOORS: + case DRAW_MODE_WINDOWS: + case DRAW_MODE_ROOFS: + case DRAW_MODE_BROKEN_WALLS: + case DRAW_MODE_DECOR: + case DRAW_MODE_DECALS: + case DRAW_MODE_FLOORS: + case DRAW_MODE_TOILET: + + case DRAW_MODE_SMART_WALLS: + case DRAW_MODE_SMART_DOORS: + case DRAW_MODE_SMART_WINDOWS: + case DRAW_MODE_SMART_BROKEN_WALLS: + case DRAW_MODE_ROOM: + case DRAW_MODE_NEWROOF: + return DrawTempMouseCursorObject( ); + + default: + break; + } + } + return FALSE; +} + + +extern INT32 iEditorToolbarState; +extern INT32 iEditorToolbarLastWallState; + +void ShowEntryPoints() +{ + //make entry points visible + if( gMapInformation.sNorthGridNo != -1 ) + AddTopmostToTail( gMapInformation.sNorthGridNo, FIRSTPOINTERS2 ); + if( gMapInformation.sEastGridNo != -1 ) + AddTopmostToTail( gMapInformation.sEastGridNo, FIRSTPOINTERS2 ); + if( gMapInformation.sSouthGridNo != -1 ) + AddTopmostToTail( gMapInformation.sSouthGridNo, FIRSTPOINTERS2 ); + if( gMapInformation.sWestGridNo != -1 ) + AddTopmostToTail( gMapInformation.sWestGridNo, FIRSTPOINTERS2 ); +} + +void HideEntryPoints() +{ + //remove entry point indicators + if( gMapInformation.sNorthGridNo != -1 ) + RemoveAllTopmostsOfTypeRange( gMapInformation.sNorthGridNo, FIRSTPOINTERS, FIRSTPOINTERS ); + if( gMapInformation.sEastGridNo != -1 ) + RemoveAllTopmostsOfTypeRange( gMapInformation.sEastGridNo, FIRSTPOINTERS, FIRSTPOINTERS ); + if( gMapInformation.sSouthGridNo != -1 ) + RemoveAllTopmostsOfTypeRange( gMapInformation.sSouthGridNo, FIRSTPOINTERS, FIRSTPOINTERS ); + if( gMapInformation.sWestGridNo != -1 ) + RemoveAllTopmostsOfTypeRange( gMapInformation.sWestGridNo, FIRSTPOINTERS, FIRSTPOINTERS ); +} + +void TaskOptionsCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iTaskMode = TASK_OPTIONS; + } +} + +void TaskTerrainCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iTaskMode = TASK_TERRAIN; + } +} + +void TaskBuildingCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iTaskMode = TASK_BUILDINGS; + } +} + +void TaskItemsCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iTaskMode = TASK_ITEMS; + } +} + +void TaskMercsCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iTaskMode = TASK_MERCS; + } +} + +void TaskMapInfoCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + iTaskMode = TASK_MAPINFO; + } +} + +void ProcessAreaSelection( BOOLEAN fWithLeftButton ) +{ + BOOLEAN fPrevState = gfRenderWorld; + gfRenderWorld = TRUE; + switch( iDrawMode ) + { + case DRAW_MODE_ROOM: + case DRAW_MODE_SLANTED_ROOF: + AddBuildingSectionToWorld( &gSelectRegion ); + break; + case DRAW_MODE_SAW_ROOM: + RemoveBuildingSectionFromWorld( &gSelectRegion ); + break; + case DRAW_MODE_CAVES: + if( fWithLeftButton ) + AddCaveSectionToWorld( &gSelectRegion ); + else + RemoveCaveSectionFromWorld( &gSelectRegion ); + break; + case DRAW_MODE_ROOMNUM: + DrawObjectsBasedOnSelectionRegion(); + if( gubCurrRoomNumber > 0 ) + { + gubCurrRoomNumber++; + gubMaxRoomNumber++; + if( iCurrentTaskbar == TASK_BUILDINGS && TextInputMode() ) + { + UINT16 str[4]; + swprintf( str, L"%d", gubCurrRoomNumber ); + SetInputFieldStringWith16BitString( 1, str ); + SetActiveField( 0 ); + } + } + break; + case DRAW_MODE_EXITGRID: + case DRAW_MODE_FLOORS: + case DRAW_MODE_GROUND: + case DRAW_MODE_OSTRUCTS: + case DRAW_MODE_OSTRUCTS1: + case DRAW_MODE_OSTRUCTS2: + case DRAW_MODE_DEBRIS: + //These aren't normally supported by area selection, so + //call the equivalent function that is normally associated with them. + DrawObjectsBasedOnSelectionRegion(); + break; + default: + gfRenderWorld = fPrevState; + break; + } +} + +//For any drawing modes that support large cursors, or even area selection, this function calls the +//appropriate paste function for every gridno within the cursor. This is not used for functions that +//rely completely on selection areas, such as buildings. +void DrawObjectsBasedOnSelectionRegion() +{ + INT32 x, y, iMapIndex; + BOOLEAN fSkipTest; + + //Certain drawing modes are placed with 100% density. Those cases are checked here, + //so the density test can be skipped. + fSkipTest = FALSE; + if( gusSelectionType == SMALLSELECTION || + iDrawMode == DRAW_MODE_GROUND || + iDrawMode == DRAW_MODE_FLOORS || + iDrawMode == DRAW_MODE_ROOMNUM || + iDrawMode == DRAW_MODE_EXITGRID ) + fSkipTest = TRUE; + + //The reason why I process the region from top to bottom then to the right is + //to even out the binary tree undo placements. Otherwise, the placements within + //the undo binary tree would alway choose the right branch because the imapindex is + //always greater than the previously positioned one. + //Process the cursor area + for ( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ ) + { + //process the region from + for ( y = gSelectRegion.iTop; y <= (INT16)gSelectRegion.iBottom; y++ ) + { + if( fSkipTest || PerformDensityTest() ) + { + iMapIndex = MAPROWCOLTOPOS( y, x ); + switch( iDrawMode ) + { + case DRAW_MODE_EXITGRID: + AddToUndoList( iMapIndex ); + AddExitGridToWorld( iMapIndex, &gExitGrid ); + AddTopmostToTail( (UINT16)iMapIndex, FIRSTPOINTERS8 ); + break; + case DRAW_MODE_DEBRIS: PasteDebris( iMapIndex ); break; + case DRAW_MODE_FLOORS: PasteSingleFloor( iMapIndex ); break; + case DRAW_MODE_GROUND: PasteTexture( iMapIndex ); break; + case DRAW_MODE_OSTRUCTS: PasteStructure( iMapIndex ); break; + case DRAW_MODE_OSTRUCTS1: PasteStructure1( iMapIndex ); break; + case DRAW_MODE_OSTRUCTS2: PasteStructure2( iMapIndex ); break; + case DRAW_MODE_ROOMNUM: PasteRoomNumber( iMapIndex, gubCurrRoomNumber ); break; + default: return; //no point in continuing... + } + } + } + } +} + +extern void AutoLoadMap(); + +//The main loop of the editor. +UINT32 EditScreenHandle( void ) +{ + UINT32 uiRetVal; + BOOLEAN fShowingCursor; + StartFrameBufferRender(); + + if( gfWorldLoaded && gMapInformation.ubMapVersion <= 7 && !gfCorruptMap ) + { + ScreenMsg( FONT_MCOLOR_RED, MSG_ERROR, L"Map data has just been corrupted. Don't save, don't quit, get Kris! If he's not here, save the map using a temp filename and document everything you just did, especially your last action!" ); + gfCorruptMap = TRUE; + } + if( gfWorldLoaded && gubScheduleID > 40 && !gfCorruptSchedules ) + { + OptimizeSchedules(); + if( gubScheduleID > 32 ) + { + ScreenMsg( FONT_MCOLOR_RED, MSG_ERROR, L"Schedule data has just been corrupted. Don't save, don't quit, get Kris! If he's not here, save the map using a temp filename and document everything you just did, especially your last action!" ); + gfCorruptSchedules = TRUE; + } + } + + if( gfAutoLoadA9 == 2 ) + AutoLoadMap(); + + if ( fEditModeFirstTime ) + { + EditModeInit( ); + } + + if ( InOverheadMap( ) && !gfSummaryWindowActive ) + { + HandleOverheadMap( ); + } + + //Calculate general mouse information + GetMouseXY( &sGridX, &sGridY ); + iMapIndex = sGridY * WORLD_COLS + sGridX; + + DetermineUndoState(); + + fBeenWarned = FALSE; + + uiRetVal = EDIT_SCREEN; + + // Handle the bottom task bar menu. + DoTaskbar(); + + //Process the variety of popup menus, dialogs, etc. + + if( gubMessageBoxStatus ) + { + if( MessageBoxHandled( ) ) + return ProcessEditscreenMessageBoxResponse(); + return EDIT_SCREEN; + } + + if( ProcessPopupMenuIfActive() ) + return EDIT_SCREEN; + if ( fHelpScreen ) + return( WaitForHelpScreenResponse( ) ); + if ( fSelectionWindow ) + return( WaitForSelectionWindowResponse( ) ); + + // If editing mercs, handle that stuff + ProcessMercEditing(); + + EnsureStatusOfEditorButtons(); + + // Handle scrolling of the map if needed + if( !gfGotoGridNoUI && iDrawMode != DRAW_MODE_SHOW_TILESET && !gfSummaryWindowActive && + !gfEditingDoor && !gfNoScroll && !InOverheadMap() ) + ScrollWorld(); + + iCurrentAction = ACTION_NULL; + + UpdateCursorAreas(); + + HandleMouseClicksInGameScreen(); + + if( !gfFirstPlacement && !gfLeftButtonState ) + gfFirstPlacement = TRUE; + + //If we are copying or moving a building, we process, then delete the building layout immediately + //after releasing the mouse button. If released in the world, then the building would have been + //processed in above function, HandleMouseClicksInGameScreen(). + if( !_LeftButtonDown && gpBuildingLayoutList ) + DeleteBuildingLayout(); + + fShowingCursor = DoIRenderASpecialMouseCursor(); + + DequeAllGameEvents( TRUE ); + + if ( fBuildingShowRoomInfo ) + { + SetRenderFlags( RENDER_FLAG_ROOMIDS ); + } + + if ( gfRenderWorld ) + { + if( gCursorNode ) + gCursorNode->uiFlags &= (~LEVELNODE_REVEAL); + + // This flag is the beast that makes the renderer do everything + MarkWorldDirty(); + + gfRenderWorld = FALSE; + } + + // The default here for the renderer is to just do dynamic stuff... + if( !gfSummaryWindowActive && !gfEditingDoor && !InOverheadMap() ) + RenderWorld(); + + DisplayWayPoints(); + + if ( fShowingCursor ) + RemoveTempMouseCursorObject(); + + ProcessEditorRendering(); + + // Handle toolbar selections + HandleJA2ToolbarSelection( ); + + // Handle keyboard shortcuts / selections + HandleKeyboardShortcuts( ); + + // Perform action based on current selection + if ( (uiRetVal = PerformSelectedAction( )) != EDIT_SCREEN ) + return( uiRetVal ); + + // Display Framerate + DisplayFrameRate( ); + + // Handle video overlays, for FPS and screen message stuff + if ( gfScrollPending ) + { + AllocateVideoOverlaysArea( ); + SaveVideoOverlaysArea( FRAME_BUFFER ); + } + ExecuteVideoOverlays( ); + + ScrollString( ); + + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender( ); + + return( uiRetVal ); +} + +void CreateGotoGridNoUI() +{ + gfGotoGridNoUI = TRUE; + //Disable the rest of the editor + DisableEditorTaskbar(); + //Create the background panel. + guiGotoGridNoUIButtonID = + CreateTextButton( L"Enter gridno:", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT, + 290, 155, 60, 50, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MSYS_NO_CALLBACK ); + SpecifyDisabledButtonStyle( guiGotoGridNoUIButtonID, DISABLED_STYLE_NONE ); + SpecifyButtonTextOffsets( guiGotoGridNoUIButtonID, 5, 5, FALSE ); + DisableButton( guiGotoGridNoUIButtonID ); + //Create a blanket region so nobody can use + MSYS_DefineRegion( &GotoGridNoUIRegion, 0, 0, 640, 480, MSYS_PRIORITY_NORMAL+1, 0, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + //Init a text input field. + InitTextInputModeWithScheme( DEFAULT_SCHEME ); + AddTextInputField( 300, 180, 40, 18, MSYS_PRIORITY_HIGH, L"", 6, INPUTTYPE_NUMERICSTRICT ); +} + +void RemoveGotoGridNoUI() +{ + INT32 iMapIndex; + gfGotoGridNoUI = FALSE; + //Enable the rest of the editor + EnableEditorTaskbar(); + RemoveButton( guiGotoGridNoUIButtonID ); + iMapIndex = GetNumericStrictValueFromField( 0 ); + KillTextInputMode(); + MSYS_RemoveRegion( &GotoGridNoUIRegion ); + if( iMapIndex != -1 ) + { //Warp the screen to the location of this gridno. + CenterScreenAtMapIndex( iMapIndex ); + } + else + { + MarkWorldDirty(); + } +} + +void UpdateLastActionBeforeLeaving() +{ + if( iCurrentTaskbar == TASK_MERCS ) + IndicateSelectedMerc( SELECT_NO_MERC ); + SpecifyItemToEdit( NULL, -1 ); +} + +void ReloadMap() +{ + UINT16 szFilename[30]; + swprintf( szFilename, L"%S", gubFilename ); + ExternalLoadMap( szFilename ); +} + +#else //non-editor version + +#include "types.h" +#include "screenids.h" + +UINT32 EditScreenInit() +{ + return TRUE ; +} + +UINT32 EditScreenHandle( ) +{ + //If this screen ever gets set, then this is a bad thing -- endless loop + return ERROR_SCREEN ; +} + +UINT32 EditScreenShutdown( ) +{ + return TRUE ; +} + +#endif + + + + + + + diff --git a/Editor/editscreen.h b/Editor/editscreen.h new file mode 100644 index 00000000..9616d621 --- /dev/null +++ b/Editor/editscreen.h @@ -0,0 +1,83 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef EDITSCREEN_H +#define EDITSCREEN_H + +#include "Button System.h" + +#define EDITOR_LIGHT_MAX (SHADE_MIN + SHADE_MAX) +#define EDITOR_LIGHT_FAKE (EDITOR_LIGHT_MAX - SHADE_MAX - 2) + +extern BOOLEAN gfFakeLights; +extern GUI_BUTTON *gpPersistantButton; + +extern UINT16 GenericButtonFillColors[40]; + +void DisplayWayPoints(void); + +BOOLEAN CheckForSlantRoofs( void ); +BOOLEAN CheckForFences( void ); + +void ShowLightPositionHandles( void ); +void RemoveLightPositionHandles( void ); + +extern BOOLEAN DoWindowSelection( void ); +extern void RemoveTempMouseCursorObject(void); +extern BOOLEAN DrawTempMouseCursorObject(void); +extern void ShowCurrentDrawingMode( void ); +extern void ShowCurrentSlotImage( HVOBJECT hVObj, INT32 iWindow ); +extern void ShowCurrentSlotSurface( UINT32 hSurface, INT32 iWindow ); + +void CreateNewMap(); + +void DisplayTilesetPage(void); +void FindTilesetComments(void); +void GetMasterList(void); + +void HandleJA2ToolbarSelection( void ); +void HandleKeyboardShortcuts( ); +UINT32 PerformSelectedAction( void ); +UINT32 WaitForSelectionWindowResponse( void ); +UINT32 WaitForMessageBoxResponse( UINT32 uiCurrentScreen ); +UINT32 WaitForHelpScreenResponse( void ); + +BOOLEAN PlaceLight( INT16 sRadius, INT16 iMapX, INT16 iMapY, INT16 sType ); +BOOLEAN RemoveLight( INT16 iMapX, INT16 iMapY ); +extern BOOLEAN gfMercResetUponEditorEntry; + +void ShowEditorToolbar( INT32 iNewTaskMode ); +void HideEditorToolbar( INT32 iOldTaskMode ); + +void ProcessSelectionArea(); + +void MapOptimize(void); + +extern UINT16 GenericButtonFillColors[40]; + +//These go together. The taskbar has a specific color scheme. +extern UINT16 gusEditorTaskbarColor; +extern UINT16 gusEditorTaskbarHiColor; +extern UINT16 gusEditorTaskbarLoColor; + +extern INT32 iOldTaskMode; +extern INT32 iCurrentTaskbar; +extern INT32 iTaskMode; + +void ProcessAreaSelection( BOOLEAN fWithLeftButton ); + +void ShowEntryPoints(); +void HideEntryPoints(); + +extern BOOLEAN gfConfirmExitFirst; +extern BOOLEAN gfConfirmExitPending; +extern BOOLEAN gfIntendOnEnteringEditor; + +#endif +#endif + + + + + + diff --git a/Editor/messagebox.cpp b/Editor/messagebox.cpp new file mode 100644 index 00000000..5b98f334 --- /dev/null +++ b/Editor/messagebox.cpp @@ -0,0 +1,167 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "vobject.h" + #include "video.h" + #include "font.h" + #include "Font Control.h" + #include "messagebox.h" + #include "input.h" + #include "english.h" +#endif + +//internal variables. +INT32 iMsgBoxNum; +INT32 iMsgBoxOkImg, iMsgBoxCancelImg; +INT32 iMsgBoxBgrnd,iMsgBoxOk,iMsgBoxCancel; +SGPRect MsgBoxRect; + +BOOLEAN gfMessageBoxResult = FALSE; +UINT8 gubMessageBoxStatus = MESSAGEBOX_NONE; + +void MsgBoxOkClkCallback( GUI_BUTTON *butn, INT32 reason ); +void MsgBoxCnclClkCallback( GUI_BUTTON *butn, INT32 reason ); + +void CreateMessageBox( UINT16 *wzString ) +{ + INT16 sPixLen; + INT16 sStartX, sStartY; + + sPixLen = StringPixLength ( wzString, (UINT16)gpLargeFontType1 ) + 10; + if ( sPixLen > 600 ) + sPixLen = 600; + + sStartX = (640 - sPixLen) / 2; + sStartY = (480 - 96) / 2; + + gfMessageBoxResult = FALSE; + + // Fake button for background w/ text + iMsgBoxBgrnd = CreateTextButton( wzString, (UINT16)gpLargeFontType1, + FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT, sStartX, sStartY, + sPixLen, 96, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, + BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK); + DisableButton( iMsgBoxBgrnd ); + SpecifyDisabledButtonStyle( iMsgBoxBgrnd, DISABLED_STYLE_NONE ); + + iMsgBoxOkImg = LoadButtonImage("EDITOR//ok.sti",0,1,2,3,4); + iMsgBoxCancelImg = LoadButtonImage("EDITOR//cancel.sti",0,1,2,3,4); + + iMsgBoxOk = QuickCreateButton(iMsgBoxOkImg, (INT16)(sStartX + (sPixLen/2) - 35), (INT16)(sStartY + 58), + BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BUTTON_NO_CALLBACK, (GUI_CALLBACK)MsgBoxOkClkCallback); + + iMsgBoxCancel = QuickCreateButton(iMsgBoxCancelImg, (INT16)(sStartX + (sPixLen/2) + 5), (INT16)(sStartY + 58), + BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BUTTON_NO_CALLBACK, (GUI_CALLBACK)MsgBoxCnclClkCallback); + + MsgBoxRect.iLeft = sStartX; + MsgBoxRect.iTop = sStartY; + MsgBoxRect.iRight = sStartX + sPixLen; + MsgBoxRect.iBottom = sStartY + 96; + + RestrictMouseCursor( &MsgBoxRect ); + + gubMessageBoxStatus = MESSAGEBOX_WAIT; + +} + +BOOLEAN MessageBoxHandled() +{ + InputAtom DummyEvent; + + while( DequeueEvent( &DummyEvent ) ) + { + if ( DummyEvent.usEvent == KEY_DOWN ) + { + switch( DummyEvent.usParam ) + { + case ENTER: + case 'y': + case 'Y': + gubMessageBoxStatus = MESSAGEBOX_DONE; + gfMessageBoxResult = TRUE; + break; + case ESC: + case 'n': + case 'N': + gubMessageBoxStatus = MESSAGEBOX_DONE; + gfMessageBoxResult = FALSE; + break; + } + } + } + + if( gubMessageBoxStatus == MESSAGEBOX_DONE ) + { + while( DequeueEvent( &DummyEvent ) ) + continue; + } + MarkButtonsDirty(); + RenderButtons( ); +// InvalidateScreen( ); +// ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender( ); + return gubMessageBoxStatus == MESSAGEBOX_DONE; +} + +void RemoveMessageBox( ) +{ + FreeMouseCursor( ); + RemoveButton( iMsgBoxCancel ); + RemoveButton( iMsgBoxOk ); + RemoveButton( iMsgBoxBgrnd ); + UnloadButtonImage( iMsgBoxOkImg ); + UnloadButtonImage( iMsgBoxCancelImg ); + gubMessageBoxStatus = MESSAGEBOX_NONE; +} + + +//---------------------------------------------------------------------------------------------- +// Quick Message Box button callback functions. +//---------------------------------------------------------------------------------------------- + +void MsgBoxOkClkCallback( GUI_BUTTON *butn, INT32 reason ) +{ + if ( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) + { + butn->uiFlags |= BUTTON_CLICKED_ON; + } + else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gubMessageBoxStatus = MESSAGEBOX_DONE; + gfMessageBoxResult = TRUE; + } +} + +void MsgBoxCnclClkCallback( GUI_BUTTON *butn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + butn->uiFlags |= BUTTON_CLICKED_ON; + } + else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + gubMessageBoxStatus = MESSAGEBOX_DONE; + gfMessageBoxResult = FALSE; + } +} + +//---------------------------------------------------------------------------------------------- +// End of the quick message box callback functions +//---------------------------------------------------------------------------------------------- + + +#endif + + + + + + diff --git a/Editor/messagebox.h b/Editor/messagebox.h new file mode 100644 index 00000000..a3821a24 --- /dev/null +++ b/Editor/messagebox.h @@ -0,0 +1,51 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __MESSAGEBOX_H +#define __MESSAGEBOX_H + +enum +{ + MESSAGEBOX_NONE, + MESSAGEBOX_DONE, + MESSAGEBOX_WAIT +}; + +extern UINT8 gubMessageBoxStatus; +extern BOOLEAN gfMessageBoxResult; + +void CreateMessageBox( UINT16 *wzString ); +BOOLEAN MessageBoxHandled(); +void RemoveMessageBox(); + +//NOTES: +//Rewrote the damn thing. It is better now because you have less management issues. +//In your screen's main loop, instead of using the previous method, you would use the following syntax: +// +// if( gubMessageBoxState ) +// { +// if( MessageBoxHandled() ) +// return ProcessMyOwnMessageBoxResultHandler(); +// return MYCURRENT_SCREEN; +// } +// +// UINT32 ProcessMyOwnMessageBoxResultHandlerFunction() +// { +// RemoveMessageBox(); //MUST BE HERE +// if( gfMessageBoxResult ) //user selected yes +// { +// ... +// return DESIRED_SCREEN; +// } +// else //user selected no +// ... +// } + +#endif +#endif + + + + + + diff --git a/Editor/newsmooth.cpp b/Editor/newsmooth.cpp new file mode 100644 index 00000000..1369b3a4 --- /dev/null +++ b/Editor/newsmooth.cpp @@ -0,0 +1,1190 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include + #include "tiledef.h" + #include "worlddef.h" + #include "worldman.h" + #include "newsmooth.h" + #include "Isometric Utils.h" + #include "EditorBuildings.h" + #include "edit_sys.h" + #include "Smoothing Utils.h" + #include "Editor Undo.h" + #include "Structure Internals.h" + #include "environment.h" + #include "Random.h" + #include "Render Fun.h" +#endif + + +BOOLEAN CaveAtGridNo( INT32 iMapIndex ); +UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal ); +UINT8 CalcNewCavePerimeterValue( INT32 iMapIndex ); + +BOOLEAN CaveAtGridNo( INT32 iMapIndex ) +{ + STRUCTURE *pStruct; + LEVELNODE* pLevel; + if( iMapIndex < 0 || iMapIndex >= NOWHERE ) + return TRUE; + pStruct = gpWorldLevelData[ iMapIndex ].pStructureHead; + while( pStruct ) + { + if( pStruct->fFlags & STRUCTURE_CAVEWALL ) + { + return TRUE; + } + pStruct = pStruct->pNext; + } + //may not have structure information, so check if there is a levelnode flag. + pLevel = gpWorldLevelData[ iMapIndex ].pStructHead; + while( pLevel ) + { + if( pLevel->uiFlags & LEVELNODE_CAVE ) + { + return TRUE; + } + pLevel = pLevel->pNext; + } + return FALSE; +} + +UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal ) +{ + UINT16 usType = FIRSTWALL; + UINT16 usIndex; + UINT16 usTileIndex; + + switch( ubTotal ) + { + case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: + case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: case 0xf0: + //usIndex = 0; + //break; + return 0xffff; + case 0x01: case 0x11: case 0x21: case 0x31: case 0x41: case 0x51: case 0x61: case 0x71: + case 0x81: case 0x91: case 0xa1: case 0xb1: case 0xc1: case 0xd1: case 0xe1: case 0xf1: + usType = SECONDWALL; + usIndex = 1 + (UINT16)Random( 4 ); + break; + case 0x02: case 0x12: case 0x22: case 0x32: case 0x42: case 0x52: case 0x62: case 0x72: + case 0x82: case 0x92: case 0xa2: case 0xb2: case 0xc2: case 0xd2: case 0xe2: case 0xf2: + usType = SECONDWALL; + usIndex = 5 + (UINT16)Random( 4 ); + break; + case 0x03: case 0x13: case 0x43: case 0x53: case 0x83: case 0x93: case 0xc3: case 0xd3: + usIndex = 1; + break; + case 0x04: case 0x14: case 0x24: case 0x34: case 0x44: case 0x54: case 0x64: case 0x74: + case 0x84: case 0x94: case 0xa4: case 0xb4: case 0xc4: case 0xd4: case 0xe4: case 0xf4: + usType = SECONDWALL; + usIndex = 9 + (UINT16)Random( 4 ); + break; + case 0x05: case 0x15: case 0x25: case 0x35: case 0x45: case 0x55: case 0x65: case 0x75: + case 0x85: case 0x95: case 0xa5: case 0xb5: case 0xc5: case 0xd5: case 0xe5: case 0xf5: + usIndex = 2 + (UINT16)Random( 2 ); + break; + case 0x06: case 0x16: case 0x26: case 0x36: case 0x86: case 0x96: case 0xa6: case 0xb6: + usIndex = 4; + break; + case 0x07: case 0x17: case 0x87: case 0x97: + usIndex = 5; + break; + case 0x08: case 0x18: case 0x28: case 0x38: case 0x48: case 0x58: case 0x68: case 0x78: + case 0x88: case 0x98: case 0xa8: case 0xb8: case 0xc8: case 0xd8: case 0xe8: case 0xf8: + usType = SECONDWALL; + usIndex = 13 + (UINT16)Random( 4 ); + break; + case 0x09: case 0x29: case 0x49: case 0x69: case 0x89: case 0xa9: case 0xc9: case 0xe9: + usIndex = 6; + break; + case 0x0a: case 0x1a: case 0x2a: case 0x3a: case 0x4a: case 0x5a: case 0x6a: case 0x7a: + case 0x8a: case 0x9a: case 0xaa: case 0xba: case 0xca: case 0xda: case 0xea: case 0xfa: + usIndex = 7 + (UINT16)Random( 2 ); + break; + case 0x0b: case 0x4b: case 0x8b: case 0xcb: + usIndex = 9; + break; + case 0x0c: case 0x1c: case 0x2c: case 0x3c: case 0x4c: case 0x5c: case 0x6c: case 0x7c: + usIndex = 10; + break; + case 0x0d: case 0x2d: case 0x4d: case 0x6d: + usIndex = 11; + break; + case 0x0e: case 0x1e: case 0x2e: case 0x3e: + usIndex = 12; + break; + case 0x0f: + usIndex = 13; + break; + case 0x19: case 0x39: case 0x59: case 0x79: case 0x99: case 0xb9: case 0xd9: case 0xf9: + usIndex = 14 + (UINT16)Random( 2 ); + break; + case 0x1b: case 0x5b: case 0x9b: case 0xdb: + usIndex = 16; + break; + case 0x1d: case 0x3d: case 0x5d: case 0x7d: + usIndex = 17; + break; + case 0x1f: + usIndex = 18; + break; + case 0x23: case 0x33: case 0x63: case 0x73: case 0xa3: case 0xb3: case 0xe3: case 0xf3: + usIndex = 19 + (UINT16)Random( 2 ); + break; + case 0x27: case 0x37: case 0xa7: case 0xb7: + usIndex = 21; + break; + case 0x2b: case 0x6b: case 0xab: case 0xeb: + usIndex = 22; + break; + case 0x2f: + usIndex = 23; + break; + case 0x3b: case 0x7b: case 0xbb: case 0xfb: + usIndex = 24 + (UINT16)Random( 3 ); + break; + case 0x3f: + usIndex = 27; + break; + case 0x46: case 0x56: case 0x66: case 0x76: case 0xc6: case 0xd6: case 0xe6: case 0xf6: + usIndex = 28 + (UINT16)Random( 2 ); + break; + case 0x47: case 0x57: case 0xc7: case 0xd7: + usIndex = 30; + break; + case 0x4e: case 0x5e: case 0x6e: case 0x7e: + usIndex = 31; + break; + case 0x4f: + usIndex = 32; + break; + case 0x5f: + usIndex = 33; + break; + case 0x67: case 0x77: case 0xe7: case 0xf7: + usIndex = 34 + (UINT16)Random( 3 ); + break; + case 0x6f: + usIndex = 37; + break; + case 0x7f: + usIndex = 38 + (UINT16)Random( 2 ); + break; + case 0x8c: case 0x9c: case 0xac: case 0xbc: case 0xcc: case 0xdc: case 0xec: case 0xfc: + usIndex = 40 + (UINT16)Random( 2 ); + break; + case 0x8d: case 0xad: case 0xcd: case 0xed: + usIndex = 42; + break; + case 0x8e: case 0x9e: case 0xae: case 0xbe: + usIndex = 43; + break; + case 0x8f: + usIndex = 44; + break; + case 0x9d: case 0xbd: case 0xdd: case 0xfd: + usIndex = 45 + (UINT16)Random( 3 ); + break; + case 0x9f: + usIndex = 48; + break; + case 0xaf: + usIndex = 49; + break; + case 0xbf: + usIndex = 50 + (UINT16)Random( 2 ); + break; + case 0xce: case 0xde: case 0xee: case 0xfe: + usIndex = 52 + (UINT16)Random( 3 ); + break; + case 0xcf: + usIndex = 55; + break; + case 0xdf: + usIndex = 56 + (UINT16)Random( 2 ); + break; + case 0xef: + usIndex = 58 + (UINT16)Random( 2 ); + break; + case 0xff: + usIndex = 60 + (UINT16)Random( 6 ); + break; + } + GetTileIndexFromTypeSubIndex( usType, usIndex, &usTileIndex ); + return usTileIndex; +} + +// 16 | 1 | 32 +// ---+---+--- +// 8 | | 2 +// ---+---+--- +// 128| 4 | 64 +//These values are combined in any possible order ranging in +//values from 0 - 255. If there is a cave existing in any of +//these bordering gridnos, then the corresponding number is added +//to this total. The lookup table has been precalculated to know +//which piece to use for all of these combinations. In many cases, +//up to 16 combinations can share the same graphic image, as corners +//may not effect the look of the piece. +UINT8 CalcNewCavePerimeterValue( INT32 iMapIndex ) +{ + UINT8 ubTotal = 0; + if( CaveAtGridNo( iMapIndex - WORLD_COLS ) ) + ubTotal += 0x01; //north + if( CaveAtGridNo( iMapIndex + 1 ) ) + ubTotal += 0x02; //east + if( CaveAtGridNo( iMapIndex + WORLD_COLS ) ) + ubTotal += 0x04; //south + if( CaveAtGridNo( iMapIndex - 1 ) ) + ubTotal += 0x08; //west + if( CaveAtGridNo( iMapIndex - WORLD_COLS - 1 ) ) + ubTotal += 0x10; //north west + if( CaveAtGridNo( iMapIndex - WORLD_COLS + 1 ) ) + ubTotal += 0x20; //north east + if( CaveAtGridNo( iMapIndex + WORLD_COLS + 1 ) ) + ubTotal += 0x40; //south east + if( CaveAtGridNo( iMapIndex + WORLD_COLS - 1 ) ) + ubTotal += 0x80; //south west + return ubTotal; +} + +void AddCave( INT32 iMapIndex, UINT16 usIndex ) +{ + LEVELNODE *pStruct; + + if( iMapIndex < 0 || iMapIndex >= NOWHERE ) + return; + //First toast any existing wall (caves) + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + //Now, add this piece + if( !AddWallToStructLayer( iMapIndex, usIndex, TRUE ) ) + return; + //Set the cave flag + pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; + Assert( pStruct ); + pStruct->uiFlags |= LEVELNODE_CAVE; +} + +//These walls have shadows associated with them, and are draw when the wall is drawn. +#define EXTERIOR_L_SHADOW_INDEX 30 +#define INTERIOR_BOTTOMEND_SHADOW_INDEX 31 + +//Wall Look Up Table containing variants and indices with each row being a different walltype. +INT8 gbWallTileLUT[NUM_WALL_TYPES][7] = +{ +// The number of variants of this tile type. +// | The first relative index of the wall type (FIRSTWALL, SECONDWALL, etc. ) walltype + 10 +// | | The 2nd relative index ( walltype + 11 ) +// | | | 3rd 4th 5th 6th +// | | | | | | | + 6, 10, 11, 12, 27, 28, 29, //INTERIOR_L + 6, 7, 8, 9, 24, 25, 26, //INTERIOR_R + 6, 4, 5, 6, 21, 22, 23, //EXTERIOR_L + 6, 1, 2, 3, 18, 19, 20, //EXTERIOR_R + 1, 14, 0, 0, 0, 0, 0, //INTERIOR_CORNER + 1, 15, 0, 0, 0, 0, 0, //INTERIOR_BOTTOMEND + 1, 13, 0, 0, 0, 0, 0, //EXTERIOR_BOTTOMEND + 1, 16, 0, 0, 0, 0, 0, //INTERIOR_EXTENDED + 1, 57, 0, 0, 0, 0, 0, //EXTERIOR_EXTENDED + 1, 56, 0, 0, 0, 0, 0, //INTERIOR_EXTENDED_BOTTOMEND + 1, 17, 0, 0, 0, 0, 0, //EXTERIOR_EXTENDED_BOTTOMEND +}; + +//Roof table -- such a small table, using definitions instead. +#define TOP_ROOF_INDEX 2 +#define BOTTOM_ROOF_INDEX 4 +#define LEFT_ROOF_INDEX 1 +#define RIGHT_ROOF_INDEX 5 +#define TOPLEFT_ROOF_INDEX 3 +#define TOPRIGHT_ROOF_INDEX 7 +#define BOTTOMLEFT_ROOF_INDEX 8 +#define BOTTOMRIGHT_ROOF_INDEX 6 +#define CENTER_ROOF_BASE_INDEX 9 +#define CENTER_ROOF_VARIANTS 3 + +//slant roof table +#define THIN_BOTTOM 1 +#define THIN_TOP 2 +#define THIN_LEFT 5 +#define THIN_RIGHT 6 +#define THICK_BOTTOM 3 +#define THICK_TOP 4 +#define THICK_LEFT 7 +#define THICK_RIGHT 8 +#define VWALL_LEFT 32 +#define VWALL_RIGHT 33 +#define HWALL_LEFT 35 +#define HWALL_RIGHT 34 + + +#define FLOOR_VARIANTS 8 + +//PRIVATELY "ENCAPSULATED" FUNCTIONS + +//These construction functions do all the smoothing. +//NOTE: passing null for wall/roof type will force the function to search for the nearest +// existing respective type. +void BuildSlantRoof( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT16 usWallType, UINT16 usRoofType, BOOLEAN fVertical ); + +void BulldozeNature( UINT32 iMapIndex ); +void EraseRoof( UINT32 iMapIndex ); +void EraseFloor( UINT32 iMapIndex ); +void EraseBuilding( UINT32 iMapIndex ); +void EraseFloorOwnedBuildingPieces( UINT32 iMapIndex ); +void ConsiderEffectsOfNewWallPiece( UINT32 iMapIndex, UINT8 usWallOrientation ); + +//---------------------------------------------------------------------------------------------------- +//BEGIN IMPLEMENTATION OF PRIVATE FUNCTIONS +//---------------------------------------------------------------------------------------------------- + +void BuildSlantRoof( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT16 usWallType, UINT16 usRoofType, BOOLEAN fVertical ) +{ + INT32 i; + UINT16 usTileIndex; + INT32 iMapIndex; + if( fVertical ) + { + iMapIndex = iBottom * WORLD_COLS + iLeft; + //This happens to be the only mapindex that needs to be backed up. The rest have already been + //done because of the building code before this. + AddToUndoList( iMapIndex + 8 ); + //Add the closest viewable pieces. There are two aframe walls pieces, and extended aframe roof pieces. + GetTileIndexFromTypeSubIndex( usWallType, VWALL_LEFT, &usTileIndex ); + AddRoofToHead( iMapIndex + 4, usTileIndex ); + GetTileIndexFromTypeSubIndex( usWallType, VWALL_RIGHT, &usTileIndex ); + AddRoofToHead( iMapIndex + 8, usTileIndex ); + GetTileIndexFromTypeSubIndex( usRoofType, THICK_LEFT, &usTileIndex ); + AddRoofToHead( iMapIndex + 3, usTileIndex ); + GetTileIndexFromTypeSubIndex( usRoofType, THICK_RIGHT, &usTileIndex ); + AddRoofToHead( iMapIndex + 7, usTileIndex ); + for( i = iBottom - 1; i > iTop; i-- ) + { + iMapIndex -= WORLD_COLS; + GetTileIndexFromTypeSubIndex( usRoofType, THIN_LEFT, &usTileIndex ); + AddRoofToHead( iMapIndex + 3, usTileIndex ); + GetTileIndexFromTypeSubIndex( usRoofType, THIN_RIGHT, &usTileIndex ); + AddRoofToHead( iMapIndex + 7, usTileIndex ); + } + iMapIndex -= WORLD_COLS; + GetTileIndexFromTypeSubIndex( usRoofType, THICK_LEFT, &usTileIndex ); + AddRoofToHead( iMapIndex + 3, usTileIndex ); + GetTileIndexFromTypeSubIndex( usRoofType, THICK_RIGHT, &usTileIndex ); + AddRoofToHead( iMapIndex + 7, usTileIndex ); + } + else + { + iMapIndex = iTop * WORLD_COLS + iRight; + //This happens to be the only mapindex that needs to be backed up. The rest have already been + //done because of the building code before this. + AddToUndoList( iMapIndex + 8*WORLD_COLS ); + //Add the closest viewable pieces. There are two aframe walls pieces, and extended aframe roof pieces. + GetTileIndexFromTypeSubIndex( usWallType, HWALL_LEFT, &usTileIndex ); + AddRoofToHead( iMapIndex + 4*WORLD_COLS, usTileIndex ); + GetTileIndexFromTypeSubIndex( usWallType, HWALL_RIGHT, &usTileIndex ); + AddRoofToHead( iMapIndex + 8*WORLD_COLS, usTileIndex ); + GetTileIndexFromTypeSubIndex( usRoofType, THICK_TOP, &usTileIndex ); + AddRoofToHead( iMapIndex + 3*WORLD_COLS, usTileIndex ); + GetTileIndexFromTypeSubIndex( usRoofType, THICK_BOTTOM, &usTileIndex ); + AddRoofToHead( iMapIndex + 7*WORLD_COLS, usTileIndex ); + for( i = iRight - 1; i > iLeft; i-- ) + { + iMapIndex--; + GetTileIndexFromTypeSubIndex( usRoofType, THIN_TOP, &usTileIndex ); + AddRoofToHead( iMapIndex + 3*WORLD_COLS, usTileIndex ); + GetTileIndexFromTypeSubIndex( usRoofType, THIN_BOTTOM, &usTileIndex ); + AddRoofToHead( iMapIndex + 7*WORLD_COLS, usTileIndex ); + } + iMapIndex--; + GetTileIndexFromTypeSubIndex( usRoofType, THICK_TOP, &usTileIndex ); + AddRoofToHead( iMapIndex + 3*WORLD_COLS, usTileIndex ); + GetTileIndexFromTypeSubIndex( usRoofType, THICK_BOTTOM, &usTileIndex ); + AddRoofToHead( iMapIndex + 7*WORLD_COLS, usTileIndex ); + } +} + +UINT16 PickAWallPiece( UINT16 usWallPieceType ) +{ + UINT16 usVariants; + UINT16 usVariantChosen; + UINT16 usWallPieceChosen = 0; + if( usWallPieceType >= 0 || usWallPieceType < NUM_WALL_TYPES ) + { + usVariants = gbWallTileLUT[ usWallPieceType ][ 0 ]; + usVariantChosen = ( rand() % usVariants ) + 1; + usWallPieceChosen = gbWallTileLUT[ usWallPieceType ][ usVariantChosen ]; + } + return usWallPieceChosen; +} + +//From a given gridNo and perspective (wallpiece), it will calculate the new piece, and +//where to place it as well as handle the special cases. +//NOTE: Placing top and left pieces are placed relative to the gridno, and the gridNo will +// shift accordingly to place the piece. Pretend you are the floor, and you want to place a piece to +// the left. You pass your position, and INTERIOR_LEFT, with interior meaning from the inside of a +// building. If you were outside the building, you would call EXTERIOR_LEFT. The left tile will be +// placed on gridNo - 1! Up tiles will be placed on gridNo - 160. +//NOTE: Passing NULL for usWallType will force it to calculate the closest existing wall type, and +// use that for building this new wall. It is necessary for restructuring a building, but not for +// adding on to an existing building, where the type is already known. +void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType ) +{ + INT16 sIndex; + UINT16 usTileIndex; + UINT16 ubWallClass; + LEVELNODE *pStruct; + if( !usWallType ) + { + usWallType = SearchForWallType( iMapIndex ); + } + switch( ubWallPiece ) + { + case EXTERIOR_TOP: + iMapIndex -= WORLD_COLS; + //exterior bottom left corner generated + if ( !gfBasement && GetVerticalWall( iMapIndex - 1) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1) ) + { //Special case where a shadow has to be created as it now is a bottom corner and + //must contribute to the bottom shadow. + AddToUndoList( iMapIndex - 1 ); + GetTileIndexFromTypeSubIndex( usWallType, INTERIOR_BOTTOMEND_SHADOW_INDEX, &usTileIndex ); + AddExclusiveShadow( iMapIndex - 1, usTileIndex ); + } + if ( pStruct = GetVerticalWall( iMapIndex ) ) //right corner + { //Special case where placing the new wall will generate a corner to the right, so replace + //the vertical piece with a bottomend. + sIndex = PickAWallPiece( EXTERIOR_BOTTOMEND ); + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex ); + ReplaceStructIndex( iMapIndex, pStruct->usIndex, usTileIndex ); + } + ubWallClass = EXTERIOR_L; + if( !gfBasement ) + { + //All exterior_l walls have shadows. + GetTileIndexFromTypeSubIndex( usWallType, EXTERIOR_L_SHADOW_INDEX, &usTileIndex ); + AddExclusiveShadow( iMapIndex, usTileIndex ); + } + break; + case EXTERIOR_BOTTOM: + ubWallClass = INTERIOR_L; + if( (pStruct = GetVerticalWall( iMapIndex + WORLD_COLS - 1 )) && !GetVerticalWall( iMapIndex - 1) ) + { + sIndex = PickAWallPiece( INTERIOR_EXTENDED ); + AddToUndoList( iMapIndex + WORLD_COLS - 1 ); + GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex ); + ReplaceStructIndex( iMapIndex + WORLD_COLS - 1, pStruct->usIndex, usTileIndex ); + } + break; + case EXTERIOR_LEFT: + iMapIndex--; + ubWallClass = EXTERIOR_R; + if( GetHorizontalWall( iMapIndex ) ) + { //Special case where placing the new wall will generate a corner. This piece + //becomes an exterior bottomend, but nothing else is effected. + ubWallClass = EXTERIOR_BOTTOMEND; + } + if( GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) ) + { + if( ubWallClass == EXTERIOR_BOTTOMEND ) + ubWallClass = EXTERIOR_EXTENDED_BOTTOMEND; + else + ubWallClass = EXTERIOR_EXTENDED; + } + break; + case EXTERIOR_RIGHT: + ubWallClass = INTERIOR_R; + if( GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) && !GetHorizontalWall( iMapIndex - WORLD_COLS ) ) + { + ubWallClass = INTERIOR_EXTENDED; + } + else if( GetHorizontalWall( iMapIndex ) && !GetVerticalWall( iMapIndex + WORLD_COLS ) ) + { + ubWallClass = INTERIOR_BOTTOMEND; + } + break; + case INTERIOR_TOP: + iMapIndex -= WORLD_COLS; + ubWallClass = INTERIOR_L; + //check for a lower left corner. + if( pStruct = GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) ) + { //Replace the piece with an extended piece. + sIndex = PickAWallPiece( INTERIOR_EXTENDED ); + AddToUndoList( iMapIndex + WORLD_COLS - 1 ); + GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex ); + ReplaceStructIndex( iMapIndex + WORLD_COLS - 1, pStruct->usIndex, usTileIndex ); + //NOTE: Not yet checking for interior extended bottomend! + } + if( pStruct = GetVerticalWall( iMapIndex ) ) + { + sIndex = PickAWallPiece( INTERIOR_BOTTOMEND ); + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex ); + ReplaceStructIndex( iMapIndex, pStruct->usIndex, usTileIndex ); + } + break; + case INTERIOR_BOTTOM: + ubWallClass = EXTERIOR_L; + if( pStruct = GetVerticalWall( iMapIndex ) ) //right corner + { //Special case where placing the new wall will generate a corner to the right, so replace + //the vertical piece with a bottomend. + sIndex = PickAWallPiece( EXTERIOR_BOTTOMEND ); + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex ); + ReplaceStructIndex( iMapIndex, pStruct->usIndex, usTileIndex ); + } + if( (pStruct = GetVerticalWall( iMapIndex + WORLD_COLS - 1 )) && !GetVerticalWall( iMapIndex - 1) ) + { + sIndex = PickAWallPiece( EXTERIOR_EXTENDED ); + AddToUndoList( iMapIndex + WORLD_COLS - 1 ); + GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex ); + ReplaceStructIndex( iMapIndex + WORLD_COLS - 1, pStruct->usIndex, usTileIndex ); + } + if( !gfBasement ) + { + //All exterior_l walls have shadows. + GetTileIndexFromTypeSubIndex( usWallType, EXTERIOR_L_SHADOW_INDEX, &usTileIndex ); + AddExclusiveShadow( iMapIndex, usTileIndex ); + } + break; + case INTERIOR_LEFT: + iMapIndex--; + ubWallClass = INTERIOR_R; + if( GetHorizontalWall( iMapIndex ) ) + { + ubWallClass = INTERIOR_BOTTOMEND; + } + if( !gfBasement && GetHorizontalWall( iMapIndex + 1 ) ) + { + AddToUndoList( iMapIndex ); + GetTileIndexFromTypeSubIndex( usWallType, INTERIOR_BOTTOMEND_SHADOW_INDEX, &usTileIndex ); + AddExclusiveShadow( iMapIndex, usTileIndex ); + } + if( GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) ) + { + if( ubWallClass == INTERIOR_BOTTOMEND ) + ubWallClass = INTERIOR_EXTENDED_BOTTOMEND; + else + ubWallClass = INTERIOR_EXTENDED; + } + break; + case INTERIOR_RIGHT: + ubWallClass = EXTERIOR_R; + if( GetHorizontalWall( iMapIndex ) ) + { //Special case where placing the new wall will generate a corner. This piece + //becomes an exterior bottomend, but nothing else is effected. + ubWallClass = EXTERIOR_BOTTOMEND; + } + if( GetHorizontalWall( iMapIndex - WORLD_COLS + 1 ) ) + { + if( ubWallClass == EXTERIOR_BOTTOMEND ) + ubWallClass = EXTERIOR_EXTENDED_BOTTOMEND; + else + ubWallClass = EXTERIOR_EXTENDED; + } + if( !gfBasement && GetHorizontalWall( iMapIndex + 1 ) && !GetHorizontalWall( iMapIndex ) + && !FloorAtGridNo( iMapIndex + WORLD_COLS ) ) + { + GetTileIndexFromTypeSubIndex( usWallType, INTERIOR_BOTTOMEND_SHADOW_INDEX, &usTileIndex ); + AddExclusiveShadow( iMapIndex, usTileIndex ); + } + break; + } + sIndex = PickAWallPiece( ubWallClass ); + GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex ); + AddToUndoList( iMapIndex ); + AddWallToStructLayer( iMapIndex, usTileIndex, FALSE ); +} + +void RebuildRoofUsingFloorInfo( INT32 iMapIndex, UINT16 usRoofType ) +{ + UINT16 usRoofIndex, usTileIndex; + BOOLEAN fTop = FALSE, fBottom = FALSE, fLeft = FALSE, fRight = FALSE; + if( !usRoofType ) + { + usRoofType = SearchForRoofType( iMapIndex ); + } + if( usRoofType == 0xffff ) + return; //no roof type around, so don't draw one. + //Analyse the mapindex for walls and set the flags. + //NOTE: There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT + AddToUndoList( iMapIndex ); + EraseRoof( iMapIndex ); + + fTop = FloorAtGridNo( iMapIndex - WORLD_COLS ) ? FALSE : TRUE; + fLeft = FloorAtGridNo( iMapIndex - 1 ) ? FALSE : TRUE; + fBottom = FloorAtGridNo( iMapIndex + WORLD_COLS ) ? FALSE : TRUE; + fRight = FloorAtGridNo( iMapIndex + 1 ) ? FALSE : TRUE; + if( fTop && fLeft ) usRoofIndex = TOPLEFT_ROOF_INDEX; + else if( fTop && fRight) usRoofIndex = TOPRIGHT_ROOF_INDEX; + else if( fBottom && fLeft ) usRoofIndex = BOTTOMLEFT_ROOF_INDEX; + else if( fBottom && fRight ) usRoofIndex = BOTTOMRIGHT_ROOF_INDEX; + else if( fTop ) usRoofIndex = TOP_ROOF_INDEX; + else if( fBottom ) usRoofIndex = BOTTOM_ROOF_INDEX; + else if( fLeft ) usRoofIndex = LEFT_ROOF_INDEX; + else if( fRight ) usRoofIndex = RIGHT_ROOF_INDEX; + else usRoofIndex = CENTER_ROOF_BASE_INDEX + ( rand() % CENTER_ROOF_VARIANTS ); + GetTileIndexFromTypeSubIndex( usRoofType, usRoofIndex, &usTileIndex ); + AddRoofToHead( iMapIndex, usTileIndex ); + //if the editor view roofs is off, then the new roofs need to be hidden. + if( !fBuildingShowRoofs ) + { + HideStructOfGivenType( iMapIndex, usRoofType, TRUE ); + } +} + +//Given a gridno, it will erase the current roof, and calculate the new roof piece based on the +//wall orientions giving priority to the top and left walls before anything else. +//NOTE: passing NULL for usRoofType will force the function to calculate the nearest roof type, +// and use that for the new roof. This is needed when erasing parts of multiple buildings simultaneously. +void RebuildRoof( UINT32 iMapIndex, UINT16 usRoofType ) +{ + UINT16 usRoofIndex, usTileIndex; + BOOLEAN fTop, fBottom, fLeft, fRight; + if( !usRoofType ) + { + usRoofType = SearchForRoofType( iMapIndex ); + } + if( usRoofType == 0xffff ) + return; //no roof type around, so don't draw one. + //Analyse the mapindex for walls and set the flags. + //NOTE: There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT + AddToUndoList( iMapIndex ); + EraseRoof( iMapIndex ); + + fTop = GetHorizontalWall( iMapIndex - WORLD_COLS ) ? TRUE : FALSE; + fLeft = GetVerticalWall( iMapIndex - 1 ) ? TRUE : FALSE; + fBottom = GetHorizontalWall( iMapIndex ) ? TRUE : FALSE; + fRight = GetVerticalWall( iMapIndex ) ? TRUE : FALSE; + if( fTop && fLeft ) usRoofIndex = TOPLEFT_ROOF_INDEX; + else if( fTop && fRight) usRoofIndex = TOPRIGHT_ROOF_INDEX; + else if( fBottom && fLeft ) usRoofIndex = BOTTOMLEFT_ROOF_INDEX; + else if( fBottom && fRight ) usRoofIndex = BOTTOMRIGHT_ROOF_INDEX; + else if( fTop ) usRoofIndex = TOP_ROOF_INDEX; + else if( fBottom ) usRoofIndex = BOTTOM_ROOF_INDEX; + else if( fLeft ) usRoofIndex = LEFT_ROOF_INDEX; + else if( fRight ) usRoofIndex = RIGHT_ROOF_INDEX; + else usRoofIndex = CENTER_ROOF_BASE_INDEX + ( rand() % CENTER_ROOF_VARIANTS ); + GetTileIndexFromTypeSubIndex( usRoofType, usRoofIndex, &usTileIndex ); + AddRoofToHead( iMapIndex, usTileIndex ); + //if the editor view roofs is off, then the new roofs need to be hidden. + if( !fBuildingShowRoofs ) + { + HideStructOfGivenType( iMapIndex, usRoofType, TRUE ); + } +} + +void BulldozeNature( UINT32 iMapIndex ) +{ + AddToUndoList( iMapIndex ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTISTRUCT,LASTISTRUCT ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTCLIFFSHADOW, LASTCLIFFSHADOW ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTOSTRUCT,LASTOSTRUCT ); //outside objects. + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTSHADOW,LASTSHADOW ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTROAD, LASTROAD ); + RemoveAllObjectsOfTypeRange( iMapIndex, DEBRISROCKS, LASTDEBRIS ); + RemoveAllObjectsOfTypeRange( iMapIndex, ANOTHERDEBRIS, ANOTHERDEBRIS ); +} + +void EraseRoof( UINT32 iMapIndex ) +{ + AddToUndoList( iMapIndex ); + RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); + RemoveAllOnRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTROOF, LASTSLANTROOF ); +} + +void EraseFloor( UINT32 iMapIndex ) +{ + AddToUndoList( iMapIndex ); + RemoveAllLandsOfTypeRange( iMapIndex, FIRSTFLOOR, LASTFLOOR ); +} + +void EraseWalls( UINT32 iMapIndex ) +{ + AddToUndoList( iMapIndex ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTDOORSHADOW, LASTDOORSHADOW ); + RemoveAllObjectsOfTypeRange( iMapIndex, DEBRISROCKS, LASTDEBRIS ); + RemoveAllTopmostsOfTypeRange( iMapIndex, WIREFRAMES, WIREFRAMES ); + RemoveAllObjectsOfTypeRange( iMapIndex, DEBRIS2MISC, DEBRIS2MISC ); + RemoveAllObjectsOfTypeRange( iMapIndex, ANOTHERDEBRIS, ANOTHERDEBRIS ); +} + +void EraseBuilding( UINT32 iMapIndex ) +{ + EraseRoof( iMapIndex ); + EraseFloor( iMapIndex ); + EraseWalls( iMapIndex ); + gubWorldRoomInfo[ iMapIndex ] = 0; +} + +//Specialized function that will delete only the TOP_RIGHT oriented wall in the gridno to the left +//and the TOP_LEFT oriented wall in the gridno up one as well as the other building information at this +//gridno. +void EraseFloorOwnedBuildingPieces( UINT32 iMapIndex ) +{ + LEVELNODE *pStruct = NULL; + UINT32 uiTileType; + UINT16 usWallOrientation; + + if( !gfBasement && !FloorAtGridNo( iMapIndex ) ) + { //We don't have ownership issues if there isn't a floor here. + return; + } + EraseBuilding( iMapIndex ); + //FIRST, SEARCH AND DESTROY FOR A LEFT NEIGHBORING TILE WITH A TOP_RIGHT ORIENTED WALL + pStruct = gpWorldLevelData[ iMapIndex - 1 ].pStructHead; + while( pStruct != NULL ) + { + if ( pStruct->usIndex != NO_TILE ) + { + GetTileType( pStruct->usIndex, &uiTileType ); + if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL || + uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + GetWallOrientation( pStruct->usIndex, &usWallOrientation ); + if( usWallOrientation == INSIDE_TOP_RIGHT || usWallOrientation == OUTSIDE_TOP_RIGHT ) + { + AddToUndoList( iMapIndex - 1 ); + RemoveStruct( iMapIndex - 1, pStruct->usIndex ); + RemoveAllShadowsOfTypeRange( iMapIndex - 1, FIRSTWALL, LASTWALL ); + break; //otherwise, it'll crash because pStruct is toast. + } + } + } + pStruct = pStruct->pNext; + } + //FINALLY, SEARCH AND DESTROY FOR A TOP NEIGHBORING TILE WITH A TOP_LEFT ORIENTED WALL + pStruct = gpWorldLevelData[ iMapIndex - WORLD_COLS ].pStructHead; + while( pStruct != NULL ) + { + if ( pStruct->usIndex != NO_TILE ) + { + GetTileType( pStruct->usIndex, &uiTileType ); + if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL || + uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR ) + { + GetWallOrientation( pStruct->usIndex, &usWallOrientation ); + if( usWallOrientation == INSIDE_TOP_LEFT || usWallOrientation == OUTSIDE_TOP_LEFT ) + { + AddToUndoList( iMapIndex - WORLD_COLS ); + RemoveStruct( iMapIndex - WORLD_COLS , pStruct->usIndex ); + RemoveAllShadowsOfTypeRange( iMapIndex - WORLD_COLS, FIRSTWALL, LASTWALL ); + break; //otherwise, it'll crash because pStruct is toast. + } + } + } + pStruct = pStruct->pNext; + } +} + +/* +BOOLEAN CaveAtGridNo( INT32 iMapIndex ); +UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal ); +UINT8 CalcNewCavePerimeterValue( INT32 iMapIndex ); +void AddCave( INT32 iMapIndex, UINT16 usIndex ); +*/ + +void RemoveCaveSectionFromWorld( SGPRect *pSelectRegion ) +{ + UINT32 top, left, right, bottom, x, y; + UINT32 iMapIndex; + UINT16 usIndex; + UINT8 ubPerimeterValue; + top = pSelectRegion->iTop; + left = pSelectRegion->iLeft; + right = pSelectRegion->iRight; + bottom = pSelectRegion->iBottom; + //Pass 1: Remove all pieces in area + for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + AddToUndoList( iMapIndex ); + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + } + //Past 2: Go around outside perimeter and smooth each piece + for( y = top - 1; y <= bottom + 1; y++ ) for( x = left - 1; x <= right + 1; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + if( CaveAtGridNo( iMapIndex ) ) + { + ubPerimeterValue = CalcNewCavePerimeterValue( iMapIndex ); + usIndex = GetCaveTileIndexFromPerimeterValue( ubPerimeterValue ); + AddToUndoList( iMapIndex ); + if( usIndex != 0xffff ) + AddCave( iMapIndex, usIndex ); + else + { //change piece to stalagmite... + RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL ); + } + } + } +} + +void AddCaveSectionToWorld( SGPRect *pSelectRegion ) +{ + INT32 top, left, right, bottom, x, y; + UINT32 uiMapIndex; + UINT16 usIndex; + UINT8 ubPerimeterValue; + top = pSelectRegion->iTop; + left = pSelectRegion->iLeft; + right = pSelectRegion->iRight; + bottom = pSelectRegion->iBottom; + //Pass 1: Add bogus piece to each gridno in region + for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) + { + uiMapIndex = y * WORLD_COLS + x; + if( uiMapIndex < NOWHERE ) + { + usIndex = GetCaveTileIndexFromPerimeterValue( 0xff ); + AddToUndoList( uiMapIndex ); + AddCave( uiMapIndex, usIndex ); + } + } + //Past 2: Go around outside perimeter and smooth each piece + for( y = top - 1; y <= bottom + 1; y++ ) for( x = left - 1; x <= right + 1; x++ ) + { + uiMapIndex = y * WORLD_COLS + x; + if( uiMapIndex < NOWHERE ) + { + if( CaveAtGridNo( uiMapIndex ) ) + { + ubPerimeterValue = CalcNewCavePerimeterValue( uiMapIndex ); + usIndex = GetCaveTileIndexFromPerimeterValue( ubPerimeterValue ); + AddToUndoList( uiMapIndex ); + if( usIndex != 0xffff ) + AddCave( uiMapIndex, usIndex ); + else + { //change piece to stalagmite... + RemoveAllStructsOfTypeRange( uiMapIndex, FIRSTWALL, LASTWALL ); + } + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +// END OF PRIVATE FUNCTION IMPLEMENTATION +//-------------------------------------------------------------------------------------------------- + + + +//-------------------------------------------------------------------------------------------------- +// BEGIN PUBLIC FUNCTION IMPLEMENTATION +//-------------------------------------------------------------------------------------------------- + +//When the user removes a section from a building, it will not only erase the +//entire highlighted area, it'll repair the building itself so there are no +//outside walls missing from the new building. +void RemoveBuildingSectionFromWorld( SGPRect *pSelectRegion ) +{ + UINT32 top, left, right, bottom, x, y; + UINT32 iMapIndex; + UINT16 usTileIndex; + UINT16 usFloorType; + BOOLEAN fFloor; + + top = pSelectRegion->iTop; + left = pSelectRegion->iLeft; + right = pSelectRegion->iRight; + bottom = pSelectRegion->iBottom; + + //1ST PASS: Erase all building owned by the floor tile if there is one. + for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + EraseFloorOwnedBuildingPieces( iMapIndex ); //Erase possible top and left walls in bordering tiles. + } + //2ND PASS: Build new walls whereever there are neighboring floor tiles. + for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + //NOTE: Top and bottom walls MUST be placed first -- it minimizes the number of special cases. + if( y == top ) + { + fFloor = FloorAtGridNo( iMapIndex - WORLD_COLS ); + if( gfBasement && !fFloor || !gfBasement && fFloor && !GetHorizontalWall( iMapIndex - WORLD_COLS ) ) + BuildWallPiece( iMapIndex, EXTERIOR_TOP, 0 ); + } + if( y == bottom ) + { + fFloor = FloorAtGridNo( iMapIndex + WORLD_COLS ); + if( gfBasement && !fFloor || !gfBasement && fFloor && !GetHorizontalWall( iMapIndex ) ) + BuildWallPiece( iMapIndex, EXTERIOR_BOTTOM, 0 ); + } + if( x == left ) + { + fFloor = FloorAtGridNo( iMapIndex - 1 ); + if( gfBasement && !fFloor || !gfBasement && fFloor && !GetVerticalWall( iMapIndex - 1 ) ) + BuildWallPiece( iMapIndex, EXTERIOR_LEFT, 0 ); + } + if( x == right ) + { + fFloor = FloorAtGridNo( iMapIndex + 1); + if( gfBasement && !fFloor || !gfBasement && fFloor && !GetVerticalWall( iMapIndex ) ) + BuildWallPiece( iMapIndex, EXTERIOR_RIGHT, 0 ); + } + } + //3RD PASS: Go around the outside of the region, and rebuild the roof. + if( gfBasement ) + { + usFloorType = GetRandomIndexByRange( FIRSTFLOOR, LASTFLOOR ); + if( usFloorType == 0xffff ) + usFloorType = FIRSTFLOOR; + for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + GetTileIndexFromTypeSubIndex( usFloorType, 1, &usTileIndex ); + AddLandToHead( iMapIndex, (UINT16)( usTileIndex + Random( FLOOR_VARIANTS ) ) ); + } + } + for( y = top - 1; y <= bottom + 1; y++ ) for( x = left - 1; x <= right + 1; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + if( y == top - 1 || y == bottom + 1 || x == left - 1 || x == right + 1 ) + { + if( !gfBasement && FloorAtGridNo( iMapIndex ) || gfBasement && !FloorAtGridNo( iMapIndex ) ) + { + RebuildRoof( iMapIndex, 0 ); + } + } + } +} + +void AddBuildingSectionToWorld( SGPRect *pSelectRegion ) +{ + INT32 top, left, right, bottom, x, y; + UINT32 iMapIndex; + UINT16 usFloorType, usWallType, usRoofType; + UINT16 usTileIndex; + BOOLEAN fNewBuilding; + BOOLEAN fSlantRoof = FALSE; + BOOLEAN fVertical; + BOOLEAN fFloor; + top = pSelectRegion->iTop; + left = pSelectRegion->iLeft; + right = pSelectRegion->iRight; + bottom = pSelectRegion->iBottom; + + //Special case scenario: + //If the user selects a floor without walls, then it is implied that the user wishes to + //change the floor for say a kitchen which might have a different floor type. + usWallType = GetRandomIndexByRange( FIRSTWALL, LASTWALL ); + usFloorType = GetRandomIndexByRange( FIRSTFLOOR, LASTFLOOR ); + if( usWallType == 0xffff && usFloorType != 0xffff ) + { //allow user to place floors + for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + EraseFloor( iMapIndex ); + GetTileIndexFromTypeSubIndex( usFloorType, 1, &usTileIndex ); + AddLandToHead( iMapIndex, (UINT16)( usTileIndex + Random( FLOOR_VARIANTS ) ) ); + } + //we are done! + return; + } + + //1ST PASS: Determine if there are any floor tiles in this region. If there are, then + // that signifies that we are concantenating this building to an existing one. Otherwise, + // we are just drawing an individual building. If we find a floor, extract the type so + // we know how to draw it later. + fNewBuilding = TRUE; + for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + if( FloorAtGridNo( iMapIndex ) ) + { + LEVELNODE *pFloor; + UINT32 uiTileType; + //If a floor is found, then we are adding to an existing structure. + fNewBuilding = FALSE; + //Extract the floor type. We already checked if there was a floor here, so it is assumed. + pFloor = gpWorldLevelData[ iMapIndex ].pLandHead; + while( pFloor ) + { + GetTileType( pFloor->usIndex, &uiTileType ); + if( uiTileType >= FIRSTFLOOR && uiTileType <= LASTFLOOR ) + { + usFloorType = (UINT16)uiTileType; + break; + } + } + usWallType = SearchForWallType( iMapIndex ); + usRoofType = SearchForRoofType( iMapIndex ); + if( usWallType != 0xffff && usRoofType != 0xffff && usFloorType !=0xffff ) + { //we have extracted all of the information we need, so we can break out. + y = bottom; + break; + } + } + } + + if( fNewBuilding ) + { + //if( gfBasement ) + // return; + //Get materials via selection window method. + usWallType = GetRandomIndexByRange( FIRSTWALL, LASTWALL ); + usFloorType = GetRandomIndexByRange( FIRSTFLOOR, LASTFLOOR ); + usRoofType = GetRandomIndexByRange( FIRSTROOF, LASTROOF ); + if( usRoofType == 0xffff ) + { + usRoofType = GetRandomIndexByRange( FIRSTSLANTROOF, LASTSLANTROOF ); + if( usRoofType != 0xffff ) + { + if( !gfBasement ) + fSlantRoof = TRUE; + else + usRoofType = FIRSTROOF; + } + } + if( usWallType == 0xffff ) + return; + } + + //2ND PASS: Remove all walls in the region that border no floor tile, or simply walls + // that are considered exterior walls. That way, it won't wreck the inside of a building + // if you select too much interior. Also, gridnos that delete walls will also delete the + // floor and roof tiles there. That signifies that the floorless parts will be resmoothed, + // and rebuilt in the third pass. + for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + if( gfBasement ) + { + EraseBuilding( iMapIndex ); + } + else if( FloorAtGridNo( iMapIndex ) && !fNewBuilding) + { + if( y >= top && !FloorAtGridNo( iMapIndex - WORLD_COLS ) ) + { + EraseHorizontalWall( iMapIndex - WORLD_COLS ); + EraseFloor( iMapIndex ); + EraseRoof( iMapIndex ); + } + if( y <= bottom && !FloorAtGridNo( iMapIndex + WORLD_COLS ) ) + { + EraseHorizontalWall( iMapIndex ); + EraseFloor( iMapIndex ); + EraseRoof( iMapIndex ); + } + if( x >= left && !FloorAtGridNo( iMapIndex - 1 ) ) + { + EraseVerticalWall( iMapIndex - 1 ); + EraseFloor( iMapIndex ); + EraseRoof( iMapIndex ); + } + if( x <= right && !FloorAtGridNo( iMapIndex + 1 ) ) + { + EraseVerticalWall( iMapIndex ); + EraseFloor( iMapIndex ); + EraseRoof( iMapIndex ); + } + } + else //we will be building outside of this structure, so bulldoze the nature -- trees, rocks, etc. + { + BulldozeNature( iMapIndex ); + } + } + //3RD PASS: Process the region, and all walls of floorless tiles are rebuilt from interior perspective. + for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + if( !FloorAtGridNo( iMapIndex ) ) + { + if( y == top && !GetHorizontalWall( iMapIndex - WORLD_COLS ) ) + { + fFloor = FloorAtGridNo( iMapIndex - WORLD_COLS ); + if( gfBasement == fFloor ) + BuildWallPiece( iMapIndex, INTERIOR_TOP, usWallType); + } + if( y == bottom && !GetHorizontalWall( iMapIndex ) ) + { + fFloor = FloorAtGridNo( iMapIndex + WORLD_COLS ); + if( gfBasement == fFloor ) + BuildWallPiece( iMapIndex, INTERIOR_BOTTOM, usWallType ); + } + if( x == left && !GetVerticalWall( iMapIndex - 1 ) ) + { + fFloor = FloorAtGridNo( iMapIndex - 1 ); + if( gfBasement == fFloor ) + BuildWallPiece( iMapIndex, INTERIOR_LEFT, usWallType ); + } + if( x == right && !GetVerticalWall( iMapIndex ) ) + { + fFloor = FloorAtGridNo( iMapIndex + 1 ); + if( gfBasement == fFloor ) + BuildWallPiece( iMapIndex, INTERIOR_RIGHT, usWallType ); + } + } + } + + //If we are dealing with slant roofs then build the whole thing now. + //Slant roofs always have a width or height of 8 tiles. + if( fSlantRoof ) + { + fVertical = (bottom - top == 7) ? FALSE : TRUE; + BuildSlantRoof( left, top, right, bottom, usWallType, usRoofType, fVertical ); + } + + //4TH PASS: Process the region, and all floorless tiles get new roofs and floors. + for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ ) + { + iMapIndex = y * WORLD_COLS + x; + if( !FloorAtGridNo( iMapIndex ) ) + { + if( !fSlantRoof ) + RebuildRoof( iMapIndex, usRoofType ); + if( usFloorType != 0xffff && !gfBasement ) + { + GetTileIndexFromTypeSubIndex( usFloorType, 1, &usTileIndex ); + AddLandToHead( iMapIndex, (UINT16)( usTileIndex + Random( FLOOR_VARIANTS ) ) ); + } + } + } +} + +void AnalyseCaveMapForStructureInfo() +{ + LEVELNODE *pStruct; + UINT32 uiTileType; + INT32 iMapIndex; + for( iMapIndex = 0; iMapIndex < WORLD_MAX; iMapIndex++ ) + { + pStruct = gpWorldLevelData[ iMapIndex ].pStructHead; + while( pStruct ) + { + if ( pStruct->usIndex != NO_TILE ) + { + GetTileType( pStruct->usIndex, &uiTileType ); + if( uiTileType == FIRSTWALL ) + { + UINT16 usSubIndex; + GetSubIndexFromTileIndex( pStruct->usIndex, &usSubIndex ); + if( usSubIndex >= 60 && usSubIndex <= 65 ) + { + pStruct->uiFlags |= LEVELNODE_CAVE; + } + } + } + pStruct = pStruct->pNext; + } + } +} + +#endif + + + + + + diff --git a/Editor/newsmooth.h b/Editor/newsmooth.h new file mode 100644 index 00000000..03ed2789 --- /dev/null +++ b/Editor/newsmooth.h @@ -0,0 +1,28 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __NEWSMOOTH_H +#define __NEWSMOOTH_H + +void AddBuildingSectionToWorld( SGPRect *pSelectRegion ); +void RemoveBuildingSectionFromWorld( SGPRect *pSelectRegion ); + +void AddCaveSectionToWorld( SGPRect *pSelectRegion ); +void RemoveCaveSectionFromWorld( SGPRect *pSelectRegion ); + +void EraseBuilding( UINT32 iMapIndex ); +void RebuildRoof( UINT32 iMapIndex, UINT16 usRoofType ); +void RebuildRoofUsingFloorInfo( INT32 iMapIndex, UINT16 usRoofType ); + +void AddCave( INT32 iMapIndex, UINT16 usIndex ); + +void AnalyseCaveMapForStructureInfo(); + +#endif +#endif + + + + + + diff --git a/Editor/popupmenu.cpp b/Editor/popupmenu.cpp new file mode 100644 index 00000000..9e2a1802 --- /dev/null +++ b/Editor/popupmenu.cpp @@ -0,0 +1,497 @@ +//FUNCTIONALITY: +//This popup menu functions IDENTICALLY to Windows95's methodology. You can use the arrow keys, or the +//mouse in two methods. The first method is where you release the mouse button before +//moving the cursor inside the popup menu, which makes it persistant (it won't go away until you click again), +//or non-persistant, where you release the button inside the menu after your initial click (non-persistant). +//IMPORTANT NOTE: +//Linda Currie, the main user of the editor dislikes the non-persistant functionality, however, it is still +//supported. Just remove the commented line of code (search for UNCOMMENT), and it's fixed -- it is +//currently disabled. + +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "tiledef.h" + #include "sysutil.h" + #include "font.h" + #include "Font Control.h" + #include "line.h" + #include "worlddat.h" + #include "selectwin.h" + #include "popupmenu.h" + #include "EditorDefines.h" + #include "render dirty.h" + #include "debug.h" + #include "mousesystem.h" + #include "cursors.h" + #include "overhead types.h" + #include "EditorMercs.h" + #include "Scheduling.h" + #include "english.h" + #include "Item Statistics.h" +#endif + +CurrentPopupMenuInformation gPopup; + +MOUSE_REGION popupRegion; + +UINT16 gusEntryHeight; +BOOLEAN fWaitingForLButtonRelease = FALSE; + +extern UINT16 gszScheduleActions[ NUM_SCHEDULE_ACTIONS ][20]; + +//Finds the string for any popup menu in JA2 -- the strings are stored +//in different ways in each instance. +INT16* GetPopupMenuString( UINT8 ubIndex ) +{ + switch( gPopup.ubPopupMenuID ) + { + case CHANGETSET_POPUP: //tile sets + return gTilesets[ ubIndex ].zName; + case OWNERSHIPGROUP_POPUP: //civilian groups + case CHANGECIVGROUP_POPUP: //civilian groups + return (INT16 *)gszCivGroupNames[ ubIndex ]; + case SCHEDULEACTION_POPUP: //setting scheduling actions + return (INT16 *)gszScheduleActions[ ubIndex ]; + case ACTIONITEM_POPUP: + return (INT16 *)gszActionItemDesc[ ubIndex ]; + default: + return 0; + } +} +/* +InitPopUpMenu +--------------- +Creates the popup menu, then takes control of the i/o +effectively turning the popup into a modal system (forcing the +user to make a selection or cancel before doing anything else. +There are two modes of operation as soon as the user presses the mouse +on a popup menu activation button. + 1) The user releases the mouse before moving the cursor onto + the popup region. The popup menu will end as soon as the + user presses the mouse button. If the cursor is out of the + popup region, then it returns 0. + 2) The user holds the mouse while moving the cursor onto the + popup region. The popup menu will end as soon as the user + releases the mouse button. If the cursor is out of the popup + region, then it returns 0. + + +Returns 0 if nothing in menu was selected, else +returns the menu entry number starting from 1. +*/ + +void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection ) +{ + UINT16 usX, usY; + UINT16 usMenuHeight; + UINT16 usMenuWidth = 0; + UINT16 usCurrStrWidth; + UINT8 ubColumn, ubEntry; + UINT8 ubCounter; + GUI_BUTTON *button; + //calculate the location of the menu based on the button position. + //This also calculates the menu's direction based on position. + + gPopup.usFont = (UINT16)SMALLFONT1; + gusEntryHeight = GetFontHeight( gPopup.usFont ); + + button = ButtonList[ iButtonID ]; + MSYS_DisableRegion( &gBottomPanalRegion ); + + switch( ubDirection ) + { + case DIR_UPRIGHT: + usX = button->Area.RegionTopLeftX; + usY = button->Area.RegionTopLeftY; + break; + case DIR_UPLEFT: + usX = button->Area.RegionBottomRightX; + usY = button->Area.RegionTopLeftY; + break; + case DIR_DOWNRIGHT: + usX = button->Area.RegionTopLeftX; + usY = button->Area.RegionBottomRightY; + break; + case DIR_DOWNLEFT: + usX = button->Area.RegionBottomRightX; + usY = button->Area.RegionBottomRightY; + break; + } + + //Decipher the popupMenuID + switch( ubPopupMenuID ) + { + case CHANGETSET_POPUP: //change tileset + gPopup.ubNumEntries = NUM_TILESETS; + break; + case OWNERSHIPGROUP_POPUP: + case CHANGECIVGROUP_POPUP: + gPopup.ubNumEntries = NUM_CIV_GROUPS; + break; + case SCHEDULEACTION_POPUP: + gPopup.ubNumEntries = NUM_SCHEDULE_ACTIONS; + break; + case ACTIONITEM_POPUP: + gPopup.ubNumEntries = NUM_ACTIONITEMS; + break; + default: + return; + } + + gPopup.usFont = (UINT16)SMALLFONT1; + gusEntryHeight = GetFontHeight( gPopup.usFont ); + + button = ButtonList[ iButtonID ]; + MSYS_DisableRegion( &gBottomPanalRegion ); + + gPopup.ubPopupMenuID = ubPopupMenuID; + gPopup.ubSelectedIndex = 0; + gPopup.ubActiveType = POPUP_ACTIVETYPE_NOT_YET_DETERMINED; + gPopup.fActive = TRUE; + fWaitingForLButtonRelease = FALSE; + gPopup.fUseKeyboardInfoUntilMouseMoves = FALSE; + //Initialize the last mouse position to be out of bounds. + gPopup.usLastMouseX = 1000; + gPopup.usLastMouseY = 1000; + //clear the column widths. + for( ubColumn = 0; ubColumn < MAX_COLUMNS; ubColumn++ ) + gPopup.ubColumnWidth[ ubColumn ] = 0; + + //1) Calc total entry height of the popup region. + gPopup.ubColumns = 1; + gPopup.ubMaxEntriesPerColumn = gPopup.ubNumEntries; + usMenuHeight = gPopup.ubNumEntries * gusEntryHeight + 3; + while( usMenuHeight >= usY && ( ubDirection == DIR_UPLEFT || ubDirection == DIR_UPRIGHT ) || + 480-usMenuHeight >= usY && ( ubDirection == DIR_DOWNLEFT || ubDirection == DIR_DOWNRIGHT ) ) + { //menu has too many entries. Increase the number of columns until the height is + //less than the max height. + gPopup.ubMaxEntriesPerColumn = (gPopup.ubNumEntries+gPopup.ubColumns)/(gPopup.ubColumns+1); + usMenuHeight = gPopup.ubMaxEntriesPerColumn * gusEntryHeight + 3; + gPopup.ubColumns++; + } + //now we have the number of columns as well as the max number of entries per column, and + //the total menu height. + + //We now calculate the total width of the menu as well as the max width of each column. + ubCounter = 0; + usMenuWidth = 0; + for( ubColumn = 0; ubColumn < gPopup.ubColumns; ubColumn++ ) + { + for( ubEntry = 0; ubEntry < gPopup.ubMaxEntriesPerColumn; ubEntry++ ) + { + if( ubCounter >= gPopup.ubNumEntries ) + break; //done (don't want to process undefined entries...) + usCurrStrWidth = 16 + StringPixLength( GetPopupMenuString( ubCounter ) , gPopup.usFont ); + if( usCurrStrWidth > gPopup.ubColumnWidth[ ubColumn ] ) + { + gPopup.ubColumnWidth[ ubColumn ] = (UINT8)usCurrStrWidth; + } + ubCounter++; + } + usMenuWidth += gPopup.ubColumnWidth[ ubColumn ]; + } + + //Calculate popup menu boundaries based on direction from argument point. + switch( ubDirection ) + { + case DIR_UPRIGHT: + gPopup.usLeft = usX; + gPopup.usTop = usY - usMenuHeight - 1; + gPopup.usRight = usX + usMenuWidth; + gPopup.usBottom = usY - 1; + break; + case DIR_UPLEFT: + gPopup.usLeft = usX - usMenuWidth; + gPopup.usTop = usY - usMenuHeight - 1; + gPopup.usRight = usX; + gPopup.usBottom = usY - 1; + break; + case DIR_DOWNRIGHT: + gPopup.usLeft = usX; + gPopup.usTop = usY + 1; + gPopup.usRight = usX + usMenuWidth; + gPopup.usBottom = usY + usMenuHeight + 1; + break; + case DIR_DOWNLEFT: + gPopup.usLeft = usX - usMenuWidth; + gPopup.usTop = usY + 1; + gPopup.usRight = usX; + gPopup.usBottom = usY + usMenuHeight + 1; + break; + } + MSYS_DefineRegion( &popupRegion, 0, 0, 640, 480, MSYS_PRIORITY_HIGHEST, + CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + + RenderPopupMenu(); +} + +void RenderPopupMenu() +{ + UINT16 usX, usY; + UINT8 ubColumn, ubEntry, ubCounter; + UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT16 usLineColor; + UINT16 usStringWidth; + UINT16 usStart; + + //Draw the menu + ColorFillVideoSurfaceArea(FRAME_BUFFER, + gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, + Get16BPPColor(FROMRGB(128, 128, 128) ) ); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 ); + usLineColor = Get16BPPColor( FROMRGB( 64, 64, 64 ) ); + RectangleDraw( TRUE, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom, + usLineColor, pDestBuf ); + if( gPopup.ubColumns > 1 ) + { //draw a vertical line between each column + usStart = gPopup.usLeft + gPopup.ubColumnWidth[ 0 ]; + for( ubColumn = 1; ubColumn < gPopup.ubColumns; ubColumn++ ) + { + LineDraw( TRUE, usStart, gPopup.usTop, usStart, gPopup.usBottom, usLineColor, pDestBuf ); + } + usStart += (UINT16)gPopup.ubColumnWidth[ ubColumn ]; + } + UnLockVideoSurface( FRAME_BUFFER ); + + //Set up the text attributes. + SetFont( gPopup.usFont); + SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( FONT_MCOLOR_WHITE ); + + usX = gPopup.usLeft + 1; + ubCounter = 0; + usStart = gPopup.usLeft; + for( ubColumn = 0; ubColumn < gPopup.ubColumns; ubColumn++ ) + { + for( ubEntry = 0; ubEntry < gPopup.ubMaxEntriesPerColumn; ubEntry++ ) + { + if( ubCounter >= gPopup.ubNumEntries ) + return; //done + //Calc current string's width in pixels. Adding 14 pixels which is the width of + //two padded gPopup.usFont spaces not stored in the string. + usStringWidth = 14 + StringPixLength( GetPopupMenuString( ubCounter ), gPopup.usFont ); + //Horizontally center the string inside the popup menu + usX = usStart + ( gPopup.ubColumnWidth[ ubColumn ] - usStringWidth ) / 2; + usY = gPopup.usTop + 1 + ubEntry * gusEntryHeight; + if( ubCounter == gPopup.ubSelectedIndex - 1 ) + { + //This is the highlighted menu entry. + SetFontForeground( FONT_MCOLOR_LTBLUE ); + mprintf( usX, usY, L" %s ", GetPopupMenuString( ubCounter ) ); + SetFontForeground( FONT_MCOLOR_WHITE ); + } + else + { + mprintf( usX, usY, L" %s ", GetPopupMenuString( ubCounter ) ); + } + ubCounter++; + } + usStart += gPopup.ubColumnWidth[ ubColumn ]; + } +} + +//This private function of PopupMenuHandle determines which menu entry +//is highlighted based on the mouse cursor position. Returns 0 if the +//mouse is out of the menu region. +UINT8 GetPopupIndexFromMousePosition() +{ + UINT8 ubNumEntriesDown; + UINT16 usRelX; + UINT8 ubCount; + if( gusMouseXPos >= gPopup.usLeft + && gusMouseXPos <= gPopup.usRight + && gusMouseYPos > gPopup.usTop //one pixel gap on top ignored + && gusMouseYPos < gPopup.usBottom - 2 ) //two pixel gap on bottom ignored + { + //subtract the top y coord of the popup region from the mouse's yPos as well + //as an extra pixel at the top of the region which is ignored in menu selection, + //divide this number by the height of a menu entry, then add one. This will + //return the menu index from 1 (at the top) to n (at the bottom). + ubNumEntriesDown = (gusMouseYPos - gPopup.usTop - 1) / gusEntryHeight + 1; + usRelX = gusMouseXPos - gPopup.usLeft; + ubCount=0; + while( usRelX > gPopup.ubColumnWidth[ ubCount ] ) + { + usRelX -= gPopup.ubColumnWidth[ ubCount ]; + ubCount++; + ubNumEntriesDown += gPopup.ubMaxEntriesPerColumn; + } + if( ubNumEntriesDown >= gPopup.ubNumEntries ) + ubNumEntriesDown = gPopup.ubNumEntries; + return ubNumEntriesDown; + } + return 0; //mouse not in valid region. +} + +void PopupMenuHandle() +{ + InputAtom InputEvent; + + if( gPopup.ubActiveType == POPUP_ACTIVETYPE_NOT_YET_DETERMINED ) + { + //Attempt to determine if the menu will be persistant or not. + //Determination is made when the mouse's left button is released or if + //the mouse cursor enters the menu region. + if( gusMouseXPos >= gPopup.usLeft + && gusMouseXPos <= gPopup.usRight + && gusMouseYPos > gPopup.usTop //one pixel gap on top ignored + && gusMouseYPos < gPopup.usBottom - 1 ) //two pixel gap on bottom ignored + { + //mouse cursor has just entered the menu region -- nonpersistant. + + //KRIS: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //Disabled this because Linda doesn't like it... (I like it though, and it works) + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //UNCOMMENT IF NONPERSISTANT IS ALLOWED + //gPopup.ubActiveType = POPUP_ACTIVETYPE_NONPERSISTANT; + + return; + } + else if( !gfLeftButtonState ) + { //left button has been released before entering region -- persistant + gPopup.ubActiveType = POPUP_ACTIVETYPE_PERSISTANT; + return; + } + } + if( !gPopup.fUseKeyboardInfoUntilMouseMoves ) + { + //check menu entry based on mouse position + gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition(); + } + else if( gusMouseXPos != gPopup.usLastMouseX || gusMouseYPos != gPopup.usLastMouseY ) + { + //The keyboard determined the last entry, but the mouse has moved, + //so use the mouse to determine the new entry. + gPopup.fUseKeyboardInfoUntilMouseMoves = FALSE; + gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition(); + } + //Check terminating conditions for persistant states. + if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT ) + fWaitingForLButtonRelease = TRUE; + if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT + || !gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_NONPERSISTANT ) + { + //Selection conditions via mouse have been met whether the mouse is in the + //menu region or not. + gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition(); + if( gPopup.ubSelectedIndex ) + { + ProcessPopupMenuSelection(); + } + gPopup.fActive = FALSE; + MSYS_RemoveRegion( &popupRegion ); + gfRenderWorld = TRUE; + gfRenderTaskbar = TRUE; + return; + } + //Use keyboard input as well. + while( DequeueEvent( &InputEvent ) ) + { + switch(InputEvent.usEvent) + { + case KEY_DOWN: + switch( InputEvent.usParam ) + { + case DNARROW: + gPopup.fUseKeyboardInfoUntilMouseMoves = TRUE; + gPopup.usLastMouseX = gusMouseXPos; + gPopup.usLastMouseY = gusMouseYPos; + gPopup.ubSelectedIndex++; + if( gPopup.ubSelectedIndex > gPopup.ubNumEntries ) + { + gPopup.ubSelectedIndex = 1; + } + break; + case UPARROW: + gPopup.fUseKeyboardInfoUntilMouseMoves = TRUE; + gPopup.usLastMouseX = gusMouseXPos; + gPopup.usLastMouseY = gusMouseYPos; + if( gPopup.ubSelectedIndex < 2 ) + { + gPopup.ubSelectedIndex = gPopup.ubNumEntries; + } + else + { + gPopup.ubSelectedIndex--; + } + break; + case ESC: + gPopup.fActive = FALSE; + MSYS_RemoveRegion( &popupRegion ); + gfRenderWorld = TRUE; + gfRenderTaskbar = TRUE; + break; + case ENTER: + ProcessPopupMenuSelection(); + gPopup.fActive = FALSE; + MSYS_RemoveRegion( &popupRegion ); + gfRenderWorld = TRUE; + gfRenderTaskbar = TRUE; + break; + } + break; + } + } +} + +void ProcessPopupMenuSelection() +{ + switch( gPopup.ubPopupMenuID ) + { + case CHANGETSET_POPUP: + //change the tileset here. + ReloadTileset( (UINT8)(gPopup.ubSelectedIndex - 1 ) ); + InitJA2SelectionWindow( ); + break; + case CHANGECIVGROUP_POPUP: + ChangeCivGroup( (UINT8)(gPopup.ubSelectedIndex - 1) ); + break; + case SCHEDULEACTION_POPUP: + UpdateScheduleAction( (UINT8)(gPopup.ubSelectedIndex - 1) ); + break; + case ACTIONITEM_POPUP: + UpdateActionItem( (UINT8)(gPopup.ubSelectedIndex - 1) ); + break; + case OWNERSHIPGROUP_POPUP: + SetOwnershipGroup( (UINT8)(gPopup.ubSelectedIndex - 1) ); + break; + } +} + +BOOLEAN ProcessPopupMenuIfActive( ) +{ + if( !gPopup.fActive && !fWaitingForLButtonRelease ) + return FALSE; + if( fWaitingForLButtonRelease ) + { + if( !gfLeftButtonState ) + { + fWaitingForLButtonRelease = FALSE; + return FALSE; + } + return TRUE; + } + PopupMenuHandle(); + RenderPopupMenu(); + InvalidateRegion( gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom ); + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender( ); + return TRUE; +} + +#endif + + + + + + diff --git a/Editor/popupmenu.h b/Editor/popupmenu.h new file mode 100644 index 00000000..3b54f85a --- /dev/null +++ b/Editor/popupmenu.h @@ -0,0 +1,106 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +//popupmenu.h +//Author: Kris Morness +//Created: Sept 4, 1997 + +#ifndef __POPUPMENU_H +#define __POPUPMENU_H + +/* +POPUP MENU + +DESIGN CONSIDERATIONS +There is currently no support for nested popup menus. Let Kris know if +you need this. + +USER INSTRUCTIONS +The goal of this popup menu system is to create a quick and intuitive +interface system which is functionally similar to Win95 and MacOS. +As soon as you click on a button which activates the popup menu, the user +will choose a selection in one of three ways: + + 1) KEYBOARD - at anytime, the user can use the keyboard regardless of mouse + mode. The up/down arrow keys will cycle through the choices and enter will + accept the choice. ESC will cancel the menu without making a choice. + 2) When the mousedown event activates the menu, the user releases the mouse before + entering the popup menu region. The menu mode will change and become persistant. + Clicking on the hilighted item will close the popup and activate the choice. + Clicking elsewhere, the popup will be closed without making a selection. This + is functionally equivalent to Win95. + 3) When the mousedown event activates the menu, the user holds the mouse down and + moves the cursor over the popup region. At this moment the menu becomes + non-persistant and a choice is made by releasing the mouse. If the mouse is + released on a highlighted choice, that choice is selected, otherwise the popup + is cancelled. This is functionally equivalent to MacOS. The small diffence is + that under Win95's standard convention, the release of the mouse outside of the + region doesn't kill the menu, but in MacOS, it does. +*/ + + +enum popupMenuIDs +{ + CHANGETSET_POPUP, + CHANGECIVGROUP_POPUP, + SCHEDULEACTION_POPUP, + ACTIONITEM_POPUP, + OWNERSHIPGROUP_POPUP, +}; + +//The direction of the popup menu relative to the button +//pressed to activate it or mouse position. In editor mode, +//this will attempt to go up and to the right of the button. +#define UPMASK 0x00 +#define DNMASK 0x10 +#define RTMASK 0x00 +#define LTMASK 0x01 +#define DIR_UPRIGHT (UPMASK + RTMASK) +#define DIR_UPLEFT (UPMASK + LTMASK) +#define DIR_DOWNRIGHT (DNMASK + RTMASK) +#define DIR_DOWNLEFT (DNMASK + LTMASK) + +#define POPUP_ACTIVETYPE_NOT_YET_DETERMINED 0 +#define POPUP_ACTIVETYPE_PERSISTANT 1 +#define POPUP_ACTIVETYPE_NONPERSISTANT 2 + +#define MAX_COLUMNS 8 + +//This structure contains all the required information for rendering +//the popup menu while in +typedef struct currentPopupMenuInformation{ + UINT8 ubPopupMenuID; + UINT8 ubSelectedIndex; //current popup menu index hilited. + UINT8 ubNumEntries; + UINT8 ubColumns; + UINT8 ubMaxEntriesPerColumn; + UINT8 ubColumnWidth[ MAX_COLUMNS ]; + UINT8 ubActiveType; + UINT16 usFont; + BOOLEAN fActive; + BOOLEAN fUseKeyboardInfoUntilMouseMoves; + UINT16 usLeft, usTop, usRight, usBottom; //popup region coords. + UINT16 usLastMouseX, usLastMouseY; +}CurrentPopupMenuInformation; + +//A global var that keeps the popup menu information. +extern CurrentPopupMenuInformation gPopup; +extern UINT16 *popupMenuStrings[5]; + +//These are the two main functions that outside users would call. +void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection ); +BOOLEAN ProcessPopupMenuIfActive(); + +//Internal functions that handled by ProcessPopupMenuIfActive +void RenderPopupMenu(); +void PopupMenuHandle(); +void ProcessPopupMenuSelection(); + +#endif +#endif + + + + + + diff --git a/Editor/selectwin.cpp b/Editor/selectwin.cpp new file mode 100644 index 00000000..91c5784c --- /dev/null +++ b/Editor/selectwin.cpp @@ -0,0 +1,1671 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "tiledef.h" + #include "vsurface.h" + #include "worlddat.h" + #include "random.h" + #include "sysutil.h" + #include "Font Control.h" + #include "selectwin.h" + #include "EditorDefines.h" + #include "Editor Taskbar Utils.h" +#endif + + +extern BOOLEAN gfOverheadMapDirty; + +extern void SetClippingRect(SGPRect *clip); +extern void GetClippingRect(SGPRect *clip); + + +extern INT32 iEditorToolbar; + +extern BOOLEAN fDontUseRandom; + +extern UINT16 GenericButtonFillColors[40]; + +BOOLEAN gfRenderSquareArea = FALSE; +INT16 iStartClickX,iStartClickY; +INT16 iEndClickX,iEndClickY; + + +INT32 iButtonIcons[4]; +INT32 iSelectWin,iCancelWin,iScrollUp,iScrollDown,iOkWin; + +BOOLEAN fAllDone=FALSE; +BOOLEAN fButtonsPresent=FALSE; + +SGPPoint SelWinSpacing, SelWinStartPoint, SelWinEndPoint; + +//These definitions help define the start and end of the various wall indices. +//This needs to be maintained if the walls change. +#define WALL_LAST_WALL_OFFSET 30 +#define WALL_FIRST_AFRAME_OFFSET 31 +#define WALL_LAST_AFRAME_OFFSET 34 +#define WALL_FIRST_WINDOW_OFFSET 35 +#define WALL_LAST_WINDOW_OFFSET 46 +#define WALL_FIRST_BROKEN_WALL_OFFSET 47 +#define WALL_LAST_BROKEN_WALL_OFFSET 54 +#define WALL_FIRST_APPENDED_WALL_OFFSET 55 +#define WALL_LAST_APPENDED_WALL_OFFSET 56 +#define WALL_FIRST_WEATHERED_WALL_OFFSET 57 +#define WALL_LAST_WEATHERED_WALL_OFFSET 64 + +//I've added these definitions to add readability, and minimize conversion time for changes +//incase there are new values, etc. +#define OSTRUCTS_NUMELEMENTS ( LASTOSTRUCT - FIRSTFULLSTRUCT + 22 ) +#define OSTRUCTS1_NUMELEMENTS 5 +#define OSTRUCTS2_NUMELEMENTS 12 +#define BANKSLIST_NUMELEMENTS 5 +#define ROADSLIST_NUMELEMENTS 1 +#define DEBRISLIST_NUMELEMENTS ( LASTDEBRIS - DEBRISROCKS + 2 + 1 ) //+1 for ANOTHERDEBRIS + +#define SINGLEWALL_NUMELEMENTS ( (LASTWALL-FIRSTWALL+1) * 2 ) +#define SINGLEDOOR_NUMELEMENTS (( LASTDOOR - FIRSTDOOR + 1 ) * 5) +#define SINGLEWINDOW_NUMELEMENTS ( LASTWALL - FIRSTWALL + 1 ) +#define SINGLEROOF_NUMELEMENTS ( (LASTROOF-FIRSTROOF+1) + (LASTSLANTROOF-FIRSTSLANTROOF+1) + \ + (LASTWALL-FIRSTWALL+1) + (SECONDONROOF-FIRSTONROOF+1) ) +#define SINGLENEWROOF_NUMELEMENTS (LASTROOF-FIRSTROOF+1) +#define SINGLEBROKENWALL_NUMELEMENTS ( (LASTDECORATIONS-FIRSTDECORATIONS+1) + (LASTWALL-FIRSTWALL+1)*2 ) +#define SINGLEDECOR_NUMELEMENTS ( LASTISTRUCT - FIRSTISTRUCT + 1 ) +#define SINGLEDECAL_NUMELEMENTS ( LASTWALLDECAL - FIRSTWALLDECAL + EIGTHWALLDECAL - FIFTHWALLDECAL + 3 ) +#define SINGLEFLOOR_NUMELEMENTS ( LASTFLOOR - FIRSTFLOOR + 1 ) +#define SINGLETOILET_NUMELEMENTS ( EIGHTISTRUCT - FIFTHISTRUCT + 1 ) +//#define ROOM_NUMELEMENTS ( (LASTWALL-FIRSTWALL+1) + (LASTFLOOR-FIRSTFLOOR+1) + \ +// (LASTROOF-FIRSTROOF+1) + (LASTSLANTROOF-FIRSTSLANTROOF+1) ) +#define ROOM_NUMELEMENTS ( (LASTWALL-FIRSTWALL+1) + (LASTFLOOR-FIRSTFLOOR+1) + \ + (LASTROOF-FIRSTROOF+1) + (2 )) + + +//This is a special case for trees which may have varying numbers. There was a problem +//in which we loaded a new tileset which had one less tree in it. When we called BuildSelectionWindow(), +//it would crash because it thought there was an extra tree which was now invalid. +UINT16 gusNumOStructs = 0; + +// List of objects to display in the selection window +DisplaySpec OStructs[ OSTRUCTS_NUMELEMENTS ]; +DisplaySpec OStructs1[ OSTRUCTS1_NUMELEMENTS ]; +DisplaySpec OStructs2[ OSTRUCTS2_NUMELEMENTS ]; +DisplaySpec BanksList[ BANKSLIST_NUMELEMENTS ]; +DisplaySpec RoadsList[ ROADSLIST_NUMELEMENTS ]; +DisplaySpec DebrisList[ DEBRISLIST_NUMELEMENTS ]; +DisplaySpec SingleWall[ SINGLEWALL_NUMELEMENTS ]; +DisplaySpec SingleDoor[ SINGLEDOOR_NUMELEMENTS ]; +DisplaySpec SingleWindow[ SINGLEWINDOW_NUMELEMENTS ]; +DisplaySpec SingleRoof[ SINGLEROOF_NUMELEMENTS ]; +DisplaySpec SingleNewRoof[ SINGLENEWROOF_NUMELEMENTS ]; +DisplaySpec SingleBrokenWall[ SINGLEBROKENWALL_NUMELEMENTS ]; +DisplaySpec SingleDecor[ SINGLEDECOR_NUMELEMENTS ]; +DisplaySpec SingleDecal[ SINGLEDECAL_NUMELEMENTS ]; +DisplaySpec SingleFloor[ SINGLEFLOOR_NUMELEMENTS ]; +DisplaySpec SingleToilet[ SINGLETOILET_NUMELEMENTS ]; +DisplaySpec Room[ ROOM_NUMELEMENTS ]; + +//These are all of the different selection lists. Changing the max_selections will +//change the number of selections values you can have at a time. This is Bret's gay code, +//though I've cleaned it up a lot. +Selections SelOStructs[MAX_SELECTIONS] = { {FIRSTFULLSTRUCT, 0, 1} }; // Default selections +Selections SelOStructs1[MAX_SELECTIONS] = { {FOURTHOSTRUCT, 0, 1} }; // Default selections +Selections SelOStructs2[MAX_SELECTIONS] = { {THIRDOSTRUCT, 0, 1} }; // Default selections +Selections SelBanks[MAX_SELECTIONS] = { {FIRSTCLIFF, 0, 1} }; +Selections SelRoads[MAX_SELECTIONS] = { {FIRSTROAD, 0, 1} }; +Selections SelDebris[MAX_SELECTIONS] = { {DEBRISROCKS, 0, 1} }; +Selections SelSingleWall[MAX_SELECTIONS] = { {FIRSTWALL, 0, 1} }; +Selections SelSingleDoor[MAX_SELECTIONS] = { {FIRSTDOOR, 0, 1} }; +Selections SelSingleWindow[MAX_SELECTIONS] = { {FIRSTWALL, 44, 1} }; +Selections SelSingleRoof[MAX_SELECTIONS] = { {FIRSTROOF, 0, 1} }; +Selections SelSingleNewRoof[MAX_SELECTIONS] = { {FIRSTROOF, 0, 1} }; +Selections SelSingleBrokenWall[MAX_SELECTIONS] = { {FIRSTDECORATIONS, 0, 1} }; +Selections SelSingleDecor[MAX_SELECTIONS]= { {FIRSTISTRUCT, 0, 1} }; +Selections SelSingleDecal[MAX_SELECTIONS] = { {FIRSTWALLDECAL, 0, 1} }; +Selections SelSingleFloor[MAX_SELECTIONS] = { {FIRSTFLOOR, 0, 1} }; +Selections SelSingleToilet[MAX_SELECTIONS] = { {FIFTHISTRUCT, 0, 1} }; +Selections SelRoom[MAX_SELECTIONS] = { {FIRSTWALL, 0, 1} }; + +// Number of objects currently in the selection list +INT32 iNumOStructsSelected = 1; +INT32 iNumOStructs1Selected = 1; +INT32 iNumOStructs2Selected = 1; +INT32 iNumBanksSelected = 1; +INT32 iNumRoadsSelected = 1; +INT32 iNumDebrisSelected = 1; + +INT32 iNumWallsSelected = 1; +INT32 iNumDoorsSelected = 1; +INT32 iNumWindowsSelected = 1; +INT32 iNumDecorSelected = 1; +INT32 iNumDecalsSelected = 1; +INT32 iNumBrokenWallsSelected = 1; +INT32 iNumFloorsSelected = 1; +INT32 iNumToiletsSelected = 1; +INT32 iNumRoofsSelected = 1; +INT32 iNumNewRoofsSelected = 1; +INT32 iNumRoomsSelected = 1; + +// Holds the previous selection list when a selection window is up. Used for canceling the selection window +Selections OldSelList[MAX_SELECTIONS]; +INT32 iOldNumSelList; + +// Global pointers for selection list +Selections *pSelList; +INT32 *pNumSelList; + +// Global used to indicate which selection to use (changes with the PGUP/PGDWN keys in editor) +INT32 iCurBank = 0; + +DisplayList *pDispList; +INT16 iTopWinCutOff,iBotWinCutOff; +DisplayList Selection; + +UINT16 SelWinFillColor = 0x0000; // Black +UINT16 SelWinHilightFillColor = 0x000d; // a kind of medium dark blue + +//---------------------------------------------------------------------------------------------- +// CreateJA2SelectionWindow +// +// Creates a selection window of the given type. +// +void CreateJA2SelectionWindow( INT16 sWhat ) +{ + DisplaySpec *pDSpec; + UINT16 usNSpecs; + + fAllDone = FALSE; + + DisableEditorTaskbar( ); + + // Load up the button images + iButtonIcons[ CANCEL_ICON ] = LoadGenericButtonIcon( "EDITOR//bigX.sti" ); + iButtonIcons[ UP_ICON ] = LoadGenericButtonIcon( "EDITOR//lgUpArrow.sti" ); + iButtonIcons[ DOWN_ICON ] = LoadGenericButtonIcon( "EDITOR//lgDownArrow.sti" ); + iButtonIcons[ OK_ICON ] = LoadGenericButtonIcon( "EDITOR//checkmark.sti" ); + + iSelectWin = CreateHotSpot(0, 0, 600, 360, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, SelWinClkCallback); + + iCancelWin = CreateIconButton((INT16)iButtonIcons[CANCEL_ICON], 0, + BUTTON_USE_DEFAULT, 600, 40, + 40, 40, BUTTON_TOGGLE, + MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, CnclClkCallback); + SetButtonFastHelpText(iCancelWin,L"Cancel selections"); + + iOkWin = CreateIconButton((INT16)iButtonIcons[OK_ICON], 0, + BUTTON_USE_DEFAULT, 600, 0, + 40, 40, BUTTON_TOGGLE, + MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, OkClkCallback); + SetButtonFastHelpText(iOkWin,L"Accept selections"); + + iScrollUp = CreateIconButton((INT16)iButtonIcons[UP_ICON], 0, + BUTTON_USE_DEFAULT, 600, 80, + 40, 160, BUTTON_NO_TOGGLE, + MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, UpClkCallback); + SetButtonFastHelpText(iScrollUp,L"Scroll window up"); + + iScrollDown = CreateIconButton((INT16)iButtonIcons[DOWN_ICON], 0, + BUTTON_USE_DEFAULT, 600, 240, + 40, 160, BUTTON_NO_TOGGLE, + MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, DwnClkCallback); + SetButtonFastHelpText(iScrollDown,L"Scroll window down"); + + fButtonsPresent = TRUE; + + SelWinSpacing.iX = 2; + SelWinSpacing.iY = 2; + + SelWinStartPoint.iX = 1; + SelWinStartPoint.iY = 15; + + iTopWinCutOff = 15; + + SelWinEndPoint.iX = 599; + SelWinEndPoint.iY = 359; + + iBotWinCutOff = 359; + + switch( sWhat ) + { + case SELWIN_OSTRUCTS: + pDSpec = OStructs; + usNSpecs = gusNumOStructs;//OSTRUCTS_NUMELEMENTS; + pSelList = SelOStructs; + pNumSelList = &iNumOStructsSelected; + break; + + case SELWIN_OSTRUCTS1: + pDSpec = OStructs1; + usNSpecs = OSTRUCTS1_NUMELEMENTS; + pSelList = SelOStructs1; + pNumSelList = &iNumOStructs1Selected; + break; + + case SELWIN_OSTRUCTS2: + pDSpec = OStructs2; + usNSpecs = OSTRUCTS2_NUMELEMENTS; + pSelList = SelOStructs2; + pNumSelList = &iNumOStructs2Selected; + break; + + case SELWIN_BANKS: + pDSpec = BanksList; + usNSpecs = BANKSLIST_NUMELEMENTS; + pSelList = SelBanks; + pNumSelList = &iNumBanksSelected; + break; + + case SELWIN_ROADS: + pDSpec = RoadsList; + usNSpecs = ROADSLIST_NUMELEMENTS; + pSelList = SelRoads; + pNumSelList = &iNumRoadsSelected; + break; + + case SELWIN_DEBRIS: + pDSpec = DebrisList; + usNSpecs = DEBRISLIST_NUMELEMENTS; + pSelList = SelDebris; + pNumSelList = &iNumDebrisSelected; + break; + + case SELWIN_SINGLEWALL: + pDSpec = SingleWall; + usNSpecs = SINGLEWALL_NUMELEMENTS; + pSelList = SelSingleWall; + pNumSelList = &iNumWallsSelected; + break; + case SELWIN_SINGLEDOOR: + pDSpec = SingleDoor; + usNSpecs = SINGLEDOOR_NUMELEMENTS; + pSelList = SelSingleDoor; + pNumSelList = &iNumDoorsSelected; + break; + case SELWIN_SINGLEWINDOW: + pDSpec = SingleWindow; + usNSpecs = SINGLEWINDOW_NUMELEMENTS; + pSelList = SelSingleWindow; + pNumSelList = &iNumWindowsSelected; + break; + case SELWIN_SINGLEROOF: + pDSpec = SingleRoof; + usNSpecs = SINGLEROOF_NUMELEMENTS; + pSelList = SelSingleRoof; + pNumSelList = &iNumRoofsSelected; + break; + case SELWIN_SINGLENEWROOF: + pDSpec = SingleNewRoof; + usNSpecs = SINGLENEWROOF_NUMELEMENTS; + pSelList = SelSingleNewRoof; + pNumSelList = &iNumNewRoofsSelected; + break; + case SELWIN_SINGLEBROKENWALL: + pDSpec = SingleBrokenWall; + usNSpecs = SINGLEBROKENWALL_NUMELEMENTS; + pSelList = SelSingleBrokenWall; + pNumSelList = &iNumBrokenWallsSelected; + break; + case SELWIN_SINGLEDECOR: + pDSpec = SingleDecor; + usNSpecs = SINGLEDECOR_NUMELEMENTS; + pSelList = SelSingleDecor; + pNumSelList = &iNumDecorSelected; + break; + case SELWIN_SINGLEDECAL: + pDSpec = SingleDecal; + usNSpecs = SINGLEDECAL_NUMELEMENTS; + pSelList = SelSingleDecal; + pNumSelList = &iNumDecalsSelected; + break; + case SELWIN_SINGLEFLOOR: + pDSpec = SingleFloor; + usNSpecs = SINGLEFLOOR_NUMELEMENTS; + pSelList = SelSingleFloor; + pNumSelList = &iNumFloorsSelected; + break; + case SELWIN_SINGLETOILET: + pDSpec = SingleToilet; + usNSpecs = SINGLETOILET_NUMELEMENTS; + pSelList = SelSingleToilet; + pNumSelList = &iNumToiletsSelected; + break; + case SELWIN_ROOM: + pDSpec = Room; + usNSpecs = ROOM_NUMELEMENTS; + pSelList = SelRoom; + pNumSelList = &iNumRoomsSelected; + break; + } + + BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint, + &SelWinSpacing, CLEAR_BACKGROUND); +} + + +//The selection window method is initialized here. This is where all the graphics for all +//the categories are organized and loaded. If you wish to move things around, then this is +//where the initialization part is done. I have also changed this from previously being loaded +//every single time you go into a selection window which was redundant and CPU consuming. +void InitJA2SelectionWindow( void ) +{ + INT32 iCount; + INT32 iCount2; + INT32 iCount3; + + UINT16 usETRLEObjects; + HVOBJECT hVObject; + + + pDispList = NULL; + + // Init the display spec lists for the types of selection windows + + // Trees & bushes (The tree button in the "terrain" toolbar) + for ( iCount3 = 0, iCount = 0; iCount < (LASTOSTRUCT - FIRSTFULLSTRUCT + 1); iCount++ ) + { + hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTFULLSTRUCT + iCount]].hTileSurface; + usETRLEObjects = hVObject->usNumberOfObjects; + + + for ( iCount2 = 0; iCount2 < usETRLEObjects; iCount2 += 3, iCount3++) + { + OStructs[ iCount3 ].ubType = DISPLAY_GRAPHIC; + OStructs[ iCount3 ].hVObject = hVObject; + OStructs[ iCount3 ].usStart = (UINT16)iCount2; + OStructs[ iCount3 ].usEnd = (UINT16)iCount2; + OStructs[ iCount3 ].uiObjIndx = (FIRSTFULLSTRUCT + iCount); + } + } + + OStructs[ iCount3 ].ubType = DISPLAY_GRAPHIC; + OStructs[ iCount3 ].hVObject = gTileDatabase[gTileTypeStartIndex[SIXTHOSTRUCT]].hTileSurface; + OStructs[ iCount3 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs[ iCount3 ].usEnd = 0; + OStructs[ iCount3 ].uiObjIndx = SIXTHOSTRUCT; + + gusNumOStructs = (UINT16)iCount3 + 1; + + // Rocks & barrels! (the "1" button in the "terrain" toolbar) + OStructs1[ 0 ].ubType = DISPLAY_GRAPHIC; + OStructs1[ 0 ].hVObject = gTileDatabase[gTileTypeStartIndex[FOURTHOSTRUCT]].hTileSurface; + OStructs1[ 0 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs1[ 0 ].usEnd = 0; + OStructs1[ 0 ].uiObjIndx = FOURTHOSTRUCT; + + for ( iCount = 0; iCount < (THIRDOSTRUCT - FIRSTOSTRUCT); iCount++ ) + { + OStructs1[ iCount + 1 ].ubType = DISPLAY_GRAPHIC; + OStructs1[ iCount + 1 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTOSTRUCT + iCount]].hTileSurface; + OStructs1[ iCount + 1 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs1[ iCount + 1 ].usEnd = 0; + OStructs1[ iCount + 1 ].uiObjIndx = FIRSTOSTRUCT + iCount; + } + + + // Other junk! (the "2" button in the "terrain" toolbar) + OStructs2[ 0 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 0 ].hVObject = gTileDatabase[gTileTypeStartIndex[THIRDOSTRUCT]].hTileSurface; + OStructs2[ 0 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 0 ].usEnd = 0; + OStructs2[ 0 ].uiObjIndx = THIRDOSTRUCT; + + OStructs2[ 1 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 1 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIFTHOSTRUCT]].hTileSurface; + OStructs2[ 1 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 1 ].usEnd = 0; + OStructs2[ 1 ].uiObjIndx = FIFTHOSTRUCT; + + OStructs2[ 2 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 2 ].hVObject = gTileDatabase[gTileTypeStartIndex[SEVENTHOSTRUCT]].hTileSurface; + OStructs2[ 2 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 2 ].usEnd = 0; + OStructs2[ 2 ].uiObjIndx = SEVENTHOSTRUCT; + + OStructs2[ 3 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 3 ].hVObject = gTileDatabase[gTileTypeStartIndex[EIGHTOSTRUCT]].hTileSurface; + OStructs2[ 3 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 3 ].usEnd = 0; + OStructs2[ 3 ].uiObjIndx = EIGHTOSTRUCT; + + OStructs2[ 4 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 4 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTVEHICLE]].hTileSurface; + OStructs2[ 4 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 4 ].usEnd = 0; + OStructs2[ 4 ].uiObjIndx = FIRSTVEHICLE; + + OStructs2[ 5 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 5 ].hVObject = gTileDatabase[gTileTypeStartIndex[SECONDVEHICLE]].hTileSurface; + OStructs2[ 5 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 5 ].usEnd = 0; + OStructs2[ 5 ].uiObjIndx = SECONDVEHICLE; + + OStructs2[ 6 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 6 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTDEBRISSTRUCT]].hTileSurface; + OStructs2[ 6 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 6 ].usEnd = 0; + OStructs2[ 6 ].uiObjIndx = FIRSTDEBRISSTRUCT; + + OStructs2[ 7 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 7 ].hVObject = gTileDatabase[gTileTypeStartIndex[SECONDDEBRISSTRUCT]].hTileSurface; + OStructs2[ 7 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 7 ].usEnd = 0; + OStructs2[ 7 ].uiObjIndx = SECONDDEBRISSTRUCT; + + OStructs2[ 8 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 8 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTLARGEEXPDEBRIS]].hTileSurface; + OStructs2[ 8 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 8 ].usEnd = 0; + OStructs2[ 8 ].uiObjIndx = FIRSTLARGEEXPDEBRIS; + + OStructs2[ 9 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 9 ].hVObject = gTileDatabase[gTileTypeStartIndex[SECONDLARGEEXPDEBRIS]].hTileSurface; + OStructs2[ 9 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 9 ].usEnd = 0; + OStructs2[ 9 ].uiObjIndx = SECONDLARGEEXPDEBRIS; + + OStructs2[ 10 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 10 ].hVObject = gTileDatabase[gTileTypeStartIndex[NINTHOSTRUCT]].hTileSurface; + OStructs2[ 10 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 10 ].usEnd = 0; + OStructs2[ 10 ].uiObjIndx = NINTHOSTRUCT; + + OStructs2[ 11 ].ubType = DISPLAY_GRAPHIC; + OStructs2[ 11 ].hVObject = gTileDatabase[gTileTypeStartIndex[TENTHOSTRUCT]].hTileSurface; + OStructs2[ 11 ].usStart = DISPLAY_ALL_OBJECTS; + OStructs2[ 11 ].usEnd = 0; + OStructs2[ 11 ].uiObjIndx = TENTHOSTRUCT; + + // River banks and cliffs (the "river" button on the "terrain" toolbar) + BanksList[0].ubType = DISPLAY_GRAPHIC; + BanksList[0].hVObject = gTileDatabase[gTileTypeStartIndex[ANIOSTRUCT]].hTileSurface; + BanksList[0].usStart = DISPLAY_ALL_OBJECTS; + BanksList[0].usEnd = 0; + BanksList[0].uiObjIndx = ANIOSTRUCT; + + BanksList[1].ubType = DISPLAY_GRAPHIC; + BanksList[1].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTCLIFF]].hTileSurface; + BanksList[1].usStart = DISPLAY_ALL_OBJECTS; + BanksList[1].usEnd = 0; + BanksList[1].uiObjIndx = FIRSTCLIFF; + + BanksList[2].ubType = DISPLAY_GRAPHIC; + BanksList[2].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTCLIFFHANG]].hTileSurface; + BanksList[2].usStart = DISPLAY_ALL_OBJECTS; + BanksList[2].usEnd = 0; + BanksList[2].uiObjIndx = FIRSTCLIFFHANG; + + BanksList[3].ubType = DISPLAY_GRAPHIC; + BanksList[3].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTROAD]].hTileSurface; + BanksList[3].usStart = DISPLAY_ALL_OBJECTS; + BanksList[3].usEnd = 0; + BanksList[3].uiObjIndx = FIRSTROAD; + + BanksList[4].ubType = DISPLAY_GRAPHIC; + BanksList[4].hVObject = gTileDatabase[gTileTypeStartIndex[FENCESTRUCT]].hTileSurface; + BanksList[4].usStart = DISPLAY_ALL_OBJECTS; + BanksList[4].usEnd = 0; + BanksList[4].uiObjIndx = FENCESTRUCT; + + RoadsList[0].ubType = DISPLAY_GRAPHIC; + RoadsList[0].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTROAD]].hTileSurface; + RoadsList[0].usStart = DISPLAY_ALL_OBJECTS; + RoadsList[0].usEnd = 0; + RoadsList[0].uiObjIndx = FIRSTROAD; + + // Debris (the "bent can" button on the "terrain", and "buildings" toolbars) + for ( iCount = 0; iCount < (LASTDEBRIS - DEBRISROCKS + 1); iCount++ ) + { + DebrisList[ iCount ].ubType = DISPLAY_GRAPHIC; + DebrisList[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[DEBRISROCKS + iCount]].hTileSurface; + DebrisList[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + DebrisList[ iCount ].usEnd = 0; + DebrisList[ iCount ].uiObjIndx = DEBRISROCKS + iCount; + } + // Add one more for new misc debris + DebrisList[ iCount ].ubType = DISPLAY_GRAPHIC; + DebrisList[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[DEBRIS2MISC ] ].hTileSurface; + DebrisList[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + DebrisList[ iCount ].usEnd = 0; + DebrisList[ iCount ].uiObjIndx = DEBRIS2MISC; + //Add yet another one... + iCount++; + DebrisList[ iCount ].ubType = DISPLAY_GRAPHIC; + DebrisList[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[ANOTHERDEBRIS ] ].hTileSurface; + DebrisList[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + DebrisList[ iCount ].usEnd = 0; + DebrisList[ iCount ].uiObjIndx = ANOTHERDEBRIS; + + // Rooms + for ( iCount = 0; iCount < (LASTWALL - FIRSTWALL + 1); iCount++ ) + { + Room[ iCount ].ubType = DISPLAY_GRAPHIC; + Room[iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTWALL + iCount]].hTileSurface; + Room[ iCount ].usStart = 0; + Room[ iCount ].usEnd = 0; + Room[ iCount ].uiObjIndx = FIRSTWALL + iCount; + } + for ( iCount2 = 0; iCount2 < (LASTFLOOR - FIRSTFLOOR + 1); iCount2++, iCount++ ) + { + Room[ iCount ].ubType = DISPLAY_GRAPHIC; + Room[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTFLOOR + iCount2]].hTileSurface; + Room[ iCount ].usStart = 0; + Room[ iCount ].usEnd = 0; + Room[ iCount ].uiObjIndx = FIRSTFLOOR + iCount2; + } + for ( iCount2 = 0; iCount2 < (LASTROOF - FIRSTROOF + 1); iCount2++, iCount++ ) + { + Room[ iCount ].ubType = DISPLAY_GRAPHIC; + Room[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTROOF + iCount2]].hTileSurface; + Room[ iCount ].usStart = 0; + Room[ iCount ].usEnd = 0; + Room[ iCount ].uiObjIndx = FIRSTROOF + iCount2; + } + for ( iCount2 = 0; iCount2 < 2/*(LASTSLANTROOF - FIRSTSLANTROOF + 1)*/; iCount2++, iCount++ ) + { + Room[ iCount ].ubType = DISPLAY_GRAPHIC; + Room[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTSLANTROOF + iCount2]].hTileSurface; + Room[ iCount ].usStart = 0; + Room[ iCount ].usEnd = 0; + Room[ iCount ].uiObjIndx = FIRSTSLANTROOF + iCount2; + } + + //Walls + for ( iCount = 0, iCount2 = 0; iCount < (LASTWALL - FIRSTWALL + 1); iCount++, iCount2+=2 ) + { + SingleWall[ iCount2 ].ubType = DISPLAY_GRAPHIC; + SingleWall[ iCount2 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTWALL + iCount]].hTileSurface; + SingleWall[ iCount2 ].usStart = 0; + SingleWall[ iCount2 ].usEnd = WALL_LAST_WALL_OFFSET; + SingleWall[ iCount2 ].uiObjIndx = FIRSTWALL + iCount; + //New appended walls + SingleWall[ iCount2+1 ].ubType = DISPLAY_GRAPHIC; + SingleWall[ iCount2+1 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTWALL + iCount]].hTileSurface; + SingleWall[ iCount2+1 ].usStart = WALL_FIRST_APPENDED_WALL_OFFSET; + SingleWall[ iCount2+1 ].usEnd = WALL_LAST_APPENDED_WALL_OFFSET; + SingleWall[ iCount2+1 ].uiObjIndx = FIRSTWALL + iCount; + } + + //Doors + for ( iCount = 0, iCount2 = 0; iCount < (LASTDOOR - FIRSTDOOR + 1); iCount++, iCount2+=5) + { + //closed + SingleDoor[ iCount2 ].ubType = DISPLAY_GRAPHIC; + SingleDoor[ iCount2 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTDOOR + iCount]].hTileSurface; + SingleDoor[ iCount2 ].usStart = 0; + SingleDoor[ iCount2 ].usEnd = 0; + SingleDoor[ iCount2 ].uiObjIndx = FIRSTDOOR + iCount; + //open, closed + SingleDoor[ iCount2+1 ].ubType = DISPLAY_GRAPHIC; + SingleDoor[ iCount2+1 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTDOOR + iCount]].hTileSurface; + SingleDoor[ iCount2+1 ].usStart = 4; + SingleDoor[ iCount2+1 ].usEnd = 5; + SingleDoor[ iCount2+1 ].uiObjIndx = FIRSTDOOR + iCount; + //open, closed + SingleDoor[ iCount2+2 ].ubType = DISPLAY_GRAPHIC; + SingleDoor[ iCount2+2 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTDOOR + iCount]].hTileSurface; + SingleDoor[ iCount2+2 ].usStart = 9; + SingleDoor[ iCount2+2 ].usEnd = 10; + SingleDoor[ iCount2+2 ].uiObjIndx = FIRSTDOOR + iCount; + //open, closed + SingleDoor[ iCount2+3 ].ubType = DISPLAY_GRAPHIC; + SingleDoor[ iCount2+3 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTDOOR + iCount]].hTileSurface; + SingleDoor[ iCount2+3 ].usStart = 14; + SingleDoor[ iCount2+3 ].usEnd = 15; + SingleDoor[ iCount2+3 ].uiObjIndx = FIRSTDOOR + iCount; + //open + SingleDoor[ iCount2+4 ].ubType = DISPLAY_GRAPHIC; + SingleDoor[ iCount2+4 ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTDOOR + iCount]].hTileSurface; + SingleDoor[ iCount2+4 ].usStart = 19; + SingleDoor[ iCount2+4 ].usEnd = 19; + SingleDoor[ iCount2+4 ].uiObjIndx = FIRSTDOOR + iCount; + } + //Windows + for ( iCount = 0; iCount < (LASTWALL - FIRSTWALL + 1); iCount++ ) + { + SingleWindow[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleWindow[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTWALL + iCount]].hTileSurface; + SingleWindow[ iCount ].usStart = WALL_FIRST_WINDOW_OFFSET; + SingleWindow[ iCount ].usEnd = WALL_LAST_WINDOW_OFFSET; + SingleWindow[ iCount ].uiObjIndx = FIRSTWALL + iCount; + } + //Roofs and slant roofs + for ( iCount = 0; iCount < (LASTROOF - FIRSTROOF + 1); iCount++ ) + { //Flat roofs + SingleRoof[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleRoof[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTROOF + iCount]].hTileSurface; + SingleRoof[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + SingleRoof[ iCount ].usEnd = 0; + SingleRoof[ iCount ].uiObjIndx = FIRSTROOF + iCount; + } + for ( iCount2 = 0; iCount2 < (LASTSLANTROOF - FIRSTSLANTROOF + 1); iCount2++, iCount++ ) + { //Slanted roofs + SingleRoof[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleRoof[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTSLANTROOF + iCount2]].hTileSurface; + SingleRoof[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + SingleRoof[ iCount ].usEnd = 0; + SingleRoof[ iCount ].uiObjIndx = FIRSTSLANTROOF + iCount2; + } + for( iCount2 = 0; iCount2 < (LASTWALL - FIRSTWALL + 1); iCount2++, iCount++ ) + { //A-Frames + SingleRoof[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleRoof[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTWALL + iCount2]].hTileSurface; + SingleRoof[ iCount ].usStart = WALL_FIRST_AFRAME_OFFSET; + SingleRoof[ iCount ].usEnd = WALL_LAST_AFRAME_OFFSET; + SingleRoof[ iCount ].uiObjIndx = FIRSTWALL + iCount2; + } + for( iCount2 = 0; iCount2 < (SECONDONROOF - FIRSTONROOF + 1); iCount2++, iCount++ ) + { //On roofs + SingleRoof[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleRoof[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTONROOF + iCount2]].hTileSurface; + SingleRoof[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + SingleRoof[ iCount ].usEnd = 0; + SingleRoof[ iCount ].uiObjIndx = FIRSTONROOF + iCount2; + } + + //New replacement roofs + for ( iCount = 0; iCount < (LASTROOF - FIRSTROOF + 1); iCount++ ) + { //Flat roofs + SingleNewRoof[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleNewRoof[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTROOF + iCount]].hTileSurface; + SingleNewRoof[ iCount ].usStart = 9; + SingleNewRoof[ iCount ].usEnd = 9; + SingleNewRoof[ iCount ].uiObjIndx = FIRSTROOF + iCount; + } + + //Broken walls + for ( iCount = 0; iCount < (LASTDECORATIONS - FIRSTDECORATIONS + 1); iCount++ ) + { //Old obsolete wall decals, but should be replaced with multitiled decals such as banners, etc. + SingleBrokenWall[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleBrokenWall[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTDECORATIONS + iCount]].hTileSurface; + SingleBrokenWall[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + SingleBrokenWall[ iCount ].usEnd = 0; + SingleBrokenWall[ iCount ].uiObjIndx = FIRSTDECORATIONS + iCount; + } + for( iCount2 = 0; iCount2 < (LASTWALL - FIRSTWALL + 1); iCount2++, iCount++ ) + { //Broken walls + SingleBrokenWall[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleBrokenWall[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTWALL + iCount2]].hTileSurface; + SingleBrokenWall[ iCount ].usStart = WALL_FIRST_BROKEN_WALL_OFFSET; + SingleBrokenWall[ iCount ].usEnd = WALL_LAST_BROKEN_WALL_OFFSET; + SingleBrokenWall[ iCount ].uiObjIndx = FIRSTWALL + iCount2; + } + for( iCount2 = 0; iCount2 < (LASTWALL - FIRSTWALL + 1); iCount2++, iCount++ ) + { //Cracked and smudged walls + SingleBrokenWall[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleBrokenWall[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTWALL + iCount2]].hTileSurface; + SingleBrokenWall[ iCount ].usStart = WALL_FIRST_WEATHERED_WALL_OFFSET; + SingleBrokenWall[ iCount ].usEnd = WALL_LAST_WEATHERED_WALL_OFFSET; + SingleBrokenWall[ iCount ].uiObjIndx = FIRSTWALL + iCount2; + } + + // Decorations + for ( iCount = 0; iCount < (LASTISTRUCT - FIRSTISTRUCT + 1); iCount++ ) + { + SingleDecor[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleDecor[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTISTRUCT + iCount]].hTileSurface; + SingleDecor[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + SingleDecor[ iCount ].usEnd = 0; + SingleDecor[ iCount ].uiObjIndx = FIRSTISTRUCT + iCount; + } + + // Wall decals + for ( iCount = 0; iCount < (LASTWALLDECAL - FIRSTWALLDECAL + 1); iCount++ ) + { + SingleDecal[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleDecal[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTWALLDECAL + iCount]].hTileSurface; + SingleDecal[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + SingleDecal[ iCount ].usEnd = 0; + SingleDecal[ iCount ].uiObjIndx = FIRSTWALLDECAL + iCount; + } + for ( iCount2 = 0; iCount2 < (EIGTHWALLDECAL - FIFTHWALLDECAL + 1); iCount++, iCount2++ ) + { + SingleDecal[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleDecal[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIFTHWALLDECAL + iCount2]].hTileSurface; + SingleDecal[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + SingleDecal[ iCount ].usEnd = 0; + SingleDecal[ iCount ].uiObjIndx = FIFTHWALLDECAL + iCount2; + } + SingleDecal[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleDecal[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTSWITCHES]].hTileSurface; + SingleDecal[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + SingleDecal[ iCount ].usEnd = 0; + SingleDecal[ iCount ].uiObjIndx = FIRSTSWITCHES; + + //Floors + for ( iCount = 0; iCount < (LASTFLOOR - FIRSTFLOOR + 1); iCount++ ) + { + SingleFloor[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleFloor[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTFLOOR + iCount]].hTileSurface; + SingleFloor[ iCount ].usStart = 0; + SingleFloor[ iCount ].usEnd = 7; + SingleFloor[ iCount ].uiObjIndx = FIRSTFLOOR + iCount; + } + + //Toilets + for ( iCount = 0; iCount < (EIGHTISTRUCT - FIFTHISTRUCT + 1); iCount++ ) + { + SingleToilet[ iCount ].ubType = DISPLAY_GRAPHIC; + SingleToilet[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIFTHISTRUCT + iCount]].hTileSurface; + SingleToilet[ iCount ].usStart = DISPLAY_ALL_OBJECTS; + SingleToilet[ iCount ].usEnd = 0; + SingleToilet[ iCount ].uiObjIndx = FIFTHISTRUCT + iCount; + } + +} + + +//---------------------------------------------------------------------------------------------- +// ShutdownJA2SelectionWindow +// +// Unloads selection window button images and makes sure any display list that may remain in memory +// is removed. +// +void ShutdownJA2SelectionWindow( void ) +{ + INT16 x; + + for (x = 0; x < 4; x++) + UnloadGenericButtonIcon( (INT16)iButtonIcons[x] ); + + if (pDispList != NULL) + { + pDispList = TrashList(pDispList); + } + gfRenderWorld = TRUE; +} + + +//---------------------------------------------------------------------------------------------- +// RemoveJA2SelectionWindow +// +// Removes the selection window from the screen. +// +void RemoveJA2SelectionWindow( void ) +{ + RemoveButton(iSelectWin); + RemoveButton(iCancelWin); + RemoveButton(iScrollUp); + RemoveButton(iScrollDown); + RemoveButton(iOkWin); + + gfRenderSquareArea = FALSE; + + if (pDispList != NULL) + { + pDispList = TrashList(pDispList); + } + gfRenderTaskbar = TRUE; + + gfOverheadMapDirty = TRUE; + EnableEditorTaskbar( ); +} + + +//---------------------------------------------------------------------------------------------- +// TrashList +// +// Free the current display list for the selection window. +// +DisplayList *TrashList( DisplayList *pNode ) +{ + if (pNode == NULL) + return(NULL); + + if (pNode->pNext != NULL) + pNode->pNext = TrashList(pNode->pNext); + + if (pNode->pNext == NULL) + MemFree(pNode); + + return(NULL); +} + + +//---------------------------------------------------------------------------------------------- +// RenderSelectionWindow +// +// Displays the current selection window +// +void RenderSelectionWindow( void ) +{ + GUI_BUTTON *button; + INT32 iSX,iSY,iEX,iEY; + UINT16 usFillColor; + static UINT8 usFillGreen = 0; + static UINT8 usDir = 5; + + + if (!fButtonsPresent) + return; + + ColorFillVideoSurfaceArea(FRAME_BUFFER, + 0, 0, 600, 400, + GenericButtonFillColors[0]); + DrawSelections( ); + MarkButtonsDirty(); + RenderButtons( ); + + if ( gfRenderSquareArea ) + { + button = ButtonList[iSelectWin]; + if ( button == NULL ) + return; + + if ( (abs( iStartClickX - button->Area.MouseXPos ) > 9) || + (abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY)) > 9) ) + { +// iSX = (INT32)iStartClickX; +// iEX = (INT32)button->Area.MouseXPos; +// iSY = (INT32)iStartClickY; +// iEY = (INT32)(button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY); + + iSX = iStartClickX; + iSY = iStartClickY - iTopWinCutOff + SelWinStartPoint.iY; + iEX = gusMouseXPos; + iEY = gusMouseYPos; + + + if (iEX < iSX) + { + iEX ^= iSX; + iSX ^= iEX; + iEX ^= iSX; + } + + if (iEY < iSY) + { + iEY ^= iSY; + iSY ^= iEY; + iEY ^= iSY; + } + + iEX = min( iEX, 600 ); + iSY = max( SelWinStartPoint.iY, iSY ); + iEY = min( 359, iEY ); + iEY = max( SelWinStartPoint.iY, iEY ); + + usFillColor = Get16BPPColor(FROMRGB(255, usFillGreen, 0)); + usFillGreen += usDir; + if( usFillGreen > 250 ) + usDir = 251; + else if( usFillGreen < 5 ) + usDir = 5; + + ColorFillVideoSurfaceArea(FRAME_BUFFER, iSX, iSY, iEX, iSY+1, usFillColor ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iSX, iEY, iEX, iEY+1, usFillColor ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iSX, iSY, iSX+1, iEY, usFillColor ); + ColorFillVideoSurfaceArea(FRAME_BUFFER, iEX, iSY, iEX+1, iEY, usFillColor ); + } + } +} + + +//---------------------------------------------------------------------------------------------- +// SelWinClkCallback +// +// Button callback function for the main selection window. Checks if user clicked on an image, +// if so selects or de-selects that object. Also handles the multi-object selection (left-click +// and drag to get the selection rectangle) +// +void SelWinClkCallback( GUI_BUTTON *button, INT32 reason ) +{ + DisplayList *pNode; + BOOLEAN fDone; + INT16 iClickX,iClickY, iYInc, iXInc; + + + if (!(button->uiFlags & BUTTON_ENABLED)) + return; + + iClickX = button->Area.MouseXPos; + iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY; + + if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) + { + button->uiFlags |= BUTTON_CLICKED_ON; + iStartClickX = iClickX; + iStartClickY = iClickY; + gfRenderSquareArea = TRUE; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_DWN) + { + button->uiFlags |= BUTTON_CLICKED_ON; + + if ( gfRenderSquareArea ) + { + gfRenderSquareArea = FALSE; + return; + } + + // Code to figure out what image user wants goes here + pNode = pDispList; + + fDone = FALSE; + while( (pNode != NULL) && !fDone ) + { + if ( (iClickX >= pNode->iX) && (iClickX < (pNode->iX + pNode->iWidth)) && + (iClickY >= pNode->iY) && (iClickY < (pNode->iY + pNode->iHeight)) ) + { + fDone = TRUE; + if ( RemoveFromSelectionList(pNode) ) + pNode->fChosen = FALSE; + } + else + pNode = pNode->pNext; + } + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + button->uiFlags &= (~BUTTON_CLICKED_ON); + } + else if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + button->uiFlags &= (~BUTTON_CLICKED_ON); + + if( !gfRenderSquareArea ) + return; + + iEndClickX = iClickX; + iEndClickY = iClickY; + + gfRenderSquareArea = FALSE; + + if( iEndClickX < iStartClickX ) + { + iStartClickX ^= iEndClickX; + iEndClickX ^= iStartClickX; + iStartClickX ^= iEndClickX; + } + + if( iEndClickY < iStartClickY ) + { + iStartClickY ^= iEndClickY; + iEndClickY ^= iStartClickY; + iStartClickY ^= iEndClickY; + } + + iXInc = iYInc = 1; + for( iClickY = iStartClickY; iClickY <= iEndClickY; iClickY += iYInc ) + { + iYInc = 1; + for( iClickX = iStartClickX; iClickX <= iEndClickX; iClickX += iXInc ) + { + iXInc = 1; + // Code to figure out what image user wants goes here + pNode = pDispList; + + fDone = FALSE; + while( (pNode != NULL) && !fDone ) + { + if ( (iClickX >= pNode->iX) && (iClickX < (pNode->iX + pNode->iWidth)) && + (iClickY >= pNode->iY) && (iClickY < (pNode->iY + pNode->iHeight)) ) + { + fDone = TRUE; + AddToSelectionList(pNode); + pNode->fChosen = TRUE; + iXInc = (pNode->iX + pNode->iWidth) - iClickX; + if ( iYInc < ((pNode->iY + pNode->iHeight) - iClickY) ) + iYInc = (pNode->iY + pNode->iHeight) - iClickY; + } + else + pNode = pNode->pNext; + } + } + } + } +} + +//When a selection window is up, the file information of the picture will display +//at the top of the screen. +void DisplaySelectionWindowGraphicalInformation() +{ + DisplayList *pNode; + BOOLEAN fDone; + //UINT16 usObjIndex, usIndex; + UINT16 y; + //Determine if there is a valid picture at cursor position. + //iRelX = gusMouseXPos; + //iRelY = gusMouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY; + + y = gusMouseYPos + iTopWinCutOff - (UINT16)SelWinStartPoint.iY; + pNode = pDispList; + fDone = FALSE; + while( (pNode != NULL) && !fDone ) + { + if ( (gusMouseXPos >= pNode->iX) && (gusMouseXPos < (pNode->iX + pNode->iWidth)) && + (y >= pNode->iY) && (y < (pNode->iY + pNode->iHeight)) ) + { + fDone = TRUE; + //pNode->fChosen = TRUE; + //iXInc = (pNode->iX + pNode->iWidth) - iClickX; + //if ( iYInc < ((pNode->iY + pNode->iHeight) - iClickY) ) + // iYInc = (pNode->iY + pNode->iHeight) - iClickY; + } + else + pNode = pNode->pNext; + } + SetFont( FONT12POINT1 ); + SetFontForeground( FONT_WHITE ); + if( pNode ) + { + //usObjIndex = (UINT16)pNode->uiObjIndx; + //usIndex = pNode->uiIndex; + if( !gTilesets[ giCurrentTilesetID].TileSurfaceFilenames[ pNode->uiObjIndx ][0] ) + { + mprintf( 2, 2, L"%S[%d] is from default tileset %s (%S)", + gTilesets[0].TileSurfaceFilenames[ pNode->uiObjIndx ], + pNode->uiIndex, gTilesets[0].zName, + gTileSurfaceName[ pNode->uiObjIndx ] ); + } + else + { + mprintf( 2, 2, L"File: %S, subindex: %d (%S)", + gTilesets[ giCurrentTilesetID ].TileSurfaceFilenames[ pNode->uiObjIndx ], + pNode->uiIndex, gTileSurfaceName[ pNode->uiObjIndx ] ); + } + } + mprintf( 350, 2, L"Current Tileset: %s", gTilesets[ giCurrentTilesetID ].zName ); +} + +//---------------------------------------------------------------------------------------------- +// AddToSelectionList +// +// Add an object in the display list to the selection list. If the object already exists in the +// selection list, then it's count is incremented. +// +void AddToSelectionList( DisplayList *pNode ) +{ + INT32 iIndex, iUseIndex; + BOOLEAN fDone; + + fDone = FALSE; + for (iIndex = 0; iIndex < (*pNumSelList) && !fDone; iIndex++ ) + { + if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject && + pNode->uiIndex == pSelList[ iIndex ].usIndex ) + { + fDone = TRUE; + iUseIndex = iIndex; + } + } + + if ( fDone ) + { + // Was already in the list, so bump up the count + pSelList[ iUseIndex ].sCount++; + } + else + { + // Wasn't in the list, so add to end (if space available) + if ( (*pNumSelList) < MAX_SELECTIONS ) + { + pSelList[ (*pNumSelList) ].uiObject = pNode->uiObjIndx; + pSelList[ (*pNumSelList) ].usIndex = pNode->uiIndex; + pSelList[ (*pNumSelList) ].sCount = 1; + + (*pNumSelList)++; + } + } +} + + + +//---------------------------------------------------------------------------------------------- +// ClearSelectionList +// +// Removes everything from the current selection list +// +BOOLEAN ClearSelectionList( void ) +{ + INT32 iIndex; + DisplayList *pNode; + + + if (pNumSelList == NULL ) + return( FALSE ); + + pNode = pDispList; + while ( pNode != NULL ) + { + pNode->fChosen = FALSE; + pNode = pNode->pNext; + } + + for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ ) + pSelList[ iIndex ].sCount = 0; + + (*pNumSelList) = 0; + return( TRUE ); +} + + +//---------------------------------------------------------------------------------------------- +// RemoveFromSelectionList +// +// Removes the object given n a display list from the selection list. If the objects count is +// greater than one, then the count is decremented and the object remains in the list. +// +BOOLEAN RemoveFromSelectionList( DisplayList *pNode ) +{ + INT32 iIndex, iUseIndex; + BOOLEAN fDone, fRemoved; + + // Abort if no entries in list (pretend we removed a node) + if ( (*pNumSelList) <= 0 ) + return( TRUE ); + + fRemoved = FALSE; + fDone = FALSE; + for (iIndex = 0; iIndex < (*pNumSelList) && !fDone; iIndex++ ) + { + if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject && + pNode->uiIndex == pSelList[ iIndex ].usIndex ) + { + fDone = TRUE; + iUseIndex = iIndex; + } + } + + if ( fDone ) + { + // Was already in the list, so bump up the count + pSelList[ iUseIndex ].sCount--; + + if ( pSelList[ iUseIndex ].sCount <= 0 ) + { + // Squash the list to remove old entry + for ( iIndex = iUseIndex; iIndex < ((*pNumSelList) - 1); iIndex++ ) + pSelList[ iIndex ] = pSelList[ iIndex + 1 ]; + + (*pNumSelList)--; + fRemoved = TRUE; + } + } + + return ( fRemoved ); +} + + +//---------------------------------------------------------------------------------------------- +// GetRandomSelection +// +// Randomly selects an item in the selection list. The object counts are taken into account so +// that objects with higher counts will be chosen more often. +// +INT32 GetRandomSelection( void ) +{ + INT32 iRandNum, iTotalCounts; + INT32 iIndex, iSelectedIndex, iNextCount; + + if ( fDontUseRandom ) + { + fDontUseRandom = FALSE; + return( iCurBank ); + } + + iTotalCounts = 0; + for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ ) + iTotalCounts += (INT32)pSelList[ iIndex ].sCount; + + iRandNum = Random( iTotalCounts ); + + iSelectedIndex = -1; + iNextCount = 0; + for (iIndex = 0; iIndex < (*pNumSelList) && iSelectedIndex == -1; iIndex++ ) + { + iNextCount += (INT32)pSelList[ iIndex ].sCount; + if ( iRandNum < iNextCount ) + iSelectedIndex = iIndex; + } + + return ( iSelectedIndex ); +} + + +//---------------------------------------------------------------------------------------------- +// IsInSelectionList +// +// Verifies if a particular display list object exists in the current selection list. +// +BOOLEAN IsInSelectionList( DisplayList *pNode ) +{ + INT32 iIndex; + BOOLEAN fFound; + + fFound = FALSE; + for (iIndex = 0; iIndex < (*pNumSelList) && !fFound; iIndex++ ) + { + if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject && + pNode->uiIndex == pSelList[ iIndex ].usIndex ) + { + fFound = TRUE; + } + } + + return ( fFound ); +} + + +//---------------------------------------------------------------------------------------------- +// FindInSelectionList +// +// Finds an occurance of a particular display list object in the current selection list. +// if found, returns the selection list's index where it can be found. otherwise it +// returns -1 +// +INT32 FindInSelectionList( DisplayList *pNode ) +{ + INT32 iIndex,iUseIndex; + BOOLEAN fFound; + + fFound = FALSE; + iUseIndex = -1; + for (iIndex = 0; iIndex < (*pNumSelList) && !fFound; iIndex++ ) + { + if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject && + pNode->uiIndex == pSelList[ iIndex ].usIndex ) + { + fFound = TRUE; + iUseIndex = iIndex; + } + } + + return ( iUseIndex ); +} + + +//---------------------------------------------------------------------------------------------- +// SaveSelectionList +// +// Copies the current selection list to a save buffer. Used in case we want to cancel a +// selection window. +// +void SaveSelectionList( void ) +{ + INT32 iIndex; + + for (iIndex = 0; iIndex < MAX_SELECTIONS; iIndex++ ) + OldSelList[ iIndex ] = pSelList[ iIndex ]; + + iOldNumSelList = (*pNumSelList); +} + + +//---------------------------------------------------------------------------------------------- +// RestoreSelectionList +// +// Copies the selection list in the save buffer back to the current selection list. +// +void RestoreSelectionList( void ) +{ + INT32 iIndex; + + for (iIndex = 0; iIndex < MAX_SELECTIONS; iIndex++ ) + pSelList[ iIndex ] = OldSelList[ iIndex ]; + + (*pNumSelList) = iOldNumSelList; +} + + +//---------------------------------------------------------------------------------------------- +// OkClkCallback +// +// Button callback function for the selection window's OK button +void OkClkCallback( GUI_BUTTON *button, INT32 reason ) +{ + + + if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + button->uiFlags |= BUTTON_CLICKED_ON; + } + else if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + button->uiFlags &= (~BUTTON_CLICKED_ON); + fAllDone = TRUE; + } +} + + +//---------------------------------------------------------------------------------------------- +// CnclClkCallback +// +// Button callback function for the selection window's CANCEL button +// +void CnclClkCallback( GUI_BUTTON *button, INT32 reason ) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + button->uiFlags |= BUTTON_CLICKED_ON; + } + else if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + button->uiFlags &= (~BUTTON_CLICKED_ON); + fAllDone = TRUE; + RestoreSelectionList(); + } +} + + +//---------------------------------------------------------------------------------------------- +// UpClkCallback +// +// Button callback function for scrolling the selection window up +// +void UpClkCallback( GUI_BUTTON *button, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + button->uiFlags |= BUTTON_CLICKED_ON; + } + else if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + button->uiFlags &= (~BUTTON_CLICKED_ON ); + ScrollSelWinUp(); + } +} + + +//---------------------------------------------------------------------------------------------- +// ScrollSelWinUp +// +// Performs the calculations required to actually scroll a selection window up by one line. +// +void ScrollSelWinUp(void) +{ + DisplayList *pNode; + INT16 iCutOff,iBotCutOff; + BOOLEAN fDone; + + // Code to scroll window up! + pNode = pDispList; + iCutOff = iTopWinCutOff; + + fDone = FALSE; + while( (pNode != NULL) && !fDone ) + { + if (pNode->iY >= iTopWinCutOff) + { + iCutOff = pNode->iY; + pNode = pNode->pNext; + } + else + { + iCutOff = pNode->iY; + fDone = TRUE; + } + } + + iBotCutOff = iBotWinCutOff - iTopWinCutOff + iCutOff; + iTopWinCutOff = iCutOff; +} + + +//---------------------------------------------------------------------------------------------- +// ScrollSelWinDown +// +// Performs the actual calculations for scrolling a selection window down. +// +void ScrollSelWinDown(void) +{ + DisplayList *pNode; + INT16 iCutOff,iBotCutOff; + BOOLEAN fDone; + + pNode = pDispList; + iCutOff = iTopWinCutOff; + + fDone = FALSE; + while( (pNode != NULL) && !fDone ) + { + if (pNode->iY > iTopWinCutOff) + { + iCutOff = pNode->iY; + pNode = pNode->pNext; + } + else + fDone = TRUE; + } + + iBotCutOff = iBotWinCutOff - iTopWinCutOff + iCutOff; + iTopWinCutOff = iCutOff; +} + + +//---------------------------------------------------------------------------------------------- +// DwnClkCallback +// +// Button callback function to scroll the selection window down. +// +void DwnClkCallback( GUI_BUTTON *button, INT32 reason ) +{ + if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) + { + button->uiFlags |= BUTTON_CLICKED_ON; + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + button->uiFlags &= (~BUTTON_CLICKED_ON); + ScrollSelWinDown(); + } +} + + + +//---------------------------------------------------------------------------------------------- +// DrawSelections +// +// Displays the objects in the display list to the selection window. +// +void DrawSelections( void ) +{ + SGPRect ClipRect, NewRect; + + NewRect.iLeft = SelWinStartPoint.iX; + NewRect.iTop = SelWinStartPoint.iY; + NewRect.iRight = SelWinEndPoint.iX; + NewRect.iBottom = SelWinEndPoint.iY; + + GetClippingRect(&ClipRect); + SetClippingRect(&NewRect); + +// SetFont( gpSmallFont ); + SetFont( gpLargeFontType1 ); + SetObjectShade( gvoLargeFontType1, 0 ); +// SetObjectShade( gvoLargeFont, 0 ); + + DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &SelWinStartPoint, CLEAR_BACKGROUND ); + + SetObjectShade( gvoLargeFontType1, 4 ); + + SetClippingRect(&ClipRect); +} + + +//---------------------------------------------------------------------------------------------- +// BuildDisplayWindow +// +// Creates a display list from a display specification list. It also sets variables up for +// properly scrolling the window etc. +// +BOOLEAN BuildDisplayWindow( DisplaySpec *pDisplaySpecs, UINT16 usNumSpecs, DisplayList **pDisplayList, + SGPPoint * pUpperLeft, SGPPoint * pBottomRight, + SGPPoint * pSpacing, UINT16 fFlags ) +{ + INT32 iCurrX = pUpperLeft->iX; + INT32 iCurrY = pUpperLeft->iY; + UINT16 usGreatestHeightInRow = 0; + UINT16 usSpecLoop; + UINT16 usETRLELoop; + UINT16 usETRLEStart; + UINT16 usETRLEEnd; + DisplaySpec * pDisplaySpec; + ETRLEObject * pETRLEObject; + DisplayList *pCurNode; + + SaveSelectionList(); + + for (usSpecLoop = 0; usSpecLoop < usNumSpecs; usSpecLoop++) + { + pDisplaySpec = &(pDisplaySpecs[usSpecLoop]); + if (pDisplaySpec->ubType == DISPLAY_GRAPHIC) + { + if( !pDisplaySpec->hVObject ) + return FALSE; + usETRLEStart = pDisplaySpec->usStart; + usETRLEEnd = pDisplaySpec->usEnd; + + if ( usETRLEStart == DISPLAY_ALL_OBJECTS ) + { + usETRLEStart = 0; + usETRLEEnd = pDisplaySpec->hVObject->usNumberOfObjects - 1; + } + + if( usETRLEStart > usETRLEEnd ) + return FALSE; + if( usETRLEEnd >= pDisplaySpec->hVObject->usNumberOfObjects ) + return FALSE; + + for( usETRLELoop = usETRLEStart; usETRLELoop <= usETRLEEnd; usETRLELoop++) + { + pETRLEObject = &(pDisplaySpec->hVObject->pETRLEObject[usETRLELoop]); + + if ((iCurrX + pETRLEObject->usWidth > pBottomRight->iX) || (fFlags & ONE_COLUMN)) + { + if (fFlags & ONE_ROW) + { + break; + } + iCurrX = pUpperLeft->iX; + iCurrY += usGreatestHeightInRow + pSpacing->iY; + usGreatestHeightInRow = 0; + } + + if ((pCurNode = (DisplayList *)MemAlloc(sizeof(DisplayList))) != FALSE) + { + pCurNode->hObj = pDisplaySpec->hVObject; + pCurNode->uiIndex = usETRLELoop; + pCurNode->iX = (INT16)iCurrX; + pCurNode->iY = (INT16)iCurrY; + pCurNode->iWidth = pETRLEObject->usWidth; + pCurNode->iHeight = pETRLEObject->usHeight; + pCurNode->pNext = *pDisplayList; + pCurNode->uiObjIndx = pDisplaySpec->uiObjIndx; + + if ( IsInSelectionList( pCurNode ) ) + pCurNode->fChosen = TRUE; + else + pCurNode->fChosen = FALSE; + + *pDisplayList = pCurNode; + } + else + return(FALSE); + + if (pETRLEObject->usHeight > usGreatestHeightInRow) + { + usGreatestHeightInRow = pETRLEObject->usHeight; + } + + iCurrX += pETRLEObject->usWidth + pSpacing->iX; + } + } + } + + return( TRUE ); +} + + +//---------------------------------------------------------------------------------------------- +// DisplayWindowFunc +// +// Blits the actual object images in the display list on the selection window. The objects that +// have been selected (in the selection list) are highlighted and the count placed in the upper +// left corner of the image. +// +BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCutOff, SGPPoint *pUpperLeft, UINT16 fFlags) +{ + INT16 iCurrY; + INT16 sTempOffsetX; + INT16 sTempOffsetY; + BOOLEAN fReturnVal; + ETRLEObject * pETRLEObject; + UINT16 usFillColor; + INT16 sCount; + + if ( pNode == NULL ) + return(TRUE); + + if ( pNode->iY < iTopCutOff ) + return(TRUE); + + fReturnVal = FALSE; + if (DisplayWindowFunc(pNode->pNext, iTopCutOff, iBottomCutOff, pUpperLeft, fFlags)) + { + iCurrY = pUpperLeft->iY + pNode->iY - iTopCutOff; + + if ( iCurrY > iBottomCutOff ) + return(TRUE); + + pETRLEObject = &(pNode->hObj->pETRLEObject[pNode->uiIndex]); + + // We have to store the offset data in temp variables before zeroing them and blitting + sTempOffsetX = pETRLEObject->sOffsetX; + sTempOffsetY = pETRLEObject->sOffsetY; + + // Set the offsets used for blitting to 0 + pETRLEObject->sOffsetX = 0; + pETRLEObject->sOffsetY = 0; + + + if (fFlags & CLEAR_BACKGROUND) + { + usFillColor = SelWinFillColor; + if (pNode->fChosen) + usFillColor = SelWinHilightFillColor; + + ColorFillVideoSurfaceArea( FRAME_BUFFER, pNode->iX, iCurrY, + pNode->iX + pNode->iWidth, + iCurrY + pNode->iHeight, usFillColor); + } + + sCount = 0; + if (pNode->fChosen) + sCount = pSelList[ FindInSelectionList( pNode ) ].sCount; + + SetObjectShade( pNode->hObj, DEFAULT_SHADE_LEVEL ); + fReturnVal = BltVideoObject( FRAME_BUFFER, pNode->hObj, pNode->uiIndex, + (UINT16)pNode->iX, (UINT16)iCurrY, + VO_BLT_SRCTRANSPARENCY, NULL); + + if ( sCount != 0) + { + gprintf( pNode->iX, iCurrY, L"%d", sCount ); + } + + pETRLEObject->sOffsetX = sTempOffsetX; + pETRLEObject->sOffsetY = sTempOffsetY; + } + + return(fReturnVal); +} + + + + + +#endif + + + + + + diff --git a/Editor/selectwin.h b/Editor/selectwin.h new file mode 100644 index 00000000..ff596467 --- /dev/null +++ b/Editor/selectwin.h @@ -0,0 +1,186 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef _SELECTION_WIN_H_ +#define _SELECTION_WIN_H_ + +#include "Types.h" +#include "vobject.h" + +#include "mousesystem.h" +#include "Button System.h" + +#define CANCEL_ICON 0 +#define UP_ICON 1 +#define DOWN_ICON 2 +#define OK_ICON 3 + +extern INT32 iButtonIcons[4]; +extern INT32 iSelectWin,iCancelWin,iScrollUp,iScrollDown; + +extern BOOLEAN fAllDone; + +extern void CreateJA2SelectionWindow( INT16 sWhat ); +extern void InitJA2SelectionWindow( void ); +extern void ShutdownJA2SelectionWindow( void ); +extern void RemoveJA2SelectionWindow( void ); +extern void RenderSelectionWindow( void ); +extern void DrawSelections( void ); + + +extern void SelWinClkCallback( GUI_BUTTON *button, INT32 reason ); +extern void CnclClkCallback( GUI_BUTTON *button, INT32 reason ); +extern void UpClkCallback( GUI_BUTTON *button, INT32 reason ); +extern void DwnClkCallback( GUI_BUTTON *button, INT32 reason ); +extern void OkClkCallback( GUI_BUTTON *button, INT32 reason ); + +extern void ScrollSelWinUp(void); +extern void ScrollSelWinDown(void); + +// defines for DisplaySpec.ubType + +#define DISPLAY_TEXT 1 +#define DISPLAY_GRAPHIC 2 + +#define ONE_COLUMN 0x0001 +#define ONE_ROW 0x0002 +#define CLEAR_BACKGROUND 0x0004 + +#define DISPLAY_ALL_OBJECTS 0xffff + +#define MAX_SELECTIONS 120 + +enum +{ + SELWIN_SINGLEWALL, + SELWIN_SINGLEDOOR, + SELWIN_SINGLEWINDOW, + SELWIN_SINGLEROOF, + SELWIN_SINGLENEWROOF, + SELWIN_SINGLEBROKENWALL, + SELWIN_SINGLEDECOR, + SELWIN_SINGLEDECAL, + SELWIN_SINGLEFLOOR, + SELWIN_SINGLETOILET, + + SELWIN_ROOM, + SELWIN_BANKS, + SELWIN_ROADS, + SELWIN_DEBRIS, + SELWIN_OSTRUCTS, + SELWIN_OSTRUCTS1, + SELWIN_OSTRUCTS2 +}; + +typedef struct +{ + UINT8 ubType; + union + { + struct + { + HVOBJECT hVObject; + UINT16 usStart; + UINT16 usEnd; + UINT32 uiObjIndx; + }; + struct + { + UINT16 * pString; + }; + }; +} +DisplaySpec; + +typedef struct _DisplayList +{ + HVOBJECT hObj; + UINT16 uiIndex; + INT16 iX; + INT16 iY; + INT16 iWidth; + INT16 iHeight; + UINT32 uiObjIndx; + BOOLEAN fChosen; + struct _DisplayList *pNext; +} DisplayList; + +typedef struct _Selections +{ + UINT32 uiObject; + UINT16 usIndex; + INT16 sCount; +} Selections; + + +INT32 FindInSelectionList( DisplayList *pNode ); +BOOLEAN IsInSelectionList( DisplayList *pNode ); +INT32 GetRandomSelection( void ); +BOOLEAN RemoveFromSelectionList( DisplayList *pNode ); +void AddToSelectionList( DisplayList *pNode ); +void RestoreSelectionList( void ); +void SaveSelectionList( void ); +BOOLEAN ClearSelectionList( void ); + +void DisplaySelectionWindowGraphicalInformation(); + + +extern INT32 iCurBank; +extern Selections *pSelList; +extern INT32 *pNumSelList; + +extern Selections SelOStructs[ MAX_SELECTIONS ]; +extern Selections SelOStructs1[ MAX_SELECTIONS ]; +extern Selections SelOStructs2[ MAX_SELECTIONS ]; +extern Selections SelBanks[ MAX_SELECTIONS ]; +extern Selections SelRoads[ MAX_SELECTIONS ]; +extern Selections SelDebris[ MAX_SELECTIONS ]; + +extern Selections SelSingleWall[ MAX_SELECTIONS ]; +extern Selections SelSingleDoor[ MAX_SELECTIONS ]; +extern Selections SelSingleWindow[ MAX_SELECTIONS ]; +extern Selections SelSingleRoof[ MAX_SELECTIONS ]; +extern Selections SelSingleNewRoof[ MAX_SELECTIONS ]; +extern Selections SelSingleBrokenWall[ MAX_SELECTIONS ]; +extern Selections SelSingleDecor[ MAX_SELECTIONS ]; +extern Selections SelSingleDecal[ MAX_SELECTIONS ]; +extern Selections SelSingleFloor[ MAX_SELECTIONS ]; +extern Selections SelSingleToilet[ MAX_SELECTIONS ]; + +extern Selections SelRoom[ MAX_SELECTIONS ]; + +extern INT32 iNumOStructsSelected; +extern INT32 iNumOStructs1Selected; +extern INT32 iNumOStructs2Selected; +extern INT32 iNumBanksSelected; +extern INT32 iNumRoadsSelected; +extern INT32 iNumDebrisSelected; +extern INT32 iNumWallsSelected; +extern INT32 iNumDoorsSelected; +extern INT32 iNumWindowsSelected; +extern INT32 iNumDecorSelected; +extern INT32 iNumDecalsSelected; +extern INT32 iNumBrokenWallsSelected; +extern INT32 iNumFloorsSelected; +extern INT32 iNumToiletsSelected; +extern INT32 iNumRoofsSelected; +extern INT32 iNumNewRoofsSelected; +extern INT32 iNumRoomsSelected; + +extern INT32 iDrawMode; +extern DisplayList *TrashList( DisplayList *pNode ); + +extern BOOLEAN BuildDisplayWindow( DisplaySpec *pDisplaySpecs, UINT16 usNumSpecs, DisplayList **pDisplayList, + SGPPoint * pUpperLeft, SGPPoint * pBottomRight, + SGPPoint * pSpacing, UINT16 fFlags ); + +extern BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCutOff, SGPPoint *pUpperLeft, UINT16 fFlags); + +#endif +#endif + + + + + + diff --git a/Editor/smooth.cpp b/Editor/smooth.cpp new file mode 100644 index 00000000..bd6b87db --- /dev/null +++ b/Editor/smooth.cpp @@ -0,0 +1,733 @@ +#ifdef PRECOMPILEDHEADERS + #include "Editor All.h" +#else + #include "builddefines.h" +#endif + +#ifdef JA2EDITOR + +#ifndef PRECOMPILEDHEADERS + #include "stdlib.h" + #include "FileMan.h" + #include "time.h" + #include "debug.h" + #include "tiledef.h" + #include "worlddef.h" + #include "worldman.h" + #include "smooth.h" + #include "editscreen.h" + #include "selectwin.h" + #include "isometric utils.h" + #include "structure wrap.h" + #include "Exit Grids.h" + #include "Editor Undo.h" +#endif + +INT16 gbSmoothStruct[] = + +{ + 3, 2, 12, 27, 12, 0, + 5, 2, 15, 30, 39, 0, + 7, 2, 17, 32, 41, 0, + 11, 2, 14, 29, 14, 0, + 8, 2, 13, 28, 38, 0, + 15, 1, 19, 0, 43, 0, + 26, 1, 20, 0, 44, 0, + 12, 2, 18, 33, 42, 0, + 23, 1, 21, 0, 45, 0, + 18, 2, 16, 31, 40, 0, + 21, 1, 22, 0, 46, 0, + 14, 2, 11, 26, 11, 0, + 19, 1, 23, 0, 47, 0, + 16, 2, 24, 34, 48, 0, + 10, 2, 25, 35, 49, 0, + -1 +}; + +// This is a list of smoothed out water/shoreline textures +// Coding is as such: +// 1st - the corresponding bitvalue for the surrounding water tiles +// 2nd - the number of variations to randomize terrain +// 3rd - the first variation +// 4th - the second variation + +INT16 gbSmoothWaterStruct[] = +// FIRST ENTRY MAJIC NUMBER CALCULATED +// 2nd ENTRY # OF VARIATIONS +// 3rd, 4rth ENTRY TILE NUMBERS ( entry 1, entry 2 ) +{ + 1020, 1, 11, 0, + 1000, 1, 12, 0, + 510, 2, 13, 43, + 190, 1, 14, 0, + 894, 1, 15, 0, + 622, 1, 16, 0, + 1014, 2, 17, 41, + 944, 1, 18, 24, + 872, 1, 19, 0, + 992, 1, 20, 0, + 62, 1, 21, 0, + 190, 2, 22, 14, + 620, 1, 23, 0, + 944, 1, 24, 18, + 878, 2, 25, 32, + 434, 1, 28, 0, + 110, 1, 29,0, + 1010, 1, 30,0, + 876, 2, 31, 32, + 878, 2, 32, 31, + 1004, 2, 32, 31, + 1006, 2, 33, 34, + 1008, 2, 34, 33, + 1016, 2, 33, 34, + 126, 2, 35, 36, + 254, 2, 35, 26, + 638, 2, 36, 26, + 438, 2, 38, 27, + 446, 2, 37, 38, + 950, 2, 37, 27, + 864, 1, 39, 0, + 1040, 1, 40, 0, + 1014, 2, 41, 17, + 432, 1, 42, 0, + 510, 1, 43, 13, + 54, 1, 44, 0, + 108, 1, 45, 0, + -1 +}; + +BOOLEAN HigherLevel( UINT32 gridno, UINT8 NewLevel ); +BOOLEAN ContainsWater( UINT32 gridno ); + +void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth ) +{ + int temp=0,type=0; + int FullTile = FALSE; + UINT16 usOldIndex; + UINT16 usTempIndex; + UINT32 cnt; + BOOLEAN fFound; + UINT32 uiTempIndex; + UINT16 usTileIndex; + UINT16 land=0; + UINT32 uiTopType; + BOOLEAN fSameTile; + + INT16 *pSmoothStruct; + // Check to see if the orginal texture was water, is so, smooth square/hex with + // SmoothWaterTerrain rather than the proceeding method + if( origType==REGWATERTEXTURE) + { + SmoothWaterTerrain( gridno, origType, piNewTile, TRUE); + return; + } + pSmoothStruct = gbSmoothStruct; + + // Get land index value for given level and adjust according to type + if ( TypeExistsInLandLayer( gridno, origType, &usTileIndex ) ) + { + GetTypeSubIndexFromTileIndex( origType, usTileIndex, &usOldIndex ); + } + else + { + *piNewTile = NO_TILE; + return; + } + + // Check if we're dealing with a 'full' tile ( first ten ) + // If so, do not smooth + // Onlt do if we are not forcing the smooth + if ( !fForceSmooth ) + { + if ( usOldIndex >= 1 && usOldIndex <= 10 ) + { + *piNewTile = NO_TILE; + return; + } + } + + // is land height one tile above not the same type? + if ( (gridno- WORLD_COLS ) >= 0 ) + { + if ( !TypeExistsInLandLayer( gridno - WORLD_COLS, origType, &usTempIndex ) ) + { + // no it's not + temp+=3; + } + } + // is land height one tile to the right not the same type? + // (make sure there IS a tile to the right, i.e. check for border) + if ((gridno+1)% WORLD_COLS !=0) + { + if ( !TypeExistsInLandLayer( gridno+1, origType, &usTempIndex ) ) + { + // no it's not + temp+=5; + } + } + + // is land height one tile down not the same type? + if ( (gridno + WORLD_COLS ) < ( WORLD_COLS * WORLD_ROWS ) ) + { + if ( !TypeExistsInLandLayer( gridno + WORLD_COLS, origType, &usTempIndex ) ) + { + // no it's not + temp+=7; + } + } + + // is land height one tile to left not the same type? + if (gridno % WORLD_COLS!=0) + { + if ( !TypeExistsInLandLayer( gridno-1, origType, &usTempIndex ) ) + { + // no it's not + temp+=11; + } + } + + // Now, at this point the height (of "temp") will tell us + // which texture piece to use + + // Loop through smooth struct + cnt = 0; + fFound = FALSE; + + GetLandHeadType( gridno, &uiTopType ); + + while( pSmoothStruct[ cnt ] != -1 ) + { + if ( pSmoothStruct[ cnt ] == temp ) + { + fSameTile = FALSE; + // If water is it's top type + do + { + // CHeck if it's the same tile + if ( pSmoothStruct[ cnt + 2 ] == usOldIndex ) + { + fSameTile = TRUE; + } + if ( pSmoothStruct[ cnt + 3 ] ) + { + if ( pSmoothStruct[ cnt + 3 ] == usOldIndex ) + { + fSameTile = TRUE; + } + } + if ( fSameTile ) + { + *piNewTile = NO_TILE; + return; + } + uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ]; + land = pSmoothStruct[ cnt + 2 + uiTempIndex ]; + fFound = TRUE; + } while( FALSE ); + break; + } + cnt += 6; + }; + if ( !fFound ) + { + // Check for existance of same tile + if ( usOldIndex >= 1 && usOldIndex <= 10 ) + { + *piNewTile = NO_TILE; + return; + } + // this is a "full" tile, so randomize between the + // five available tiles + land = (rand( ) % 10 ) + 1; + FullTile = TRUE; + } + GetTileIndexFromTypeSubIndex( origType, land, &usTileIndex ); + *piNewTile = usTileIndex; +} + +void SmoothExitGridRadius( INT16 sMapIndex, UINT8 ubRadius ) +{ + LEVELNODE* pShadow; + INT16 x, y; + INT16 centerX, centerY; + + ConvertGridNoToXY( sMapIndex, ¢erX, ¢erY ); + + for( y = centerY - ubRadius; y <= centerY + ubRadius; y++ ) + { + for( x = centerX - ubRadius; x <= centerX + ubRadius; x++ ) + { + sMapIndex = y * WORLD_COLS + x; + if( GridNoOnVisibleWorldTile( sMapIndex ) ) + { + if( GetExitGridLevelNode( sMapIndex, &pShadow ) ) + { + UINT16 usIndex; + SmoothExitGrid( sMapIndex, &usIndex, TRUE ); + if( usIndex != NO_TILE && usIndex != pShadow->usIndex ) + { + AddToUndoList( sMapIndex ); + pShadow->usIndex = usIndex; + } + } + } + } + } +} + +void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth ) +{ + int temp=0,type=0; + int FullTile = FALSE; + UINT16 usOldIndex; + UINT16 usTempIndex; + UINT32 cnt; + BOOLEAN fFound; + UINT32 uiTempIndex; + UINT16 usTileIndex; + UINT16 usExitGridIndex=0; + BOOLEAN fSameTile; + + INT16 *pSmoothStruct; + + pSmoothStruct = gbSmoothStruct; + + // Get Object index value for given level and adjust according to type + if ( TypeExistsInShadowLayer( gridno, EXITTEXTURE, &usTileIndex ) ) + { + GetTypeSubIndexFromTileIndex( EXITTEXTURE, usTileIndex, &usOldIndex ); + } + else + { + *piNewTile = NO_TILE; + return; + } + + // Check if we're dealing with a 'full' tile ( first ten ) + // If so, do not smooth + // Onlt do if we are not forcing the smooth + if ( !fForceSmooth ) + { + if ( usOldIndex >= 1 && usOldIndex <= 10 ) + { + *piNewTile = NO_TILE; + return; + } + } + + // is Object height one tile above not the same type? + if ( (gridno- WORLD_COLS ) >= 0 ) + { + if ( !TypeExistsInShadowLayer( gridno - WORLD_COLS, EXITTEXTURE, &usTempIndex ) ) + { + // no it's not + temp+=3; + } + } + // is Object height one tile to the right not the same type? + // (make sure there IS a tile to the right, i.e. check for border) + if ((gridno+1)% WORLD_COLS !=0) + { + if ( !TypeExistsInShadowLayer( gridno+1, EXITTEXTURE, &usTempIndex ) ) + { + // no it's not + temp+=5; + } + } + + // is Object height one tile down not the same type? + if ( (gridno + WORLD_COLS ) < ( WORLD_COLS * WORLD_ROWS ) ) + { + if ( !TypeExistsInShadowLayer( gridno + WORLD_COLS, EXITTEXTURE, &usTempIndex ) ) + { + // no it's not + temp+=7; + } + } + + // is Object height one tile to left not the same type? + if (gridno % WORLD_COLS!=0) + { + if ( !TypeExistsInShadowLayer( gridno-1, EXITTEXTURE, &usTempIndex ) ) + { + // no it's not + temp+=11; + } + } + + // Now, at this point the height (of "temp") will tell us + // which texture piece to use + + // Loop through smooth struct + cnt = 0; + fFound = FALSE; + + while( pSmoothStruct[ cnt ] != -1 ) + { + if ( pSmoothStruct[ cnt ] == temp ) + { + fSameTile = FALSE; + // If water is it's top type + do + { + // CHeck if it's the same tile + if ( pSmoothStruct[ cnt + 2 ] == usOldIndex ) + { + fSameTile = TRUE; + } + if ( pSmoothStruct[ cnt + 3 ] ) + { + if ( pSmoothStruct[ cnt + 3 ] == usOldIndex ) + { + fSameTile = TRUE; + } + } + if ( fSameTile ) + { + *piNewTile = NO_TILE; + return; + } + uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ]; + usExitGridIndex = pSmoothStruct[ cnt + 2 + uiTempIndex ]; + fFound = TRUE; + } while( FALSE ); + break; + } + cnt += 6; + }; + if ( !fFound ) + { + // Check for existance of same tile + if ( usOldIndex >= 1 && usOldIndex <= 10 ) + { + *piNewTile = NO_TILE; + return; + } + // this is a "full" tile, so randomize between the + // five available tiles + usExitGridIndex = (rand( ) % 10 ) + 1; + FullTile = TRUE; + } + GetTileIndexFromTypeSubIndex( EXITTEXTURE, usExitGridIndex, &usTileIndex ); + *piNewTile = usTileIndex; +} + +void SmoothTerrainWorld( UINT32 uiCheckType ) +{ + int cnt; + UINT16 usIndex; + UINT16 NewTile; + // Smooth out entire world surrounding tiles + for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) + { + if ( TypeExistsInLandLayer( cnt, uiCheckType, &usIndex ) ) + { + SmoothTerrain( cnt, uiCheckType, &NewTile, TRUE ); + + if ( NewTile != NO_TILE ) + { + // Change tile + SetLandIndex( cnt, NewTile, uiCheckType, FALSE ); + } + } + } +} + + +void SmoothAllTerrainWorld( void ) +{ + int cnt; + UINT16 usIndex; + UINT16 NewTile; + UINT32 uiCheckType; + // Smooth out entire world surrounding tiles + for ( cnt = 0; cnt < WORLD_MAX; cnt++ ) + { + for ( uiCheckType = FIRSTTEXTURE; uiCheckType <= SEVENTHTEXTURE; uiCheckType++ ) + { + if ( TypeExistsInLandLayer( cnt, uiCheckType, &usIndex ) ) + { + SmoothTerrain( cnt, uiCheckType, &NewTile, TRUE ); + + if ( NewTile != NO_TILE ) + { + // Change tile + SetLandIndex( cnt, NewTile, uiCheckType, FALSE ); + } + } + } + } +} + +void SmoothTerrainRadius( UINT32 iMapIndex, UINT32 uiCheckType, UINT8 ubRadius, BOOLEAN fForceSmooth ) +{ + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2; + INT32 iNewIndex; + UINT16 NewTile; + UINT16 usIndex; + INT32 leftmost; + // Don't bother to smooth floors, they don't need them + if ( uiCheckType >= FIRSTFLOOR && uiCheckType <= LASTFLOOR ) + return; + // Determine start end end indicies and num rows + sTop = ubRadius; + sBottom = -ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; + for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) + { + leftmost = ( ( iMapIndex + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS; + for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) + { + iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2; + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + { + if ( TypeExistsInLandLayer( iNewIndex, uiCheckType, &usIndex ) ) + { + SmoothTerrain( iNewIndex, uiCheckType, &NewTile, fForceSmooth ); + + if ( NewTile != NO_TILE ) + { + // Change tile + AddToUndoList( iNewIndex ); + SetLandIndex( iNewIndex, NewTile, uiCheckType, FALSE ); + } + } + } + } + } +} + +void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForceSmooth ) +{ + INT16 sTop, sBottom; + INT16 sLeft, sRight; + INT16 cnt1, cnt2, cnt3; + INT32 iNewIndex; + UINT16 NewTile; + UINT16 usIndex; + INT32 leftmost; + // Determine start end end indicies and num rows + sTop = ubRadius; + sBottom = -ubRadius; + sLeft = - ubRadius; + sRight = ubRadius; + for( cnt3 = FIRSTTEXTURE; cnt3 <= SEVENTHTEXTURE; cnt3++ ) + { + for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ ) + { + leftmost = ( ( iMapIndex + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS; + for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ ) + { + iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2; + if ( iNewIndex >=0 && iNewIndex < WORLD_MAX && + iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) ) + { + if ( TypeExistsInLandLayer( iNewIndex, cnt3, &usIndex ) ) + { + SmoothTerrain( iNewIndex, cnt3, &NewTile, fForceSmooth ); + if ( NewTile != NO_TILE ) + { + // Change tile + SetLandIndex( iNewIndex, NewTile, cnt3, FALSE ); + } + } + } + } + } + } +} + +void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth ) +{ + // This procedure will calculate the approriate smooth texture for a water texture + // based on the surrounding water textures. This is done via masking bits within + // a temp variable, then searching for the right texture and inserting it + int temp=0,type=0; + int FullTile = FALSE; + UINT16 usOldIndex; + UINT16 usTempIndex; + UINT32 cnt; + BOOLEAN fFound; + UINT32 uiTempIndex; + UINT16 usTileIndex; + UINT16 land=0; + UINT32 uiTopType; + BOOLEAN fSameTile; + INT16 *pSmoothStruct; + + pSmoothStruct = gbSmoothWaterStruct; + // Get land index value for given level and adjust according to type + if ( TypeExistsInLandLayer( gridno, origType, &usTileIndex ) ) + { + GetTypeSubIndexFromTileIndex( origType, usTileIndex, &usOldIndex ); + } + else + { + *piNewTile = NO_TILE; + return; + } + // Check if we're dealing with a 'full' tile ( first ten ) + // If so, do not smooth + // Onlt do if we are not forcing the smooth + if ( !fForceSmooth ) + { + if ( usOldIndex >= 1 && usOldIndex <= 10 ) + { + *piNewTile = NO_TILE; + return; + } + } + // Mask approriate bits in temp for the lookup in the SmoothWaterStruct list + if ( (gridno- WORLD_COLS ) >= 0 ) + { + if ( TypeRangeExistsInLandLayer( gridno - WORLD_COLS, origType, origType, &usTempIndex ) ) + { + // no it's not + temp|=4; + } + } + // is land height one tile to the right not the same type? + // (make sure there IS a tile to the right, i.e. check for border) + if ((gridno+1)% WORLD_COLS !=0) + { + if ( TypeRangeExistsInLandLayer( gridno + 1, origType, origType, &usTempIndex ) ) + { + // no it's not + temp|=64; + } + } + // is land height one tile down not the same type? + if ( (gridno + WORLD_COLS ) < ( WORLD_COLS * WORLD_ROWS ) ) + { + if ( TypeRangeExistsInLandLayer( gridno + WORLD_COLS, origType, origType, &usTempIndex ) ) + { + // no it's not + temp|=256; + } + } + // is land height one tile to left not the same type? + if (gridno % WORLD_COLS!=0) + { + if ( TypeRangeExistsInLandLayer( gridno - 1, origType, origType, &usTempIndex ) ) + { + // no it's not + temp|=16; + } + } + if ((gridno+1)% WORLD_COLS !=0) + { + + if ( (gridno- WORLD_COLS ) >= 0 ) + { + if ( TypeRangeExistsInLandLayer( gridno - WORLD_COLS + 1, origType, origType, &usTempIndex ) ) + { + // no it's not + temp|=8; + } + } + } + if (gridno % WORLD_COLS!=0) + { + if ( (gridno- WORLD_COLS ) >= 0 ) + { + if ( TypeRangeExistsInLandLayer( gridno - WORLD_COLS - 1, origType, origType, &usTempIndex ) ) + { + // no it's not + temp|=2; + } + } + } + if ((gridno+1)% WORLD_COLS !=0) + { + if ( (gridno + WORLD_COLS ) < ( WORLD_COLS * WORLD_ROWS ) ) + { + if ( TypeRangeExistsInLandLayer( gridno + WORLD_COLS + 1, origType, origType, &usTempIndex ) ) + { + // no it's not + temp|=512; + } + } + } + if (gridno % WORLD_COLS!=0) + { + if ( (gridno + WORLD_COLS ) < ( WORLD_COLS * WORLD_ROWS ) ) + { + + if ( TypeRangeExistsInLandLayer( gridno + WORLD_COLS - 1, origType, origType, &usTempIndex ) ) + { + // no it's not + temp|=128; + } + } + } + if ( TypeRangeExistsInLandLayer( gridno, origType, origType, &usTempIndex ) ) + { + // no it's not + temp|=32; + } + // Loop through smooth struct + cnt = 0; + fFound = FALSE; + GetLandHeadType( gridno, &uiTopType ); + // Speed up of this while loop using double/quick search will result + // in an incorrect solution due to multiple instances of bitvalues in the list of + // smoothed water textures + while( pSmoothStruct[ cnt ] != -1 ) + { + if ( pSmoothStruct[ cnt ] == temp ) + { + fSameTile = FALSE; + do + { + // CHeck if it's the same tile + if ( pSmoothStruct[ cnt + 2 ] == usOldIndex ) + { + fSameTile = TRUE; + } + if ( pSmoothStruct[ cnt + 3 ] ) + { + if ( pSmoothStruct[ cnt + 3 ] == usOldIndex ) + { + fSameTile = TRUE; + } + } + if ( fSameTile ) + { + *piNewTile = NO_TILE; + return; + } + uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ]; + land = pSmoothStruct[ cnt + 2 + uiTempIndex ]; + fFound = TRUE; + } while( FALSE ); + break; + } + cnt += 4; + }; + if ( !fFound ) + { + // Check for existance of same tile + if ( usOldIndex >= 1 && usOldIndex <= 10 ) + { + *piNewTile = NO_TILE; + return; + } + land = (rand( ) % 10 ) + 1; + FullTile = TRUE; + } + GetTileIndexFromTypeSubIndex( origType, land, &usTileIndex ); + *piNewTile = usTileIndex; +} + + +#endif + + + + + + diff --git a/Editor/smooth.h b/Editor/smooth.h new file mode 100644 index 00000000..7d9b3d0b --- /dev/null +++ b/Editor/smooth.h @@ -0,0 +1,34 @@ +#include "BuildDefines.h" + +#ifdef JA2EDITOR +#ifndef __SMOOTH_H +#define __SMOOTH_H + +#define ONELEVELTYPEONEROOF 1 +#define ONELEVELTYPETWOROOF 2 + + +// Area (pointer to SGP rect) + +// Location to check-+--| | |---- Check left and right edges -----| |---- Check top and bottom edges -----| +#define IsLocationInArea( x, y, r ) ( ((x) >= r->iLeft) && ((x) <= r->iRight) && ((y) >= r->iTop) && ((y) <= r->iBottom) ) + + +void SmoothAllTerrainWorld( void ); +void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth ); + +void SmoothTerrainRadius( UINT32 iMapIndex, UINT32 uiCheckType, UINT8 ubRadius, BOOLEAN fForceSmooth ); +void SmoothTerrainWorld( UINT32 uiCheckType ); +void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth ); +void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForceSmooth ); + +void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth ); +void SmoothExitGridRadius( INT16 sMapIndex, UINT8 ubRadius ); + +#endif +#endif + + + + + + diff --git a/Fade Screen.cpp b/Fade Screen.cpp new file mode 100644 index 00000000..380c576e --- /dev/null +++ b/Fade Screen.cpp @@ -0,0 +1,698 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" +#else + #include "sgp.h" + #include "screenids.h" + #include "Timer Control.h" + #include "sys globals.h" + #include "fade screen.h" + #include "sysutil.h" + #include "vobject_blitters.h" + #include "cursor control.h" + #include "music control.h" + #include "Render Dirty.h" + #include "gameloop.h" +#endif + +#define SQUARE_STEP 8 + +extern UINT32 guiExitScreen; // symbol already declared globally in laptop.cpp (jonathanl) +BOOLEAN gfFadeInitialized = FALSE; +INT8 gbFadeValue; +INT16 gsFadeLimit; +UINT32 guiTime; +UINT32 guiFadeDelay; +BOOLEAN gfFirstTimeInFade = FALSE; +INT16 gsFadeCount; +INT8 gbFadeType; +// BOOLEAN gfFadeIn; // duplicate def (jonathanl) +INT32 giX1, giX2, giY1, giY2; +INT16 gsFadeRealCount; +BOOLEAN gfFadeInVideo; + +UINT32 uiOldMusicMode; + +FADE_FUNCTION gFadeFunction = NULL; + +FADE_HOOK gFadeInDoneCallback = NULL; +FADE_HOOK gFadeOutDoneCallback = NULL; + + +void FadeFrameBufferSquare( ); +void FadeFrameBufferVersionOne( ); +void FadeFrameBufferVersionFaster( INT8 bFadeValue ); +void FadeFrameBufferSide( ); +void FadeFrameBufferRealFade( ); + +void FadeInBackBufferVersionOne( ); +void FadeInBackBufferSquare( ); +void FadeInFrameBufferRealFade( ); + + +extern BOOLEAN ShadowVideoSurfaceRectUsingLowPercentTable( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2); +BOOLEAN UpdateSaveBufferWithBackbuffer( void ); + + +BOOLEAN gfFadeIn = FALSE; +BOOLEAN gfFadeOut = FALSE; +BOOLEAN gfFadeOutDone = FALSE; +BOOLEAN gfFadeInDone = FALSE; + + +void FadeInNextFrame( ) +{ + gfFadeIn = TRUE; + gfFadeInDone = FALSE; +} + +void FadeOutNextFrame( ) +{ + gfFadeOut = TRUE; + gfFadeOutDone = FALSE; +} + + +BOOLEAN HandleBeginFadeIn( UINT32 uiScreenExit ) +{ + if ( gfFadeIn ) + { + BeginFade( uiScreenExit, 35, FADE_IN_REALFADE, 5 ); + + gfFadeIn = FALSE; + + gfFadeInDone = TRUE; + + return( TRUE ); + } + + return( FALSE ); +} + +BOOLEAN HandleBeginFadeOut( UINT32 uiScreenExit ) +{ + if ( gfFadeOut ) + { + BeginFade( uiScreenExit, 35, FADE_OUT_REALFADE, 5 ); + + gfFadeOut = FALSE; + + gfFadeOutDone = TRUE; + + return( TRUE ); + } + + return( FALSE ); +} + + +BOOLEAN HandleFadeOutCallback( ) +{ + if ( gfFadeOutDone ) + { + gfFadeOutDone = FALSE; + + if ( gFadeOutDoneCallback != NULL ) + { + gFadeOutDoneCallback( ); + + gFadeOutDoneCallback = NULL; + + return( TRUE ); + } + } + + return( FALSE ); +} + + +BOOLEAN HandleFadeInCallback( ) +{ + if ( gfFadeInDone ) + { + gfFadeInDone = FALSE; + + if ( gFadeInDoneCallback != NULL ) + { + gFadeInDoneCallback( ); + } + + gFadeInDoneCallback = NULL; + + return( TRUE ); + } + + return( FALSE ); +} + + +void BeginFade( UINT32 uiExitScreen, INT8 bFadeValue, INT8 bType, UINT32 uiDelay ) +{ + //Init some paramters + guiExitScreen = uiExitScreen; + gbFadeValue = bFadeValue; + guiFadeDelay = uiDelay; + gfFadeIn = FALSE; + gfFadeInVideo = TRUE; + + uiOldMusicMode = uiMusicHandle; + + + // Calculate step; + switch ( bType ) + { + case FADE_IN_REALFADE: + + gsFadeRealCount = -1; + gsFadeLimit = 8; + gFadeFunction = (FADE_FUNCTION)FadeInFrameBufferRealFade; + gfFadeInVideo = FALSE; + + // Copy backbuffer to savebuffer + UpdateSaveBufferWithBackbuffer( ); + + // Clear framebuffer + ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + break; + + case FADE_OUT_REALFADE: + + gsFadeRealCount = -1; + gsFadeLimit = 10; + gFadeFunction = (FADE_FUNCTION)FadeFrameBufferRealFade; + gfFadeInVideo = FALSE; + + // Clear framebuffer + //ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + break; + + case FADE_OUT_VERSION_ONE: + //gsFadeLimit = 255 / bFadeValue; + //gFadeFunction = (FADE_FUNCTION)FadeFrameBufferVersionOne; + //SetMusicFadeSpeed( 25 ); + //SetMusicMode( MUSIC_NONE ); + break; + + case FADE_OUT_SQUARE: + gsFadeLimit = (SCREEN_WIDTH / ( SQUARE_STEP * 2 ) ); + giX1 = 0; + giX2 = SCREEN_WIDTH; + giY1 = 0; + giY2 = SCREEN_HEIGHT; + gFadeFunction = (FADE_FUNCTION)FadeFrameBufferSquare; + + // Zero frame buffer + ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + //ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + + // SetMusicFadeSpeed( 25 ); + //SetMusicMode( MUSIC_NONE ); + break; + + case FADE_IN_VERSION_ONE: + gsFadeLimit = 255 / bFadeValue; + gFadeFunction = (FADE_FUNCTION)FadeInBackBufferVersionOne; + break; + + case FADE_IN_SQUARE: + gFadeFunction = (FADE_FUNCTION)FadeInBackBufferSquare; + giX1 = SCREEN_WIDTH/2; + giX2 = SCREEN_WIDTH/2; + giY1 = SCREEN_HEIGHT/2; + giY2 = SCREEN_HEIGHT/2; + gsFadeLimit = (SCREEN_WIDTH / ( SQUARE_STEP * 2 ) ); + gfFadeIn = TRUE; + break; + + case FADE_OUT_VERSION_FASTER: + gsFadeLimit = (255 / bFadeValue) * 2; + gFadeFunction = (FADE_FUNCTION)FadeFrameBufferVersionFaster; + + //SetMusicFadeSpeed( 25 ); + //SetMusicMode( MUSIC_NONE ); + break; + + case FADE_OUT_VERSION_SIDE: + // Copy frame buffer to save buffer + gsFadeLimit = (SCREEN_WIDTH / 8 ); + gFadeFunction = (FADE_FUNCTION)FadeFrameBufferSide; + + //SetMusicFadeSpeed( 25 ); + //SetMusicMode( MUSIC_NONE ); + break; + + } + + gfFadeInitialized = TRUE; + gfFirstTimeInFade = TRUE; + gsFadeCount = 0; + gbFadeType = bType; + + SetPendingNewScreen(FADE_SCREEN); + +} + + +UINT32 FadeScreenInit( ) +{ + return( TRUE ); +} + + +UINT32 FadeScreenHandle( ) +{ + UINT32 uiTime; + + if ( !gfFadeInitialized ) + { + SET_ERROR( "Fade Screen called but not intialized " ); + return( ERROR_SCREEN ); + } + + // ATE: Remove cursor + SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); + + + if ( gfFirstTimeInFade ) + { + gfFirstTimeInFade = FALSE; + + // Calcuate delay + guiTime = GetJA2Clock( ); + } + + // Get time + uiTime = GetJA2Clock( ); + + MusicPoll( TRUE ); + + if ( ( uiTime - guiTime ) > guiFadeDelay ) + { + // Fade! + if ( !gfFadeIn ) + { + //gFadeFunction( ); + } + + InvalidateScreen(); + + if ( !gfFadeInVideo ) + { + gFadeFunction( ); + } + + gsFadeCount++; + + if ( gsFadeCount > gsFadeLimit ) + { + switch( gbFadeType ) + { + case FADE_OUT_REALFADE: + + // Clear framebuffer + ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + break; + } + + //End! + gfFadeInitialized = FALSE; + gfFadeIn = FALSE; + + return( guiExitScreen ); + } + } + + return( FADE_SCREEN ); +} + +UINT32 FadeScreenShutdown( ) +{ + + return( FALSE ); +} + + +void FadeFrameBufferVersionOne( ) +{ + INT32 cX, cY; + UINT32 uiDestPitchBYTES; + UINT16 *pBuf; + INT16 bR, bG, bB; + UINT32 uiRGBColor; + UINT16 s16BPPSrc; + + + pBuf = (UINT16*)LockVideoSurface(FRAME_BUFFER, &uiDestPitchBYTES); + + // LOCK FRAME BUFFER + for ( cX = 0; cX < SCREEN_WIDTH; cX++ ) + { + for ( cY = 0; cY < SCREEN_HEIGHT; cY++ ) + { + s16BPPSrc = pBuf[ ( cY * 640 ) + cX ]; + + uiRGBColor = GetRGBColor( s16BPPSrc ); + + bR = SGPGetRValue( uiRGBColor ); + bG = SGPGetGValue( uiRGBColor ); + bB = SGPGetBValue( uiRGBColor ); + + // Fade down + bR -= gbFadeValue; + if ( bR < 0 ) + bR = 0; + + bG -= gbFadeValue; + if ( bG < 0 ) + bG = 0; + + bB -= gbFadeValue; + if ( bB < 0 ) + bB = 0; + + // Set back info buffer + pBuf[ ( cY * SCREEN_WIDTH ) + cX ] = Get16BPPColor( FROMRGB( bR, bG, bB ) ); + + } + } + + UnLockVideoSurface(FRAME_BUFFER); + +} + +void FadeInBackBufferVersionOne( ) +{ + INT32 cX, cY; + UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; + UINT16 *pSrcBuf, *pDestBuf; + INT16 bR, bG, bB; + UINT32 uiRGBColor; + UINT16 s16BPPSrc; + INT16 bFadeVal = ( gsFadeLimit - gsFadeCount ) * gbFadeValue; + + pDestBuf = (UINT16*)LockVideoSurface(BACKBUFFER, &uiDestPitchBYTES); + pSrcBuf = (UINT16*)LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES); + + // LOCK FRAME BUFFER + for ( cX = 0; cX < SCREEN_WIDTH; cX++ ) + { + for ( cY = 0; cY < SCREEN_HEIGHT; cY++ ) + { + s16BPPSrc = pSrcBuf[ ( cY * SCREEN_WIDTH ) + cX ]; + + uiRGBColor = GetRGBColor( s16BPPSrc ); + + bR = SGPGetRValue( uiRGBColor ); + bG = SGPGetGValue( uiRGBColor ); + bB = SGPGetBValue( uiRGBColor ); + + // Fade down + bR -= bFadeVal; + if ( bR < 0 ) + bR = 0; + + bG -= bFadeVal; + if ( bG < 0 ) + bG = 0; + + bB -= bFadeVal; + if ( bB < 0 ) + bB = 0; + + // Set back info dest buffer + pDestBuf[ ( cY * SCREEN_WIDTH ) + cX ] = Get16BPPColor( FROMRGB( bR, bG, bB ) ); + + } + } + + UnLockVideoSurface(FRAME_BUFFER); + UnLockVideoSurface(BACKBUFFER); + +} + + +void FadeFrameBufferVersionFaster( INT8 bFadeValue ) +{ + INT32 cX, cY, iStartX, iStartY; + UINT32 uiDestPitchBYTES; + UINT16 *pBuf; + INT16 bR, bG, bB; + UINT32 uiRGBColor; + UINT16 s16BPPSrc; + + + pBuf = (UINT16*)LockVideoSurface(FRAME_BUFFER, &uiDestPitchBYTES); + + iStartX = gsFadeCount % 2; + iStartY = 0; + + // LOCK FRAME BUFFER + for ( cX = iStartX; cX < SCREEN_WIDTH; cX+= 2 ) + { + if ( iStartX == 1 ) + { + iStartX = 0; + } + else + { + iStartX = 1; + } + + for ( cY = iStartY; cY < SCREEN_HEIGHT; cY++ ) + { + s16BPPSrc = pBuf[ ( cY * SCREEN_WIDTH ) + cX ]; + + uiRGBColor = GetRGBColor( s16BPPSrc ); + + bR = SGPGetRValue( uiRGBColor ); + bG = SGPGetGValue( uiRGBColor ); + bB = SGPGetBValue( uiRGBColor ); + + // Fade down + bR -= bFadeValue; + if ( bR < 0 ) + bR = 0; + + bG -= bFadeValue; + if ( bG < 0 ) + bG = 0; + + bB -= bFadeValue; + if ( bB < 0 ) + bB = 0; + + // Set back info buffer + pBuf[ ( cY * SCREEN_WIDTH ) + cX ] = Get16BPPColor( FROMRGB( bR, bG, bB ) ); + + } + } + + UnLockVideoSurface(FRAME_BUFFER); + +} + + +void FadeFrameBufferSide( ) +{ + INT32 iX1, iX2; + INT16 sFadeMove; + + sFadeMove = gsFadeCount * 4; + + iX1 = 0; + iX2 = sFadeMove; + + ColorFillVideoSurfaceArea( FRAME_BUFFER, iX1, 0, iX2, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + + iX1 = 640 - sFadeMove; + iX2 = 640; + + ColorFillVideoSurfaceArea( FRAME_BUFFER, iX1, 0, iX2, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + +} + +void FadeFrameBufferSquare( ) +{ + INT32 iX1, iX2, iY1, iY2; + INT16 sFadeXMove, sFadeYMove; + + sFadeXMove = SQUARE_STEP; + sFadeYMove = (INT16)(sFadeXMove * .75); + + + iX1 = giX1; + iX2 = giX1 + sFadeXMove; + iY1 = giY1; + iY2 = giY1 + sFadeYMove; + + ColorFillVideoSurfaceArea( BACKBUFFER, iX1, 0, iX2, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + ColorFillVideoSurfaceArea( BACKBUFFER, 0, iY1, SCREEN_WIDTH, iY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + + iX1 = giX2 - sFadeXMove; + iX2 = giX2; + iY1 = giY2 - sFadeYMove; + iY2 = giY2; + + ColorFillVideoSurfaceArea( BACKBUFFER, iX1, 0, iX2, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + ColorFillVideoSurfaceArea( BACKBUFFER, 0, iY1, SCREEN_WIDTH, iY2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + + giX1 += sFadeXMove; + giX2 -= sFadeXMove; + giY1 += sFadeYMove; + giY2 -= sFadeYMove; + +} + + +void FadeInBackBufferSquare( ) +{ + INT32 iX1, iX2, iY1, iY2; + INT16 sFadeXMove, sFadeYMove; + blt_vs_fx BltFx; + + sFadeXMove = SQUARE_STEP; + sFadeYMove = (INT16)(sFadeXMove * .75); + + if ( gsFadeCount == 0 ) + { + ColorFillVideoSurfaceArea( BACKBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + } + + iX1 = giX1 - sFadeXMove; + iX2 = giX1; + iY1 = giY1 - sFadeYMove; + iY2 = giY2 + sFadeYMove; + + BltFx.SrcRect.iLeft = iX1; + BltFx.SrcRect.iTop = iY1; + BltFx.SrcRect.iRight = iX2; + BltFx.SrcRect.iBottom = iY2; + + if ( BltFx.SrcRect.iRight != BltFx.SrcRect.iLeft ) + { + BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, + iX1, iY1, + VS_BLT_SRCSUBRECT, &BltFx ); + } + + iX1 = giX2; + iX2 = giX2 + sFadeXMove; + iY1 = giY1 - sFadeYMove; + iY2 = giY2 + sFadeYMove; + + BltFx.SrcRect.iLeft = iX1; + BltFx.SrcRect.iTop = iY1; + BltFx.SrcRect.iRight = iX2; + BltFx.SrcRect.iBottom = iY2; + + if ( BltFx.SrcRect.iRight != BltFx.SrcRect.iLeft ) + { + BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, + iX1, iY1, + VS_BLT_SRCSUBRECT, &BltFx ); + } + + iX1 = giX1; + iX2 = giX2; + iY1 = giY1 - sFadeYMove; + iY2 = giY1; + + BltFx.SrcRect.iLeft = iX1; + BltFx.SrcRect.iTop = iY1; + BltFx.SrcRect.iRight = iX2; + BltFx.SrcRect.iBottom = iY2; + + if ( BltFx.SrcRect.iBottom != BltFx.SrcRect.iTop ) + { + BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, + iX1, iY1, + VS_BLT_SRCSUBRECT, &BltFx ); + } + + iX1 = giX1; + iX2 = giX2; + iY1 = giY2; + iY2 = giY2 + sFadeYMove; + + BltFx.SrcRect.iLeft = iX1; + BltFx.SrcRect.iTop = iY1; + BltFx.SrcRect.iRight = iX2; + BltFx.SrcRect.iBottom = iY2; + + if ( BltFx.SrcRect.iBottom != BltFx.SrcRect.iTop ) + { + BltVideoSurface( BACKBUFFER, FRAME_BUFFER, 0, + iX1, iY1, + VS_BLT_SRCSUBRECT, &BltFx ); + } + + giX1 -= sFadeXMove; + giX2 += sFadeXMove; + giY1 -= sFadeYMove; + giY2 += sFadeYMove; + +} + + +void FadeFrameBufferRealFade( ) +{ + if ( gsFadeRealCount != gsFadeCount ) + { + ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + gsFadeRealCount = gsFadeCount; + } + +} + + +void FadeInFrameBufferRealFade( ) +{ + INT32 cnt; + + if ( gsFadeRealCount != gsFadeCount ) + { + + for ( cnt = 0; cnt < ( gsFadeLimit - gsFadeCount ); cnt++ ) + { + ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + } + + // Refresh Screen + RefreshScreen( NULL ); + + // Copy save buffer back + RestoreExternBackgroundRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + gsFadeRealCount = gsFadeCount; + } + +} + + +BOOLEAN UpdateSaveBufferWithBackbuffer(void) +{ + UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; + UINT8 *pDestBuf, *pSrcBuf; + UINT16 usWidth, usHeight; + UINT8 ubBitDepth; + + + // Update saved buffer - do for the viewport size ony! + GetCurrentVideoSettings( &usWidth, &usHeight, &ubBitDepth ); + + pSrcBuf = LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES); + pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); + + if(gbPixelDepth==16) + { + // BLIT HERE + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + } + + UnLockVideoSurface(FRAME_BUFFER); + UnLockVideoSurface(guiSAVEBUFFER); + + return(TRUE); +} diff --git a/Fade Screen.h b/Fade Screen.h new file mode 100644 index 00000000..5f764b7e --- /dev/null +++ b/Fade Screen.h @@ -0,0 +1,40 @@ +#ifndef FADE_SCREEN_H +#define FADE_SCREEN_H + +#define FADE_OUT_VERSION_ONE 1 +#define FADE_OUT_VERSION_FASTER 2 +#define FADE_OUT_VERSION_SIDE 3 +#define FADE_OUT_SQUARE 4 +#define FADE_OUT_REALFADE 5 + +#define FADE_IN_VERSION_ONE 10 +#define FADE_IN_SQUARE 11 +#define FADE_IN_REALFADE 12 + +typedef void (*FADE_HOOK)( void ); + +extern FADE_HOOK gFadeInDoneCallback; +extern FADE_HOOK gFadeOutDoneCallback; + + +typedef void (*FADE_FUNCTION)( void ); + + +extern BOOLEAN gfFadeInitialized; +extern BOOLEAN gfFadeIn; +extern INT8 gbFadeType; +extern FADE_FUNCTION gFadeFunction; +extern BOOLEAN gfFadeInVideo; + +void BeginFade( UINT32 uiExitScreen, INT8 bFadeValue, INT8 bType, UINT32 uiDelay ); + +BOOLEAN HandleBeginFadeIn( UINT32 uiScreenExit ); +BOOLEAN HandleBeginFadeOut( UINT32 uiScreenExit ); + +BOOLEAN HandleFadeOutCallback( ); +BOOLEAN HandleFadeInCallback( ); + +void FadeInNextFrame( ); +void FadeOutNextFrame( ); + +#endif \ No newline at end of file diff --git a/GameInitOptionsScreen.cpp b/GameInitOptionsScreen.cpp new file mode 100644 index 00000000..da7c717d --- /dev/null +++ b/GameInitOptionsScreen.cpp @@ -0,0 +1,1355 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" + #include "Intro.h" +#else + #include "Types.h" + #include "GameInitOptionsScreen.h" + #include "GameSettings.h" + #include "Utilities.h" + #include "wCheck.h" + #include "Font Control.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Input.h" + #include "Options Screen.h" + #include "English.h" + #include "Sysutil.h" + #include "Fade Screen.h" + #include "Cursor Control.h" + #include "Music Control.h" + #include "cursors.h" + #include "Intro.h" +#endif + +//////////////////////////////////////////// +// +// Global Defines +// +/////////////////////////////////////////// + +#define GIO_TITLE_FONT FONT14ARIAL//FONT16ARIAL +#define GIO_TITLE_COLOR FONT_MCOLOR_WHITE + +#define GIO_TOGGLE_TEXT_FONT FONT12ARIAL//FONT16ARIAL +#define GIO_TOGGLE_TEXT_COLOR FONT_MCOLOR_WHITE + +//buttons +#define GIO_BTN_OK_X iScreenWidthOffset + ((320 - 115) / 2) +#define GIO_BTN_OK_Y iScreenHeightOffset + 435 +#define GIO_CANCEL_X iScreenWidthOffset + 320 + 143 + +//main title +#define GIO_MAIN_TITLE_X 0 +#define GIO_MAIN_TITLE_Y iScreenHeightOffset + 10 +#define GIO_MAIN_TITLE_WIDTH SCREEN_WIDTH + +//radio box locations +#define GIO_GAP_BN_SETTINGS 35 +#define GIO_OFFSET_TO_TEXT 30 +#define GIO_OFFSET_TO_TOGGLE_BOX 250 +#define GIO_OFFSET_TO_TOGGLE_BOX_Y 9 + + +#define GIO_DIF_SETTINGS_X iScreenWidthOffset + 20 +#define GIO_DIF_SETTINGS_Y iScreenHeightOffset + 75 +#define GIO_DIF_SETTINGS_WIDTH GIO_OFFSET_TO_TOGGLE_BOX - GIO_OFFSET_TO_TEXT + +// Madd +#define GIO_GAME_SETTINGS_X GIO_DIF_SETTINGS_X +#define GIO_GAME_SETTINGS_Y GIO_GUN_SETTINGS_Y +#define GIO_GAME_SETTINGS_WIDTH GIO_DIF_SETTINGS_WIDTH + +#define GIO_GUN_SETTINGS_X GIO_BR_SETTING_X +#define GIO_GUN_SETTINGS_Y iScreenHeightOffset + 242 +#define GIO_GUN_SETTINGS_WIDTH GIO_DIF_SETTINGS_WIDTH + +/* +#define GIO_TIMED_TURN_SETTING_X GIO_DIF_SETTINGS_X +#define GIO_TIMED_TURN_SETTING_Y GIO_GAME_SETTINGS_Y +#define GIO_TIMED_TURN_SETTING_WIDTH GIO_DIF_SETTINGS_WIDTH +*/ + +// Madd +#define GIO_BR_SETTING_X iScreenWidthOffset + 340 +#define GIO_BR_SETTING_Y GIO_DIF_SETTINGS_Y +#define GIO_BR_SETTING_WIDTH GIO_DIF_SETTINGS_WIDTH + +#define GIO_IRON_MAN_SETTING_X iScreenWidthOffset + 20 +#define GIO_IRON_MAN_SETTING_Y iScreenHeightOffset + 355 +#define GIO_IRON_MAN_SETTING_WIDTH GIO_DIF_SETTINGS_WIDTH + +//Difficulty settings +enum +{ + GIO_DIFF_EASY, + GIO_DIFF_MED, + GIO_DIFF_HARD, + GIO_DIFF_INSANE, + NUM_DIFF_SETTINGS, +}; + +// Game Settings options +enum +{ + GIO_REALISTIC, + GIO_SCI_FI, + //GIO_PLATINUM, + + NUM_GAME_STYLES, +}; + +// Gun options +enum +{ + GIO_REDUCED_GUNS, + GIO_GUN_NUT, + + NUM_GUN_OPTIONS, +}; + +// Madd +// BR options +enum +{ + GIO_BR_GOOD, + GIO_BR_GREAT, + GIO_BR_EXCELLENT, + GIO_BR_AWESOME, + + NUM_BR_OPTIONS, +}; + +// JA2Gold: no more timed turns setting + +/* +//enum for the timed turns setting +enum +{ + GIO_NO_TIMED_TURNS, + GIO_TIMED_TURNS, + + GIO_NUM_TIMED_TURN_OPTIONS, +}; +*/ + +// Iron man mode + +enum +{ + GIO_CAN_SAVE, + GIO_IRON_MAN, + + NUM_SAVE_OPTIONS, +}; + +//enum for different states of game +enum +{ + GIO_NOTHING, + GIO_CANCEL, + GIO_EXIT, + GIO_IRON_MAN_MODE +}; + +//////////////////////////////////////////// +// +// Global Variables +// +/////////////////////////////////////////// + +BOOLEAN gfGIOScreenEntry = TRUE; +BOOLEAN gfGIOScreenExit = FALSE; +BOOLEAN gfReRenderGIOScreen=TRUE; +BOOLEAN gfGIOButtonsAllocated = FALSE; + +UINT8 gubGameOptionScreenHandler=GIO_NOTHING; + +UINT32 gubGIOExitScreen = GAME_INIT_OPTIONS_SCREEN; + +UINT32 guiGIOMainBackGroundImage; + + +INT32 giGioMessageBox = -1; +//BOOLEAN gfExitGioDueToMessageBox=FALSE; + + +//UINT8 gubDifficultySettings[ NUM_DIFF_SETTINGS ]; +//UINT8 gubGameSettings[ NUM_GAME_STYLES ]; +//UINT8 gubGunSettings[ NUM_GUN_OPTIONS ]; + +//extern INT32 gp16PointArial; + + +// Done Button +void BtnGIODoneCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiGIODoneButton; +INT32 giGIODoneBtnImage; + +// Cancel Button +void BtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiGIOCancelButton; +INT32 giGIOCancelBtnImage; + + +//checkbox to toggle the Diff level +UINT32 guiDifficultySettingsToggles[ NUM_DIFF_SETTINGS ]; +void BtnDifficultyTogglesCallback(GUI_BUTTON *btn,INT32 reason); + +//checkbox to toggle Game style +UINT32 guiGameStyleToggles[ NUM_GAME_STYLES ]; +void BtnGameStyleTogglesCallback(GUI_BUTTON *btn,INT32 reason); + +//checkbox to toggle Gun options +UINT32 guiGunOptionToggles[ NUM_GUN_OPTIONS ]; +void BtnGunOptionsTogglesCallback(GUI_BUTTON *btn,INT32 reason); + +// JA2Gold: no more timed turns setting +/* +//checkbox to toggle Timed turn option on or off +UINT32 guiTimedTurnToggles[ GIO_NUM_TIMED_TURN_OPTIONS ]; +void BtnTimedTurnsTogglesCallback(GUI_BUTTON *btn,INT32 reason); +*/ + +//checkbox to toggle Save style +UINT32 guiGameSaveToggles[ NUM_SAVE_OPTIONS ]; +void BtnGameSaveTogglesCallback(GUI_BUTTON *btn,INT32 reason); + +//checkbox to toggle BR selection +UINT32 guiBROptionToggles[ NUM_BR_OPTIONS ]; +void BtnBROptionTogglesCallback(GUI_BUTTON *btn,INT32 reason); + + +//////////////////////////////////////////// +// +// Local Function Prototypes +// +/////////////////////////////////////////// + +extern void ClearMainMenu(); + +BOOLEAN EnterGIOScreen(); +BOOLEAN ExitGIOScreen(); +void HandleGIOScreen(); +BOOLEAN RenderGIOScreen(); +void GetGIOScreenUserInput(); +UINT8 GetCurrentGunButtonSetting(); +// JA2Gold: added save (iron man) button setting +UINT8 GetCurrentGameSaveButtonSetting(); +UINT8 GetCurrentGameStyleButtonSetting(); +UINT8 GetCurrentDifficultyButtonSetting(); +void RestoreGIOButtonBackGrounds(); +void DoneFadeOutForExitGameInitOptionScreen( void ); +void DoneFadeInForExitGameInitOptionScreen( void ); +// JA2Gold: no more timed turns setting +//UINT8 GetCurrentTimedTurnsButtonSetting(); +BOOLEAN DoGioMessageBox( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); +void DisplayMessageToUserAboutGameDifficulty(); +void ConfirmGioDifSettingMessageBoxCallBack( UINT8 bExitValue ); +BOOLEAN DisplayMessageToUserAboutIronManMode(); +void ConfirmGioIronManMessageBoxCallBack( UINT8 bExitValue ); + + +UINT32 GameInitOptionsScreenInit( void ) +{ + return( 1 ); +} + + +UINT32 GameInitOptionsScreenHandle( void ) +{ + StartFrameBufferRender(); + + if( gfGIOScreenEntry ) + { +// PauseGame(); + + EnterGIOScreen(); + gfGIOScreenEntry = FALSE; + gfGIOScreenExit = FALSE; + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + } + + GetGIOScreenUserInput(); + + + HandleGIOScreen(); + + // render buttons marked dirty + MarkButtonsDirty( ); + RenderButtons( ); + + // render help +// RenderFastHelp( ); +// RenderButtonsFastHelp( ); + + + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + + if ( HandleFadeOutCallback( ) ) + { + ClearMainMenu(); + return( gubGIOExitScreen ); + } + + if ( HandleBeginFadeOut( gubGIOExitScreen ) ) + { + return( gubGIOExitScreen ); + } + + if( gfGIOScreenExit ) + { + ExitGIOScreen(); + } + + if ( HandleFadeInCallback( ) ) + { + // Re-render the scene! + RenderGIOScreen(); + } + + if ( HandleBeginFadeIn( gubGIOExitScreen ) ) + { + } + + return( gubGIOExitScreen ); +} + + +UINT32 GameInitOptionsScreenShutdown( void ) +{ + return( 1 ); +} + + +BOOLEAN EnterGIOScreen() +{ + VOBJECT_DESC VObjectDesc; + UINT16 cnt; + UINT16 usPosY; + + if( gfGIOButtonsAllocated ) + return( TRUE ); + + SetCurrentCursorFromDatabase( CURSOR_NORMAL ); + + // load the Main trade screen backgroiund image + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + + if (iResolution == 0) + { + FilenameForBPP("INTERFACE\\OptionsScreenBackGround.sti", VObjectDesc.ImageFile); + } + else if (iResolution == 1) + { + FilenameForBPP("INTERFACE\\OptionsScreenBackGround_800x600.sti", VObjectDesc.ImageFile); + } + else if (iResolution == 2) + { + FilenameForBPP("INTERFACE\\OptionsScreenBackGround_1024x768.sti", VObjectDesc.ImageFile); + } + + CHECKF(AddVideoObject(&VObjectDesc, &guiGIOMainBackGroundImage )); + + //Ok button + giGIODoneBtnImage = LoadButtonImage("INTERFACE\\PreferencesButtons.sti", -1,0,-1,2,-1 ); + guiGIODoneButton = CreateIconAndTextButton( giGIODoneBtnImage, gzGIOScreenText[GIO_OK_TEXT], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + GIO_BTN_OK_X, GIO_BTN_OK_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIODoneCallback); + + SpecifyButtonSoundScheme( guiGIODoneButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + SpecifyDisabledButtonStyle( guiGIODoneButton, DISABLED_STYLE_NONE ); + + //Cancel button + giGIOCancelBtnImage = UseLoadedButtonImage( giGIODoneBtnImage, -1,1,-1,3,-1 ); + guiGIOCancelButton = CreateIconAndTextButton( giGIOCancelBtnImage, gzGIOScreenText[GIO_CANCEL_TEXT], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + GIO_CANCEL_X, GIO_BTN_OK_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGIOCancelCallback ); + SpecifyButtonSoundScheme( guiGIOCancelButton, BUTTON_SOUND_SCHEME_BIGSWITCH3 ); + + + // + //Check box to toggle Difficulty settings + // + usPosY = GIO_DIF_SETTINGS_Y - GIO_OFFSET_TO_TOGGLE_BOX_Y; + + for( cnt=0; cntuiFlags |= BUTTON_CLICKED_ON; + + else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM ) + ButtonList[ guiDifficultySettingsToggles[ GIO_DIFF_MED ] ]->uiFlags |= BUTTON_CLICKED_ON; + + else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD ) + ButtonList[ guiDifficultySettingsToggles[ GIO_DIFF_HARD ] ]->uiFlags |= BUTTON_CLICKED_ON; + + else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE ) + ButtonList[ guiDifficultySettingsToggles[ GIO_DIFF_INSANE ] ]->uiFlags |= BUTTON_CLICKED_ON; + + else + ButtonList[ guiDifficultySettingsToggles[ GIO_DIFF_MED ] ]->uiFlags |= BUTTON_CLICKED_ON; + + + // + //Check box to toggle Game settings ( realistic, sci fi ) + // + + usPosY = GIO_GAME_SETTINGS_Y - GIO_OFFSET_TO_TOGGLE_BOX_Y; + for( cnt=0; cntuiFlags |= BUTTON_CLICKED_ON; + else // if(gGameOptions.ubGameStyle == STYLE_REALISTIC) + ButtonList[ guiGameStyleToggles[ GIO_REALISTIC ] ]->uiFlags |= BUTTON_CLICKED_ON; +// else +// ButtonList[ guiGameStyleToggles[ GIO_PLATINUM ] ]->uiFlags |= BUTTON_CLICKED_ON; + + + // Madd + usPosY = GIO_BR_SETTING_Y - GIO_OFFSET_TO_TOGGLE_BOX_Y; + for( cnt=0; cntuiFlags |= BUTTON_CLICKED_ON; + break; + case BR_GREAT: + ButtonList[ guiBROptionToggles[ GIO_BR_GREAT ] ]->uiFlags |= BUTTON_CLICKED_ON; + break; + case BR_EXCELLENT: + ButtonList[ guiBROptionToggles[ GIO_BR_EXCELLENT ] ]->uiFlags |= BUTTON_CLICKED_ON; + break; + case BR_AWESOME: + ButtonList[ guiBROptionToggles[ GIO_BR_AWESOME ] ]->uiFlags |= BUTTON_CLICKED_ON; + break; + } + + // JA2Gold: iron man buttons + usPosY = GIO_IRON_MAN_SETTING_Y - GIO_OFFSET_TO_TOGGLE_BOX_Y; + for( cnt=0; cntuiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ guiGameSaveToggles[ GIO_CAN_SAVE ] ]->uiFlags |= BUTTON_CLICKED_ON; + + + // + // Toggle Air Strikes On / Off + // + + usPosY = GIO_GUN_SETTINGS_Y - GIO_OFFSET_TO_TOGGLE_BOX_Y; + for( cnt=0; cntuiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ guiGunOptionToggles[ GIO_REDUCED_GUNS ] ]->uiFlags |= BUTTON_CLICKED_ON; + +// JA2 Gold: no more timed turns + // + // Check box to toggle the timed turn option + // +/* + usPosY = GIO_TIMED_TURN_SETTING_Y - GIO_OFFSET_TO_TOGGLE_BOX_Y; + for( cnt=0; cntuiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ guiTimedTurnToggles[ GIO_NO_TIMED_TURNS ] ]->uiFlags |= BUTTON_CLICKED_ON; +*/ + + + + //Reset the exit screen + gubGIOExitScreen = GAME_INIT_OPTIONS_SCREEN; + + //REnder the screen once so we can blt ot to ths save buffer + RenderGIOScreen(); + + BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + gfGIOButtonsAllocated = TRUE; + + return( TRUE ); +} + + +BOOLEAN ExitGIOScreen() +{ + UINT16 cnt; + + if( !gfGIOButtonsAllocated ) + return( TRUE ); + + //Delete the main options screen background + DeleteVideoObjectFromIndex( guiGIOMainBackGroundImage ); + + RemoveButton( guiGIOCancelButton ); + RemoveButton( guiGIODoneButton ); + + UnloadButtonImage( giGIOCancelBtnImage ); + UnloadButtonImage( giGIODoneBtnImage ); + + + //Check box to toggle Difficulty settings + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + UINT8 cnt; + + for( cnt=0; cntuiFlags &= ~BUTTON_CLICKED_ON; + } + + //enable the current button + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + UINT8 cnt; + BOOLEAN fAnyChecked=FALSE; + + //if none of the other boxes are checked, do not uncheck this box + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + fAnyChecked = TRUE; + } + } + //if none are checked, re check this one + if( !fAnyChecked ) + btn->uiFlags |= BUTTON_CLICKED_ON; + } + } +} + +//Madd +void BtnBROptionTogglesCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT8 ubButton = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + UINT8 cnt; + + for( cnt=0; cntuiFlags &= ~BUTTON_CLICKED_ON; + } + + //enable the current button + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + UINT8 cnt; + BOOLEAN fAnyChecked=FALSE; + + //if none of the other boxes are checked, do not uncheck this box + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + fAnyChecked = TRUE; + } + } + //if none are checked, re check this one + if( !fAnyChecked ) + btn->uiFlags |= BUTTON_CLICKED_ON; + } + } +} + +void BtnGameStyleTogglesCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT8 ubButton = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + UINT8 cnt; + + for( cnt=0; cntuiFlags &= ~BUTTON_CLICKED_ON; + } + + //enable the current button + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + UINT8 cnt; + BOOLEAN fAnyChecked=FALSE; + + //if none of the other boxes are checked, do not uncheck this box + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + fAnyChecked = TRUE; + } + } + //if none are checked, re check this one + if( !fAnyChecked ) + btn->uiFlags |= BUTTON_CLICKED_ON; + } + } +} + +void BtnGameSaveTogglesCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { +// UINT8 ubButton = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + UINT8 cnt; + + for( cnt=0; cntuiFlags &= ~BUTTON_CLICKED_ON; + } + + //enable the current button + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + UINT8 cnt; + BOOLEAN fAnyChecked=FALSE; + + //if none of the other boxes are checked, do not uncheck this box + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + fAnyChecked = TRUE; + } + } + //if none are checked, re check this one + if( !fAnyChecked ) + btn->uiFlags |= BUTTON_CLICKED_ON; + } + } +} + +void BtnGunOptionsTogglesCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT8 ubButton = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + UINT8 cnt; + + for( cnt=0; cntuiFlags &= ~BUTTON_CLICKED_ON; + } + + //enable the current button + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + UINT8 cnt; + BOOLEAN fAnyChecked=FALSE; + + //if none of the other boxes are checked, do not uncheck this box + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + fAnyChecked = TRUE; + } + } + //if none are checked, re check this one + if( !fAnyChecked ) + btn->uiFlags |= BUTTON_CLICKED_ON; + } + } +} + +// JA2Gold: no more timed turns setting +/* +void BtnTimedTurnsTogglesCallback( GUI_BUTTON *btn, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT8 ubButton = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + UINT8 cnt; + + for( cnt=0; cntuiFlags &= ~BUTTON_CLICKED_ON; + } + + //enable the current button + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + UINT8 cnt; + BOOLEAN fAnyChecked=FALSE; + + //if none of the other boxes are checked, do not uncheck this box + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + fAnyChecked = TRUE; + } + } + //if none are checked, re check this one + if( !fAnyChecked ) + btn->uiFlags |= BUTTON_CLICKED_ON; + } + } +} +*/ + + + + +void BtnGIODoneCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //if the user doesnt have IRON MAN mode selected + if( !DisplayMessageToUserAboutIronManMode() ) + { + //Confirm the difficulty setting + DisplayMessageToUserAboutGameDifficulty(); + } + + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnGIOCancelCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + gubGameOptionScreenHandler = GIO_CANCEL; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +UINT8 GetCurrentDifficultyButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + + return( 0 ); +} + + + +//Madd +UINT8 GetCurrentBROptionButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + +UINT8 GetCurrentGameStyleButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + + + +UINT8 GetCurrentGunButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + +// JA2 Gold: no timed turns +/* +UINT8 GetCurrentTimedTurnsButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} +*/ + +UINT8 GetCurrentGameSaveButtonSetting() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + { + return( cnt ); + } + } + return( 0 ); +} + + + +void RestoreGIOButtonBackGrounds() +{ + UINT8 cnt; + UINT16 usPosY; + + + usPosY = GIO_DIF_SETTINGS_Y-GIO_OFFSET_TO_TOGGLE_BOX_Y; + //Check box to toggle Difficulty settings + for( cnt=0; cntuiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ guiGameSaveToggles[ GIO_CAN_SAVE ] ]->uiFlags |= BUTTON_CLICKED_ON; + } +} diff --git a/GameInitOptionsScreen.h b/GameInitOptionsScreen.h new file mode 100644 index 00000000..32a6c212 --- /dev/null +++ b/GameInitOptionsScreen.h @@ -0,0 +1,12 @@ +#ifndef _GAME_INIT_OPTIONS_SCREEN_H_ +#define _GAME_INIT_OPTIONS_SCREEN_H_ + + +UINT32 GameInitOptionsScreenInit( void ); +UINT32 GameInitOptionsScreenHandle( void ); +UINT32 GameInitOptionsScreenShutdown( void ); + + + + +#endif diff --git a/GameSettings.cpp b/GameSettings.cpp new file mode 100644 index 00000000..79903bbb --- /dev/null +++ b/GameSettings.cpp @@ -0,0 +1,734 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" + #include "HelpScreen.h" + #include "Campaign.h" + #include "Cheats.h" + #include "INIReader.h" +#else + #include "Types.h" + #include "GameSettings.h" + #include "FileMan.h" + #include "String.h" + #include "Sound Control.h" + #include "SaveLoadScreen.h" + #include "Music Control.h" + #include "Options Screen.h" + #include "Overhead.h" + #include "GameVersion.h" + #include "LibraryDataBase.h" + #include "Debug.h" + #include "Language Defines.h" + #include "HelpScreen.h" + #include "INIReader.h" +#endif + +#include "Text.h" + +#define GAME_SETTINGS_FILE "..\\Ja2.set" + +#define GAME_INI_FILE "..\\Ja2.ini" + +#define GAME_EXTERNAL_OPTIONS_FILE "Ja2_Options.ini" + +#define CD_ROOT_DIR "DATA\\" + +GAME_SETTINGS gGameSettings; +GAME_OPTIONS gGameOptions; +// Snap: Options read from an INI file in the default of custom Data directory +GAME_EXTERNAL_OPTIONS gGameExternalOptions; + +extern SGPFILENAME gCheckFilenames[]; +extern CHAR8 gzErrorMsg[256]; + +void InitGameSettings(); + +BOOLEAN GetCdromLocationFromIniFile( STR pRootOfCdromDrive ); + +extern BOOLEAN DoJA2FilesExistsOnDrive( CHAR8 *zCdLocation ); + +BOOLEAN GetCDromDriveLetter( STR8 pString ); +BOOLEAN IsDriveLetterACDromDrive( STR pDriveLetter ); +void CDromEjectionErrorMessageBoxCallBack( UINT8 bExitValue ); + + +//Change this number when we want any who gets the new build to reset the options +#define GAME_SETTING_CURRENT_VERSION 522 + + + +BOOLEAN LoadGameSettings() +{ + HWFILE hFile; + UINT32 uiNumBytesRead; + + + //if the game settings file does NOT exist, or if it is smaller then what it should be + if( !FileExists( GAME_SETTINGS_FILE ) || FileSize( GAME_SETTINGS_FILE ) != sizeof( GAME_SETTINGS ) ) + { + //Initialize the settings + InitGameSettings(); + + //delete the shade tables aswell + DeleteShadeTableDir( ); + } + else + { + hFile = FileOpen( GAME_SETTINGS_FILE, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + InitGameSettings(); + return(FALSE); + } + + FileRead( hFile, &gGameSettings, sizeof( GAME_SETTINGS ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( GAME_SETTINGS ) ) + { + FileClose( hFile ); + InitGameSettings(); + return(FALSE); + } + + FileClose( hFile ); + } + + + //if the version in the game setting file is older then the we want, init the game settings + if( gGameSettings.uiSettingsVersionNumber < GAME_SETTING_CURRENT_VERSION ) + { + //Initialize the settings + InitGameSettings(); + + //delete the shade tables aswell + DeleteShadeTableDir( ); + + return( TRUE ); + } + + + // + //Do checking to make sure the settings are valid + // + if( gGameSettings.bLastSavedGameSlot < 0 || gGameSettings.bLastSavedGameSlot >= NUM_SAVE_GAMES ) + gGameSettings.bLastSavedGameSlot = -1; + + if( gGameSettings.ubMusicVolumeSetting > HIGHVOLUME ) + gGameSettings.ubMusicVolumeSetting = MIDVOLUME; + + if( gGameSettings.ubSoundEffectsVolume > HIGHVOLUME ) + gGameSettings.ubSoundEffectsVolume = MIDVOLUME; + + if( gGameSettings.ubSpeechVolume > HIGHVOLUME ) + gGameSettings.ubSpeechVolume = MIDVOLUME; + + + //make sure that at least subtitles or speech is enabled + if( !gGameSettings.fOptions[ TOPTION_SUBTITLES ] && !gGameSettings.fOptions[ TOPTION_SPEECH ] ) + { + gGameSettings.fOptions[ TOPTION_SUBTITLES ] = TRUE; + gGameSettings.fOptions[ TOPTION_SPEECH ] = TRUE; + } + + + // + // Set the settings + // + + SetSoundEffectsVolume( gGameSettings.ubSoundEffectsVolume ); + SetSpeechVolume( gGameSettings.ubSpeechVolume ); + MusicSetVolume( gGameSettings.ubMusicVolumeSetting ); + +#ifndef BLOOD_N_GORE_ENABLED + gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] = FALSE; +#endif + + //if the user doesnt want the help screens present + if( gGameSettings.fHideHelpInAllScreens ) + { + gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen = 0; + } + else + { + //Set it so that every screens help will come up the first time ( the 'x' will be set ) + gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen = 0xffff; + } + + return( TRUE ); +} + + +BOOLEAN SaveGameSettings() +{ + HWFILE hFile; + UINT32 uiNumBytesWritten; + + + + //create the file + hFile = FileOpen( GAME_SETTINGS_FILE, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + return(FALSE); + } + + + + //Record the current settings into the game settins structure + + gGameSettings.ubSoundEffectsVolume = (UINT8)GetSoundEffectsVolume( ); + gGameSettings.ubSpeechVolume = (UINT8)GetSpeechVolume( ); + gGameSettings.ubMusicVolumeSetting = (UINT8)MusicGetVolume( ); + + strcpy( gGameSettings.zVersionNumber, czVersionNumber ); + + gGameSettings.uiSettingsVersionNumber = GAME_SETTING_CURRENT_VERSION; + + //Write the game settings to disk + FileWrite( hFile, &gGameSettings, sizeof( GAME_SETTINGS ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( GAME_SETTINGS ) ) + { + FileClose( hFile ); + return(FALSE); + } + + FileClose( hFile ); + + return( TRUE ); +} + +void InitGameSettings() +{ + memset( &gGameSettings, 0, sizeof( GAME_SETTINGS ) ); + + //Init the Game Settings + gGameSettings.bLastSavedGameSlot = -1; + gGameSettings.ubMusicVolumeSetting = 63; + gGameSettings.ubSoundEffectsVolume = 63; + gGameSettings.ubSpeechVolume = 63; + + //Set the settings + SetSoundEffectsVolume( gGameSettings.ubSoundEffectsVolume ); + SetSpeechVolume( gGameSettings.ubSpeechVolume ); + MusicSetVolume( gGameSettings.ubMusicVolumeSetting ); + + gGameSettings.fOptions[ TOPTION_SUBTITLES ] = TRUE; + gGameSettings.fOptions[ TOPTION_SPEECH ] = TRUE; + gGameSettings.fOptions[ TOPTION_KEY_ADVANCE_SPEECH ] = FALSE; + gGameSettings.fOptions[ TOPTION_RTCONFIRM ] = FALSE; + gGameSettings.fOptions[ TOPTION_HIDE_BULLETS ] = FALSE; + gGameSettings.fOptions[ TOPTION_TRACKING_MODE ] = TRUE; + gGameSettings.fOptions[ TOPTION_MUTE_CONFIRMATIONS ] = FALSE; + gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] = TRUE; + gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] = TRUE; + gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] = FALSE; + gGameSettings.fOptions[ TOPTION_OLD_SELECTION_METHOD ] = FALSE; + gGameSettings.fOptions[ TOPTION_ALWAYS_SHOW_MOVEMENT_PATH ] = FALSE; + + gGameSettings.fOptions[ TOPTION_SLEEPWAKE_NOTIFICATION ] = TRUE; + + gGameSettings.fOptions[ TOPTION_USE_METRIC_SYSTEM ] = FALSE; + + #ifndef BLOOD_N_GORE_ENABLED + gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] = FALSE; + #endif + + gGameSettings.fOptions[ TOPTION_MERC_ALWAYS_LIGHT_UP ] = FALSE; + gGameSettings.fOptions[ TOPTION_SMART_CURSOR ] = FALSE; + + gGameSettings.fOptions[ TOPTION_SNAP_CURSOR_TO_DOOR ] = TRUE; + gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] = TRUE; + gGameSettings.fOptions[ TOPTION_TOGGLE_TREE_TOPS ] = TRUE; + gGameSettings.fOptions[ TOPTION_TOGGLE_WIREFRAME ] = TRUE; + gGameSettings.fOptions[ TOPTION_3D_CURSOR ] = FALSE; + gGameSettings.fOptions[ TOPTION_CTH_CURSOR ] = TRUE; +//Madd: + gGameSettings.fOptions[ TOPTION_GL_BURST_CURSOR ] = TRUE; + gGameSettings.fOptions[ TOPTION_DROP_ALL ] = FALSE; + // JA2Gold + gGameSettings.fOptions[ TOPTION_MERC_CASTS_LIGHT ] = TRUE; + + gGameSettings.ubSizeOfDisplayCover = 4; + gGameSettings.ubSizeOfLOS = 4; + + //Since we just set the settings, save them + SaveGameSettings(); +} + +void InitGameOptions() +{ + memset( &gGameOptions, 0, sizeof( GAME_OPTIONS ) ); + + //Init the game options + gGameOptions.ubBobbyRay = BR_GOOD; + gGameOptions.fGunNut = TRUE; + gGameOptions.fAirStrikes = FALSE; + gGameOptions.ubGameStyle = STYLE_SCIFI; + gGameOptions.ubDifficultyLevel = DIF_LEVEL_MEDIUM; + //gGameOptions.fTurnTimeLimit = FALSE; + + gGameOptions.fIronManMode = FALSE; + +} + + +// Snap: Read options from an INI file in the default of custom Data directory +void LoadGameExternalOptions() +{ + + //Kaiden: Setting Ja2_Options.ini file to be read + CIniReader iniReader(GAME_EXTERNAL_OPTIONS_FILE); + + gGameExternalOptions.iStartingCashNovice = iniReader.ReadInteger("Options", "NOVICE_CASH",45000); + gGameExternalOptions.iStartingCashExperienced = iniReader.ReadInteger("Options", "EXPERIENCED_CASH",35000); + gGameExternalOptions.iStartingCashExpert = iniReader.ReadInteger("Options", "EXPERT_CASH",30000); + gGameExternalOptions.iStartingCashInsane = iniReader.ReadInteger("Options", "INSANE_CASH",15000); + + gGameExternalOptions.fSellAll = iniReader.ReadBoolean("Options","CAN_SELL_ALT_LMB",TRUE); + gGameExternalOptions.iPriceModifier = iniReader.ReadInteger("Options","PRICE_MODIFIER",4); + + gGameExternalOptions.iMinAttribute = iniReader.ReadInteger("Options","MIN_ATTRIBUTE_POINT",35); + gGameExternalOptions.iMaxAttribute = iniReader.ReadInteger("Options","MAX_ATTRIBUTE_POINT",90); + gGameExternalOptions.iImpAttributePoints = iniReader.ReadInteger("Options","IMPATTRIBUTEPOINTS",40); + gGameExternalOptions.iMaxZeroBonus = iniReader.ReadInteger("Options","MAX_ZERO_BONUS",15); + gGameExternalOptions.iStartAttribute = iniReader.ReadInteger("Options","START_ATTRIBUTE",55); + + gGameExternalOptions.iMaxMilitiaPerSector = iniReader.ReadInteger("Options","MAX_MILITIA_PER_SECTOR",20); + gGameExternalOptions.iTrainingSquadSize = iniReader.ReadInteger("Options","MAX_TRAINING_SQUAD_SIZE",10); + gGameExternalOptions.iMilitiaTrainingCost = iniReader.ReadInteger("Options","MILITIA_TRAINING_COST",750); + gGameExternalOptions.iMinLoyaltyToTrain = iniReader.ReadInteger("Options","MIN_LOYALTY_TO_TRAIN",20); + + gGameExternalOptions.iMaxEnemyGroupSize = iniReader.ReadInteger("Options","MAX_STRATEGIC_TEAM_SIZE",20); + + + gGameExternalOptions.iReinforcementPoolNovice = iniReader.ReadInteger("Options","NOVICE_QUEENS_POOL_OF_TROOPS",150); + gGameExternalOptions.iReinforcementPoolExperienced = iniReader.ReadInteger("Options","EXPERIENCED_QUEENS_POOL_OF_TROOPS",200); + gGameExternalOptions.iReinforcementPoolExpert = iniReader.ReadInteger("Options","EXPERT_QUEENS_POOL_OF_TROOPS",400); + gGameExternalOptions.iReinforcementPoolInsane = iniReader.ReadInteger("Options","INSANE_QUEENS_POOL_OF_TROOPS",8000); + + gGameExternalOptions.iForcePercentageNovice = iniReader.ReadInteger("Options","NOVICE_INITIAL_GARRISON_PERCENTAGES",70); + gGameExternalOptions.iForcePercentageExperienced = iniReader.ReadInteger("Options","EXPERIENCED_INITIAL_GARRISON_PERCENTAGES",100); + gGameExternalOptions.iForcePercentageExpert = iniReader.ReadInteger("Options","EXPERT_INITIAL_GARRISON_PERCENTAGES",150); + gGameExternalOptions.iForcePercentageInsane = iniReader.ReadInteger("Options","INSANE_INITIAL_GARRISON_PERCENTAGES",200); + + gGameExternalOptions.iPercentElitesBonusExpert = iniReader.ReadInteger("Options","EXPERT_ELITE_BONUS",25); + gGameExternalOptions.iPercentElitesBonusInsane = iniReader.ReadInteger("Options","INSANE_ELITE_BONUS",25); + + gGameExternalOptions.ubMinEnemyGroupSizeNovice = iniReader.ReadInteger("Options","NOVICE_MIN_ENEMY_GROUP_SIZE",3); + gGameExternalOptions.ubMinEnemyGroupSizeExperienced = iniReader.ReadInteger("Options","EXPERIENCED_MIN_ENEMY_GROUP_SIZE",4); + gGameExternalOptions.ubMinEnemyGroupSizeExpert = iniReader.ReadInteger("Options","EXPERT_MIN_ENEMY_GROUP_SIZE",6); + gGameExternalOptions.ubMinEnemyGroupSizeInsane = iniReader.ReadInteger("Options","INSANE_MIN_ENEMY_GROUP_SIZE",8); + + + gGameExternalOptions.fMercDayOne = iniReader.ReadBoolean("Options","MERC_AVAILABLE_DAY_ONE",FALSE); + gGameExternalOptions.fAllMercsAvailable = iniReader.ReadBoolean("Options","ALL_MERCS_AT_MERC",FALSE); + + gGameExternalOptions.fPers_att = iniReader.ReadBoolean("Options","USE_RANDOM_PERSONALITY",FALSE); + gGameExternalOptions.iCustomPersonality = iniReader.ReadInteger("Options","CUSTOM_PERSONALITY",6); + gGameExternalOptions.iCustomAttitude = iniReader.ReadInteger("Options","CUSTOM_ATTITUDE",0); + +} + + +BOOLEAN GetCDLocation( ) +{ + UINT32 uiStrngLength = 0; + CHAR8 zCdLocation[ SGPFILENAME_LEN ]; + UINT32 uiDriveType=0; + UINT32 uiRetVal=0; + + //Do a crude check to make sure the Ja2.ini file is the right on + + uiRetVal = GetPrivateProfileString( "Ja2 Settings","CD", "", zCdLocation, SGPFILENAME_LEN, GAME_INI_FILE ); + if( uiRetVal == 0 || !IsDriveLetterACDromDrive( zCdLocation ) ) + { + // the user most likely doesnt have the file, or the user has messed with the file + // build a new one + + //First delete the old file + // Snap: don't clobber the INI file! + //FileDelete( GAME_INI_FILE ); + + //Get the location of the cdrom drive + if( GetCDromDriveLetter( zCdLocation ) ) + { + CHAR8 *pTemp; + + //if it succeeded + pTemp = strrchr( zCdLocation, ':' ); + pTemp[0] = '\0'; + } + else + { + //put in a default location + sprintf( zCdLocation, "c" ); + } + + //Now create a new file + WritePrivateProfileString( "Ja2 Settings", "CD", zCdLocation, GAME_INI_FILE ); + + GetPrivateProfileString( "Ja2 Settings","CD", "", zCdLocation, SGPFILENAME_LEN, GAME_INI_FILE ); + } + + uiStrngLength = strlen( zCdLocation ); + + //if the string length is less the 1 character, it is a drive letter + if( uiStrngLength == 1 ) + { + sprintf( gzCdDirectory, "%s:\\%s", zCdLocation, CD_ROOT_DIR ); + } + + //else it is most likely a network location + else if( uiStrngLength > 1 ) + { + sprintf( gzCdDirectory, "%s\\%s", zCdLocation, CD_ROOT_DIR ); + } + else + { + //no path was entered + gzCdDirectory[ 0 ] = '.'; + } + + return( TRUE ); +} + + + +BOOLEAN GetCDromDriveLetter( STR8 pString ) +{ + UINT32 uiSize=0; + UINT8 ubCnt=0; + CHAR8 zDriveLetters[512]; + CHAR8 zDriveLetter[16]; + UINT32 uiDriveType; + + uiSize = GetLogicalDriveStrings( 512, zDriveLetters ); + + for( ubCnt=0;ubCnt 32 || ubMeanwhile > NUM_MEANWHILES ) + { + return( FALSE ); + } + + uiCheckFlag = 0x1 << ubMeanwhile; + + if ( gGameSettings.uiMeanwhileScenesSeenFlags & uiCheckFlag ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + +BOOLEAN SetMeanwhileSceneSeen( UINT8 ubMeanwhile ) +{ + UINT32 uiCheckFlag; + + if ( ubMeanwhile > 32 || ubMeanwhile > NUM_MEANWHILES ) + { + // can't set such a flag! + return( FALSE ); + } + uiCheckFlag = 0x1 << ubMeanwhile; + gGameSettings.uiMeanwhileScenesSeenFlags |= uiCheckFlag; + return( TRUE ); +} + +BOOLEAN CanGameBeSaved() +{ + //if the iron man mode is on + if( gGameOptions.fIronManMode ) + { + //if we are in turn based combat + if( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) + { + //no save for you + return( FALSE ); + } + + //if there are enemies in the current sector + if( gWorldSectorX != -1 && gWorldSectorY != -1 && + gWorldSectorX != 0 && gWorldSectorY != 0 && + NumEnemiesInAnySector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) > 0 ) + { + //no save for you + return( FALSE ); + } + + //All checks failed, so we can save + return( TRUE ); + } + else + { + return( TRUE ); + } +} diff --git a/GameSettings.h b/GameSettings.h new file mode 100644 index 00000000..96e2184a --- /dev/null +++ b/GameSettings.h @@ -0,0 +1,206 @@ +#ifndef _GAME_SETTINGS__H_ +#define _GAME_SETTINGS__H_ + + +//If you add any options, MAKE sure you add the corresponding string to the Options Screen string array +enum +{ + TOPTION_SPEECH, + TOPTION_MUTE_CONFIRMATIONS, + TOPTION_SUBTITLES, + TOPTION_KEY_ADVANCE_SPEECH, + TOPTION_ANIMATE_SMOKE, +// TOPTION_HIDE_BULLETS, +// TOPTION_CONFIRM_MOVE, + TOPTION_BLOOD_N_GORE, + TOPTION_DONT_MOVE_MOUSE, + TOPTION_OLD_SELECTION_METHOD, + TOPTION_ALWAYS_SHOW_MOVEMENT_PATH, + + +// TOPTION_TIME_LIMIT_TURNS, //moved to the game init screen + + TOPTION_SHOW_MISSES, + + TOPTION_RTCONFIRM, + + +// TOPTION_DISPLAY_ENEMY_INDICATOR, //Displays the number of enemies seen by the merc, ontop of their portrait + TOPTION_SLEEPWAKE_NOTIFICATION, + + TOPTION_USE_METRIC_SYSTEM, //If set, uses the metric system + + TOPTION_MERC_ALWAYS_LIGHT_UP, + + TOPTION_SMART_CURSOR, + + TOPTION_SNAP_CURSOR_TO_DOOR, + + TOPTION_GLOW_ITEMS, + TOPTION_TOGGLE_TREE_TOPS, + TOPTION_TOGGLE_WIREFRAME, + TOPTION_3D_CURSOR, + TOPTION_CTH_CURSOR, + TOPTION_GL_BURST_CURSOR, + TOPTION_DROP_ALL, + NUM_GAME_OPTIONS, //Toggle up this will be able to be Toggled by the player + + //These options will NOT be toggable by the Player + TOPTION_MERC_CASTS_LIGHT = NUM_GAME_OPTIONS, + TOPTION_HIDE_BULLETS, + TOPTION_TRACKING_MODE, + + NUM_ALL_GAME_OPTIONS, +}; + + +typedef struct +{ + INT8 bLastSavedGameSlot; // The last saved game number goes in here + + UINT8 ubMusicVolumeSetting; + UINT8 ubSoundEffectsVolume; + UINT8 ubSpeechVolume; + + //The following are set from the status of the toggle boxes in the Options Screen + UINT8 fOptions[ NUM_ALL_GAME_OPTIONS ]; + + CHAR8 zVersionNumber[14]; + + UINT32 uiSettingsVersionNumber; + UINT32 uiMeanwhileScenesSeenFlags; + + BOOLEAN fHideHelpInAllScreens; + + BOOLEAN fUNUSEDPlayerFinishedTheGame; // JA2Gold: for UB compatibility + UINT8 ubSizeOfDisplayCover; + UINT8 ubSizeOfLOS; + + UINT8 ubFiller[17]; + +} GAME_SETTINGS; + + + +//Enums for the difficulty levels +enum +{ + DIF_LEVEL_ZERO, + DIF_LEVEL_EASY, + DIF_LEVEL_MEDIUM, + DIF_LEVEL_HARD, + DIF_LEVEL_INSANE, + DIF_LEVEL_FIVE, +}; + +//Enums for the difficulty levels +enum +{ + STYLE_REALISTIC = 0, //the specific indices are there to keep compartibility wiht old saves (back when there were only 2 styles) + STYLE_SCIFI = 1, + STYLE_PLATINUM = 2, +}; + +enum +{ + BR_GOOD = 1, + BR_GREAT = 2, + BR_EXCELLENT = 4, + BR_AWESOME = 10, +}; + +typedef struct +{ + BOOLEAN fGunNut; + BOOLEAN fAirStrikes;//Madd + UINT8 ubGameStyle; + UINT8 ubDifficultyLevel; + BOOLEAN fTurnTimeLimit; + BOOLEAN fIronManMode; + UINT8 ubBobbyRay; + UINT8 ubFiller[7]; + +} GAME_OPTIONS; + +// Snap: Options read from an INI file in the default of custom Data directory +typedef struct +{ + INT32 iStartingCashNovice; + INT32 iStartingCashExperienced; + INT32 iStartingCashExpert; + INT32 iStartingCashInsane; + + BOOLEAN fSellAll; + INT16 iPriceModifier; + + INT32 iMinAttribute; + INT32 iMaxAttribute; + INT32 iImpAttributePoints; + INT32 iMaxZeroBonus; + INT32 iStartAttribute; + + INT32 iMaxMilitiaPerSector; + INT32 iTrainingSquadSize; + INT32 iMilitiaTrainingCost; + INT32 iMinLoyaltyToTrain; + + INT32 iMaxEnemyGroupSize; + + INT32 iReinforcementPoolNovice; + INT32 iReinforcementPoolExperienced; + INT32 iReinforcementPoolExpert; + INT32 iReinforcementPoolInsane; + + INT32 iForcePercentageNovice; + INT32 iForcePercentageExperienced; + INT32 iForcePercentageExpert; + INT32 iForcePercentageInsane; + + INT32 iPercentElitesBonusExpert; + INT32 iPercentElitesBonusInsane; + + UINT8 ubMinEnemyGroupSizeNovice; + UINT8 ubMinEnemyGroupSizeExperienced; + UINT8 ubMinEnemyGroupSizeExpert; + UINT8 ubMinEnemyGroupSizeInsane; + + BOOLEAN fMercDayOne; + BOOLEAN fAllMercsAvailable; + + BOOLEAN fPers_att; + + INT8 iCustomPersonality; + INT8 iCustomAttitude; + + + +} GAME_EXTERNAL_OPTIONS; + +//This structure will contain general Ja2 settings NOT individual game settings. +extern GAME_SETTINGS gGameSettings; + +//This structure will contain the Game options set at the beginning of the game. +extern GAME_OPTIONS gGameOptions; + +// Snap: Options read from an INI file in the default of custom Data directory +extern GAME_EXTERNAL_OPTIONS gGameExternalOptions; + +BOOLEAN SaveGameSettings(); +BOOLEAN LoadGameSettings(); +// Snap: Read options from an INI file in the default of custom Data directory +void LoadGameExternalOptions(); + +void InitGameOptions(); + + +BOOLEAN GetCDLocation( ); + +void DisplayGameSettings( ); + +BOOLEAN MeanwhileSceneSeen( UINT8 ubMeanwhile ); + +BOOLEAN SetMeanwhileSceneSeen( UINT8 ubMeanwhile ); + +BOOLEAN CanGameBeSaved(); + +#endif \ No newline at end of file diff --git a/GameVersion.cpp b/GameVersion.cpp new file mode 100644 index 00000000..95bbea30 --- /dev/null +++ b/GameVersion.cpp @@ -0,0 +1,41 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" +#else + #include "Types.h" + #include "GameVersion.h" +#endif + + +// +// Keeps track of the game version +// + +#ifdef JA2BETAVERSION + +//BETA/TEST BUILD VERSION +INT16 zVersionLabel[16] = { L"Beta v. 0.98" }; + +#elif defined CRIPPLED_VERSION + +//RELEASE BUILD VERSION +INT16 zVersionLabel[16] = { L"Beta v. 0.98" }; + +#else + + //RELEASE BUILD VERSION + INT16 zVersionLabel[16] = { L"Release v1.13" }; + + +#endif + +INT8 czVersionNumber[16] = { "Build 11.08.05" }; +INT16 zTrackingNumber[16] = { L"Z" }; + + +// +// Keeps track of the saved game version. Increment the saved game version whenever +// you will invalidate the saved game file + +#define SAVE_GAME_VERSION 99 + +const UINT32 guiSavedGameVersion = SAVE_GAME_VERSION; diff --git a/GameVersion.h b/GameVersion.h new file mode 100644 index 00000000..8f1d0d36 --- /dev/null +++ b/GameVersion.h @@ -0,0 +1,34 @@ +#ifndef _GAME_VERSION_H_ +#define _GAME_VERSION_H_ + + +#ifdef __cplusplus +extern "C" { +#endif + + +// +// Keeps track of the game version +// + +extern INT16 zVersionLabel[16]; +extern INT8 czVersionNumber[16]; +extern INT16 zTrackingNumber[16]; + + + +//#define RUSSIANGOLD + +// +// Keeps track of the saved game version. Increment the saved game version whenever +// you will invalidate the saved game file +// + +const extern UINT32 guiSavedGameVersion; + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/HelpScreen.cpp b/HelpScreen.cpp new file mode 100644 index 00000000..0d095243 --- /dev/null +++ b/HelpScreen.cpp @@ -0,0 +1,2570 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" + #include "HelpScreen.h" + #include "HelpScreenText.h" + #include "Line.h" +#else + #include "sgp.h" + #include "sys globals.h" + #include "sysutil.h" + #include "vobject_blitters.h" + #include "wcheck.h" + #include "cursors.h" + #include "font control.h" + #include "cursor control.h" + #include "render dirty.h" + #include "GameScreen.h" + #include "Text.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Font Control.h" + #include "text.h" + #include "Multi Language Graphic Utils.h" + #include "HelpScreen.h" + #include "HelpScreenText.h" + #include "Line.h" +#endif + +extern INT16 gsVIEWPORT_END_Y; +extern void PrintDate( void ); +extern void PrintNumberOnTeam( void ); +extern void PrintBalance( void ); +extern BOOLEAN fMapScreenBottomDirty; +extern BOOLEAN fCharacterInfoPanelDirty; +extern BOOLEAN fTeamPanelDirty; +extern BOOLEAN fMapScreenBottomDirty; +extern BOOLEAN fMapPanelDirty; +extern BOOLEAN gfGamePaused; +extern BOOLEAN fShowMapInventoryPool; + +extern BOOLEAN BltVSurfaceUsingDD( HVSURFACE hDestVSurface, HVSURFACE hSrcVSurface, UINT32 fBltFlags, INT32 iDestX, INT32 iDestY, RECT *SrcRect ); + + + +#define HELP_SCREEN_ACTIVE 0x00000001 + + + +//The defualt size and placement of the screen +//#define HELP_SCREEN_DEFUALT_LOC_X 155 +//#define HELP_SCREEN_DEFUALT_LOC_Y 105 + +#define HELP_SCREEN_DEFUALT_LOC_WIDTH HELP_SCREEN_SMALL_LOC_WIDTH + HELP_SCREEN_BUTTON_BORDER_WIDTH +#define HELP_SCREEN_DEFUALT_LOC_HEIGHT 292//300 + +#define HELP_SCREEN_BUTTON_BORDER_WIDTH 92 +#define HELP_SCREEN_SMALL_LOC_WIDTH 320 +#define HELP_SCREEN_SMALL_LOC_HEIGHT HELP_SCREEN_DEFUALT_LOC_HEIGHT //224 + + + +#define HELP_SCREEN_BTN_OFFSET_X 11 +#define HELP_SCREEN_BTN_OFFSET_Y 12//50 +#define HELP_SCREEN_BTN_FONT_ON_COLOR 73 +#define HELP_SCREEN_BTN_FONT_OFF_COLOR FONT_MCOLOR_WHITE + +#define HELP_SCREEN_BTN_FONT_BACK_COLOR 50 +#define HELP_SCREEN_BTN_FONT FONT10ARIAL + +#define HELP_SCREEN_BTN_WIDTH 77 +#define HELP_SCREEN_BTN_HEIGHT 22 +#define HELP_SCREEN_GAP_BN_BTNS 8 + +#define HELP_SCREEN_MARGIN_SIZE 10 +#define HELP_SCREEN_TEXT_RIGHT_MARGIN_SPACE 36 +#define HELP_SCREEN_TEXT_LEFT_MARGIN_WITH_BTN ( HELP_SCREEN_BUTTON_BORDER_WIDTH + 5 + HELP_SCREEN_MARGIN_SIZE ) +#define HELP_SCREEN_TEXT_LEFT_MARGIN ( 5 + HELP_SCREEN_MARGIN_SIZE ) + + +#define HELP_SCREEN_TEXT_OFFSET_Y 48 +#define HELP_SCREEN_GAP_BTN_LINES 2 + +#define HELP_SCREEN_TITLE_BODY_FONT FONT12ARIAL +#define HELP_SCREEN_TITLE_BODY_COLOR FONT_MCOLOR_WHITE//FONT_NEARBLACK + +#define HELP_SCREEN_TEXT_BODY_FONT FONT10ARIAL +#define HELP_SCREEN_TEXT_BODY_COLOR FONT_MCOLOR_WHITE//FONT_NEARBLACK +#define HELP_SCREEN_TEXT_BACKGROUND 0//NO_SHADOW//FONT_MCOLOR_WHITE + +#define HELP_SCREEN_TITLE_OFFSET_Y 7 +#define HELP_SCREEN_HELP_REMINDER_Y HELP_SCREEN_TITLE_OFFSET_Y + 15 + +#define HELP_SCREEN_NUM_BTNS 8 + + +#define HELP_SCREEN_SHOW_HELP_AGAIN_REGION_OFFSET_X 4 +#define HELP_SCREEN_SHOW_HELP_AGAIN_REGION_OFFSET_Y 18 +#define HELP_SCREEN_SHOW_HELP_AGAIN_REGION_TEXT_OFFSET_X 25 + HELP_SCREEN_SHOW_HELP_AGAIN_REGION_OFFSET_X +#define HELP_SCREEN_SHOW_HELP_AGAIN_REGION_TEXT_OFFSET_Y ( HELP_SCREEN_SHOW_HELP_AGAIN_REGION_OFFSET_Y ) + +#define HELP_SCREEN_EXIT_BTN_OFFSET_X 291 +#define HELP_SCREEN_EXIT_BTN_LOC_Y 9 + +#define HELP_SCREEN_ + + +//the type of help screen +#define HLP_SCRN_DEFAULT_TYPE 9 +#define HLP_SCRN_BUTTON_BORDER 8 + + + +//this is the size of the text buffer where everything will be blitted. +// 2 ( bytest for char ) * width of buffer * height of 1 line * # of text lines +//#define HLP_SCRN__NUMBER_BYTES_IN_TEXT_BUFFER ( 2 * HLP_SCRN__WIDTH_OF_TEXT_BUFFER * HLP_SCRN__HEIGHT_OF_1_LINE_IN_BUFFER * HLP_SCRN__MAX_NUMBER_OF_LINES_IN_BUFFER ) +#define HLP_SCRN__WIDTH_OF_TEXT_BUFFER 280 +#define HLP_SCRN__MAX_NUMBER_OF_LINES_IN_BUFFER 170//100 +#define HLP_SCRN__HEIGHT_OF_1_LINE_IN_BUFFER ( GetFontHeight( HELP_SCREEN_TEXT_BODY_FONT ) + HELP_SCREEN_GAP_BTN_LINES ) +#define HLP_SCRN__MAX_NUMBER_PIXELS_DISPLAYED_IN_TEXT_BUFFER HELP_SCREEN_DEFUALT_LOC_HEIGHT +#define HLP_SCRN__HEIGHT_OF_TEXT_BUFFER ( HLP_SCRN__HEIGHT_OF_1_LINE_IN_BUFFER * HLP_SCRN__MAX_NUMBER_OF_LINES_IN_BUFFER ) + +#define HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER ( HLP_SCRN__HEIGHT_OF_TEXT_AREA / HLP_SCRN__HEIGHT_OF_1_LINE_IN_BUFFER ) + +#define HLP_SCRN__HEIGHT_OF_TEXT_AREA 228 + +#define HLP_SCRN__HEIGHT_OF_SCROLL_AREA 182 +#define HLP_SCRN__WIDTH_OF_SCROLL_AREA 20 +#define HLP_SCRN__SCROLL_POSX 292 +#define HLP_SCRN__SCROLL_POSY ( gHelpScreen.usScreenLocY + 63 ) + +#define HLP_SCRN__SCROLL_UP_ARROW_X 292 +#define HLP_SCRN__SCROLL_UP_ARROW_Y 43 + +#define HLP_SCRN__SCROLL_DWN_ARROW_X HLP_SCRN__SCROLL_UP_ARROW_X +#define HLP_SCRN__SCROLL_DWN_ARROW_Y HLP_SCRN__SCROLL_UP_ARROW_Y + 202 + + + + +//enums for the different dirty levels +enum +{ + HLP_SCRN_DRTY_LVL_NOT_DIRTY, + HLP_SCRN_DRTY_LVL_REFRESH_TEXT, + HLP_SCRN_DRTY_LVL_REFRESH_ALL, +}; + +//new screen: + +enum +{ + HLP_SCRN_MPSCRN_SCTR_OVERVIEW, +}; + +//mapscreen, welcome to arulco +enum +{ + HLP_SCRN_MPSCRN_OVERVIEW, + HLP_SCRN_MPSCRN_ASSIGNMENTS, + HLP_SCRN_MPSCRN_DESTINATIONS, + HLP_SCRN_MPSCRN_MAP, + HLP_SCRN_MPSCRN_MILITIA, + HLP_SCRN_MPSCRN_AIRSPACE, + HLP_SCRN_MPSCRN_ITEMS, + HLP_SCRN_MPSCRN_KEYBOARD, + + HLP_SCRN_NUM_MPSCRN_BTNS, + +}; +//laptop sub pages +enum +{ + HLP_SCRN_LPTP_OVERVIEW, + HLP_SCRN_LPTP_EMAIL, + HLP_SCRN_LPTP_WEB, + HLP_SCRN_LPTP_FILES, + HLP_SCRN_LPTP_HISTORY, + HLP_SCRN_LPTP_PERSONNEL, + HLP_SCRN_LPTP_FINANCIAL, + HLP_SCRN_LPTP_MERC_STATS, + + HLP_SCRN_LPTP_NUM_PAGES, +}; + +//Mapscreen no one hired yet pages +enum +{ + HLP_SCRN_NO_ONE_HIRED, + + HLP_SCRN_NUM_MAPSCREEN_NO_1_HIRED_YET_PAGES, +}; + +//mapscreen no 1 hired yet pages +enum +{ + HLP_SCRN_NOT_IN_ARULCO, + + HLP_SCRN_NUM_NOT_IN_ARULCO_PAGES, +}; + + + +//Tactical +enum +{ + HLP_SCRN_TACTICAL_OVERVIEW, + HLP_SCRN_TACTICAL_MOVEMENT, + HLP_SCRN_TACTICAL_SIGHT, + HLP_SCRN_TACTICAL_ATTACKING, + HLP_SCRN_TACTICAL_ITEMS, + HLP_SCRN_TACTICAL_KEYBOARD, + + HLP_SCRN_NUM_TACTICAL_PAGES, + +}; + +//ddd + + +HELP_SCREEN_STRUCT gHelpScreen; + + +typedef struct +{ + INT32 iButtonTextNum[ HELP_SCREEN_NUM_BTNS ]; + +} HELP_SCREEN_BTN_TEXT_RECORD; + +//An array of record nums for the text on the help buttons +HELP_SCREEN_BTN_TEXT_RECORD gHelpScreenBtnTextRecordNum[ HELP_SCREEN_NUMBER_OF_HELP_SCREENS ] = +{ +//new screen: + + //Laptop button record nums + // HELP_SCREEN_LAPTOP, + { HLP_TXT_LAPTOP_BUTTON_1, + HLP_TXT_LAPTOP_BUTTON_2, + HLP_TXT_LAPTOP_BUTTON_3, + HLP_TXT_LAPTOP_BUTTON_4, + HLP_TXT_LAPTOP_BUTTON_5, + HLP_TXT_LAPTOP_BUTTON_6, + HLP_TXT_LAPTOP_BUTTON_7, + HLP_TXT_LAPTOP_BUTTON_8, }, + + +// HELP_SCREEN_MAPSCREEN, + { HLP_TXT_WELCOM_TO_ARULCO_BUTTON_1, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_2, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_3, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_4, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_5, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_6, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_7, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_8, }, + +// HELP_SCREEN_MAPSCREEN_NO_ONE_HIRED, + { -1, -1, -1, -1, -1, -1, -1, -1, }, + +// HELP_SCREEN_MAPSCREEN_NOT_IN_ARULCO, + { -1, -1, -1, -1, -1, -1, -1, -1, }, + +// HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY, + { -1, -1, -1, -1, -1, -1, -1, -1, }, + +// HELP_SCREEN_TACTICAL, + { HLP_TXT_TACTICAL_BUTTON_1, + HLP_TXT_TACTICAL_BUTTON_2, + HLP_TXT_TACTICAL_BUTTON_3, + HLP_TXT_TACTICAL_BUTTON_4, + HLP_TXT_TACTICAL_BUTTON_5, + HLP_TXT_TACTICAL_BUTTON_6, + -1, -1, }, + +// HELP_SCREEN_OPTIONS, + { -1, -1, -1, -1, -1, -1, -1, -1, }, + +// HELP_SCREEN_LOAD_GAME, + { -1, -1, -1, -1, -1, -1, -1, -1, }, + +}; + + +BOOLEAN gfHelpScreenEntry = TRUE; +BOOLEAN gfHelpScreenExit = FALSE; + + + +UINT32 guiHelpScreenBackGround; +UINT32 guiHelpScreenTextBufferSurface; + +BOOLEAN gfScrollBoxIsScrolling = FALSE; + +BOOLEAN gfHaveRenderedFirstFrameToSaveBuffer=FALSE; + + +// must use this cause you have ur cursor over a button when entering the help screen, the button will burn though. +//It does this cause that region loses it focus so it draws the button again. +UINT8 gubRenderHelpScreenTwiceInaRow=0; + +//mmm + +// region to mask the background +MOUSE_REGION gHelpScreenFullScreenMask; +//void SelectHelpTextFullScreenMaskCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + +// region to mask the background +MOUSE_REGION gHelpScreenScrollArea; +void SelectHelpScrollAreaMovementCallBack( MOUSE_REGION * pRegion, INT32 iReason ); +void SelectHelpScrollAreaCallBack( MOUSE_REGION * pRegion, INT32 iReason ); + +// region to mask the background +MOUSE_REGION gHelpScreenScrollAreaArrows; +void SelectHelpScrollAreaArrowsCallBack( MOUSE_REGION * pRegion, INT32 iReason ); + + +//checkbox to toggle show help again toggle +UINT32 gHelpScreenDontShowHelpAgainToggle; +void BtnHelpScreenDontShowHelpAgainCallback(GUI_BUTTON *btn,INT32 reason); +//MOUSE_REGION HelpScreenDontShowHelpAgainToggleTextRegion; +//void HelpScreenDontShowHelpAgainToggleTextRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + +INT32 giHelpScreenButtonsImage[ HELP_SCREEN_NUM_BTNS ]; +UINT32 guiHelpScreenBtns[ HELP_SCREEN_NUM_BTNS ]; +void BtnHelpScreenBtnsCallback(GUI_BUTTON *btn,INT32 reason); + +INT32 giExitBtnImage; +UINT32 guiHelpScreenExitBtn; +void BtnHelpScreenExitCallback(GUI_BUTTON *btn,INT32 reason); + + +INT32 giHelpScreenScrollArrows[2]; +UINT32 guiHelpScreenScrollArrowImage[2]; +void BtnHelpScreenScrollArrowsCallback(GUI_BUTTON *btn,INT32 reason); + + + +//ggg + + + + + +BOOLEAN EnterHelpScreen(); +void HandleHelpScreen(); +void RenderHelpScreen(); +void ExitHelpScreen(); + +void GetHelpScreenUserInput(); +void HelpScreenSpecialExitCode(); +void SetSizeAndPropertiesOfHelpScreen(); +BOOLEAN DrawHelpScreenBackGround(); +void PrepareToExitHelpScreen(); +void SpecialHandlerCode(); + +UINT16 RenderSpecificHelpScreen(); + +UINT16 RenderLaptopHelpScreen(); +UINT16 RenderTacticalHelpScreen(); +UINT16 RenderMapScreenHelpScreen(); +UINT16 RenderMapScreenNoOneHiredYetHelpScreen(); +UINT16 RenderMapScreenNotYetInArulcoHelpScreen(); +UINT16 RenderMapScreenSectorInventoryHelpScreen(); + +void GetHelpScreenTextPositions( UINT16 *pusPosX, UINT16 *pusPosY, UINT16 *pusWidth ); +void DisplayCurrentScreenTitleAndFooter(); +void GetHelpScreenText( UINT32 uiRecordToGet, STR16 pText ); +UINT16 GetAndDisplayHelpScreenText( UINT32 uiRecord, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth ); +void CreateHelpScreenButtons(); +void RefreshAllHelpScreenButtons(); + +void RenderTextBufferToScreen(); +void RenderCurrentHelpScreenTextToBuffer(); +void DestroyHelpScreenTextBuffer(); +BOOLEAN CreateHelpScreenTextBuffer(); +void ChangeHelpScreenSubPage(); +void ClearHelpScreenTextBuffer(); +void ChangeTopLineInTextBufferByAmount( INT32 iAmouontToMove ); +void DisplayHelpScreenTextBufferScrollBox(); +void CalculateHeightAndPositionForHelpScreenScrollBox( INT32 *piHeightOfScrollBox, INT32 *iTopOfScrollBox ); +void HelpScreenMouseMoveScrollBox( INT32 usMousePosY ); +void CreateScrollAreaButtons(); +void DeleteScrollArrowButtons(); +void ChangeToHelpScreenSubPage( INT8 bNewPage ); +BOOLEAN AreWeClickingOnScrollBar( INT32 usMousePosY ); + + +//ppp + + + +void InitHelpScreenSystem() +{ + //set some values + memset( &gHelpScreen, 0, sizeof( gHelpScreen ) ); + + //set it up so we can enter the screen + gfHelpScreenEntry = TRUE; + gfHelpScreenExit = FALSE; + + gHelpScreen.bCurrentHelpScreenActiveSubPage = -1; + + gHelpScreen.fHaveAlreadyBeenInHelpScreenSinceEnteringCurrenScreen = FALSE; +} + +BOOLEAN ShouldTheHelpScreenComeUp( UINT8 ubScreenID, BOOLEAN fForceHelpScreenToComeUp ) +{ + + //if the screen is being forsced to come up ( user pressed 'h' ) + if( fForceHelpScreenToComeUp ) + { + //Set thefact that the user broughtthe help screen up + gHelpScreen.fForceHelpScreenToComeUp = TRUE; + + goto HELP_SCREEN_SHOULD_COME_UP; + } + + //if we are already in the help system, return true + if( gHelpScreen.uiFlags & HELP_SCREEN_ACTIVE ) + { + return( TRUE ); + } + + //has the player been in the screen before + if( ( gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen >> ubScreenID ) & 0x01 ) + { + goto HELP_SCREEN_WAIT_1_FRAME; + } + + //if we have already been in the screen, and the user DIDNT press 'h', leave + if( gHelpScreen.fHaveAlreadyBeenInHelpScreenSinceEnteringCurrenScreen ) + { + return( FALSE ); + } + + //should the screen come up, based on the users choice for it automatically coming up +// if( !( gHelpScreen.fHideHelpInAllScreens ) ) + { +// goto HELP_SCREEN_WAIT_1_FRAME; + } + + //the help screen shouldnt come up + return( FALSE ); + +HELP_SCREEN_WAIT_1_FRAME: + + // we have to wait 1 frame while the screen renders + if( gHelpScreen.bDelayEnteringHelpScreenBy1FrameCount < 2 ) + { + gHelpScreen.bDelayEnteringHelpScreenBy1FrameCount += 1; + + UnmarkButtonsDirty( ); + + return( FALSE ); + } + +HELP_SCREEN_SHOULD_COME_UP: + + //Record which screen it is + + //if its mapscreen + if( ubScreenID == HELP_SCREEN_MAPSCREEN ) + { + //determine which screen it is ( is any mercs hired, did game just start ) + gHelpScreen.bCurrentHelpScreen = HelpScreenDetermineWhichMapScreenHelpToShow(); + } + else + { + gHelpScreen.bCurrentHelpScreen = ubScreenID; + } + + //mark it that the help screnn is enabled + gHelpScreen.uiFlags |= HELP_SCREEN_ACTIVE; + + // reset + gHelpScreen.bDelayEnteringHelpScreenBy1FrameCount = 0; + + return( TRUE ); +} + + +void HelpScreenHandler() +{ + //if we are just entering the help screen + if( gfHelpScreenEntry ) + { + //setup the help screen + EnterHelpScreen(); + + gfHelpScreenEntry = FALSE; + gfHelpScreenExit = FALSE; + } + + RestoreBackgroundRects(); + + + //get the mouse and keyboard inputs + GetHelpScreenUserInput(); + + //handle the help screen + HandleHelpScreen(); + + //if the help screen is dirty, re-render it + if( gHelpScreen.ubHelpScreenDirty != HLP_SCRN_DRTY_LVL_NOT_DIRTY ) + { + //temp +// gHelpScreen.ubHelpScreenDirty = HLP_SCRN_DRTY_LVL_REFRESH_ALL; + + + RenderHelpScreen(); + gHelpScreen.ubHelpScreenDirty = HLP_SCRN_DRTY_LVL_NOT_DIRTY; + } + + // render buttons marked dirty +// MarkButtonsDirty( ); + RenderButtons( ); + + SaveBackgroundRects( ); + RenderButtonsFastHelp(); + + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + + //if we are leaving the help screen + if( gfHelpScreenExit ) + { + gfHelpScreenExit = FALSE; + + gfHelpScreenEntry = TRUE; + + //exit mouse regions etc.. + ExitHelpScreen(); + + //reset the helpscreen id + gHelpScreen.bCurrentHelpScreen = -1; + } +} + +BOOLEAN EnterHelpScreen() +{ + VOBJECT_DESC VObjectDesc; + UINT16 usPosX, usPosY;//, usWidth, usHeight; +// INT32 iStartLoc; +// CHAR16 zText[1024]; + + //Clear out all the save background rects + EmptyBackgroundRects( ); + + + UnmarkButtonsDirty( ); + + // remeber if the game was paused or not ( so when we exit we know what to do ) + gHelpScreen.fWasTheGamePausedPriorToEnteringHelpScreen = gfGamePaused; + + //pause the game + PauseGame( ); + + + //Determine the help screen size, based off the help screen + SetSizeAndPropertiesOfHelpScreen(); + + //Create a mouse region 'mask' the entrire screen + MSYS_DefineRegion( &gHelpScreenFullScreenMask, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, + gHelpScreen.usCursor, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); + MSYS_AddRegion( &gHelpScreenFullScreenMask ); + + + //Create the exit button + if( gHelpScreen.bNumberOfButtons != 0 ) + usPosX = gHelpScreen.usScreenLocX + HELP_SCREEN_EXIT_BTN_OFFSET_X + HELP_SCREEN_BUTTON_BORDER_WIDTH; + else + usPosX = gHelpScreen.usScreenLocX + HELP_SCREEN_EXIT_BTN_OFFSET_X; + + usPosY = gHelpScreen.usScreenLocY + HELP_SCREEN_EXIT_BTN_LOC_Y; + + //Create the exit buttons + giExitBtnImage = LoadButtonImage("INTERFACE\\HelpScreen.sti", -1,0,4,2,6 ); + + guiHelpScreenExitBtn = CreateIconAndTextButton( giExitBtnImage, L"", HELP_SCREEN_BTN_FONT, + HELP_SCREEN_BTN_FONT_ON_COLOR, DEFAULT_SHADOW, + HELP_SCREEN_BTN_FONT_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + usPosX, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, BtnHelpScreenExitCallback ); + SetButtonFastHelpText( guiHelpScreenExitBtn, gzHelpScreenText[HLP_SCRN_TXT__EXIT_SCREEN] ); + SetButtonCursor( guiHelpScreenExitBtn, gHelpScreen.usCursor); + + + + //Create the buttons needed for the screen + CreateHelpScreenButtons(); + + + //if there are buttons + if( gHelpScreen.bNumberOfButtons != 0 ) + usPosX = gHelpScreen.usScreenLocX + HELP_SCREEN_SHOW_HELP_AGAIN_REGION_OFFSET_X + HELP_SCREEN_BUTTON_BORDER_WIDTH; + else + usPosX = gHelpScreen.usScreenLocX + HELP_SCREEN_SHOW_HELP_AGAIN_REGION_OFFSET_X; + + usPosY = gHelpScreen.usScreenLocY + gHelpScreen.usScreenHeight - HELP_SCREEN_SHOW_HELP_AGAIN_REGION_OFFSET_Y; + + if( !gHelpScreen.fForceHelpScreenToComeUp) + { + gHelpScreenDontShowHelpAgainToggle = CreateCheckBoxButton( usPosX, (UINT16)(usPosY-3), + "INTERFACE\\OptionsCheckBoxes.sti", MSYS_PRIORITY_HIGHEST, + BtnHelpScreenDontShowHelpAgainCallback ); + + SetButtonCursor( gHelpScreenDontShowHelpAgainToggle, gHelpScreen.usCursor ); + + // Set the state of the chec box + if( gGameSettings.fHideHelpInAllScreens ) + ButtonList[ gHelpScreenDontShowHelpAgainToggle ]->uiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ gHelpScreenDontShowHelpAgainToggle ]->uiFlags &= ~BUTTON_CLICKED_ON; + } + +/* + ///creatre a region for the text that says ' [ x ] click to continue seeing ....' + iStartLoc = HELPSCREEN_RECORD_SIZE * HLP_TXT_CONSTANT_FOOTER; + LoadEncryptedDataFromFile(HELPSCREEN_FILE, zText, iStartLoc, HELPSCREEN_RECORD_SIZE ); + + usWidth = StringPixLength( zText, HELP_SCREEN_TEXT_BODY_FONT ); + usHeight = GetFontHeight( HELP_SCREEN_TEXT_BODY_FONT ); + +/* + MSYS_DefineRegion( &HelpScreenDontShowHelpAgainToggleTextRegion, usPosX, usPosY, (UINT16)(usPosX+usWidth), (UINT16)(usPosY+usHeight), MSYS_PRIORITY_HIGHEST-1, + gHelpScreen.usCursor, MSYS_NO_CALLBACK, HelpScreenDontShowHelpAgainToggleTextRegionCallBack ); + MSYS_AddRegion( &HelpScreenDontShowHelpAgainToggleTextRegion ); +*/ + + // load the help screen background graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\HelpScreen.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiHelpScreenBackGround)); + + + //create the text buffer + CreateHelpScreenTextBuffer(); + + + //make sure we redraw everything + gHelpScreen.ubHelpScreenDirty = HLP_SCRN_DRTY_LVL_REFRESH_ALL; + + //mark it that we have been in since we enter the current screen + gHelpScreen.fHaveAlreadyBeenInHelpScreenSinceEnteringCurrenScreen = TRUE; + + //set the fact that we have been to the screen + gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen &= ~( 1 << gHelpScreen.bCurrentHelpScreen ); + + //always start at the top + gHelpScreen.iLineAtTopOfTextBuffer = 0; + + //set it so there was no previous click + gHelpScreen.iLastMouseClickY = -1; + + //Create the scroll box, and scroll arrow regions/buttons + CreateScrollAreaButtons(); + + //render the active page to the text buffer + ChangeHelpScreenSubPage(); + + //reset scroll box flag + gfScrollBoxIsScrolling = FALSE; + + //reset first frame buffer + gfHaveRenderedFirstFrameToSaveBuffer = FALSE; + + gubRenderHelpScreenTwiceInaRow = 0; + + return( TRUE ); +} + +void HandleHelpScreen() +{ + //if any of the possible screens need to have a some code done every loop.. its done in here + SpecialHandlerCode(); + + if( gfScrollBoxIsScrolling ) + { + if( gfLeftButtonState ) + { + HelpScreenMouseMoveScrollBox( gusMouseYPos ); + } + else + { + gfScrollBoxIsScrolling = FALSE; + gHelpScreen.iLastMouseClickY = -1; + } + } + + if( gubRenderHelpScreenTwiceInaRow < 3 ) + { +//test +// gHelpScreen.ubHelpScreenDirty = HLP_SCRN_DRTY_LVL_REFRESH_ALL; + + gubRenderHelpScreenTwiceInaRow++; + + UnmarkButtonsDirty( ); + } + + // refresh all of help screens buttons + RefreshAllHelpScreenButtons(); +} + +void RenderHelpScreen() +{ +//rrr + + if( gfHaveRenderedFirstFrameToSaveBuffer ) + { + //Restore the background before blitting the text back on + RestoreExternBackgroundRect( gHelpScreen.usScreenLocX, gHelpScreen.usScreenLocY, gHelpScreen.usScreenWidth, gHelpScreen.usScreenHeight ); + } + + + if( gHelpScreen.ubHelpScreenDirty == HLP_SCRN_DRTY_LVL_REFRESH_ALL ) + { + //Display the helpscreen background + DrawHelpScreenBackGround(); + + //Display the current screens title, and footer info + DisplayCurrentScreenTitleAndFooter(); + } + + + if( !gfHaveRenderedFirstFrameToSaveBuffer ) + { + gfHaveRenderedFirstFrameToSaveBuffer = TRUE; + + // WANNE: an exception occurs, when i try to open the help screen in laptop mode, so i put a try-catch block + // around this. I will fix that later. + __try + { + //blit everything to the save buffer ( cause the save buffer can bleed through ) + BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, gHelpScreen.usScreenLocX, gHelpScreen.usScreenLocY, (UINT16)(gHelpScreen.usScreenLocX+gHelpScreen.usScreenWidth), (UINT16)(gHelpScreen.usScreenLocY+gHelpScreen.usScreenHeight) ); + } + __except(filter(GetExceptionCode(), GetExceptionInformation())) + { + } + + UnmarkButtonsDirty( ); + } + + + //render the text buffer to the screen + if( gHelpScreen.ubHelpScreenDirty >= HLP_SCRN_DRTY_LVL_REFRESH_TEXT ) + { + RenderTextBufferToScreen(); + } +} + + +void ExitHelpScreen() +{ + INT32 i; + + if( !gHelpScreen.fForceHelpScreenToComeUp ) + { + //Get the current value of the checkbox + if( ButtonList[ gHelpScreenDontShowHelpAgainToggle ]->uiFlags & BUTTON_CLICKED_ON ) + { + gGameSettings.fHideHelpInAllScreens = TRUE; + gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen = 0; + } + else + { + gGameSettings.fHideHelpInAllScreens = FALSE; + } + + //remove the mouse region for the '[ ] dont show help...' + RemoveButton( gHelpScreenDontShowHelpAgainToggle ); + } + + + //mark it that the help screen is not active + gHelpScreen.uiFlags &= ~HELP_SCREEN_ACTIVE; + + //remove the mouse region that blankets + MSYS_RemoveRegion( &gHelpScreenFullScreenMask ); + + //checkbox to toggle show help again toggle +// MSYS_RemoveRegion( &HelpScreenDontShowHelpAgainToggleTextRegion ); + + + //remove the hepl graphic + DeleteVideoObjectFromIndex( guiHelpScreenBackGround ); + + + //remove the exit button + RemoveButton( guiHelpScreenExitBtn ); + + //if there are any buttons, remove them + if( gHelpScreen.bNumberOfButtons != 0 ) + { + for( i=0; i< gHelpScreen.bNumberOfButtons; i++ ) + { + UnloadButtonImage( giHelpScreenButtonsImage[i] ); + RemoveButton( guiHelpScreenBtns[i] ); + } + } + + //destroy the text buffer for the help screen + DestroyHelpScreenTextBuffer(); + + + //Handles the dirtying of any special screen we are about to reenter + HelpScreenSpecialExitCode(); + + //if the game was NOT paused + if( gHelpScreen.fWasTheGamePausedPriorToEnteringHelpScreen == FALSE ) + { + //un pause the game + UnPauseGame( ); + } + + //Delete the scroll box, and scroll arrow regions/buttons + DeleteScrollArrowButtons(); + + //reset + gHelpScreen.fForceHelpScreenToComeUp = FALSE; + + SaveGameSettings(); +} + + +BOOLEAN DrawHelpScreenBackGround() +{ + HVOBJECT hPixHandle; + UINT16 usPosX; + + //Get and display the background image + GetVideoObject(&hPixHandle, guiHelpScreenBackGround ); + + usPosX = gHelpScreen.usScreenLocX; + + //if there are buttons, blit the button border + if( gHelpScreen.bNumberOfButtons != 0 ) + { + BltVideoObject(FRAME_BUFFER, hPixHandle, HLP_SCRN_BUTTON_BORDER, usPosX, gHelpScreen.usScreenLocY, VO_BLT_SRCTRANSPARENCY,NULL); + usPosX += HELP_SCREEN_BUTTON_BORDER_WIDTH; + } + + BltVideoObject(FRAME_BUFFER, hPixHandle, HLP_SCRN_DEFAULT_TYPE, usPosX, gHelpScreen.usScreenLocY, VO_BLT_SRCTRANSPARENCY,NULL); + + InvalidateRegion( gHelpScreen.usScreenLocX, gHelpScreen.usScreenLocY, gHelpScreen.usScreenLocX+gHelpScreen.usScreenWidth, gHelpScreen.usScreenLocY + gHelpScreen.usScreenHeight ); + + return( TRUE ); +} + +void SetSizeAndPropertiesOfHelpScreen() +{ + + +//new screen: + gHelpScreen.bNumberOfButtons = 0; + + // + //these are the default settings, so if the screen uses different then defualt, set them in the switch + // + { + gHelpScreen.usScreenWidth = HELP_SCREEN_DEFUALT_LOC_WIDTH; + gHelpScreen.usScreenHeight = HELP_SCREEN_DEFUALT_LOC_HEIGHT; + + gHelpScreen.usScreenLocX = ( SCREEN_WIDTH - gHelpScreen.usScreenWidth ) / 2; + gHelpScreen.usScreenLocY = ( SCREEN_HEIGHT - gHelpScreen.usScreenHeight ) / 2; + + gHelpScreen.bCurrentHelpScreenActiveSubPage = 0; + + gHelpScreen.usCursor = CURSOR_NORMAL; + } + + + switch( gHelpScreen.bCurrentHelpScreen ) + { + case HELP_SCREEN_LAPTOP: + gHelpScreen.bNumberOfButtons = HLP_SCRN_LPTP_NUM_PAGES; + gHelpScreen.usCursor = CURSOR_LAPTOP_SCREEN; + + //center the screen inside the laptop screen + gHelpScreen.usScreenLocX = LAPTOP_SCREEN_UL_X + ( 502 - gHelpScreen.usScreenWidth ) / 2; + gHelpScreen.usScreenLocY = LAPTOP_SCREEN_UL_Y + ( LAPTOP_SCREEN_HEIGHT - gHelpScreen.usScreenHeight ) / 2; + + break; + case HELP_SCREEN_MAPSCREEN: + gHelpScreen.bNumberOfButtons = HLP_SCRN_NUM_MPSCRN_BTNS; + + //calc the center position based on the current panel thats being displayed + gHelpScreen.usScreenLocY = ( gsVIEWPORT_END_Y - gHelpScreen.usScreenHeight ) / 2; + break; + case HELP_SCREEN_TACTICAL: + gHelpScreen.bNumberOfButtons = HLP_SCRN_NUM_TACTICAL_PAGES; + + //calc the center position based on the current panel thats being displayed + gHelpScreen.usScreenLocY = ( gsVIEWPORT_END_Y - gHelpScreen.usScreenHeight ) / 2; + break; + + case HELP_SCREEN_MAPSCREEN_NO_ONE_HIRED: + case HELP_SCREEN_MAPSCREEN_NOT_IN_ARULCO: + case HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY: + gHelpScreen.usScreenWidth = HELP_SCREEN_SMALL_LOC_WIDTH; + gHelpScreen.usScreenHeight = HELP_SCREEN_SMALL_LOC_HEIGHT; + + //calc screen position since we just set the width and height + gHelpScreen.usScreenLocX = ( SCREEN_WIDTH - gHelpScreen.usScreenWidth ) / 2; + + //calc the center position based on the current panel thats being displayed + gHelpScreen.usScreenLocY = ( gsVIEWPORT_END_Y - gHelpScreen.usScreenHeight ) / 2; + + gHelpScreen.bNumberOfButtons = 0; + gHelpScreen.bCurrentHelpScreenActiveSubPage = 0; + break; + + + case HELP_SCREEN_OPTIONS: + case HELP_SCREEN_LOAD_GAME: + break; + + default: + #ifdef JA2BETAVERSION + AssertMsg( 0, "Error in help screen. DF 0" ); + #else + break; + #endif + } + + //if there are buttons + if( gHelpScreen.bNumberOfButtons != 0 ) + gHelpScreen.usLeftMarginPosX = gHelpScreen.usScreenLocX + HELP_SCREEN_TEXT_LEFT_MARGIN_WITH_BTN; + else + gHelpScreen.usLeftMarginPosX = gHelpScreen.usScreenLocX + HELP_SCREEN_TEXT_LEFT_MARGIN; + +} + +void CreateHelpScreenButtons() +{ + UINT16 usPosX, usPosY; + CHAR16 sText[1024]; + INT32 i; + + //if there are buttons to create + if( gHelpScreen.bNumberOfButtons != 0 ) + { + + usPosX = gHelpScreen.usScreenLocX + HELP_SCREEN_BTN_OFFSET_X; + usPosY = HELP_SCREEN_BTN_OFFSET_Y + gHelpScreen.usScreenLocY; + + + //loop through all the buttons, and create them + for( i=0; i< gHelpScreen.bNumberOfButtons; i++ ) + { + //get the text for the button + GetHelpScreenText( gHelpScreenBtnTextRecordNum[ gHelpScreen.bCurrentHelpScreen ].iButtonTextNum[i], sText ); + +/* + guiHelpScreenBtns[i] = CreateTextButton( sText, HELP_SCREEN_BTN_FONT, HELP_SCREEN_BTN_FONT_COLOR, HELP_SCREEN_BTN_FONT_BACK_COLOR, + BUTTON_USE_DEFAULT, usPosX, usPosY, HELP_SCREEN_BTN_WIDTH, HELP_SCREEN_BTN_HEIGHT, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, BUTTON_NO_CALLBACK, BtnHelpScreenBtnsCallback ); +*/ + + + giHelpScreenButtonsImage[i] = UseLoadedButtonImage( giExitBtnImage, -1,1,5,3,7 ); + + guiHelpScreenBtns[i] = CreateIconAndTextButton( giHelpScreenButtonsImage[i], sText, HELP_SCREEN_BTN_FONT, + HELP_SCREEN_BTN_FONT_ON_COLOR, DEFAULT_SHADOW, + HELP_SCREEN_BTN_FONT_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + usPosX, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, BtnHelpScreenBtnsCallback); + + + SetButtonCursor( guiHelpScreenBtns[i], gHelpScreen.usCursor); + MSYS_SetBtnUserData( guiHelpScreenBtns[i], 0, i); + +// SpecifyButtonTextOffsets( guiHelpScreenBtns[i], 19, 9, TRUE ); + + usPosY += HELP_SCREEN_BTN_HEIGHT + HELP_SCREEN_GAP_BN_BTNS; + } + + ButtonList[ guiHelpScreenBtns[0] ]->uiFlags |= BUTTON_CLICKED_ON; + } +} + + +void GetHelpScreenUserInput() +{ + InputAtom Event; + POINT MousePos; + + GetCursorPos(&MousePos); + + while( DequeueEvent( &Event ) ) + { + // HOOK INTO MOUSE HOOKS + switch( Event.usEvent) + { + case LEFT_BUTTON_DOWN: + MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_UP: + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_DOWN: + MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + } + + + if( !HandleTextInput( &Event ) && Event.usEvent == KEY_UP ) + { + switch( Event.usParam ) + { + case ESC: + PrepareToExitHelpScreen(); + break; + + case DNARROW: + { + ChangeTopLineInTextBufferByAmount( 1 ); + } + break; + + case UPARROW: + { + ChangeTopLineInTextBufferByAmount( -1 ); + } + break; + + case PGUP: + { + ChangeTopLineInTextBufferByAmount( -( HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER -1 ) ); + } + break; + case PGDN: + { + ChangeTopLineInTextBufferByAmount( ( HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER -1 ) ); + } + break; + + case LEFTARROW: + ChangeToHelpScreenSubPage( (INT8)( gHelpScreen.bCurrentHelpScreenActiveSubPage - 1 ) ); + break; + + case RIGHTARROW: + ChangeToHelpScreenSubPage( (INT8)( gHelpScreen.bCurrentHelpScreenActiveSubPage + 1 ) ); + break; + +/* + + case LEFTARROW: + { + } + break; + + case RIGHTARROW: + { + } + break; +*/ + + +#ifdef JA2TESTVERSION + //rerender the hepl screen + case 'r': + gHelpScreen.ubHelpScreenDirty = HLP_SCRN_DRTY_LVL_REFRESH_ALL; + break; + + case 'i': + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + break; + + case 'd': + InvalidateRegion( gHelpScreen.usScreenLocX, gHelpScreen.usScreenLocY, gHelpScreen.usScreenLocX+gHelpScreen.usScreenWidth, gHelpScreen.usScreenLocY + gHelpScreen.usScreenHeight ); + break; +#endif + } + } + + if( !HandleTextInput( &Event ) && Event.usEvent == KEY_REPEAT ) + { + switch( Event.usParam ) + { + case DNARROW: + { + ChangeTopLineInTextBufferByAmount( 1 ); + } + break; + + case UPARROW: + { + ChangeTopLineInTextBufferByAmount( -1 ); + } + break; + + case PGUP: + { + ChangeTopLineInTextBufferByAmount( -( HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER -1 ) ); + } + break; + case PGDN: + { + ChangeTopLineInTextBufferByAmount( ( HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER -1 ) ); + } + break; + } + } + } +} + + +//Handles anything spcial that must be done when exiting the specific screen we are about to reenter ( eg. dirtying of the screen ) +void HelpScreenSpecialExitCode() +{ + //switch on the current screen + switch( gHelpScreen.bCurrentHelpScreen ) + { + case HELP_SCREEN_LAPTOP: + fReDrawScreenFlag = TRUE; + break; + + case HELP_SCREEN_MAPSCREEN_NO_ONE_HIRED: + case HELP_SCREEN_MAPSCREEN_NOT_IN_ARULCO: + case HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY: + case HELP_SCREEN_MAPSCREEN: + fCharacterInfoPanelDirty = TRUE; + fTeamPanelDirty = TRUE; + fMapScreenBottomDirty = TRUE; + fMapPanelDirty=TRUE; + break; + + case HELP_SCREEN_TACTICAL: + fInterfacePanelDirty = DIRTYLEVEL2; + SetRenderFlags(RENDER_FLAG_FULL); + break; + + case HELP_SCREEN_OPTIONS: + break; + case HELP_SCREEN_LOAD_GAME: + break; + + default: + #ifdef JA2BETAVERSION + AssertMsg( 0, "Error in help screen. DF 0" ); + #else + break; + #endif + } +} + +void PrepareToExitHelpScreen() +{ + gfHelpScreenExit = TRUE; +} + + +//Handles anything special that must be done when exiting the specific screen we are about to reenter ( eg. dirtying of the screen ) +void SpecialHandlerCode() +{ + //switch on the current screen + switch( gHelpScreen.bCurrentHelpScreen ) + { + case HELP_SCREEN_LAPTOP: + PrintDate( ); + PrintBalance( ); + PrintNumberOnTeam( ); + break; + case HELP_SCREEN_MAPSCREEN: + break; + case HELP_SCREEN_TACTICAL: + break; + + case HELP_SCREEN_MAPSCREEN_NO_ONE_HIRED: + break; + case HELP_SCREEN_MAPSCREEN_NOT_IN_ARULCO: + break; + case HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY: + break; + break; + case HELP_SCREEN_OPTIONS: + break; + case HELP_SCREEN_LOAD_GAME: + break; + + default: + #ifdef JA2BETAVERSION + AssertMsg( 0, "Error in help screen: SpecialHandlerCode(). DF 0" ); + #else + break; + #endif + } +} + + +UINT16 RenderSpecificHelpScreen() +{ + UINT16 usNumVerticalPixelsDisplayed = 0; +//new screen: + + //set the buffer for the text to go to +// SetFontDestBuffer( guiHelpScreenTextBufferSurface, gHelpScreen.usLeftMarginPosX, gHelpScreen.usScreenLocY + HELP_SCREEN_TEXT_OFFSET_Y, +// HLP_SCRN__WIDTH_OF_TEXT_BUFFER, HLP_SCRN__NUMBER_BYTES_IN_TEXT_BUFFER, FALSE ); + SetFontDestBuffer( guiHelpScreenTextBufferSurface, 0, 0, + HLP_SCRN__WIDTH_OF_TEXT_BUFFER, HLP_SCRN__HEIGHT_OF_TEXT_BUFFER, FALSE ); + + + //switch on the current screen + switch( gHelpScreen.bCurrentHelpScreen ) + { + case HELP_SCREEN_LAPTOP: + usNumVerticalPixelsDisplayed = RenderLaptopHelpScreen(); + break; + case HELP_SCREEN_MAPSCREEN: + usNumVerticalPixelsDisplayed = RenderMapScreenHelpScreen(); + break; + case HELP_SCREEN_TACTICAL: + usNumVerticalPixelsDisplayed = RenderTacticalHelpScreen(); + break; + case HELP_SCREEN_MAPSCREEN_NO_ONE_HIRED: + usNumVerticalPixelsDisplayed = RenderMapScreenNoOneHiredYetHelpScreen(); + break; + case HELP_SCREEN_MAPSCREEN_NOT_IN_ARULCO: + usNumVerticalPixelsDisplayed = RenderMapScreenNotYetInArulcoHelpScreen(); + break; + case HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY: + usNumVerticalPixelsDisplayed = RenderMapScreenSectorInventoryHelpScreen(); + break; + case HELP_SCREEN_OPTIONS: + break; + case HELP_SCREEN_LOAD_GAME: + break; + + default: + #ifdef JA2BETAVERSION + SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + AssertMsg( 0, "Error in help screen: RenderSpecificHelpScreen(). DF 0" ); + #else + break; + #endif + } + + SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + + //add 1 line to the bottom of the buffer + usNumVerticalPixelsDisplayed += 10; + + return( usNumVerticalPixelsDisplayed ); +} + +void GetHelpScreenTextPositions( UINT16 *pusPosX, UINT16 *pusPosY, UINT16 *pusWidth ) +{ + //if there are buttons + if( pusPosX != NULL ) + *pusPosX = 0; + + if( pusWidth != NULL ) + *pusWidth = HLP_SCRN__WIDTH_OF_TEXT_BUFFER - 1 * HELP_SCREEN_MARGIN_SIZE; //DEF was 2 + + if( pusPosY != NULL ) + *pusPosY = 0; +} + + + +void DisplayCurrentScreenTitleAndFooter() +{ + INT32 iStartLoc = -1; + CHAR16 zText[1024]; + UINT16 usPosX=0, usPosY=0, usWidth=0; + +//new screen: + + //switch on the current screen + switch( gHelpScreen.bCurrentHelpScreen ) + { + case HELP_SCREEN_LAPTOP: + iStartLoc = HELPSCREEN_RECORD_SIZE * HLP_TXT_LAPTOP_TITLE; + break; + case HELP_SCREEN_MAPSCREEN: + iStartLoc = HELPSCREEN_RECORD_SIZE * HLP_TXT_WELCOM_TO_ARULCO_TITLE; + break; + case HELP_SCREEN_TACTICAL: + iStartLoc = HELPSCREEN_RECORD_SIZE * HLP_TXT_TACTICAL_TITLE; + break; + case HELP_SCREEN_MAPSCREEN_NO_ONE_HIRED: + iStartLoc = HELPSCREEN_RECORD_SIZE * HLP_TXT_MPSCRN_NO_1_HIRED_YET_TITLE; + break; + case HELP_SCREEN_MAPSCREEN_NOT_IN_ARULCO: + iStartLoc = HELPSCREEN_RECORD_SIZE * HLP_TXT_MPSCRN_NOT_IN_ARULCO_TITLE; + break; + case HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY: + iStartLoc = HELPSCREEN_RECORD_SIZE * HLP_TXT_SECTOR_INVTRY_TITLE; + break; + case HELP_SCREEN_OPTIONS: + break; + case HELP_SCREEN_LOAD_GAME: + break; + + default: + #ifdef JA2BETAVERSION + AssertMsg( 0, "Error in help screen: DisplayCurrentScreenTitleAndFooter(). DF 0" ); + #else + break; + #endif + } + +// GetHelpScreenTextPositions( NULL, NULL, &usWidth ); + + if( gHelpScreen.bNumberOfButtons != 0 ) + usWidth = gHelpScreen.usScreenWidth - HELP_SCREEN_TEXT_LEFT_MARGIN_WITH_BTN - HELP_SCREEN_TEXT_RIGHT_MARGIN_SPACE; + else + usWidth = gHelpScreen.usScreenWidth - HELP_SCREEN_TEXT_LEFT_MARGIN - HELP_SCREEN_TEXT_RIGHT_MARGIN_SPACE; + + //if this screen has a valid title + if( iStartLoc != -1 ) + { + LoadEncryptedDataFromFile(HELPSCREEN_FILE, zText, iStartLoc, HELPSCREEN_RECORD_SIZE ); + + SetFontShadow( NO_SHADOW ); + + usPosX = gHelpScreen.usLeftMarginPosX; + +// DrawTextToScreen( zText, usPosX, (UINT16)(gHelpScreen.usScreenLocY+HELP_SCREEN_TITLE_OFFSET_Y), usWidth, +// HELP_SCREEN_TITLE_BODY_FONT, HELP_SCREEN_TITLE_BODY_COLOR, HELP_SCREEN_TEXT_BACKGROUND, FALSE, CENTER_JUSTIFIED ); + + //Display the Title + IanDisplayWrappedString( usPosX, (UINT16)(gHelpScreen.usScreenLocY+HELP_SCREEN_TITLE_OFFSET_Y), usWidth, HELP_SCREEN_GAP_BTN_LINES, + HELP_SCREEN_TITLE_BODY_FONT, HELP_SCREEN_TITLE_BODY_COLOR, zText, + HELP_SCREEN_TEXT_BACKGROUND, FALSE, 0 ); + + } + + //Display the '( press H to get help... )' + iStartLoc = HELPSCREEN_RECORD_SIZE * HLP_TXT_CONSTANT_SUBTITLE; + LoadEncryptedDataFromFile(HELPSCREEN_FILE, zText, iStartLoc, HELPSCREEN_RECORD_SIZE ); + + usPosX = gHelpScreen.usLeftMarginPosX; + + usPosY = gHelpScreen.usScreenLocY+HELP_SCREEN_HELP_REMINDER_Y; +// DrawTextToScreen( zText, usPosX, usPosY, usWidth, +// HELP_SCREEN_TEXT_BODY_FONT, HELP_SCREEN_TITLE_BODY_COLOR, HELP_SCREEN_TEXT_BACKGROUND, FALSE, CENTER_JUSTIFIED ); + + + IanDisplayWrappedString( usPosX, usPosY, usWidth, HELP_SCREEN_GAP_BTN_LINES, + HELP_SCREEN_TITLE_BODY_FONT, HELP_SCREEN_TITLE_BODY_COLOR, zText, + HELP_SCREEN_TEXT_BACKGROUND, FALSE, 0 ); + + if( !gHelpScreen.fForceHelpScreenToComeUp ) + { + //calc location for the ' [ x ] Dont display again...' + iStartLoc = HELPSCREEN_RECORD_SIZE * HLP_TXT_CONSTANT_FOOTER; + LoadEncryptedDataFromFile(HELPSCREEN_FILE, zText, iStartLoc, HELPSCREEN_RECORD_SIZE ); + + usPosX = gHelpScreen.usLeftMarginPosX + HELP_SCREEN_SHOW_HELP_AGAIN_REGION_TEXT_OFFSET_X; + + usPosY = gHelpScreen.usScreenLocY + gHelpScreen.usScreenHeight - HELP_SCREEN_SHOW_HELP_AGAIN_REGION_TEXT_OFFSET_Y + 2; + + + //Display the ' [ x ] Dont display again...' + IanDisplayWrappedString( usPosX, usPosY, usWidth, HELP_SCREEN_GAP_BTN_LINES, + HELP_SCREEN_TEXT_BODY_FONT, HELP_SCREEN_TITLE_BODY_COLOR, zText, + HELP_SCREEN_TEXT_BACKGROUND, FALSE, 0 ); + } + + SetFontShadow( DEFAULT_SHADOW ); +} + +void BtnHelpScreenBtnsCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { +// btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + //Get the btn id + INT8 bRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + ChangeToHelpScreenSubPage( bRetValue ); +/* + //change the current page to the new one + gHelpScreen.bCurrentHelpScreenActiveSubPage = ( bRetValue > gHelpScreen.bNumberOfButtons ) ? gHelpScreen.bNumberOfButtons-1 : bRetValue; + + gHelpScreen.ubHelpScreenDirty = HLP_SCRN_DRTY_LVL_REFRESH_TEXT; + + for( i=0; i< gHelpScreen.bNumberOfButtons; i++ ) + { + ButtonList[ guiHelpScreenBtns[i] ]->uiFlags &= (~BUTTON_CLICKED_ON ); + } + + //change the current sub page, and render it to the buffer + ChangeHelpScreenSubPage(); +*/ + btn->uiFlags |= BUTTON_CLICKED_ON; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { +// btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void ChangeToHelpScreenSubPage( INT8 bNewPage ) +{ + INT8 i; + + //if for some reason, we are assigning a lower number + if( bNewPage < 0 ) + { + gHelpScreen.bCurrentHelpScreenActiveSubPage = 0; + } + + //for some reason if the we are passing in a # that is greater then the max, set it to the max + else if( bNewPage >= gHelpScreen.bNumberOfButtons ) + { + gHelpScreen.bCurrentHelpScreenActiveSubPage = ( gHelpScreen.bNumberOfButtons == 0 ) ? 0: gHelpScreen.bNumberOfButtons -1; + } + + //if we are selecting the current su page, exit + else if( bNewPage == gHelpScreen.bCurrentHelpScreenActiveSubPage ) + { + return; + } + + //else assign the new subpage + else + { + gHelpScreen.bCurrentHelpScreenActiveSubPage = bNewPage; + } + + //refresh the screen + gHelpScreen.ubHelpScreenDirty = HLP_SCRN_DRTY_LVL_REFRESH_TEXT; + + //'undepress' all the buttons + for( i=0; i< gHelpScreen.bNumberOfButtons; i++ ) + { + ButtonList[ guiHelpScreenBtns[i] ]->uiFlags &= (~BUTTON_CLICKED_ON ); + } + + //depress the proper button + ButtonList[ guiHelpScreenBtns[ gHelpScreen.bCurrentHelpScreenActiveSubPage ] ]->uiFlags |= BUTTON_CLICKED_ON; + + //change the current sub page, and render it to the buffer + ChangeHelpScreenSubPage(); +} + +void GetHelpScreenText( UINT32 uiRecordToGet, STR16 pText ) +{ + INT32 iStartLoc = -1; + + iStartLoc = HELPSCREEN_RECORD_SIZE * uiRecordToGet; + LoadEncryptedDataFromFile(HELPSCREEN_FILE, pText, iStartLoc, HELPSCREEN_RECORD_SIZE ); +} + +//returns the number of vertical pixels printed +UINT16 GetAndDisplayHelpScreenText( UINT32 uiRecord, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth ) +{ + CHAR16 zText[1024]; + UINT16 usNumVertPixels = 0; + UINT32 uiStartLoc; + + SetFontShadow( NO_SHADOW ); + + GetHelpScreenText( uiRecord, zText ); + + //Get the record + uiStartLoc = HELPSCREEN_RECORD_SIZE * uiRecord; + LoadEncryptedDataFromFile(HELPSCREEN_FILE, zText, uiStartLoc, HELPSCREEN_RECORD_SIZE ); + + //Display the text + usNumVertPixels = IanDisplayWrappedString( usPosX, usPosY, usWidth, HELP_SCREEN_GAP_BTN_LINES, + HELP_SCREEN_TEXT_BODY_FONT, HELP_SCREEN_TEXT_BODY_COLOR, zText, + HELP_SCREEN_TEXT_BACKGROUND, FALSE, 0 ); + + SetFontShadow( DEFAULT_SHADOW ); + + return( usNumVertPixels ); +} + + + + + +void BtnHelpScreenDontShowHelpAgainCallback( GUI_BUTTON *btn, INT32 reason ) +{ +// UINT8 ubButton = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { +/* + btn->uiFlags &= ~BUTTON_CLICKED_ON; + + if( gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen & ( 1 << gHelpScreen.bCurrentHelpScreen ) ) + { +// + gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen &= ~( 1 << gHelpScreen.bCurrentHelpScreen ); + } + else + { +// gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen |= ( 1 << gHelpScreen.bCurrentHelpScreen ); + + } +// btn->uiFlags |= BUTTON_CLICKED_ON; +*/ + } +} + +/* +void HelpScreenDontShowHelpAgainToggleTextRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } + + + else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if( gGameSettings.fOptions[ ubButton ] ) + { + } + else + { + } + } +} +*/ + +//set the fact the we have chmaged to a new screen +void NewScreenSoResetHelpScreen( ) +{ + gHelpScreen.fHaveAlreadyBeenInHelpScreenSinceEnteringCurrenScreen = FALSE; + gHelpScreen.bDelayEnteringHelpScreenBy1FrameCount = 0; +} + + +void BtnHelpScreenExitCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + + PrepareToExitHelpScreen(); + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +UINT16 RenderLaptopHelpScreen() +{ + UINT16 usPosX, usPosY, usWidth, usNumVertPixels; + UINT8 ubCnt; + UINT16 usTotalNumberOfVerticalPixels=0; + UINT16 usFontHeight = GetFontHeight( HELP_SCREEN_TEXT_BODY_FONT ); + + + if( gHelpScreen.bCurrentHelpScreenActiveSubPage == -1 ) + { + return( 0 ); + } + + //Get the position for the text + GetHelpScreenTextPositions( &usPosX, &usPosY, &usWidth ); + + //switch on the current screen + switch( gHelpScreen.bCurrentHelpScreenActiveSubPage ) + { + case HLP_SCRN_LPTP_OVERVIEW: + //Display all the paragraphs + for( ubCnt=0; ubCnt<2; ubCnt++ ) + { + //Display the text, and get the number of pixels it used to display it + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_LAPTOP_OVERVIEW_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + +/* + //Display the first paragraph + usTotalNumberOfVerticalPixels = GetAndDisplayHelpScreenText( HLP_TXT_LAPTOP_OVERVIEW_P1, usPosX, usPosY, usWidth ); + + usPosY = usPosY+ usNumVertPixels + GetFontHeight( HELP_SCREEN_TEXT_BODY_FONT ); + + //Display the second paragraph + usTotalNumberOfVerticalPixels += GetAndDisplayHelpScreenText( HLP_TXT_LAPTOP_OVERVIEW_P2, usPosX, usPosY, usWidth ); +*/ + break; + + case HLP_SCRN_LPTP_EMAIL: + + //Display the first paragraph + usTotalNumberOfVerticalPixels = GetAndDisplayHelpScreenText( HLP_TXT_LAPTOP_EMAIL_P1, usPosX, usPosY, usWidth ); + break; + + + case HLP_SCRN_LPTP_WEB: + + //Display the first paragraph + usTotalNumberOfVerticalPixels = GetAndDisplayHelpScreenText( HLP_TXT_LAPTOP_WEB_P1, usPosX, usPosY, usWidth ); + + break; + + + case HLP_SCRN_LPTP_FILES: + + //Display the first paragraph + usTotalNumberOfVerticalPixels = GetAndDisplayHelpScreenText( HLP_TXT_LAPTOP_FILES_P1, usPosX, usPosY, usWidth ); + break; + + + case HLP_SCRN_LPTP_HISTORY: + //Display the first paragraph + usTotalNumberOfVerticalPixels = GetAndDisplayHelpScreenText( HLP_TXT_LAPTOP_HISTORY_P1, usPosX, usPosY, usWidth ); + + break; + + + case HLP_SCRN_LPTP_PERSONNEL: + + //Display the first paragraph + usTotalNumberOfVerticalPixels = GetAndDisplayHelpScreenText( HLP_TXT_LAPTOP_PERSONNEL_P1, usPosX, usPosY, usWidth ); + break; + + case HLP_SCRN_LPTP_FINANCIAL: + //Display all the paragraphs + for( ubCnt=0; ubCnt<2; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_FINANCES_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + + break; + + case HLP_SCRN_LPTP_MERC_STATS: + //Display all the paragraphs + for( ubCnt=0; ubCnt<15; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_MERC_STATS_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + + break; + } + + return( usTotalNumberOfVerticalPixels ); +} + + +UINT16 RenderMapScreenNoOneHiredYetHelpScreen() +{ + UINT16 usPosX, usPosY, usWidth, usNumVertPixels; + UINT8 ubCnt; + UINT16 usTotalNumberOfVerticalPixels=0; + UINT16 usFontHeight = GetFontHeight( HELP_SCREEN_TEXT_BODY_FONT ); + + + if( gHelpScreen.bCurrentHelpScreenActiveSubPage == -1 ) + { + return( 0 ); + } + + //Get the position for the text + GetHelpScreenTextPositions( &usPosX, &usPosY, &usWidth ); + + //switch on the current screen + switch( gHelpScreen.bCurrentHelpScreenActiveSubPage ) + { + case HLP_SCRN_NO_ONE_HIRED: + + //Display all the paragraphs + for( ubCnt=0; ubCnt<2; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_MPSCRN_NO_1_HIRED_YET_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + + break; + } + + return( usTotalNumberOfVerticalPixels ); +} + + +UINT16 RenderMapScreenNotYetInArulcoHelpScreen() +{ + UINT16 usPosX, usPosY, usWidth, usNumVertPixels; + UINT8 ubCnt; + UINT16 usTotalNumberOfVerticalPixels=0; + UINT16 usFontHeight = GetFontHeight( HELP_SCREEN_TEXT_BODY_FONT ); + + + if( gHelpScreen.bCurrentHelpScreenActiveSubPage == -1 ) + { + return( 0 ); + } + + //Get the position for the text + GetHelpScreenTextPositions( &usPosX, &usPosY, &usWidth ); + + //switch on the current screen + switch( gHelpScreen.bCurrentHelpScreenActiveSubPage ) + { + case HLP_SCRN_NOT_IN_ARULCO: + + //Display all the paragraphs + for( ubCnt=0; ubCnt<3; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_MPSCRN_NOT_IN_ARULCO_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + } + + return( usTotalNumberOfVerticalPixels ); +} + + +UINT16 RenderMapScreenSectorInventoryHelpScreen() +{ + UINT16 usPosX, usPosY, usWidth, usNumVertPixels; + UINT8 ubCnt; + UINT16 usTotalNumberOfVerticalPixels=0; + UINT16 usFontHeight = GetFontHeight( HELP_SCREEN_TEXT_BODY_FONT ); + + + if( gHelpScreen.bCurrentHelpScreenActiveSubPage == -1 ) + { + return( 0 ); + } + + //Get the position for the text + GetHelpScreenTextPositions( &usPosX, &usPosY, &usWidth ); + + //switch on the current screen + switch( gHelpScreen.bCurrentHelpScreenActiveSubPage ) + { + case HLP_SCRN_MPSCRN_SCTR_OVERVIEW: + + //Display all the paragraphs + for( ubCnt=0; ubCnt<2; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_SECTOR_INVTRY_OVERVIEW_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + + break; + } + + return( usTotalNumberOfVerticalPixels ); +} + + + + +UINT16 RenderTacticalHelpScreen() +{ + UINT16 usPosX, usPosY, usWidth, usNumVertPixels; + UINT8 ubCnt; + UINT16 usTotalNumberOfVerticalPixels=0; + UINT16 usFontHeight = GetFontHeight( HELP_SCREEN_TEXT_BODY_FONT ); + + + if( gHelpScreen.bCurrentHelpScreenActiveSubPage == -1 ) + { + return( 0 ); + } + + //Get the position for the text + GetHelpScreenTextPositions( &usPosX, &usPosY, &usWidth ); + + //switch on the current screen + switch( gHelpScreen.bCurrentHelpScreenActiveSubPage ) + { + case HLP_SCRN_TACTICAL_OVERVIEW: + + //Display all the paragraph + for( ubCnt=0; ubCnt<4; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_TACTICAL_OVERVIEW_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + + case HLP_SCRN_TACTICAL_MOVEMENT: + //Display all the paragraphs + for( ubCnt=0; ubCnt<4; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_TACTICAL_MOVEMENT_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + + + case HLP_SCRN_TACTICAL_SIGHT: + //Display all the paragraphs + for( ubCnt=0; ubCnt<4; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_TACTICAL_SIGHT_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + + break; + + + case HLP_SCRN_TACTICAL_ATTACKING: + //Display all the paragraphs + for( ubCnt=0; ubCnt<3; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_TACTICAL_ATTACKING_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + + + case HLP_SCRN_TACTICAL_ITEMS: + + //Display all the paragraphs + for( ubCnt=0; ubCnt<4; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_TACTICAL_ITEMS_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + + break; + + + case HLP_SCRN_TACTICAL_KEYBOARD: + //Display all the paragraphs + for( ubCnt=0; ubCnt<8; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_TACTICAL_KEYBOARD_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + } + + return( usTotalNumberOfVerticalPixels ); +} + + + +UINT16 RenderMapScreenHelpScreen() +{ + UINT16 usPosX, usPosY, usWidth, usNumVertPixels; + UINT8 ubCnt; + UINT16 usTotalNumberOfVerticalPixels=0; + UINT16 usFontHeight = GetFontHeight( HELP_SCREEN_TEXT_BODY_FONT ); + + + if( gHelpScreen.bCurrentHelpScreenActiveSubPage == -1 ) + { + return( 0 ); + } + + //Get the position for the text + GetHelpScreenTextPositions( &usPosX, &usPosY, &usWidth ); + + //switch on the current screen + switch( gHelpScreen.bCurrentHelpScreenActiveSubPage ) + { + case HLP_SCRN_MPSCRN_OVERVIEW: + + //Display all the paragraph + for( ubCnt=0; ubCnt<3; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + + case HLP_SCRN_MPSCRN_ASSIGNMENTS: + + //Display all the paragraphs + for( ubCnt=0; ubCnt<4; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + + + case HLP_SCRN_MPSCRN_DESTINATIONS: + //Display all the paragraphs + for( ubCnt=0; ubCnt<5; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + + break; + + + case HLP_SCRN_MPSCRN_MAP: + + //Display all the paragraphs + for( ubCnt=0; ubCnt<3; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_WELCOM_TO_ARULCO_MAP_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + + + case HLP_SCRN_MPSCRN_MILITIA: + + //Display all the paragraphs + for( ubCnt=0; ubCnt<3; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_WELCOM_TO_ARULCO_MILITIA_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + + break; + + + case HLP_SCRN_MPSCRN_AIRSPACE: + + //Display all the paragraphs + for( ubCnt=0; ubCnt<2; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_WELCOM_TO_ARULCO_AIRSPACE_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + + case HLP_SCRN_MPSCRN_ITEMS: + + //Display all the paragraphs + for( ubCnt=0; ubCnt<1; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_WELCOM_TO_ARULCO_ITEMS_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + + case HLP_SCRN_MPSCRN_KEYBOARD: + //Display all the paragraphs + for( ubCnt=0; ubCnt<4; ubCnt++ ) + { + usNumVertPixels = GetAndDisplayHelpScreenText( HLP_TXT_WELCOM_TO_ARULCO_KEYBOARD_P1+ubCnt, usPosX, usPosY, usWidth ); + + //move the next text down by the right amount + usPosY = usPosY+ usNumVertPixels + usFontHeight; + + //add the total amount of pixels used + usTotalNumberOfVerticalPixels += usNumVertPixels + usFontHeight; + } + break; + } + + return( usTotalNumberOfVerticalPixels ); +} + + +void RefreshAllHelpScreenButtons() +{ + UINT8 i; + + //loop through all the buttons, and refresh them + for( i=0; i< gHelpScreen.bNumberOfButtons; i++ ) + { + ButtonList[ guiHelpScreenBtns[i] ]->uiFlags |= BUTTON_DIRTY; + } + + ButtonList[ guiHelpScreenExitBtn ]->uiFlags |= BUTTON_DIRTY; + + if( !gHelpScreen.fForceHelpScreenToComeUp ) + { + ButtonList[ gHelpScreenDontShowHelpAgainToggle ]->uiFlags |= BUTTON_DIRTY; + } + + ButtonList[ giHelpScreenScrollArrows[0] ]->uiFlags |= BUTTON_DIRTY; + ButtonList[ giHelpScreenScrollArrows[1] ]->uiFlags |= BUTTON_DIRTY; +} + + + +INT8 HelpScreenDetermineWhichMapScreenHelpToShow() +{ + if( fShowMapInventoryPool ) + { + return( HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY ); + } + + if( AnyMercsHired() == FALSE ) + { + return( HELP_SCREEN_MAPSCREEN_NO_ONE_HIRED ); + } + + if( gTacticalStatus.fDidGameJustStart ) + { + return( HELP_SCREEN_MAPSCREEN_NOT_IN_ARULCO ); + } + + return( HELP_SCREEN_MAPSCREEN ); +} + + +BOOLEAN CreateHelpScreenTextBuffer() +{ + VSURFACE_DESC vs_desc; + + // Create a background video surface to blt the face onto + vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; + vs_desc.usWidth = HLP_SCRN__WIDTH_OF_TEXT_BUFFER; + vs_desc.usHeight = HLP_SCRN__HEIGHT_OF_TEXT_BUFFER; + vs_desc.ubBitDepth = 16; + CHECKF( AddVideoSurface( &vs_desc, &guiHelpScreenTextBufferSurface) ); + + return( TRUE ); +} + +void DestroyHelpScreenTextBuffer() +{ + DeleteVideoSurfaceFromIndex( guiHelpScreenTextBufferSurface ); +} + +void RenderCurrentHelpScreenTextToBuffer() +{ + //clear the buffer ( use 0, black as a transparent color + ClearHelpScreenTextBuffer(); + + //Render the current screen, and get the number of pixels it used to display + gHelpScreen.usTotalNumberOfPixelsInBuffer = RenderSpecificHelpScreen(); + + //calc the number of lines in the buffer + gHelpScreen.usTotalNumberOfLinesInBuffer = gHelpScreen.usTotalNumberOfPixelsInBuffer / ( HLP_SCRN__HEIGHT_OF_1_LINE_IN_BUFFER ); +} + + +void RenderTextBufferToScreen() +{ + HVSURFACE hDestVSurface, hSrcVSurface; + SGPRect SrcRect; + + + GetVideoSurface( &hDestVSurface, guiRENDERBUFFER ); + GetVideoSurface( &hSrcVSurface, guiHelpScreenTextBufferSurface ); + + SrcRect.iLeft = 0; + SrcRect.iTop = gHelpScreen.iLineAtTopOfTextBuffer * HLP_SCRN__HEIGHT_OF_1_LINE_IN_BUFFER; + SrcRect.iRight = HLP_SCRN__WIDTH_OF_TEXT_BUFFER; + SrcRect.iBottom = SrcRect.iTop + HLP_SCRN__HEIGHT_OF_TEXT_AREA - ( 2 * 8 ); + + BltVSurfaceUsingDD( hDestVSurface, hSrcVSurface, VO_BLT_SRCTRANSPARENCY, gHelpScreen.usLeftMarginPosX, ( gHelpScreen.usScreenLocY + HELP_SCREEN_TEXT_OFFSET_Y ), (RECT*)&SrcRect ); + + DisplayHelpScreenTextBufferScrollBox(); +} + +void ChangeHelpScreenSubPage() +{ + //reset + gHelpScreen.iLineAtTopOfTextBuffer = 0; + + RenderCurrentHelpScreenTextToBuffer(); + + //enable or disable the help screen arrow buttons + if( gHelpScreen.usTotalNumberOfLinesInBuffer <= HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER ) + { + DisableButton( giHelpScreenScrollArrows[0] ); + DisableButton( giHelpScreenScrollArrows[1] ); + } + else + { + EnableButton( giHelpScreenScrollArrows[0] ); + EnableButton( giHelpScreenScrollArrows[1] ); + } +} + +void ClearHelpScreenTextBuffer() +{ + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + + // CLEAR THE FRAME BUFFER + pDestBuf = LockVideoSurface( guiHelpScreenTextBufferSurface, &uiDestPitchBYTES ); + memset(pDestBuf, 0, HLP_SCRN__HEIGHT_OF_TEXT_BUFFER * uiDestPitchBYTES ); + UnLockVideoSurface( guiHelpScreenTextBufferSurface ); + InvalidateScreen( ); +} + + + +// - is up, + is down +void ChangeTopLineInTextBufferByAmount( INT32 iAmouontToMove ) +{ + //if we are moving up + if( iAmouontToMove < 0 ) + { + if( gHelpScreen.iLineAtTopOfTextBuffer + iAmouontToMove >= 0 ) + { + //if we can move up by the requested amount + if( ( gHelpScreen.usTotalNumberOfLinesInBuffer - gHelpScreen.iLineAtTopOfTextBuffer ) > iAmouontToMove ) + { + gHelpScreen.iLineAtTopOfTextBuffer += iAmouontToMove; + } + + //else, trying to move past the top + else + { + gHelpScreen.iLineAtTopOfTextBuffer = 0; + } + } + else + { + gHelpScreen.iLineAtTopOfTextBuffer = 0; + } + } + + //else we are moving down + else + { + //if we dont have to scroll cause there is not enough text + if( gHelpScreen.usTotalNumberOfLinesInBuffer <= HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER ) + { + gHelpScreen.iLineAtTopOfTextBuffer = 0; + } + else + { + if( ( gHelpScreen.iLineAtTopOfTextBuffer + HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER + iAmouontToMove ) <= gHelpScreen.usTotalNumberOfLinesInBuffer ) + { + gHelpScreen.iLineAtTopOfTextBuffer += iAmouontToMove; + } + else + { + gHelpScreen.iLineAtTopOfTextBuffer = gHelpScreen.usTotalNumberOfLinesInBuffer - HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER; + } + } + } + +// RenderCurrentHelpScreenTextToBuffer(); + + gHelpScreen.ubHelpScreenDirty = HLP_SCRN_DRTY_LVL_REFRESH_TEXT; +} + + + +void DisplayHelpScreenTextBufferScrollBox() +{ + INT32 iSizeOfBox; + INT32 iTopPosScrollBox=0; + UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + UINT16 usPosX; + + if( gHelpScreen.bNumberOfButtons != 0 ) + { + usPosX = gHelpScreen.usScreenLocX + HLP_SCRN__SCROLL_POSX + HELP_SCREEN_BUTTON_BORDER_WIDTH; + } + else + { + usPosX = gHelpScreen.usScreenLocX + HLP_SCRN__SCROLL_POSX; + } + + // + //first calculate the height of the scroll box + // + + CalculateHeightAndPositionForHelpScreenScrollBox( &iSizeOfBox, &iTopPosScrollBox ); + + // + // next draw the box + // + + //if there ARE scroll bars, draw the + if( !( gHelpScreen.usTotalNumberOfLinesInBuffer <= HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER ) ) + { + ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, iTopPosScrollBox, usPosX+HLP_SCRN__WIDTH_OF_SCROLL_AREA, iTopPosScrollBox+iSizeOfBox-1, Get16BPPColor( FROMRGB( 227, 198, 88 ) ) ); + + //display the line + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + + // draw the gold highlite line on the top and left + LineDraw(FALSE, usPosX, iTopPosScrollBox, usPosX+HLP_SCRN__WIDTH_OF_SCROLL_AREA, iTopPosScrollBox, Get16BPPColor( FROMRGB( 235, 222, 171 ) ), pDestBuf); + LineDraw(FALSE, usPosX, iTopPosScrollBox, usPosX, iTopPosScrollBox+iSizeOfBox-1, Get16BPPColor( FROMRGB( 235, 222, 171 ) ), pDestBuf); + + // draw the shadow line on the bottom and right + LineDraw(FALSE, usPosX, iTopPosScrollBox+iSizeOfBox-1, usPosX+HLP_SCRN__WIDTH_OF_SCROLL_AREA, iTopPosScrollBox+iSizeOfBox-1, Get16BPPColor( FROMRGB( 65, 49, 6 ) ), pDestBuf); + LineDraw(FALSE, usPosX+HLP_SCRN__WIDTH_OF_SCROLL_AREA, iTopPosScrollBox, usPosX+HLP_SCRN__WIDTH_OF_SCROLL_AREA, iTopPosScrollBox+iSizeOfBox-1, Get16BPPColor( FROMRGB( 65, 49, 6 ) ), pDestBuf); + + // unlock frame buffer + UnLockVideoSurface( FRAME_BUFFER ); + } +} + + +void CreateScrollAreaButtons() +{ + UINT16 usPosX, usWidth, usPosY; + INT32 iPosY, iHeight; + + if( gHelpScreen.bNumberOfButtons != 0 ) + { + usPosX = gHelpScreen.usScreenLocX + HLP_SCRN__SCROLL_POSX + HELP_SCREEN_BUTTON_BORDER_WIDTH; + } + else + { + usPosX = gHelpScreen.usScreenLocX + HLP_SCRN__SCROLL_POSX; + } + + usWidth = HLP_SCRN__WIDTH_OF_SCROLL_AREA; + + //Get the height and position of the scroll box + CalculateHeightAndPositionForHelpScreenScrollBox( &iHeight, &iPosY ); + + //Create a mouse region 'mask' the entrire screen + MSYS_DefineRegion( &gHelpScreenScrollArea, usPosX, (UINT16)iPosY, (UINT16)(usPosX+usWidth), (UINT16)(iPosY+HLP_SCRN__HEIGHT_OF_SCROLL_AREA), MSYS_PRIORITY_HIGHEST, + gHelpScreen.usCursor, SelectHelpScrollAreaMovementCallBack, SelectHelpScrollAreaCallBack ); + MSYS_AddRegion( &gHelpScreenScrollArea ); + + guiHelpScreenScrollArrowImage[ 0 ] = LoadButtonImage( "INTERFACE\\HelpScreen.sti", 14,10, 11, 12 ,13 ); + guiHelpScreenScrollArrowImage[ 1 ] = UseLoadedButtonImage( guiHelpScreenScrollArrowImage[ 0 ] ,19,15,16,17,18 ); + + if( gHelpScreen.bNumberOfButtons != 0 ) + usPosX = gHelpScreen.usScreenLocX + HLP_SCRN__SCROLL_UP_ARROW_X + HELP_SCREEN_BUTTON_BORDER_WIDTH; + else + usPosX = gHelpScreen.usScreenLocX + HLP_SCRN__SCROLL_UP_ARROW_X; + + usPosY = gHelpScreen.usScreenLocY + HLP_SCRN__SCROLL_UP_ARROW_Y; + + //Create the scroll arrows + giHelpScreenScrollArrows[ 0 ] = QuickCreateButton( guiHelpScreenScrollArrowImage[ 0 ], usPosX, usPosY, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, BtnHelpScreenScrollArrowsCallback ); + MSYS_SetBtnUserData( giHelpScreenScrollArrows[0],0,0); + SetButtonCursor( giHelpScreenScrollArrows[0], gHelpScreen.usCursor ); + + usPosY = gHelpScreen.usScreenLocY + HLP_SCRN__SCROLL_DWN_ARROW_Y; + + //Create the scroll arrows + giHelpScreenScrollArrows[ 1 ] = QuickCreateButton( guiHelpScreenScrollArrowImage[ 1 ], usPosX, usPosY, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, BtnHelpScreenScrollArrowsCallback ); + MSYS_SetBtnUserData( giHelpScreenScrollArrows[1],0,1); + SetButtonCursor( giHelpScreenScrollArrows[1], gHelpScreen.usCursor ); +} + + +void DeleteScrollArrowButtons() +{ + INT8 i; + //remove the mouse region that blankets + MSYS_RemoveRegion( &gHelpScreenScrollArea ); + + for( i=0; i<2; i++) + { + RemoveButton( giHelpScreenScrollArrows[ i ] ); + UnloadButtonImage( guiHelpScreenScrollArrowImage[ i ] ); + } +} + + +void CalculateHeightAndPositionForHelpScreenScrollBox( INT32 *piHeightOfScrollBox, INT32 *piTopOfScrollBox ) +{ + INT32 iSizeOfBox, iTopPosScrollBox; + FLOAT dPercentSizeOfBox = 0; + FLOAT dTemp=0; + + dPercentSizeOfBox = HLP_SCRN__MAX_NUMBER_DISPLAYED_LINES_IN_BUFFER / (FLOAT ) gHelpScreen.usTotalNumberOfLinesInBuffer; + + //if the # is >= 1 then the box is the full size of the scroll area + if( dPercentSizeOfBox >= 1.0 ) + { + iSizeOfBox = HLP_SCRN__HEIGHT_OF_SCROLL_AREA; + + //no need to calc the top spot for the box + iTopPosScrollBox = HLP_SCRN__SCROLL_POSY; + } + else + { + iSizeOfBox = (INT32)( dPercentSizeOfBox * HLP_SCRN__HEIGHT_OF_SCROLL_AREA + 0.5 ); + + // + //next, calculate the top position of the box + // + dTemp = ( HLP_SCRN__HEIGHT_OF_SCROLL_AREA / ( FLOAT ) gHelpScreen.usTotalNumberOfLinesInBuffer ) * gHelpScreen.iLineAtTopOfTextBuffer; + + iTopPosScrollBox = (INT32)( dTemp +.5 ) + HLP_SCRN__SCROLL_POSY; + } + + if( piHeightOfScrollBox != NULL ) + *piHeightOfScrollBox = iSizeOfBox; + + if( piTopOfScrollBox != NULL ) + *piTopOfScrollBox = iTopPosScrollBox; +} + + +void SelectHelpScrollAreaCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + gfScrollBoxIsScrolling = FALSE; + gHelpScreen.iLastMouseClickY = -1; + } + else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + gfScrollBoxIsScrolling = TRUE; + HelpScreenMouseMoveScrollBox( pRegion->MouseYPos ); + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } + +} + +void SelectHelpScrollAreaMovementCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { +// InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } + else if( iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + } + else if( iReason & MSYS_CALLBACK_REASON_MOVE ) + { + if( gfLeftButtonState ) + { + HelpScreenMouseMoveScrollBox( pRegion->MouseYPos ); + } + } +} + +void HelpScreenMouseMoveScrollBox( INT32 usMousePosY ) +{ + INT32 iPosY, iHeight; + INT32 iNumberOfIncrements=0; + FLOAT dSizeOfIncrement = ( HLP_SCRN__HEIGHT_OF_SCROLL_AREA / ( FLOAT ) gHelpScreen.usTotalNumberOfLinesInBuffer ); + FLOAT dTemp; + INT32 iNewPosition; + + CalculateHeightAndPositionForHelpScreenScrollBox( &iHeight, &iPosY ); + + if( AreWeClickingOnScrollBar( usMousePosY ) || gHelpScreen.iLastMouseClickY != -1 ) + { + if( gHelpScreen.iLastMouseClickY == -1 ) + gHelpScreen.iLastMouseClickY = usMousePosY; + + if( usMousePosY < gHelpScreen.iLastMouseClickY ) + { +// iNewPosition = iPosY - ( UINT16)( dSizeOfIncrement + .5); + iNewPosition = iPosY - ( gHelpScreen.iLastMouseClickY - usMousePosY ); + + } + else if( usMousePosY > gHelpScreen.iLastMouseClickY ) + { +// iNewPosition = iPosY + ( UINT16)( dSizeOfIncrement + .5); + iNewPosition = iPosY + usMousePosY - gHelpScreen.iLastMouseClickY; + } + else + { + return; + } + + dTemp = ( iNewPosition - iPosY ) / dSizeOfIncrement; + + if( dTemp < 0 ) + iNumberOfIncrements = (INT32)( dTemp - 0.5 ); + else + iNumberOfIncrements = (INT32)( dTemp + 0.5 ); + + gHelpScreen.iLastMouseClickY = usMousePosY; + +// return; + } + else + { + //if the mouse is higher then the top of the scroll area, set it to the top of the scroll area + if( usMousePosY < HLP_SCRN__SCROLL_POSY ) + usMousePosY = HLP_SCRN__SCROLL_POSY; + + dTemp = ( usMousePosY - iPosY ) / dSizeOfIncrement; + + if( dTemp < 0 ) + iNumberOfIncrements = (INT32)( dTemp - 0.5 ); + else + iNumberOfIncrements = (INT32)( dTemp + 0.5 ); + } + + //if there has been a change + if( iNumberOfIncrements != 0 ) + { + ChangeTopLineInTextBufferByAmount( iNumberOfIncrements ); + } +} + + + +void BtnHelpScreenScrollArrowsCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + INT32 iButtonID = MSYS_GetBtnUserData( btn, 0); + + btn->uiFlags |= BUTTON_CLICKED_ON; + + //if up + if( iButtonID == 0 ) + { + ChangeTopLineInTextBufferByAmount( -1 ); + } + else + { + ChangeTopLineInTextBufferByAmount( 1 ); + } + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + INT32 iButtonID = MSYS_GetBtnUserData( btn, 0); + + //if up + if( iButtonID == 0 ) + { + ChangeTopLineInTextBufferByAmount( -1 ); + } + else + { + ChangeTopLineInTextBufferByAmount( 1 ); + } + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + +} + + +BOOLEAN AreWeClickingOnScrollBar( INT32 usMousePosY ) +{ + INT32 iPosY, iHeight; + + CalculateHeightAndPositionForHelpScreenScrollBox( &iHeight, &iPosY ); + + if( usMousePosY >= iPosY && usMousePosY < ( iPosY + iHeight ) ) + return( TRUE ); + else + return( FALSE ); +} diff --git a/HelpScreen.h b/HelpScreen.h new file mode 100644 index 00000000..a575fd6d --- /dev/null +++ b/HelpScreen.h @@ -0,0 +1,75 @@ +#ifndef _HELP_SCREEN__H_ +#define _HELP_SCREEN__H_ + + +//enum used for the different help screens that can come up +enum +{ + HELP_SCREEN_LAPTOP, + HELP_SCREEN_MAPSCREEN, + HELP_SCREEN_MAPSCREEN_NO_ONE_HIRED, + HELP_SCREEN_MAPSCREEN_NOT_IN_ARULCO, + HELP_SCREEN_MAPSCREEN_SECTOR_INVENTORY, + HELP_SCREEN_TACTICAL, + HELP_SCREEN_OPTIONS, + HELP_SCREEN_LOAD_GAME, + + HELP_SCREEN_NUMBER_OF_HELP_SCREENS, +}; + + + + +typedef struct +{ + INT8 bCurrentHelpScreen; + UINT32 uiFlags; + + UINT16 usHasPlayerSeenHelpScreenInCurrentScreen; + + UINT8 ubHelpScreenDirty; + + UINT16 usScreenLocX; + UINT16 usScreenLocY; + UINT16 usScreenWidth; + UINT16 usScreenHeight; + + INT32 iLastMouseClickY; //last position the mouse was clicked ( if != -1 ) + + INT8 bCurrentHelpScreenActiveSubPage; //used to keep track of the current page being displayed + + INT8 bNumberOfButtons; + + //used so if the user checked the box to show the help, it doesnt automatically come up every frame + BOOLEAN fHaveAlreadyBeenInHelpScreenSinceEnteringCurrenScreen; + + INT8 bDelayEnteringHelpScreenBy1FrameCount; + UINT16 usLeftMarginPosX; + + UINT16 usCursor; + + BOOLEAN fWasTheGamePausedPriorToEnteringHelpScreen; + + + + //scroll variables + UINT16 usTotalNumberOfPixelsInBuffer; + INT32 iLineAtTopOfTextBuffer; + UINT16 usTotalNumberOfLinesInBuffer; + BOOLEAN fForceHelpScreenToComeUp; + +} HELP_SCREEN_STRUCT; + +extern HELP_SCREEN_STRUCT gHelpScreen; + + + + +BOOLEAN ShouldTheHelpScreenComeUp( UINT8 ubScreenID, BOOLEAN fForceHelpScreenToComeUp ); +void HelpScreenHandler(); +void InitHelpScreenSystem(); +void NewScreenSoResetHelpScreen( ); +INT8 HelpScreenDetermineWhichMapScreenHelpToShow(); + + +#endif \ No newline at end of file diff --git a/HelpScreenText.h b/HelpScreenText.h new file mode 100644 index 00000000..463cdc42 --- /dev/null +++ b/HelpScreenText.h @@ -0,0 +1,178 @@ +#ifndef HELP_SCREEN_TEXT__H_ +#define HELP_SCREEN_TEXT__H_ + + +#include "Encrypted File.h" + +#define HELPSCREEN_FILE "BINARYDATA\\Help.edt" + +#define HELPSCREEN_RECORD_SIZE 80 * 8 * 2 + +//enum for the help text paragrphs +enum +{ + HLP_TXT_CONSTANT_SUBTITLE, //0 + HLP_TXT_CONSTANT_FOOTER, + HLP_TXT_LAPTOP_TITLE, + HLP_TXT_LAPTOP_BUTTON_1, + HLP_TXT_LAPTOP_OVERVIEW_P1, + HLP_TXT_LAPTOP_OVERVIEW_P2, + HLP_TXT_LAPTOP_BUTTON_2, + HLP_TXT_LAPTOP_EMAIL_P1, + HLP_TXT_LAPTOP_BUTTON_3, + HLP_TXT_LAPTOP_WEB_P1, + + HLP_TXT_LAPTOP_BUTTON_4, //10 + HLP_TXT_LAPTOP_FILES_P1, + HLP_TXT_LAPTOP_BUTTON_5, + HLP_TXT_LAPTOP_HISTORY_P1, + HLP_TXT_LAPTOP_BUTTON_6, + HLP_TXT_LAPTOP_PERSONNEL_P1, + + HLP_TXT_LAPTOP_BUTTON_7, + HLP_TXT_FINANCES_P1, + HLP_TXT_FINANCES_P2, + + HLP_TXT_LAPTOP_BUTTON_8, + HLP_TXT_MERC_STATS_P1, + HLP_TXT_MERC_STATS_P2, + HLP_TXT_MERC_STATS_P3, + HLP_TXT_MERC_STATS_P4, + HLP_TXT_MERC_STATS_P5, + HLP_TXT_MERC_STATS_P6, + HLP_TXT_MERC_STATS_P7, + HLP_TXT_MERC_STATS_P8, + HLP_TXT_MERC_STATS_P9, + HLP_TXT_MERC_STATS_P10, + HLP_TXT_MERC_STATS_P11, + HLP_TXT_MERC_STATS_P12, + HLP_TXT_MERC_STATS_P13, + HLP_TXT_MERC_STATS_P14, + HLP_TXT_MERC_STATS_P15, + +//mapscreen no one hired yet + HLP_TXT_MPSCRN_NO_1_HIRED_YET_TITLE, + HLP_TXT_MPSCRN_NO_1_HIRED_YET_P1, //20 + HLP_TXT_MPSCRN_NO_1_HIRED_YET_P2, + +//mapscreen not in arulco yet + HLP_TXT_MPSCRN_NOT_IN_ARULCO_TITLE, + + HLP_TXT_MPSCRN_NOT_IN_ARULCO_P1, + HLP_TXT_MPSCRN_NOT_IN_ARULCO_P2, + HLP_TXT_MPSCRN_NOT_IN_ARULCO_P3, + + HLP_TXT_WELCOM_TO_ARULCO_TITLE, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_1, + HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P1, + HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P2, + + + + + + HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P3, //30 + HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P4, + HLP_TXT_WELCOM_TO_ARULCO_OVERVIEW_P5, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_2, + HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P1, + HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P2, + HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P3, + HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P4, + HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P5, + HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P6, + + + HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P7, //40 + HLP_TXT_WELCOM_TO_ARULCO_ASSNMNT_P8, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_3, + HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P1, + HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P2, + HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P3, + HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P4, + HLP_TXT_WELCOM_TO_ARULCO_DSTINATION_P5, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_4, + HLP_TXT_WELCOM_TO_ARULCO_MAP_P1, + + HLP_TXT_WELCOM_TO_ARULCO_MAP_P2, //50 + HLP_TXT_WELCOM_TO_ARULCO_MAP_P3, + HLP_TXT_WELCOM_TO_ARULCO_MAP_P4, + HLP_TXT_WELCOM_TO_ARULCO_MAP_P5, + HLP_TXT_WELCOM_TO_ARULCO_MAP_P6, + HLP_TXT_WELCOM_TO_ARULCO_MAP_P7, + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_5, + HLP_TXT_WELCOM_TO_ARULCO_MILITIA_P1, + HLP_TXT_WELCOM_TO_ARULCO_MILITIA_P2, + + + HLP_TXT_WELCOM_TO_ARULCO_MILITIA_P3, //60 + + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_6, + HLP_TXT_WELCOM_TO_ARULCO_AIRSPACE_P1, + HLP_TXT_WELCOM_TO_ARULCO_AIRSPACE_P2, + + + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_7, + HLP_TXT_WELCOM_TO_ARULCO_ITEMS_P1, + + HLP_TXT_WELCOM_TO_ARULCO_BUTTON_8, + HLP_TXT_WELCOM_TO_ARULCO_KEYBOARD_P1, + HLP_TXT_WELCOM_TO_ARULCO_KEYBOARD_P2, + HLP_TXT_WELCOM_TO_ARULCO_KEYBOARD_P3, + HLP_TXT_WELCOM_TO_ARULCO_KEYBOARD_P4, + + + HLP_TXT_TACTICAL_TITLE, + HLP_TXT_TACTICAL_BUTTON_1, + HLP_TXT_TACTICAL_OVERVIEW_P1, + HLP_TXT_TACTICAL_OVERVIEW_P2, + HLP_TXT_TACTICAL_OVERVIEW_P3, + HLP_TXT_TACTICAL_OVERVIEW_P4, + + HLP_TXT_TACTICAL_BUTTON_2, + HLP_TXT_TACTICAL_MOVEMENT_P1, + HLP_TXT_TACTICAL_MOVEMENT_P2, + HLP_TXT_TACTICAL_MOVEMENT_P3, + HLP_TXT_TACTICAL_MOVEMENT_P4, + + + HLP_TXT_TACTICAL_BUTTON_3, + HLP_TXT_TACTICAL_SIGHT_P1, + HLP_TXT_TACTICAL_SIGHT_P2, + HLP_TXT_TACTICAL_SIGHT_P3, + HLP_TXT_TACTICAL_SIGHT_P4, + + HLP_TXT_TACTICAL_BUTTON_4, + HLP_TXT_TACTICAL_ATTACKING_P1, + HLP_TXT_TACTICAL_ATTACKING_P2, + HLP_TXT_TACTICAL_ATTACKING_P3, + + HLP_TXT_TACTICAL_BUTTON_5, + + HLP_TXT_TACTICAL_ITEMS_P1, + HLP_TXT_TACTICAL_ITEMS_P2, + HLP_TXT_TACTICAL_ITEMS_P3, + HLP_TXT_TACTICAL_ITEMS_P4, + HLP_TXT_TACTICAL_BUTTON_6, + + + HLP_TXT_TACTICAL_KEYBOARD_P1, + HLP_TXT_TACTICAL_KEYBOARD_P2, + HLP_TXT_TACTICAL_KEYBOARD_P3, + HLP_TXT_TACTICAL_KEYBOARD_P4, + HLP_TXT_TACTICAL_KEYBOARD_P5, + HLP_TXT_TACTICAL_KEYBOARD_P6, + HLP_TXT_TACTICAL_KEYBOARD_P7, + HLP_TXT_TACTICAL_KEYBOARD_P8, + + + HLP_TXT_SECTOR_INVTRY_TITLE, +// HLP_TXT_SECTOR_INVTRY_BUTTON_1, + HLP_TXT_SECTOR_INVTRY_OVERVIEW_P1, + HLP_TXT_SECTOR_INVTRY_OVERVIEW_P2, + + +// HLP_TXT_, +}; + +#endif diff --git a/Init.cpp b/Init.cpp new file mode 100644 index 00000000..088aef79 --- /dev/null +++ b/Init.cpp @@ -0,0 +1,563 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" + #include "HelpScreen.h" + #include "Multilingual Text Code Generator.h" + #include "INIReader.h" + +#else + #include + #include "sgp.h" + #include "Gameloop.h" + #include "Screens.h" + #include "Wcheck.h" + #include "INIReader.h" + #include "vobject_blitters.h" + #include "renderworld.h" + #include "mousesystem.h" + #include "sysutil.h" + #include "worlddef.h" + #include "Animation Data.h" + #include "overhead.h" + #include "Font Control.h" + #include "Button System.h" + #include "Timer Control.h" + #include "Utilities.h" + #include "Radar Screen.h" + #include "Render Dirty.h" + #include "cursors.h" + #include "Sound Control.h" + #include "Event Pump.h" + #include "lighting.h" + #include "Cursor Control.h" + #include "music control.h" + #include "video.h" + #include "sys globals.h" + #include "mapscreen.h" + #include "interface items.h" + #include "Maputility.h" + #include "strategic.h" + #include "dialogue control.h" + #include "Text.h" + #include "laptop.h" + #include "NPC.h" + #include "MercTextBox.h" + #include "tile cache.h" + #include "strategicmap.h" + #include "Map Information.h" + #include "laptop.h" + #include "Shade Table Util.h" + #include "Exit Grids.h" + #include "Summary Info.h" + #include "GameSettings.h" + #include "Game Init.h" + #include "Init.h" + #include "jascreens.h" + #include "XML.h" +#endif + +extern BOOLEAN GetCDromDriveLetter( STR8 pString ); + +// The InitializeGame function is responsible for setting up all data and Gaming Engine +// tasks which will run the game + +#ifdef JA2BETAVERSION +extern BOOLEAN gfUseConsecutiveQuickSaveSlots; +#endif + +#if defined( GERMAN ) && !defined( _DEBUG ) + //#define LASERLOCK_ENABLED +#endif + + +#ifdef LASERLOCK_ENABLED + int LASERLOK_Init( HINSTANCE hInstance ); + int LASERLOK_Run(); + int LASERLOK_Check(); + + BOOLEAN PrepareLaserLockSystem(); + void HandleLaserLockResult( BOOLEAN fSuccess ); +// int TestCall( int n); +#endif + +extern HINSTANCE ghInstance; + + +BOOLEAN LoadExternalGameplayData(STR directoryName) +{ + char fileName[MAX_PATH]; + + strcpy(fileName, directoryName); + strcat(fileName, AMMOTYPESFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + + if(!ReadInAmmoTypeStats(fileName)) + return FALSE; + + //if(!WriteAmmoTypeStats()) + // return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, AMMOFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInAmmoStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, ITEMSFILENAME); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); + if(!ReadInItemStats(fileName)) + return FALSE; + + //if(!WriteItemStats()) + // return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, SOUNDSFILENAME); + if(!ReadInSoundArray(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, MAGAZINESFILENAME); + if(!ReadInMagazineStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, ATTACHMENTSFILENAME); + if(!ReadInAttachmentStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, ATTACHMENTINFOFILENAME); + if(!ReadInAttachmentInfoStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, LAUNCHABLESFILENAME); + if(!ReadInLaunchableStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, COMPATIBLEFACEITEMSFILENAME); + if(!ReadInCompatibleFaceItemStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, MERGESFILENAME); + if(!ReadInMergeStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, ATTACHMENTCOMBOMERGESFILENAME); + if(!ReadInAttachmentComboMergeStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, EXPLOSIVESFILENAME); + if(!ReadInExplosiveStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, ARMOURSFILENAME); + if(!ReadInArmourStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, WEAPONSFILENAME); + if(!ReadInWeaponStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, INCOMPATIBLEATTACHMENTSFILENAME); + if(!ReadInIncompatibleAttachmentStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, ENEMYGUNCHOICESFILENAME); + if(!ReadInExtendedArmyGunChoicesStats (fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, ENEMYITEMCHOICESFILENAME); + if(!ReadInArmyItemChoicesStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, IMPITEMCHOICESFILENAME); + if(!ReadInIMPItemChoicesStats(fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, TONYINVENTORYFILENAME); + if(!ReadInInventoryStats(gTonyInventory,fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, DEVININVENTORYFILENAME); + if(!ReadInInventoryStats(gDevinInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, FRANZINVENTORYFILENAME); + if(!ReadInInventoryStats(gFranzInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, KEITHINVENTORYFILENAME); + if(!ReadInInventoryStats(gKeithInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, SAMINVENTORYFILENAME); + if(!ReadInInventoryStats(gSamInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, JAKEINVENTORYFILENAME); + if(!ReadInInventoryStats(gJakeInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, HOWARDINVENTORYFILENAME); + if(!ReadInInventoryStats(gHowardInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, GABBYINVENTORYFILENAME); + if(!ReadInInventoryStats(gGabbyInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, FRANKINVENTORYFILENAME); + if(!ReadInInventoryStats(gFrankInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, ELGININVENTORYFILENAME); + if(!ReadInInventoryStats(gElginInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, MANNYINVENTORYFILENAME); + if(!ReadInInventoryStats(gMannyInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, HERVEINVENTORYFILENAME); + if(!ReadInInventoryStats(gHerveInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, PETERINVENTORYFILENAME); + if(!ReadInInventoryStats(gPeterInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, ALBERTOINVENTORYFILENAME); + if(!ReadInInventoryStats(gAlbertoInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, CARLOINVENTORYFILENAME); + if(!ReadInInventoryStats(gCarloInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, MICKEYINVENTORYFILENAME); + if(!ReadInInventoryStats(gMickyInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, ARNIEINVENTORYFILENAME); + if(!ReadInInventoryStats(gArnieInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, PERKOINVENTORYFILENAME); + if(!ReadInInventoryStats(gPerkoInventory,fileName)) + return FALSE; + strcpy(fileName, directoryName); + strcat(fileName, FREDOINVENTORYFILENAME); + if(!ReadInInventoryStats(gFredoInventory,fileName)) + return FALSE; + + strcpy(fileName, directoryName); + strcat(fileName, CITYTABLEFILENAME); + if(!ReadInMapStructure(fileName)) + return FALSE; + + return TRUE; +} + + +UINT32 InitializeJA2(void) +{ + +#ifdef LASERLOCK_ENABLED + HandleLaserLockResult( PrepareLaserLockSystem() ); +#endif + + HandleJA2CDCheck( ); + + gfWorldLoaded = FALSE; + + //Load external game mechanic data + if ( !LoadExternalGameplayData(TABLEDATA_DIRECTORY)) + { + return( ERROR_SCREEN ); + } + + // Load external text + LoadAllExternalText(); + + // Init JA2 sounds + InitJA2Sound( ); + + gsRenderCenterX = 805; + gsRenderCenterY = 805; + + + // Init data + InitializeSystemVideoObjects( ); + + // Init animation system + if ( !InitAnimationSystem( ) ) + { + return( ERROR_SCREEN ); + } + + // Init lighting system + InitLightingSystem(); + + // Init dialog queue system + InitalizeDialogueControl(); + + if ( !InitStrategicEngine( ) ) + { + return( ERROR_SCREEN ); + } + + //needs to be called here to init the SectorInfo struct + InitStrategicMovementCosts( ); + + // Init tactical engine + if ( !InitTacticalEngine( ) ) + { + return( ERROR_SCREEN ); + } + + // Init timer system + //Moved to the splash screen code. + //InitializeJA2Clock( ); + + // INit shade tables + BuildShadeTable( ); + + // INit intensity tables + BuildIntensityTable( ); + + // Init Event Manager + if ( !InitializeEventManager( ) ) + { + return( ERROR_SCREEN ); + } + + // Initailize World + if ( !InitializeWorld( ) ) + { + return( ERROR_SCREEN ); + } + + InitTileCache( ); + + InitMercPopupBox( ); + + // Set global volume + MusicSetVolume( gGameSettings.ubMusicVolumeSetting ); + + DetermineRGBDistributionSettings(); + +#ifdef JA2BETAVERSION + #ifdef JA2EDITOR + + //UNCOMMENT NEXT LINE TO ALLOW FORCE UPDATES... + //LoadGlobalSummary(); + if( gfMustForceUpdateAllMaps ) + { + ApologizeOverrideAndForceUpdateEverything(); + } + #endif +#endif + +#ifdef JA2BETAVERSION + if( ProcessIfMultilingualCmdLineArgDetected( (UINT8 *)gzCommandLine ) ) + { //If the multilingual text code generator has activated, quit now. + gfProgramIsRunning = FALSE; + return( INIT_SCREEN ); + } +#endif + +#ifdef JA2BETAVERSION + // CHECK COMMANDLINE FOR SPECIAL UTILITY + if ( strcmp( gzCommandLine, "-DOMAPS" ) == 0 ) + { + return( MAPUTILITY_SCREEN ); + } +#endif + +#ifdef JA2BETAVERSION + //This allows the QuickSave Slots to be autoincremented, ie everytime the user saves, there will be a new quick save file + if ( _stricmp( gzCommandLine, "-quicksave" ) == 0 ) + { + gfUseConsecutiveQuickSaveSlots = TRUE; + } +#endif + +#ifdef JA2BETAVERSION + #ifdef JA2EDITOR + // CHECK COMMANDLINE FOR SPECIAL UTILITY + if( !strcmp( gzCommandLine, "-EDITORAUTO" ) ) + { + OutputDebugString( "Beginning JA2 using -EDITORAUTO commandline argument...\n" ); + //For editor purposes, need to know the default map file. + sprintf( (char *)gubFilename, "none"); + //also set the sector + gWorldSectorX = 0; + gWorldSectorY = 0; + gfAutoLoadA9 = TRUE; + gfIntendOnEnteringEditor = TRUE; + gGameOptions.fGunNut = TRUE; + gGameOptions.fAirStrikes = FALSE; + return( GAME_SCREEN ); + } + if ( strcmp( gzCommandLine, "-EDITOR" ) == 0 ) + { + OutputDebugString( "Beginning JA2 using -EDITOR commandline argument...\n" ); + //For editor purposes, need to know the default map file. + sprintf( (char *)gubFilename, "none"); + //also set the sector + gWorldSectorX = 0; + gWorldSectorY = 0; + gfAutoLoadA9 = FALSE; + gfIntendOnEnteringEditor = TRUE; + gGameOptions.fGunNut = TRUE; + gGameOptions.fAirStrikes = FALSE; + return( GAME_SCREEN ); + } + #endif +#endif + + return( INIT_SCREEN ); +} + + +void ShutdownJA2(void) +{ + UINT32 uiIndex; + + // Clear screen.... + ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + InvalidateScreen( ); + // Remove cursor.... + SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); + + RefreshScreen( NULL ); + + ShutdownStrategicLayer(); + + // remove temp files built by laptop + ClearOutTempLaptopFiles( ); + + // Shutdown queue system + ShutdownDialogueControl(); + + // Shutdown Screens + for (uiIndex = 0; uiIndex < MAX_SCREENS; uiIndex++) + { + (*(GameScreens[uiIndex].ShutdownScreen))(); + } + + + // Shutdown animation system + DeInitAnimationSystem( ); + + ShutdownLightingSystem(); + + CursorDatabaseClear(); + + ShutdownTacticalEngine( ); + + // Shutdown Overhead + ShutdownOverhead( ); + + DeinitializeWorld( ); + + DeleteTileCache( ); + + ShutdownJA2Clock( ); + + ShutdownFonts(); + + ShutdownJA2Sound( ); + + ShutdownEventManager( ); + + ShutdownBaseDirtyRectQueue( ); + + // Unload any text box images! + RemoveTextMercPopupImages( ); + + ClearOutVehicleList(); +} + + +#ifdef LASERLOCK_ENABLED + +BOOLEAN PrepareLaserLockSystem() +{ + INT32 iInitRetVal=0; + INT32 iRunRetVal=0; + INT32 iCheckRetVal=0; + CHAR8 zDirectory[512]; + + CHAR8 zCdLocation[ SGPFILENAME_LEN ]; + CHAR8 zCdFile[ SGPFILENAME_LEN ]; + + //Get the "current" file directory + GetFileManCurrentDirectory( zDirectory ); + + if( GetCDromDriveLetter( zCdLocation ) ) + { + // OK, build filename + sprintf( zCdFile, "%s%s", zCdLocation, "Data" ); + } + else + { + goto FAILED_LASERLOK; + } + + //Go back to the root directory + SetFileManCurrentDirectory( zCdFile ); + //Init the laser lock system + iInitRetVal = LASERLOK_Init( ghInstance ); + if( iInitRetVal != 0 ) + goto FAILED_LASERLOK; + + //makes the verification of the laserlok system + iRunRetVal = LASERLOK_Run(); + if( iRunRetVal != 0 ) + goto FAILED_LASERLOK; + + //checks the result of the laserlok run function + iCheckRetVal = LASERLOK_Check(); + if( iCheckRetVal != 0 ) + goto FAILED_LASERLOK; + + //Restore back to the proper directory + SetFileManCurrentDirectory( zDirectory ); + return( TRUE ); + +FAILED_LASERLOK: + //Restore back to the proper directory + SetFileManCurrentDirectory( zDirectory ); + return( FALSE ); +} + +void HandleLaserLockResult( BOOLEAN fSuccess ) +{ + if( !fSuccess ) + { + CHAR8 zString[512]; + + sprintf( zString, "%S", gzLateLocalizedString[56] ); + + ShowCursor(TRUE); + ShowCursor(TRUE); + ShutdownWithErrorBox( zString ); + } +} + +#endif diff --git a/Init.h b/Init.h new file mode 100644 index 00000000..ba811598 --- /dev/null +++ b/Init.h @@ -0,0 +1,9 @@ +#ifndef _INIT_H +#define _INIT_H + +UINT32 InitializeJA2( ); +void ShutdownJA2( ); + +BOOLEAN LoadExternalGameplayData(STR directoryName); + +#endif \ No newline at end of file diff --git a/Intro.cpp b/Intro.cpp new file mode 100644 index 00000000..24964e78 --- /dev/null +++ b/Intro.cpp @@ -0,0 +1,518 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" + #include "Intro.h" + #include "Cinematics.h" +#else + #include "sgp.h" + #include "sys globals.h" + #include "sysutil.h" + #include "vobject_blitters.h" + #include "wcheck.h" + #include "cursors.h" + #include "font control.h" + #include "cursor control.h" + #include "render dirty.h" + #include "GameScreen.h" + #include "Text.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Font Control.h" + #include "text.h" + #include "Multi Language Graphic Utils.h" + #include "Line.h" + #include "Intro.h" + #include "Cinematics.h" +#endif + +extern STR16 gzIntroScreen[]; +extern HVSURFACE ghFrameBuffer; + +enum +{ + INTRO_TXT__CANT_FIND_INTRO, +}; + +//ddd + + +//ggg +BOOLEAN gfIntroScreenEntry; +BOOLEAN gfIntroScreenExit; + +UINT32 guiIntroExitScreen = INTRO_SCREEN; + + +extern BOOLEAN gfDoneWithSplashScreen; + +SMKFLIC *gpSmackFlic = NULL; + +#define SMKINTRO_FIRST_VIDEO 255 +#define SMKINTRO_NO_VIDEO -1 + +//enums for the various smacker files +enum +{ + SMKINTRO_REBEL_CRDT, + SMKINTRO_OMERTA, + SMKINTRO_PRAGUE_CRDT, + SMKINTRO_PRAGUE, + + //there are no more videos shown for the begining + + + SMKINTRO_END_END_SPEECH_MIGUEL, + SMKINTRO_END_END_SPEECH_NO_MIGUEL, + SMKINTRO_END_HELI_FLYBY, + SMKINTRO_END_SKYRIDER_HELICOPTER, + SMKINTRO_END_NOSKYRIDER_HELICOPTER, + + SMKINTRO_SPLASH_SCREEN, + SMKINTRO_SPLASH_TALONSOFT, + + //there are no more videos shown for the endgame + SMKINTRO_LAST_END_GAME, +}; + +INT32 giCurrentIntroBeingPlayed = SMKINTRO_NO_VIDEO; + +CHAR *gpzSmackerFileNames[] = +{ + //begining of the game + "INTRO\\Rebel_cr.smk", + "INTRO\\Omerta.smk", + "INTRO\\Prague_cr.smk", + "INTRO\\Prague.smk", + + + //endgame + "INTRO\\Throne_Mig.smk", + "INTRO\\Throne_NoMig.smk", + "INTRO\\Heli_FlyBy.smk", + "INTRO\\Heli_Sky.smk", + "INTRO\\Heli_NoSky.smk", + + "INTRO\\SplashScreen.smk", + "INTRO\\TalonSoftid_endhold.smk", +}; + + +//enums used for when the intro screen can come up, either begining game intro, or end game cinematic +INT8 gbIntroScreenMode=-1; + + +extern void CDromEjectionErrorMessageBoxCallBack( UINT8 bExitValue ); + +void GetIntroScreenUserInput(); +BOOLEAN EnterIntroScreen(); +void RenderIntroScreen(); +void ExitIntroScreen(); +void HandleIntroScreen(); +void PrepareToExitIntroScreen(); +INT32 GetNextIntroVideo( UINT32 uiCurrentVideo ); +void StartPlayingIntroFlic( INT32 iIndexOfFlicToPlay ); +void DisplaySirtechSplashScreen(); + + +//ppp + + +UINT32 IntroScreenInit( void ) +{ + //Set so next time we come in, we can set up + gfIntroScreenEntry = TRUE; + + return( 1 ); +} + + +UINT32 IntroScreenShutdown( void ) +{ + return( 1 ); +} + + +UINT32 IntroScreenHandle( void ) +{ + if( gfIntroScreenEntry ) + { + EnterIntroScreen(); + gfIntroScreenEntry = FALSE; + gfIntroScreenExit = FALSE; + + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + } + + RestoreBackgroundRects(); + + + GetIntroScreenUserInput(); + + HandleIntroScreen(); + + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + + + if( gfIntroScreenExit ) + { + ExitIntroScreen(); + gfIntroScreenExit = FALSE; + gfIntroScreenEntry = TRUE; + } + + return( guiIntroExitScreen ); +} + + +BOOLEAN EnterIntroScreen() +{ + INT32 iFirstVideoID = -1; + + ClearMainMenu(); + + + SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); + + // Don't play music.... + SetMusicMode( MUSIC_NONE ); + +#ifdef JA2BETAVERSION + if( FileExists( "..\\NoIntro.txt" ) ) + { + PrepareToExitIntroScreen(); + return( TRUE ); + } +#endif + + //if the library doesnt exist, exit + if( !IsLibraryOpened( LIBRARY_INTRO ) ) + { + PrepareToExitIntroScreen(); + return( TRUE ); + } + + //initialize smacker + SmkInitialize( ghWindow, SCREEN_WIDTH, SCREEN_HEIGHT); + + + //get the index opf the first video to watch + iFirstVideoID = GetNextIntroVideo( SMKINTRO_FIRST_VIDEO ); + + if( iFirstVideoID != -1 ) + { + StartPlayingIntroFlic( iFirstVideoID ); + + guiIntroExitScreen = INTRO_SCREEN; + } + + //Got no intro video, exit + else + { + PrepareToExitIntroScreen(); + } + + + return( TRUE ); +} + +void RenderIntroScreen() +{ +} + +void ExitIntroScreen() +{ + + //shutdown smaker + SmkShutdown(); +} + +void HandleIntroScreen() +{ + BOOLEAN fFlicStillPlaying = FALSE; + + //if we are exiting this screen, this frame, dont update the screen + if( gfIntroScreenExit ) + return; + + + //handle smaker each frame + fFlicStillPlaying = SmkPollFlics(); + + //if the flic is not playing + if( !fFlicStillPlaying ) + { + INT32 iNextVideoToPlay = -1; + + iNextVideoToPlay = GetNextIntroVideo( giCurrentIntroBeingPlayed ); + + if( iNextVideoToPlay != -1 ) + { + StartPlayingIntroFlic( iNextVideoToPlay ); + } + else + { + PrepareToExitIntroScreen(); + giCurrentIntroBeingPlayed = -1; + } + } + + InvalidateScreen(); +} + + + +void GetIntroScreenUserInput() +{ + InputAtom Event; + POINT MousePos; + + + GetCursorPos(&MousePos); + + while( DequeueEvent( &Event ) ) + { + // HOOK INTO MOUSE HOOKS + switch( Event.usEvent) + { + case LEFT_BUTTON_DOWN: + MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_UP: + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_DOWN: + MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + } + + + if( Event.usEvent == KEY_UP ) + { + switch( Event.usParam ) + { + case ESC: + PrepareToExitIntroScreen(); + break; + case SPACE: + SmkCloseFlic( gpSmackFlic ); + break; + +#ifdef JA2TESTVERSION + + case 'r': + break; + + case 'i': + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + break; + +#endif + } + } + } + + // if the user presses either mouse button + if( gfLeftButtonState || gfRightButtonState ) + { + //advance to the next flic + SmkCloseFlic( gpSmackFlic ); + } +} + + +void PrepareToExitIntroScreen() +{ + //if its the intro at the begining of the game + if( gbIntroScreenMode == INTRO_BEGINING ) + { + //go to the init screen + guiIntroExitScreen = INIT_SCREEN; + } + else if( gbIntroScreenMode == INTRO_SPLASH ) + { + //display a logo when exiting + DisplaySirtechSplashScreen(); + + gfDoneWithSplashScreen = TRUE; + guiIntroExitScreen = INIT_SCREEN; + } + else + { + //We want to reinitialize the game + ReStartingGame(); + +// guiIntroExitScreen = MAINMENU_SCREEN; + guiIntroExitScreen = CREDIT_SCREEN; + } + + gfIntroScreenExit = TRUE; +} + + +INT32 GetNextIntroVideo( UINT32 uiCurrentVideo ) +{ + INT32 iStringToUse = -1; + + //switch on whether it is the beginging or the end game video + switch( gbIntroScreenMode ) + { + //the video at the begining of the game + case INTRO_BEGINING: + { + switch( uiCurrentVideo ) + { + case SMKINTRO_FIRST_VIDEO: + iStringToUse = SMKINTRO_REBEL_CRDT; + break; + case SMKINTRO_REBEL_CRDT: + iStringToUse = SMKINTRO_OMERTA; + break; + case SMKINTRO_OMERTA: + iStringToUse = SMKINTRO_PRAGUE_CRDT; + break; + case SMKINTRO_PRAGUE_CRDT: + iStringToUse = SMKINTRO_PRAGUE; + break; + case SMKINTRO_PRAGUE: + iStringToUse = -1; + break; +// case SMKINTRO_LAST_INTRO: +// iStringToUse = -1; +// break; + } + } + break; + + //end game + case INTRO_ENDING: + { + switch( uiCurrentVideo ) + { + case SMKINTRO_FIRST_VIDEO: + //if Miguel is dead, play the flic with out him in it + if( gMercProfiles[ MIGUEL ].bMercStatus == MERC_IS_DEAD ) + iStringToUse = SMKINTRO_END_END_SPEECH_NO_MIGUEL; + else + iStringToUse = SMKINTRO_END_END_SPEECH_MIGUEL; + break; + + case SMKINTRO_END_END_SPEECH_MIGUEL: + case SMKINTRO_END_END_SPEECH_NO_MIGUEL: + iStringToUse = SMKINTRO_END_HELI_FLYBY; + break; + + //if SkyRider is dead, play the flic without him + case SMKINTRO_END_HELI_FLYBY: + if( gMercProfiles[ SKYRIDER ].bMercStatus == MERC_IS_DEAD ) + iStringToUse = SMKINTRO_END_NOSKYRIDER_HELICOPTER; + else + iStringToUse = SMKINTRO_END_SKYRIDER_HELICOPTER; + break; + } + } + break; + + case INTRO_SPLASH: + switch( uiCurrentVideo ) + { + case SMKINTRO_FIRST_VIDEO: + iStringToUse = SMKINTRO_SPLASH_SCREEN; + break; + case SMKINTRO_SPLASH_SCREEN: + //iStringToUse = SMKINTRO_SPLASH_TALONSOFT; + break; + } + break; + } + + return( iStringToUse ); +} + + +void StartPlayingIntroFlic( INT32 iIndexOfFlicToPlay ) +{ + + if( iIndexOfFlicToPlay != -1 ) + { + //start playing a flic + gpSmackFlic = SmkPlayFlic( gpzSmackerFileNames[ iIndexOfFlicToPlay ], (SCREEN_WIDTH-640)/2, (SCREEN_HEIGHT-480)/2, TRUE ); + + if( gpSmackFlic != NULL ) + { + giCurrentIntroBeingPlayed = iIndexOfFlicToPlay; + } + else + { + //do a check +#ifdef JA2BETAVERSION + PrepareToExitIntroScreen(); +#else + + DoScreenIndependantMessageBox( gzIntroScreen[INTRO_TXT__CANT_FIND_INTRO], MSG_BOX_FLAG_OK, CDromEjectionErrorMessageBoxCallBack ); +#endif + } + } +} + + +void SetIntroType( INT8 bIntroType ) +{ + if( bIntroType == INTRO_BEGINING ) + { + gbIntroScreenMode = INTRO_BEGINING; + } + else if( bIntroType == INTRO_ENDING ) + { + gbIntroScreenMode = INTRO_ENDING; + } + else if( bIntroType == INTRO_SPLASH ) + { + gbIntroScreenMode = INTRO_SPLASH; + } +} + + +void DisplaySirtechSplashScreen() +{ + HVOBJECT hPixHandle; + VOBJECT_DESC VObjectDesc; + UINT32 uiLogoID; + + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + + + // CLEAR THE FRAME BUFFER + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES ); + UnLockVideoSurface( FRAME_BUFFER ); + + + memset( &VObjectDesc, 0, sizeof( VOBJECT_DESC ) ); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\SirtechSplash.sti", VObjectDesc.ImageFile); + +// FilenameForBPP("INTERFACE\\TShold.sti", VObjectDesc.ImageFile); + if( !AddVideoObject(&VObjectDesc, &uiLogoID) ) + { + AssertMsg( 0, String( "Failed to load %s", VObjectDesc.ImageFile ) ); + return; + } + + GetVideoObject(&hPixHandle, uiLogoID); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,(SCREEN_WIDTH-640)/2, (SCREEN_HEIGHT-480)/2, VO_BLT_SRCTRANSPARENCY,NULL); + DeleteVideoObjectFromIndex(uiLogoID); + + + InvalidateScreen(); + RefreshScreen( NULL ); +} \ No newline at end of file diff --git a/Intro.h b/Intro.h new file mode 100644 index 00000000..15a5fd09 --- /dev/null +++ b/Intro.h @@ -0,0 +1,26 @@ +#ifndef _INTRO__C_ +#define _INTRO__C_ + + + +UINT32 IntroScreenShutdown( void ); +UINT32 IntroScreenHandle( void ); +UINT32 IntroScreenInit( void ); + + +//enums used for when the intro screen can come up, used with 'gbIntroScreenMode' +enum +{ + INTRO_BEGINING, //set when viewing the intro at the begining of the game + INTRO_ENDING, //set when viewing the end game video. + + INTRO_SPLASH, +}; + + +extern UINT32 guiSmackerSurface; + + +void SetIntroType( INT8 bIntroType ); + +#endif \ No newline at end of file diff --git a/JA2 All.h b/JA2 All.h new file mode 100644 index 00000000..9ddda201 --- /dev/null +++ b/JA2 All.h @@ -0,0 +1,162 @@ +#ifndef __JA2_ALL_H +#define __JA2_ALL_H + +#pragma message("GENERATED PCH FOR JA2 PROJECT.") + +#include +#include +#include +#include "sgp.h" +#include "gameloop.h" +#include "himage.h" +#include "vobject.h" +#include "vobject_private.h" +#include "vobject_blitters.h" +#include "Types.h" +#include "wcheck.h" +#include "renderworld.h" +#include "input.h" +#include "screenids.h" +#include "overhead.h" +#include "Isometric Utils.h" +#include "sysutil.h" +#include "Radar Screen.h" +#include "Soldier Control.h" +#include "Animation Control.h" +#include "Animation Data.h" +#include "Event Pump.h" +#include "Timer Control.h" +#include "Render Dirty.h" +#include "Sys Globals.h" +#include "interface.h" +#include "soldier ani.h" +#include +#include +#include "english.h" +#include "Fileman.h" +#include "messageboxscreen.h" +#include "sgp.h" +#include "fade screen.h" +#include "cursor control.h" +#include "music control.h" +#include "GameInitOptionsScreen.h" +#include "GameSettings.h" +#include "Utilities.h" +#include "Font Control.h" +#include "WordWrap.h" +#include "Options Screen.h" +#include "cursors.h" +#include "Screens.h" +#include "init.h" +#include "laptop.h" +#include "mapscreen.h" +#include "Game Clock.h" +#include "LibraryDataBase.h" +#include "Map Screen Interface.h" +#include "Tactical Save.h" +#include "Interface Control.h" +#include "text.h" +#include "Handle UI.h" +#include "Button System.h" +#include "lighting.h" +#include "environment.h" +#include "bullets.h" +#include "message.h" +#include +#include "overhead map.h" +#include "Strategic Exit GUI.h" +#include "strategic movement.h" +#include "Tactical Placement GUI.h" +#include "Air raid.h" +#include "game init.h" +//DEF: Test Code +#ifdef NETWORKED +#include "Networking.h" +#endif +#include "physics.h" +#include "dialogue control.h" +#include "soldier macros.h" +#include "faces.h" +#include "strategicmap.h" +#include "gamescreen.h" +#include "strategic turns.h" +#include "merc entering.h" +#include "soldier create.h" +#include "Soldier Init List.h" +#include "interface panels.h" +#include "Map Information.h" +#include "Squads.h" +#include "interface dialogue.h" +#include "auto bandage.h" +#include "meanwhile.h" +#include "strategic ai.h" +#include "Sound Control.h" +#include "SaveLoadScreen.h" +#include "GameVersion.h" +#include "Debug.h" +#include "Language Defines.h" +#include "mousesystem.h" +#include "worlddef.h" +#include "video.h" +#include "interface items.h" +#include "Maputility.h" +#include "strategic.h" +#include "NPC.h" +#include "MercTextBox.h" +#include "tile cache.h" +#include "Shade Table Util.h" +#include "Exit Grids.h" +#include "Summary Info.h" +#include +#include "font.h" +#include "timer.h" +#include "tiledef.h" +#include "editscreen.h" +#include "jascreens.h" +#include "animation cache.h" +#include "mainmenuscreen.h" +#include "Random.h" +#include "Multi Language Graphic Utils.h" +#include "SaveLoadGame.h" +#include "Text Input.h" +#include "Slider.h" +#include "soundman.h" +#include "Ambient Control.h" +#include "Worlddat.h" +#include "Gap.h" +#include "Soldier Profile.h" +#include "Keys.h" +#include "finances.h" +#include "History.h" +#include "files.h" +#include "Email.h" +#include "Game Events.h" +#include "LaptopSave.h" +#include "Queen Command.h" +#include "Quests.h" +#include "opplist.h" +#include "Merc Hiring.h" +#include "Ai.h" +#include "SmokeEffects.h" +#include "Map Screen Interface Border.h" +#include "Map Screen Interface Bottom.h" +#include "Map Screen Helicopter.h" +#include "Arms Dealer Init.h" +#include "Strategic Mines.h" +#include "Strategic Town Loyalty.h" +#include "Vehicles.h" +#include "Merc Contract.h" +#include "Strategic Pathing.h" +#include "TeamTurns.h" +#include "explosion control.h" +#include "Creature Spreading.h" +#include "Strategic Status.h" +#include "Boxing.h" +#include "Map Screen Interface Map.h" +#include "lighteffects.h" +#include "JA2 Splash.h" +#include "Scheduling.h" +#include "_JA25EnglishText.h" +#include "XML.h" + +#endif diff --git a/JA2 Demo Ads.h b/JA2 Demo Ads.h new file mode 100644 index 00000000..2d5d97c7 --- /dev/null +++ b/JA2 Demo Ads.h @@ -0,0 +1,6 @@ +#ifndef _JA2_DEMO_ADS_H +#define _JA2_DEMO_ADS_H + +#include "types.h" + +#endif \ No newline at end of file diff --git a/JA2 Splash.cpp b/JA2 Splash.cpp new file mode 100644 index 00000000..c9b48c9c --- /dev/null +++ b/JA2 Splash.cpp @@ -0,0 +1,71 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" +#else + //add includes here! +#endif + +UINT32 guiSplashFrameFade = 10; +UINT32 guiSplashStartTime = 0; +extern HVSURFACE ghFrameBuffer; + +//Simply create videosurface, load image, and draw it to the screen. +void InitJA2SplashScreen() +{ + UINT32 uiLogoID = 0; + //HVSURFACE hVSurface; // unused jonathanl + // VSURFACE_DESC VSurfaceDesc; //unused jonathanl + INT32 i = 0; + +#if !defined( ENGLISH ) && defined( JA2TESTVERSION ) + memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); + VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; + sprintf( VSurfaceDesc.ImageFile, "LOADSCREENS\\Notification.sti" ); + if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) + { + AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); + return; + } + GetVideoSurface(&hVSurface, uiLogoID ); + BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); + DeleteVideoSurfaceFromIndex( uiLogoID ); + + + InvalidateScreen(); + RefreshScreen( NULL ); + + guiSplashStartTime = GetJA2Clock(); + while( i < 60 * 15 )//guiSplashStartTime + 15000 > GetJA2Clock() ) + { + //Allow the user to pick his bum. + InvalidateScreen(); + RefreshScreen( NULL ); + i++; + } +#endif + + #ifdef ENGLISH + ClearMainMenu(); + #else + { + + memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); + VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; + GetMLGFilename( VSurfaceDesc.ImageFile, MLG_SPLASH ); + if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) + { + AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); + return; + } + + GetVideoSurface( &hVSurface, uiLogoID ); + BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); + DeleteVideoSurfaceFromIndex( uiLogoID ); + } + #endif + + + InvalidateScreen(); + RefreshScreen( NULL ); + + guiSplashStartTime = GetJA2Clock(); +} diff --git a/JA2 Splash.h b/JA2 Splash.h new file mode 100644 index 00000000..5c809e68 --- /dev/null +++ b/JA2 Splash.h @@ -0,0 +1,9 @@ +#ifndef __JA2_SPLASH_H +#define __JA2_SPLASH_H + +void InitJA2SplashScreen(); + +extern UINT32 guiSplashFrameFade; +extern UINT32 guiSplashStartTime; + +#endif \ No newline at end of file diff --git a/JA2.dep b/JA2.dep new file mode 100644 index 00000000..2ec6688d --- /dev/null +++ b/JA2.dep @@ -0,0 +1,4179 @@ +# Microsoft Developer Studio Generated Dependency File, included by JA2.mak + +.\Utils\_Ja25GermanText.cpp : \ + ".\builddefines.h"\ + ".\Editor\LoadScreen.h"\ + ".\fade screen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\local.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\standard gaming platform\compression.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\impTGA.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\vsurface_private.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Map Information.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\Soldier Control.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\Animated ProgressBar.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Debug Control.h"\ + ".\utils\encrypted file.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\popupbox.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\utils\sticonvert.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\Utils\Utils All.h"\ + ".\utils\wordwrap.h"\ + + +.\aniviewscreen.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\Credits.cpp : \ + ".\builddefines.h"\ + ".\Credits.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\utils\encrypted file.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\Utils\Cursors.cpp : \ + ".\builddefines.h"\ + ".\Editor\LoadScreen.h"\ + ".\fade screen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\local.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\standard gaming platform\compression.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\impTGA.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\vsurface_private.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Map Information.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\Soldier Control.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\Utils\Animated ProgressBar.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Debug Control.h"\ + ".\utils\encrypted file.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\popupbox.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\utils\sticonvert.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\Utils\Utils All.h"\ + ".\utils\wordwrap.h"\ + + +".\Fade Screen.cpp" : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\GameInitOptionsScreen.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\intro.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\gameloop.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\helpscreen.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\PreBattle Interface.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\gamescreen.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\helpscreen.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\PreBattle Interface.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\GameSettings.cpp : \ + ".\builddefines.h"\ + ".\cheats.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\helpscreen.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\Tactical\Campaign.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\GameVersion.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\HelpScreen.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\helpscreen.h"\ + ".\helpscreentext.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\utils\encrypted file.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\Init.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\helpscreen.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Multilingual Text Code Generator.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\Intro.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\intro.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\standard gaming platform\rad.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\standard gaming platform\smack.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\utils\cinematics.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +".\JA2 Splash.cpp" : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\Res\ja2.rc : \ + ".\Res\jagged3.ico"\ + + +.\jascreens.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +".\Loading Screen.cpp" : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\Loading Screen.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\MainMenuScreen.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\utils\encrypted file.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\MessageBoxScreen.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +".\Options Screen.cpp" : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\TileEngine\worldman.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\SaveLoadGame.cpp : \ + ".\builddefines.h"\ + ".\cheats.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\helpscreen.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\laptop\bobbyr.h"\ + ".\Laptop\BobbyRMailOrder.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\IMP Confirm.h"\ + ".\Laptop\IMP Portraits.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\mercs.h"\ + ".\Laptop\Store Inventory.h"\ + ".\Loading Screen.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\PreBattle Interface.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Event Handler.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\civ quotes.h"\ + ".\tactical\dialogue control.h"\ + ".\Tactical\Enemy Soldier Save.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\tactical\interface utils.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\Militia Control.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\Animated ProgressBar.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\SaveLoadScreen.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Init.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +.\SCREENS.cpp : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + + +".\Sys Globals.cpp" : \ + ".\builddefines.h"\ + ".\Editor\editscreen.h"\ + ".\Editor\Summary Info.h"\ + ".\fade screen.h"\ + ".\GameInitOptionsScreen.h"\ + ".\gameloop.h"\ + ".\gamescreen.h"\ + ".\GameSettings.h"\ + ".\gameversion.h"\ + ".\init.h"\ + ".\JA2 All.h"\ + ".\ja2 splash.h"\ + ".\jascreens.h"\ + ".\Language Defines.h"\ + ".\Laptop\email.h"\ + ".\Laptop\files.h"\ + ".\Laptop\finances.h"\ + ".\Laptop\history.h"\ + ".\Laptop\laptop.h"\ + ".\Laptop\LaptopSave.h"\ + ".\Laptop\Store Inventory.h"\ + ".\local.h"\ + ".\mainmenuscreen.h"\ + ".\MessageBoxScreen.h"\ + ".\Options Screen.h"\ + ".\SaveLoadGame.h"\ + ".\SaveLoadScreen.h"\ + ".\screenids.h"\ + ".\SCREENS.H"\ + ".\standard gaming platform\button sound control.h"\ + ".\Standard Gaming Platform\Button System.h"\ + ".\Standard Gaming Platform\container.h"\ + ".\Standard Gaming Platform\Cursor Control.h"\ + ".\Standard Gaming Platform\DbMan.h"\ + ".\Standard Gaming Platform\Debug.h"\ + ".\Standard Gaming Platform\DirectDraw Calls.h"\ + ".\Standard Gaming Platform\DirectX Common.h"\ + ".\Standard Gaming Platform\english.h"\ + ".\Standard Gaming Platform\FileMan.h"\ + ".\Standard Gaming Platform\font.h"\ + ".\Standard Gaming Platform\himage.h"\ + ".\Standard Gaming Platform\imgfmt.h"\ + ".\Standard Gaming Platform\Input.h"\ + ".\standard gaming platform\ja2 libs.h"\ + ".\Standard Gaming Platform\LibraryDataBase.h"\ + ".\Standard Gaming Platform\line.h"\ + ".\Standard Gaming Platform\MemMan.h"\ + ".\Standard Gaming Platform\mousesystem.h"\ + ".\Standard Gaming Platform\mousesystem_macros.h"\ + ".\standard gaming platform\mss.h"\ + ".\Standard Gaming Platform\Mutex Manager.h"\ + ".\Standard Gaming Platform\pcx.h"\ + ".\Standard Gaming Platform\random.h"\ + ".\Standard Gaming Platform\sgp.h"\ + ".\Standard Gaming Platform\shading.h"\ + ".\Standard Gaming Platform\soundman.h"\ + ".\Standard Gaming Platform\timer.h"\ + ".\Standard Gaming Platform\TopicIDs.h"\ + ".\Standard Gaming Platform\TopicOps.h"\ + ".\Standard Gaming Platform\Video.h"\ + ".\Standard Gaming Platform\vobject.h"\ + ".\Standard Gaming Platform\vobject_blitters.h"\ + ".\Standard Gaming Platform\vobject_private.h"\ + ".\Standard Gaming Platform\vsurface.h"\ + ".\Standard Gaming Platform\WCheck.h"\ + ".\Strategic\Assignments.h"\ + ".\Strategic\Campaign Types.h"\ + ".\Strategic\Creature Spreading.h"\ + ".\Strategic\Game Clock.h"\ + ".\Strategic\Game Event Hook.h"\ + ".\Strategic\Game Events.h"\ + ".\Strategic\Game Init.h"\ + ".\Strategic\Map Screen Helicopter.h"\ + ".\Strategic\Map Screen Interface Border.h"\ + ".\Strategic\Map Screen Interface Bottom.h"\ + ".\Strategic\Map Screen Interface Map.h"\ + ".\Strategic\Map Screen Interface.h"\ + ".\Strategic\mapscreen.h"\ + ".\strategic\meanwhile.h"\ + ".\Strategic\Merc Contract.h"\ + ".\Strategic\Queen Command.h"\ + ".\Strategic\Quests.h"\ + ".\Strategic\Scheduling.h"\ + ".\Strategic\Strategic AI.h"\ + ".\Strategic\Strategic Mines.h"\ + ".\Strategic\Strategic Movement.h"\ + ".\Strategic\Strategic Pathing.h"\ + ".\Strategic\Strategic Status.h"\ + ".\Strategic\Strategic Town Loyalty.h"\ + ".\strategic\strategic turns.h"\ + ".\Strategic\strategic.h"\ + ".\Strategic\strategicmap.h"\ + ".\Sys Globals.h"\ + ".\tactical\air raid.h"\ + ".\Tactical\animation cache.h"\ + ".\Tactical\Animation Control.h"\ + ".\Tactical\Animation Data.h"\ + ".\Tactical\Arms Dealer Init.h"\ + ".\tactical\auto bandage.h"\ + ".\Tactical\Boxing.h"\ + ".\tactical\bullets.h"\ + ".\tactical\dialogue control.h"\ + ".\tactical\faces.h"\ + ".\tactical\gap.h"\ + ".\Tactical\Handle Items.h"\ + ".\Tactical\Handle UI.h"\ + ".\tactical\interface control.h"\ + ".\tactical\interface dialogue.h"\ + ".\Tactical\Interface Items.h"\ + ".\Tactical\interface panels.h"\ + ".\Tactical\Interface.h"\ + ".\Tactical\Item Types.h"\ + ".\Tactical\Items.h"\ + ".\Tactical\Keys.h"\ + ".\Tactical\los.h"\ + ".\Tactical\Map Information.h"\ + ".\tactical\merc entering.h"\ + ".\Tactical\Merc Hiring.h"\ + ".\Tactical\opplist.h"\ + ".\Tactical\overhead types.h"\ + ".\Tactical\Overhead.h"\ + ".\tactical\rotting corpses.h"\ + ".\Tactical\soldier ani.h"\ + ".\Tactical\Soldier Control.h"\ + ".\Tactical\Soldier Create.h"\ + ".\tactical\soldier find.h"\ + ".\Tactical\Soldier Init List.h"\ + ".\Tactical\Soldier macros.h"\ + ".\Tactical\soldier profile type.h"\ + ".\Tactical\Soldier Profile.h"\ + ".\Tactical\Squads.h"\ + ".\Tactical\Strategic Exit GUI.h"\ + ".\Tactical\Tactical Save.h"\ + ".\Tactical\TeamTurns.h"\ + ".\Tactical\Vehicles.h"\ + ".\Tactical\weapons.h"\ + ".\Tactical\World Items.h"\ + ".\TacticalAI\ai.h"\ + ".\TacticalAI\NPC.h"\ + ".\TileEngine\Ambient Control.h"\ + ".\TileEngine\Ambient Types.h"\ + ".\TileEngine\environment.h"\ + ".\TileEngine\Exit Grids.h"\ + ".\tileengine\explosion control.h"\ + ".\TileEngine\Isometric Utils.h"\ + ".\tileengine\lighteffects.h"\ + ".\TileEngine\lighting.h"\ + ".\tileengine\overhead map.h"\ + ".\tileengine\phys math.h"\ + ".\tileengine\physics.h"\ + ".\TileEngine\Radar Screen.h"\ + ".\TileEngine\render dirty.h"\ + ".\TileEngine\renderworld.h"\ + ".\TileEngine\Shade Table Util.h"\ + ".\tileengine\smokeeffects.h"\ + ".\TileEngine\Structure Internals.h"\ + ".\TileEngine\structure.h"\ + ".\TileEngine\sysutil.h"\ + ".\tileengine\tactical placement gui.h"\ + ".\TileEngine\Tile Animation.h"\ + ".\tileengine\tile cache.h"\ + ".\TileEngine\TileDat.h"\ + ".\TileEngine\tiledef.h"\ + ".\tileengine\world tileset enums.h"\ + ".\TileEngine\WorldDat.h"\ + ".\TileEngine\worlddef.h"\ + ".\utils\_ja25englishtext.h"\ + ".\Utils\cursors.h"\ + ".\Utils\Event Manager.h"\ + ".\Utils\Event Pump.h"\ + ".\Utils\Font Control.h"\ + ".\utils\maputility.h"\ + ".\utils\merctextbox.h"\ + ".\Utils\message.h"\ + ".\Utils\Multi Language Graphic Utils.h"\ + ".\Utils\Music Control.h"\ + ".\utils\slider.h"\ + ".\Utils\Sound Control.h"\ + ".\Utils\Text Input.h"\ + ".\Utils\Text.h"\ + ".\Utils\Timer Control.h"\ + ".\Utils\utilities.h"\ + ".\utils\wordwrap.h"\ + diff --git a/JA2.dsp b/JA2.dsp new file mode 100644 index 00000000..8500de27 --- /dev/null +++ b/JA2.dsp @@ -0,0 +1,461 @@ +# Microsoft Developer Studio Project File - Name="ja2" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=ja2 - Win32 Demo Bounds Checker +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "JA2.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "JA2.mak" CFG="ja2 - Win32 Demo Bounds Checker" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ja2 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Release with Debug Info" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Bounds Checker" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Debug Demo" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Release Demo" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Demo Release with Debug Info" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Demo Bounds Checker" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName ""$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA" +# PROP Scc_LocalPath "..\..\ja2\build" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ja2 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir ".\Release" +# PROP BASE Intermediate_Dir ".\Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /G5 /MT /W3 /GX /Zi /O2 /Ob2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"JA2 All.h" /FD /O2b2 /c +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 libexpatMT.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map /machine:I386 /out:"..\ja2_cvs.exe" + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir ".\Debug" +# PROP BASE Intermediate_Dir ".\Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /I "..\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"JA2 All.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 libexpatMT.lib mss32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /nodefaultlib:"libcmt" /out:"..\ja2_cvs.exe" /libpath:".\..\..\Standard Gaming Platform\\" +# SUBTRACT LINK32 /nodefaultlib + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ja2___Wi" +# PROP BASE Intermediate_Dir "ja2___Wi" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release with Debug" +# PROP Intermediate_Dir "Release with Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G5 /MT /W3 /GX /Zi /O2 /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /D "NDEBUG" /D "CALLBACKTIMER" /D "JA2" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /O2b2 /c +# ADD CPP /nologo /G5 /MT /W4 /GX /Zi /O2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "NDEBUG" /D "RELEASE_WITH_DEBUG_INFO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"JA2 All.h" /FD /O2b2 /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"\ja2\ja2.exe" +# ADD LINK32 libexpatMT.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"..\ja2_cvs.exe" +# SUBTRACT LINK32 /nodefaultlib + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ja2___W1" +# PROP BASE Intermediate_Dir "ja2___W1" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Bounds Checker" +# PROP Intermediate_Dir "Bounds Checker" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "JA2" /D "WIN32" /D "_WINDOWS" /D "CALLBACKTIMER" /FR /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /FR /YX"JA2 All.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"\ja2\ja2.exe" +# ADD LINK32 vtuneapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"\ja2\ja2.exe" + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ja2___W0" +# PROP BASE Intermediate_Dir "ja2___W0" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug Demo" +# PROP Intermediate_Dir "Debug Demo" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "JA2" /D "WIN32" /D "_WINDOWS" /D "CALLBACKTIMER" /FR /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"JA2 All.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"\ja2\ja2.exe" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"d:\ja2demo\ja2.exe" + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ja2___W2" +# PROP BASE Intermediate_Dir "ja2___W2" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release Demo" +# PROP Intermediate_Dir "Release Demo" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G5 /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /D "NDEBUG" /D "CALLBACKTIMER" /D "JA2" /D "WIN32" /D "_WINDOWS" /D "RELEASE_WITH_DEBUG_INFO" /FR /YX /FD /O2b2 /c +# ADD CPP /nologo /G5 /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"JA2 All.h" /FD /O2b2 /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"\ja2\ja2.exe" +# SUBTRACT BASE LINK32 /nodefaultlib +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"d:\ja2demo\ja2.exe" +# SUBTRACT LINK32 /nodefaultlib + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ja2___W3" +# PROP BASE Intermediate_Dir "ja2___W3" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Demo Release with Debug" +# PROP Intermediate_Dir "Demo Release with Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /G5 /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /D "NDEBUG" /D "CALLBACKTIMER" /D "JA2" /D "WIN32" /D "_WINDOWS" /D "RELEASE_WITH_DEBUG_INFO" /FR /YX /FD /O2b2 /c +# ADD CPP /nologo /G5 /MT /W4 /GX /Zi /O2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"JA2 All.h" /FD /O2b2 /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"\ja2\ja2.exe" +# SUBTRACT BASE LINK32 /nodefaultlib +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"d:\ja2demo\ja2.exe" +# SUBTRACT LINK32 /nodefaultlib + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "ja2___W4" +# PROP BASE Intermediate_Dir "ja2___W4" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Demo Bounds Checker" +# PROP Intermediate_Dir "Demo Bounds Checker" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "CALLBACKTIMER" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "BOUNDS_CHECKER" /FR /YX /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"JA2 All.h" /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"\ja2\ja2.exe" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map /debug /machine:I386 /out:"..\..\ja2.exe" + +!ENDIF + +# Begin Target + +# Name "ja2 - Win32 Release" +# Name "ja2 - Win32 Debug" +# Name "ja2 - Win32 Release with Debug Info" +# Name "ja2 - Win32 Bounds Checker" +# Name "ja2 - Win32 Debug Demo" +# Name "ja2 - Win32 Release Demo" +# Name "ja2 - Win32 Demo Release with Debug Info" +# Name "ja2 - Win32 Demo Bounds Checker" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90" +# Begin Source File + +SOURCE=.\Utils\_Ja25GermanText.cpp +# End Source File +# Begin Source File + +SOURCE=.\aniviewscreen.cpp +# End Source File +# Begin Source File + +SOURCE=.\Credits.cpp +# End Source File +# Begin Source File + +SOURCE=.\Utils\Cursors.cpp +# End Source File +# Begin Source File + +SOURCE=".\Fade Screen.cpp" +# End Source File +# Begin Source File + +SOURCE=.\GameInitOptionsScreen.cpp +# End Source File +# Begin Source File + +SOURCE=.\gameloop.cpp +# End Source File +# Begin Source File + +SOURCE=.\gamescreen.cpp +# End Source File +# Begin Source File + +SOURCE=.\GameSettings.cpp +# End Source File +# Begin Source File + +SOURCE=.\GameVersion.cpp +# End Source File +# Begin Source File + +SOURCE=.\HelpScreen.cpp +# End Source File +# Begin Source File + +SOURCE=.\Init.cpp +# End Source File +# Begin Source File + +SOURCE=.\Intro.cpp +# End Source File +# Begin Source File + +SOURCE=".\JA2 Splash.cpp" +# End Source File +# Begin Source File + +SOURCE=.\Res\ja2.rc +# ADD BASE RSC /l 0x409 /i "Res" +# ADD RSC /l 0x409 /i "Res" /i ".\Res" +# End Source File +# Begin Source File + +SOURCE=.\jascreens.cpp +# End Source File +# Begin Source File + +SOURCE=".\Loading Screen.cpp" +# End Source File +# Begin Source File + +SOURCE=.\MainMenuScreen.cpp +# End Source File +# Begin Source File + +SOURCE=.\MessageBoxScreen.cpp +# End Source File +# Begin Source File + +SOURCE=".\Options Screen.cpp" +# End Source File +# Begin Source File + +SOURCE=.\SaveLoadGame.cpp +# End Source File +# Begin Source File + +SOURCE=.\SaveLoadScreen.cpp +# End Source File +# Begin Source File + +SOURCE=.\SCREENS.cpp +# End Source File +# Begin Source File + +SOURCE=".\Sys Globals.cpp" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" +# Begin Source File + +SOURCE=.\builddefines.h +# End Source File +# Begin Source File + +SOURCE=.\Credits.h +# End Source File +# Begin Source File + +SOURCE=.\GameInitOptionsScreen.h +# End Source File +# Begin Source File + +SOURCE=.\gameloop.h +# End Source File +# Begin Source File + +SOURCE=.\GameSettings.h +# End Source File +# Begin Source File + +SOURCE=".\JA2 All.h" +# End Source File +# Begin Source File + +SOURCE=".\JA2 Demo Ads.h" +# End Source File +# Begin Source File + +SOURCE=.\jascreens.h +# End Source File +# Begin Source File + +SOURCE=".\Language Defines.h" +# End Source File +# Begin Source File + +SOURCE=".\Loading Screen.h" +# End Source File +# Begin Source File + +SOURCE=.\local.h +# End Source File +# Begin Source File + +SOURCE=.\MessageBoxScreen.h +# End Source File +# Begin Source File + +SOURCE=".\Options Screen.h" +# End Source File +# Begin Source File + +SOURCE=.\SaveLoadGame.h +# End Source File +# Begin Source File + +SOURCE=.\SaveLoadScreen.h +# End Source File +# Begin Source File + +SOURCE=.\screenids.h +# End Source File +# Begin Source File + +SOURCE=.\SCREENS.H +# End Source File +# Begin Source File + +SOURCE=.\Strategic\strategicmap.h +# End Source File +# Begin Source File + +SOURCE=".\Sys Globals.h" +# End Source File +# Begin Source File + +SOURCE=.\VtuneApi.h +# End Source File +# End Group +# Begin Source File + +SOURCE=.\Res\jagged3.ico +# End Source File +# End Target +# End Project diff --git a/JA2.dsw b/JA2.dsw new file mode 100644 index 00000000..a969a1f9 --- /dev/null +++ b/JA2.dsw @@ -0,0 +1,185 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "Editor"=.\Editor\Editor.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + "$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA + ..\..\ja2\build + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Laptop"=.\Laptop\Laptop.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + "$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA + ..\..\ja2\build + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Standard Gaming Platform"=".\Standard Gaming Platform\Standard Gaming Platform.dsp" - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + "$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA + ..\..\ja2\build + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Strategic"=.\Strategic\Strategic.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + "$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA + ..\..\ja2\build + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Tactical"=.\Tactical\Tactical.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + "$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA + ..\..\ja2\build + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "TacticalAI"=.\TacticalAI\TacticalAI.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + "$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA + ..\..\ja2\build + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "TileEngine"=.\TileEngine\TileEngine.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + "$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA + ..\..\ja2\build + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Utils"=.\Utils\Utils.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + "$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA + ..\..\ja2\build + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "ja2"=.\JA2.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + "$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA + ..\..\ja2\build + end source code control +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name TileEngine + End Project Dependency + Begin Project Dependency + Project_Dep_Name Standard Gaming Platform + End Project Dependency + Begin Project Dependency + Project_Dep_Name Tactical + End Project Dependency + Begin Project Dependency + Project_Dep_Name Utils + End Project Dependency + Begin Project Dependency + Project_Dep_Name TacticalAI + End Project Dependency + Begin Project Dependency + Project_Dep_Name Editor + End Project Dependency + Begin Project Dependency + Project_Dep_Name Laptop + End Project Dependency + Begin Project Dependency + Project_Dep_Name Strategic + End Project Dependency +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/JA2.mak b/JA2.mak new file mode 100644 index 00000000..32a51693 --- /dev/null +++ b/JA2.mak @@ -0,0 +1,2273 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on JA2.dsp +!IF "$(CFG)" == "" +CFG=ja2 - Win32 Demo Bounds Checker +!MESSAGE No configuration specified. Defaulting to ja2 - Win32 Demo Bounds Checker. +!ENDIF + +!IF "$(CFG)" != "ja2 - Win32 Release" && "$(CFG)" != "ja2 - Win32 Debug" && "$(CFG)" != "ja2 - Win32 Release with Debug Info" && "$(CFG)" != "ja2 - Win32 Bounds Checker" && "$(CFG)" != "ja2 - Win32 Debug Demo" && "$(CFG)" != "ja2 - Win32 Release Demo" && "$(CFG)" != "ja2 - Win32 Demo Release with Debug Info" && "$(CFG)" != "ja2 - Win32 Demo Bounds Checker" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "JA2.mak" CFG="ja2 - Win32 Demo Bounds Checker" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ja2 - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Release with Debug Info" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Bounds Checker" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Debug Demo" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Release Demo" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Demo Release with Debug Info" (based on "Win32 (x86) Application") +!MESSAGE "ja2 - Win32 Demo Bounds Checker" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ja2 - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" + +!ELSE + +ALL : "Strategic - Win32 Release" "Laptop - Win32 Release" "Editor - Win32 Release" "TacticalAI - Win32 Release" "Utils - Win32 Release" "Tactical - Win32 Release" "Standard Gaming Platform - Win32 Release" "TileEngine - Win32 Release" "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"TileEngine - Win32 ReleaseCLEAN" "Standard Gaming Platform - Win32 ReleaseCLEAN" "Tactical - Win32 ReleaseCLEAN" "Utils - Win32 ReleaseCLEAN" "TacticalAI - Win32 ReleaseCLEAN" "Editor - Win32 ReleaseCLEAN" "Laptop - Win32 ReleaseCLEAN" "Strategic - Win32 ReleaseCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\_Ja25GermanText.obj" + -@erase "$(INTDIR)\_Ja25GermanText.sbr" + -@erase "$(INTDIR)\aniviewscreen.obj" + -@erase "$(INTDIR)\aniviewscreen.sbr" + -@erase "$(INTDIR)\Credits.obj" + -@erase "$(INTDIR)\Credits.sbr" + -@erase "$(INTDIR)\Cursors.obj" + -@erase "$(INTDIR)\Cursors.sbr" + -@erase "$(INTDIR)\Fade Screen.obj" + -@erase "$(INTDIR)\Fade Screen.sbr" + -@erase "$(INTDIR)\GameInitOptionsScreen.obj" + -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" + -@erase "$(INTDIR)\gameloop.obj" + -@erase "$(INTDIR)\gameloop.sbr" + -@erase "$(INTDIR)\gamescreen.obj" + -@erase "$(INTDIR)\gamescreen.sbr" + -@erase "$(INTDIR)\GameSettings.obj" + -@erase "$(INTDIR)\GameSettings.sbr" + -@erase "$(INTDIR)\GameVersion.obj" + -@erase "$(INTDIR)\GameVersion.sbr" + -@erase "$(INTDIR)\HelpScreen.obj" + -@erase "$(INTDIR)\HelpScreen.sbr" + -@erase "$(INTDIR)\Init.obj" + -@erase "$(INTDIR)\Init.sbr" + -@erase "$(INTDIR)\Intro.obj" + -@erase "$(INTDIR)\Intro.sbr" + -@erase "$(INTDIR)\JA2 Splash.obj" + -@erase "$(INTDIR)\JA2 Splash.sbr" + -@erase "$(INTDIR)\ja2.res" + -@erase "$(INTDIR)\jascreens.obj" + -@erase "$(INTDIR)\jascreens.sbr" + -@erase "$(INTDIR)\Loading Screen.obj" + -@erase "$(INTDIR)\Loading Screen.sbr" + -@erase "$(INTDIR)\MainMenuScreen.obj" + -@erase "$(INTDIR)\MainMenuScreen.sbr" + -@erase "$(INTDIR)\MessageBoxScreen.obj" + -@erase "$(INTDIR)\MessageBoxScreen.sbr" + -@erase "$(INTDIR)\Options Screen.obj" + -@erase "$(INTDIR)\Options Screen.sbr" + -@erase "$(INTDIR)\SaveLoadGame.obj" + -@erase "$(INTDIR)\SaveLoadGame.sbr" + -@erase "$(INTDIR)\SaveLoadScreen.obj" + -@erase "$(INTDIR)\SaveLoadScreen.sbr" + -@erase "$(INTDIR)\SCREENS.obj" + -@erase "$(INTDIR)\SCREENS.sbr" + -@erase "$(INTDIR)\Sys Globals.obj" + -@erase "$(INTDIR)\Sys Globals.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\JA2.bsc" + -@erase "$(OUTDIR)\ja2_cvs.map" + -@erase "..\ja2_cvs.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /G5 /MT /W3 /GX /Zi /O2 /Ob2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /O2b2 /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" +BSC32_SBRS= \ + "$(INTDIR)\_Ja25GermanText.sbr" \ + "$(INTDIR)\aniviewscreen.sbr" \ + "$(INTDIR)\Credits.sbr" \ + "$(INTDIR)\Cursors.sbr" \ + "$(INTDIR)\Fade Screen.sbr" \ + "$(INTDIR)\GameInitOptionsScreen.sbr" \ + "$(INTDIR)\gameloop.sbr" \ + "$(INTDIR)\gamescreen.sbr" \ + "$(INTDIR)\GameSettings.sbr" \ + "$(INTDIR)\GameVersion.sbr" \ + "$(INTDIR)\HelpScreen.sbr" \ + "$(INTDIR)\Init.sbr" \ + "$(INTDIR)\Intro.sbr" \ + "$(INTDIR)\JA2 Splash.sbr" \ + "$(INTDIR)\jascreens.sbr" \ + "$(INTDIR)\Loading Screen.sbr" \ + "$(INTDIR)\MainMenuScreen.sbr" \ + "$(INTDIR)\MessageBoxScreen.sbr" \ + "$(INTDIR)\Options Screen.sbr" \ + "$(INTDIR)\SaveLoadGame.sbr" \ + "$(INTDIR)\SaveLoadScreen.sbr" \ + "$(INTDIR)\SCREENS.sbr" \ + "$(INTDIR)\Sys Globals.sbr" + +"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=libexpatMT.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2_cvs.map" /machine:I386 /out:"..\ja2_cvs.exe" +LINK32_OBJS= \ + "$(INTDIR)\_Ja25GermanText.obj" \ + "$(INTDIR)\aniviewscreen.obj" \ + "$(INTDIR)\Credits.obj" \ + "$(INTDIR)\Cursors.obj" \ + "$(INTDIR)\Fade Screen.obj" \ + "$(INTDIR)\GameInitOptionsScreen.obj" \ + "$(INTDIR)\gameloop.obj" \ + "$(INTDIR)\gamescreen.obj" \ + "$(INTDIR)\GameSettings.obj" \ + "$(INTDIR)\GameVersion.obj" \ + "$(INTDIR)\HelpScreen.obj" \ + "$(INTDIR)\Init.obj" \ + "$(INTDIR)\Intro.obj" \ + "$(INTDIR)\JA2 Splash.obj" \ + "$(INTDIR)\jascreens.obj" \ + "$(INTDIR)\Loading Screen.obj" \ + "$(INTDIR)\MainMenuScreen.obj" \ + "$(INTDIR)\MessageBoxScreen.obj" \ + "$(INTDIR)\Options Screen.obj" \ + "$(INTDIR)\SaveLoadGame.obj" \ + "$(INTDIR)\SaveLoadScreen.obj" \ + "$(INTDIR)\SCREENS.obj" \ + "$(INTDIR)\Sys Globals.obj" \ + "$(INTDIR)\ja2.res" \ + ".\TileEngine\Release\TileEngine.lib" \ + ".\Standard Gaming Platform\Release\Standard Gaming Platform.lib" \ + ".\Tactical\Release\Tactical.lib" \ + ".\Utils\Release\Utils.lib" \ + ".\TacticalAI\Release\TacticalAI.lib" \ + ".\Editor\Release\Editor.lib" \ + ".\Laptop\Release\Laptop.lib" \ + ".\Strategic\Release\Strategic.lib" + +"..\ja2_cvs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" + +!ELSE + +ALL : "Strategic - Win32 Debug" "Laptop - Win32 Debug" "Editor - Win32 Debug" "TacticalAI - Win32 Debug" "Utils - Win32 Debug" "Tactical - Win32 Debug" "Standard Gaming Platform - Win32 Debug" "TileEngine - Win32 Debug" "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"TileEngine - Win32 DebugCLEAN" "Standard Gaming Platform - Win32 DebugCLEAN" "Tactical - Win32 DebugCLEAN" "Utils - Win32 DebugCLEAN" "TacticalAI - Win32 DebugCLEAN" "Editor - Win32 DebugCLEAN" "Laptop - Win32 DebugCLEAN" "Strategic - Win32 DebugCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\_Ja25GermanText.obj" + -@erase "$(INTDIR)\_Ja25GermanText.sbr" + -@erase "$(INTDIR)\aniviewscreen.obj" + -@erase "$(INTDIR)\aniviewscreen.sbr" + -@erase "$(INTDIR)\Credits.obj" + -@erase "$(INTDIR)\Credits.sbr" + -@erase "$(INTDIR)\Cursors.obj" + -@erase "$(INTDIR)\Cursors.sbr" + -@erase "$(INTDIR)\Fade Screen.obj" + -@erase "$(INTDIR)\Fade Screen.sbr" + -@erase "$(INTDIR)\GameInitOptionsScreen.obj" + -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" + -@erase "$(INTDIR)\gameloop.obj" + -@erase "$(INTDIR)\gameloop.sbr" + -@erase "$(INTDIR)\gamescreen.obj" + -@erase "$(INTDIR)\gamescreen.sbr" + -@erase "$(INTDIR)\GameSettings.obj" + -@erase "$(INTDIR)\GameSettings.sbr" + -@erase "$(INTDIR)\GameVersion.obj" + -@erase "$(INTDIR)\GameVersion.sbr" + -@erase "$(INTDIR)\HelpScreen.obj" + -@erase "$(INTDIR)\HelpScreen.sbr" + -@erase "$(INTDIR)\Init.obj" + -@erase "$(INTDIR)\Init.sbr" + -@erase "$(INTDIR)\Intro.obj" + -@erase "$(INTDIR)\Intro.sbr" + -@erase "$(INTDIR)\JA2 Splash.obj" + -@erase "$(INTDIR)\JA2 Splash.sbr" + -@erase "$(INTDIR)\ja2.res" + -@erase "$(INTDIR)\jascreens.obj" + -@erase "$(INTDIR)\jascreens.sbr" + -@erase "$(INTDIR)\Loading Screen.obj" + -@erase "$(INTDIR)\Loading Screen.sbr" + -@erase "$(INTDIR)\MainMenuScreen.obj" + -@erase "$(INTDIR)\MainMenuScreen.sbr" + -@erase "$(INTDIR)\MessageBoxScreen.obj" + -@erase "$(INTDIR)\MessageBoxScreen.sbr" + -@erase "$(INTDIR)\Options Screen.obj" + -@erase "$(INTDIR)\Options Screen.sbr" + -@erase "$(INTDIR)\SaveLoadGame.obj" + -@erase "$(INTDIR)\SaveLoadGame.sbr" + -@erase "$(INTDIR)\SaveLoadScreen.obj" + -@erase "$(INTDIR)\SaveLoadScreen.sbr" + -@erase "$(INTDIR)\SCREENS.obj" + -@erase "$(INTDIR)\SCREENS.sbr" + -@erase "$(INTDIR)\Sys Globals.obj" + -@erase "$(INTDIR)\Sys Globals.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\JA2.bsc" + -@erase "$(OUTDIR)\ja2_cvs.map" + -@erase "..\ja2_cvs.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /I "..\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" +BSC32_SBRS= \ + "$(INTDIR)\_Ja25GermanText.sbr" \ + "$(INTDIR)\aniviewscreen.sbr" \ + "$(INTDIR)\Credits.sbr" \ + "$(INTDIR)\Cursors.sbr" \ + "$(INTDIR)\Fade Screen.sbr" \ + "$(INTDIR)\GameInitOptionsScreen.sbr" \ + "$(INTDIR)\gameloop.sbr" \ + "$(INTDIR)\gamescreen.sbr" \ + "$(INTDIR)\GameSettings.sbr" \ + "$(INTDIR)\GameVersion.sbr" \ + "$(INTDIR)\HelpScreen.sbr" \ + "$(INTDIR)\Init.sbr" \ + "$(INTDIR)\Intro.sbr" \ + "$(INTDIR)\JA2 Splash.sbr" \ + "$(INTDIR)\jascreens.sbr" \ + "$(INTDIR)\Loading Screen.sbr" \ + "$(INTDIR)\MainMenuScreen.sbr" \ + "$(INTDIR)\MessageBoxScreen.sbr" \ + "$(INTDIR)\Options Screen.sbr" \ + "$(INTDIR)\SaveLoadGame.sbr" \ + "$(INTDIR)\SaveLoadScreen.sbr" \ + "$(INTDIR)\SCREENS.sbr" \ + "$(INTDIR)\Sys Globals.sbr" + +"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=libexpatMT.lib mss32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2_cvs.map" /debug /machine:I386 /nodefaultlib:"libcmt" /out:"..\ja2_cvs.exe" /libpath:".\..\..\Standard Gaming Platform\\" +LINK32_OBJS= \ + "$(INTDIR)\_Ja25GermanText.obj" \ + "$(INTDIR)\aniviewscreen.obj" \ + "$(INTDIR)\Credits.obj" \ + "$(INTDIR)\Cursors.obj" \ + "$(INTDIR)\Fade Screen.obj" \ + "$(INTDIR)\GameInitOptionsScreen.obj" \ + "$(INTDIR)\gameloop.obj" \ + "$(INTDIR)\gamescreen.obj" \ + "$(INTDIR)\GameSettings.obj" \ + "$(INTDIR)\GameVersion.obj" \ + "$(INTDIR)\HelpScreen.obj" \ + "$(INTDIR)\Init.obj" \ + "$(INTDIR)\Intro.obj" \ + "$(INTDIR)\JA2 Splash.obj" \ + "$(INTDIR)\jascreens.obj" \ + "$(INTDIR)\Loading Screen.obj" \ + "$(INTDIR)\MainMenuScreen.obj" \ + "$(INTDIR)\MessageBoxScreen.obj" \ + "$(INTDIR)\Options Screen.obj" \ + "$(INTDIR)\SaveLoadGame.obj" \ + "$(INTDIR)\SaveLoadScreen.obj" \ + "$(INTDIR)\SCREENS.obj" \ + "$(INTDIR)\Sys Globals.obj" \ + "$(INTDIR)\ja2.res" \ + ".\TileEngine\Debug\TileEngine.lib" \ + ".\Standard Gaming Platform\Debug\Standard Gaming Platform.lib" \ + ".\Tactical\Debug\Tactical.lib" \ + ".\Utils\Debug\Utils.lib" \ + ".\TacticalAI\Debug\TacticalAI.lib" \ + ".\Editor\Debug\Editor.lib" \ + ".\Laptop\Debug\Laptop.lib" \ + ".\Strategic\Debug\Strategic.lib" + +"..\ja2_cvs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + +OUTDIR=.\Release with Debug +INTDIR=.\Release with Debug +# Begin Custom Macros +OutDir=.\Release with Debug +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" + +!ELSE + +ALL : "Strategic - Win32 Release with Debug Info" "Laptop - Win32 Release with Debug Info" "Editor - Win32 Release with Debug Info" "TacticalAI - Win32 Release with Debug Info" "Utils - Win32 Release with Debug Info" "Tactical - Win32 Release with Debug Info" "Standard Gaming Platform - Win32 Release with Debug Info" "TileEngine - Win32 Release with Debug Info" "..\ja2_cvs.exe" "$(OUTDIR)\JA2.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"TileEngine - Win32 Release with Debug InfoCLEAN" "Standard Gaming Platform - Win32 Release with Debug InfoCLEAN" "Tactical - Win32 Release with Debug InfoCLEAN" "Utils - Win32 Release with Debug InfoCLEAN" "TacticalAI - Win32 Release with Debug InfoCLEAN" "Editor - Win32 Release with Debug InfoCLEAN" "Laptop - Win32 Release with Debug InfoCLEAN" "Strategic - Win32 Release with Debug InfoCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\_Ja25GermanText.obj" + -@erase "$(INTDIR)\_Ja25GermanText.sbr" + -@erase "$(INTDIR)\aniviewscreen.obj" + -@erase "$(INTDIR)\aniviewscreen.sbr" + -@erase "$(INTDIR)\Credits.obj" + -@erase "$(INTDIR)\Credits.sbr" + -@erase "$(INTDIR)\Cursors.obj" + -@erase "$(INTDIR)\Cursors.sbr" + -@erase "$(INTDIR)\Fade Screen.obj" + -@erase "$(INTDIR)\Fade Screen.sbr" + -@erase "$(INTDIR)\GameInitOptionsScreen.obj" + -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" + -@erase "$(INTDIR)\gameloop.obj" + -@erase "$(INTDIR)\gameloop.sbr" + -@erase "$(INTDIR)\gamescreen.obj" + -@erase "$(INTDIR)\gamescreen.sbr" + -@erase "$(INTDIR)\GameSettings.obj" + -@erase "$(INTDIR)\GameSettings.sbr" + -@erase "$(INTDIR)\GameVersion.obj" + -@erase "$(INTDIR)\GameVersion.sbr" + -@erase "$(INTDIR)\HelpScreen.obj" + -@erase "$(INTDIR)\HelpScreen.sbr" + -@erase "$(INTDIR)\Init.obj" + -@erase "$(INTDIR)\Init.sbr" + -@erase "$(INTDIR)\Intro.obj" + -@erase "$(INTDIR)\Intro.sbr" + -@erase "$(INTDIR)\JA2 Splash.obj" + -@erase "$(INTDIR)\JA2 Splash.sbr" + -@erase "$(INTDIR)\ja2.res" + -@erase "$(INTDIR)\jascreens.obj" + -@erase "$(INTDIR)\jascreens.sbr" + -@erase "$(INTDIR)\Loading Screen.obj" + -@erase "$(INTDIR)\Loading Screen.sbr" + -@erase "$(INTDIR)\MainMenuScreen.obj" + -@erase "$(INTDIR)\MainMenuScreen.sbr" + -@erase "$(INTDIR)\MessageBoxScreen.obj" + -@erase "$(INTDIR)\MessageBoxScreen.sbr" + -@erase "$(INTDIR)\Options Screen.obj" + -@erase "$(INTDIR)\Options Screen.sbr" + -@erase "$(INTDIR)\SaveLoadGame.obj" + -@erase "$(INTDIR)\SaveLoadGame.sbr" + -@erase "$(INTDIR)\SaveLoadScreen.obj" + -@erase "$(INTDIR)\SaveLoadScreen.sbr" + -@erase "$(INTDIR)\SCREENS.obj" + -@erase "$(INTDIR)\SCREENS.sbr" + -@erase "$(INTDIR)\Sys Globals.obj" + -@erase "$(INTDIR)\Sys Globals.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\JA2.bsc" + -@erase "$(OUTDIR)\ja2_cvs.map" + -@erase "..\ja2_cvs.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /G5 /MT /W4 /GX /Zi /O2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "NDEBUG" /D "RELEASE_WITH_DEBUG_INFO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /O2b2 /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" +BSC32_SBRS= \ + "$(INTDIR)\_Ja25GermanText.sbr" \ + "$(INTDIR)\aniviewscreen.sbr" \ + "$(INTDIR)\Credits.sbr" \ + "$(INTDIR)\Cursors.sbr" \ + "$(INTDIR)\Fade Screen.sbr" \ + "$(INTDIR)\GameInitOptionsScreen.sbr" \ + "$(INTDIR)\gameloop.sbr" \ + "$(INTDIR)\gamescreen.sbr" \ + "$(INTDIR)\GameSettings.sbr" \ + "$(INTDIR)\GameVersion.sbr" \ + "$(INTDIR)\HelpScreen.sbr" \ + "$(INTDIR)\Init.sbr" \ + "$(INTDIR)\Intro.sbr" \ + "$(INTDIR)\JA2 Splash.sbr" \ + "$(INTDIR)\jascreens.sbr" \ + "$(INTDIR)\Loading Screen.sbr" \ + "$(INTDIR)\MainMenuScreen.sbr" \ + "$(INTDIR)\MessageBoxScreen.sbr" \ + "$(INTDIR)\Options Screen.sbr" \ + "$(INTDIR)\SaveLoadGame.sbr" \ + "$(INTDIR)\SaveLoadScreen.sbr" \ + "$(INTDIR)\SCREENS.sbr" \ + "$(INTDIR)\Sys Globals.sbr" + +"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=libexpatMT.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2_cvs.map" /debug /machine:I386 /out:"..\ja2_cvs.exe" +LINK32_OBJS= \ + "$(INTDIR)\_Ja25GermanText.obj" \ + "$(INTDIR)\aniviewscreen.obj" \ + "$(INTDIR)\Credits.obj" \ + "$(INTDIR)\Cursors.obj" \ + "$(INTDIR)\Fade Screen.obj" \ + "$(INTDIR)\GameInitOptionsScreen.obj" \ + "$(INTDIR)\gameloop.obj" \ + "$(INTDIR)\gamescreen.obj" \ + "$(INTDIR)\GameSettings.obj" \ + "$(INTDIR)\GameVersion.obj" \ + "$(INTDIR)\HelpScreen.obj" \ + "$(INTDIR)\Init.obj" \ + "$(INTDIR)\Intro.obj" \ + "$(INTDIR)\JA2 Splash.obj" \ + "$(INTDIR)\jascreens.obj" \ + "$(INTDIR)\Loading Screen.obj" \ + "$(INTDIR)\MainMenuScreen.obj" \ + "$(INTDIR)\MessageBoxScreen.obj" \ + "$(INTDIR)\Options Screen.obj" \ + "$(INTDIR)\SaveLoadGame.obj" \ + "$(INTDIR)\SaveLoadScreen.obj" \ + "$(INTDIR)\SCREENS.obj" \ + "$(INTDIR)\Sys Globals.obj" \ + "$(INTDIR)\ja2.res" \ + ".\TileEngine\Release with Debug\TileEngine.lib" \ + ".\Standard Gaming Platform\Release with Debug Info\Standard Gaming Platform.lib" \ + ".\Tactical\Release with Debug\Tactical.lib" \ + ".\Utils\Release with Debug\Utils.lib" \ + ".\TacticalAI\Release with Debug\TacticalAI.lib" \ + ".\Editor\Release with Debug\Editor.lib" \ + ".\Laptop\Release with Debug\Laptop.lib" \ + ".\Strategic\Release with Debug\Strategic.lib" + +"..\ja2_cvs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + +OUTDIR=.\Bounds Checker +INTDIR=.\Bounds Checker +# Begin Custom Macros +OutDir=.\Bounds Checker +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "..\ja2.exe" "$(OUTDIR)\JA2.bsc" + +!ELSE + +ALL : "Strategic - Win32 Bounds Checker" "Laptop - Win32 Bounds Checker" "Editor - Win32 Bounds Checker" "TacticalAI - Win32 Bounds Checker" "Utils - Win32 Bounds Checker" "Tactical - Win32 Bounds Checker" "Standard Gaming Platform - Win32 Bounds Checker" "TileEngine - Win32 Bounds Checker" "..\ja2.exe" "$(OUTDIR)\JA2.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"TileEngine - Win32 Bounds CheckerCLEAN" "Standard Gaming Platform - Win32 Bounds CheckerCLEAN" "Tactical - Win32 Bounds CheckerCLEAN" "Utils - Win32 Bounds CheckerCLEAN" "TacticalAI - Win32 Bounds CheckerCLEAN" "Editor - Win32 Bounds CheckerCLEAN" "Laptop - Win32 Bounds CheckerCLEAN" "Strategic - Win32 Bounds CheckerCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\_Ja25GermanText.obj" + -@erase "$(INTDIR)\_Ja25GermanText.sbr" + -@erase "$(INTDIR)\aniviewscreen.obj" + -@erase "$(INTDIR)\aniviewscreen.sbr" + -@erase "$(INTDIR)\Credits.obj" + -@erase "$(INTDIR)\Credits.sbr" + -@erase "$(INTDIR)\Cursors.obj" + -@erase "$(INTDIR)\Cursors.sbr" + -@erase "$(INTDIR)\Fade Screen.obj" + -@erase "$(INTDIR)\Fade Screen.sbr" + -@erase "$(INTDIR)\GameInitOptionsScreen.obj" + -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" + -@erase "$(INTDIR)\gameloop.obj" + -@erase "$(INTDIR)\gameloop.sbr" + -@erase "$(INTDIR)\gamescreen.obj" + -@erase "$(INTDIR)\gamescreen.sbr" + -@erase "$(INTDIR)\GameSettings.obj" + -@erase "$(INTDIR)\GameSettings.sbr" + -@erase "$(INTDIR)\GameVersion.obj" + -@erase "$(INTDIR)\GameVersion.sbr" + -@erase "$(INTDIR)\HelpScreen.obj" + -@erase "$(INTDIR)\HelpScreen.sbr" + -@erase "$(INTDIR)\Init.obj" + -@erase "$(INTDIR)\Init.sbr" + -@erase "$(INTDIR)\Intro.obj" + -@erase "$(INTDIR)\Intro.sbr" + -@erase "$(INTDIR)\JA2 Splash.obj" + -@erase "$(INTDIR)\JA2 Splash.sbr" + -@erase "$(INTDIR)\ja2.res" + -@erase "$(INTDIR)\jascreens.obj" + -@erase "$(INTDIR)\jascreens.sbr" + -@erase "$(INTDIR)\Loading Screen.obj" + -@erase "$(INTDIR)\Loading Screen.sbr" + -@erase "$(INTDIR)\MainMenuScreen.obj" + -@erase "$(INTDIR)\MainMenuScreen.sbr" + -@erase "$(INTDIR)\MessageBoxScreen.obj" + -@erase "$(INTDIR)\MessageBoxScreen.sbr" + -@erase "$(INTDIR)\Options Screen.obj" + -@erase "$(INTDIR)\Options Screen.sbr" + -@erase "$(INTDIR)\SaveLoadGame.obj" + -@erase "$(INTDIR)\SaveLoadGame.sbr" + -@erase "$(INTDIR)\SaveLoadScreen.obj" + -@erase "$(INTDIR)\SaveLoadScreen.sbr" + -@erase "$(INTDIR)\SCREENS.obj" + -@erase "$(INTDIR)\SCREENS.sbr" + -@erase "$(INTDIR)\Sys Globals.obj" + -@erase "$(INTDIR)\Sys Globals.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\JA2.bsc" + -@erase "$(OUTDIR)\ja2.map" + -@erase "..\ja2.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" +BSC32_SBRS= \ + "$(INTDIR)\_Ja25GermanText.sbr" \ + "$(INTDIR)\aniviewscreen.sbr" \ + "$(INTDIR)\Credits.sbr" \ + "$(INTDIR)\Cursors.sbr" \ + "$(INTDIR)\Fade Screen.sbr" \ + "$(INTDIR)\GameInitOptionsScreen.sbr" \ + "$(INTDIR)\gameloop.sbr" \ + "$(INTDIR)\gamescreen.sbr" \ + "$(INTDIR)\GameSettings.sbr" \ + "$(INTDIR)\GameVersion.sbr" \ + "$(INTDIR)\HelpScreen.sbr" \ + "$(INTDIR)\Init.sbr" \ + "$(INTDIR)\Intro.sbr" \ + "$(INTDIR)\JA2 Splash.sbr" \ + "$(INTDIR)\jascreens.sbr" \ + "$(INTDIR)\Loading Screen.sbr" \ + "$(INTDIR)\MainMenuScreen.sbr" \ + "$(INTDIR)\MessageBoxScreen.sbr" \ + "$(INTDIR)\Options Screen.sbr" \ + "$(INTDIR)\SaveLoadGame.sbr" \ + "$(INTDIR)\SaveLoadScreen.sbr" \ + "$(INTDIR)\SCREENS.sbr" \ + "$(INTDIR)\Sys Globals.sbr" + +"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=vtuneapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2.map" /debug /machine:I386 /out:"\ja2\ja2.exe" +LINK32_OBJS= \ + "$(INTDIR)\_Ja25GermanText.obj" \ + "$(INTDIR)\aniviewscreen.obj" \ + "$(INTDIR)\Credits.obj" \ + "$(INTDIR)\Cursors.obj" \ + "$(INTDIR)\Fade Screen.obj" \ + "$(INTDIR)\GameInitOptionsScreen.obj" \ + "$(INTDIR)\gameloop.obj" \ + "$(INTDIR)\gamescreen.obj" \ + "$(INTDIR)\GameSettings.obj" \ + "$(INTDIR)\GameVersion.obj" \ + "$(INTDIR)\HelpScreen.obj" \ + "$(INTDIR)\Init.obj" \ + "$(INTDIR)\Intro.obj" \ + "$(INTDIR)\JA2 Splash.obj" \ + "$(INTDIR)\jascreens.obj" \ + "$(INTDIR)\Loading Screen.obj" \ + "$(INTDIR)\MainMenuScreen.obj" \ + "$(INTDIR)\MessageBoxScreen.obj" \ + "$(INTDIR)\Options Screen.obj" \ + "$(INTDIR)\SaveLoadGame.obj" \ + "$(INTDIR)\SaveLoadScreen.obj" \ + "$(INTDIR)\SCREENS.obj" \ + "$(INTDIR)\Sys Globals.obj" \ + "$(INTDIR)\ja2.res" \ + ".\TileEngine\Bounds Checker\TileEngine.lib" \ + ".\Standard Gaming Platform\Standar0\Standard Gaming Platform.lib" \ + ".\Tactical\Bounds Checker\Tactical.lib" \ + ".\Utils\Bounds Checker\Utils.lib" \ + ".\TacticalAI\Bounds Checker\TacticalAI.lib" \ + ".\Editor\Bounds Checker\Editor.lib" \ + ".\Laptop\Bounds Checker\Laptop.lib" \ + ".\Strategic\Bounds Checker\Strategic.lib" + +"..\ja2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + +OUTDIR=.\Debug Demo +INTDIR=.\Debug Demo +# Begin Custom Macros +OutDir=.\Debug Demo +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" + +!ELSE + +ALL : "Strategic - Win32 Debug Demo" "Laptop - Win32 Debug Demo" "Editor - Win32 Debug Demo" "TacticalAI - Win32 Debug Demo" "Utils - Win32 Debug Demo" "Tactical - Win32 Debug Demo" "Standard Gaming Platform - Win32 Debug Demo" "TileEngine - Win32 Debug Demo" "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"TileEngine - Win32 Debug DemoCLEAN" "Standard Gaming Platform - Win32 Debug DemoCLEAN" "Tactical - Win32 Debug DemoCLEAN" "Utils - Win32 Debug DemoCLEAN" "TacticalAI - Win32 Debug DemoCLEAN" "Editor - Win32 Debug DemoCLEAN" "Laptop - Win32 Debug DemoCLEAN" "Strategic - Win32 Debug DemoCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\_Ja25GermanText.obj" + -@erase "$(INTDIR)\_Ja25GermanText.sbr" + -@erase "$(INTDIR)\aniviewscreen.obj" + -@erase "$(INTDIR)\aniviewscreen.sbr" + -@erase "$(INTDIR)\Credits.obj" + -@erase "$(INTDIR)\Credits.sbr" + -@erase "$(INTDIR)\Cursors.obj" + -@erase "$(INTDIR)\Cursors.sbr" + -@erase "$(INTDIR)\Fade Screen.obj" + -@erase "$(INTDIR)\Fade Screen.sbr" + -@erase "$(INTDIR)\GameInitOptionsScreen.obj" + -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" + -@erase "$(INTDIR)\gameloop.obj" + -@erase "$(INTDIR)\gameloop.sbr" + -@erase "$(INTDIR)\gamescreen.obj" + -@erase "$(INTDIR)\gamescreen.sbr" + -@erase "$(INTDIR)\GameSettings.obj" + -@erase "$(INTDIR)\GameSettings.sbr" + -@erase "$(INTDIR)\GameVersion.obj" + -@erase "$(INTDIR)\GameVersion.sbr" + -@erase "$(INTDIR)\HelpScreen.obj" + -@erase "$(INTDIR)\HelpScreen.sbr" + -@erase "$(INTDIR)\Init.obj" + -@erase "$(INTDIR)\Init.sbr" + -@erase "$(INTDIR)\Intro.obj" + -@erase "$(INTDIR)\Intro.sbr" + -@erase "$(INTDIR)\JA2 Splash.obj" + -@erase "$(INTDIR)\JA2 Splash.sbr" + -@erase "$(INTDIR)\ja2.res" + -@erase "$(INTDIR)\jascreens.obj" + -@erase "$(INTDIR)\jascreens.sbr" + -@erase "$(INTDIR)\Loading Screen.obj" + -@erase "$(INTDIR)\Loading Screen.sbr" + -@erase "$(INTDIR)\MainMenuScreen.obj" + -@erase "$(INTDIR)\MainMenuScreen.sbr" + -@erase "$(INTDIR)\MessageBoxScreen.obj" + -@erase "$(INTDIR)\MessageBoxScreen.sbr" + -@erase "$(INTDIR)\Options Screen.obj" + -@erase "$(INTDIR)\Options Screen.sbr" + -@erase "$(INTDIR)\SaveLoadGame.obj" + -@erase "$(INTDIR)\SaveLoadGame.sbr" + -@erase "$(INTDIR)\SaveLoadScreen.obj" + -@erase "$(INTDIR)\SaveLoadScreen.sbr" + -@erase "$(INTDIR)\SCREENS.obj" + -@erase "$(INTDIR)\SCREENS.sbr" + -@erase "$(INTDIR)\Sys Globals.obj" + -@erase "$(INTDIR)\Sys Globals.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\JA2.bsc" + -@erase "$(OUTDIR)\ja2.map" + -@erase "..\..\ja2demo\ja2.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" +BSC32_SBRS= \ + "$(INTDIR)\_Ja25GermanText.sbr" \ + "$(INTDIR)\aniviewscreen.sbr" \ + "$(INTDIR)\Credits.sbr" \ + "$(INTDIR)\Cursors.sbr" \ + "$(INTDIR)\Fade Screen.sbr" \ + "$(INTDIR)\GameInitOptionsScreen.sbr" \ + "$(INTDIR)\gameloop.sbr" \ + "$(INTDIR)\gamescreen.sbr" \ + "$(INTDIR)\GameSettings.sbr" \ + "$(INTDIR)\GameVersion.sbr" \ + "$(INTDIR)\HelpScreen.sbr" \ + "$(INTDIR)\Init.sbr" \ + "$(INTDIR)\Intro.sbr" \ + "$(INTDIR)\JA2 Splash.sbr" \ + "$(INTDIR)\jascreens.sbr" \ + "$(INTDIR)\Loading Screen.sbr" \ + "$(INTDIR)\MainMenuScreen.sbr" \ + "$(INTDIR)\MessageBoxScreen.sbr" \ + "$(INTDIR)\Options Screen.sbr" \ + "$(INTDIR)\SaveLoadGame.sbr" \ + "$(INTDIR)\SaveLoadScreen.sbr" \ + "$(INTDIR)\SCREENS.sbr" \ + "$(INTDIR)\Sys Globals.sbr" + +"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2.map" /debug /machine:I386 /out:"d:\ja2demo\ja2.exe" +LINK32_OBJS= \ + "$(INTDIR)\_Ja25GermanText.obj" \ + "$(INTDIR)\aniviewscreen.obj" \ + "$(INTDIR)\Credits.obj" \ + "$(INTDIR)\Cursors.obj" \ + "$(INTDIR)\Fade Screen.obj" \ + "$(INTDIR)\GameInitOptionsScreen.obj" \ + "$(INTDIR)\gameloop.obj" \ + "$(INTDIR)\gamescreen.obj" \ + "$(INTDIR)\GameSettings.obj" \ + "$(INTDIR)\GameVersion.obj" \ + "$(INTDIR)\HelpScreen.obj" \ + "$(INTDIR)\Init.obj" \ + "$(INTDIR)\Intro.obj" \ + "$(INTDIR)\JA2 Splash.obj" \ + "$(INTDIR)\jascreens.obj" \ + "$(INTDIR)\Loading Screen.obj" \ + "$(INTDIR)\MainMenuScreen.obj" \ + "$(INTDIR)\MessageBoxScreen.obj" \ + "$(INTDIR)\Options Screen.obj" \ + "$(INTDIR)\SaveLoadGame.obj" \ + "$(INTDIR)\SaveLoadScreen.obj" \ + "$(INTDIR)\SCREENS.obj" \ + "$(INTDIR)\Sys Globals.obj" \ + "$(INTDIR)\ja2.res" \ + ".\TileEngine\Debug Demo\TileEngine.lib" \ + ".\Standard Gaming Platform\Standard\Standard Gaming Platform.lib" \ + ".\Tactical\Debug Demo\Tactical.lib" \ + ".\Utils\Debug Demo\Utils.lib" \ + ".\TacticalAI\Debug Demo\TacticalAI.lib" \ + ".\Editor\Debug Demo\Editor.lib" \ + ".\Laptop\Debug Demo\Laptop.lib" \ + ".\Strategic\Debug Demo\Strategic.lib" + +"..\..\ja2demo\ja2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + +OUTDIR=.\Release Demo +INTDIR=.\Release Demo +# Begin Custom Macros +OutDir=.\Release Demo +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" + +!ELSE + +ALL : "Strategic - Win32 Release Demo" "Laptop - Win32 Release Demo" "Editor - Win32 Release Demo" "TacticalAI - Win32 Release Demo" "Utils - Win32 Release Demo" "Tactical - Win32 Release Demo" "Standard Gaming Platform - Win32 Release Demo" "TileEngine - Win32 Release Demo" "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"TileEngine - Win32 Release DemoCLEAN" "Standard Gaming Platform - Win32 Release DemoCLEAN" "Tactical - Win32 Release DemoCLEAN" "Utils - Win32 Release DemoCLEAN" "TacticalAI - Win32 Release DemoCLEAN" "Editor - Win32 Release DemoCLEAN" "Laptop - Win32 Release DemoCLEAN" "Strategic - Win32 Release DemoCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\_Ja25GermanText.obj" + -@erase "$(INTDIR)\_Ja25GermanText.sbr" + -@erase "$(INTDIR)\aniviewscreen.obj" + -@erase "$(INTDIR)\aniviewscreen.sbr" + -@erase "$(INTDIR)\Credits.obj" + -@erase "$(INTDIR)\Credits.sbr" + -@erase "$(INTDIR)\Cursors.obj" + -@erase "$(INTDIR)\Cursors.sbr" + -@erase "$(INTDIR)\Fade Screen.obj" + -@erase "$(INTDIR)\Fade Screen.sbr" + -@erase "$(INTDIR)\GameInitOptionsScreen.obj" + -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" + -@erase "$(INTDIR)\gameloop.obj" + -@erase "$(INTDIR)\gameloop.sbr" + -@erase "$(INTDIR)\gamescreen.obj" + -@erase "$(INTDIR)\gamescreen.sbr" + -@erase "$(INTDIR)\GameSettings.obj" + -@erase "$(INTDIR)\GameSettings.sbr" + -@erase "$(INTDIR)\GameVersion.obj" + -@erase "$(INTDIR)\GameVersion.sbr" + -@erase "$(INTDIR)\HelpScreen.obj" + -@erase "$(INTDIR)\HelpScreen.sbr" + -@erase "$(INTDIR)\Init.obj" + -@erase "$(INTDIR)\Init.sbr" + -@erase "$(INTDIR)\Intro.obj" + -@erase "$(INTDIR)\Intro.sbr" + -@erase "$(INTDIR)\JA2 Splash.obj" + -@erase "$(INTDIR)\JA2 Splash.sbr" + -@erase "$(INTDIR)\ja2.res" + -@erase "$(INTDIR)\jascreens.obj" + -@erase "$(INTDIR)\jascreens.sbr" + -@erase "$(INTDIR)\Loading Screen.obj" + -@erase "$(INTDIR)\Loading Screen.sbr" + -@erase "$(INTDIR)\MainMenuScreen.obj" + -@erase "$(INTDIR)\MainMenuScreen.sbr" + -@erase "$(INTDIR)\MessageBoxScreen.obj" + -@erase "$(INTDIR)\MessageBoxScreen.sbr" + -@erase "$(INTDIR)\Options Screen.obj" + -@erase "$(INTDIR)\Options Screen.sbr" + -@erase "$(INTDIR)\SaveLoadGame.obj" + -@erase "$(INTDIR)\SaveLoadGame.sbr" + -@erase "$(INTDIR)\SaveLoadScreen.obj" + -@erase "$(INTDIR)\SaveLoadScreen.sbr" + -@erase "$(INTDIR)\SCREENS.obj" + -@erase "$(INTDIR)\SCREENS.sbr" + -@erase "$(INTDIR)\Sys Globals.obj" + -@erase "$(INTDIR)\Sys Globals.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\JA2.bsc" + -@erase "$(OUTDIR)\ja2.map" + -@erase "..\..\ja2demo\ja2.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /G5 /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /O2b2 /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" +BSC32_SBRS= \ + "$(INTDIR)\_Ja25GermanText.sbr" \ + "$(INTDIR)\aniviewscreen.sbr" \ + "$(INTDIR)\Credits.sbr" \ + "$(INTDIR)\Cursors.sbr" \ + "$(INTDIR)\Fade Screen.sbr" \ + "$(INTDIR)\GameInitOptionsScreen.sbr" \ + "$(INTDIR)\gameloop.sbr" \ + "$(INTDIR)\gamescreen.sbr" \ + "$(INTDIR)\GameSettings.sbr" \ + "$(INTDIR)\GameVersion.sbr" \ + "$(INTDIR)\HelpScreen.sbr" \ + "$(INTDIR)\Init.sbr" \ + "$(INTDIR)\Intro.sbr" \ + "$(INTDIR)\JA2 Splash.sbr" \ + "$(INTDIR)\jascreens.sbr" \ + "$(INTDIR)\Loading Screen.sbr" \ + "$(INTDIR)\MainMenuScreen.sbr" \ + "$(INTDIR)\MessageBoxScreen.sbr" \ + "$(INTDIR)\Options Screen.sbr" \ + "$(INTDIR)\SaveLoadGame.sbr" \ + "$(INTDIR)\SaveLoadScreen.sbr" \ + "$(INTDIR)\SCREENS.sbr" \ + "$(INTDIR)\Sys Globals.sbr" + +"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2.map" /debug /machine:I386 /out:"d:\ja2demo\ja2.exe" +LINK32_OBJS= \ + "$(INTDIR)\_Ja25GermanText.obj" \ + "$(INTDIR)\aniviewscreen.obj" \ + "$(INTDIR)\Credits.obj" \ + "$(INTDIR)\Cursors.obj" \ + "$(INTDIR)\Fade Screen.obj" \ + "$(INTDIR)\GameInitOptionsScreen.obj" \ + "$(INTDIR)\gameloop.obj" \ + "$(INTDIR)\gamescreen.obj" \ + "$(INTDIR)\GameSettings.obj" \ + "$(INTDIR)\GameVersion.obj" \ + "$(INTDIR)\HelpScreen.obj" \ + "$(INTDIR)\Init.obj" \ + "$(INTDIR)\Intro.obj" \ + "$(INTDIR)\JA2 Splash.obj" \ + "$(INTDIR)\jascreens.obj" \ + "$(INTDIR)\Loading Screen.obj" \ + "$(INTDIR)\MainMenuScreen.obj" \ + "$(INTDIR)\MessageBoxScreen.obj" \ + "$(INTDIR)\Options Screen.obj" \ + "$(INTDIR)\SaveLoadGame.obj" \ + "$(INTDIR)\SaveLoadScreen.obj" \ + "$(INTDIR)\SCREENS.obj" \ + "$(INTDIR)\Sys Globals.obj" \ + "$(INTDIR)\ja2.res" \ + ".\TileEngine\Release Demo\TileEngine.lib" \ + ".\Standard Gaming Platform\Standar1\Standard Gaming Platform.lib" \ + ".\Tactical\Release Demo\Tactical.lib" \ + ".\Utils\Release Demo\Utils.lib" \ + ".\TacticalAI\Release Demo\TacticalAI.lib" \ + ".\Editor\Release Demo\Editor.lib" \ + ".\Laptop\Release Demo\Laptop.lib" \ + ".\Strategic\Release Demo\Strategic.lib" + +"..\..\ja2demo\ja2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + +OUTDIR=.\Demo Release with Debug +INTDIR=.\Demo Release with Debug +# Begin Custom Macros +OutDir=.\Demo Release with Debug +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" + +!ELSE + +ALL : "Strategic - Win32 Demo Release with Debug Info" "Laptop - Win32 Demo Release with Debug Info" "Editor - Win32 Demo Release with Debug Info" "TacticalAI - Win32 Demo Release with Debug Info" "Utils - Win32 Demo Release with Debug Info" "Tactical - Win32 Demo Release with Debug Info" "Standard Gaming Platform - Win32 Demo Release with Debug Info" "TileEngine - Win32 Demo Release with Debug Info" "..\..\ja2demo\ja2.exe" "$(OUTDIR)\JA2.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"TileEngine - Win32 Demo Release with Debug InfoCLEAN" "Standard Gaming Platform - Win32 Demo Release with Debug InfoCLEAN" "Tactical - Win32 Demo Release with Debug InfoCLEAN" "Utils - Win32 Demo Release with Debug InfoCLEAN" "TacticalAI - Win32 Demo Release with Debug InfoCLEAN" "Editor - Win32 Demo Release with Debug InfoCLEAN" "Laptop - Win32 Demo Release with Debug InfoCLEAN" "Strategic - Win32 Demo Release with Debug InfoCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\_Ja25GermanText.obj" + -@erase "$(INTDIR)\_Ja25GermanText.sbr" + -@erase "$(INTDIR)\aniviewscreen.obj" + -@erase "$(INTDIR)\aniviewscreen.sbr" + -@erase "$(INTDIR)\Credits.obj" + -@erase "$(INTDIR)\Credits.sbr" + -@erase "$(INTDIR)\Cursors.obj" + -@erase "$(INTDIR)\Cursors.sbr" + -@erase "$(INTDIR)\Fade Screen.obj" + -@erase "$(INTDIR)\Fade Screen.sbr" + -@erase "$(INTDIR)\GameInitOptionsScreen.obj" + -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" + -@erase "$(INTDIR)\gameloop.obj" + -@erase "$(INTDIR)\gameloop.sbr" + -@erase "$(INTDIR)\gamescreen.obj" + -@erase "$(INTDIR)\gamescreen.sbr" + -@erase "$(INTDIR)\GameSettings.obj" + -@erase "$(INTDIR)\GameSettings.sbr" + -@erase "$(INTDIR)\GameVersion.obj" + -@erase "$(INTDIR)\GameVersion.sbr" + -@erase "$(INTDIR)\HelpScreen.obj" + -@erase "$(INTDIR)\HelpScreen.sbr" + -@erase "$(INTDIR)\Init.obj" + -@erase "$(INTDIR)\Init.sbr" + -@erase "$(INTDIR)\Intro.obj" + -@erase "$(INTDIR)\Intro.sbr" + -@erase "$(INTDIR)\JA2 Splash.obj" + -@erase "$(INTDIR)\JA2 Splash.sbr" + -@erase "$(INTDIR)\ja2.res" + -@erase "$(INTDIR)\jascreens.obj" + -@erase "$(INTDIR)\jascreens.sbr" + -@erase "$(INTDIR)\Loading Screen.obj" + -@erase "$(INTDIR)\Loading Screen.sbr" + -@erase "$(INTDIR)\MainMenuScreen.obj" + -@erase "$(INTDIR)\MainMenuScreen.sbr" + -@erase "$(INTDIR)\MessageBoxScreen.obj" + -@erase "$(INTDIR)\MessageBoxScreen.sbr" + -@erase "$(INTDIR)\Options Screen.obj" + -@erase "$(INTDIR)\Options Screen.sbr" + -@erase "$(INTDIR)\SaveLoadGame.obj" + -@erase "$(INTDIR)\SaveLoadGame.sbr" + -@erase "$(INTDIR)\SaveLoadScreen.obj" + -@erase "$(INTDIR)\SaveLoadScreen.sbr" + -@erase "$(INTDIR)\SCREENS.obj" + -@erase "$(INTDIR)\SCREENS.sbr" + -@erase "$(INTDIR)\Sys Globals.obj" + -@erase "$(INTDIR)\Sys Globals.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\JA2.bsc" + -@erase "$(OUTDIR)\ja2.map" + -@erase "..\..\ja2demo\ja2.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /G5 /MT /W4 /GX /Zi /O2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /O2b2 /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" +BSC32_SBRS= \ + "$(INTDIR)\_Ja25GermanText.sbr" \ + "$(INTDIR)\aniviewscreen.sbr" \ + "$(INTDIR)\Credits.sbr" \ + "$(INTDIR)\Cursors.sbr" \ + "$(INTDIR)\Fade Screen.sbr" \ + "$(INTDIR)\GameInitOptionsScreen.sbr" \ + "$(INTDIR)\gameloop.sbr" \ + "$(INTDIR)\gamescreen.sbr" \ + "$(INTDIR)\GameSettings.sbr" \ + "$(INTDIR)\GameVersion.sbr" \ + "$(INTDIR)\HelpScreen.sbr" \ + "$(INTDIR)\Init.sbr" \ + "$(INTDIR)\Intro.sbr" \ + "$(INTDIR)\JA2 Splash.sbr" \ + "$(INTDIR)\jascreens.sbr" \ + "$(INTDIR)\Loading Screen.sbr" \ + "$(INTDIR)\MainMenuScreen.sbr" \ + "$(INTDIR)\MessageBoxScreen.sbr" \ + "$(INTDIR)\Options Screen.sbr" \ + "$(INTDIR)\SaveLoadGame.sbr" \ + "$(INTDIR)\SaveLoadScreen.sbr" \ + "$(INTDIR)\SCREENS.sbr" \ + "$(INTDIR)\Sys Globals.sbr" + +"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2.map" /debug /machine:I386 /out:"d:\ja2demo\ja2.exe" +LINK32_OBJS= \ + "$(INTDIR)\_Ja25GermanText.obj" \ + "$(INTDIR)\aniviewscreen.obj" \ + "$(INTDIR)\Credits.obj" \ + "$(INTDIR)\Cursors.obj" \ + "$(INTDIR)\Fade Screen.obj" \ + "$(INTDIR)\GameInitOptionsScreen.obj" \ + "$(INTDIR)\gameloop.obj" \ + "$(INTDIR)\gamescreen.obj" \ + "$(INTDIR)\GameSettings.obj" \ + "$(INTDIR)\GameVersion.obj" \ + "$(INTDIR)\HelpScreen.obj" \ + "$(INTDIR)\Init.obj" \ + "$(INTDIR)\Intro.obj" \ + "$(INTDIR)\JA2 Splash.obj" \ + "$(INTDIR)\jascreens.obj" \ + "$(INTDIR)\Loading Screen.obj" \ + "$(INTDIR)\MainMenuScreen.obj" \ + "$(INTDIR)\MessageBoxScreen.obj" \ + "$(INTDIR)\Options Screen.obj" \ + "$(INTDIR)\SaveLoadGame.obj" \ + "$(INTDIR)\SaveLoadScreen.obj" \ + "$(INTDIR)\SCREENS.obj" \ + "$(INTDIR)\Sys Globals.obj" \ + "$(INTDIR)\ja2.res" \ + ".\TileEngine\Demo Release with Debug\TileEngine.lib" \ + ".\Standard Gaming Platform\Standar2\Standard Gaming Platform.lib" \ + ".\Tactical\Demo Release with Debug\Tactical.lib" \ + ".\Utils\Demo Release with Debug\Utils.lib" \ + ".\TacticalAI\Demo Release with Debug\TacticalAI.lib" \ + ".\Editor\Demo Release with Debug\Editor.lib" \ + ".\Laptop\Demo Release with Debug\Laptop.lib" \ + ".\Strategic\Demo Release with Debug\Strategic.lib" + +"..\..\ja2demo\ja2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + +OUTDIR=.\Demo Bounds Checker +INTDIR=.\Demo Bounds Checker +# Begin Custom Macros +OutDir=.\Demo Bounds Checker +# End Custom Macros + +!IF "$(RECURSE)" == "0" + +ALL : "..\..\ja2.exe" "$(OUTDIR)\JA2.bsc" + +!ELSE + +ALL : "Strategic - Win32 Demo Bounds Checker" "Laptop - Win32 Demo Bounds Checker" "Editor - Win32 Demo Bounds Checker" "TacticalAI - Win32 Demo Bounds Checker" "Utils - Win32 Demo Bounds Checker" "Tactical - Win32 Demo Bounds Checker" "TileEngine - Win32 Demo Bounds Checker" "..\..\ja2.exe" "$(OUTDIR)\JA2.bsc" + +!ENDIF + +!IF "$(RECURSE)" == "1" +CLEAN :"TileEngine - Win32 Demo Bounds CheckerCLEAN" "Tactical - Win32 Demo Bounds CheckerCLEAN" "Utils - Win32 Demo Bounds CheckerCLEAN" "TacticalAI - Win32 Demo Bounds CheckerCLEAN" "Editor - Win32 Demo Bounds CheckerCLEAN" "Laptop - Win32 Demo Bounds CheckerCLEAN" "Strategic - Win32 Demo Bounds CheckerCLEAN" +!ELSE +CLEAN : +!ENDIF + -@erase "$(INTDIR)\_Ja25GermanText.obj" + -@erase "$(INTDIR)\_Ja25GermanText.sbr" + -@erase "$(INTDIR)\aniviewscreen.obj" + -@erase "$(INTDIR)\aniviewscreen.sbr" + -@erase "$(INTDIR)\Credits.obj" + -@erase "$(INTDIR)\Credits.sbr" + -@erase "$(INTDIR)\Cursors.obj" + -@erase "$(INTDIR)\Cursors.sbr" + -@erase "$(INTDIR)\Fade Screen.obj" + -@erase "$(INTDIR)\Fade Screen.sbr" + -@erase "$(INTDIR)\GameInitOptionsScreen.obj" + -@erase "$(INTDIR)\GameInitOptionsScreen.sbr" + -@erase "$(INTDIR)\gameloop.obj" + -@erase "$(INTDIR)\gameloop.sbr" + -@erase "$(INTDIR)\gamescreen.obj" + -@erase "$(INTDIR)\gamescreen.sbr" + -@erase "$(INTDIR)\GameSettings.obj" + -@erase "$(INTDIR)\GameSettings.sbr" + -@erase "$(INTDIR)\GameVersion.obj" + -@erase "$(INTDIR)\GameVersion.sbr" + -@erase "$(INTDIR)\HelpScreen.obj" + -@erase "$(INTDIR)\HelpScreen.sbr" + -@erase "$(INTDIR)\Init.obj" + -@erase "$(INTDIR)\Init.sbr" + -@erase "$(INTDIR)\Intro.obj" + -@erase "$(INTDIR)\Intro.sbr" + -@erase "$(INTDIR)\JA2 Splash.obj" + -@erase "$(INTDIR)\JA2 Splash.sbr" + -@erase "$(INTDIR)\ja2.res" + -@erase "$(INTDIR)\jascreens.obj" + -@erase "$(INTDIR)\jascreens.sbr" + -@erase "$(INTDIR)\Loading Screen.obj" + -@erase "$(INTDIR)\Loading Screen.sbr" + -@erase "$(INTDIR)\MainMenuScreen.obj" + -@erase "$(INTDIR)\MainMenuScreen.sbr" + -@erase "$(INTDIR)\MessageBoxScreen.obj" + -@erase "$(INTDIR)\MessageBoxScreen.sbr" + -@erase "$(INTDIR)\Options Screen.obj" + -@erase "$(INTDIR)\Options Screen.sbr" + -@erase "$(INTDIR)\SaveLoadGame.obj" + -@erase "$(INTDIR)\SaveLoadGame.sbr" + -@erase "$(INTDIR)\SaveLoadScreen.obj" + -@erase "$(INTDIR)\SaveLoadScreen.sbr" + -@erase "$(INTDIR)\SCREENS.obj" + -@erase "$(INTDIR)\SCREENS.sbr" + -@erase "$(INTDIR)\Sys Globals.obj" + -@erase "$(INTDIR)\Sys Globals.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\JA2.bsc" + -@erase "$(OUTDIR)\ja2.map" + -@erase "..\..\ja2.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Communications" /I ".\Editor" /I ".\Strategic" /I ".\Laptop" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "JA2DEMO" /D "CALLBACKTIMER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\JA2.pch" /YX"JA2 All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ja2.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\JA2.bsc" +BSC32_SBRS= \ + "$(INTDIR)\_Ja25GermanText.sbr" \ + "$(INTDIR)\aniviewscreen.sbr" \ + "$(INTDIR)\Credits.sbr" \ + "$(INTDIR)\Cursors.sbr" \ + "$(INTDIR)\Fade Screen.sbr" \ + "$(INTDIR)\GameInitOptionsScreen.sbr" \ + "$(INTDIR)\gameloop.sbr" \ + "$(INTDIR)\gamescreen.sbr" \ + "$(INTDIR)\GameSettings.sbr" \ + "$(INTDIR)\GameVersion.sbr" \ + "$(INTDIR)\HelpScreen.sbr" \ + "$(INTDIR)\Init.sbr" \ + "$(INTDIR)\Intro.sbr" \ + "$(INTDIR)\JA2 Splash.sbr" \ + "$(INTDIR)\jascreens.sbr" \ + "$(INTDIR)\Loading Screen.sbr" \ + "$(INTDIR)\MainMenuScreen.sbr" \ + "$(INTDIR)\MessageBoxScreen.sbr" \ + "$(INTDIR)\Options Screen.sbr" \ + "$(INTDIR)\SaveLoadGame.sbr" \ + "$(INTDIR)\SaveLoadScreen.sbr" \ + "$(INTDIR)\SCREENS.sbr" \ + "$(INTDIR)\Sys Globals.sbr" + +"$(OUTDIR)\JA2.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"$(INTDIR)\ja2.map" /debug /machine:I386 /out:"..\..\ja2.exe" +LINK32_OBJS= \ + "$(INTDIR)\_Ja25GermanText.obj" \ + "$(INTDIR)\aniviewscreen.obj" \ + "$(INTDIR)\Credits.obj" \ + "$(INTDIR)\Cursors.obj" \ + "$(INTDIR)\Fade Screen.obj" \ + "$(INTDIR)\GameInitOptionsScreen.obj" \ + "$(INTDIR)\gameloop.obj" \ + "$(INTDIR)\gamescreen.obj" \ + "$(INTDIR)\GameSettings.obj" \ + "$(INTDIR)\GameVersion.obj" \ + "$(INTDIR)\HelpScreen.obj" \ + "$(INTDIR)\Init.obj" \ + "$(INTDIR)\Intro.obj" \ + "$(INTDIR)\JA2 Splash.obj" \ + "$(INTDIR)\jascreens.obj" \ + "$(INTDIR)\Loading Screen.obj" \ + "$(INTDIR)\MainMenuScreen.obj" \ + "$(INTDIR)\MessageBoxScreen.obj" \ + "$(INTDIR)\Options Screen.obj" \ + "$(INTDIR)\SaveLoadGame.obj" \ + "$(INTDIR)\SaveLoadScreen.obj" \ + "$(INTDIR)\SCREENS.obj" \ + "$(INTDIR)\Sys Globals.obj" \ + "$(INTDIR)\ja2.res" \ + ".\TileEngine\Demo Bounds Checker\TileEngine.lib" \ + ".\Tactical\Demo Bounds Checker\Tactical.lib" \ + ".\Utils\Demo Bounds Checker\Utils.lib" \ + ".\TacticalAI\Demo Bounds Checker\TacticalAI.lib" \ + ".\Editor\Demo Bounds Checker\Editor.lib" \ + ".\Laptop\Demo Bounds Checker\Laptop.lib" \ + ".\Strategic\Demo Bounds Checker\Strategic.lib" + +"..\..\ja2.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("JA2.dep") +!INCLUDE "JA2.dep" +!ELSE +!MESSAGE Warning: cannot find "JA2.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "ja2 - Win32 Release" || "$(CFG)" == "ja2 - Win32 Debug" || "$(CFG)" == "ja2 - Win32 Release with Debug Info" || "$(CFG)" == "ja2 - Win32 Bounds Checker" || "$(CFG)" == "ja2 - Win32 Debug Demo" || "$(CFG)" == "ja2 - Win32 Release Demo" || "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" || "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" +SOURCE=.\Utils\_Ja25GermanText.cpp + +"$(INTDIR)\_Ja25GermanText.obj" "$(INTDIR)\_Ja25GermanText.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=.\aniviewscreen.cpp + +"$(INTDIR)\aniviewscreen.obj" "$(INTDIR)\aniviewscreen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\Credits.cpp + +"$(INTDIR)\Credits.obj" "$(INTDIR)\Credits.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\Utils\Cursors.cpp + +"$(INTDIR)\Cursors.obj" "$(INTDIR)\Cursors.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +SOURCE=".\Fade Screen.cpp" + +"$(INTDIR)\Fade Screen.obj" "$(INTDIR)\Fade Screen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\GameInitOptionsScreen.cpp + +"$(INTDIR)\GameInitOptionsScreen.obj" "$(INTDIR)\GameInitOptionsScreen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\gameloop.cpp + +"$(INTDIR)\gameloop.obj" "$(INTDIR)\gameloop.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\gamescreen.cpp + +"$(INTDIR)\gamescreen.obj" "$(INTDIR)\gamescreen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\GameSettings.cpp + +"$(INTDIR)\GameSettings.obj" "$(INTDIR)\GameSettings.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\GameVersion.cpp + +"$(INTDIR)\GameVersion.obj" "$(INTDIR)\GameVersion.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\HelpScreen.cpp + +"$(INTDIR)\HelpScreen.obj" "$(INTDIR)\HelpScreen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\Init.cpp + +"$(INTDIR)\Init.obj" "$(INTDIR)\Init.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\Intro.cpp + +"$(INTDIR)\Intro.obj" "$(INTDIR)\Intro.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\JA2 Splash.cpp" + +"$(INTDIR)\JA2 Splash.obj" "$(INTDIR)\JA2 Splash.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\Res\ja2.rc + +!IF "$(CFG)" == "ja2 - Win32 Release" + + +"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "NDEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + + +"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "_DEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + + +"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "NDEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + + +"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "_DEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + + +"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "_DEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + + +"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "NDEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + + +"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "NDEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + + +"$(INTDIR)\ja2.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)\ja2.res" /i "Res" /i ".\Res" /d "_DEBUG" $(SOURCE) + + +!ENDIF + +SOURCE=.\jascreens.cpp + +"$(INTDIR)\jascreens.obj" "$(INTDIR)\jascreens.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Loading Screen.cpp" + +"$(INTDIR)\Loading Screen.obj" "$(INTDIR)\Loading Screen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\MainMenuScreen.cpp + +"$(INTDIR)\MainMenuScreen.obj" "$(INTDIR)\MainMenuScreen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\MessageBoxScreen.cpp + +"$(INTDIR)\MessageBoxScreen.obj" "$(INTDIR)\MessageBoxScreen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Options Screen.cpp" + +"$(INTDIR)\Options Screen.obj" "$(INTDIR)\Options Screen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\SaveLoadGame.cpp + +"$(INTDIR)\SaveLoadGame.obj" "$(INTDIR)\SaveLoadGame.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\SaveLoadScreen.cpp + +"$(INTDIR)\SaveLoadScreen.obj" "$(INTDIR)\SaveLoadScreen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\SCREENS.cpp + +"$(INTDIR)\SCREENS.obj" "$(INTDIR)\SCREENS.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Sys Globals.cpp" + +"$(INTDIR)\Sys Globals.obj" "$(INTDIR)\Sys Globals.sbr" : $(SOURCE) "$(INTDIR)" + + +!IF "$(CFG)" == "ja2 - Win32 Release" + +"TileEngine - Win32 Release" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release" + cd ".." + +"TileEngine - Win32 ReleaseCLEAN" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + +"TileEngine - Win32 Debug" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Debug" + cd ".." + +"TileEngine - Win32 DebugCLEAN" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Debug" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + +"TileEngine - Win32 Release with Debug Info" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release with Debug Info" + cd ".." + +"TileEngine - Win32 Release with Debug InfoCLEAN" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + +"TileEngine - Win32 Bounds Checker" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Bounds Checker" + cd ".." + +"TileEngine - Win32 Bounds CheckerCLEAN" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + +"TileEngine - Win32 Debug Demo" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Debug Demo" + cd ".." + +"TileEngine - Win32 Debug DemoCLEAN" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Debug Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + +"TileEngine - Win32 Release Demo" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release Demo" + cd ".." + +"TileEngine - Win32 Release DemoCLEAN" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Release Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + +"TileEngine - Win32 Demo Release with Debug Info" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Demo Release with Debug Info" + cd ".." + +"TileEngine - Win32 Demo Release with Debug InfoCLEAN" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + +"TileEngine - Win32 Demo Bounds Checker" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Demo Bounds Checker" + cd ".." + +"TileEngine - Win32 Demo Bounds CheckerCLEAN" : + cd ".\TileEngine" + $(MAKE) /$(MAKEFLAGS) /F .\TileEngine.mak CFG="TileEngine - Win32 Demo Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ENDIF + +!IF "$(CFG)" == "ja2 - Win32 Release" + +"Standard Gaming Platform - Win32 Release" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release" + cd ".." + +"Standard Gaming Platform - Win32 ReleaseCLEAN" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + +"Standard Gaming Platform - Win32 Debug" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Debug" + cd ".." + +"Standard Gaming Platform - Win32 DebugCLEAN" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Debug" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + +"Standard Gaming Platform - Win32 Release with Debug Info" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release with Debug Info" + cd ".." + +"Standard Gaming Platform - Win32 Release with Debug InfoCLEAN" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + +"Standard Gaming Platform - Win32 Bounds Checker" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Bounds Checker" + cd ".." + +"Standard Gaming Platform - Win32 Bounds CheckerCLEAN" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + +"Standard Gaming Platform - Win32 Debug Demo" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Debug Demo" + cd ".." + +"Standard Gaming Platform - Win32 Debug DemoCLEAN" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Debug Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + +"Standard Gaming Platform - Win32 Release Demo" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release Demo" + cd ".." + +"Standard Gaming Platform - Win32 Release DemoCLEAN" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Release Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + +"Standard Gaming Platform - Win32 Demo Release with Debug Info" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Demo Release with Debug Info" + cd ".." + +"Standard Gaming Platform - Win32 Demo Release with Debug InfoCLEAN" : + cd ".\Standard Gaming Platform" + $(MAKE) /$(MAKEFLAGS) /F ".\Standard Gaming Platform.mak" CFG="Standard Gaming Platform - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + +!ENDIF + +!IF "$(CFG)" == "ja2 - Win32 Release" + +"Tactical - Win32 Release" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release" + cd ".." + +"Tactical - Win32 ReleaseCLEAN" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + +"Tactical - Win32 Debug" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Debug" + cd ".." + +"Tactical - Win32 DebugCLEAN" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Debug" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + +"Tactical - Win32 Release with Debug Info" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release with Debug Info" + cd ".." + +"Tactical - Win32 Release with Debug InfoCLEAN" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + +"Tactical - Win32 Bounds Checker" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Bounds Checker" + cd ".." + +"Tactical - Win32 Bounds CheckerCLEAN" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + +"Tactical - Win32 Debug Demo" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Debug Demo" + cd ".." + +"Tactical - Win32 Debug DemoCLEAN" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Debug Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + +"Tactical - Win32 Release Demo" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release Demo" + cd ".." + +"Tactical - Win32 Release DemoCLEAN" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Release Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + +"Tactical - Win32 Demo Release with Debug Info" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Demo Release with Debug Info" + cd ".." + +"Tactical - Win32 Demo Release with Debug InfoCLEAN" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + +"Tactical - Win32 Demo Bounds Checker" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Demo Bounds Checker" + cd ".." + +"Tactical - Win32 Demo Bounds CheckerCLEAN" : + cd ".\Tactical" + $(MAKE) /$(MAKEFLAGS) /F .\Tactical.mak CFG="Tactical - Win32 Demo Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ENDIF + +!IF "$(CFG)" == "ja2 - Win32 Release" + +"Utils - Win32 Release" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release" + cd ".." + +"Utils - Win32 ReleaseCLEAN" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + +"Utils - Win32 Debug" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Debug" + cd ".." + +"Utils - Win32 DebugCLEAN" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Debug" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + +"Utils - Win32 Release with Debug Info" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release with Debug Info" + cd ".." + +"Utils - Win32 Release with Debug InfoCLEAN" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + +"Utils - Win32 Bounds Checker" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Bounds Checker" + cd ".." + +"Utils - Win32 Bounds CheckerCLEAN" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + +"Utils - Win32 Debug Demo" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Debug Demo" + cd ".." + +"Utils - Win32 Debug DemoCLEAN" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Debug Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + +"Utils - Win32 Release Demo" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release Demo" + cd ".." + +"Utils - Win32 Release DemoCLEAN" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Release Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + +"Utils - Win32 Demo Release with Debug Info" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Demo Release with Debug Info" + cd ".." + +"Utils - Win32 Demo Release with Debug InfoCLEAN" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + +"Utils - Win32 Demo Bounds Checker" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Demo Bounds Checker" + cd ".." + +"Utils - Win32 Demo Bounds CheckerCLEAN" : + cd ".\Utils" + $(MAKE) /$(MAKEFLAGS) /F .\Utils.mak CFG="Utils - Win32 Demo Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ENDIF + +!IF "$(CFG)" == "ja2 - Win32 Release" + +"TacticalAI - Win32 Release" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release" + cd ".." + +"TacticalAI - Win32 ReleaseCLEAN" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + +"TacticalAI - Win32 Debug" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Debug" + cd ".." + +"TacticalAI - Win32 DebugCLEAN" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Debug" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + +"TacticalAI - Win32 Release with Debug Info" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release with Debug Info" + cd ".." + +"TacticalAI - Win32 Release with Debug InfoCLEAN" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + +"TacticalAI - Win32 Bounds Checker" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Bounds Checker" + cd ".." + +"TacticalAI - Win32 Bounds CheckerCLEAN" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + +"TacticalAI - Win32 Debug Demo" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Debug Demo" + cd ".." + +"TacticalAI - Win32 Debug DemoCLEAN" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Debug Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + +"TacticalAI - Win32 Release Demo" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release Demo" + cd ".." + +"TacticalAI - Win32 Release DemoCLEAN" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Release Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + +"TacticalAI - Win32 Demo Release with Debug Info" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Demo Release with Debug Info" + cd ".." + +"TacticalAI - Win32 Demo Release with Debug InfoCLEAN" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + +"TacticalAI - Win32 Demo Bounds Checker" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Demo Bounds Checker" + cd ".." + +"TacticalAI - Win32 Demo Bounds CheckerCLEAN" : + cd ".\TacticalAI" + $(MAKE) /$(MAKEFLAGS) /F .\TacticalAI.mak CFG="TacticalAI - Win32 Demo Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ENDIF + +!IF "$(CFG)" == "ja2 - Win32 Release" + +"Editor - Win32 Release" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release" + cd ".." + +"Editor - Win32 ReleaseCLEAN" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + +"Editor - Win32 Debug" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Debug" + cd ".." + +"Editor - Win32 DebugCLEAN" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Debug" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + +"Editor - Win32 Release with Debug Info" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release with Debug Info" + cd ".." + +"Editor - Win32 Release with Debug InfoCLEAN" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + +"Editor - Win32 Bounds Checker" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Bounds Checker" + cd ".." + +"Editor - Win32 Bounds CheckerCLEAN" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + +"Editor - Win32 Debug Demo" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Debug Demo" + cd ".." + +"Editor - Win32 Debug DemoCLEAN" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Debug Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + +"Editor - Win32 Release Demo" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release Demo" + cd ".." + +"Editor - Win32 Release DemoCLEAN" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Release Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + +"Editor - Win32 Demo Release with Debug Info" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Demo Release with Debug Info" + cd ".." + +"Editor - Win32 Demo Release with Debug InfoCLEAN" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + +"Editor - Win32 Demo Bounds Checker" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Demo Bounds Checker" + cd ".." + +"Editor - Win32 Demo Bounds CheckerCLEAN" : + cd ".\Editor" + $(MAKE) /$(MAKEFLAGS) /F .\Editor.mak CFG="Editor - Win32 Demo Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ENDIF + +!IF "$(CFG)" == "ja2 - Win32 Release" + +"Laptop - Win32 Release" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release" + cd ".." + +"Laptop - Win32 ReleaseCLEAN" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + +"Laptop - Win32 Debug" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Debug" + cd ".." + +"Laptop - Win32 DebugCLEAN" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Debug" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + +"Laptop - Win32 Release with Debug Info" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release with Debug Info" + cd ".." + +"Laptop - Win32 Release with Debug InfoCLEAN" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + +"Laptop - Win32 Bounds Checker" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Bounds Checker" + cd ".." + +"Laptop - Win32 Bounds CheckerCLEAN" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + +"Laptop - Win32 Debug Demo" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Debug Demo" + cd ".." + +"Laptop - Win32 Debug DemoCLEAN" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Debug Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + +"Laptop - Win32 Release Demo" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release Demo" + cd ".." + +"Laptop - Win32 Release DemoCLEAN" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Release Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + +"Laptop - Win32 Demo Release with Debug Info" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Demo Release with Debug Info" + cd ".." + +"Laptop - Win32 Demo Release with Debug InfoCLEAN" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + +"Laptop - Win32 Demo Bounds Checker" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Demo Bounds Checker" + cd ".." + +"Laptop - Win32 Demo Bounds CheckerCLEAN" : + cd ".\Laptop" + $(MAKE) /$(MAKEFLAGS) /F .\Laptop.mak CFG="Laptop - Win32 Demo Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ENDIF + +!IF "$(CFG)" == "ja2 - Win32 Release" + +"Strategic - Win32 Release" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release" + cd ".." + +"Strategic - Win32 ReleaseCLEAN" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug" + +"Strategic - Win32 Debug" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Debug" + cd ".." + +"Strategic - Win32 DebugCLEAN" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Debug" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release with Debug Info" + +"Strategic - Win32 Release with Debug Info" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release with Debug Info" + cd ".." + +"Strategic - Win32 Release with Debug InfoCLEAN" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Bounds Checker" + +"Strategic - Win32 Bounds Checker" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Bounds Checker" + cd ".." + +"Strategic - Win32 Bounds CheckerCLEAN" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Debug Demo" + +"Strategic - Win32 Debug Demo" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Debug Demo" + cd ".." + +"Strategic - Win32 Debug DemoCLEAN" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Debug Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Release Demo" + +"Strategic - Win32 Release Demo" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release Demo" + cd ".." + +"Strategic - Win32 Release DemoCLEAN" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Release Demo" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Release with Debug Info" + +"Strategic - Win32 Demo Release with Debug Info" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Demo Release with Debug Info" + cd ".." + +"Strategic - Win32 Demo Release with Debug InfoCLEAN" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Demo Release with Debug Info" RECURSE=1 CLEAN + cd ".." + +!ELSEIF "$(CFG)" == "ja2 - Win32 Demo Bounds Checker" + +"Strategic - Win32 Demo Bounds Checker" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Demo Bounds Checker" + cd ".." + +"Strategic - Win32 Demo Bounds CheckerCLEAN" : + cd ".\Strategic" + $(MAKE) /$(MAKEFLAGS) /F .\Strategic.mak CFG="Strategic - Win32 Demo Bounds Checker" RECURSE=1 CLEAN + cd ".." + +!ENDIF + + +!ENDIF + diff --git a/JA2.opt b/JA2.opt new file mode 100644 index 0000000000000000000000000000000000000000..44fe5f0ada30db136d1d698b31d1ebe25e828b50 GIT binary patch literal 106496 zcmeHQTX-ASabB9HEK;%}+lnH|l6^$k3@DM5NIQxwM@~Tiq#%I+LI9>z(_Jrt6$Kl_ zqQF9y>L^uuZ__rtH%Zer={0TBrs=)uy-nJt>Fu$7>LoAz(tcm_(3gH~=jr_ za+Hv>(r|%u=A1ca&h7&E=giFC|J_6X{LxPy`WMM}JSPoHUwVC1+Tkj{53h&p_j@JO zzy3PCwa@hW1_;G`e3fY6|1eI0H5&%q4;lf{nm+*A2^s~Bfp&ptogc(`59m!GTmsTV zpoc+^fcAmj3?ja_;Cujd5OfIiDCjWg2ZL~(9s)A}D6?6r(4!R1egI)%`0wVqmoSPsG)B=4ys153XbWj&`4fHCA_&<&_t?_F( zzZ-ND^d8VRf^LD9(UXRj0yA&o+&1oDRKz^?B7b!s%M1^B{hzr{|b)vEnoj=^C`vfi%+NW{zFHP;dYKakWcp_$)+PtANz^Pl0Ss?qkH^7M^~CPrCk&2 z%0|7pE?NymzoNA_=2K@^UsmQ;*ShsaZM9@`Et*_Kiz~8Xrq*cWH_%2&(IOS{#MhSJit)?=Pt zb4J;!d9pc2x)9Jg>|v}>(W>#+W*hD3ZADkt>(wVbtR=e`y0IASCOd6qjC)$x^LG?s z^Y2h=bzN(F$DA?BR?U;mS=XA7hV`2gx$*02>-5~yblnKB!p27B}2tRoIEM?tM!g(wY92R>$X+#YQ51ARiibkRIz5Z6HQgEsWpMy z%_v6C;wrjsp=%O5YV_0*%9_^IMYm(MBN<}79vDY<1MOZo_2M}pa+*>z2WJ!}#JIU| ztGJzM$nxw=N3V~Isp;9NQ}kyRe}u7cCy$4Aj(){C@vd&Y`iiLrv-?E9f%q;LxssDF zi4#I3#N3(FVp`0eIxQysOe>jrV!RAS@I8G7eE2gtMayF!^ObVBkeADa#YMVSmr9pQ za&b9ZSk9I&%jdI;=QE`;_3v$@Hy72W+OAiZv~EXT(ym$Smr@#yHKqE>lt?UAvT`b! z%grZK7boZSCUl%6O!Sd&Mss# z>5%R`4}&{cU0eeLSJbnV#>_{tK6hzBjhn5cT8otGwmVuo5w^DGLoiiYE)|yLm6a9a zj=`EZ4-Ee!V_Dt6br!f)V?Hu!YDaHtH;jja(!lehcEfs%)XZl=ry2S1u%1Jz@99Bb z0X_oSF*G#PmGqIFQhE3z#nQ0niALA3d7)RD4d0_AL@oA%$7Y%?Zr5qczQEDtg4D5Oo4yB#e92m^M8x=}}D2OJUrnqEd1mlB4x2B5^c< zR@2XQ>+~Vh5fk=>mdPjQbD8uc`X6<#9vUS~$>24fEB50+Ud|*-cVt*pW6H+PmWYBcnVtSKtiJ`$5A42$u@C<6= z+^MEqBFyG!@lm4PP|OPi^Bv+o-0= z-NZBTCZ17Js{AQwY3P`AeT1&91ON5TVUa52^O;mRTfo^!>QaWOyR;5Rt zSr#eI)nABai^=6u)a=YUk1V4oQdF-qQ&Ov~tZyhnskUU?2i*--)^D^_k(e(Oa+71n zqN>v?h2?ag`U+Mpw7RM3mIV5?K7eH*nJW$AF@7+F4U{CA&xV>vqzk1;Sq_sNi)$sD zpFJI;vzUBK$yAKaVsR~}~I-}Z!J zc-E|eFS`bIV(0Ht?gDLXW&Dr#|MC7m+RjBp`xqjAzViM*-v7t=pAG+wGXBT=|BT(l zy#LR$)sFZ7@&3PZc6>|bR3@5_#Yut3(p_S8U_|MdzylAG{L zCco%G$2h#H2{;@9#q~cvN}XE%$0bPV!uOdxzh!vgYnB(fCN=Ori+5L07JVcv|8I&_ z5Lf;Q>dum%g%^Jol5W=zd%q>0WYZBn(q7HmLgeS*@!m50z{#sW{z3A|pPhWl=0!CZ}$Ht7gX0F*#BGC*#DdTzwTAa{Ncy z(d<4p7c7$FKL)}!S`j%p{-ZYlF7N;3{hx;41jm1*u$IOSPu~A&1@+|kj~xFofI_#5wKp&Yu#q8BT`q@>MLq{ z%ndc|lu|`=+g*&7`+c1+s|`eTSB*S8w@5qm>I);ZkCa~hkMRmGq%`ams?=CoPDeZMt&+6(%#KKXF(50b@n9D${o0&B6$Cx0o zS(EW>0UbgXGvkU~Y-`;D45jY(M_CrM~9;&*vkz zKXhi;54{0Bc|?YQTmoM<@RwFJNAsght?mvyx;i(RUR-o-16Io1XWsx)M~#DTy=*b ze+=(;f#SwLe4g6-;y;!lyNdadWCe4LdmOrr_>V79=f3&-?lHK-ZAz@c5+~c{eavP16xO7)zbr8+7k()*LSw8UQL84IRc)J zeLc{fG%;{~4upN%Yf5tNOc&Gx~1l$idQ$-MC(?`9X)v5A4Tlf6!^~NQsTuza`i<1fuWZ z=#xQy8^HE$MIMYli(p?~#q_!$HNzYdR3^or2qNc?1zGJ;2AOAq%*Gf$d7amO1nac(`x+#SgQDa`uBrP!+RD;WRRnq~F6ZbchiDCEnt zbDaOlAIz5XKXLx2qTu{bod3zeZk>(Xo_Gv)DewPg{NJ#3SP(y1LV^K382@MdpYebC zZN&#`fHkm1HDKd^Pn4~6N)9j=0{`u{nf&NqtkwtY){cnS*x&v@(-7z{Y~yGm&~PAD zMhI9~SC0p}>IVTn8sLuFcY7qjX%8_708R&Z{l_5u;} z=B7_AVoi`3-yi^S&$8Oly6vjE<)X_{Kp{UG9lHNYC!@*3d% zzgvEZd4jBgNDbKd|AdV!C$kPbA7TO6(_{170AluVsMmudD7GEIL76?H?2{Ajc(k;* zdEt(RbkPs_ckq1w7(;gdIyMCtZ#4RUGGrw2@&De==$I=N3-|A{oOI1aE*MpAVsVIl zv(u+GF{etbZ;%Dx?qlS4zehLf-Y>D8n~(ATF(HnhL^u-sU$1AEinIl>sI05=T_Cc} z7f!t>&WTi8g;zzksx_0%8g1q^D-$B5MRo&?(G2_3vKuXvk@x@lBDygC-@qkRyCJH^ zl~ogKbhUMw0%4X_5bqXroN-;S%!b7l>g8nEN9ml65AA*oUZG2kiwdK0hX929?i z6pZ(S;>KV92I|-s|GZ+vUT;Vps@ue|5Aok00{;$BT>0Nd{rlv`0{T|am!QaR$N4)z-wFCI(EC8&4f-C? z_k!LJ`aaP2gNXkJasDCD4}*RL^rN5;fIbNN5a`E19|rw6i1>dJ=Z}Cs3i>I~PlJ92 z^s}I!1N}VcW1wFE{UYd>K-7-tSMd51pkD=j67*}JUkCjL=r=*X1tPxR!TEPVp91|J z==VW?0Qy7FAA$ZDM0|gW^Phn}4f+h|&q03y`b*GfL4O7M9O$n>e*^kk5VhM1N6-FO zZ>X8(dcCPSX1P%NpTick|2b9tdN@=LvTeft7i=8U6Xus`hRtmvWNsl>LQLymaCFvOa1X&c7_2sylPWi{V8nhhw66_K*t+ut zN1`?{r%J4EkackD`UhDGGfjrEO_pv8Bm4ib{}22B)Ef;^Q#*QFyJ6V(6t@5AO;J@E zjWwipFwCB0^5pnG?Ek~@e{AbsWQe1T&B69Rw*QF)+yB`9N55|PU=6Sawxb5v{aU@e$;<(yEl7#j*ay{;%yfb=6}-LDgylNf!FjZ3z z?WZ5Of56Kc73b@am(3m-LF>KY(4rjoGTs@QKX`q-!Y$ZV8bU_xR9R`St9n*fH^LW@ zMjN(FR32|3h;tM3CHBEHA}+@3_erU=+EU~C^VHO4^+rl->IzJN?K?;B@4N@b{~7;h z{GaiErK2?`9~^s)yqQMf%!Ew7jQ=+sj~+20tUTx(|BK^)ar`fi|JCVksInR0i{pPO z)t0Pu43&5Sd#z;iv!_Etqj}gk|1bTT;)6B78rX^&VElh8t}4%oH4sk&Hva#}%gUUC z{#)4e0~eBWe!M@7FRZMGD(}ER{%vH>%*-l8$kl6|8TGmv1-n1w9!4bOAK7Iu#?>)* zM>f{(+XCJjW7KdCxqInn1K96ojIsb6a5LFs3gZ6>H``{>e_Hj&106&S-Bjd*SQ~SB zyh}rUMc4zvmYmpw>qn(=7K8ZSAkcoS=Nd31JuIb)ZS7^Xs`t=wOYVV^t~6^(yCxQu zje2uk6dQ_;xH=nsTkW)?vi0Q}F^oEWS;p*+lG(m|J2JJpuC@E~xL3KbxR}dKiKPHqoGF#jZr0mKZ!W4Zan!3zTDPMv zY1gcXT`6l%@svm`RNJ+k$F!0OvF?Ct;EH;dlJkFX{4az(f5!hygMod<{|&QsFQF zWSoX}m?$C@MPj2=*+UZPodbxX2WfZ7lm1wecArQ1ae ztWBR#NlxMrX9Qj;ZwU_3m~!)HAiyct7A^jMI~J)kpjFEhV__xqG#bsFi3 z6*CRcqY+C%GmCAN?PD|U;{p~L3T-l4g+6okbZl+Xd`|f0YOJ2UIKG}A4Oh4EXc-&| z@1U=B@6$KTirm-nE}m0am`hsBP;Z+^Ni`E(n0`8(7`QryUIy9jBli$&!i&y%4mfwZ zz3wyt`a(q!U0vV0df)Gy?{<;j2kE<`^}W&hMrnRubA6|yFKyXEJ~Bv6s*ulTQf072 zMX5<=OGYXWqyGBTjY&~$F#a!`=suCEbvU9lo6VOq%L~a=CPKBn`eVngi?gEDU2D{< z!YPiF>~KU$b|>o&E~#DXk!lr2%Cs9TC5wqkar4=+W0rAXKC_tR_&*%~XRw)o_y5!9 z0UxXZ*1%TO0OS8#aaDOvtbuqM_|pAD!_r=9yLu0 zJ00nHWc^X4S0y2>82Nu{l7@GKj`7>bKl97f={~dPG-R$xUE~~E$E)@rae?}Wk$-3p zN*@N<=D+}xui&@oy(3?fs*t|{=}qJyx}E$(?mRF)QK4`Dgi5XaJE07lEZnSoclSfm zh=KOK{<;zIE7j;MG-{=Ww&pSi58ZMZf`@KJLVwin(5)U=XufwKL-VZ*2eb>EBp_x% z&%Qf!%d$jEc5WKt=+)Z`&i3Cq;k90|{kLajVEeDe_Fuy^r1U^^;+gJl*l5O&_!8FR`zGFqvt5;|37jOnKOP;b{JZ-CN2ruj~IaJ2@AHwc9 z`zk|F2loGH0(P)BoccBzv;PMYo3j6h)@{~0B6U@*zM{6-|3hS(S2Xtju&_!}2K#@6 z08;G#0dF_DI@te%aQ$fCE%yH~ofdA0*Bp<4Og=4pyh=j+1$vNO5T7#ZJm{2B6p4rR zI*XFzz;qGPjQXHND()}U={Q8P7p4nJ?$vuFJH?Tb9S+9-f?6#mmrEJhqfw(MQk!Oj zo?i>&f3oS?Qxgd}UEugn$N=JjJ7u|4PN!tq@9|>)j^{ILfHkoFG_V6PTE?VX_rEke zDt*8+{nW|Si4)S$5H^HjkEe`(m;P}G-1L4Jdqh{HMd$s9^b-C((!0cOtsaTcx^73nR|QksnqoB+ZWz8Jv*B|HJx0Tou58+DtRjP%&CQE(wWmYC27j) zo5a~0DE}8P{uN}4{RHB|zX`PS9;@cfqylSD_Sqg|qK|6ywsK8vchp+FJ#*F3O!^Kq zvmauQfIbVYJOX;)9&3iQKo`p)*O|)bnCPRK1?)LZDf(TzV(4l*3;HKZFFWqBUT7nA z1w@B^Hs1}_%aYQ(>w5V-^zwe(Y9sepFQfz7EquatrZPI77;wFiUhd9aG!JPjp#QeC za{pI=R(4@Lw29t6viWYX~2Gtybl_nWFW)$SObS2kfc>>#`f8I zOV@=ND`k}ejVE<{-mG + +
+

Build Log

+

+--------------------Configuration: TileEngine - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP58.tmp" with contents +[ +/nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/TileEngine.pch" /YX"TileEngine All.h" /Fo"Release/" /Fd"Release/" /FD /O2b2 /c +"C:\ja2\build\TileEngine\Ambient Control.cpp" +"C:\ja2\build\TileEngine\Buildings.cpp" +"C:\ja2\build\TileEngine\environment.cpp" +"C:\ja2\build\TileEngine\Exit Grids.cpp" +"C:\ja2\build\TileEngine\Explosion Control.cpp" +"C:\ja2\build\TileEngine\Fog Of War.cpp" +"C:\ja2\build\TileEngine\Interactive Tiles.cpp" +"C:\ja2\build\TileEngine\Isometric Utils.cpp" +"C:\ja2\build\TileEngine\LightEffects.cpp" +"C:\ja2\build\TileEngine\lighting.cpp" +"C:\ja2\build\TileEngine\Map Edgepoints.cpp" +"C:\ja2\build\TileEngine\overhead map.cpp" +"C:\ja2\build\TileEngine\phys math.cpp" +"C:\ja2\build\TileEngine\physics.cpp" +"C:\ja2\build\TileEngine\pits.cpp" +"C:\ja2\build\TileEngine\Radar Screen.cpp" +"C:\ja2\build\TileEngine\Render Dirty.cpp" +"C:\ja2\build\TileEngine\Render Fun.cpp" +"C:\ja2\build\TileEngine\renderworld.cpp" +"C:\ja2\build\TileEngine\SaveLoadMap.cpp" +"C:\ja2\build\TileEngine\Shade Table Util.cpp" +"C:\ja2\build\TileEngine\Simple Render Utils.cpp" +"C:\ja2\build\TileEngine\Smell.cpp" +"C:\ja2\build\TileEngine\SmokeEffects.cpp" +"C:\ja2\build\TileEngine\structure.cpp" +"C:\ja2\build\TileEngine\sysutil.cpp" +"C:\ja2\build\TileEngine\Tactical Placement GUI.cpp" +"C:\ja2\build\TileEngine\Tile Animation.cpp" +"C:\ja2\build\TileEngine\Tile Cache.cpp" +"C:\ja2\build\TileEngine\Tile Surface.cpp" +"C:\ja2\build\TileEngine\TileDat.cpp" +"C:\ja2\build\TileEngine\tiledef.cpp" +"C:\ja2\build\TileEngine\WorldDat.cpp" +"C:\ja2\build\TileEngine\worlddef.cpp" +"C:\ja2\build\TileEngine\worldman.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP58.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP59.tmp" with contents +[ +/nologo /out:"Release\TileEngine.lib" +".\Release\Ambient Control.obj" +.\Release\Buildings.obj +.\Release\environment.obj +".\Release\Exit Grids.obj" +".\Release\Explosion Control.obj" +".\Release\Fog Of War.obj" +".\Release\Interactive Tiles.obj" +".\Release\Isometric Utils.obj" +.\Release\LightEffects.obj +.\Release\lighting.obj +".\Release\Map Edgepoints.obj" +".\Release\overhead map.obj" +".\Release\phys math.obj" +.\Release\physics.obj +.\Release\pits.obj +".\Release\Radar Screen.obj" +".\Release\Render Dirty.obj" +".\Release\Render Fun.obj" +.\Release\renderworld.obj +.\Release\SaveLoadMap.obj +".\Release\Shade Table Util.obj" +".\Release\Simple Render Utils.obj" +.\Release\Smell.obj +.\Release\SmokeEffects.obj +.\Release\structure.obj +.\Release\sysutil.obj +".\Release\Tactical Placement GUI.obj" +".\Release\Tile Animation.obj" +".\Release\Tile Cache.obj" +".\Release\Tile Surface.obj" +.\Release\TileDat.obj +.\Release\tiledef.obj +.\Release\WorldDat.obj +.\Release\worlddef.obj +.\Release\worldman.obj +] +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP59.tmp" +

Output Window

+Compiling... +Ambient Control.cpp +GENERATED PCH FOR TILEENGINE PROJECT. +Buildings.cpp +environment.cpp +Exit Grids.cpp +Explosion Control.cpp +Fog Of War.cpp +Interactive Tiles.cpp +Isometric Utils.cpp +LightEffects.cpp +lighting.cpp +Map Edgepoints.cpp +overhead map.cpp +phys math.cpp +physics.cpp +pits.cpp +Radar Screen.cpp +Render Dirty.cpp +Render Fun.cpp +renderworld.cpp +SaveLoadMap.cpp +Shade Table Util.cpp +Simple Render Utils.cpp +Smell.cpp +SmokeEffects.cpp +structure.cpp +sysutil.cpp +Tactical Placement GUI.cpp +Tile Animation.cpp +Tile Cache.cpp +Tile Surface.cpp +TileDat.cpp +tiledef.cpp +WorldDat.cpp +worlddef.cpp +worldman.cpp +Creating library... +

+--------------------Configuration: Standard Gaming Platform - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5A.tmp" with contents +[ +/nologo /MT /W3 /GX /O2 /I "..\\" /I "..\TileEngine" /I "..\Tactical" /I "..\Utils" /I "..\strategic" /I ".\\" /D "NO_ZLIB" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR".\Release/" /Fp".\Release/Standard Gaming Platform.pch" /YX"JA2 SGP ALL.H" /Fo".\Release/" /Fd".\Release/" /FD /c +"C:\ja2\build\Standard Gaming Platform\Button Sound Control.cpp" +"C:\ja2\build\Standard Gaming Platform\Button System.cpp" +"C:\ja2\build\Standard Gaming Platform\Container.cpp" +"C:\ja2\build\Standard Gaming Platform\Cursor Control.cpp" +"C:\ja2\build\Standard Gaming Platform\DbMan.cpp" +"C:\ja2\build\Standard Gaming Platform\DirectDraw Calls.cpp" +"C:\ja2\build\Standard Gaming Platform\DirectX Common.cpp" +"C:\ja2\build\Standard Gaming Platform\English.cpp" +"C:\ja2\build\Standard Gaming Platform\ExceptionHandling.cpp" +"C:\ja2\build\Standard Gaming Platform\FileCat.cpp" +"C:\ja2\build\Standard Gaming Platform\FileMan.cpp" +"C:\ja2\build\Standard Gaming Platform\Font.cpp" +"C:\ja2\build\Standard Gaming Platform\himage.cpp" +"C:\ja2\build\Standard Gaming Platform\impTGA.cpp" +"C:\ja2\build\Standard Gaming Platform\input.cpp" +"C:\ja2\build\Standard Gaming Platform\Install.cpp" +"C:\ja2\build\Standard Gaming Platform\LibraryDataBase.cpp" +"C:\ja2\build\Standard Gaming Platform\line.cpp" +"C:\ja2\build\Standard Gaming Platform\MemMan.cpp" +"C:\ja2\build\Standard Gaming Platform\mousesystem.cpp" +"C:\ja2\build\Standard Gaming Platform\Mutex Manager.cpp" +"C:\ja2\build\Standard Gaming Platform\PCX.cpp" +"C:\ja2\build\Standard Gaming Platform\Random.cpp" +"C:\ja2\build\Standard Gaming Platform\readdir.cpp" +"C:\ja2\build\Standard Gaming Platform\RegInst.cpp" +"C:\ja2\build\Standard Gaming Platform\sgp.cpp" +"C:\ja2\build\Standard Gaming Platform\shading.cpp" +"C:\ja2\build\Standard Gaming Platform\soundman.cpp" +"C:\ja2\build\Standard Gaming Platform\STCI.cpp" +"C:\ja2\build\Standard Gaming Platform\stringicmp.cpp" +"C:\ja2\build\Standard Gaming Platform\timer.cpp" +"C:\ja2\build\Standard Gaming Platform\video.cpp" +"C:\ja2\build\Standard Gaming Platform\vobject.cpp" +"C:\ja2\build\Standard Gaming Platform\vobject_blitters.cpp" +"C:\ja2\build\Standard Gaming Platform\vsurface.cpp" +"C:\ja2\build\Standard Gaming Platform\WinFont.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5A.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5B.tmp" with contents +[ +/nologo /MT /W3 /GX /O2 /I "..\\" /I "..\TileEngine" /I "..\Tactical" /I "..\Utils" /I "..\strategic" /I ".\\" /D "NO_ZLIB" /D "JA2_PRECOMPILED_HEADERS" /D "NO_ZLIB_COMPRESSION" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /D "_DEBUG" /FR".\Release/" /Fp".\Release/Standard Gaming Platform.pch" /YX"JA2 SGP ALL.H" /Fo".\Release/" /Fd".\Release/" /FD /c +"C:\ja2\build\Standard Gaming Platform\DEBUG.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5B.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5C.tmp" with contents +[ +/nologo /out:".\Release\Standard Gaming Platform.lib" +".\Release\Button Sound Control.obj" +".\Release\Button System.obj" +".\Release\Container.obj" +".\Release\Cursor Control.obj" +".\Release\DbMan.obj" +".\Release\DEBUG.obj" +".\Release\DirectDraw Calls.obj" +".\Release\DirectX Common.obj" +".\Release\English.obj" +".\Release\ExceptionHandling.obj" +".\Release\FileCat.obj" +".\Release\FileMan.obj" +".\Release\Font.obj" +".\Release\himage.obj" +".\Release\impTGA.obj" +".\Release\input.obj" +".\Release\Install.obj" +".\Release\LibraryDataBase.obj" +".\Release\line.obj" +".\Release\MemMan.obj" +".\Release\mousesystem.obj" +".\Release\Mutex Manager.obj" +".\Release\PCX.obj" +".\Release\Random.obj" +".\Release\readdir.obj" +".\Release\RegInst.obj" +".\Release\sgp.obj" +".\Release\shading.obj" +".\Release\soundman.obj" +".\Release\STCI.obj" +".\Release\stringicmp.obj" +".\Release\timer.obj" +".\Release\video.obj" +".\Release\vobject.obj" +".\Release\vobject_blitters.obj" +".\Release\vsurface.obj" +".\Release\WinFont.obj" +".\ddraw.lib" +] +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5C.tmp" +

Output Window

+Compiling... +Button Sound Control.cpp +GENERATED PCH FOR JA2 SGP PROJECT. +Button System.cpp +Container.cpp +Cursor Control.cpp +DbMan.cpp +DirectDraw Calls.cpp +DirectX Common.cpp +GENERATED PCH FOR JA2 SGP PROJECT. +English.cpp +GENERATED PCH FOR JA2 SGP PROJECT. +ExceptionHandling.cpp +FileCat.cpp +FileMan.cpp +GENERATED PCH FOR JA2 SGP PROJECT. +Font.cpp +himage.cpp +impTGA.cpp +input.cpp +Install.cpp +LibraryDataBase.cpp +line.cpp +MemMan.cpp +mousesystem.cpp +GENERATED PCH FOR JA2 SGP PROJECT. +Mutex Manager.cpp +PCX.cpp +Random.cpp +readdir.cpp +RegInst.cpp +GENERATED PCH FOR JA2 SGP PROJECT. +sgp.cpp +shading.cpp +soundman.cpp +TEMP! +STCI.cpp +stringicmp.cpp +timer.cpp +GENERATED PCH FOR JA2 SGP PROJECT. +video.cpp +vobject.cpp +vobject_blitters.cpp +vsurface.cpp +WinFont.cpp +Compiling... +DEBUG.cpp +GENERATED PCH FOR JA2 SGP PROJECT. +Creating library... +

+--------------------Configuration: Tactical - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5D.tmp" with contents +[ +/nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /FR"Release/" /Fp"Release/Tactical.pch" /YX"Tactical All.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\ja2\build\Tactical\Air Raid.cpp" +"C:\ja2\build\Tactical\Animation Cache.cpp" +"C:\ja2\build\Tactical\Animation Control.cpp" +"C:\ja2\build\Tactical\Animation Data.cpp" +"C:\ja2\build\Tactical\Arms Dealer Init.cpp" +"C:\ja2\build\Tactical\ArmsDealerInvInit.cpp" +"C:\ja2\build\Tactical\Auto Bandage.cpp" +"C:\ja2\build\Tactical\Boxing.cpp" +"C:\ja2\build\Tactical\bullets.cpp" +"C:\ja2\build\Tactical\Campaign.cpp" +"C:\ja2\build\Tactical\Civ Quotes.cpp" +"C:\ja2\build\Tactical\Dialogue Control.cpp" +"C:\ja2\build\Tactical\DisplayCover.cpp" +"C:\ja2\build\Tactical\Drugs And Alcohol.cpp" +"C:\ja2\build\Tactical\End Game.cpp" +"C:\ja2\build\Tactical\Enemy Soldier Save.cpp" +"C:\ja2\build\Tactical\Faces.cpp" +"C:\ja2\build\Tactical\fov.cpp" +"C:\ja2\build\Tactical\GAP.cpp" +"C:\ja2\build\Tactical\Handle Doors.cpp" +"C:\ja2\build\Tactical\Handle Items.cpp" +"C:\ja2\build\Tactical\Handle UI Plan.cpp" +"C:\ja2\build\Tactical\Handle UI.cpp" +"C:\ja2\build\Tactical\Interface Control.cpp" +"C:\ja2\build\Tactical\Interface Cursors.cpp" +"C:\ja2\build\Tactical\Interface Dialogue.cpp" +"C:\ja2\build\Tactical\Interface Items.cpp" +"C:\ja2\build\Tactical\Interface Panels.cpp" +"C:\ja2\build\Tactical\Interface Utils.cpp" +"C:\ja2\build\Tactical\Interface.cpp" +"C:\ja2\build\Tactical\Inventory Choosing.cpp" +"C:\ja2\build\Tactical\Items.cpp" +"C:\ja2\build\Tactical\Keys.cpp" +"C:\ja2\build\Tactical\Map Information.cpp" +"C:\ja2\build\Tactical\Merc Entering.cpp" +"C:\ja2\build\Tactical\Merc Hiring.cpp" +"C:\ja2\build\Tactical\Militia Control.cpp" +"C:\ja2\build\Tactical\Morale.cpp" +"C:\ja2\build\Tactical\opplist.cpp" +"C:\ja2\build\Tactical\Overhead.cpp" +"C:\ja2\build\Tactical\PATHAI.cpp" +"C:\ja2\build\Tactical\Points.cpp" +"C:\ja2\build\Tactical\QARRAY.cpp" +"C:\ja2\build\Tactical\Real Time Input.cpp" +"C:\ja2\build\Tactical\Rotting Corpses.cpp" +"C:\ja2\build\Tactical\ShopKeeper Interface.cpp" +"C:\ja2\build\Tactical\SkillCheck.cpp" +"C:\ja2\build\Tactical\Soldier Add.cpp" +"C:\ja2\build\Tactical\Soldier Ani.cpp" +"C:\ja2\build\Tactical\Soldier Control.cpp" +"C:\ja2\build\Tactical\Soldier Create.cpp" +"C:\ja2\build\Tactical\Soldier Find.cpp" +"C:\ja2\build\Tactical\Soldier Init List.cpp" +"C:\ja2\build\Tactical\Soldier Profile.cpp" +"C:\ja2\build\Tactical\Soldier Tile.cpp" +"C:\ja2\build\Tactical\Spread Burst.cpp" +"C:\ja2\build\Tactical\Squads.cpp" +"C:\ja2\build\Tactical\Strategic Exit GUI.cpp" +"C:\ja2\build\Tactical\Structure Wrap.cpp" +"C:\ja2\build\Tactical\Tactical Save.cpp" +"C:\ja2\build\Tactical\Tactical Turns.cpp" +"C:\ja2\build\Tactical\TeamTurns.cpp" +"C:\ja2\build\Tactical\Turn Based Input.cpp" +"C:\ja2\build\Tactical\UI Cursors.cpp" +"C:\ja2\build\Tactical\Vehicles.cpp" +"C:\ja2\build\Tactical\Weapons.cpp" +"C:\ja2\build\Tactical\World Items.cpp" +"C:\ja2\build\Tactical\XML_Armour.cpp" +"C:\ja2\build\Tactical\XML_AttachmentInfo.cpp" +"C:\ja2\build\Tactical\XML_Attachments.cpp" +"C:\ja2\build\Tactical\XML_BurstSoundStrings.cpp" +"C:\ja2\build\Tactical\XML_ComboMergeInfo.cpp" +"C:\ja2\build\Tactical\XML_CompatibleFaceItems.cpp" +"C:\ja2\build\Tactical\XML_EnemyItemChoice.cpp" +"C:\ja2\build\Tactical\XML_EnemyWeaponChoice.cpp" +"C:\ja2\build\Tactical\XML_Explosive.cpp" +"C:\ja2\build\Tactical\XML_IMPItemChoices.cpp" +"C:\ja2\build\Tactical\XML_IncompatibleAttachments.cpp" +"C:\ja2\build\Tactical\XML_Launchable.cpp" +"C:\ja2\build\Tactical\XML_Magazine.cpp" +"C:\ja2\build\Tactical\XML_Merge.cpp" +"C:\ja2\build\Tactical\XML_Sounds.cpp" +"C:\ja2\build\Tactical\XML_TonyInventory.cpp" +"C:\ja2\build\Tactical\XML_AmmoTypes.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5D.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5E.tmp" with contents +[ +/nologo /MT /W3 /GX /Od /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /FR"Release/" /Fp"Release/Tactical.pch" /YX"Tactical All.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\ja2\build\Tactical\LOS.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5E.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5F.tmp" with contents +[ +/nologo /out:"Release\Tactical.lib" +".\Release\Air Raid.obj" +".\Release\Animation Cache.obj" +".\Release\Animation Control.obj" +".\Release\Animation Data.obj" +".\Release\Arms Dealer Init.obj" +.\Release\ArmsDealerInvInit.obj +".\Release\Auto Bandage.obj" +.\Release\Boxing.obj +.\Release\bullets.obj +.\Release\Campaign.obj +".\Release\Civ Quotes.obj" +".\Release\Dialogue Control.obj" +.\Release\DisplayCover.obj +".\Release\Drugs And Alcohol.obj" +".\Release\End Game.obj" +".\Release\Enemy Soldier Save.obj" +.\Release\Faces.obj +.\Release\fov.obj +.\Release\GAP.obj +".\Release\Handle Doors.obj" +".\Release\Handle Items.obj" +".\Release\Handle UI Plan.obj" +".\Release\Handle UI.obj" +".\Release\Interface Control.obj" +".\Release\Interface Cursors.obj" +".\Release\Interface Dialogue.obj" +".\Release\Interface Items.obj" +".\Release\Interface Panels.obj" +".\Release\Interface Utils.obj" +.\Release\Interface.obj +".\Release\Inventory Choosing.obj" +.\Release\Items.obj +.\Release\Keys.obj +.\Release\LOS.obj +".\Release\Map Information.obj" +".\Release\Merc Entering.obj" +".\Release\Merc Hiring.obj" +".\Release\Militia Control.obj" +.\Release\Morale.obj +.\Release\opplist.obj +.\Release\Overhead.obj +.\Release\PATHAI.obj +.\Release\Points.obj +.\Release\QARRAY.obj +".\Release\Real Time Input.obj" +".\Release\Rotting Corpses.obj" +".\Release\ShopKeeper Interface.obj" +.\Release\SkillCheck.obj +".\Release\Soldier Add.obj" +".\Release\Soldier Ani.obj" +".\Release\Soldier Control.obj" +".\Release\Soldier Create.obj" +".\Release\Soldier Find.obj" +".\Release\Soldier Init List.obj" +".\Release\Soldier Profile.obj" +".\Release\Soldier Tile.obj" +".\Release\Spread Burst.obj" +.\Release\Squads.obj +".\Release\Strategic Exit GUI.obj" +".\Release\Structure Wrap.obj" +".\Release\Tactical Save.obj" +".\Release\Tactical Turns.obj" +.\Release\TeamTurns.obj +".\Release\Turn Based Input.obj" +".\Release\UI Cursors.obj" +.\Release\Vehicles.obj +.\Release\Weapons.obj +".\Release\World Items.obj" +.\Release\XML_Armour.obj +.\Release\XML_AttachmentInfo.obj +.\Release\XML_Attachments.obj +.\Release\XML_BurstSoundStrings.obj +.\Release\XML_ComboMergeInfo.obj +.\Release\XML_CompatibleFaceItems.obj +.\Release\XML_EnemyItemChoice.obj +.\Release\XML_EnemyWeaponChoice.obj +.\Release\XML_Explosive.obj +.\Release\XML_IMPItemChoices.obj +.\Release\XML_IncompatibleAttachments.obj +.\Release\XML_Launchable.obj +.\Release\XML_Magazine.obj +.\Release\XML_Merge.obj +.\Release\XML_Sounds.obj +.\Release\XML_TonyInventory.obj +.\Release\XML_AmmoTypes.obj +] +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP5F.tmp" +

Output Window

+Compiling... +Air Raid.cpp +GENERATED PCH FOR TACTICAL PROJECT. +Animation Cache.cpp +Animation Control.cpp +Animation Data.cpp +Arms Dealer Init.cpp +ArmsDealerInvInit.cpp +Auto Bandage.cpp +Boxing.cpp +bullets.cpp +Campaign.cpp +Civ Quotes.cpp +Dialogue Control.cpp +DisplayCover.cpp +GENERATED PCH FOR TACTICAL AI PROJECT. +Drugs And Alcohol.cpp +GENERATED PCH FOR TACTICAL PROJECT. +End Game.cpp +Enemy Soldier Save.cpp +Faces.cpp +fov.cpp +GAP.cpp +Handle Doors.cpp +Handle Items.cpp +Handle UI Plan.cpp +Handle UI.cpp +Interface Control.cpp +Interface Cursors.cpp +Interface Dialogue.cpp +Interface Items.cpp +Interface Panels.cpp +Interface Utils.cpp +Interface.cpp +Inventory Choosing.cpp +Items.cpp +Keys.cpp +Map Information.cpp +Merc Entering.cpp +Merc Hiring.cpp +Militia Control.cpp +Morale.cpp +opplist.cpp +Overhead.cpp +PATHAI.cpp +Points.cpp +QARRAY.cpp +Real Time Input.cpp +Rotting Corpses.cpp +ShopKeeper Interface.cpp +SkillCheck.cpp +Soldier Add.cpp +Soldier Ani.cpp +Soldier Control.cpp +Soldier Create.cpp +Soldier Find.cpp +Soldier Init List.cpp +Soldier Profile.cpp +Soldier Tile.cpp +Spread Burst.cpp +Squads.cpp +Strategic Exit GUI.cpp +Structure Wrap.cpp +Tactical Save.cpp +Tactical Turns.cpp +TeamTurns.cpp +Turn Based Input.cpp +UI Cursors.cpp +Vehicles.cpp +Weapons.cpp +World Items.cpp +XML_Armour.cpp +XML_AttachmentInfo.cpp +XML_Attachments.cpp +XML_BurstSoundStrings.cpp +XML_ComboMergeInfo.cpp +XML_CompatibleFaceItems.cpp +XML_EnemyItemChoice.cpp +XML_EnemyWeaponChoice.cpp +XML_Explosive.cpp +XML_IMPItemChoices.cpp +XML_IncompatibleAttachments.cpp +XML_Launchable.cpp +XML_Magazine.cpp +XML_Merge.cpp +XML_Sounds.cpp +XML_TonyInventory.cpp +XML_AmmoTypes.cpp +Compiling... +LOS.cpp +GENERATED PCH FOR TACTICAL PROJECT. +Creating library... +

+--------------------Configuration: Utils - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP60.tmp" with contents +[ +/nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/Utils.pch" /YX"Utils All.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\ja2\build\Utils\_DutchText.cpp" +"C:\ja2\build\Utils\_EnglishText.cpp" +"C:\ja2\build\Utils\_FrenchText.cpp" +"C:\ja2\build\Utils\_GermanText.cpp" +"C:\ja2\build\Utils\_ItalianText.cpp" +"C:\ja2\build\Utils\_Ja25EnglishText.cpp" +"C:\ja2\build\Utils\_Ja25GermanText.cpp" +"C:\ja2\build\Utils\_PolishText.cpp" +"C:\ja2\build\Utils\_RussianText.cpp" +"C:\ja2\build\Utils\Animated ProgressBar.cpp" +"C:\ja2\build\Utils\Cinematics.cpp" +"C:\ja2\build\Utils\Cursors.cpp" +"C:\ja2\build\Utils\Debug Control.cpp" +"C:\ja2\build\Utils\dsutil.cpp" +"C:\ja2\build\Utils\Encrypted File.cpp" +"C:\ja2\build\Utils\Event Manager.cpp" +"C:\ja2\build\Utils\Event Pump.cpp" +"C:\ja2\build\Utils\Font Control.cpp" +"C:\ja2\build\Utils\INIReader.cpp" +"C:\ja2\build\Utils\MapUtility.cpp" +"C:\ja2\build\Utils\MercTextBox.cpp" +"C:\ja2\build\Utils\message.cpp" +"C:\ja2\build\Utils\Multi Language Graphic Utils.cpp" +"C:\ja2\build\Utils\Multilingual Text Code Generator.cpp" +"C:\ja2\build\Utils\Music Control.cpp" +"C:\ja2\build\Utils\PopUpBox.cpp" +"C:\ja2\build\Utils\Quantize Wrap.cpp" +"C:\ja2\build\Utils\Quantize.cpp" +"C:\ja2\build\Utils\Slider.cpp" +"C:\ja2\build\Utils\Sound Control.cpp" +"C:\ja2\build\Utils\STIConvert.cpp" +"C:\ja2\build\Utils\Text Input.cpp" +"C:\ja2\build\Utils\Text Utils.cpp" +"C:\ja2\build\Utils\Timer Control.cpp" +"C:\ja2\build\Utils\Utilities.cpp" +"C:\ja2\build\Utils\WordWrap.cpp" +"C:\ja2\build\Utils\XML_Items.cpp" +"C:\ja2\build\Utils\XML_Strings.cpp" +"C:\ja2\build\Utils\XML_Strings2.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP60.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP61.tmp" with contents +[ +/nologo /out:"Release\Utils.lib" +.\Release\_DutchText.obj +.\Release\_EnglishText.obj +.\Release\_FrenchText.obj +.\Release\_GermanText.obj +.\Release\_ItalianText.obj +.\Release\_Ja25EnglishText.obj +.\Release\_Ja25GermanText.obj +.\Release\_PolishText.obj +.\Release\_RussianText.obj +".\Release\Animated ProgressBar.obj" +.\Release\Cinematics.obj +.\Release\Cursors.obj +".\Release\Debug Control.obj" +.\Release\dsutil.obj +".\Release\Encrypted File.obj" +".\Release\Event Manager.obj" +".\Release\Event Pump.obj" +".\Release\Font Control.obj" +.\Release\INIReader.obj +.\Release\MapUtility.obj +.\Release\MercTextBox.obj +.\Release\message.obj +".\Release\Multi Language Graphic Utils.obj" +".\Release\Multilingual Text Code Generator.obj" +".\Release\Music Control.obj" +.\Release\PopUpBox.obj +".\Release\Quantize Wrap.obj" +.\Release\Quantize.obj +.\Release\Slider.obj +".\Release\Sound Control.obj" +.\Release\STIConvert.obj +".\Release\Text Input.obj" +".\Release\Text Utils.obj" +".\Release\Timer Control.obj" +.\Release\Utilities.obj +.\Release\WordWrap.obj +.\Release\XML_Items.obj +.\Release\XML_Strings.obj +.\Release\XML_Strings2.obj +] +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP61.tmp" +

Output Window

+Compiling... +_DutchText.cpp +GENERATED PCH FOR UTILS PROJECT. +_EnglishText.cpp +GENERATED PCH FOR UTILS PROJECT. +_FrenchText.cpp +_GermanText.cpp +_ItalianText.cpp +GENERATED PCH FOR UTILS PROJECT. +_Ja25EnglishText.cpp +GENERATED PCH FOR UTILS PROJECT. +_Ja25GermanText.cpp +_PolishText.cpp +GENERATED PCH FOR UTILS PROJECT. +_RussianText.cpp +Animated ProgressBar.cpp +GENERATED PCH FOR UTILS PROJECT. +Cinematics.cpp +Cursors.cpp +GENERATED PCH FOR UTILS PROJECT. +Debug Control.cpp +dsutil.cpp +Encrypted File.cpp +Event Manager.cpp +Event Pump.cpp +Font Control.cpp +INIReader.cpp +MapUtility.cpp +GENERATED PCH FOR UTILS PROJECT. +MercTextBox.cpp +message.cpp +Multi Language Graphic Utils.cpp +GENERATED PCH FOR UTILS PROJECT. +Multilingual Text Code Generator.cpp +Music Control.cpp +GENERATED PCH FOR UTILS PROJECT. +PopUpBox.cpp +Quantize Wrap.cpp +Quantize.cpp +Slider.cpp +GENERATED PCH FOR UTILS PROJECT. +Sound Control.cpp +STIConvert.cpp +Text Input.cpp +Text Utils.cpp +Timer Control.cpp +Utilities.cpp +WordWrap.cpp +XML_Items.cpp +GENERATED PCH FOR TACTICAL PROJECT. +XML_Strings.cpp +XML_Strings2.cpp +Creating library... +

+--------------------Configuration: TacticalAI - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP62.tmp" with contents +[ +/nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\Editor" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/TacticalAI.pch" /YX"AI All.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\ja2\build\TacticalAI\AIList.cpp" +"C:\ja2\build\TacticalAI\AIMain.cpp" +"C:\ja2\build\TacticalAI\AIUtils.cpp" +"C:\ja2\build\TacticalAI\Attacks.cpp" +"C:\ja2\build\TacticalAI\CreatureDecideAction.cpp" +"C:\ja2\build\TacticalAI\DecideAction.cpp" +"C:\ja2\build\TacticalAI\FindLocations.cpp" +"C:\ja2\build\TacticalAI\Knowledge.cpp" +"C:\ja2\build\TacticalAI\Medical.cpp" +"C:\ja2\build\TacticalAI\Movement.cpp" +"C:\ja2\build\TacticalAI\NPC.cpp" +"C:\ja2\build\TacticalAI\PanicButtons.cpp" +"C:\ja2\build\TacticalAI\QuestDebug.cpp" +"C:\ja2\build\TacticalAI\Realtime.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP62.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP63.tmp" with contents +[ +/nologo /out:"Release\TacticalAI.lib" +.\Release\AIList.obj +.\Release\AIMain.obj +.\Release\AIUtils.obj +.\Release\Attacks.obj +.\Release\CreatureDecideAction.obj +.\Release\DecideAction.obj +.\Release\FindLocations.obj +.\Release\Knowledge.obj +.\Release\Medical.obj +.\Release\Movement.obj +.\Release\NPC.obj +.\Release\PanicButtons.obj +.\Release\QuestDebug.obj +.\Release\Realtime.obj +] +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP63.tmp" +

Output Window

+Compiling... +AIList.cpp +GENERATED PCH FOR TACTICAL AI PROJECT. +AIMain.cpp +AIUtils.cpp +Attacks.cpp +CreatureDecideAction.cpp +DecideAction.cpp +FindLocations.cpp +Knowledge.cpp +Medical.cpp +Movement.cpp +NPC.cpp +PanicButtons.cpp +QuestDebug.cpp +Realtime.cpp +Creating library... +

+--------------------Configuration: Editor - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP64.tmp" with contents +[ +/nologo /MT /W3 /GX /O2 /Ob2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\strategic" /I "..\Laptop" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/Editor.pch" /YX"Editor All.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\ja2\build\Editor\Cursor Modes.cpp" +"C:\ja2\build\Editor\edit_sys.cpp" +"C:\ja2\build\Editor\Editor Callbacks.cpp" +"C:\ja2\build\Editor\Editor Modes.cpp" +"C:\ja2\build\Editor\Editor Taskbar Creation.cpp" +"C:\ja2\build\Editor\Editor Taskbar Utils.cpp" +"C:\ja2\build\Editor\Editor Undo.cpp" +"C:\ja2\build\Editor\EditorBuildings.cpp" +"C:\ja2\build\Editor\EditorItems.cpp" +"C:\ja2\build\Editor\EditorMapInfo.cpp" +"C:\ja2\build\Editor\EditorMercs.cpp" +"C:\ja2\build\Editor\EditorTerrain.cpp" +"C:\ja2\build\Editor\editscreen.cpp" +"C:\ja2\build\Editor\Item Statistics.cpp" +"C:\ja2\build\Editor\LoadScreen.cpp" +"C:\ja2\build\Editor\messagebox.cpp" +"C:\ja2\build\Editor\newsmooth.cpp" +"C:\ja2\build\Editor\popupmenu.cpp" +"C:\ja2\build\Editor\Road Smoothing.cpp" +"C:\ja2\build\Editor\Sector Summary.cpp" +"C:\ja2\build\Editor\selectwin.cpp" +"C:\ja2\build\Editor\SmartMethod.cpp" +"C:\ja2\build\Editor\smooth.cpp" +"C:\ja2\build\Editor\Smoothing Utils.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP64.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP65.tmp" with contents +[ +/nologo /out:"Release\Editor.lib" +".\Release\Cursor Modes.obj" +.\Release\edit_sys.obj +".\Release\Editor Callbacks.obj" +".\Release\Editor Modes.obj" +".\Release\Editor Taskbar Creation.obj" +".\Release\Editor Taskbar Utils.obj" +".\Release\Editor Undo.obj" +.\Release\EditorBuildings.obj +.\Release\EditorItems.obj +.\Release\EditorMapInfo.obj +.\Release\EditorMercs.obj +.\Release\EditorTerrain.obj +.\Release\editscreen.obj +".\Release\Item Statistics.obj" +.\Release\LoadScreen.obj +.\Release\messagebox.obj +.\Release\newsmooth.obj +.\Release\popupmenu.obj +".\Release\Road Smoothing.obj" +".\Release\Sector Summary.obj" +.\Release\selectwin.obj +.\Release\SmartMethod.obj +.\Release\smooth.obj +".\Release\Smoothing Utils.obj" +] +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP65.tmp" +

Output Window

+Compiling... +Cursor Modes.cpp +edit_sys.cpp +Editor Callbacks.cpp +Editor Modes.cpp +Editor Taskbar Creation.cpp +Editor Taskbar Utils.cpp +Editor Undo.cpp +EditorBuildings.cpp +EditorItems.cpp +EditorMapInfo.cpp +EditorMercs.cpp +EditorTerrain.cpp +editscreen.cpp +Item Statistics.cpp +LoadScreen.cpp +messagebox.cpp +newsmooth.cpp +popupmenu.cpp +Road Smoothing.cpp +Sector Summary.cpp +selectwin.cpp +SmartMethod.cpp +smooth.cpp +Smoothing Utils.cpp +Creating library... +

+--------------------Configuration: Laptop - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP66.tmp" with contents +[ +/nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/Laptop.pch" /YX"Laptop All.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\ja2\build\Laptop\aim.cpp" +"C:\ja2\build\Laptop\AimArchives.cpp" +"C:\ja2\build\Laptop\AimFacialIndex.cpp" +"C:\ja2\build\Laptop\AimHistory.cpp" +"C:\ja2\build\Laptop\AimLinks.cpp" +"C:\ja2\build\Laptop\AimMembers.cpp" +"C:\ja2\build\Laptop\AimPolicies.cpp" +"C:\ja2\build\Laptop\AimSort.cpp" +"C:\ja2\build\Laptop\BobbyR.cpp" +"C:\ja2\build\Laptop\BobbyRAmmo.cpp" +"C:\ja2\build\Laptop\BobbyRArmour.cpp" +"C:\ja2\build\Laptop\BobbyRGuns.cpp" +"C:\ja2\build\Laptop\BobbyRMailOrder.cpp" +"C:\ja2\build\Laptop\BobbyRMisc.cpp" +"C:\ja2\build\Laptop\BobbyRShipments.cpp" +"C:\ja2\build\Laptop\BobbyRUsed.cpp" +"C:\ja2\build\Laptop\BrokenLink.cpp" +"C:\ja2\build\Laptop\CharProfile.cpp" +"C:\ja2\build\Laptop\email.cpp" +"C:\ja2\build\Laptop\files.cpp" +"C:\ja2\build\Laptop\finances.cpp" +"C:\ja2\build\Laptop\florist Cards.cpp" +"C:\ja2\build\Laptop\florist Gallery.cpp" +"C:\ja2\build\Laptop\florist Order Form.cpp" +"C:\ja2\build\Laptop\florist.cpp" +"C:\ja2\build\Laptop\funeral.cpp" +"C:\ja2\build\Laptop\history.cpp" +"C:\ja2\build\Laptop\IMP AboutUs.cpp" +"C:\ja2\build\Laptop\IMP Attribute Entrance.cpp" +"C:\ja2\build\Laptop\IMP Attribute Finish.cpp" +"C:\ja2\build\Laptop\IMP Attribute Selection.cpp" +"C:\ja2\build\Laptop\IMP Begin Screen.cpp" +"C:\ja2\build\Laptop\IMP Compile Character.cpp" +"C:\ja2\build\Laptop\IMP Confirm.cpp" +"C:\ja2\build\Laptop\IMP Finish.cpp" +"C:\ja2\build\Laptop\IMP HomePage.cpp" +"C:\ja2\build\Laptop\IMP MainPage.cpp" +"C:\ja2\build\Laptop\IMP Personality Entrance.cpp" +"C:\ja2\build\Laptop\IMP Personality Finish.cpp" +"C:\ja2\build\Laptop\IMP Personality Quiz.cpp" +"C:\ja2\build\Laptop\IMP Portraits.cpp" +"C:\ja2\build\Laptop\IMP Skill Trait.cpp" +"C:\ja2\build\Laptop\IMP Text System.cpp" +"C:\ja2\build\Laptop\IMP Voices.cpp" +"C:\ja2\build\Laptop\IMPVideoObjects.cpp" +"C:\ja2\build\Laptop\insurance Comments.cpp" +"C:\ja2\build\Laptop\insurance Contract.cpp" +"C:\ja2\build\Laptop\insurance Info.cpp" +"C:\ja2\build\Laptop\insurance.cpp" +"C:\ja2\build\Laptop\laptop.cpp" +"C:\ja2\build\Laptop\mercs Account.cpp" +"C:\ja2\build\Laptop\mercs Files.cpp" +"C:\ja2\build\Laptop\mercs No Account.cpp" +"C:\ja2\build\Laptop\mercs.cpp" +"C:\ja2\build\Laptop\personnel.cpp" +"C:\ja2\build\Laptop\sirtech.cpp" +"C:\ja2\build\Laptop\Store Inventory.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP66.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP67.tmp" with contents +[ +/nologo /out:"Release\Laptop.lib" +.\Release\aim.obj +.\Release\AimArchives.obj +.\Release\AimFacialIndex.obj +.\Release\AimHistory.obj +.\Release\AimLinks.obj +.\Release\AimMembers.obj +.\Release\AimPolicies.obj +.\Release\AimSort.obj +.\Release\BobbyR.obj +.\Release\BobbyRAmmo.obj +.\Release\BobbyRArmour.obj +.\Release\BobbyRGuns.obj +.\Release\BobbyRMailOrder.obj +.\Release\BobbyRMisc.obj +.\Release\BobbyRShipments.obj +.\Release\BobbyRUsed.obj +.\Release\BrokenLink.obj +.\Release\CharProfile.obj +.\Release\email.obj +.\Release\files.obj +.\Release\finances.obj +".\Release\florist Cards.obj" +".\Release\florist Gallery.obj" +".\Release\florist Order Form.obj" +.\Release\florist.obj +.\Release\funeral.obj +.\Release\history.obj +".\Release\IMP AboutUs.obj" +".\Release\IMP Attribute Entrance.obj" +".\Release\IMP Attribute Finish.obj" +".\Release\IMP Attribute Selection.obj" +".\Release\IMP Begin Screen.obj" +".\Release\IMP Compile Character.obj" +".\Release\IMP Confirm.obj" +".\Release\IMP Finish.obj" +".\Release\IMP HomePage.obj" +".\Release\IMP MainPage.obj" +".\Release\IMP Personality Entrance.obj" +".\Release\IMP Personality Finish.obj" +".\Release\IMP Personality Quiz.obj" +".\Release\IMP Portraits.obj" +".\Release\IMP Skill Trait.obj" +".\Release\IMP Text System.obj" +".\Release\IMP Voices.obj" +.\Release\IMPVideoObjects.obj +".\Release\insurance Comments.obj" +".\Release\insurance Contract.obj" +".\Release\insurance Info.obj" +.\Release\insurance.obj +.\Release\laptop.obj +".\Release\mercs Account.obj" +".\Release\mercs Files.obj" +".\Release\mercs No Account.obj" +.\Release\mercs.obj +.\Release\personnel.obj +.\Release\sirtech.obj +".\Release\Store Inventory.obj" +] +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP67.tmp" +

Output Window

+Compiling... +aim.cpp +GENERATED PCH FOR LAPTOP PROJECT. +AimArchives.cpp +AimFacialIndex.cpp +AimHistory.cpp +AimLinks.cpp +AimMembers.cpp +AimPolicies.cpp +AimSort.cpp +BobbyR.cpp +BobbyRAmmo.cpp +BobbyRArmour.cpp +BobbyRGuns.cpp +BobbyRMailOrder.cpp +BobbyRMisc.cpp +BobbyRShipments.cpp +BobbyRUsed.cpp +BrokenLink.cpp +CharProfile.cpp +email.cpp +files.cpp +finances.cpp +florist Cards.cpp +florist Gallery.cpp +florist Order Form.cpp +florist.cpp +funeral.cpp +history.cpp +IMP AboutUs.cpp +IMP Attribute Entrance.cpp +IMP Attribute Finish.cpp +IMP Attribute Selection.cpp +IMP Begin Screen.cpp +IMP Compile Character.cpp +IMP Confirm.cpp +IMP Finish.cpp +IMP HomePage.cpp +IMP MainPage.cpp +IMP Personality Entrance.cpp +IMP Personality Finish.cpp +IMP Personality Quiz.cpp +IMP Portraits.cpp +IMP Skill Trait.cpp +IMP Text System.cpp +IMP Voices.cpp +IMPVideoObjects.cpp +insurance Comments.cpp +insurance Contract.cpp +insurance Info.cpp +insurance.cpp +laptop.cpp +mercs Account.cpp +mercs Files.cpp +mercs No Account.cpp +mercs.cpp +personnel.cpp +sirtech.cpp +Store Inventory.cpp +Creating library... +

+--------------------Configuration: Strategic - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP68.tmp" with contents +[ +/nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\Laptop" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/Strategic.pch" /YX"Strategic All.h" /Fo"Release/" /Fd"Release/" /FD /c +"C:\ja2\build\Strategic\AI Viewer.cpp" +"C:\ja2\build\Strategic\Assignments.cpp" +"C:\ja2\build\Strategic\Auto Resolve.cpp" +"C:\ja2\build\Strategic\Campaign Init.cpp" +"C:\ja2\build\Strategic\Creature Spreading.cpp" +"C:\ja2\build\Strategic\Game Clock.cpp" +"C:\ja2\build\Strategic\Game Event Hook.cpp" +"C:\ja2\build\Strategic\Game Events.cpp" +"C:\ja2\build\Strategic\Game Init.cpp" +"C:\ja2\build\Strategic\Hourly Update.cpp" +"C:\ja2\build\Strategic\Map Screen Helicopter.cpp" +"C:\ja2\build\Strategic\Map Screen Interface Border.cpp" +"C:\ja2\build\Strategic\Map Screen Interface Bottom.cpp" +"C:\ja2\build\Strategic\Map Screen Interface Map Inventory.cpp" +"C:\ja2\build\Strategic\Map Screen Interface Map.cpp" +"C:\ja2\build\Strategic\Map Screen Interface TownMine Info.cpp" +"C:\ja2\build\Strategic\Map Screen Interface.cpp" +"C:\ja2\build\Strategic\mapscreen.cpp" +"C:\ja2\build\Strategic\Meanwhile.cpp" +"C:\ja2\build\Strategic\Merc Contract.cpp" +"C:\ja2\build\Strategic\Player Command.cpp" +"C:\ja2\build\Strategic\PreBattle Interface.cpp" +"C:\ja2\build\Strategic\Queen Command.cpp" +"C:\ja2\build\Strategic\Quest Debug System.cpp" +"C:\ja2\build\Strategic\Quests.cpp" +"C:\ja2\build\Strategic\QuestText.cpp" +"C:\ja2\build\Strategic\Scheduling.cpp" +"C:\ja2\build\Strategic\Strategic AI.cpp" +"C:\ja2\build\Strategic\Strategic Event Handler.cpp" +"C:\ja2\build\Strategic\Strategic Merc Handler.cpp" +"C:\ja2\build\Strategic\Strategic Mines.cpp" +"C:\ja2\build\Strategic\Strategic Movement Costs.cpp" +"C:\ja2\build\Strategic\Strategic Movement.cpp" +"C:\ja2\build\Strategic\Strategic Pathing.cpp" +"C:\ja2\build\Strategic\Strategic Status.cpp" +"C:\ja2\build\Strategic\Strategic Town Loyalty.cpp" +"C:\ja2\build\Strategic\strategic town reputation.cpp" +"C:\ja2\build\Strategic\Strategic Turns.cpp" +"C:\ja2\build\Strategic\strategic.cpp" +"C:\ja2\build\Strategic\strategicmap.cpp" +"C:\ja2\build\Strategic\Town Militia.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP68.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP69.tmp" with contents +[ +/nologo /out:"Release\Strategic.lib" +".\Release\AI Viewer.obj" +.\Release\Assignments.obj +".\Release\Auto Resolve.obj" +".\Release\Campaign Init.obj" +".\Release\Creature Spreading.obj" +".\Release\Game Clock.obj" +".\Release\Game Event Hook.obj" +".\Release\Game Events.obj" +".\Release\Game Init.obj" +".\Release\Hourly Update.obj" +".\Release\Map Screen Helicopter.obj" +".\Release\Map Screen Interface Border.obj" +".\Release\Map Screen Interface Bottom.obj" +".\Release\Map Screen Interface Map Inventory.obj" +".\Release\Map Screen Interface Map.obj" +".\Release\Map Screen Interface TownMine Info.obj" +".\Release\Map Screen Interface.obj" +.\Release\mapscreen.obj +.\Release\Meanwhile.obj +".\Release\Merc Contract.obj" +".\Release\Player Command.obj" +".\Release\PreBattle Interface.obj" +".\Release\Queen Command.obj" +".\Release\Quest Debug System.obj" +.\Release\Quests.obj +.\Release\QuestText.obj +.\Release\Scheduling.obj +".\Release\Strategic AI.obj" +".\Release\Strategic Event Handler.obj" +".\Release\Strategic Merc Handler.obj" +".\Release\Strategic Mines.obj" +".\Release\Strategic Movement Costs.obj" +".\Release\Strategic Movement.obj" +".\Release\Strategic Pathing.obj" +".\Release\Strategic Status.obj" +".\Release\Strategic Town Loyalty.obj" +".\Release\strategic town reputation.obj" +".\Release\Strategic Turns.obj" +.\Release\strategic.obj +.\Release\strategicmap.obj +".\Release\Town Militia.obj" +] +Creating command line "link.exe -lib @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP69.tmp" +

Output Window

+Compiling... +AI Viewer.cpp +GENERATED PCH FOR STRATEGIC PROJECT. +Assignments.cpp +Auto Resolve.cpp +Campaign Init.cpp +Creature Spreading.cpp +Game Clock.cpp +Game Event Hook.cpp +Game Events.cpp +Game Init.cpp +Hourly Update.cpp +Map Screen Helicopter.cpp +Map Screen Interface Border.cpp +Map Screen Interface Bottom.cpp +Map Screen Interface Map Inventory.cpp +Map Screen Interface Map.cpp +Map Screen Interface TownMine Info.cpp +Map Screen Interface.cpp +mapscreen.cpp +Meanwhile.cpp +Merc Contract.cpp +Player Command.cpp +PreBattle Interface.cpp +Queen Command.cpp +Quest Debug System.cpp +Quests.cpp +QuestText.cpp +Scheduling.cpp +Strategic AI.cpp +Strategic Event Handler.cpp +Strategic Merc Handler.cpp +Strategic Mines.cpp +Strategic Movement Costs.cpp +Strategic Movement.cpp +Strategic Pathing.cpp +Strategic Status.cpp +Strategic Town Loyalty.cpp +strategic town reputation.cpp +Strategic Turns.cpp +strategic.cpp +strategicmap.cpp +Town Militia.cpp +Creating library... +

+--------------------Configuration: ja2 - Win32 Release-------------------- +

+

Command Lines

+Creating command line "rc.exe /l 0x409 /fo"Release/ja2.res" /i "Res" /i ".\Res" /d "NDEBUG" "C:\ja2\build\Res\ja2.rc"" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP6A.tmp" with contents +[ +/nologo /G5 /MT /W3 /GX /Zi /O2 /Ob2 /I ".\Standard Gaming Platform" /I ".\TileEngine" /I ".\Tactical" /I ".\Utils" /I ".\TacticalAI" /I ".\Editor" /I ".\Strategic" /I ".\laptop" /I ".\\" /D "CALLBACKTIMER" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"Release/" /Fp"Release/JA2.pch" /YX"JA2 All.h" /Fo"Release/" /Fd"Release/" /FD /O2b2 /c +"C:\ja2\build\Utils\_Ja25GermanText.cpp" +"C:\ja2\build\aniviewscreen.cpp" +"C:\ja2\build\Credits.cpp" +"C:\ja2\build\Utils\Cursors.cpp" +"C:\ja2\build\Fade Screen.cpp" +"C:\ja2\build\GameInitOptionsScreen.cpp" +"C:\ja2\build\gameloop.cpp" +"C:\ja2\build\gamescreen.cpp" +"C:\ja2\build\GameSettings.cpp" +"C:\ja2\build\GameVersion.cpp" +"C:\ja2\build\HelpScreen.cpp" +"C:\ja2\build\Init.cpp" +"C:\ja2\build\Intro.cpp" +"C:\ja2\build\JA2 Splash.cpp" +"C:\ja2\build\jascreens.cpp" +"C:\ja2\build\Loading Screen.cpp" +"C:\ja2\build\MainMenuScreen.cpp" +"C:\ja2\build\MessageBoxScreen.cpp" +"C:\ja2\build\Options Screen.cpp" +"C:\ja2\build\SaveLoadGame.cpp" +"C:\ja2\build\SaveLoadScreen.cpp" +"C:\ja2\build\SCREENS.cpp" +"C:\ja2\build\Sys Globals.cpp" +] +Creating command line "cl.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP6A.tmp" +Creating temporary file "C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP6B.tmp" with contents +[ +libexpatMT.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib smackw32.lib mss32.lib /nologo /subsystem:windows /profile /map:"Release/ja2_cvs.map" /machine:I386 /out:"..\ja2_cvs.exe" +.\Release\_Ja25GermanText.obj +.\Release\aniviewscreen.obj +.\Release\Credits.obj +.\Release\Cursors.obj +".\Release\Fade Screen.obj" +.\Release\GameInitOptionsScreen.obj +.\Release\gameloop.obj +.\Release\gamescreen.obj +.\Release\GameSettings.obj +.\Release\GameVersion.obj +.\Release\HelpScreen.obj +.\Release\Init.obj +.\Release\Intro.obj +".\Release\JA2 Splash.obj" +.\Release\jascreens.obj +".\Release\Loading Screen.obj" +.\Release\MainMenuScreen.obj +.\Release\MessageBoxScreen.obj +".\Release\Options Screen.obj" +.\Release\SaveLoadGame.obj +.\Release\SaveLoadScreen.obj +.\Release\SCREENS.obj +".\Release\Sys Globals.obj" +.\Release\ja2.res +.\TileEngine\Release\TileEngine.lib +".\Standard Gaming Platform\Release\Standard Gaming Platform.lib" +.\Tactical\Release\Tactical.lib +.\Utils\Release\Utils.lib +.\TacticalAI\Release\TacticalAI.lib +.\Editor\Release\Editor.lib +.\Laptop\Release\Laptop.lib +.\Strategic\Release\Strategic.lib +] +Creating command line "link.exe @C:\DOCUME~1\Owner\LOCALS~1\Temp\RSP6B.tmp" +

Output Window

+Compiling resources... +Compiling... +_Ja25GermanText.cpp +GENERATED PCH FOR UTILS PROJECT. +aniviewscreen.cpp +GENERATED PCH FOR JA2 PROJECT. +Credits.cpp +Cursors.cpp +GENERATED PCH FOR UTILS PROJECT. +Fade Screen.cpp +GENERATED PCH FOR JA2 PROJECT. +GameInitOptionsScreen.cpp +gameloop.cpp +gamescreen.cpp +GameSettings.cpp +GameVersion.cpp +HelpScreen.cpp +Init.cpp +Intro.cpp +JA2 Splash.cpp +jascreens.cpp +Loading Screen.cpp +MainMenuScreen.cpp +MessageBoxScreen.cpp +Options Screen.cpp +SaveLoadGame.cpp +SaveLoadScreen.cpp +SCREENS.cpp +Sys Globals.cpp +Linking... +LINK : warning LNK4089: all references to "ADVAPI32.dll" discarded by /OPT:REF + + + +

Results

+ja2_cvs.exe - 0 error(s), 1 warning(s) +
+ + diff --git a/JA2.sln b/JA2.sln new file mode 100644 index 00000000..a5fad666 --- /dev/null +++ b/JA2.sln @@ -0,0 +1,207 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Editor", "Editor\Editor.vcproj", "{CB33540F-3AFF-4985-86FE-5E899B570133}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Laptop", "Laptop\Laptop.vcproj", "{FEE1FCB1-6A45-4247-A440-3561F33B16A3}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Standard Gaming Platform", "Standard Gaming Platform\Standard Gaming Platform.vcproj", "{4D15E8C7-9458-403C-A34B-15DF2CAF3277}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Strategic", "Strategic\Strategic.vcproj", "{5C428253-7443-4C4B-A5F2-E079DA2E6933}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tactical", "Tactical\Tactical.vcproj", "{F80B55A6-E228-4EB6-B915-4815E01CEA76}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TacticalAI", "TacticalAI\TacticalAI.vcproj", "{94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TileEngine", "TileEngine\TileEngine.vcproj", "{262D8F88-8266-4B16-999E-B5C0B12EFF01}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utils", "Utils\Utils.vcproj", "{6B1D57C9-A579-452E-8642-6ECF3E9FD399}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ja2", "JA2.vcproj", "{0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}" + ProjectSection(ProjectDependencies) = postProject + {5C428253-7443-4C4B-A5F2-E079DA2E6933} = {5C428253-7443-4C4B-A5F2-E079DA2E6933} + {FEE1FCB1-6A45-4247-A440-3561F33B16A3} = {FEE1FCB1-6A45-4247-A440-3561F33B16A3} + {CB33540F-3AFF-4985-86FE-5E899B570133} = {CB33540F-3AFF-4985-86FE-5E899B570133} + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6} = {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6} + {6B1D57C9-A579-452E-8642-6ECF3E9FD399} = {6B1D57C9-A579-452E-8642-6ECF3E9FD399} + {F80B55A6-E228-4EB6-B915-4815E01CEA76} = {F80B55A6-E228-4EB6-B915-4815E01CEA76} + {4D15E8C7-9458-403C-A34B-15DF2CAF3277} = {4D15E8C7-9458-403C-A34B-15DF2CAF3277} + {262D8F88-8266-4B16-999E-B5C0B12EFF01} = {262D8F88-8266-4B16-999E-B5C0B12EFF01} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Bounds Checker = Bounds Checker + Debug = Debug + Debug Demo = Debug Demo + Demo Bounds Checker = Demo Bounds Checker + Demo Release with Debug Info = Demo Release with Debug Info + Release = Release + Release Demo = Release Demo + Release with Debug Info = Release with Debug Info + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {CB33540F-3AFF-4985-86FE-5E899B570133}.Bounds Checker.ActiveCfg = Bounds Checker|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Bounds Checker.Build.0 = Bounds Checker|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Debug.ActiveCfg = Debug|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Debug.Build.0 = Debug|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Debug Demo.ActiveCfg = Debug Demo|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Debug Demo.Build.0 = Debug Demo|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Demo Bounds Checker.ActiveCfg = Demo Bounds Checker|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Demo Bounds Checker.Build.0 = Demo Bounds Checker|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Demo Release with Debug Info.ActiveCfg = Demo Release with Debug Info|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Demo Release with Debug Info.Build.0 = Demo Release with Debug Info|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Release.ActiveCfg = Release|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Release.Build.0 = Release|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Release Demo.ActiveCfg = Release Demo|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Release Demo.Build.0 = Release Demo|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Release with Debug Info.ActiveCfg = Release with Debug Info|Win32 + {CB33540F-3AFF-4985-86FE-5E899B570133}.Release with Debug Info.Build.0 = Release with Debug Info|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Bounds Checker.ActiveCfg = Bounds Checker|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Bounds Checker.Build.0 = Bounds Checker|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Debug.ActiveCfg = Debug|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Debug.Build.0 = Debug|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Debug Demo.ActiveCfg = Debug Demo|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Debug Demo.Build.0 = Debug Demo|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Demo Bounds Checker.ActiveCfg = Demo Bounds Checker|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Demo Bounds Checker.Build.0 = Demo Bounds Checker|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Demo Release with Debug Info.ActiveCfg = Demo Release with Debug Info|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Demo Release with Debug Info.Build.0 = Demo Release with Debug Info|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Release.ActiveCfg = Release|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Release.Build.0 = Release|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Release Demo.ActiveCfg = Release Demo|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Release Demo.Build.0 = Release Demo|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Release with Debug Info.ActiveCfg = Release with Debug Info|Win32 + {FEE1FCB1-6A45-4247-A440-3561F33B16A3}.Release with Debug Info.Build.0 = Release with Debug Info|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Bounds Checker.ActiveCfg = Bounds Checker|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Bounds Checker.Build.0 = Bounds Checker|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Debug.ActiveCfg = Debug|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Debug.Build.0 = Debug|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Debug Demo.ActiveCfg = Debug Demo|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Debug Demo.Build.0 = Debug Demo|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Demo Bounds Checker.ActiveCfg = Bounds Checker|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Demo Bounds Checker.Build.0 = Bounds Checker|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Demo Release with Debug Info.ActiveCfg = Demo Release with Debug Info|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Demo Release with Debug Info.Build.0 = Demo Release with Debug Info|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Release.ActiveCfg = Release|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Release.Build.0 = Release|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Release Demo.ActiveCfg = Release Demo|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Release Demo.Build.0 = Release Demo|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Release with Debug Info.ActiveCfg = Release with Debug Info|Win32 + {4D15E8C7-9458-403C-A34B-15DF2CAF3277}.Release with Debug Info.Build.0 = Release with Debug Info|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Bounds Checker.ActiveCfg = Bounds Checker|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Bounds Checker.Build.0 = Bounds Checker|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Debug.ActiveCfg = Debug|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Debug.Build.0 = Debug|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Debug Demo.ActiveCfg = Debug Demo|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Debug Demo.Build.0 = Debug Demo|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Demo Bounds Checker.ActiveCfg = Demo Bounds Checker|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Demo Bounds Checker.Build.0 = Demo Bounds Checker|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Demo Release with Debug Info.ActiveCfg = Demo Release with Debug Info|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Demo Release with Debug Info.Build.0 = Demo Release with Debug Info|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Release.ActiveCfg = Release|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Release.Build.0 = Release|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Release Demo.ActiveCfg = Release Demo|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Release Demo.Build.0 = Release Demo|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Release with Debug Info.ActiveCfg = Release with Debug Info|Win32 + {5C428253-7443-4C4B-A5F2-E079DA2E6933}.Release with Debug Info.Build.0 = Release with Debug Info|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Bounds Checker.ActiveCfg = Bounds Checker|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Bounds Checker.Build.0 = Bounds Checker|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Debug.ActiveCfg = Debug|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Debug.Build.0 = Debug|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Debug Demo.ActiveCfg = Debug Demo|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Debug Demo.Build.0 = Debug Demo|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Demo Bounds Checker.ActiveCfg = Demo Bounds Checker|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Demo Bounds Checker.Build.0 = Demo Bounds Checker|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Demo Release with Debug Info.ActiveCfg = Demo Release with Debug Info|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Demo Release with Debug Info.Build.0 = Demo Release with Debug Info|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Release.ActiveCfg = Release|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Release.Build.0 = Release|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Release Demo.ActiveCfg = Release Demo|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Release Demo.Build.0 = Release Demo|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Release with Debug Info.ActiveCfg = Release with Debug Info|Win32 + {F80B55A6-E228-4EB6-B915-4815E01CEA76}.Release with Debug Info.Build.0 = Release with Debug Info|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Bounds Checker.ActiveCfg = Bounds Checker|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Bounds Checker.Build.0 = Bounds Checker|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Debug.ActiveCfg = Debug|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Debug.Build.0 = Debug|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Debug Demo.ActiveCfg = Debug Demo|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Debug Demo.Build.0 = Debug Demo|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Demo Bounds Checker.ActiveCfg = Demo Bounds Checker|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Demo Bounds Checker.Build.0 = Demo Bounds Checker|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Demo Release with Debug Info.ActiveCfg = Demo Release with Debug Info|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Demo Release with Debug Info.Build.0 = Demo Release with Debug Info|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Release.ActiveCfg = Release|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Release.Build.0 = Release|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Release Demo.ActiveCfg = Release Demo|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Release Demo.Build.0 = Release Demo|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Release with Debug Info.ActiveCfg = Release with Debug Info|Win32 + {94DA4574-7108-4CDA-B43F-DA83B1C3EDF6}.Release with Debug Info.Build.0 = Release with Debug Info|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Bounds Checker.ActiveCfg = Bounds Checker|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Bounds Checker.Build.0 = Bounds Checker|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Debug.ActiveCfg = Debug|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Debug.Build.0 = Debug|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Debug Demo.ActiveCfg = Debug Demo|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Debug Demo.Build.0 = Debug Demo|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Demo Bounds Checker.ActiveCfg = Demo Bounds Checker|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Demo Bounds Checker.Build.0 = Demo Bounds Checker|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Demo Release with Debug Info.ActiveCfg = Demo Release with Debug Info|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Demo Release with Debug Info.Build.0 = Demo Release with Debug Info|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Release.ActiveCfg = Release|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Release.Build.0 = Release|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Release Demo.ActiveCfg = Release Demo|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Release Demo.Build.0 = Release Demo|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Release with Debug Info.ActiveCfg = Release with Debug Info|Win32 + {262D8F88-8266-4B16-999E-B5C0B12EFF01}.Release with Debug Info.Build.0 = Release with Debug Info|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Bounds Checker.ActiveCfg = Bounds Checker|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Bounds Checker.Build.0 = Bounds Checker|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Debug.ActiveCfg = Debug|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Debug.Build.0 = Debug|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Debug Demo.ActiveCfg = Debug Demo|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Debug Demo.Build.0 = Debug Demo|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Demo Bounds Checker.ActiveCfg = Demo Bounds Checker|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Demo Bounds Checker.Build.0 = Demo Bounds Checker|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Demo Release with Debug Info.ActiveCfg = Demo Release with Debug Info|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Demo Release with Debug Info.Build.0 = Demo Release with Debug Info|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Release.ActiveCfg = Release|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Release.Build.0 = Release|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Release Demo.ActiveCfg = Release Demo|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Release Demo.Build.0 = Release Demo|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Release with Debug Info.ActiveCfg = Release with Debug Info|Win32 + {6B1D57C9-A579-452E-8642-6ECF3E9FD399}.Release with Debug Info.Build.0 = Release with Debug Info|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Bounds Checker.ActiveCfg = Bounds Checker|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Bounds Checker.Build.0 = Bounds Checker|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Debug.ActiveCfg = Debug|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Debug.Build.0 = Debug|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Debug Demo.ActiveCfg = Debug Demo|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Debug Demo.Build.0 = Debug Demo|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Demo Bounds Checker.ActiveCfg = Demo Bounds Checker|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Demo Bounds Checker.Build.0 = Demo Bounds Checker|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Demo Release with Debug Info.ActiveCfg = Demo Release with Debug Info|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Demo Release with Debug Info.Build.0 = Demo Release with Debug Info|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Release.ActiveCfg = Release|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Release.Build.0 = Release|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Release Demo.ActiveCfg = Release Demo|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Release Demo.Build.0 = Release Demo|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Release with Debug Info.ActiveCfg = Release with Debug Info|Win32 + {0795F6E2-EE5C-48C5-AB6B-11E64B7533D4}.Release with Debug Info.Build.0 = Release with Debug Info|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/JA2.suo b/JA2.suo new file mode 100644 index 0000000000000000000000000000000000000000..268837e8b101da70e50f69a8e057e1368da06267 GIT binary patch literal 66560 zcmeI52b>h;`N#JF6#+pJ5s5JyP-Bc7T!G_6l)Jqcbb0?EKbSsw-Ff}_Daa159a z9s-U9)4*}yVIU124i`YAaj4smsG|QS#f|)TAcK zoJXjV6Dk~#>}oj=4veNQg|~yO$Kc^8{21AHeAJ#+@%wnRpq@wVMRllnV$lyxY^#lF zIhSYNNqPO0nqhk&zqY){rH1Tj6~8IJNzbD86}9|HoU68^#gjR$@1$Z{O9$wAR7bUc zwOPrvcdpvMx2?7Gf^@(fAYSNLrS>l!QLgp3d5f9VhNxBYM7ntmXCB3+>NzYSar2EirZQXpB_4u(Mv>;O*& zBS3OG26lqWz%HPcq}HtG*u(k?pl0_}@HB80_{b|>`{l2la_ib_KKJW4-hJg?q?TeW zcV;9ZwJ(2MV6WYKzt)m6>7fDi_*UA6^ih@;s;Aa31JGlPXCFbA+C8qp z6zpkmC+JDbHRzno3i;>XYWGEO#5D z2E*pcP1pi)$1c(VSAiaLAFI{2QL^fu#-a?uy)5O~t5nMzdpVv`y7vNpAEn&QoTZY+ z*w(Y=*lWh#^rDZ_$oUdJZQSDmYT3bB_Zee7%DSI*D)r)Vuft|)FvL@CH8t>R;_XkI z8rgb^M&2T-mRrg{QR(%YjQ3&v;NX3vV}nc7W4bQRxts7%x{wYlTcd^#Ym9t((z*#* zk`!mr3C-x0G59rvFEWhNcK-{<%9WK z2g~oK4r=k2qTO<))?=adI0^eFTB&R;`P+uBe%@q#OPv%fU;c+|@eZh<_BR|_x@^^? zePu^2e+uP#_CHv@G=(@->=%SR4COb;Uh95Q%a^{q2^wh8b`#rALycbzw6EnGH?+^b z{Tt0u`&Im#cscW&bANX89W&NF|AcElGwDr7-E)^t`@@_QzVrTt3s-;i zceh{ph%MXOO?flFGJojaLl>@p>E5gFx$Tzgdz&cHm~W{(t7tbP08+QB+23x6v5mbA zh^qusF5(EsQ>h!~@+I%B-*Bp*tsz>$T8>T^F)rbN9D{$_^Q``rZP{jSn&qdTN^sBS zJTW_G%<1RnaLC#n6_+(<%Qjy#gRk>VQA0)~ZkWx1VEL)k9^JFpP|38HyWyz4UR6B} zY@{q%2zjGf9(WhE9HSMcizGC?&r807b}Bh(GmogYSCFHiok|)1lvA*EQ&V?0YfJL- zuYFtp&Tmam-D9>Ur~boQoSmHd@4mDCw{PqJ_HEs}Z|lDN*7Vfg{FXe-)jZ2EkR2Q{ z{;j(UbkAo+J2I4?eCGAdozDLif<=@?82Lh|jNhRW?wI?A#D7%CokX&Q?b# zE>_9*>FxQ!Z}{Kjl^yl@C3|xfJhH4u#xFtF$XBn#V|!-#@8fDH{|Ih%JUq~n;pwIG zM@CwR4w91#_LGP44EXX1>;1c4APNY$OWG@kPC$^=HXt6nxel2gA zn$h*$hJ*4ayLr+9id~tvM=MNDZ4VK9hOA#J*}7J?+o(+k`|W0{-TcD=XPcN=}$hDPn-cwCL@vQ$5J;_$?3GM9DnB*UGrYURdt z9qW-Bs})?=$a?sGUb@$^E^F;d%UZkcvSyM(%i%b!!P-oh^=KS7t&VSGUA>kZhk{n4 zwxSJN(TdBB<&+*(6ugX&{88ymZFQPYFI)0vGsdfJ;k;h1>NDPIR3FvSqPWxpGwMm6 z+M~d7W4&vax?sDlr7c)1Q7o19*2=3zx`Ej%tBYONI=(KpR=?JIC>Oboh<3>2S^Y7t zmjN%1a;@G{AC2;ZOVLtG&_RpX?lRg)daDzeQbfHR?bU~tTEt#2d(valU>!zhdHKaC zv9+bO%TjBzdsb3i*Q3$?jMe%sYwe=d+k8pmY8A&C+cxB~E(Q6jE#k8AhU*$NA~)`` zj;{P<>z}%;Sy1A4nSQw_{qxmwI##1fPxj*P_2J*i?^}fKw2`(nYAfjAn2t!}O5ZN! z44p4MYCXj+wxW81UWU+JsRfCT)AGEmsk?gkITfcaUf#uBT?#a*M+>-=4b{l47VvUt z?x^PHU~QE1GNtZnakt3z!aYRyQMtC3%}T=wogvowzVbiPqJ<^lZvVpW%qKPyuDt|>B9qTW8E3q z>$AGcWvM|~_b3%dk}SVm*2=4eyWVOm?Jn!+N|LPpa#^z=Pu)dmR)00Fu5qN!dh;&p zQm-YlS+2&^C=O+;XX?5hjqW$F8r6;r*XV2MN;_J-7fq_@Sz{(MY%4RV@su`>ZsELT zCaUh>H{~aL*ozuR&!R`Fd_RZXM*pqxTWD{pfS)b^;? z554vn9AWE*`g$weZx0eZXy+0ueQVqe#ZN4ucp~$~Z|uurm(spKBR5=-ms+rL{uU4? zb9kU?rZe+gibq2?yqlNjUFj&u1C<-nDSkWQhSJ_VTAF_(X)(p~dO;8~n^E+cNNQ~{ z#lByybCM);$JiJ_-cEFmt>Wx*mZ)4_cCpV#ua!^xV1Ozyx%t4Tby@VS+$dulGY zkYsS;=&VW^oJtYA3l1d_eC7Ga!XtPW)K4P#a`V2)l9t+TH&!}{KZ3LDm5V=I$hJ4- zqUM=S;*a{`j}7@2VRQDf2bx5)l{xbLN6JmB`E;&*26!fT7I-#z4!9aT7d#IeL6nqSP9DD+N5_}5W1U?OJ2A=_+ z1)l@AfX{<3fLp;A!I!|7!B@an!Pmgo!8gD+!ENAM;M?Fk;Je^^;QQbQ;D_Kx;K$%6 z;HN;(@^jX|0KWvk0=I)-gWrJPg5QDPgFk>jf>kgFC>T;4bhF@K10z z_!sy$_z$=T{1^NW{2#a%+z0LlrlY1wbBY&Ft6FPxb0T*PX4<^`QId7GGsVkh`P*Yl zq!#LiLnp(bq>nT_>e&E|O1ZRT9J!QueC0g8bMk!gYnUk3%}v``K>7P?Kc-(JmGcn% zG=vnsrL~6s_or}&w@Zc`oSO#D}#1LMDzCs4{-s@cwq8G(MOL zpAudLvnHqHTUU@*eoI$MO~vlTGoahiaKZl}*q{B8dhOA&63Q2kFDdmlYUM!^PgS=u zr{{SQ7I#`5=B8b=Q=VE}y!kB-)R84?idsr_in-)d;<1fF`?#KVU!Gr4d|j8^Qn`gz z6{Ym@{|0fOwlgn6ibq42989va;d#GPE3_<+V=j52=-S_glGw)n`*dkE>XPnWb}8uZ zDSk=(>B^%Vh&SHN$m^}+pH|jsDB^oMRLoKhWpxK#0nbXs^^>Z(O0(M~PVPEQ4mSAK-HD_$LV83g^m?<6o8OaTXh zgTWzSDmWBO1Jl6_a2S{gG?wLX)<=NZ;7BkB90lfrqrp6I444ld0*(a_1;>Ghfi!qH zSO69R{U_oH;6(5Ua1wYVI2k+&oB|esX0RA60WF{vv;qCc@KUf0bb#fc6PyZGfYZQA za5^{xtO8v?&yr!?1A0LpSPj;Iwct!}7C0NM1LuJCU;}tG*a*%A=YjLV1>iz(5qJ!E zEO;E)1Rf8b0G$pdSo?EZ7RRfs4T)xCC4ZhQM|(402!xcrq9PqhJi^SuSI} z3tSF%gQtK!;0kahcq(`rxC-dsHSPb|)8JzE{mEDGe8VUiBv-98>2C=3H^}OHoUrfC zx$`KJh_&39l;%9e{jt0|st@w7!}`zcYJQ;N*CcuhkDfe#&(Eu{I98)Ds!@Jhey)mO z?_A>V)#C4Yy%9kkMf3OS;a6f!g4V>-ZHi$lS(ADwp2VotW7Ji7`w}lkt%oZ~=BK{Q z&&E8*>dpMr!^0$#T{)BOh=%s;AkkF-R&u$z7d@BO3mO%KEnbCA}y%%J@FTxv^? zR{l=Pzc~N?(7$i_ILoW8{B#vR{oZ zwamZ!W6GD`WtY8sr>3r(MQ<6q{yqeMd{inYwPr|@j9avfn>&gpxt#|px8sh7NiR?R zy*%!?;YCu?qe<(kuXTBSKXEgs1>YgDL|gG6w&6X*eShxh_yW%W&jil`&j!x{SA*w* z=Yi*g7l0Rn7l9Xpmw=aomw}gqYrreOE5WP4tHHJ4HQ=@2b>Q{j4d9L7P2kPoE#R%- zI&eLB8+bd=IF@&^eiwK*xBBB`OW@1kE8wf(YvAkP8{nJZHt;R*ZSWoNUGP2deeeVD zL+~S@=Ma9%_Rqi_`D4Fi{VQ-g_%-+q_$~My_&xXo_#^le_%rwm_$&Au_&c}@=)V7C z{g3>%R~CmOFF{Y__!2L0ajO1ymc(7bxJwa>^}9=ZTZ{ef`e~nJhstG#PRh%9Fvnd# zy_1|!Ejc0YU12{zDvg$}pG!$5yLu+udzU`EKdydWB>g{e`hQjxS?DOEZtLey5_yJ4 zp5^;X-CA+=uq#U%jC2%#Ci%3W7n?3>Bi;zMGgDn;dV}Gg3aiA}1-87iHVvOci?|hi-dL~w zY8b?OTH#|0y8#3y7R%T@P=-B3=^v3Lt+{lmo68UN?M=(%w(rOdXNT>* z54&)1cp$fHv~c>AHRr86TQ{4T85-QNCAWEGAiZ&Lc$*F#vN}7Q9oamje~GqFo=Kg` zi~?5PHM77@6R!<$%r2sm&J~K6N2gQFu2uQ!;{PY!#2C&2?mK2ih%~1zV~ofSW>3zg zF5#BC^L%=Ma+E#7FWFR@o=Mx|X)T`0T@q53*IMJ>cYbOO<=Ovm9w}RH*fXBZmEQk> zYzq9_S|jT6!Vnt7oew)Wr~d#?znbUS4&^o8HqBdt{u#7u;ahe3Zm9B1{uvf+t#wSb zY%_83R-{({1<}t4q;BdwfV8YkO_tE4R;142dk@mnk?Kq>MXr`1i>;|eeD|`SVXK`H zL>aah5odSvdpBDxe0te#XRm|b+W7RacO_AZXC>17CYde&KUT%FV>PG3>)73pI@_+}N_`QSU%Q#n(+ru;IY5dP$tp?F3-$X4}pch@&HF|3aw&x6- zx}5rm>oZyFPHUNYD92}rH$8Lwsu2Vu$cWxQ&vH(+C7mDtc?2h_)4AID`u!)6=9c`4 zYw;P*O|63y{<)5KQ#)CA5vfHLy)7niT+AKgcF(Y_Zh?0_FRwzVI=F#faYI8ISpi%S3E^2aDcW10GC z1@UbybE43;DtSJ^`93z4ndPdMGS7=qrrt3sE!V!eR9ZH3xP;!jbo`j^U3#<@T2{C5 ztIE_(|KL>5(@6ehc_nEXvn`1jNj(O6l1IPIcl1IdmGTYryW(R#yS&^&FH`Y$Ep*_f zcoOm>mZPWpXb+3n>t(N#kJaK<)5{W#LVwNpyu;}5N>8GDdP^I3Yd7|65!OJuLrXjN zj$W$uUgQ}_@2z7!WNfST9zBa_HJW_$f*+-P_8w^3P1*jMbQ$|9KPp~LqF7?S8_Da{Q?#6^&_sqrMg$Y{jCV7ipGn zm4)`92&fkB*m$EBiiFjudY?!fuBrdS(;v0Af4A)-x^L)3QYi2!Vd@n)2-eK&bs2wx zBYw!-hZz}0VK#Hu9el3fvj;JeQ?AfM0p&8(zLexr)S;AOFKA&)CP41Hly@6j`n{D; z2B?F#6{Dc#=+sjuU*CjVw0G|j_Aioj^tmf;n*Qd~ZkjIV{E+-BI73Z)xOWeCw`L|o zh@f)X*p7xoV;cp*#3o$&Iwz6)9Nl`YYWM~EbXR|ttY^vBg1$!iRl&h-}a+0%$tbq;s)rc zmew{r!lL#tCydsb@^SyAbzCi2+8!Fkp{0z3EaK5o;XLYwN3vk;*o5UkY0pL2hIT&M zYB#^hipbK*hA53{Q>#73hACy*$+-$}tUalezO59#SF;Jh`>iu6_%ybwA6=8>GmPW5 z)>vtUgIoFCb}7ik7|92WjkDh+?PBhMPIC=4$zcV?k>*E-)BHr_yblRqf=9HJPnYr8 z)GZ*nw?3PEHTiK$!z!d#CxP{|6vAha`z~6>G9%}4(?wx2UV5)`vb+JQ)^sR#VCA^@ zqVvLOI`2VF)5c0?Ko1`iPRo;_Wh=6!j)3JxQYDqr$jgjW%9C#~TS_c-B8!q#X>Lih zIv0Ams*k;vynL1>`l6)&!sWEwJ#(g$W`vG7+o_tS-K&eVvDEe1xcU1lZ8t*60ibT` zVrw^!w0%f8ZBH6cxjiV=q*z#;y*~a=3a{f#qo>q`)|Qle2QrV58n!LP#PM;D^J8K^&vfRl(-oj@$9TM`YrQg?&lgAvOHO0&#Q3~=aaXo;k29h z`p%=Bx?wNJTF9%~4F#2%Xmqq1(07N1)AHa6ukSQa&>ILjPVzS`oMv+-Jk7Qn->x5t zOXF+y^Ra^o8|%0D+VJ#n8cuvWTcBa%q%L4HW`xsh#)OwU`?nvXNZW8ehcs@qJ1m@b z_tKZDVKWmqHj_^$+t8SNy{~P~45w9U!pm8)58N1fmBe7P!f7^X!qd!eM;k>opPU^Y zPP1WXHZjK-_@@Og9ugUrYbiJAaT8H)VKCt?lRePjz((rD64^aAoDZkNhX-d)IM}1% zy;!1NIoWTGr_rk?=hJJ~IEwpZ{-NQtJ{DT*HINqa?;3iaA;)g}JoOTZa)e7wj@=IQ zRK`#l#9q!*hOn1&`na->(an|{dHZVdej26dssN_ly9A=v{Qy~$G*YSdbMwN zL+MtcFVo?)ldYeqw3F6TOWn+fHT|VUVGm#hy+3j9BA%km5W literal 0 HcmV?d00001 diff --git a/JA2.vcproj b/JA2.vcproj new file mode 100644 index 00000000..65a9edae --- /dev/null +++ b/JA2.vcproj @@ -0,0 +1,2429 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Language Defines.h b/Language Defines.h new file mode 100644 index 00000000..5c95c240 --- /dev/null +++ b/Language Defines.h @@ -0,0 +1,21 @@ +#ifndef __LANGUAGE_DEFINES_H +#define __LANGUAGE_DEFINES_H + +//ONLY ONE OF THESE CAN BE DEFINED AT A TIME! + +#define ENGLISH +//#define GERMAN +//#define RUSSIAN +//#define DUTCH +//#define POLISH + +#define BLOOD_N_GORE_ENABLED + + + +//if the language represents words as single chars +#ifdef TAIWAN + #define SINGLE_CHAR_WORDS +#endif + +#endif \ No newline at end of file diff --git a/Laptop/AimArchives.cpp b/Laptop/AimArchives.cpp new file mode 100644 index 00000000..89850844 --- /dev/null +++ b/Laptop/AimArchives.cpp @@ -0,0 +1,703 @@ + +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "AimArchives.h" + #include "aim.h" + #include "WordWrap.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Encrypted File.h" + #include "Text.h" +#endif + + + +#define AIM_ALUMNI_NAME_FILE "BINARYDATA\\AlumName.edt" +#define AIM_ALUMNI_FILE "BINARYDATA\\Alumni.edt" + + +#define AIM_ALUMNI_TITLE_FONT FONT14ARIAL +#define AIM_ALUMNI_TITLE_COLOR AIM_GREEN + +#define AIM_ALUMNI_POPUP_FONT FONT10ARIAL +#define AIM_ALUMNI_POPUP_COLOR FONT_MCOLOR_WHITE + +#define AIM_ALUMNI_POPUP_NAME_FONT FONT12ARIAL +#define AIM_ALUMNI_POPUP_NAME_COLOR FONT_MCOLOR_WHITE + +#define AIM_ALUMNI_NAME_FONT FONT12ARIAL +#define AIM_ALUMNI_NAME_COLOR FONT_MCOLOR_WHITE +#define AIM_ALUMNI_PAGE_FONT FONT14ARIAL +#define AIM_ALUMNI_PAGE_COLOR_UP FONT_MCOLOR_DKWHITE +#define AIM_ALUMNI_PAGE_COLOR_DOWN 138 + +#define AIM_ALUMNI_NAME_LINESIZE 80 * 2 +#define AIM_ALUMNI_ALUMNI_LINESIZE 7 * 80 * 2 + +#define AIM_ALUMNI_NUM_FACE_COLS 5 +#define AIM_ALUMNI_NUM_FACE_ROWS 4 +#define MAX_NUMBER_OLD_MERCS_ON_PAGE AIM_ALUMNI_NUM_FACE_ROWS * AIM_ALUMNI_NUM_FACE_COLS + +#define AIM_ALUMNI_START_GRID_X LAPTOP_SCREEN_UL_X + 37 +#define AIM_ALUMNI_START_GRID_Y LAPTOP_SCREEN_WEB_UL_Y + 68 + +#define AIM_ALUMNI_GRID_OFFSET_X 90 +#define AIM_ALUMNI_GRID_OFFSET_Y 72 + +#define AIM_ALUMNI_ALUMNI_FRAME_WIDTH 66 +#define AIM_ALUMNI_ALUMNI_FRAME_HEIGHT 64 + +#define AIM_ALUMNI_ALUMNI_FACE_WIDTH 56 +#define AIM_ALUMNI_ALUMNI_FACE_HEIGHT 50 + +#define AIM_ALUMNI_NAME_OFFSET_X 5 +#define AIM_ALUMNI_NAME_OFFSET_Y 55 +#define AIM_ALUMNI_NAME_WIDTH AIM_ALUMNI_ALUMNI_FRAME_WIDTH - AIM_ALUMNI_NAME_OFFSET_X * 2 + +#define AIM_ALUMNI_PAGE1_X LAPTOP_SCREEN_UL_X + 100 +#define AIM_ALUMNI_PAGE1_Y LAPTOP_SCREEN_WEB_UL_Y + 357 +#define AIM_ALUMNI_PAGE_GAP BOTTOM_BUTTON_START_WIDTH + 25 + +#define AIM_ALUMNI_PAGE_END_X AIM_ALUMNI_PAGE1_X + (BOTTOM_BUTTON_START_WIDTH + BOTTOM_BUTTON_START_WIDTH) * 3 +#define AIM_ALUMNI_PAGE_END_Y AIM_ALUMNI_PAGE1_Y + BOTTOM_BUTTON_START_HEIGHT + +#define AIM_ALUMNI_TITLE_X IMAGE_OFFSET_X + 149 +#define AIM_ALUMNI_TITLE_Y AIM_SYMBOL_Y + AIM_SYMBOL_SIZE_Y // + 2 +#define AIM_ALUMNI_TITLE_WIDTH AIM_SYMBOL_WIDTH + +#define AIM_POPUP_WIDTH 309 +#define AIM_POPUP_TEXT_WIDTH 296 +#define AIM_POPUP_SECTION_HEIGHT 9 + +#define AIM_POPUP_X LAPTOP_SCREEN_UL_X + (500-AIM_POPUP_WIDTH)/2 +#define AIM_POPUP_Y iScreenHeightOffset + 120 + LAPTOP_SCREEN_WEB_DELTA_Y + +#define AIM_POPUP_SHADOW_GAP 4 + +#define AIM_POPUP_TEXT_X AIM_POPUP_X + +#define AIM_ALUMNI_FACE_PANEL_X AIM_POPUP_X + 6 +#define AIM_ALUMNI_FACE_PANEL_Y AIM_POPUP_Y + 6 +#define AIM_ALUMNI_FACE_PANEL_WIDTH 58 +#define AIM_ALUMNI_FACE_PANEL_HEIGHT 52 + +#define AIM_ALUMNI_POPUP_NAME_X AIM_ALUMNI_FACE_PANEL_X + AIM_ALUMNI_FACE_PANEL_WIDTH + 10 +#define AIM_ALUMNI_POPUP_NAME_Y AIM_ALUMNI_FACE_PANEL_Y + 20 + +#define AIM_ALUMNI_POPUP_DESC_X AIM_POPUP_X + 8 +#define AIM_ALUMNI_POPUP_DESC_Y AIM_ALUMNI_FACE_PANEL_Y + AIM_ALUMNI_FACE_PANEL_HEIGHT + 5 + +#define AIM_ALUMNI_DONE_X AIM_POPUP_X + AIM_POPUP_WIDTH - AIM_ALUMNI_DONE_WIDTH - 7 +#define AIM_ALUMNI_DONE_WIDTH 36 +#define AIM_ALUMNI_DONE_HEIGHT 16 + +#define AIM_ALUMNI_NAME_SIZE 80 * 2 +#define AIM_ALUMNI_DECRIPTION_SIZE 80 * 7 * 2 +#define AIM_ALUMNI_FILE_RECORD_SIZE 80 * 8 * 2 +#define AIM_ALUMNI_FULL_NAME_SIZE 80 * 2 + +UINT32 guiAlumniFrame; +UINT32 guiOldAim; +UINT32 guiPageButtons; +UINT32 guiAlumniPopUp; +UINT32 guiPopUpPic; +UINT32 guiDoneButton; + +UINT8 gubPageNum; +UINT8 gunAlumniButtonDown=255; +BOOLEAN gfExitingAimArchives; +UINT8 gubDrawOldMerc; +UINT8 gfDrawPopUpBox=FALSE; +BOOLEAN gfDestroyPopUpBox; +BOOLEAN gfFaceMouseRegionsActive; +//BOOLEAN gfDestroyDoneRegion; +BOOLEAN gfReDrawScreen=FALSE; + +BOOLEAN AimArchivesSubPagesVisitedFlag[3] = {0,0,0}; + + //Mouse Regions + +//Face regions +MOUSE_REGION gMercAlumniFaceMouseRegions[ MAX_NUMBER_OLD_MERCS_ON_PAGE ]; +void SelectAlumniFaceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Done region +MOUSE_REGION gDoneRegion; +void SelectAlumniDoneRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Previous Button +void BtnAlumniPageButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiAlumniPageButton[3]; +INT32 guiAlumniPageButtonImage; + + +void ResetAimArchiveButtons(); +void DisableAimArchiveButton(); +void DisplayAlumniOldMercPopUp(); +void DestroyPopUpBox(); +void InitAlumniFaceRegions(); +void RemoveAimAlumniFaceRegion(); +void CreateDestroyDoneMouseRegion(UINT16 usPosY); +void ChangingAimArchiveSubPage( UINT8 ubSubPageNumber ); + + +void GameInitAimArchives() +{ + +} + +void EnterInitAimArchives() +{ + gfDrawPopUpBox=FALSE; + gfDestroyPopUpBox = FALSE; + + memset( &AimArchivesSubPagesVisitedFlag, 0, 3); + AimArchivesSubPagesVisitedFlag[0] = TRUE; +} + + +BOOLEAN EnterAimArchives() +{ + VOBJECT_DESC VObjectDesc; + UINT16 usPosX, i; + + + gfExitingAimArchives = FALSE; +// gubDrawOldMerc = 255; + gfDrawPopUpBox=FALSE; + gfDestroyPopUpBox=FALSE; + + InitAimDefaults(); + InitAimMenuBar(); + + gubPageNum = (UINT8)giCurrentSubPage; + + // load the Alumni Frame and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\AlumniFrame.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiAlumniFrame)); + + // load the 1st set of faces and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Old_Aim.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiOldAim)); + + // load the Bottom Buttons graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BottomButton.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiPageButtons)); + + // load the PopupPic graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\PopupPicFrame.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiPopUpPic)); + + // load the AlumniPopUp graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\AlumniPopUp.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiAlumniPopUp)); + + // load the Done Button graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\DoneButton.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiDoneButton)); + + InitAlumniFaceRegions(); + + //Load graphic for buttons + guiAlumniPageButtonImage = LoadButtonImage("LAPTOP\\BottomButtons2.sti", -1,0,-1,1,-1 ); + + usPosX = AIM_ALUMNI_PAGE1_X; + for(i=0; i<3; i++) + { + guiAlumniPageButton[i] = CreateIconAndTextButton( guiAlumniPageButtonImage, AimAlumniText[i], AIM_ALUMNI_PAGE_FONT, + AIM_ALUMNI_PAGE_COLOR_UP, DEFAULT_SHADOW, + AIM_ALUMNI_PAGE_COLOR_DOWN, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + usPosX, AIM_ALUMNI_PAGE1_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnAlumniPageButtonCallback); + SetButtonCursor(guiAlumniPageButton[i], CURSOR_WWW); + MSYS_SetBtnUserData( guiAlumniPageButton[i], 0, i); + + usPosX += AIM_ALUMNI_PAGE_GAP; + } + + DisableAimArchiveButton(); + RenderAimArchives(); + return(TRUE); +} + +void ExitAimArchives() +{ + UINT16 i; + + gfExitingAimArchives = TRUE; + + DeleteVideoObjectFromIndex(guiAlumniFrame); + DeleteVideoObjectFromIndex(guiOldAim); + DeleteVideoObjectFromIndex(guiAlumniPopUp); + DeleteVideoObjectFromIndex(guiPopUpPic); + DeleteVideoObjectFromIndex(guiDoneButton); + + + RemoveAimAlumniFaceRegion(); + + UnloadButtonImage( guiAlumniPageButtonImage ); + for(i=0; i<3; i++) + RemoveButton( guiAlumniPageButton[i] ); + + RemoveAimDefaults(); + ExitAimMenuBar(); + giCurrentSubPage = gubPageNum; + + CreateDestroyDoneMouseRegion(0); + gfDestroyPopUpBox = FALSE; + gfDrawPopUpBox = FALSE; +} + +void HandleAimArchives() +{ + if( gfReDrawScreen ) + { +// RenderAimArchives(); + fPausedReDrawScreenFlag = TRUE; + + gfReDrawScreen = FALSE; + } + if( gfDestroyPopUpBox ) + { + gfDestroyPopUpBox = FALSE; + + CreateDestroyDoneMouseRegion(0); + InitAlumniFaceRegions(); + gfDestroyPopUpBox = FALSE; + } +} + +void RenderAimArchives() +{ + HVOBJECT hFrameHandle; + HVOBJECT hFaceHandle; +// HVOBJECT hBottomButtonHandle; + UINT16 usPosX, usPosY,x,y,i=0; + UINT8 ubNumRows=0; + UINT32 uiStartLoc=0; + wchar_t sText[400]; + + + DrawAimDefaults(); + DisableAimButton(); + + //Draw Link Title + DrawTextToScreen(AimAlumniText[AIM_ALUMNI_ALUMNI], AIM_ALUMNI_TITLE_X, AIM_ALUMNI_TITLE_Y, AIM_ALUMNI_TITLE_WIDTH, AIM_ALUMNI_TITLE_FONT, AIM_ALUMNI_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Draw the mug shot border and face + GetVideoObject(&hFrameHandle, guiAlumniFrame); + GetVideoObject(&hFaceHandle, guiOldAim); + + switch(gubPageNum) + { + case 0: + ubNumRows = AIM_ALUMNI_NUM_FACE_ROWS; + i=0; + break; + case 1: + ubNumRows = AIM_ALUMNI_NUM_FACE_ROWS; + i=20; + break; + case 2: + ubNumRows = 2; + i=40; + break; + default: + Assert(0); + break; + } + + usPosX = AIM_ALUMNI_START_GRID_X; + usPosY = AIM_ALUMNI_START_GRID_Y; + for(y=0; yuiFlags |= BUTTON_CLICKED_ON; + + gunAlumniButtonDown=ubRetValue; + + InvalidateRegion(AIM_ALUMNI_PAGE1_X,AIM_ALUMNI_PAGE1_Y, AIM_ALUMNI_PAGE_END_X,AIM_ALUMNI_PAGE_END_Y); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + RemoveAimAlumniFaceRegion(); + + ChangingAimArchiveSubPage( ubRetValue ); + + gubPageNum = ubRetValue; + + gfReDrawScreen = TRUE; + + gfDestroyPopUpBox = TRUE; + + gunAlumniButtonDown=255; + ResetAimArchiveButtons(); + DisableAimArchiveButton(); + gfDrawPopUpBox = FALSE; + + InvalidateRegion(AIM_ALUMNI_PAGE1_X,AIM_ALUMNI_PAGE1_Y, AIM_ALUMNI_PAGE_END_X,AIM_ALUMNI_PAGE_END_Y); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + gunAlumniButtonDown=255; + DisableAimArchiveButton(); + InvalidateRegion(AIM_ALUMNI_PAGE1_X,AIM_ALUMNI_PAGE1_Y, AIM_ALUMNI_PAGE_END_X,AIM_ALUMNI_PAGE_END_Y); + } +} + + +void ResetAimArchiveButtons() +{ + int i=0; + + for(i=0; i<3; i++) + { + ButtonList[ guiAlumniPageButton[i] ]->uiFlags &= ~BUTTON_CLICKED_ON; + } +} + + +void DisableAimArchiveButton() +{ + if( gfExitingAimArchives == TRUE) + return; + + if( (gubPageNum == 0 ) ) + { + ButtonList[ guiAlumniPageButton[ 0 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); + } + else if( gubPageNum == 1 ) + { + ButtonList[ guiAlumniPageButton[ 1 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); + } + else if( gubPageNum == 2 ) + { + ButtonList[ guiAlumniPageButton[ 2 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); + } +} + + +void DisplayAlumniOldMercPopUp() +{ + UINT8 i,ubNumLines=11; //17 + UINT16 usPosY, usTextPosY; + UINT8 ubFontHeight, ubNumDescLines; + HVOBJECT hAlumniPopUpHandle; + HVOBJECT hDoneHandle; + HVOBJECT hFacePaneHandle; + HVOBJECT hFaceHandle; +// WRAPPED_STRING *pFirstWrappedString, *pTempWrappedString; + UINT16 usHeight = GetFontHeight(AIM_ALUMNI_POPUP_FONT); + wchar_t sName[AIM_ALUMNI_NAME_SIZE]; + wchar_t sDesc[AIM_ALUMNI_DECRIPTION_SIZE]; + UINT32 uiStartLoc; + UINT16 usStringPixLength; + + GetVideoObject(&hAlumniPopUpHandle, guiAlumniPopUp); + GetVideoObject(&hDoneHandle, guiDoneButton); + GetVideoObject(&hFacePaneHandle, guiPopUpPic); + GetVideoObject(&hFaceHandle, guiOldAim); + + ubFontHeight = (UINT8)GetFontHeight(AIM_ALUMNI_POPUP_FONT); + + //Load the description + uiStartLoc = AIM_ALUMNI_FILE_RECORD_SIZE * gubDrawOldMerc + AIM_ALUMNI_FULL_NAME_SIZE; + LoadEncryptedDataFromFile(AIM_ALUMNI_FILE, sDesc, uiStartLoc, AIM_ALUMNI_DECRIPTION_SIZE); + + usStringPixLength = StringPixLength( sDesc, AIM_ALUMNI_POPUP_FONT); + ubNumDescLines = (UINT8) (usStringPixLength / AIM_POPUP_TEXT_WIDTH); + + ubNumLines += ubNumDescLines; + + usTextPosY = AIM_POPUP_Y + 5; + usPosY = AIM_POPUP_Y; + + //draw top line of the popup background + ShadowVideoSurfaceRect( FRAME_BUFFER, AIM_POPUP_X+AIM_POPUP_SHADOW_GAP, usPosY+AIM_POPUP_SHADOW_GAP, AIM_POPUP_X + AIM_POPUP_WIDTH+AIM_POPUP_SHADOW_GAP, usPosY + AIM_POPUP_SECTION_HEIGHT+AIM_POPUP_SHADOW_GAP-1); + BltVideoObject(FRAME_BUFFER, hAlumniPopUpHandle, 0,AIM_POPUP_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); + //draw mid section of the popup background + usPosY += AIM_POPUP_SECTION_HEIGHT; + for(i=0; iuiFlags &= (~BUTTON_CLICKED_ON ); + DrawMercsFaceToScreen(ubMercNum, usPosX, usPosY, 1); + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } + else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + pRegion->uiFlags |= BUTTON_CLICKED_ON ; + DrawMercsFaceToScreen(ubMercNum, usPosX, usPosY, 0); + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } +} + +BOOLEAN DrawMercsFaceToScreen(UINT8 ubMercID, UINT16 usPosX, UINT16 usPosY, UINT8 ubImage) +{ + HVOBJECT hMugShotBorderHandle; + HVOBJECT hFaceHandle; + SOLDIERTYPE *pSoldier=NULL; + + pSoldier = FindSoldierByProfileID( AimMercArray[ubMercID], TRUE ); + + + //Blt the portrait background + GetVideoObject(&hMugShotBorderHandle, guiMugShotBorder); + BltVideoObject(FRAME_BUFFER, hMugShotBorderHandle, ubImage,usPosX, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); + + //Blt face to screen + GetVideoObject(&hFaceHandle, guiAimFiFace[ubMercID]); + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,usPosX+AIM_FI_FACE_OFFSET, usPosY+AIM_FI_FACE_OFFSET, VO_BLT_SRCTRANSPARENCY,NULL); + + if( IsMercDead( AimMercArray[ubMercID] ) ) + { + //get the face object + GetVideoObject(&hFaceHandle, guiAimFiFace[ubMercID]); + + //if the merc is dead + //shade the face red, (to signif that he is dead) + hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); + + //set the red pallete to the face + SetObjectHandleShade( guiAimFiFace[ubMercID], 0 ); + + //Blt face to screen + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,usPosX+AIM_FI_FACE_OFFSET, usPosY+AIM_FI_FACE_OFFSET, VO_BLT_SRCTRANSPARENCY,NULL); + + DrawTextToScreen(AimFiText[AIM_FI_DEAD], (UINT16)(usPosX+AIM_FI_AWAY_TEXT_OFFSET_X), (UINT16)(usPosY+AIM_FI_AWAY_TEXT_OFFSET_Y), AIM_FI_AWAY_TEXT_OFFSET_WIDTH, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + + //else if the merc is currently a POW or, the merc was fired as a pow + else if( gMercProfiles[ AimMercArray[ubMercID] ].bMercStatus == MERC_FIRED_AS_A_POW || ( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) ) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, usPosX+AIM_FI_FACE_OFFSET, usPosY+AIM_FI_FACE_OFFSET, usPosX + 48+AIM_FI_FACE_OFFSET, usPosY + 43+AIM_FI_FACE_OFFSET); + DrawTextToScreen( pPOWStrings[0], (UINT16)(usPosX+AIM_FI_AWAY_TEXT_OFFSET_X), (UINT16)(usPosY+AIM_FI_AWAY_TEXT_OFFSET_Y), AIM_FI_AWAY_TEXT_OFFSET_WIDTH, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + + //if the merc is on our team + else if( pSoldier != NULL ) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, usPosX+AIM_FI_FACE_OFFSET, usPosY+AIM_FI_FACE_OFFSET, usPosX + 48+AIM_FI_FACE_OFFSET, usPosY + 43+AIM_FI_FACE_OFFSET); + DrawTextToScreen( MercInfo[MERC_FILES_ALREADY_HIRED], (UINT16)(usPosX+AIM_FI_AWAY_TEXT_OFFSET_X), (UINT16)(usPosY+AIM_FI_AWAY_TEXT_OFFSET_Y), AIM_FI_AWAY_TEXT_OFFSET_WIDTH, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + + //if the merc is away, shadow his/her face and blit 'away' over top + else if( !IsMercHireable( AimMercArray[ubMercID] ) ) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, usPosX+AIM_FI_FACE_OFFSET, usPosY+AIM_FI_FACE_OFFSET, usPosX + 48+AIM_FI_FACE_OFFSET, usPosY + 43+AIM_FI_FACE_OFFSET); + DrawTextToScreen( AimFiText[AIM_FI_DEAD+1], (UINT16)(usPosX+AIM_FI_AWAY_TEXT_OFFSET_X), (UINT16)(usPosY+AIM_FI_AWAY_TEXT_OFFSET_Y), AIM_FI_AWAY_TEXT_OFFSET_WIDTH, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + //if not enough room use this.. + //AimFiText[AIM_FI_AWAY] + } + + return(TRUE); +} + + + + + + + + diff --git a/Laptop/AimFacialIndex.h b/Laptop/AimFacialIndex.h new file mode 100644 index 00000000..9bd4ae3b --- /dev/null +++ b/Laptop/AimFacialIndex.h @@ -0,0 +1,32 @@ +#ifndef __AIMFACIALINDEX_H_ +#define __AIMFACIALINDEX_H_ + +#define AIM_FI_LEFT_CLICK_TEXT_X (SCREEN_WIDTH - 640) / 2 + 116 +#define AIM_FI_LEFT_CLICK_TEXT_Y (SCREEN_HEIGHT - 480) / 2 + 35 + LAPTOP_SCREEN_WEB_DELTA_Y + +#define AIM_FI_CLICK_DESC_TEXT_Y_OFFSET 16 + +#define AIM_FI_RIGHT_CLICK_TEXT_X (SCREEN_WIDTH - 640) / 2 + 500 + +#define AIM_FI_CLICK_TEXT_WIDTH 110 + +#define AIM_FI_HELP_FONT FONT10ARIAL +#define AIM_FI_HELP_TITLE_FONT FONT12ARIAL +#define IM_FI_HELP_COLOR FONT_MCOLOR_WHITE + +void GameInitAimFacialIndex(); +BOOLEAN EnterAimFacialIndex(); +void ExitAimFacialIndex(); +void HandleAimFacialIndex(); +BOOLEAN RenderAimFacialIndex(); + +BOOLEAN DisplayAimFIMugShot(); + +#endif + + + + + + + diff --git a/Laptop/AimHistory.cpp b/Laptop/AimHistory.cpp new file mode 100644 index 00000000..cde92293 --- /dev/null +++ b/Laptop/AimHistory.cpp @@ -0,0 +1,626 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "AimHistory.h" + #include "aim.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Encrypted File.h" + #include "Text.h" +#endif + + + +// Defines + +#define NUM_AIM_HISTORY_PAGES 5 + +#define AIM_HISTORY_TITLE_FONT FONT14ARIAL +#define AIM_HISTORY_TITLE_COLOR AIM_GREEN +#define AIM_HISTORY_TEXT_FONT FONT10ARIAL +#define AIM_HISTORY_TEXT_COLOR FONT_MCOLOR_WHITE +#define AIM_HISTORY_TOC_TEXT_FONT FONT12ARIAL +#define AIM_HISTORY_TOC_TEXT_COLOR FONT_MCOLOR_WHITE +#define AIM_HISTORY_PARAGRAPH_TITLE_FONT FONT12ARIAL +#define AIM_HISTORY_PARAGRAPH_TITLE_COLOR FONT_MCOLOR_WHITE + + +#define AIM_HISTORY_MENU_X LAPTOP_SCREEN_UL_X + 40 +#define AIM_HISTORY_MENU_Y iScreenHeightOffset + 370 + LAPTOP_SCREEN_WEB_DELTA_Y +#define AIM_HISTORY_MENU_BUTTON_AMOUNT 4 +#define AIM_HISTORY_GAP_X 40 + BOTTOM_BUTTON_START_WIDTH +#define AIM_HISTORY_MENU_END_X AIM_HISTORY_MENU_X + AIM_HISTORY_GAP_X * (AIM_HISTORY_MENU_BUTTON_AMOUNT+2) +#define AIM_HISTORY_MENU_END_Y AIM_HISTORY_MENU_Y + BOTTOM_BUTTON_START_HEIGHT + +#define AIM_HISTORY_TEXT_X IMAGE_OFFSET_X + 149 +#define AIM_HISTORY_TEXT_Y AIM_SYMBOL_Y + AIM_SYMBOL_SIZE_Y + 45 +#define AIM_HISTORY_TEXT_WIDTH AIM_SYMBOL_WIDTH + +#define AIM_HISTORY_PARAGRAPH_X LAPTOP_SCREEN_UL_X + 20 +#define AIM_HISTORY_PARAGRAPH_Y AIM_HISTORY_SUBTITLE_Y + 18 +#define AIM_HISTORY_SUBTITLE_Y iScreenHeightOffset + 150 + LAPTOP_SCREEN_WEB_DELTA_Y +#define AIM_HISTORY_PARAGRAPH_WIDTH 460 + +#define AIM_HISTORY_CONTENTBUTTON_X iScreenWidthOffset + 259 +#define AIM_HISTORY_CONTENTBUTTON_Y AIM_HISTORY_SUBTITLE_Y + +#define AIM_HISTORY_TOC_X AIM_HISTORY_CONTENTBUTTON_X +#define AIM_HISTORY_TOC_Y 5 +#define AIM_HISTORY_TOC_GAP_Y 25 + +#define AIM_HISTORY_SPACE_BETWEEN_PARAGRAPHS 8 + +extern UINT32 guiBottomButton; // symbol already declared globally in AimPolicies.cpp (jonathanl) +extern UINT32 guiBottomButton2; // symbol already declared globally in AimPolicies.cpp (jonathanl) +extern UINT32 guiContentButton; // symbol already declared globally in AimPolicies.cpp (jonathanl) + +extern UINT8 gubCurPageNum; // symbol already declared globally in AimPolicies.cpp (jonathanl) +extern BOOLEAN gfInToc = FALSE; // symbol already declared globally in AimPolicies.cpp (jonathanl) +extern UINT8 gubAimHistoryMenuButtonDown=255; // symbol already declared globally in AimPolicies.cpp (jonathanl) + +BOOLEAN gfExitingAimHistory; +BOOLEAN AimHistorySubPagesVisitedFlag[ NUM_AIM_HISTORY_PAGES ]; + + + +void ResetAimHistoryButtons(); +void DisableAimHistoryButton(); + + +MOUSE_REGION gSelectedHistoryTocMenuRegion[ NUM_AIM_HISTORY_PAGES ]; +void SelectHistoryTocMenuRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Bottom Menu Buttons +void BtnHistoryMenuButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiHistoryMenuButton[ AIM_HISTORY_MENU_BUTTON_AMOUNT ]; +INT32 guiHistoryMenuButtonImage; + + +BOOLEAN DrawAimHistoryMenuBar(void); +BOOLEAN ExitAimHistoryMenuBar(void); +BOOLEAN InitAimHistoryMenuBar(void); +BOOLEAN DisplayAimHistoryParagraph(UINT8 ubPageNum, UINT8 ubNumParagraphs); +BOOLEAN InitTocMenu(); +BOOLEAN ExitTocMenu(); +void ChangingAimHistorySubPage( UINT8 ubSubPageNumber ); + + +// These enums represent which paragraph they are located in the AimHist.edt file +enum +{ + IN_THE_BEGINNING =6, + IN_THE_BEGINNING_1, + IN_THE_BEGINNING_2, + + THE_ISLAND_METAVIRA, + THE_ISLAND_METAVIRA_1, + THE_ISLAND_METAVIRA_2, + + GUS_TARBALLS, + GUS_TARBALLS_1, + GUS_TARBALLS_2, + + WORD_FROM_FOUNDER, + WORD_FROM_FOUNDER_1, + COLONEL_MOHANNED, + + INCORPORATION, + INCORPORATION_1, + INCORPORATION_2, + DUNN_AND_BRADROAD, + INCORPORATION_3, +} AimHistoryTextLocatoins; + + + +void GameInitAimHistory() +{ + +} + +void EnterInitAimHistory() +{ + memset( &AimHistorySubPagesVisitedFlag, 0, NUM_AIM_HISTORY_PAGES); +} + + +BOOLEAN EnterAimHistory() +{ + VOBJECT_DESC VObjectDesc; + + gfExitingAimHistory = FALSE; + InitAimDefaults(); + InitAimHistoryMenuBar(); + + // load the Content Buttons graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\ContentButton.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiContentButton)); + + gubCurPageNum = (UINT8) giCurrentSubPage; + RenderAimHistory(); + + + DisableAimHistoryButton(); + gubAimHistoryMenuButtonDown = 255; + + return(TRUE); +} + +void ExitAimHistory() +{ + gfExitingAimHistory = TRUE; + RemoveAimDefaults(); + ExitAimHistoryMenuBar(); + + DeleteVideoObjectFromIndex(guiContentButton); + giCurrentSubPage = gubCurPageNum; + + if(gfInToc) + ExitTocMenu(); + +} + +void HandleAimHistory() +{ + +} + +void RenderAimHistory() +{ + wchar_t sText[400]; + UINT32 uiStartLoc=0; + UINT16 usPosY; + + DrawAimDefaults(); +// DrawAimHistoryMenuBar(); + DisplayAimSlogan(); + DisplayAimCopyright(); + + DrawTextToScreen(AimHistoryText[AIM_HISTORY_TITLE], AIM_HISTORY_TEXT_X, AIM_HISTORY_TEXT_Y, AIM_HISTORY_TEXT_WIDTH, AIM_HISTORY_TITLE_FONT, AIM_HISTORY_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + + switch(gubCurPageNum) + { + // History Page TOC + case 0: + InitTocMenu(); + break; + + //Load and Display the begining + case 1: + DisplayAimHistoryParagraph(IN_THE_BEGINNING, 2); + break; + + //Load and Display the island of metavira + case 2: + DisplayAimHistoryParagraph(THE_ISLAND_METAVIRA, 2); + break; + + //Load and Display the gus tarballs + case 3: + DisplayAimHistoryParagraph(GUS_TARBALLS, 2); + break; + + //Load and Display the founder + case 4: + DisplayAimHistoryParagraph(WORD_FROM_FOUNDER, 1); + + // display coloniel Mohanned... + usPosY = AIM_HISTORY_PARAGRAPH_Y + (GetFontHeight(AIM_HISTORY_TEXT_FONT) + 2)* 5 + LAPTOP_SCREEN_WEB_DELTA_Y; + uiStartLoc = AIM_HISTORY_LINE_SIZE * COLONEL_MOHANNED; + LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); + DisplayWrappedString(AIM_HISTORY_PARAGRAPH_X, iScreenHeightOffset + 210+LAPTOP_SCREEN_WEB_DELTA_Y, AIM_HISTORY_PARAGRAPH_WIDTH, 2, AIM_HISTORY_TEXT_FONT, AIM_HISTORY_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + break; + + //Load and Display the incorporation + case 5: + DisplayAimHistoryParagraph(INCORPORATION, 2); + + // display dunn and bradbord... + uiStartLoc = AIM_HISTORY_LINE_SIZE * DUNN_AND_BRADROAD; + LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); + DisplayWrappedString(AIM_HISTORY_PARAGRAPH_X, iScreenHeightOffset + 270+LAPTOP_SCREEN_WEB_DELTA_Y, AIM_HISTORY_PARAGRAPH_WIDTH, 2, AIM_HISTORY_TEXT_FONT, AIM_HISTORY_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + + //AIM_HISTORY_PARAGRAPH_Y + uiStartLoc = AIM_HISTORY_LINE_SIZE * INCORPORATION_3; + LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); + DisplayWrappedString(AIM_HISTORY_PARAGRAPH_X, iScreenHeightOffset + 290+LAPTOP_SCREEN_WEB_DELTA_Y, AIM_HISTORY_PARAGRAPH_WIDTH, 2, AIM_HISTORY_TEXT_FONT, AIM_HISTORY_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + break; + } + + MarkButtonsDirty( ); + + RenderWWWProgramTitleBar( ); + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + + +BOOLEAN InitAimHistoryMenuBar(void) +{ + VOBJECT_DESC VObjectDesc; + UINT16 i, usPosX; + + // load the Bottom Buttons graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BottomButton.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBottomButton)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BottomButton2.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBottomButton2)); + + guiHistoryMenuButtonImage = LoadButtonImage("LAPTOP\\BottomButtons2.sti", -1,0,-1,1,-1 ); + usPosX = AIM_HISTORY_MENU_X; + for(i=0; i 0) + { + gubCurPageNum--; + ChangingAimHistorySubPage( gubCurPageNum ); +// RenderAimHistory(); + } + } + + // Home Page + else if( rValue == 2 ) + { + guiCurrentLaptopMode = LAPTOP_MODE_AIM; + } + //Company policies + else if( rValue == 3 ) + { + guiCurrentLaptopMode = LAPTOP_MODE_AIM_POLICIES; + } + //Next Page + else if( rValue == 4 ) + { + if( gubCurPageNum < NUM_AIM_HISTORY_PAGES ) + { + gubCurPageNum++; + ChangingAimHistorySubPage( gubCurPageNum ); + + fOnPage = FALSE; + if(gfInToc) + { + ExitTocMenu(); + } + fOnPage = TRUE; +// RenderAimHistory(); + } + } + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } + } +} + + +BOOLEAN DisplayAimHistoryParagraph(UINT8 ubPageNum, UINT8 ubNumParagraphs) +{ + wchar_t sText[400]; + UINT32 uiStartLoc=0; + UINT16 usPosY=0; + UINT16 usNumPixels=0; + + //title + uiStartLoc = AIM_HISTORY_LINE_SIZE * ubPageNum; + LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); + DrawTextToScreen(sText, AIM_HISTORY_PARAGRAPH_X, AIM_HISTORY_SUBTITLE_Y, 0, AIM_HISTORY_PARAGRAPH_TITLE_FONT, AIM_HISTORY_PARAGRAPH_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + if(ubNumParagraphs >= 1) + { + usPosY = AIM_HISTORY_PARAGRAPH_Y; + //1st paragraph + uiStartLoc = AIM_HISTORY_LINE_SIZE * (ubPageNum + 1 ); + LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); + usNumPixels = DisplayWrappedString(AIM_HISTORY_PARAGRAPH_X, usPosY, AIM_HISTORY_PARAGRAPH_WIDTH, 2, AIM_HISTORY_TEXT_FONT, AIM_HISTORY_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + + if(ubNumParagraphs >= 2) + { + //2nd paragraph + usPosY += usNumPixels + AIM_HISTORY_SPACE_BETWEEN_PARAGRAPHS; + uiStartLoc = AIM_HISTORY_LINE_SIZE * (ubPageNum + 2 ); + LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); + DisplayWrappedString(AIM_HISTORY_PARAGRAPH_X, usPosY, AIM_HISTORY_PARAGRAPH_WIDTH, 2, AIM_HISTORY_TEXT_FONT, AIM_HISTORY_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + + if(ubNumParagraphs >= 3) + { + //3rd paragraph + usPosY += usNumPixels + AIM_HISTORY_SPACE_BETWEEN_PARAGRAPHS; + + uiStartLoc = AIM_HISTORY_LINE_SIZE * (ubPageNum + 3 ); + LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); + DisplayWrappedString(AIM_HISTORY_PARAGRAPH_X, usPosY, AIM_HISTORY_PARAGRAPH_WIDTH, 2, AIM_HISTORY_TEXT_FONT, AIM_HISTORY_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + + return(TRUE); +} + + + +BOOLEAN InitTocMenu() +{ + UINT16 i, usPosY; + UINT16 usHeight; + UINT16 usWidth=0; + UINT32 uiStartLoc=0; + wchar_t sText[400]; + UINT8 ubLocInFile[]= + {IN_THE_BEGINNING, + THE_ISLAND_METAVIRA, + GUS_TARBALLS, + WORD_FROM_FOUNDER, + INCORPORATION}; + + HVOBJECT hContentButtonHandle; + + GetVideoObject(&hContentButtonHandle, guiContentButton); + + usHeight = GetFontHeight(AIM_HISTORY_TOC_TEXT_FONT); + usPosY = AIM_HISTORY_CONTENTBUTTON_Y; + for(i=0; iuiFlags |= BUTTON_CLICKED_ON; + + gubAimHistoryMenuButtonDown = ubRetValue; + + InvalidateRegion(AIM_HISTORY_MENU_X,AIM_HISTORY_MENU_Y, AIM_HISTORY_MENU_END_X,AIM_HISTORY_MENU_END_Y); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + ResetAimHistoryButtons(); + + if( ubRetValue == 1 ) + { + if( gubCurPageNum > 0) + { + gubCurPageNum--; + ChangingAimHistorySubPage( gubCurPageNum ); + +// RenderAimHistory(); + ResetAimHistoryButtons(); + } + else + btn->uiFlags |= (BUTTON_CLICKED_ON ); + } + + // Home Page + else if( ubRetValue == 2 ) + { + guiCurrentLaptopMode = LAPTOP_MODE_AIM; + } + //Company policies + else if( ubRetValue == 3 ) + { + guiCurrentLaptopMode = LAPTOP_MODE_AIM_MEMBERS_ARCHIVES; + } + //Next Page + else if( ubRetValue == 4 ) + { + if( gubCurPageNum < NUM_AIM_HISTORY_PAGES ) + { + gubCurPageNum++; + ChangingAimHistorySubPage( gubCurPageNum ); + + if(gfInToc) + { + ExitTocMenu(); + } +// RenderAimHistory(); + } + else + btn->uiFlags |= (BUTTON_CLICKED_ON ); + + } + + DisableAimHistoryButton(); + + InvalidateRegion(AIM_HISTORY_MENU_X,AIM_HISTORY_MENU_Y, AIM_HISTORY_MENU_END_X,AIM_HISTORY_MENU_END_Y); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + DisableAimHistoryButton(); + + InvalidateRegion(AIM_HISTORY_MENU_X,AIM_HISTORY_MENU_Y, AIM_HISTORY_MENU_END_X,AIM_HISTORY_MENU_END_Y); + } +} + + +void ResetAimHistoryButtons() +{ + int i=0; + + for(i=0; iuiFlags &= ~BUTTON_CLICKED_ON; + } +} + +void DisableAimHistoryButton() +{ + if( gfExitingAimHistory == TRUE) + return; + + if( (gubCurPageNum == 0 ) ) + { + ButtonList[ guiHistoryMenuButton[ 0 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); + } + else if( ( gubCurPageNum == 5) ) + { + ButtonList[ guiHistoryMenuButton[ AIM_HISTORY_MENU_BUTTON_AMOUNT-1 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); + } +} + + + +void ChangingAimHistorySubPage( UINT8 ubSubPageNumber ) +{ + fLoadPendingFlag = TRUE; + + if( AimHistorySubPagesVisitedFlag[ ubSubPageNumber ] == FALSE ) + { + fConnectingToSubPage = TRUE; + fFastLoadFlag = FALSE; + + AimHistorySubPagesVisitedFlag[ ubSubPageNumber ] = TRUE; + } + else + { + fConnectingToSubPage = TRUE; + fFastLoadFlag = TRUE; + } +} + + + + + + + + diff --git a/Laptop/AimHistory.h b/Laptop/AimHistory.h new file mode 100644 index 00000000..5a396825 --- /dev/null +++ b/Laptop/AimHistory.h @@ -0,0 +1,17 @@ +#ifndef __AIMHISTORY_H +#define __AIMHISTORY_H + +void GameInitAimHistory(); +BOOLEAN EnterAimHistory(); +void ExitAimHistory(); +void HandleAimHistory(); +void RenderAimHistory(); +void EnterInitAimHistory(); + +#endif + + + + + + diff --git a/Laptop/AimLinks.cpp b/Laptop/AimLinks.cpp new file mode 100644 index 00000000..4461cc1e --- /dev/null +++ b/Laptop/AimLinks.cpp @@ -0,0 +1,181 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "AimLinks.h" + #include "aim.h" + #include "Utilities.h" + #include "WCheck.h" + #include "WordWrap.h" + #include "Text.h" + #include "Multi Language Graphic Utils.h" +#endif + +#define AIM_LINK_TITLE_FONT FONT14ARIAL +#define AIM_LINK_TITLE_COLOR AIM_GREEN + +#define AIM_LINK_FONT FONT12ARIAL +#define AIM_LINK_COLOR AIM_FONT_GOLD + +#define AIM_LINK_NUM_LINKS 3 + +#define AIM_LINK_LINK_OFFSET_Y 94//90 + +#define AIM_LINK_LINK_WIDTH 420 +#define AIM_LINK_LINK_HEIGHT 70 + +#define AIM_LINK_BOBBY_LINK_X LAPTOP_SCREEN_UL_X + 40 +#define AIM_LINK_BOBBY_LINK_Y LAPTOP_SCREEN_WEB_UL_Y + 91 + +#define AIM_LINK_FUNERAL_LINK_X AIM_LINK_BOBBY_LINK_X +#define AIM_LINK_FUNERAL_LINK_Y AIM_LINK_BOBBY_LINK_Y + AIM_LINK_LINK_OFFSET_Y + +#define AIM_LINK_INSURANCE_LINK_X AIM_LINK_BOBBY_LINK_X +#define AIM_LINK_INSURANCE_LINK_Y AIM_LINK_FUNERAL_LINK_Y + AIM_LINK_LINK_OFFSET_Y + +#define AIM_LINK_TITLE_X IMAGE_OFFSET_X + 149 +#define AIM_LINK_TITLE_Y AIM_SYMBOL_Y + AIM_SYMBOL_SIZE_Y + 10 +#define AIM_LINK_TITLE_WIDTH AIM_SYMBOL_WIDTH + +#define AIM_LINK_LINK_TEXT_1_Y AIM_LINK_BOBBY_LINK_Y + 71 +#define AIM_LINK_LINK_TEXT_2_Y AIM_LINK_FUNERAL_LINK_Y + 36 +#define AIM_LINK_LINK_TEXT_3_Y AIM_LINK_INSURANCE_LINK_Y + 45 + + + + + + +UINT32 guiBobbyLink; +UINT32 guiFuneralLink; +UINT32 guiInsuranceLink; +UINT8 gubLinkPages[]={ + BOBBYR_BOOKMARK, + FUNERAL_BOOKMARK, + INSURANCE_BOOKMARK}; + +//Clicking on guys Face +MOUSE_REGION gSelectedLinkRegion[ AIM_LINK_NUM_LINKS ] ; +void SelectLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + +void GameInitAimLinks() +{ + +} + +BOOLEAN EnterAimLinks() +{ + VOBJECT_DESC VObjectDesc; + UINT16 usPosY; + INT16 i; + + InitAimDefaults(); + InitAimMenuBar(); + + // load the Bobby link graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_BOBBYRAYLINK ); + CHECKF(AddVideoObject(&VObjectDesc, &guiBobbyLink)); + + // load the Funeral graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_MORTUARYLINK ); + CHECKF(AddVideoObject(&VObjectDesc, &guiFuneralLink)); + + // load the Insurance graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_INSURANCELINK ); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsuranceLink)); + + usPosY = AIM_LINK_BOBBY_LINK_Y; + for(i=0; i 2 ) + { + DisplayWrappedString( AIM_MEDICAL_DEPOSIT_X, (UINT16)(AIM_MEDICAL_DEPOSIT_Y - GetFontHeight( AIM_FONT12ARIAL ) ), AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + } + else + DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X, AIM_MEDICAL_DEPOSIT_Y, AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + } + + LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString); + if( MercInfoString[0] != 0) + { + DisplayWrappedString(AIM_MERC_INFO_X, AIM_MERC_INFO_Y, AIM_MERC_INFO_WIDTH, 2, AIM_M_FONT_DYNAMIC_TEXT, AIM_FONT_MCOLOR_WHITE, MercInfoString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + if( AdditionalInfoString[0] != 0) + { + DrawTextToScreen(CharacterInfo[AIM_MEMBER_ADDTNL_INFO], AIM_MERC_ADD_X, AIM_MERC_ADD_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayWrappedString(AIM_MERC_ADD_INFO_X, AIM_MERC_ADD_INFO_Y, AIM_MERC_INFO_WIDTH, 2, AIM_M_FONT_DYNAMIC_TEXT, AIM_FONT_MCOLOR_WHITE, AdditionalInfoString, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + + return(TRUE); +} + + + +BOOLEAN LoadMercBioInfo(UINT8 ubIndex, STR16 pInfoString, STR16 pAddInfo) +{ + HWFILE hFile; + UINT32 uiBytesRead; + UINT16 i; + UINT32 uiStartSeekAmount; + + + hFile = FileOpen(MERCBIOSFILENAME, FILE_ACCESS_READ, FALSE); + if ( !hFile ) + { + return( FALSE ); + } + + + // Get current mercs bio info + uiStartSeekAmount = (SIZE_MERC_BIO_INFO + SIZE_MERC_ADDITIONAL_INFO) * ubIndex; + + if ( FileSeek( hFile, uiStartSeekAmount, FILE_SEEK_FROM_START ) == FALSE ) + { + return( FALSE ); + } + + if( !FileRead( hFile, pInfoString, SIZE_MERC_BIO_INFO, &uiBytesRead) ) + { + return( FALSE ); + } + + // Decrement, by 1, any value > 32 + for(i=0; (i 33 ) + pInfoString[i] -= 1; + #ifdef POLISH + switch( pInfoString[ i ] ) + { + case 260: pInfoString[ i ] = 165; break; + case 262: pInfoString[ i ] = 198; break; + case 280: pInfoString[ i ] = 202; break; + case 321: pInfoString[ i ] = 163; break; + case 323: pInfoString[ i ] = 209; break; + case 211: pInfoString[ i ] = 211; break; + + case 346: pInfoString[ i ] = 338; break; + case 379: pInfoString[ i ] = 175; break; + case 377: pInfoString[ i ] = 143; break; + case 261: pInfoString[ i ] = 185; break; + case 263: pInfoString[ i ] = 230; break; + case 281: pInfoString[ i ] = 234; break; + + case 322: pInfoString[ i ] = 179; break; + case 324: pInfoString[ i ] = 241; break; + case 243: pInfoString[ i ] = 243; break; + case 347: pInfoString[ i ] = 339; break; + case 380: pInfoString[ i ] = 191; break; + case 378: pInfoString[ i ] = 376; break; + } + #endif + } + + + // Get the additional info + uiStartSeekAmount = ((SIZE_MERC_BIO_INFO + SIZE_MERC_ADDITIONAL_INFO) * ubIndex )+ SIZE_MERC_BIO_INFO ; + if ( FileSeek( hFile, uiStartSeekAmount, FILE_SEEK_FROM_START ) == FALSE ) + { + return( FALSE ); + } + + if( !FileRead( hFile, pAddInfo, SIZE_MERC_ADDITIONAL_INFO, &uiBytesRead) ) + { + return( FALSE ); + } + + // Decrement, by 1, any value > 32 + for(i=0; (i 33 ) + pAddInfo[i] -= 1; + #ifdef POLISH + switch( pAddInfo[ i ] ) + { + case 260: pAddInfo[ i ] = 165; break; + case 262: pAddInfo[ i ] = 198; break; + case 280: pAddInfo[ i ] = 202; break; + case 321: pAddInfo[ i ] = 163; break; + case 323: pAddInfo[ i ] = 209; break; + case 211: pAddInfo[ i ] = 211; break; + + case 346: pAddInfo[ i ] = 338; break; + case 379: pAddInfo[ i ] = 175; break; + case 377: pAddInfo[ i ] = 143; break; + case 261: pAddInfo[ i ] = 185; break; + case 263: pAddInfo[ i ] = 230; break; + case 281: pAddInfo[ i ] = 234; break; + + case 322: pAddInfo[ i ] = 179; break; + case 324: pAddInfo[ i ] = 241; break; + case 243: pAddInfo[ i ] = 243; break; + case 347: pAddInfo[ i ] = 339; break; + case 380: pAddInfo[ i ] = 191; break; + case 378: pAddInfo[ i ] = 376; break; + } + #endif + } + + FileClose(hFile); + return(TRUE); +} + + +BOOLEAN DisplayMercsInventory(UINT8 ubMercID) +{ + UINT8 i; + INT16 PosX, PosY, sCenX, sCenY; + UINT16 usItem; + INVTYPE *pItem; + HVOBJECT hVObject; + UINT32 usHeight, usWidth; + ETRLEObject *pTrav; + UINT16 gzItemName[ SIZE_ITEM_NAME ]; + UINT8 ubItemCount=0; +// UINT16 gzTempItemName[ SIZE_ITEM_INFO ]; + + //if the mercs inventory has already been purchased, dont display the inventory + if( gMercProfiles[ ubMercID ].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS ) + return( TRUE ); + + + PosY = WEAPONBOX_Y; + PosX = WEAPONBOX_X+3; // + 3 ( 1 to take care of the shadow, +2 to get past the weapon box border ) + for(i=0; ipETRLEObject[ pItem->ubGraphicNum ] ); + + usHeight = (UINT32)pTrav->usHeight; + usWidth = (UINT32)pTrav->usWidth; + + sCenX = PosX + ( abs( WEAPONBOX_SIZE_X - 3 - usWidth ) / 2 ) - pTrav->sOffsetX; + sCenY = PosY + ( abs( WEAPONBOX_SIZE_Y - usHeight ) / 2 ) - pTrav->sOffsetY; + + //blt the shadow of the item + BltVideoObjectOutlineShadowFromIndex( FRAME_BUFFER, GetInterfaceGraphicForItem( pItem ), pItem->ubGraphicNum, sCenX-2, sCenY+2); + //blt the item + BltVideoObjectOutlineFromIndex( FRAME_BUFFER, GetInterfaceGraphicForItem( pItem ), pItem->ubGraphicNum, sCenX, sCenY, 0, FALSE ); + + + //if there are more then 1 piece of equipment in the current slot, display how many there are + if( gMercProfiles[ubMercID].bInvNumber[ i ] > 1 ) + { + wchar_t zTempStr[ 32 ]; +// UINT16 usWidthOfNumber; + + swprintf( zTempStr, L"x%d", gMercProfiles[ ubMercID ].bInvNumber[ i ] ); + + DrawTextToScreen( zTempStr, (UINT16)(PosX-1), (UINT16)(PosY+20), AIM_MEMBER_WEAPON_NAME_WIDTH, AIM_M_FONT_DYNAMIC_TEXT, AIM_M_WEAPON_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + } + else + { + } + + wcscpy( gzItemName, ShortItemNames[ usItem ] ); + + //if this will only be a single line, center it in the box + if( ( DisplayWrappedString( (UINT16)(PosX-1), AIM_MEMBER_WEAPON_NAME_Y, AIM_MEMBER_WEAPON_NAME_WIDTH, 2, AIM_M_WEAPON_TEXT_FONT, AIM_M_WEAPON_TEXT_COLOR, gzItemName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ) / GetFontHeight( AIM_M_WEAPON_TEXT_FONT ) ) == 1 ) + DisplayWrappedString( (UINT16)(PosX-1), (UINT16)(AIM_MEMBER_WEAPON_NAME_Y+GetFontHeight( AIM_M_WEAPON_TEXT_FONT )/2), AIM_MEMBER_WEAPON_NAME_WIDTH, 2, AIM_M_WEAPON_TEXT_FONT, AIM_M_WEAPON_TEXT_COLOR, gzItemName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + else + DisplayWrappedString( (UINT16)(PosX-1), AIM_MEMBER_WEAPON_NAME_Y, AIM_MEMBER_WEAPON_NAME_WIDTH, 2, AIM_M_WEAPON_TEXT_FONT, AIM_M_WEAPON_TEXT_COLOR, gzItemName, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + PosX += WEAPONBOX_SIZE_X; + } + } + + return(TRUE); +} + + + + +void BtnPreviousButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + InitCreateDeleteAimPopUpBox(AIM_POPUP_DELETE, NULL, NULL, 0, 0, 0); + + if( gbCurrentIndex > 0) + gbCurrentIndex--; + else + gbCurrentIndex = MAX_NUMBER_MERCS - 1; + + gfRedrawScreen = TRUE; + + gbCurrentSoldier = AimMercArray[gbCurrentIndex]; + + gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnContactButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + //if we are not already in the video conferemce mode, go in to it + if( !gubVideoConferencingMode) + { + + gubVideoConferencingMode = AIM_VIDEO_POPUP_MODE; +// gubVideoConferencingMode = AIM_VIDEO_INIT_MODE; + gfFirstTimeInContactScreen = TRUE; + } + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + InitCreateDeleteAimPopUpBox(AIM_POPUP_DELETE, NULL, NULL, 0, 0, 0); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnNextButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InitCreateDeleteAimPopUpBox(AIM_POPUP_DELETE, NULL, NULL, 0, 0, 0); + + if( gbCurrentIndex < MAX_NUMBER_MERCS-1 ) + gbCurrentIndex++; + else + gbCurrentIndex = 0; + + gbCurrentSoldier = AimMercArray[gbCurrentIndex]; + + gfRedrawScreen = TRUE; + + gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +BOOLEAN DisplayMercsFace() +{ + HVOBJECT hFaceHandle; + HVOBJECT hPortraitHandle; + STR sFaceLoc = "FACES\\BIGFACES\\"; + char sTemp[100]; + VOBJECT_DESC VObjectDesc; + SOLDIERTYPE *pSoldier=NULL; + + //See if the merc is currently hired + pSoldier = FindSoldierByProfileID( gbCurrentSoldier, TRUE ); + + // Portrait Frame + GetVideoObject(&hPortraitHandle, guiPortrait); + BltVideoObject(FRAME_BUFFER, hPortraitHandle, 0,PORTRAIT_X, PORTRAIT_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // load the Face graphic and add it + sprintf(sTemp, "%s%02d.sti", sFaceLoc, gbCurrentSoldier); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP(sTemp, VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiFace)); + + //Blt face to screen + GetVideoObject(&hFaceHandle, guiFace); + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,FACE_X, FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //if the merc is dead + if( IsMercDead( gbCurrentSoldier ) ) + { + //shade the face red, (to signif that he is dead) + hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); + + //get the face object + GetVideoObject(&hFaceHandle, guiFace); + + //set the red pallete to the face + SetObjectHandleShade( guiFace, 0 ); + + //Blt face to screen + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,FACE_X, FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //if the merc is dead, display it + DrawTextToScreen(AimPopUpText[AIM_MEMBER_DEAD], FACE_X+1, FACE_Y+107, FACE_WIDTH, FONT14ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + + //else if the merc is currently a POW or, the merc was fired as a pow + else if( gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_FIRED_AS_A_POW || ( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) ) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, FACE_X, FACE_Y, FACE_X + FACE_WIDTH, FACE_Y + FACE_HEIGHT); + DrawTextToScreen( pPOWStrings[0], FACE_X+1, FACE_Y+107, FACE_WIDTH, FONT14ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + + + //else if the merc has already been hired + else if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) ) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, FACE_X, FACE_Y, FACE_X + FACE_WIDTH, FACE_Y + FACE_HEIGHT); + DrawTextToScreen( MercInfo[MERC_FILES_ALREADY_HIRED], FACE_X+1, FACE_Y+107, FACE_WIDTH, FONT14ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + + else if( !IsMercHireable( gbCurrentSoldier ) ) + { + //else if the merc has a text file and the merc is not away + ShadowVideoSurfaceRect( FRAME_BUFFER, FACE_X, FACE_Y, FACE_X + FACE_WIDTH, FACE_Y + FACE_HEIGHT); + DrawTextToScreen(AimPopUpText[AIM_MEMBER_ON_ASSIGNMENT], FACE_X+1, FACE_Y+107, FACE_WIDTH, FONT14ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + + DeleteVideoObjectFromIndex(guiFace); + + return( TRUE ); +} + + +void DisplayMercStats() +{ + UINT8 ubColor; + + // + // Display all the static text + // + + //First column in stats box. Health, Agility, dexterity, strength, leadership, wisdom + DrawTextToScreen(CharacterInfo[AIM_MEMBER_HEALTH], STATS_FIRST_COL, HEALTH_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayDots(STATS_FIRST_COL, HEALTH_Y, FIRST_COLUMN_DOT, CharacterInfo[AIM_MEMBER_HEALTH]); + + DrawTextToScreen(CharacterInfo[AIM_MEMBER_AGILITY], STATS_FIRST_COL, AGILITY_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayDots(STATS_FIRST_COL, AGILITY_Y, FIRST_COLUMN_DOT, CharacterInfo[AIM_MEMBER_AGILITY]); + + DrawTextToScreen(CharacterInfo[AIM_MEMBER_DEXTERITY], STATS_FIRST_COL, DEXTERITY_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayDots(STATS_FIRST_COL, DEXTERITY_Y, FIRST_COLUMN_DOT, CharacterInfo[AIM_MEMBER_DEXTERITY]); + + DrawTextToScreen(CharacterInfo[AIM_MEMBER_STRENGTH], STATS_FIRST_COL, STRENGTH_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayDots(STATS_FIRST_COL, STRENGTH_Y, FIRST_COLUMN_DOT, CharacterInfo[AIM_MEMBER_STRENGTH]); + + DrawTextToScreen(CharacterInfo[AIM_MEMBER_LEADERSHIP], STATS_FIRST_COL, LEADERSHIP_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayDots(STATS_FIRST_COL, LEADERSHIP_Y, FIRST_COLUMN_DOT, CharacterInfo[AIM_MEMBER_LEADERSHIP]); + + DrawTextToScreen(CharacterInfo[AIM_MEMBER_WISDOM], STATS_FIRST_COL, WISDOM_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayDots(STATS_FIRST_COL, WISDOM_Y, FIRST_COLUMN_DOT, CharacterInfo[AIM_MEMBER_WISDOM]); + + + //Second column in stats box. Exp.Level, Markmanship, mechanical, explosive, medical + DrawTextToScreen(CharacterInfo[AIM_MEMBER_EXP_LEVEL], STATS_SECOND_COL, EXPLEVEL_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DisplayDots(STATS_SECOND_COL, EXPLEVEL_Y, SECOND_COLUMN_DOT, CharacterInfo[AIM_MEMBER_EXP_LEVEL]); + + DrawTextToScreen(CharacterInfo[AIM_MEMBER_MARKSMANSHIP], STATS_SECOND_COL, MARKSMAN_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT , FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DisplayDots(STATS_SECOND_COL, MARKSMAN_Y, SECOND_COLUMN_DOT, CharacterInfo[AIM_MEMBER_MARKSMANSHIP]); + + DrawTextToScreen(CharacterInfo[AIM_MEMBER_MECHANICAL], STATS_SECOND_COL, MECHANAICAL_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DisplayDots(STATS_SECOND_COL, MECHANAICAL_Y, SECOND_COLUMN_DOT, CharacterInfo[AIM_MEMBER_MECHANICAL]); + + DrawTextToScreen(CharacterInfo[AIM_MEMBER_EXPLOSIVE], STATS_SECOND_COL, EXPLOSIVE_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DisplayDots(STATS_SECOND_COL, EXPLOSIVE_Y, SECOND_COLUMN_DOT, CharacterInfo[AIM_MEMBER_EXPLOSIVE]); + + DrawTextToScreen(CharacterInfo[AIM_MEMBER_MEDICAL], STATS_SECOND_COL, MEDICAL_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DisplayDots(STATS_SECOND_COL, MEDICAL_Y, SECOND_COLUMN_DOT, CharacterInfo[AIM_MEMBER_MEDICAL]); + + + // + // Display all the Merc dynamic stat info + // + + //Name + DrawTextToScreen(gMercProfiles[gbCurrentSoldier].zName, NAME_X, NAME_Y, 0, FONT14ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + // Numbers for above. Health, Agility, dexterity, strength, leadership, wisdom + + ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bLife ); + DrawNumeralsToScreen( gMercProfiles[gbCurrentSoldier].bLife, 3, STATS_FIRST_NUM, HEALTH_Y, AIM_M_NUMBER_FONT, ubColor ); + + ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bAgility ); + DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bAgility, 3, STATS_FIRST_NUM, AGILITY_Y, AIM_M_NUMBER_FONT, ubColor ); + + ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bDexterity ); + DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bDexterity, 3, STATS_FIRST_NUM, DEXTERITY_Y, AIM_M_NUMBER_FONT, ubColor ); + + ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bStrength ); + DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bStrength, 3, STATS_FIRST_NUM, STRENGTH_Y, AIM_M_NUMBER_FONT, ubColor ); + + ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bLeadership ); + DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bLeadership, 3, STATS_FIRST_NUM, LEADERSHIP_Y, AIM_M_NUMBER_FONT, ubColor ); + + ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bWisdom ); + DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bWisdom, 3, STATS_FIRST_NUM, WISDOM_Y, AIM_M_NUMBER_FONT, ubColor ); + + //Second column in stats box. Exp.Level, Markmanship, mechanical, explosive, medical + +// ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bExpLevel ); + DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bExpLevel, 3, STATS_SECOND_NUM, EXPLEVEL_Y, AIM_M_NUMBER_FONT, FONT_MCOLOR_WHITE ); + + ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bMarksmanship ); + DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bMarksmanship, 3, STATS_SECOND_NUM, MARKSMAN_Y, AIM_M_NUMBER_FONT, ubColor ); + + ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bMechanical ); + DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bMechanical, 3, STATS_SECOND_NUM, MECHANAICAL_Y, AIM_M_NUMBER_FONT, ubColor ); + + ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bExplosive ); + DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bExplosive, 3, STATS_SECOND_NUM, EXPLOSIVE_Y, AIM_M_NUMBER_FONT, ubColor ); + + ubColor = GetStatColor( gMercProfiles[gbCurrentSoldier].bMedical ); + DrawNumeralsToScreen(gMercProfiles[gbCurrentSoldier].bMedical, 3, STATS_SECOND_NUM, MEDICAL_Y, AIM_M_NUMBER_FONT, ubColor ); +} + +UINT8 GetStatColor( INT8 bStat ) +{ + if( bStat >= 80 ) + return( HIGH_STAT_COLOR ); + else if( bStat >= 50 ) + return( MED_STAT_COLOR ); + else + return( LOW_STAT_COLOR ); +} + +//displays the dots between the stats and the stat name +void DisplayDots(UINT16 usNameX, UINT16 usNameY, UINT16 usStatX, STR16 pString) +{ + INT16 sNumberOfDots; + UINT16 usStringLength = StringPixLength(pString, AIM_M_FONT_STATIC_TEXT); + INT16 i; + UINT16 usPosX; + + sNumberOfDots = (usStatX - usNameX - usStringLength) / 7; + + usPosX = usStatX; + for(i=usNameX + usStringLength; i <= usPosX; usPosX-=7) + { + DrawTextToScreen(L".", (UINT16)usPosX, usNameY, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } +} + + +void BtnContractLengthButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + btn->uiFlags |= BUTTON_CLICKED_ON; + + gubContractLength = ubRetValue; + DisplaySelectLights(TRUE, FALSE); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + DisplaySelectLights(FALSE, FALSE); + + guiMercAttitudeTime = GetJA2Clock(); + + DisplayMercChargeAmount(); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + +// InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnBuyEquipmentButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + gfBuyEquipment = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + DisplaySelectLights(FALSE, TRUE); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + DisplaySelectLights(FALSE, FALSE); + DisplayMercChargeAmount(); + + guiMercAttitudeTime = GetJA2Clock(); + +// InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +//Transfer funds button callback +void BtnAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + gfStopMercFromTalking = TRUE; + gubMercAttitudeLevel = QUOTE_DELAY_NO_ACTION; + + //If we try to hire the merc + if( ubRetValue == 0) + { + StopMercTalking(); + + //can the merc be hired? (does he like/not like people on the team +// if( CanMercBeHired() ) + { + //Was the merc hired + if( AimMemberHireMerc() ) + { + // if merc was hired + InitCreateDeleteAimPopUpBox(AIM_POPUP_CREATE, AimPopUpText[AIM_MEMBER_FUNDS_TRANSFER_SUCCESFUL], NULL, AIM_POPUP_BOX_X, AIM_POPUP_BOX_Y, AIM_POPUP_BOX_SUCCESS); + DelayMercSpeech( gbCurrentSoldier, QUOTE_CONTRACT_ACCEPTANCE, 750, TRUE, FALSE ); + + //Disable the buttons behind the message box + EnableDisableCurrentVideoConferenceButtons( TRUE ); + + SpecifyDisabledButtonStyle( giBuyEquipmentButton[0], DISABLED_STYLE_NONE ); + SpecifyDisabledButtonStyle( giBuyEquipmentButton[1], DISABLED_STYLE_NONE ); + + giIdOfLastHiredMerc = AimMercArray[gbCurrentIndex]; + } + } +/* + else + { + //else the merc doesnt like a player on the team, hang up when the merc is done complaining + + //reset ( in case merc was going to say something + DelayMercSpeech( 0, 0, 0, FALSE, TRUE ); + + gubVideoConferencingMode = AIM_VIDEO_HIRE_MERC_MODE; + } +*/ + } + // else we cancel + else + { + gubVideoConferencingMode = AIM_VIDEO_FIRST_CONTACT_MERC_MODE; + } + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + +INT8 AimMemberHireMerc() +{ + MERC_HIRE_STRUCT HireMercStruct; + UINT8 ubCurrentSoldier = AimMercArray[gbCurrentIndex]; + INT8 bReturnCode; + INT16 sSoldierID=0; + INT8 bTypeOfContract=0; + + + if( LaptopSaveInfo.iCurrentBalance < giContractAmount ) + { + //wasnt hired because of lack of funds + InitCreateDeleteAimPopUpBox(AIM_POPUP_CREATE, AimPopUpText[AIM_MEMBER_FUNDS_TRANSFER_FAILED], AimPopUpText[AIM_MEMBER_NOT_ENOUGH_FUNDS], AIM_POPUP_BOX_X, AIM_POPUP_BOX_Y, AIM_POPUP_BOX_FAILURE); + + //Disable the buttons behind the message box + EnableDisableCurrentVideoConferenceButtons( TRUE ); + + SpecifyDisabledButtonStyle( giBuyEquipmentButton[0], DISABLED_STYLE_NONE ); + SpecifyDisabledButtonStyle( giBuyEquipmentButton[1], DISABLED_STYLE_NONE ); + + DelayMercSpeech( gbCurrentSoldier, QUOTE_REFUSAL_TO_JOIN_LACK_OF_FUNDS, 750, TRUE, FALSE ); + + return(FALSE); + } + + memset(&HireMercStruct, 0, sizeof(MERC_HIRE_STRUCT)); + + HireMercStruct.ubProfileID = ubCurrentSoldier; + + //DEF: temp + HireMercStruct.sSectorX = gsMercArriveSectorX; + HireMercStruct.sSectorY = gsMercArriveSectorY; + HireMercStruct.fUseLandingZoneForArrival = TRUE; + HireMercStruct.ubInsertionCode = INSERTION_CODE_ARRIVING_GAME; + + HireMercStruct.fCopyProfileItemsOver = gfBuyEquipment; + //if the players is buyibng the equipment + if( gfBuyEquipment ) + { + gMercProfiles[ ubCurrentSoldier ].ubMiscFlags |= PROFILE_MISC_FLAG_ALREADY_USED_ITEMS; + } + + //If 1 day + if( gubContractLength == AIM_CONTRACT_LENGTH_ONE_DAY) + { + bTypeOfContract = CONTRACT_EXTEND_1_DAY; + HireMercStruct.iTotalContractLength = 1; + } + else if( gubContractLength == AIM_CONTRACT_LENGTH_ONE_WEEK) + { + bTypeOfContract = CONTRACT_EXTEND_1_WEEK; + HireMercStruct.iTotalContractLength = 7; + } + else if( gubContractLength == AIM_CONTRACT_LENGTH_TWO_WEEKS) + { + bTypeOfContract = CONTRACT_EXTEND_2_WEEK; + HireMercStruct.iTotalContractLength = 14; + } + + //specify when the merc should arrive + HireMercStruct.uiTimeTillMercArrives = GetMercArrivalTimeOfDay( );// + ubCurrentSoldier + + //Set the time and ID of the last hired merc will arrive +// LaptopSaveInfo.sLastHiredMerc.iIdOfMerc = HireMercStruct.ubProfileID; +// LaptopSaveInfo.sLastHiredMerc.uiArrivalTime = HireMercStruct.uiTimeTillMercArrives; + + //if we succesfully hired the merc + bReturnCode = HireMerc( &HireMercStruct ); + if( bReturnCode == MERC_HIRE_OVER_20_MERCS_HIRED ) + { + //display a warning saying u cant hire more then 20 mercs + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_20_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return(FALSE); + } + else if( bReturnCode == MERC_HIRE_FAILED ) + { + return(FALSE); + } + + //Set the type of contract the merc is on + sSoldierID = GetSoldierIDFromMercID( ubCurrentSoldier ); + if( sSoldierID == -1 ) + return( FALSE ); + Menptr[ sSoldierID ].bTypeOfLastContract = bTypeOfContract; + + + //add an entry in the finacial page for the hiring of the merc + AddTransactionToPlayersBook(HIRED_MERC, ubCurrentSoldier, GetWorldTotalMin(), -( giContractAmount - gMercProfiles[gbCurrentSoldier].sMedicalDepositAmount ) ); + + if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit ) + { + //add an entry in the finacial page for the medical deposit + AddTransactionToPlayersBook( MEDICAL_DEPOSIT, ubCurrentSoldier, GetWorldTotalMin(), -(gMercProfiles[gbCurrentSoldier].sMedicalDepositAmount) ); + } + + //add an entry in the history page for the hiring of the merc + AddHistoryToPlayersLog(HISTORY_HIRED_MERC_FROM_AIM, ubCurrentSoldier, GetWorldTotalMin(), -1, -1 ); + return(TRUE); +} + + + +BOOLEAN DisplayVideoConferencingDisplay() +{ + wchar_t sMercName[128]; + + if( ( gubVideoConferencingMode == AIM_VIDEO_NOT_DISPLAYED_MODE ) || ( gubVideoConferencingMode == AIM_VIDEO_POPUP_MODE ) ) + return(FALSE); + + DisplayMercsVideoFace(); + + //Title & Name + if( gubVideoConferencingMode == AIM_VIDEO_INIT_MODE) + { + swprintf( sMercName, L"%s", VideoConfercingText[AIM_MEMBER_CONNECTING]); + DrawTextToScreen(sMercName, AIM_MEMBER_VIDEO_NAME_X, AIM_MEMBER_VIDEO_NAME_Y, 0, FONT12ARIAL, AIM_M_VIDEO_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + else + { + swprintf( sMercName, L"%s %s", VideoConfercingText[AIM_MEMBER_VIDEO_CONF_WITH], gMercProfiles[gbCurrentSoldier].zName); + DrawTextToScreen(sMercName, AIM_MEMBER_VIDEO_NAME_X, AIM_MEMBER_VIDEO_NAME_Y, 0, FONT12ARIAL, AIM_M_VIDEO_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + + //Display Contract charge text + if( gubVideoConferencingMode == AIM_VIDEO_HIRE_MERC_MODE ) + { + // Display the contract charge + SetFontShadow(AIM_M_VIDEO_NAME_SHADOWCOLOR); + DrawTextToScreen(VideoConfercingText[AIM_MEMBER_CONTRACT_CHARGE], AIM_CONTRACT_CHARGE_X, AIM_CONTRACT_CHARGE_Y, 0, FONT12ARIAL, AIM_M_VIDEO_NAME_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + SetFontShadow(DEFAULT_SHADOW); + } + + DisplayMercChargeAmount(); + +// if( gfMercIsTalking && !gfIsAnsweringMachineActive) + if( gfMercIsTalking && gGameSettings.fOptions[ TOPTION_SUBTITLES ] ) + { + UINT16 usActualWidth; + UINT16 usActualHeight; + UINT16 usPosX; + + SET_USE_WINFONTS( TRUE ); + SET_WINFONT( giSubTitleWinFont ); + + iAimMembersBoxId = PrepareMercPopupBox( iAimMembersBoxId ,BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, gsTalkingMercText, 300, 0, 0, 0, &usActualWidth, &usActualHeight); + + SET_USE_WINFONTS( FALSE ); + + usPosX = iScreenWidthOffset + ( 613 - usActualWidth ) / 2 ; + + RenderMercPopUpBoxFromIndex( iAimMembersBoxId, usPosX, TEXT_POPUP_WINDOW_Y, FRAME_BUFFER); + + if( RemoveMercPopupBoxFromIndex( iAimMembersBoxId ) ) + { + iAimMembersBoxId = -1; + } + } + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + + return(TRUE); +} + +BOOLEAN DisplayMercsVideoFace() +{ + HVOBJECT hTerminalHandle; + STR sFaceLoc = "FACES\\"; + + // Get and Blt Terminal Frame + GetVideoObject(&hTerminalHandle, guiVideoConfTerminal); + ShadowVideoSurfaceImage( FRAME_BUFFER, hTerminalHandle, AIM_MEMBER_VIDEO_CONF_TERMINAL_X, AIM_MEMBER_VIDEO_CONF_TERMINAL_Y); + BltVideoObject(FRAME_BUFFER, hTerminalHandle, 0,AIM_MEMBER_VIDEO_CONF_TERMINAL_X, AIM_MEMBER_VIDEO_CONF_TERMINAL_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + //Display the Select light on the merc + if(gubVideoConferencingMode == AIM_VIDEO_HIRE_MERC_MODE) + DisplaySelectLights(FALSE, FALSE); + + return(TRUE); +} + +void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown) +{ + UINT16 i, usPosY, usPosX; + + //First draw the select light for the contract length buttons + usPosY = AIM_MEMBER_BUY_CONTRACT_LENGTH_Y; + for(i=0; i<3; i++) + { + // if the if is true, the light is on + if( gubContractLength == i) + { + if( fContractDown) + { + usPosX = AIM_MEMBER_BUY_CONTRACT_LENGTH_X + AIM_SELECT_LIGHT_ON_X; + ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY+AIM_SELECT_LIGHT_ON_Y, usPosX+8, usPosY+AIM_SELECT_LIGHT_ON_Y+8, Get16BPPColor( FROMRGB( 0, 255, 0 ) ) ); + } + else + { + usPosX = AIM_MEMBER_BUY_CONTRACT_LENGTH_X + AIM_SELECT_LIGHT_OFF_X; + ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY+AIM_SELECT_LIGHT_OFF_Y, usPosX+8, usPosY+AIM_SELECT_LIGHT_OFF_Y+8, Get16BPPColor( FROMRGB( 0, 255, 0 ) ) ); + } + } + else + { + usPosX = AIM_MEMBER_BUY_CONTRACT_LENGTH_X + AIM_SELECT_LIGHT_OFF_X; + ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY+AIM_SELECT_LIGHT_OFF_Y, usPosX+8, usPosY+AIM_SELECT_LIGHT_OFF_Y+8, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + } + usPosY += AIM_MEMBER_BUY_EQUIPMENT_GAP; + } + + //draw the select light for the buy equipment buttons + usPosY = AIM_MEMBER_BUY_CONTRACT_LENGTH_Y; + for(i=0; i<2; i++) + { + if( gfBuyEquipment == i) + { + if( fBuyEquipDown) + { + usPosX = AIM_MEMBER_BUY_EQUIPMENT_X + AIM_SELECT_LIGHT_ON_X; + ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY+AIM_SELECT_LIGHT_ON_Y, usPosX+8, usPosY+AIM_SELECT_LIGHT_ON_Y+8, Get16BPPColor( FROMRGB( 0, 255, 0 ) ) ); + } + else + { + usPosX = AIM_MEMBER_BUY_EQUIPMENT_X + AIM_SELECT_LIGHT_OFF_X; + ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY+AIM_SELECT_LIGHT_OFF_Y, usPosX+8, usPosY+AIM_SELECT_LIGHT_OFF_Y+8, Get16BPPColor( FROMRGB( 0, 255, 0 ) ) ); + } + } + else + { + usPosX = AIM_MEMBER_BUY_EQUIPMENT_X + AIM_SELECT_LIGHT_OFF_X; + ColorFillVideoSurfaceArea( FRAME_BUFFER, usPosX, usPosY+AIM_SELECT_LIGHT_OFF_Y, usPosX+8, usPosY+AIM_SELECT_LIGHT_OFF_Y+8, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + } + usPosY += AIM_MEMBER_BUY_EQUIPMENT_GAP; + } + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + +UINT32 DisplayMercChargeAmount() +{ + wchar_t wTemp[50]; + wchar_t wDollarTemp[50]; + HVOBJECT hImageHandle; + + + if( gubVideoConferencingMode != AIM_VIDEO_HIRE_MERC_MODE ) + return(0); + + // Display the 'black hole'for the contract charge in the video conference terminal + GetVideoObject(&hImageHandle, guiVideoContractCharge); + BltVideoObject(FRAME_BUFFER, hImageHandle, 0,AIM_MEMBER_VIDEO_CONF_CONTRACT_IMAGE_X, AIM_MEMBER_VIDEO_CONF_CONTRACT_IMAGE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) == NULL ) + { + giContractAmount = 0; + + //the contract charge amount + + // Get the salary rate + if( gubContractLength == AIM_CONTRACT_LENGTH_ONE_DAY) + giContractAmount = gMercProfiles[gbCurrentSoldier].sSalary; + + else if( gubContractLength == AIM_CONTRACT_LENGTH_ONE_WEEK) + giContractAmount = gMercProfiles[gbCurrentSoldier].uiWeeklySalary; + + else if( gubContractLength == AIM_CONTRACT_LENGTH_TWO_WEEKS) + giContractAmount = gMercProfiles[gbCurrentSoldier].uiBiWeeklySalary; + + // if there is a medical deposit, add it in + if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit ) + { + giContractAmount += gMercProfiles[gbCurrentSoldier].sMedicalDepositAmount; + } + + //If hired with the equipment, add it in aswell + if( gfBuyEquipment ) + { + giContractAmount += gMercProfiles[gbCurrentSoldier].usOptionalGearCost; + } + } + + + swprintf( wDollarTemp, L"%d", giContractAmount); + InsertCommasForDollarFigure( wDollarTemp ); + InsertDollarSignInToString( wDollarTemp ); + + //if the merc hasnt just been hired +// if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) == NULL ) + { + if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit ) + swprintf(wTemp, L"%s %s", wDollarTemp, VideoConfercingText[AIM_MEMBER_WITH_MEDICAL] ); + else + swprintf(wTemp, L"%s", wDollarTemp ); + + DrawTextToScreen(wTemp, AIM_CONTRACT_CHARGE_AMOUNNT_X+1, AIM_CONTRACT_CHARGE_AMOUNNT_Y+3, 0, AIM_M_VIDEO_CONTRACT_AMOUNT_FONT, AIM_M_VIDEO_CONTRACT_AMOUNT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + + return(giContractAmount); +} + +BOOLEAN InitCreateDeleteAimPopUpBox(UINT8 ubFlag, STR16 sString1, STR16 sString2, UINT16 usPosX, UINT16 usPosY, UINT8 ubData) +{ + VOBJECT_DESC VObjectDesc; + HVOBJECT hPopupBoxHandle; + static UINT16 usPopUpBoxPosX, usPopUpBoxPosY; + static wchar_t sPopUpString1[400], sPopUpString2[400]; + static BOOLEAN fPopUpBoxActive = FALSE;; + + switch( ubFlag ) + { + case AIM_POPUP_CREATE: + { + if( fPopUpBoxActive ) + return(FALSE); + + //Disable the 'X' to close the pop upi video + DisableButton( giXToCloseVideoConfButton ); + + if(sString1 != NULL) + wcscpy(sPopUpString1, sString1); + else + sPopUpString1[0] = L'\0'; + + if(sString2 != NULL) + wcscpy(sPopUpString2, sString2); + else + sPopUpString2[0] = L'\0'; + + usPopUpBoxPosX = usPosX; + usPopUpBoxPosY = usPosY; + + // load the popup box graphic + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\VideoConfPopUp.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiPopUpBox)); + + GetVideoObject(&hPopupBoxHandle, guiPopUpBox); + BltVideoObject(FRAME_BUFFER, hPopupBoxHandle, 0,usPosX, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); + + //Create the popup boxes button + guiPopUpImage = LoadButtonImage("LAPTOP\\VideoConfButtons.sti", -1,2,-1,3,-1 ); + guiPopUpOkButton = CreateIconAndTextButton( guiPopUpImage, VideoConfercingText[AIM_MEMBER_OK], + FONT14ARIAL, + AIM_POPUP_BOX_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_POPUP_BOX_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + (UINT16)(usPosX+AIM_POPUP_BOX_BUTTON_OFFSET_X), (UINT16)(usPosY+AIM_POPUP_BOX_BUTTON_OFFSET_Y), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH+5, + DEFAULT_MOVE_CALLBACK, BtnPopUpOkButtonCallback); + SetButtonCursor(guiPopUpOkButton, CURSOR_LAPTOP_SCREEN); + MSYS_SetBtnUserData( guiPopUpOkButton, 0, ubData); + + fPopUpBoxActive = TRUE; + gubPopUpBoxAction = AIM_POPUP_DISPLAY; + + + // Disable the current video conference buttons + //EnableDisableCurrentVideoConferenceButtons(TRUE); + if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE ) + { + // Enable the current video conference buttons + EnableDisableCurrentVideoConferenceButtons(FALSE); + } + + + +// +// Create a new flag for the PostButtonRendering function +// + fReDrawPostButtonRender = TRUE; + } + break; + + case AIM_POPUP_DISPLAY: + { + HVOBJECT hPopupBoxHandle; + UINT16 usTempPosY = usPopUpBoxPosY; + + if( gubPopUpBoxAction != AIM_POPUP_DISPLAY) + return(FALSE); + + // load and display the popup box graphic + GetVideoObject(&hPopupBoxHandle, guiPopUpBox); + BltVideoObject(FRAME_BUFFER, hPopupBoxHandle, 0,usPopUpBoxPosX, usPopUpBoxPosY, VO_BLT_SRCTRANSPARENCY,NULL); + + SetFontShadow(AIM_M_VIDEO_NAME_SHADOWCOLOR); + + usTempPosY += AIM_POPUP_BOX_STRING1_Y; + if( sPopUpString1[0] != L'\0') + usTempPosY += DisplayWrappedString(usPopUpBoxPosX, usTempPosY, AIM_POPUP_BOX_WIDTH, 2, AIM_POPUP_BOX_FONT, AIM_POPUP_BOX_COLOR, sPopUpString1, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + if( sPopUpString2[0] != L'\0') + DisplayWrappedString(usPopUpBoxPosX, (UINT16)(usTempPosY+4), AIM_POPUP_BOX_WIDTH, 2, AIM_POPUP_BOX_FONT, AIM_POPUP_BOX_COLOR, sPopUpString2, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + SetFontShadow(DEFAULT_SHADOW); + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + + } + break; + + case AIM_POPUP_DELETE: + { + if( !fPopUpBoxActive ) + return(FALSE); + + //Disable the 'X' to close the pop upi video + EnableButton( giXToCloseVideoConfButton ); + + UnloadButtonImage( guiPopUpImage ); + RemoveButton( guiPopUpOkButton ); + DeleteVideoObjectFromIndex( guiPopUpBox ); + + fPopUpBoxActive = FALSE; + gubPopUpBoxAction = AIM_POPUP_NOTHING; + + if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE ) + { + // Enable the current video conference buttons + EnableDisableCurrentVideoConferenceButtons(FALSE); + } + else if( gubVideoConferencingPreviousMode == AIM_VIDEO_MERC_ANSWERING_MACHINE_MODE ) + { + EnableButton( giAnsweringMachineButton[1]); + } + } + break; + } + + return(TRUE); +} + + +void BtnPopUpOkButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + static BOOLEAN fInCallback=TRUE; + + if( fInCallback ) + { + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT8 ubCurPageNum = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + fInCallback = FALSE; + +// gfStopMercFromTalking = TRUE; + + gubPopUpBoxAction = AIM_POPUP_DELETE; + + if( gubVideoConferencingMode != AIM_VIDEO_NOT_DISPLAYED_MODE ) + { + if( ubCurPageNum == AIM_POPUP_BOX_SUCCESS) + { + gubVideoConferencingMode = AIM_VIDEO_HIRE_MERC_MODE; + WaitForMercToFinishTalkingOrUserToClick(); + } + // gubVideoConferencingMode = AIM_VIDEO_POPDOWN_MODE; + else + gubVideoConferencingMode = AIM_VIDEO_HIRE_MERC_MODE; + } + + fInCallback = TRUE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } +} + +// we first contact merc. We either go to hire him or cancel the call +void BtnFirstContactButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + +// gfStopMercFromTalking = TRUE; + StopMercTalking(); + + gfAimMemberCanMercSayOpeningQuote = FALSE; + + if( ubRetValue == 0) + { + if( CanMercBeHired() ) + { + gubVideoConferencingMode = AIM_VIDEO_HIRE_MERC_MODE; + } + } + else + { + gubVideoConferencingMode = AIM_VIDEO_POPDOWN_MODE; + } + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnAnsweringMachineButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + UINT8 ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if( ubRetValue == 0) + { + //Set a flag indicating that the merc has a message + gMercProfiles[ gbCurrentSoldier ].ubMiscFlags3 |= PROFILE_MISC_FLAG3_PLAYER_LEFT_MSG_FOR_MERC_AT_AIM; + WaitForMercToFinishTalkingOrUserToClick(); + + //Display a message box displaying a messsage that the message was recorded +// DoLapTopMessageBox( 10, AimPopUpText[ AIM_MEMBER_MESSAGE_RECORDED ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL ); + InitCreateDeleteAimPopUpBox( AIM_POPUP_CREATE, L" ", AimPopUpText[ AIM_MEMBER_MESSAGE_RECORDED ], AIM_POPUP_BOX_X, AIM_POPUP_BOX_Y, AIM_POPUP_BOX_SUCCESS ); + + + SpecifyDisabledButtonStyle( giAnsweringMachineButton[1], DISABLED_STYLE_NONE ); + DisableButton( giAnsweringMachineButton[1]); + DisableButton( giAnsweringMachineButton[0] ); + } + else + { + gubVideoConferencingMode = AIM_VIDEO_POPDOWN_MODE; +// gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE; + } + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnHangUpButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(CONTACT_X,CONTACT_BOX_Y,CONTACT_BR_X,CONTACT_BR_Y); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { +// gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE; + gubVideoConferencingMode = AIM_VIDEO_POPDOWN_MODE; + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + InvalidateRegion(CONTACT_X,CONTACT_BOX_Y,CONTACT_BR_X,CONTACT_BR_Y); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(CONTACT_X,CONTACT_BOX_Y,CONTACT_BR_X,CONTACT_BR_Y); + } +} + +// InitVideoFace() is called once to initialize things +BOOLEAN InitVideoFace(UINT8 ubMercID) +{ + //Create the facial index + giMercFaceIndex = InitFace( ubMercID, NOBODY, 0 ); + + SetAutoFaceActive( guiVideoFaceBackground, FACE_AUTO_RESTORE_BUFFER , giMercFaceIndex, 0, 0); + + RenderAutoFace( giMercFaceIndex ); + + gubCurrentStaticMode = VC_NO_STATIC; + + gfVideoFaceActive = TRUE; + + guiMercAttitudeTime = GetJA2Clock(); + + return(TRUE); +} + + +// InitVideoFaceTalking() is called to start a merc speaking a particular message +BOOLEAN InitVideoFaceTalking(UINT8 ubMercID, UINT16 usQuoteNum) +{ + + //Starts the merc talking + if(!CharacterDialogue( ubMercID, usQuoteNum, giMercFaceIndex, DIALOGUE_CONTACTPAGE_UI, FALSE , FALSE) ) + { + return(FALSE); + } + + //Enables it so if a player clicks, he will shutup the merc + MSYS_EnableRegion(&gSelectedShutUpMercRegion); + + gfIsShutUpMouseRegionActive = TRUE; + gfMercIsTalking = TRUE; + guiTimeThatMercStartedTalking = GetJA2Clock(); + return(TRUE); +} + + +BOOLEAN DisplayTalkingMercFaceForVideoPopUp(INT32 iFaceIndex) +{ + static BOOLEAN fWasTheMercTalking=FALSE; + BOOLEAN fIsTheMercTalking; + SGPRect SrcRect; + SGPRect DestRect; + + + //Test + SrcRect.iLeft = 0; + SrcRect.iTop = 0; + SrcRect.iRight = 48; + SrcRect.iBottom = 43; + + DestRect.iLeft = AIM_MEMBER_VIDEO_FACE_X; + DestRect.iTop = AIM_MEMBER_VIDEO_FACE_Y; + DestRect.iRight = DestRect.iLeft + AIM_MEMBER_VIDEO_FACE_WIDTH; + DestRect.iBottom = DestRect.iTop + AIM_MEMBER_VIDEO_FACE_HEIGHT; + + + + //If the answering machine graphics is up, dont handle the faces + if( gfIsAnsweringMachineActive ) + { + gFacesData[ giMercFaceIndex ].fInvalidAnim = TRUE; + } + + HandleDialogue(); + HandleAutoFaces( ); + HandleTalkingAutoFaces( ); + + //If the answering machine is up, dont display the face +// if( !gfIsAnsweringMachineActive ) + { + //Blt the face surface to the video background surface + if( !BltStretchVideoSurface(FRAME_BUFFER, guiVideoFaceBackground, 0, 0, VO_BLT_SRCTRANSPARENCY, &SrcRect, &DestRect ) ) + return(FALSE); + + //if the merc is not at home and the players is leaving a message, shade the players face + if( gfIsAnsweringMachineActive ) + ShadowVideoSurfaceRect( FRAME_BUFFER, DestRect.iLeft, DestRect.iTop, DestRect.iRight-1, DestRect.iBottom-1 ); + + + //If the answering machine graphics is up, place a message on the screen + if( gfIsAnsweringMachineActive ) + { + //display a message over the mercs face + DisplayWrappedString( AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y+20, AIM_MEMBER_VIDEO_FACE_WIDTH, 2, FONT14ARIAL, 145, AimPopUpText[ AIM_MEMBER_PRERECORDED_MESSAGE ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + + + InvalidateRegion(AIM_MEMBER_VIDEO_FACE_X,AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH,AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT); + } + + fIsTheMercTalking = gFacesData[iFaceIndex].fTalking; + + //if the merc is talking, reset their attitude time + if( fIsTheMercTalking ) + { + //def added 3/18/99 + guiMercAttitudeTime = GetJA2Clock(); + } + + //if the text the merc is saying is really short, extend the time that it is on the screen + if( ( GetJA2Clock() - guiTimeThatMercStartedTalking ) > usAimMercSpeechDuration ) + { + //if the merc just stopped talking + if(fWasTheMercTalking && !fIsTheMercTalking ) + { + fWasTheMercTalking = FALSE; + + gfRedrawScreen = TRUE; + guiMercAttitudeTime = GetJA2Clock(); + + StopMercTalking(); + } + } + else if( fIsTheMercTalking ) + { + fWasTheMercTalking = fIsTheMercTalking; + } + + return(fIsTheMercTalking); +} + +void DisplayTextForMercFaceVideoPopUp(INT16 * pString) +{ + +#ifdef TAIWANESE + swprintf( gsTalkingMercText, L"%s", pString ); +#else + swprintf( gsTalkingMercText, L"\"%s\"", pString ); +#endif + + //Set the minimum time for the dialogue text to be present + usAimMercSpeechDuration = wcslen( gsTalkingMercText ) * AIM_TEXT_SPEECH_MODIFIER; + + if( usAimMercSpeechDuration < MINIMUM_TALKING_TIME_FOR_MERC ) + usAimMercSpeechDuration = MINIMUM_TALKING_TIME_FOR_MERC; + + + gfRedrawScreen = TRUE; +} + + + +void SelectShutUpMercRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + BOOLEAN fInCallBack=TRUE; + + if(fInCallBack) + { + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + gfStopMercFromTalking = TRUE; + } + else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + fInCallBack = FALSE; + + gfStopMercFromTalking = TRUE; + fInCallBack = TRUE; + } + } +} + + +UINT8 WillMercAcceptCall() +{ + //if merc has hung up on the player twice within a period of time (MERC_ANNOYED_WONT_CONTACT_TIME_MINUTES )the merc cant ber hired + if( gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_ANNOYED_WONT_CONTACT ) + { + return(AIM_VIDEO_MERC_UNAVAILABLE_MODE); + } + + //if the merc is currently on contract, the answering machine will pick up. + if( (gMercProfiles[ gbCurrentSoldier ].bMercStatus > 0 ) || (gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_HAS_NO_TEXT_FILE ) || (gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_HIRED_BUT_NOT_ARRIVED_YET ) ) + { + return(AIM_VIDEO_MERC_ANSWERING_MACHINE_MODE); + } + + // if the merc is at home, or if the merc is only slightly annoyed at the player, he will greet the player + if( IsMercHireable( gbCurrentSoldier ) ) + { + return(AIM_VIDEO_FIRST_CONTACT_MERC_MODE); + } + else + return(AIM_VIDEO_MERC_ANSWERING_MACHINE_MODE); +} + + + +BOOLEAN CanMercBeHired() +{ + UINT8 i,j; + INT8 bMercID; + BOOLEAN fRetVal = FALSE; + BOOLEAN fBuddyOnTeam=FALSE; + + + + StopMercTalking(); + + // if the merc recently came back with poor morale, and hasn't gotten over it yet + if (gMercProfiles[ gbCurrentSoldier ].ubDaysOfMoraleHangover > 0) + { + // then he refuses with a lame excuse. Buddy or no buddy. + WaitForMercToFinishTalkingOrUserToClick(); + InitVideoFaceTalking( gbCurrentSoldier, QUOTE_LAME_REFUSAL ); + return( FALSE ); + } + + + // loop through the list of people the merc hates + for(i=0; i< NUMBER_HATED_MERCS_ONTEAM; i++) + { + //see if someone the merc hates is on the team + bMercID = gMercProfiles[ gbCurrentSoldier ].bHated[i]; + + if( bMercID < 0 ) + continue; + + //if the hated merc is dead + if( IsMercDead( bMercID ) ) + { + //ignore the merc + continue; + } + + if( IsMercOnTeamAndInOmertaAlready( bMercID ) ) + { + //if the merc hates someone on the team, see if a buddy is on the team + for(j=0; j< NUMBER_HATED_MERCS_ONTEAM; j++) + { + //if a buddy is on the team, the merc will join + bMercID = gMercProfiles[ gbCurrentSoldier ].bBuddy[j]; + + if( bMercID < 0 ) + continue; + + if( IsMercOnTeam( bMercID ) && !IsMercDead( bMercID ) ) + { + if(j == 0 ) + { + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_JOINING_CAUSE_BUDDY_1_ON_TEAM); + } + else if(j == 1 ) + { + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_JOINING_CAUSE_BUDDY_2_ON_TEAM); + } + else + { + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_JOINING_CAUSE_LEARNED_TO_LIKE_BUDDY_ON_TEAM); + } + + return(TRUE); + } + } + + // the merc doesnt like anybody on the team + //if merc doesnt like first hated merc + if( i == 0) + { + if( gMercProfiles[ gbCurrentSoldier ].bHatedTime[ i ] < 24 ) + { + WaitForMercToFinishTalkingOrUserToClick(); + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_HATE_MERC_1_ON_TEAM); + fRetVal = FALSE; + } + else + { + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_PERSONALITY_BIAS_WITH_MERC_1); + fRetVal = TRUE; + } + } + else if( i == 1) + { + if( gMercProfiles[ gbCurrentSoldier ].bHatedTime[ i ] < 24 ) + { + WaitForMercToFinishTalkingOrUserToClick(); + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_HATE_MERC_2_ON_TEAM); + fRetVal = FALSE; + } + else + { + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_PERSONALITY_BIAS_WITH_MERC_2); +// DelayMercSpeech( gbCurrentSoldier, QUOTE_PERSONALITY_BIAS_WITH_MERC_2, 750, TRUE, FALSE ); + fRetVal = TRUE; + } + } + else + { + WaitForMercToFinishTalkingOrUserToClick(); + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_LEARNED_TO_HATE_MERC_ON_TEAM); + fRetVal = FALSE; + } + + return( fRetVal ); + } + } + + //Is a buddy working on the team + fBuddyOnTeam = DoesMercHaveABuddyOnTheTeam( gbCurrentSoldier ); + + //If the merc doesnt have a buddy on the team + if( !fBuddyOnTeam ) + { + // Check the players Death rate + if( MercThinksDeathRateTooHigh( gbCurrentSoldier ) ) + { + WaitForMercToFinishTalkingOrUserToClick(); + InitVideoFaceTalking( gbCurrentSoldier, QUOTE_DEATH_RATE_REFUSAL ); + return( FALSE ); + } + + // Check the players Reputation + if( MercThinksBadReputationTooHigh( gbCurrentSoldier ) ) + { + WaitForMercToFinishTalkingOrUserToClick(); + InitVideoFaceTalking( gbCurrentSoldier, QUOTE_REPUTATION_REFUSAL ); + return( FALSE ); + } + } + + return(TRUE); +} + + + + +BOOLEAN DisplaySnowBackground() +{ + UINT32 uiCurrentTime = 0; + HVOBJECT hSnowHandle; + UINT8 ubCount; + + uiCurrentTime = GetJA2Clock(); + + if(gubCurrentCount < VC_NUM_LINES_SNOW) + { + ubCount = gubCurrentCount; + } + else if( gubCurrentCount < VC_NUM_LINES_SNOW*2 ) + { + ubCount = gubCurrentCount - VC_NUM_LINES_SNOW; + } + else + { + gfFirstTimeInContactScreen = FALSE; + gubCurrentCount = 0; + ubCount = 0; + + if( gubVideoConferencingMode == AIM_VIDEO_FIRST_CONTACT_MERC_MODE && gfAimMemberCanMercSayOpeningQuote ) + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_GREETING); + + return(TRUE); + } + + // if it is time to update the snow image + if( (uiCurrentTime - guiLastHandleMercTime) > VC_CONTACT_STATIC_TIME) + { + gubCurrentCount++; + guiLastHandleMercTime = uiCurrentTime; + } + // Get the snow background, and blit it + GetVideoObject(&hSnowHandle, guiBWSnow); + BltVideoObject(FRAME_BUFFER, hSnowHandle, ubCount,AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + InvalidateRegion(AIM_MEMBER_VIDEO_FACE_X,AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH,AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT); + + return(FALSE); +} + + +BOOLEAN DisplayBlackBackground(UINT8 ubMaxNumOfLoops) +{ + UINT32 uiCurrentTime = 0; + UINT8 ubCount; + + uiCurrentTime = GetJA2Clock(); + + if(gubCurrentCount < ubMaxNumOfLoops) + { + ubCount = gubCurrentCount; + } + else + { + gubCurrentCount = 0; + return(TRUE); + } + + // if it is time to update the snow image + if( (uiCurrentTime - guiLastHandleMercTime) > VC_CONTACT_STATIC_TIME) + { + gubCurrentCount++; + guiLastHandleMercTime = uiCurrentTime; + } + // Blit color to screen + ColorFillVideoSurfaceArea( FRAME_BUFFER, AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH, AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + InvalidateRegion(AIM_MEMBER_VIDEO_FACE_X,AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH,AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT); + + return(FALSE); +} + + + + +void HandleVideoDistortion() +{ + static UINT32 uiStaticNoiseSound = NO_SAMPLE; + UINT8 ubOldMode = gubCurrentStaticMode; + + // if we are just entering the contact page, display a snowy background + if( gfFirstTimeInContactScreen && !gfIsAnsweringMachineActive) + { + DisplaySnowBackground(); + + //if it is time to start playing another sound + if( uiStaticNoiseSound == NO_SAMPLE ) + { + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static4.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + } + } + else + { + switch( gubCurrentStaticMode ) + { + case VC_NO_STATIC: + { + static UINT32 uiCurTime=0; + UINT8 ubNum; + + //if the sound is playing, stop it + if( uiStaticNoiseSound != NO_SAMPLE ) + { + SoundStop( uiStaticNoiseSound ); + uiStaticNoiseSound = NO_SAMPLE; + } + + //DECIDE WHICH ONE TO BLIT NEXT + if( (GetJA2Clock() - uiCurTime) > 2500) + { + ubNum = (UINT8)Random( 200 );//125; + + if( ubNum < 15) + gubCurrentStaticMode = VC_FUZZY_LINE; + + else if( ubNum < 25) + gubCurrentStaticMode = VC_STRAIGHTLINE; + + else if( ubNum < 35) + gubCurrentStaticMode = VC_BW_SNOW; + + else if( ubNum < 40) + gubCurrentStaticMode = VC_PIXELATE; + + else if( ubNum < 80) + gubCurrentStaticMode = VC_TRANS_SNOW_OUT; + + else if( ubNum < 100) + gubCurrentStaticMode = VC_TRANS_SNOW_IN; + + uiCurTime = GetJA2Clock(); + } + } + break; + + case VC_FUZZY_LINE: + gubCurrentStaticMode = DisplayDistortionLine(VC_FUZZY_LINE, guiFuzzLine, VC_NUM_FUZZ_LINES); + + //if it is time to start playing another sound + if( uiStaticNoiseSound == NO_SAMPLE ) + { + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static1.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + } + break; + + case VC_STRAIGHTLINE: + gubCurrentStaticMode = DisplayDistortionLine(VC_STRAIGHTLINE, guiStraightLine, VC_NUM_STRAIGHT_LINES); + + //if it is time to start playing another sound + if( uiStaticNoiseSound == NO_SAMPLE ) + { + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static5.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + } + break; + + case VC_BW_SNOW: + gubCurrentStaticMode = DisplayDistortionLine(VC_BW_SNOW, guiBWSnow, 5); + + //if it is time to start playing another sound + if( uiStaticNoiseSound == NO_SAMPLE ) + { + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static6.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + } + break; + + case VC_PIXELATE: + gubCurrentStaticMode = DisplayPixelatedImage(4); + + //if it is time to start playing another sound + if( uiStaticNoiseSound == NO_SAMPLE ) + { + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static3.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + } + break; + + case VC_TRANS_SNOW_OUT: + gubCurrentStaticMode = DisplayTransparentSnow(VC_TRANS_SNOW_OUT, guiTransSnow, 7, FALSE); + + //if it is time to start playing another sound + if( uiStaticNoiseSound == NO_SAMPLE ) + { + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static5.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + } + break; + + case VC_TRANS_SNOW_IN: + gubCurrentStaticMode = DisplayTransparentSnow(VC_TRANS_SNOW_IN, guiTransSnow, 7, TRUE); + + //if it is time to start playing another sound + if( uiStaticNoiseSound == NO_SAMPLE ) + { + uiStaticNoiseSound = PlayJA2SampleFromFile( "LAPTOP\\static4.wav", RATE_11025, LOWVOLUME, 1, MIDDLEPAN ); + } + break; + } + + if( ubOldMode != gubCurrentStaticMode ) + { + uiStaticNoiseSound = NO_SAMPLE; + } + } +} + +//returns true when done. else false +UINT8 DisplayTransparentSnow(UINT8 ubMode, UINT32 uiImageIdentifier, UINT8 ubMaxImages, BOOLEAN bForward) +{ + HVOBJECT hFuzzLineHandle; + static INT8 bCount= 0; + UINT32 uiCurrentTime = 0; + static UINT32 uiLastTime=0; + + uiCurrentTime = GetJA2Clock(); + + if( (uiCurrentTime - uiLastTime) > 100) + { + if( bForward ) + { + if( bCount > ubMaxImages-1 ) + bCount = 0; + else + bCount++; + } + else + { + if( bCount <= 0 ) + bCount = ubMaxImages-1; + else + bCount--; + } + uiLastTime = uiCurrentTime; + } + + if( bCount >= ubMaxImages) + bCount = ubMaxImages - 1; + + // Get the snow background, and blit it + GetVideoObject(&hFuzzLineHandle, uiImageIdentifier); + BltVideoObject(FRAME_BUFFER, hFuzzLineHandle, bCount,AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + if( bForward ) + { + if( bCount == ubMaxImages-1) + { + bCount = 0; + return(VC_BW_SNOW); + } + else + return(ubMode); + } + else + { + if( bCount == 0) + { + bCount = 0; + return(VC_NO_STATIC); + } + else + return(ubMode); + } +} + + +//returns true when done. else false +UINT8 DisplayDistortionLine(UINT8 ubMode, UINT32 uiImageIdentifier, UINT8 ubMaxImages) +{ + HVOBJECT hFuzzLineHandle; + static UINT8 ubCount=255; + UINT32 uiCurrentTime = 0; + static UINT32 uiLastTime=0; + + uiCurrentTime = GetJA2Clock(); + + if( (uiCurrentTime - uiLastTime) > VC_CONTACT_FUZZY_LINE_TIME) + { + if( ubCount >= ubMaxImages-1 ) + ubCount = 0; + else + ubCount++; + uiLastTime = uiCurrentTime; + } + + if( ubCount >= ubMaxImages) + ubCount = ubMaxImages - 1; + + // Get the snow background, and blit it + GetVideoObject(&hFuzzLineHandle, uiImageIdentifier); + BltVideoObject(FRAME_BUFFER, hFuzzLineHandle, ubCount,AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + if( ubCount == ubMaxImages-1) + { + ubCount = 0; + if( ubMode == VC_BW_SNOW) + return(VC_TRANS_SNOW_OUT); + else + return(VC_NO_STATIC); + } + else + return(ubMode); +} + +UINT8 DisplayPixelatedImage(UINT8 ubMaxImages) +{ + static UINT8 ubCount=255; + UINT32 uiCurrentTime = 0; + static UINT32 uiLastTime=0; + + uiCurrentTime = GetJA2Clock(); + + if( (uiCurrentTime - uiLastTime) > VC_CONTACT_FUZZY_LINE_TIME) + { + if( ubCount >= ubMaxImages-1 ) + ubCount = 0; + else + ubCount++; + uiLastTime = uiCurrentTime; + } + +// PixelateVideoObjectRect( FRAME_BUFFER, AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH-1, AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT-1); + ShadowVideoSurfaceRect( FRAME_BUFFER, AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH-1, AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT-1); + + if( ubCount == ubMaxImages-1) + { + ubCount = 0; + return(VC_NO_STATIC); + } + else + return(VC_PIXELATE); +} + +void HandleMercAttitude() +{ + UINT32 uiCurrentTime = 0; + + uiCurrentTime = GetJA2Clock(); + + if( ( gubMercAttitudeLevel <= 1 && ( ( uiCurrentTime - guiMercAttitudeTime ) > QUOTE_FIRST_ATTITUDE_TIME ) ) || + ( ( uiCurrentTime - guiMercAttitudeTime ) > QUOTE_ATTITUDE_TIME ) ) + { + + if( gubMercAttitudeLevel == QUOTE_DELAY_SMALL_TALK) + { + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_SMALL_TALK); + } + else if( gubMercAttitudeLevel == QUOTE_DELAY_IMPATIENT_TALK) + { + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_IMPATIENT_QUOTE); + } + else if( gubMercAttitudeLevel == QUOTE_DELAY_VERY_IMPATIENT_TALK) + { + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_PRECEDENT_TO_REPEATING_ONESELF); + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_IMPATIENT_QUOTE); + } + else if( gubMercAttitudeLevel == QUOTE_DELAY_HANGUP_TALK) + { + UINT32 uiResetTime; + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_COMMENT_BEFORE_HANG_UP); + + //if the merc is going to hang up disable the buttons, so user cant press any buttons +// EnableDisableCurrentVideoConferenceButtons( FALSE); + if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE ) + { + // Enable the current video conference buttons + EnableDisableCurrentVideoConferenceButtons(FALSE); + } + + + //increments the merc 'annoyance' at the player + if( gMercProfiles[ gbCurrentSoldier ].bMercStatus == 0 ) + gMercProfiles[ gbCurrentSoldier ].bMercStatus = MERC_ANNOYED_BUT_CAN_STILL_CONTACT; + else if( gMercProfiles[ gbCurrentSoldier ].bMercStatus == MERC_ANNOYED_BUT_CAN_STILL_CONTACT ) + gMercProfiles[ gbCurrentSoldier ].bMercStatus = MERC_ANNOYED_WONT_CONTACT; + + // add an event so we can reset the 'annoyance factor' + uiResetTime = ( Random( 600 ) ); + uiResetTime += GetWorldTotalMin() + MERC_ANNOYED_WONT_CONTACT_TIME_MINUTES; + AddStrategicEvent( EVENT_AIM_RESET_MERC_ANNOYANCE, uiResetTime, gbCurrentSoldier ); + + gfHangUpMerc = TRUE; + } + + if( gubMercAttitudeLevel == QUOTE_MERC_BUSY ) + { + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_LAME_REFUSAL); + gfHangUpMerc = TRUE; + } + else if( gubMercAttitudeLevel != QUOTE_DELAY_NO_ACTION ) + gubMercAttitudeLevel++; + + guiMercAttitudeTime = GetJA2Clock(); + } +} + +void StopMercTalking() +{ + if( gfIsShutUpMouseRegionActive ) + { + MSYS_DisableRegion(&gSelectedShutUpMercRegion); + + ShutupaYoFace( giMercFaceIndex ); + gfMercIsTalking = FALSE; + guiMercAttitudeTime = GetJA2Clock(); + gfIsShutUpMouseRegionActive = FALSE; + gfRedrawScreen = TRUE; + } +} + + + +void BtnXToCloseVideoConfButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + gubVideoConferencingMode = AIM_VIDEO_POPDOWN_MODE; +// gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE; + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } +} + + +BOOLEAN InitDeleteVideoConferencePopUp( ) +{ + static BOOLEAN fXRegionActive = FALSE; + static BOOLEAN fVideoConferenceCreated = FALSE; + UINT8 i; + UINT16 usPosX, usPosY; + VOBJECT_DESC VObjectDesc; + VSURFACE_DESC vs_desc; + + //remove the face help text + gfAimMemberDisplayFaceHelpText = FALSE; + + //Gets reset to FALSE in the HandleCurrentVideoConfMode() function + gfJustSwitchedVideoConferenceMode = TRUE; + + + //remove old mode + DeleteVideoConfPopUp(); + + //reset ( in case merc was going to say something + DelayMercSpeech( 0, 0, 0, FALSE, TRUE ); + + //if the video conferencing is currently displayed, put the 'x' to close it in the top right corner + //and disable the ability to click on the BIG face to go to different screen + if( ( gubVideoConferencingMode != AIM_VIDEO_NOT_DISPLAYED_MODE) && ( gubVideoConferencingMode != AIM_VIDEO_POPUP_MODE) ) + { + if( !fXRegionActive ) + { + giXToCloseVideoConfButton = QuickCreateButton(giXToCloseVideoConfButtonImage, AIM_MEMBER_VIDEO_CONF_XCLOSE_X, AIM_MEMBER_VIDEO_CONF_XCLOSE_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnXToCloseVideoConfButtonCallback); + SetButtonCursor(giXToCloseVideoConfButton, CURSOR_LAPTOP_SCREEN); + SpecifyDisabledButtonStyle( giXToCloseVideoConfButton, DISABLED_STYLE_NONE ); + fXRegionActive = TRUE; + + MSYS_DisableRegion(&gSelectedFaceRegion); + } + } + + + + // The video conference is not displayed + if( gubVideoConferencingMode == AIM_VIDEO_NOT_DISPLAYED_MODE ) + { + gubVideoConferencingPreviousMode = gubVideoConferencingMode; + gfRedrawScreen = TRUE; + + if( gfVideoFaceActive ) + { + StopMercTalking(); + + //Get rid of the talking face + DeleteFace(giMercFaceIndex); + } + + //if the ansering machine is currently on, turn it off + if( gfIsAnsweringMachineActive) + gfIsAnsweringMachineActive = FALSE; + + gfVideoFaceActive = FALSE; + + if( fXRegionActive ) + { + + RemoveButton(giXToCloseVideoConfButton ); + fXRegionActive = FALSE; + } + + MSYS_DisableRegion(&gSelectedShutUpMercRegion); + + //Enable the ability to click on the BIG face to go to different screen + MSYS_EnableRegion(&gSelectedFaceRegion); + +// EnableDisableCurrentVideoConferenceButtons(FALSE); + if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE ) + { + // Enable the current video conference buttons + EnableDisableCurrentVideoConferenceButtons(FALSE); + } + + + fVideoConferenceCreated = FALSE; + + fNewMailFlag = gfIsNewMailFlagSet; + gfIsNewMailFlagSet = FALSE; + + } + + + if( gubVideoConferencingMode == AIM_VIDEO_POPUP_MODE ) + { + + gubVideoConferencingPreviousMode = gubVideoConferencingMode; + + if( gfJustSwitchedVideoConferenceMode ) + { + UINT32 uiVideoBackgroundGraphic; + HVOBJECT hImageHandle; + + + // load the answering machine graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\VideoTitleBar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiVideoBackgroundGraphic)); + + // Create a background video surface to blt the face onto + vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; + vs_desc.usWidth = AIM_MEMBER_VIDEO_TITLE_BAR_WIDTH; + vs_desc.usHeight = AIM_MEMBER_VIDEO_TITLE_BAR_HEIGHT; + vs_desc.ubBitDepth = 16; + CHECKF( AddVideoSurface( &vs_desc, &guiVideoTitleBar) ); + + + gfAimMemberCanMercSayOpeningQuote = TRUE; + + GetVideoObject(&hImageHandle, uiVideoBackgroundGraphic); + BltVideoObject(guiVideoTitleBar, hImageHandle, 0,0,0, VO_BLT_SRCTRANSPARENCY,NULL); + + DeleteVideoObjectFromIndex(uiVideoBackgroundGraphic); + } + } + + + // The opening animation of the vc (fuzzy screen, then goes to black) + if( gubVideoConferencingMode == AIM_VIDEO_INIT_MODE ) + { + gubVideoConferencingPreviousMode = gubVideoConferencingMode; + gubMercAttitudeLevel = 0; + gubContractLength = AIM_CONTRACT_LENGTH_ONE_WEEK; + + if( gMercProfiles[gbCurrentSoldier].usOptionalGearCost == 0 ) + gfBuyEquipment = FALSE; + else + gfBuyEquipment = TRUE; + + gfMercIsTalking = FALSE; + gfVideoFaceActive = FALSE; + guiLastHandleMercTime = 0; + gfHangUpMerc = FALSE; + + fVideoConferenceCreated = TRUE; + } + + // The screen in which you first contact the merc, you have the option to hang up or goto hire merc screen + if( gubVideoConferencingMode == AIM_VIDEO_FIRST_CONTACT_MERC_MODE ) + { + //if the last screen was the init screen, then we need to initialize the video face + if( ( gubVideoConferencingPreviousMode == AIM_VIDEO_INIT_MODE) || ( gubVideoConferencingPreviousMode == AIM_VIDEO_NOT_DISPLAYED_MODE) ) + { + //Put the merc face up on the screen + InitVideoFace(gbCurrentSoldier); + +// if( gubVideoConferencingPreviousMode == AIM_VIDEO_INIT_MODE) +// InitVideoFaceTalking(gbCurrentSoldier, QUOTE_GREETING); + } + + gubVideoConferencingPreviousMode = gubVideoConferencingMode; + + // Hang up button + usPosX = AIM_MEMBER_AUTHORIZE_PAY_X; + guiVideoConferenceButtonImage[2] = LoadButtonImage("LAPTOP\\VideoConfButtons.sti", -1,2,-1,3,-1 ); + for(i=0; i<2; i++) + { + giAuthorizeButton[i] = CreateIconAndTextButton( guiVideoConferenceButtonImage[2], VideoConfercingText[i+AIM_MEMBER_HIRE], + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + usPosX, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFirstContactButtonCallback); + + MSYS_SetBtnUserData( giAuthorizeButton[i], 0, i); + SetButtonCursor(giAuthorizeButton[i], CURSOR_LAPTOP_SCREEN); + usPosX += AIM_MEMBER_AUTHORIZE_PAY_GAP; + } + + if( gfWaitingForMercToStopTalkingOrUserToClick ) + { + DisableButton( giAuthorizeButton[0] ); + gfWaitingForMercToStopTalkingOrUserToClick = FALSE; + + //Display a popup msg box telling the user when and where the merc will arrive +// DisplayPopUpBoxExplainingMercArrivalLocationAndTime( giIdOfLastHiredMerc ); + giIdOfLastHiredMerc = -1; + } + } + + + + // The screen in which you set the contract length, and the ability to buy equipment.. + if( gubVideoConferencingMode == AIM_VIDEO_HIRE_MERC_MODE) + { + gubVideoConferencingPreviousMode = gubVideoConferencingMode; + + // Contract Length button + guiVideoConferenceButtonImage[0] = LoadButtonImage("LAPTOP\\VideoConfButtons.sti", -1,0,-1,1,-1 ); + usPosY = AIM_MEMBER_BUY_CONTRACT_LENGTH_Y; + for(i=0; i<3; i++) + { + giContractLengthButton[i] = CreateIconAndTextButton( guiVideoConferenceButtonImage[0], VideoConfercingText[i+AIM_MEMBER_ONE_DAY], FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_LJUSTIFIED, + AIM_MEMBER_BUY_CONTRACT_LENGTH_X, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnContractLengthButtonCallback); + + SetButtonCursor(giContractLengthButton[i], CURSOR_LAPTOP_SCREEN); + MSYS_SetBtnUserData( giContractLengthButton[i], 0, i); + SpecifyDisabledButtonStyle( giContractLengthButton[i], DISABLED_STYLE_NONE ); + usPosY += AIM_MEMBER_BUY_EQUIPMENT_GAP; + } + + // BuyEquipment button + usPosY = AIM_MEMBER_BUY_CONTRACT_LENGTH_Y; + for(i=0; i<2; i++) + { + giBuyEquipmentButton[i] = CreateIconAndTextButton( guiVideoConferenceButtonImage[0], VideoConfercingText[i+AIM_MEMBER_NO_EQUIPMENT], + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_LJUSTIFIED, + AIM_MEMBER_BUY_EQUIPMENT_X, usPosY, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnBuyEquipmentButtonCallback); + + SetButtonCursor(giBuyEquipmentButton[i], CURSOR_LAPTOP_SCREEN); + MSYS_SetBtnUserData( giBuyEquipmentButton[i], 0, i); + SpecifyDisabledButtonStyle( giBuyEquipmentButton[i], DISABLED_STYLE_SHADED ); + usPosY += AIM_MEMBER_BUY_EQUIPMENT_GAP; + } + if( gMercProfiles[gbCurrentSoldier].usOptionalGearCost == 0 ) + DisableButton( giBuyEquipmentButton[1] ); + + + // Authorize button + usPosX = AIM_MEMBER_AUTHORIZE_PAY_X; + guiVideoConferenceButtonImage[1] = LoadButtonImage("LAPTOP\\VideoConfButtons.sti", -1,2,-1,3,-1 ); + for(i=0; i<2; i++) + { + giAuthorizeButton[i] = CreateIconAndTextButton( guiVideoConferenceButtonImage[1], VideoConfercingText[i+AIM_MEMBER_TRANSFER_FUNDS], + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + usPosX, AIM_MEMBER_AUTHORIZE_PAY_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnAuthorizeButtonCallback); + + SetButtonCursor(giAuthorizeButton[i], CURSOR_LAPTOP_SCREEN); + MSYS_SetBtnUserData( giAuthorizeButton[i], 0, i); + SpecifyDisabledButtonStyle( giAuthorizeButton[i], DISABLED_STYLE_NONE ); + usPosX += AIM_MEMBER_AUTHORIZE_PAY_GAP; + } + +// InitVideoFaceTalking(gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT); + DelayMercSpeech( gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT, 750, TRUE, FALSE ); + } + + + + + // The merc is not home and the player gets the answering machine + if( gubVideoConferencingMode == AIM_VIDEO_MERC_ANSWERING_MACHINE_MODE ) + { + gubVideoConferencingPreviousMode = gubVideoConferencingMode; + + gfIsAnsweringMachineActive = TRUE; + + // Leave msg button + usPosX = AIM_MEMBER_AUTHORIZE_PAY_X; + guiVideoConferenceButtonImage[2] = LoadButtonImage("LAPTOP\\VideoConfButtons.sti", -1,2,-1,3,-1 ); + + giAnsweringMachineButton[0] = CreateIconAndTextButton( guiVideoConferenceButtonImage[2], VideoConfercingText[AIM_MEMBER_LEAVE_MESSAGE], + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + usPosX, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnAnsweringMachineButtonCallback); + MSYS_SetBtnUserData( giAnsweringMachineButton[0], 0, 0); + SetButtonCursor(giAnsweringMachineButton[0], CURSOR_LAPTOP_SCREEN); + + //if the user has already left a message, disable the button + if( gMercProfiles[ gbCurrentSoldier ].ubMiscFlags3 & PROFILE_MISC_FLAG3_PLAYER_LEFT_MSG_FOR_MERC_AT_AIM ) + DisableButton( giAnsweringMachineButton[0] ); + + usPosX += AIM_MEMBER_AUTHORIZE_PAY_GAP; + + giAnsweringMachineButton[1] = CreateIconAndTextButton( guiVideoConferenceButtonImage[2], VideoConfercingText[AIM_MEMBER_HANG_UP], + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + usPosX, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnAnsweringMachineButtonCallback); + + MSYS_SetBtnUserData( giAnsweringMachineButton[1], 0, 1); + SetButtonCursor(giAnsweringMachineButton[1], CURSOR_LAPTOP_SCREEN); + + //The face must be inited even though the face wont appear. It is so the voice is played + InitVideoFace(gbCurrentSoldier); + + //Make sure the merc doesnt ramble away to the player + gubMercAttitudeLevel = QUOTE_DELAY_NO_ACTION; + + +// +//DEF: TEST +// +/* // load the answering machine graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\explosion.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiAnsweringMachineImage)); +*/ + gubCurrentStaticMode = VC_NO_STATIC; + } + + + + + // The merc is home but for some reason doesnt want to work for player + if( gubVideoConferencingMode == AIM_VIDEO_MERC_UNAVAILABLE_MODE) + { + gubVideoConferencingPreviousMode = gubVideoConferencingMode; + + // The hangup button + guiVideoConferenceButtonImage[2] = LoadButtonImage("LAPTOP\\VideoConfButtons.sti", -1,2,-1,3,-1 ); + + giHangUpButton = CreateIconAndTextButton( guiVideoConferenceButtonImage[2], VideoConfercingText[AIM_MEMBER_HANG_UP], + FONT12ARIAL, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + AIM_M_VIDEO_NAME_COLOR, AIM_M_VIDEO_NAME_SHADOWCOLOR, + TEXT_CJUSTIFIED, + AIM_MEMBER_HANG_UP_X, AIM_MEMBER_HANG_UP_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnHangUpButtonCallback); + + MSYS_SetBtnUserData( giHangUpButton, 0, 1); + SetButtonCursor(giHangUpButton, CURSOR_LAPTOP_SCREEN); + + //set the flag saying specifying that merc is busy + gubMercAttitudeLevel = QUOTE_MERC_BUSY; + + InitVideoFace(gbCurrentSoldier); + } + + if( gubVideoConferencingMode == AIM_VIDEO_POPDOWN_MODE ) + { + UINT32 uiVideoBackgroundGraphic; + HVOBJECT hImageHandle; + + if( gubPopUpBoxAction == AIM_POPUP_DISPLAY ) + { + return( TRUE ); + } + + gubVideoConferencingPreviousMode = gubVideoConferencingMode; + + gfIsAnsweringMachineActive = FALSE; + + + // load the Video conference background graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\VideoTitleBar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiVideoBackgroundGraphic)); + + // Create a background video surface to blt the face onto + vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; + vs_desc.usWidth = AIM_MEMBER_VIDEO_TITLE_BAR_WIDTH; + vs_desc.usHeight = AIM_MEMBER_VIDEO_TITLE_BAR_HEIGHT; + vs_desc.ubBitDepth = 16; + CHECKF( AddVideoSurface( &vs_desc, &guiVideoTitleBar) ); + + + GetVideoObject(&hImageHandle, uiVideoBackgroundGraphic); + BltVideoObject(guiVideoTitleBar, hImageHandle, 0,0,0, VO_BLT_SRCTRANSPARENCY,NULL); + + DeleteVideoObjectFromIndex(uiVideoBackgroundGraphic); + } + +// gfWaitingForMercToStopTalkingOrUserToClick = FALSE; + + //reset the time in which the merc will get annoyed + guiMercAttitudeTime = GetJA2Clock(); + return(TRUE); +} + + +BOOLEAN DeleteVideoConfPopUp() +{ + UINT16 i; + + //reset ( in case merc was going to say something + DelayMercSpeech( 0, 0, 0, FALSE, TRUE ); + + switch( gubVideoConferencingPreviousMode ) + { + // The video conference is not displayed + case AIM_VIDEO_NOT_DISPLAYED_MODE: + { + + break; + } + + + case AIM_VIDEO_POPUP_MODE: + { + DeleteVideoSurfaceFromIndex(guiVideoTitleBar); + break; + } + + // The opening animation of the vc (fuzzy screen, then goes to black) + case AIM_VIDEO_INIT_MODE: + { + + break; + } + + + + // The screen in which you first contact the merc, you have the option to hang up or goto hire merc screen + case AIM_VIDEO_FIRST_CONTACT_MERC_MODE: + { + //Remove the video conf buttons images + UnloadButtonImage(guiVideoConferenceButtonImage[2]); + + //Remove the Hangup buttons + for(i=0; i<2; i++) + RemoveButton(giAuthorizeButton[i] ); + + break; + } + + + + // The screen in which you set the contract length, and the ability to buy equipment.. + case AIM_VIDEO_HIRE_MERC_MODE: + { + //Remove the video conf buttons images + for(i=0; i<2; i++) + UnloadButtonImage(guiVideoConferenceButtonImage[i]); + + //Remove the Contracy Length button + for(i=0; i<3; i++) + RemoveButton(giContractLengthButton[i] ); + + for(i=0; i<2; i++) + RemoveButton(giBuyEquipmentButton[i] ); + + for(i=0; i<2; i++) + RemoveButton(giAuthorizeButton[i] ); + + break; + } + + + + + // The merc is not home and the player gets the answering machine + case AIM_VIDEO_MERC_ANSWERING_MACHINE_MODE: + { + if( gubPopUpBoxAction == AIM_POPUP_DISPLAY ) + { +// return( TRUE ); + } + + //Remove the video conf buttons images + UnloadButtonImage(guiVideoConferenceButtonImage[2]); + + //Remove the Answering machine buttons + for(i=0; i<2; i++) + RemoveButton(giAnsweringMachineButton[i] ); + +// DeleteVideoObjectFromIndex(guiAnsweringMachineImage); + break; + } + + + + + // The merc is home but doesnt want to work for player + case AIM_VIDEO_MERC_UNAVAILABLE_MODE: + { + RemoveButton(giHangUpButton ); + UnloadButtonImage(guiVideoConferenceButtonImage[2]); + break; + } + + case AIM_VIDEO_POPDOWN_MODE: + { + if( gubPopUpBoxAction == AIM_POPUP_DISPLAY ) + { + return( TRUE ); + } + + if( gfWaitingForMercToStopTalkingOrUserToClick ) + { + gfWaitingForMercToStopTalkingOrUserToClick = FALSE; + +// DisplayPopUpBoxExplainingMercArrivalLocationAndTime( giIdOfLastHiredMerc ); + } + + + gfWaitingForMercToStopTalkingOrUserToClick = FALSE; + DeleteVideoSurfaceFromIndex(guiVideoTitleBar); + break; + } + + } + return(TRUE); +} + + + + +BOOLEAN HandleCurrentVideoConfMode() +{ + switch( gubVideoConferencingMode ) + { + // The video conference is not displayed + case AIM_VIDEO_NOT_DISPLAYED_MODE: + { + gfWaitingForMercToStopTalkingOrUserToClick = FALSE; + + break; + } + + + case AIM_VIDEO_POPUP_MODE: + { + BOOLEAN ubDone; + + if( gfJustSwitchedVideoConferenceMode ) + ubDone = DisplayMovingTitleBar( TRUE, TRUE ); + else + ubDone = DisplayMovingTitleBar( TRUE, FALSE ); + + + if(ubDone) + gubVideoConferencingMode = AIM_VIDEO_INIT_MODE; + + break; + } + + // The opening animation of the vc (fuzzy screen, then goes to black) + case AIM_VIDEO_INIT_MODE: + { + static UINT8 ubCurMode = 0; + BOOLEAN fDone; + + if( ubCurMode == 0 ) + { + fDone = DisplayBlackBackground( 10 ); + if( fDone ) + ubCurMode = 1; + } + else + fDone = DisplaySnowBackground(); + + if( fDone && ubCurMode ) + { + ubCurMode = 0; + + gubVideoConferencingMode = WillMercAcceptCall(); + } + + break; + } + + // The screen in which you first contact the merc, you have the option to hang up or goto hire merc screen + case AIM_VIDEO_FIRST_CONTACT_MERC_MODE: + { + //if the merc is at home, play his greeting +// if( gfJustSwitchedVideoConferenceMode ) +// InitVideoFaceTalking(gbCurrentSoldier, QUOTE_GREETING); + + break; + } + + // The screen in which you set the contract length, and the ability to buy equipment.. + case AIM_VIDEO_HIRE_MERC_MODE: + { + + break; + } + + // The merc is not home and the player gets the answering machine + case AIM_VIDEO_MERC_ANSWERING_MACHINE_MODE: + { + //if the merc is not at home, play his answering machine + if( gfJustSwitchedVideoConferenceMode ) + { + InitVideoFaceTalking(gbCurrentSoldier, QUOTE_ANSWERING_MACHINE_MSG); + } + + break; + } + + // The merc is home but doesnt want to work for player + case AIM_VIDEO_MERC_UNAVAILABLE_MODE: + { + + break; + } + + case AIM_VIDEO_POPDOWN_MODE: + { + BOOLEAN ubDone; + + if( gfJustSwitchedVideoConferenceMode ) + ubDone = DisplayMovingTitleBar( FALSE, TRUE ); + else + ubDone = DisplayMovingTitleBar( FALSE, FALSE ); + + if(ubDone) + { + gubVideoConferencingMode = AIM_VIDEO_NOT_DISPLAYED_MODE; + + + //display the popup telling the user when the just hired merc is going to land + DisplayPopUpBoxExplainingMercArrivalLocationAndTime( /*giIdOfLastHiredMerc*/ ); // no parameters (jonathanl) + + //render the screen immediately to get rid of the pop down stuff + InitDeleteVideoConferencePopUp( ); + RenderAIMMembers(); + gfVideoFaceActive = FALSE; + } + + break; + } + } + + //Gets set in the InitDeleteVideoConferencePopUp() function +// gfJustSwitchedVideoConferenceMode = FALSE; + + return(TRUE); +} + + + +BOOLEAN EnableDisableCurrentVideoConferenceButtons( BOOLEAN fEnable) +{ + INT8 i; + static BOOLEAN fCreated = FALSE; + if(!fEnable) + { + if( fCreated ) + { + //enable buttons behind the acknowlegde button + + for( i=0; i<3; i++) + EnableButton( giContractLengthButton[i] ); + + for(i=0; i<2; i++) + EnableButton( giBuyEquipmentButton[i] ); + + for(i=0; i<2; i++) + EnableButton( giAuthorizeButton[i] ); + + fCreated = FALSE; + } + } + else + { + if( !fCreated ) + { + //disable buttons behind the acknowlegde button + for( i=0; i<3; i++) + DisableButton( giContractLengthButton[i] ); + + for(i=0; i<2; i++) + DisableButton( giBuyEquipmentButton[i] ); + + for(i=0; i<2; i++) + DisableButton( giAuthorizeButton[i] ); + + + fCreated = TRUE; + } + } + return(TRUE); +} + +/* +BOOLEAN HandleAnsweringMachineMessage() +{ + static BOOLEAN fDone; + + if( gfJustSwitchedVideoConferenceMode ) + fDone = DisplayAnimatedAnsweringMachineMsg( TRUE, 12); + else if( !fDone ) + { + fDone = DisplayAnimatedAnsweringMachineMsg( FALSE, 12); + if( fDone ) + { + fDone = FALSE; + } + } + + return(TRUE); +} +*/ +/* +BOOLEAN DisplayAnimatedAnsweringMachineMsg( BOOLEAN fInit, UINT8 ubNumSubImages) +{ +// HVOBJECT hImageHandle; + static UINT8 ubSubImage=0; + static UINT32 uiLastTime=0; + UINT32 uiCurTime = GetJA2Clock(); + static UINT8 ubMode=0; + + if( fInit ) + { + ubSubImage = 0; + uiLastTime = 0; + ubMode = 0; + } + + if( (uiCurTime - uiLastTime) > VC_ANSWER_IMAGE_DELAY ) + { + + if( ubMode == 0) + { + if( ubSubImage >= ubNumSubImages) + ubSubImage = 0; + + // Display the Answering machine graphic + + // For now just blit the guys face, and shade it +// GetVideoObject(&hImageHandle, guiAnsweringMachineImage); +// BltVideoObject(FRAME_BUFFER, hImageHandle, ubSubImage, AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + InvalidateRegion(AIM_MEMBER_VIDEO_FACE_X,AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH,AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT); + + ubSubImage ++; + if( ubSubImage == ubNumSubImages) + { + ubSubImage = 0; + ubMode++; + return(TRUE); + } + } + else + { + + //display the black background with text over it. + ColorFillVideoSurfaceArea( FRAME_BUFFER, AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH, AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + DisplayWrappedString(AIM_MEMBER_VIDEO_FACE_X, AIM_MEMBER_VIDEO_FACE_Y+20, AIM_MEMBER_VIDEO_FACE_WIDTH, 2, FONT14ARIAL, 145, AimPopUpText[AIM_MEMBER_LEAVE_MSG], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + InvalidateRegion(AIM_MEMBER_VIDEO_FACE_X,AIM_MEMBER_VIDEO_FACE_Y, AIM_MEMBER_VIDEO_FACE_X+AIM_MEMBER_VIDEO_FACE_WIDTH,AIM_MEMBER_VIDEO_FACE_Y+AIM_MEMBER_VIDEO_FACE_HEIGHT); + + ubSubImage ++; + if( ubSubImage == ubNumSubImages * 2) + { + ubSubImage = 0; + ubMode=0; + return(TRUE); + } + } + + + //reset clock + uiLastTime = GetJA2Clock(); + } + + return(FALSE); +} +*/ + +void ResetMercAnnoyanceAtPlayer( UINT8 ubMercID ) +{ + //if merc is still annoyed, reset back to 0 + + if ( ubMercID == LARRY_NORMAL ) + { + if ( CheckFact( FACT_LARRY_CHANGED, 0 ) ) + { + ubMercID = LARRY_DRUNK; + } + } + else if ( ubMercID == LARRY_DRUNK ) + { + if ( CheckFact( FACT_LARRY_CHANGED, 0 ) == FALSE ) + { + ubMercID = LARRY_NORMAL; + } + } + if( ( gMercProfiles[ ubMercID ].bMercStatus == MERC_ANNOYED_WONT_CONTACT ) || ( gMercProfiles[ ubMercID ].bMercStatus == MERC_ANNOYED_BUT_CAN_STILL_CONTACT ) ) + gMercProfiles[ ubMercID ].bMercStatus = 0; +} + +BOOLEAN DisableNewMailMessage() +{ + if( fNewMailFlag && gubVideoConferencingMode ) + { + gfIsNewMailFlagSet = TRUE; + fNewMailFlag = FALSE; + gfRedrawScreen = TRUE; + + return(TRUE); + + } + return(FALSE); +} + +BOOLEAN DisplayMovingTitleBar(BOOLEAN fForward, BOOLEAN fInit ) +{ + static UINT8 ubCount; + UINT16 usPosX, usPosY, usPosRightX, usPosBottomY, usWidth, usHeight; + SGPRect SrcRect; + SGPRect DestRect; + static SGPRect LastRect; + FLOAT usTemp; + + if( fForward ) + { + if( fInit ) + ubCount = 1; + + usTemp = (331 - 125) / (FLOAT)AIM_MEMBER_VIDEO_TITLE_ITERATIONS ; + usPosX = (UINT16)(331 - usTemp * ubCount); + + usTemp = (490 - 405) / (FLOAT)AIM_MEMBER_VIDEO_TITLE_ITERATIONS; + usPosRightX = (UINT16)(405 + usTemp * ubCount); + + usTemp = (AIM_MEMBER_VIDEO_TITLE_START_Y - 96) / (FLOAT)AIM_MEMBER_VIDEO_TITLE_ITERATIONS; + usPosY = (UINT16)(AIM_MEMBER_VIDEO_TITLE_START_Y - usTemp * ubCount); + + usPosBottomY = AIM_MEMBER_VIDEO_TITLE_BAR_HEIGHT; + } + else + { + if( fInit ) + ubCount = AIM_MEMBER_VIDEO_TITLE_ITERATIONS - 1; + + usTemp = (331 - 125) / (FLOAT)AIM_MEMBER_VIDEO_TITLE_ITERATIONS ; + usPosX = (UINT16)(331 - usTemp * ubCount); + + usTemp = (490 - 405) / (FLOAT)AIM_MEMBER_VIDEO_TITLE_ITERATIONS; + usPosRightX = (UINT16)(405 + usTemp * ubCount); + + usTemp = (AIM_MEMBER_VIDEO_TITLE_START_Y - 96) / (FLOAT)AIM_MEMBER_VIDEO_TITLE_ITERATIONS; + usPosY = (UINT16)(AIM_MEMBER_VIDEO_TITLE_START_Y - usTemp * ubCount); + + usPosBottomY = AIM_MEMBER_VIDEO_TITLE_BAR_HEIGHT; + } + + SrcRect.iLeft = 0; + SrcRect.iTop = 0; + SrcRect.iRight = AIM_MEMBER_VIDEO_TITLE_BAR_WIDTH; + SrcRect.iBottom = AIM_MEMBER_VIDEO_TITLE_BAR_HEIGHT; + + DestRect.iLeft = iScreenWidthOffset + usPosX; + DestRect.iTop = iScreenHeightOffset + usPosY; + DestRect.iRight = iScreenWidthOffset + usPosRightX; + DestRect.iBottom = DestRect.iTop + usPosBottomY; + + if( fForward ) + { + //Restore the old rect + if( ubCount > 2 ) + { + usWidth = (UINT16)(LastRect.iRight - LastRect.iLeft); + usHeight = (UINT16)(LastRect.iBottom - LastRect.iTop); + BlitBufferToBuffer(guiSAVEBUFFER, guiRENDERBUFFER, (UINT16)LastRect.iLeft, (UINT16)LastRect.iTop, usWidth, usHeight); + } + + //Save rectangle + if( ubCount > 1 ) + { + usWidth = (UINT16)(DestRect.iRight - DestRect.iLeft); + usHeight = (UINT16)(DestRect.iBottom - DestRect.iTop); + BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, (UINT16)DestRect.iLeft, (UINT16)DestRect.iTop, usWidth, usHeight); + } + } + else + { + //Restore the old rect + if( ubCount < AIM_MEMBER_VIDEO_TITLE_ITERATIONS - 2 ) + { + usWidth = (UINT16)(LastRect.iRight - LastRect.iLeft); + usHeight = (UINT16)(LastRect.iBottom - LastRect.iTop); + BlitBufferToBuffer(guiSAVEBUFFER, guiRENDERBUFFER, (UINT16)LastRect.iLeft, (UINT16)LastRect.iTop, usWidth, usHeight); + } + + //Save rectangle + if( ubCount < AIM_MEMBER_VIDEO_TITLE_ITERATIONS - 1 ) + { + usWidth = (UINT16)(DestRect.iRight - DestRect.iLeft); + usHeight = (UINT16)(DestRect.iBottom - DestRect.iTop); + BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, (UINT16)DestRect.iLeft, (UINT16)DestRect.iTop, usWidth, usHeight); + } + } + + + + BltStretchVideoSurface(FRAME_BUFFER, guiVideoTitleBar, 0, 0, VO_BLT_SRCTRANSPARENCY, &SrcRect, &DestRect ); + + InvalidateRegion(DestRect.iLeft,DestRect.iTop, DestRect.iRight, DestRect.iBottom); + InvalidateRegion(LastRect.iLeft,LastRect.iTop, LastRect.iRight, LastRect.iBottom); + + LastRect = DestRect; + + if( fForward ) + { + ubCount++; + if( ubCount == AIM_MEMBER_VIDEO_TITLE_ITERATIONS-1) + return(TRUE); + else + return(FALSE); + } + else + { + ubCount--; + if( ubCount == 0) + return(TRUE); + else + return(FALSE); + } +} + + +#ifdef JA2TESTVERSION +//TEMP: +void TempHiringOfMercs( UINT8 ubNumberOfMercs, BOOLEAN fReset ) +{ + INT16 i; + UINT8 MercID[]={11,16,29,36,2,10,17,6,7,12,0,1,3,4,5,8,9,13,14,15,18,19 }; + MERC_HIRE_STRUCT HireMercStruct; + static BOOLEAN fHaveCalledBefore=FALSE; + + //if we should reset the global variable + if( fReset ) + { + fHaveCalledBefore = FALSE; + return; + } + + + if( fHaveCalledBefore ) + return; + + if( guiCurrentLaptopMode != LAPTOP_MODE_NONE ) + return; + + fHaveCalledBefore = TRUE; + + for( i=0; i usCurDelay ) + { + InitVideoFaceTalking( ubCurMercID, usCurQuoteNum ); + fQuoteWaiting = FALSE; + + if( fHangUpAfter ) + { + gfHangUpMerc = TRUE; + fHangUpAfter = FALSE; + } + } + } +} + + + + + +#ifdef JA2TESTVERSION + +//TEMP!!! +BOOLEAN QuickHireMerc() +{ + INT8 bReturnCode; + MERC_HIRE_STRUCT HireMercStruct; + UINT8 ubCurrentSoldier = AimMercArray[gbCurrentIndex]; + + giContractAmount = 0; + +// if( !IsMercHireable( ubCurrentSoldier ) ) +// return( FALSE ); + if( FindSoldierByProfileID( ubCurrentSoldier, TRUE ) != NULL ) + return( FALSE ); + + HireMercStruct.ubProfileID = ubCurrentSoldier; + + //DEF: temp + HireMercStruct.sSectorX = gsMercArriveSectorX; + HireMercStruct.sSectorY = gsMercArriveSectorY; + HireMercStruct.bSectorZ = 0; + HireMercStruct.fUseLandingZoneForArrival = TRUE; + HireMercStruct.ubInsertionCode = INSERTION_CODE_ARRIVING_GAME; + + HireMercStruct.fCopyProfileItemsOver = TRUE; + gMercProfiles[ ubCurrentSoldier ].ubMiscFlags |= PROFILE_MISC_FLAG_ALREADY_USED_ITEMS; + + + + if( gfKeyState[ ALT ] ) + HireMercStruct.iTotalContractLength = 14; + else if( gfKeyState[ CTRL ] ) + HireMercStruct.iTotalContractLength = 7; + else + HireMercStruct.iTotalContractLength = 1; + + + //specify when the merc should arrive + HireMercStruct.uiTimeTillMercArrives = GetMercArrivalTimeOfDay( );// + ubCurrentSoldier; + + SetFlagToForceHireMerc( TRUE ); + bReturnCode = HireMerc( &HireMercStruct ); + SetFlagToForceHireMerc( FALSE ); + if( bReturnCode == MERC_HIRE_OVER_20_MERCS_HIRED ) + { + //display a warning saying u cant hire more then 20 mercs + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, AimPopUpText[ AIM_MEMBER_ALREADY_HAVE_20_MERCS ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return(FALSE); + } + else if( bReturnCode == MERC_HIRE_FAILED ) + { + return(FALSE); + } + + //add an entry in the finacial page for the hiring of the merc + giContractAmount = gMercProfiles[gbCurrentSoldier].sSalary; + + AddTransactionToPlayersBook(HIRED_MERC, ubCurrentSoldier, GetWorldTotalMin(), -( giContractAmount ) );//- gMercProfiles[gbCurrentSoldier].sMedicalDepositAmount + + if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit ) + { + //add an entry in the finacial page for the medical deposit + AddTransactionToPlayersBook( MEDICAL_DEPOSIT, ubCurrentSoldier, GetWorldTotalMin(), -(gMercProfiles[gbCurrentSoldier].sMedicalDepositAmount) ); + } + + //add an entry in the history page for the hiring of the merc + AddHistoryToPlayersLog(HISTORY_HIRED_MERC_FROM_AIM, ubCurrentSoldier, GetWorldTotalMin(), -1, -1 ); + + gfRedrawScreen = TRUE; + + return( TRUE ); +} + + +void TempHandleAimMemberKeyBoardInput() +{ + InputAtom InputEvent; + + while (DequeueEvent(&InputEvent) == TRUE) + {//!HandleTextInput( &InputEvent ) && + if( InputEvent.usEvent == KEY_DOWN ) + { + switch (InputEvent.usParam) + { +#ifdef JA2TESTVERSION + case SPACE: + QuickHireMerc(); + break; + + case '~': + // to test going on other assignments, unhired merc improvements & deaths + if (guiDay == 1) guiDay++; + MercDailyUpdate(); + gfRedrawScreen = TRUE; + break; +#endif + + default: + HandleKeyBoardShortCutsForLapTop( InputEvent.usEvent, InputEvent.usParam, InputEvent.usKeyState ); + break; + } + } + } +} + +#endif + + +void WaitForMercToFinishTalkingOrUserToClick() +{ + //if the region is not active + if( !gfIsShutUpMouseRegionActive ) + { + //Enables it so if a player clicks, he will shutup the merc + MSYS_EnableRegion(&gSelectedShutUpMercRegion); + gfIsShutUpMouseRegionActive = TRUE; + } + + if( gfIsAnsweringMachineActive ) + gubVideoConferencingMode = AIM_VIDEO_MERC_ANSWERING_MACHINE_MODE; + else + gubVideoConferencingMode = AIM_VIDEO_FIRST_CONTACT_MERC_MODE; + + gfWaitingForMercToStopTalkingOrUserToClick = TRUE; + gfHangUpMerc = TRUE; + gfStopMercFromTalking = FALSE; +} + + + + +/* +BOOLEAN DisplayShadedStretchedMercFace( UINT8 ubMercID, UINT16 usPosX, UINT16 usPosY ) +{ + SGPRect SrcRect; + SGPRect DestRect; + + + //Test + SrcRect.iLeft = 0; + SrcRect.iTop = 0; + SrcRect.iRight = 48; + SrcRect.iBottom = 43; + + DestRect.iLeft = AIM_MEMBER_VIDEO_FACE_X; + DestRect.iTop = AIM_MEMBER_VIDEO_FACE_Y; + DestRect.iRight = DestRect.iLeft + AIM_MEMBER_VIDEO_FACE_WIDTH; + DestRect.iBottom = DestRect.iTop + AIM_MEMBER_VIDEO_FACE_HEIGHT; + + + if( !BltStretchVideoSurface(FRAME_BUFFER, guiVideoFaceBackground, 0, 0, VO_BLT_SRCTRANSPARENCY, &SrcRect, &DestRect ) ) + return(FALSE); + + + return( TRUE ); +} +*/ + + + +#if defined ( JA2TESTVERSION ) + +void DemoHiringOfMercs( ) +{ + INT16 i; + #ifdef GERMAN + UINT8 MercID[]={ 7, 10, 4, 14, 50 }; + #else + UINT8 MercID[]={ 7, 10, 4, 42, 33 }; + #endif + MERC_HIRE_STRUCT HireMercStruct; + static BOOLEAN fHaveCalledBefore=FALSE; + + if( fHaveCalledBefore ) + return; + + fHaveCalledBefore = TRUE; + + if( guiCurrentLaptopMode != LAPTOP_MODE_NONE ) + return; + + for( i=0; i<5; i++) + { + memset(&HireMercStruct, 0, sizeof(MERC_HIRE_STRUCT)); + + HireMercStruct.ubProfileID = MercID[i]; + + //DEF: temp + HireMercStruct.sSectorX = 1; + HireMercStruct.sSectorY = 16; + HireMercStruct.ubInsertionCode = INSERTION_CODE_ARRIVING_GAME; + + HireMercStruct.fCopyProfileItemsOver = TRUE; + gMercProfiles[ MercID[i] ].ubMiscFlags |= PROFILE_MISC_FLAG_ALREADY_USED_ITEMS; + + + HireMercStruct.iTotalContractLength = 60; + + //specify when the merc should arrive + HireMercStruct.uiTimeTillMercArrives = GetMercArrivalTimeOfDay( );// + MercID[i]; + + //since this is only a testing function, make the merc available + gMercProfiles[ MercID[i] ].bMercStatus = 0; + + //if we succesfully hired the merc + HireMerc( &HireMercStruct ); + + //add an entry in the finacial page for the hiring of the merc + AddTransactionToPlayersBook(HIRED_MERC, MercID[i], GetWorldTotalMin(), -(INT32)( gMercProfiles[MercID[i]].sSalary ) ); + + if( gMercProfiles[ MercID[i] ].bMedicalDeposit ) + { + //add an entry in the finacial page for the medical deposit + AddTransactionToPlayersBook( MEDICAL_DEPOSIT, MercID[i], GetWorldTotalMin(), -(gMercProfiles[MercID[i]].sMedicalDepositAmount) ); + } + + //add an entry in the history page for the hiring of the merc + AddHistoryToPlayersLog(HISTORY_HIRED_MERC_FROM_AIM, MercID[i], GetWorldTotalMin(), -1, -1 ); + } +} + +#endif + + + +void DisplayPopUpBoxExplainingMercArrivalLocationAndTime( ) +{ + CHAR16 szLocAndTime[512]; + SOLDIERTYPE *pSoldier = NULL; + CHAR16 zTimeString[128]; + CHAR16 zSectorIDString[512]; + UINT32 uiHour; + + //if the id of the merc is invalid, dont display the pop up + if( LaptopSaveInfo.sLastHiredMerc.iIdOfMerc == -1 ) + return; + + //if the pop up has already been displayed, dont display it again for this occurence of laptop + if( LaptopSaveInfo.sLastHiredMerc.fHaveDisplayedPopUpInLaptop ) + return; + + pSoldier = FindSoldierByProfileID( (UINT8)LaptopSaveInfo.sLastHiredMerc.iIdOfMerc, TRUE ); + + if( pSoldier == NULL ) + return; + + //calc the approximate hour the mercs will arrive at + uiHour = ( ( LaptopSaveInfo.sLastHiredMerc.uiArrivalTime ) - ( ( ( LaptopSaveInfo.sLastHiredMerc.uiArrivalTime ) / 1440 ) * 1440 ) ) / 60; + + //create the time string + swprintf( zTimeString, L"%02d:%02d", uiHour, 0 ); + + //get the id string + GetSectorIDString( gsMercArriveSectorX, gsMercArriveSectorY, 0, zSectorIDString, FALSE ); + + //create the string to display to the user, looks like.... + // L"%s should arrive at the designated drop-off point ( sector %d:%d %s ) on day %d, at approximately %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival + +#ifdef GERMAN + //Germans version has a different argument order + swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], + gMercProfiles[ pSoldier->ubProfile ].zNickname, + LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, + zTimeString, + zSectorIDString ); +#else + swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], + gMercProfiles[ pSoldier->ubProfile ].zNickname, + zSectorIDString, + LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, + zTimeString ); +#endif + + + + //display the message box + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, szLocAndTime, LAPTOP_SCREEN, MSG_BOX_FLAG_OK, DisplayPopUpBoxExplainingMercArrivalLocationAndTimeCallBack ); + + //reset the id of the last merc + LaptopSaveInfo.sLastHiredMerc.iIdOfMerc = -1; + + //set the fact that the pop up has been displayed this time in laptop + LaptopSaveInfo.sLastHiredMerc.fHaveDisplayedPopUpInLaptop = TRUE; + +} + +void DisplayPopUpBoxExplainingMercArrivalLocationAndTimeCallBack( UINT8 bExitValue ) +{ + //unset the flag so the msgbox WONT dislay its save buffer + gfDontOverRideSaveBuffer = FALSE; + + if( guiCurrentLaptopMode == LAPTOP_MODE_AIM_MEMBERS ) + { + //render the screen + gfRedrawScreen = TRUE; + RenderAIMMembers(); + } +} + +void DisplayAimMemberClickOnFaceHelpText() +{ + //display the 'left and right click' onscreen help msg + DrawTextToScreen( AimMemberText[0], AIM_FI_LEFT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_TITLE_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( AimMemberText[1], AIM_FI_LEFT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y+AIM_FI_CLICK_DESC_TEXT_Y_OFFSET, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + DrawTextToScreen( AimMemberText[2], AIM_FI_RIGHT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_TITLE_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( AimMemberText[3], AIM_FI_RIGHT_CLICK_TEXT_X, AIM_FI_LEFT_CLICK_TEXT_Y+AIM_FI_CLICK_DESC_TEXT_Y_OFFSET, AIM_FI_CLICK_TEXT_WIDTH, AIM_FI_HELP_FONT, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); +} + + + + + + diff --git a/Laptop/AimMembers.h b/Laptop/AimMembers.h new file mode 100644 index 00000000..6d6a09ae --- /dev/null +++ b/Laptop/AimMembers.h @@ -0,0 +1,45 @@ +#ifndef __AIMMEMBERS_H_ +#define __AIMMEMBERS_H_ + +void GameInitAIMMembers(); +BOOLEAN EnterAIMMembers(); +void ExitAIMMembers(); +void HandleAIMMembers(); +BOOLEAN RenderAIMMembers(); + + +BOOLEAN DrawNumeralsToScreen(INT32 iNumber, INT8 bWidth, UINT16 usLocX, UINT16 usLocY, UINT32 ulFont, UINT8 ubColor); +BOOLEAN DrawMoneyToScreen(INT32 iNumber, INT8 bWidth, UINT16 usLocX, UINT16 usLocY, UINT32 ulFont, UINT8 ubColor); + +void DisplayTextForMercFaceVideoPopUp(INT16 * pString); + +BOOLEAN DisplayTalkingMercFaceForVideoPopUp(INT32 iFaceIndex); +void EnterInitAimMembers(); +BOOLEAN RenderAIMMembersTopLevel(); +void ResetMercAnnoyanceAtPlayer( UINT8 ubMercID ); +BOOLEAN DisableNewMailMessage(); +void DisplayPopUpBoxExplainingMercArrivalLocationAndTime( ); + + +// which mode are we in during video conferencing?..0 means no video conference +extern UINT8 gubVideoConferencingMode; + +//TEMP!!! +#ifdef JA2TESTVERSION +void TempHiringOfMercs( UINT8 ubNumberOfMercs, BOOLEAN fReset ); +#endif + + +#if defined ( JA2TESTVERSION ) + void DemoHiringOfMercs( ); +#endif + + + +#endif + + + + + + diff --git a/Laptop/AimPolicies.cpp b/Laptop/AimPolicies.cpp new file mode 100644 index 00000000..53dbd65f --- /dev/null +++ b/Laptop/AimPolicies.cpp @@ -0,0 +1,891 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "AimPolicies.h" + #include "aim.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Encrypted File.h" + #include "Text.h" +#endif + +#define NUM_AIM_POLICY_PAGES 11 +#define NUM_AIM_POLICY_TOC_BUTTONS 9 +#define AIMPOLICYFILE "BINARYDATA\\AimPol.edt" +#define AIM_POLICY_LINE_SIZE 80 * 5 * 2 // 80 columns of 5 lines that are wide chars, 800 bytes total + +#define AIM_POLICY_TITLE_FONT FONT14ARIAL +#define AIM_POLICY_TITLE_COLOR AIM_GREEN +#define AIM_POLICY_TEXT_FONT FONT10ARIAL +#define AIM_POLICY_TEXT_COLOR FONT_MCOLOR_WHITE +#define AIM_POLICY_TOC_FONT FONT12ARIAL +#define AIM_POLICY_TOC_COLOR FONT_MCOLOR_WHITE +#define AIM_POLICY_TOC_TITLE_FONT FONT12ARIAL +#define AIM_POLICY_TOC_TITLE_COLOR FONT_MCOLOR_WHITE +#define AIM_POLICY_SUBTITLE_FONT FONT12ARIAL +#define AIM_POLICY_SUBTITLE_COLOR FONT_MCOLOR_WHITE +#define AIM_POLICY_AGREE_TOC_COLOR_ON FONT_MCOLOR_WHITE +#define AIM_POLICY_AGREE_TOC_COLOR_OFF FONT_MCOLOR_DKWHITE + +#define AIM_POLICY_MENU_X LAPTOP_SCREEN_UL_X + 40 +#define AIM_POLICY_MENU_Y (SCREEN_HEIGHT - 480)/ 2 + 390 + LAPTOP_SCREEN_WEB_DELTA_Y +#define AIM_POLICY_MENU_BUTTON_AMOUNT 4 +#define AIM_POLICY_GAP_X 40 + BOTTOM_BUTTON_START_WIDTH + +#define AIM_POLICY_TITLE_X IMAGE_OFFSET_X + 149 +#define AIM_POLICY_TITLE_Y AIM_SYMBOL_Y + AIM_SYMBOL_SIZE_Y + 11 +#define AIM_POLICY_TITLE_WIDTH AIM_SYMBOL_WIDTH + +#define AIM_POLICY_TITLE_STATEMENT_WIDTH 300 +#define AIM_POLICY_TITLE_STATEMENT_X IMAGE_OFFSET_X + (500 - AIM_POLICY_TITLE_STATEMENT_WIDTH) / 2 +5//80 +#define AIM_POLICY_TITLE_STATEMENT_Y AIM_SYMBOL_Y + AIM_SYMBOL_SIZE_Y + 75 + +#define AIM_POLICY_SUBTITLE_NUMBER AIM_POLICY_TITLE_STATEMENT_X - 75 +#define AIM_POLICY_SUBTITLE_X AIM_POLICY_SUBTITLE_NUMBER + 20 +#define AIM_POLICY_SUBTITLE_Y iScreenHeightOffset + 115 + LAPTOP_SCREEN_WEB_DELTA_Y + +#define AIM_POLICY_PARAGRAPH_NUMBER AIM_POLICY_SUBTITLE_X - 12 +#define AIM_POLICY_PARAGRAPH_X AIM_POLICY_PARAGRAPH_NUMBER + 23 +#define AIM_POLICY_PARAGRAPH_Y AIM_POLICY_SUBTITLE_Y + 20 +#define AIM_POLICY_PARAGRAPH_WIDTH 380 +#define AIM_POLICY_PARAGRAPH_GAP 6 +#define AIM_POLICY_SUBPARAGRAPH_NUMBER AIM_POLICY_PARAGRAPH_X +#define AIM_POLICY_SUBPARAGRAPH_X AIM_POLICY_SUBPARAGRAPH_NUMBER + 25 + +#define AIM_POLICY_TOC_X iScreenWidthOffset + 259 +#define AIM_POLICY_TOC_Y AIM_POLICY_SUBTITLE_Y +#define AIM_POLICY_TOC_GAP_Y 25 +#define AIM_POLICY_TOC_TEXT_OFFSET_X 5 +#define AIM_POLICY_TOC_TEXT_OFFSET_Y 5 + + +#define AIM_POLICY_AGREEMENT_X IMAGE_OFFSET_X + 150 +#define AIM_POLICY_AGREEMENT_Y iScreenHeightOffset + 350 + LAPTOP_SCREEN_WEB_DELTA_Y + +#define AIM_POLICY_DISAGREEMENT_X AIM_POLICY_AGREEMENT_X + 125 +#define AIM_POLICY_DISAGREEMENT_Y AIM_POLICY_AGREEMENT_Y + +#define AIM_POLICY_TOC_PAGE 1 +#define AIM_POLICY_LAST_PAGE 10 + +#define AIM_POLICY_AGREE_PAGE 0 + +// These enums represent which paragraph they are located in the AimPol.edt file +enum +{ + AIM_STATEMENT_OF_POLICY, + AIM_STATEMENT_OF_POLICY_1, + AIM_STATEMENT_OF_POLICY_2, + + DEFINITIONS, + DEFINITIONS_1, + DEFINITIONS_2, + DEFINITIONS_3, + DEFINITIONS_4, + + LENGTH_OF_ENGAGEMENT, + LENGTH_OF_ENGAGEMENT_1, + LENGTH_OF_ENGAGEMENT_1_1, + LENGTH_OF_ENGAGEMENT_1_2, + LENGTH_OF_ENGAGEMENT_1_3, + LENGTH_OF_ENGAGEMENT_2, + + LOCATION_0F_ENGAGEMENT, + LOCATION_0F_ENGAGEMENT_1, + LOCATION_0F_ENGAGEMENT_2, + LOCATION_0F_ENGAGEMENT_2_1, + LOCATION_0F_ENGAGEMENT_2_2, + LOCATION_0F_ENGAGEMENT_2_3, + LOCATION_0F_ENGAGEMENT_2_4, + LOCATION_0F_ENGAGEMENT_3, + + CONTRACT_EXTENSIONS, + CONTRACT_EXTENSIONS_1, + CONTRACT_EXTENSIONS_2, + CONTRACT_EXTENSIONS_3, + + TERMS_OF_PAYMENT, + TERMS_OF_PAYMENT_1, + + TERMS_OF_ENGAGEMENT, + TERMS_OF_ENGAGEMENT_1, + TERMS_OF_ENGAGEMENT_2A, + TERMS_OF_ENGAGEMENT_2B, + + ENGAGEMENT_TERMINATION, + ENGAGEMENT_TERMINATION_1, + ENGAGEMENT_TERMINATION_1_1, + ENGAGEMENT_TERMINATION_1_2, + ENGAGEMENT_TERMINATION_1_3, + + EQUIPMENT_AND_INVENTORY, + EQUIPMENT_AND_INVENTORY_1, + EQUIPMENT_AND_INVENTORY_2, + + POLICY_MEDICAL, + POLICY_MEDICAL_1, + POLICY_MEDICAL_2, + POLICY_MEDICAL_3A, + POLICY_MEDICAL_3B, + POLICY_MEDICAL_4, + + NUM_AIM_POLICY_LOCATIONS + +}AimPolicyTextLocatoins; + + +//Toc menu mouse regions +MOUSE_REGION gSelectedPolicyTocMenuRegion[ NUM_AIM_POLICY_TOC_BUTTONS ]; +void SelectPolicyTocMenuRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Agree/Disagree menu Buttons regions +void BtnPoliciesAgreeButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiPoliciesAgreeButton[ 2 ]; +INT32 guiPoliciesButtonImage; + +//Bottom Menu Buttons +void BtnPoliciesMenuButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiPoliciesMenuButton[ AIM_POLICY_MENU_BUTTON_AMOUNT ]; +INT32 guiPoliciesMenuButtonImage; + + + + +UINT32 guiBottomButton; +UINT32 guiBottomButton2; +UINT8 gubCurPageNum; +BOOLEAN gfInPolicyToc = FALSE; +BOOLEAN gfInAgreementPage = FALSE; +BOOLEAN gfAimPolicyMenuBarLoaded = FALSE; +UINT32 guiContentButton; +BOOLEAN gfExitingPolicesAgreeButton; +UINT8 gubPoliciesAgreeButtonDown; +UINT8 gubAimPolicyMenuButtonDown=255; +BOOLEAN gfExitingAimPolicy; +BOOLEAN AimPoliciesSubPagesVisitedFlag[NUM_AIM_POLICY_PAGES]; + + + + +BOOLEAN InitAimPolicyMenuBar(void); +BOOLEAN ExitAimPolicyMenuBar(void); +BOOLEAN InitAimPolicyTocMenu(void); +BOOLEAN ExitAimPolicyTocMenu(void); +BOOLEAN DrawAimPolicyMenu(); +BOOLEAN DisplayAimPolicyStatement(void); +BOOLEAN DisplayAimPolicyTitleText(void); +BOOLEAN InitAgreementRegion(void); +BOOLEAN ExitAgreementButton(void); +void DisableAimPolicyButton(); +void ResetAimPolicyButtons(); +void ChangingAimPoliciesSubPage( UINT8 ubSubPageNumber ); + + + +BOOLEAN DisplayAimPolicyTitle(UINT16 usPosY, UINT8 ubPageNum, FLOAT fNumber); +UINT16 DisplayAimPolicyParagraph(UINT16 usPosY, UINT8 ubPageNum, FLOAT fNumber); +UINT16 DisplayAimPolicySubParagraph(UINT16 usPosY, UINT8 ubPageNum, FLOAT fNumber); + + + +void GameInitAimPolicies() +{ + +} + +void EnterInitAimPolicies() +{ + memset( &AimPoliciesSubPagesVisitedFlag, 0, NUM_AIM_POLICY_PAGES); +} + + +BOOLEAN EnterAimPolicies() +{ + VOBJECT_DESC VObjectDesc; + + InitAimDefaults(); + + gubCurPageNum = (UINT8) giCurrentSubPage; + + gfAimPolicyMenuBarLoaded = FALSE; + gfExitingAimPolicy = FALSE; + + gubPoliciesAgreeButtonDown = 255; + gubAimPolicyMenuButtonDown = 255; + + if( gubCurPageNum != 0) + InitAimPolicyMenuBar(); + + gfInPolicyToc = FALSE; + + // load the Bottom Buttons graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BottomButton.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBottomButton)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BottomButton2.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBottomButton2)); + + // load the Content Buttons graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\ContentButton.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiContentButton)); + + RenderAimPolicies(); + return(TRUE); +} + +void ExitAimPolicies() +{ + gfExitingAimPolicy = TRUE; + + DeleteVideoObjectFromIndex(guiBottomButton); + DeleteVideoObjectFromIndex(guiBottomButton2); + DeleteVideoObjectFromIndex(guiContentButton); + + if( gfAimPolicyMenuBarLoaded ) + ExitAimPolicyMenuBar(); + + if(gfInPolicyToc) + ExitAimPolicyTocMenu(); + + if( gfInAgreementPage ) + ExitAgreementButton(); + RemoveAimDefaults(); + + giCurrentSubPage = gubCurPageNum; + +} + +void HandleAimPolicies() +{ + if( (gfAimPolicyMenuBarLoaded != TRUE) && gubCurPageNum != 0) + { + InitAimPolicyMenuBar(); +// RenderAimPolicies(); + fPausedReDrawScreenFlag = TRUE; + } + +} + +void RenderAimPolicies() +{ + UINT16 usNumPixles; + + DrawAimDefaults(); + + DisplayAimPolicyTitleText(); + + if( gfInAgreementPage ) + ExitAgreementButton(); + + switch( gubCurPageNum ) + { + case 0: + DisplayAimPolicyStatement(); + InitAgreementRegion(); + break; + + case 1: + InitAimPolicyTocMenu(); + InitAimPolicyMenuBar(); + DisableAimPolicyButton(); + DrawAimPolicyMenu(); + break; + + case 2: + //Display the Definitions title + DisplayAimPolicyTitle(AIM_POLICY_SUBTITLE_Y, DEFINITIONS, (FLOAT)1.0); + usNumPixles = AIM_POLICY_PARAGRAPH_Y; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, DEFINITIONS_1, (FLOAT)1.1) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, DEFINITIONS_2, (FLOAT)1.2) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, DEFINITIONS_3, (FLOAT)1.3) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, DEFINITIONS_4, (FLOAT)1.4); + break; + + case 3: + DisplayAimPolicyTitle(AIM_POLICY_SUBTITLE_Y, LENGTH_OF_ENGAGEMENT, (FLOAT)2.0); + usNumPixles = AIM_POLICY_PARAGRAPH_Y; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, LENGTH_OF_ENGAGEMENT_1, (FLOAT)2.1) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicySubParagraph(usNumPixles, LENGTH_OF_ENGAGEMENT_1_1, (FLOAT)2.11) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicySubParagraph(usNumPixles, LENGTH_OF_ENGAGEMENT_1_2, (FLOAT)2.12) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicySubParagraph(usNumPixles, LENGTH_OF_ENGAGEMENT_1_3, (FLOAT)2.13) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, LENGTH_OF_ENGAGEMENT_2, (FLOAT)2.2) + AIM_POLICY_PARAGRAPH_GAP; + break; + + case 4: + DisplayAimPolicyTitle(AIM_POLICY_SUBTITLE_Y, LOCATION_0F_ENGAGEMENT, (FLOAT)3.0); + usNumPixles = AIM_POLICY_PARAGRAPH_Y; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, LOCATION_0F_ENGAGEMENT_1, (FLOAT)3.1) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, LOCATION_0F_ENGAGEMENT_2, (FLOAT)3.2) + AIM_POLICY_PARAGRAPH_GAP; + + usNumPixles += DisplayAimPolicySubParagraph(usNumPixles, LOCATION_0F_ENGAGEMENT_2_1, (FLOAT)3.21) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicySubParagraph(usNumPixles, LOCATION_0F_ENGAGEMENT_2_2, (FLOAT)3.22) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicySubParagraph(usNumPixles, LOCATION_0F_ENGAGEMENT_2_3, (FLOAT)3.23) + AIM_POLICY_PARAGRAPH_GAP; +// usNumPixles += DisplayAimPolicySubParagraph(usNumPixles, LOCATION_0F_ENGAGEMENT_2_4, (FLOAT)3.24) + AIM_POLICY_PARAGRAPH_GAP; + + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, LOCATION_0F_ENGAGEMENT_2_4, (FLOAT)3.3) + AIM_POLICY_PARAGRAPH_GAP; + + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, LOCATION_0F_ENGAGEMENT_3, (FLOAT)3.4) + AIM_POLICY_PARAGRAPH_GAP; + break; + + case 5: + DisplayAimPolicyTitle(AIM_POLICY_SUBTITLE_Y, CONTRACT_EXTENSIONS, (FLOAT)4.0); + usNumPixles = AIM_POLICY_PARAGRAPH_Y; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, CONTRACT_EXTENSIONS_1, (FLOAT)4.1) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, CONTRACT_EXTENSIONS_2, (FLOAT)4.2) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, CONTRACT_EXTENSIONS_3, (FLOAT)4.3) + AIM_POLICY_PARAGRAPH_GAP; + break; + + case 6: + DisplayAimPolicyTitle(AIM_POLICY_SUBTITLE_Y, TERMS_OF_PAYMENT, (FLOAT)5.0); + usNumPixles = AIM_POLICY_PARAGRAPH_Y; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, TERMS_OF_PAYMENT_1, (FLOAT)5.1) + AIM_POLICY_PARAGRAPH_GAP; + break; + + case 7: + DisplayAimPolicyTitle(AIM_POLICY_SUBTITLE_Y, TERMS_OF_ENGAGEMENT, (FLOAT)6.0); + usNumPixles = AIM_POLICY_PARAGRAPH_Y; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, TERMS_OF_ENGAGEMENT_1, (FLOAT)6.1) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, TERMS_OF_ENGAGEMENT_2A, (FLOAT)6.2) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, TERMS_OF_ENGAGEMENT_2B, (FLOAT)0.0) + AIM_POLICY_PARAGRAPH_GAP; + break; + + case 8: + DisplayAimPolicyTitle(AIM_POLICY_SUBTITLE_Y, ENGAGEMENT_TERMINATION, (FLOAT)7.0); + usNumPixles = AIM_POLICY_PARAGRAPH_Y; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, ENGAGEMENT_TERMINATION_1, (FLOAT)7.1) + AIM_POLICY_PARAGRAPH_GAP; + + usNumPixles += DisplayAimPolicySubParagraph(usNumPixles, ENGAGEMENT_TERMINATION_1_1, (FLOAT)7.11) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicySubParagraph(usNumPixles, ENGAGEMENT_TERMINATION_1_2, (FLOAT)7.12) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicySubParagraph(usNumPixles, ENGAGEMENT_TERMINATION_1_3, (FLOAT)7.13) + AIM_POLICY_PARAGRAPH_GAP; + break; + + case 9: + DisplayAimPolicyTitle(AIM_POLICY_SUBTITLE_Y, EQUIPMENT_AND_INVENTORY, (FLOAT)8.0); + usNumPixles = AIM_POLICY_PARAGRAPH_Y; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, EQUIPMENT_AND_INVENTORY_1, (FLOAT)8.1) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, EQUIPMENT_AND_INVENTORY_2, (FLOAT)8.2) + AIM_POLICY_PARAGRAPH_GAP; + break; + + case 10: + DisableAimPolicyButton(); + + DisplayAimPolicyTitle(AIM_POLICY_SUBTITLE_Y, POLICY_MEDICAL, (FLOAT)9.0); + usNumPixles = AIM_POLICY_PARAGRAPH_Y; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, POLICY_MEDICAL_1, (FLOAT)9.1) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, POLICY_MEDICAL_2, (FLOAT)9.2) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, POLICY_MEDICAL_3A, (FLOAT)9.3) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, POLICY_MEDICAL_3B, (FLOAT)0.0) + AIM_POLICY_PARAGRAPH_GAP; + usNumPixles += DisplayAimPolicyParagraph(usNumPixles, POLICY_MEDICAL_4, (FLOAT)9.4) + AIM_POLICY_PARAGRAPH_GAP; + break; + } + + MarkButtonsDirty( ); + + RenderWWWProgramTitleBar( ); + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + +BOOLEAN InitAimPolicyMenuBar(void) +{ + UINT16 i, usPosX; + + if(gfAimPolicyMenuBarLoaded) + return(TRUE); + + //Load graphic for buttons + guiPoliciesMenuButtonImage = LoadButtonImage("LAPTOP\\BottomButtons2.sti", -1,0,-1,1,-1 ); + + usPosX = AIM_POLICY_MENU_X; + for(i=0; iuiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + gubPoliciesAgreeButtonDown = ubRetValue; + } + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //Agree + fOnPage = FALSE; + if(ubRetValue == 1) + { + gubCurPageNum++; + ChangingAimPoliciesSubPage( gubCurPageNum ); + } + + //Disagree + else + { + guiCurrentLaptopMode = LAPTOP_MODE_AIM; + } + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + fOnPage = TRUE; + gubPoliciesAgreeButtonDown = 255; + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + gubPoliciesAgreeButtonDown = 255; + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + } + } +} + +void BtnPoliciesMenuButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + UINT8 ubRetValue; + static BOOLEAN fOnPage=TRUE; + if(fOnPage) + { + ubRetValue = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + gubAimPolicyMenuButtonDown = ubRetValue; + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + } + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + gubAimPolicyMenuButtonDown = 255; + //If previous Page + if( ubRetValue == 0 ) + { + if( gubCurPageNum > 1) + { + gubCurPageNum--; + ChangingAimPoliciesSubPage( gubCurPageNum ); + } + } + + // Home Page + else if( ubRetValue == 1 ) + { + guiCurrentLaptopMode = LAPTOP_MODE_AIM; + } + + //Company policies index + else if( ubRetValue == 2 ) + { + if( gubCurPageNum != 1 ) + { + gubCurPageNum=1; + ChangingAimPoliciesSubPage( gubCurPageNum ); + } + } + + //Next Page + else if( ubRetValue == 3 ) + { + if( gubCurPageNum < NUM_AIM_POLICY_PAGES-1 ) + { + gubCurPageNum++; + ChangingAimPoliciesSubPage( gubCurPageNum ); + + fOnPage = FALSE; + if(gfInPolicyToc) + { + ExitAimPolicyTocMenu(); + } + fOnPage = TRUE; + } + } + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + ResetAimPolicyButtons(); + DisableAimPolicyButton(); + fOnPage = TRUE; + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + gubAimPolicyMenuButtonDown = 255; + DisableAimPolicyButton(); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + } + } +} + + +void ResetAimPolicyButtons() +{ + int i=0; + + for(i=0; iuiFlags &= ~BUTTON_CLICKED_ON; + } +} + + +void DisableAimPolicyButton() +{ + if( gfExitingAimPolicy == TRUE || gfAimPolicyMenuBarLoaded == FALSE ) + return; + + if( (gubCurPageNum == AIM_POLICY_TOC_PAGE ) ) + { + ButtonList[ guiPoliciesMenuButton[ 0 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); + ButtonList[ guiPoliciesMenuButton[ 2 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); + } + else if( ( gubCurPageNum == AIM_POLICY_LAST_PAGE ) ) + { + ButtonList[ guiPoliciesMenuButton[ 3 ] ]->uiFlags |= (BUTTON_CLICKED_ON ); + } +} + + +void ChangingAimPoliciesSubPage( UINT8 ubSubPageNumber ) +{ + fLoadPendingFlag = TRUE; + + if( AimPoliciesSubPagesVisitedFlag[ ubSubPageNumber ] == FALSE ) + { + fConnectingToSubPage = TRUE; + fFastLoadFlag = FALSE; + + AimPoliciesSubPagesVisitedFlag[ ubSubPageNumber ] = TRUE; + } + else + { + fConnectingToSubPage = TRUE; + fFastLoadFlag = TRUE; + } +} + + + + + + + + diff --git a/Laptop/AimPolicies.h b/Laptop/AimPolicies.h new file mode 100644 index 00000000..7654cd8a --- /dev/null +++ b/Laptop/AimPolicies.h @@ -0,0 +1,17 @@ +#ifndef __AIMPOLICIES_H +#define __AIMPOLICIES_H + +void GameInitAimPolicies(); +BOOLEAN EnterAimPolicies(); +void ExitAimPolicies(); +void HandleAimPolicies(); +void RenderAimPolicies(); +void EnterInitAimPolicies(); + +#endif + + + + + + diff --git a/Laptop/AimSort.cpp b/Laptop/AimSort.cpp new file mode 100644 index 00000000..b08afe05 --- /dev/null +++ b/Laptop/AimSort.cpp @@ -0,0 +1,751 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "AimSort.h" + #include "Aim.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Soldier Profile.h" + #include "stdlib.h" + #include "Game Clock.h" + #include "Text.h" + #include "Multi Language Graphic Utils.h" +#endif + +//#define + +#define AIM_SORT_FONT_TITLE FONT14ARIAL +#define AIM_SORT_FONT_SORT_TEXT FONT10ARIAL + +#define AIM_SORT_COLOR_SORT_TEXT AIM_FONT_MCOLOR_WHITE +#define AIM_SORT_SORT_BY_COLOR 146 +#define AIM_SORT_LINK_TEXT_COLOR 146 + +#define AIM_SORT_GAP_BN_ICONS 60 +#define AIM_SORT_CHECKBOX_SIZE 10 +#define AIM_SORT_ON 0 +#define AIM_SORT_OFF 1 + +#define AIM_SORT_TO_MUGSHOTS_X IMAGE_OFFSET_X + 89 +#define AIM_SORT_TO_MUGSHOTS_Y IMAGE_OFFSET_Y + 184 +#define AIM_SORT_TO_MUGSHOTS_SIZE 54 + +#define AIM_SORT_TO_STATS_X AIM_SORT_TO_MUGSHOTS_X +#define AIM_SORT_TO_STATS_Y AIM_SORT_TO_MUGSHOTS_Y + AIM_SORT_GAP_BN_ICONS +#define AIM_SORT_TO_STATS_SIZE AIM_SORT_TO_MUGSHOTS_SIZE + +#define AIM_SORT_TO_ALUMNI_X AIM_SORT_TO_MUGSHOTS_X +#define AIM_SORT_TO_ALUMNI_Y AIM_SORT_TO_STATS_Y + AIM_SORT_GAP_BN_ICONS +#define AIM_SORT_TO_ALUMNI_SIZE AIM_SORT_TO_MUGSHOTS_SIZE + +#define AIM_SORT_AIM_MEMBER_X AIM_SORT_SORT_BY_X +#define AIM_SORT_AIM_MEMBER_Y iScreenHeightOffset + 105 + LAPTOP_SCREEN_WEB_DELTA_Y +#define AIM_SORT_AIM_MEMBER_WIDTH AIM_SORT_SORT_BY_WIDTH + +#define AIM_SORT_SORT_BY_TEXT_X AIM_SORT_SORT_BY_X + 9 +#define AIM_SORT_SORT_BY_TEXT_Y AIM_SORT_SORT_BY_Y + 8 + +#define AIM_SORT_PRICE_TEXT_X AIM_SORT_SORT_BY_X + 22 +#define AIM_SORT_PRICE_TEXT_Y AIM_SORT_SORT_BY_Y + 36 + +#define AIM_SORT_EXP_TEXT_X AIM_SORT_PRICE_TEXT_X +#define AIM_SORT_EXP_TEXT_Y AIM_SORT_PRICE_TEXT_Y + 13 + +#define AIM_SORT_MARKMNSHP_TEXT_X AIM_SORT_PRICE_TEXT_X +#define AIM_SORT_MARKMNSHP_TEXT_Y AIM_SORT_EXP_TEXT_Y + 13 + +#define AIM_SORT_MEDICAL_X AIM_SORT_SORT_BY_X + 125 +#define AIM_SORT_MEDICAL_Y AIM_SORT_PRICE_TEXT_Y + +#define AIM_SORT_EXPLOSIVES_X AIM_SORT_MEDICAL_X +#define AIM_SORT_EXPLOSIVES_Y AIM_SORT_EXP_TEXT_Y + +#define AIM_SORT_MECHANICAL_X AIM_SORT_MEDICAL_X +#define AIM_SORT_MECHANICAL_Y AIM_SORT_MARKMNSHP_TEXT_Y + +#define AIM_SORT_ASC_DESC_WIDTH 100 +#define AIM_SORT_ASCEND_TEXT_X AIM_SORT_SORT_BY_X + 154 - AIM_SORT_ASC_DESC_WIDTH - 4 + 18 +#define AIM_SORT_ASCEND_TEXT_Y iScreenHeightOffset + 128 + LAPTOP_SCREEN_WEB_DELTA_Y + +#define AIM_SORT_DESCEND_TEXT_X AIM_SORT_ASCEND_TEXT_X +#define AIM_SORT_DESCEND_TEXT_Y iScreenHeightOffset + 141 + LAPTOP_SCREEN_WEB_DELTA_Y + + +#define AIM_SORT_MUGSHOT_TEXT_X iScreenWidthOffset + 266 +#define AIM_SORT_MUGSHOT_TEXT_Y iScreenHeightOffset + 230 + LAPTOP_SCREEN_WEB_DELTA_Y + +#define AIM_SORT_MERC_STATS_TEXT_X AIM_SORT_MUGSHOT_TEXT_X +#define AIM_SORT_MERC_STATS_TEXT_Y iScreenHeightOffset + 293 + LAPTOP_SCREEN_WEB_DELTA_Y + +#define AIM_SORT_ALUMNI_TEXT_X AIM_SORT_MUGSHOT_TEXT_X +#define AIM_SORT_ALUMNI_TEXT_Y iScreenHeightOffset + 351 + LAPTOP_SCREEN_WEB_DELTA_Y + +#define AIM_SORT_FIRST_SORT_CLOUMN_GAP 22 + + +#define AIM_SORT_SORT_BY_X IMAGE_OFFSET_X + 155 +#define AIM_SORT_SORT_BY_Y IMAGE_OFFSET_Y + 96 +#define AIM_SORT_SORT_BY_WIDTH 190 +#define AIM_SORT_SORT_BY_HEIGHT 81 + +UINT16 AimSortCheckBoxLoc[]={ + (AIM_SORT_SORT_BY_X + 9), (AIM_SORT_SORT_BY_Y + 34), + (AIM_SORT_SORT_BY_X + 9), (AIM_SORT_SORT_BY_Y + 47), + (AIM_SORT_SORT_BY_X + 9), (AIM_SORT_SORT_BY_Y + 60), + (AIM_SORT_SORT_BY_X + 111), (AIM_SORT_SORT_BY_Y + 34), + (AIM_SORT_SORT_BY_X + 111), (AIM_SORT_SORT_BY_Y + 47), + (AIM_SORT_SORT_BY_X + 111), (AIM_SORT_SORT_BY_Y + 60), + (AIM_SORT_SORT_BY_X + 172), (AIM_SORT_SORT_BY_Y + 4), + (AIM_SORT_SORT_BY_X + 172), (AIM_SORT_SORT_BY_Y + 17)}; + +UINT8 gubCurrentSortMode; +UINT8 gubOldSortMode; +UINT8 gubCurrentListMode; +UINT8 gubOldListMode; + +// Mouse stuff +//Clicking on To Mugshot +MOUSE_REGION gSelectedToMugShotRegion; +void SelectToMugShotRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Clicking on ToStats +MOUSE_REGION gSelectedToStatsRegion; +void SelectToStatsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Clicking on ToStats +MOUSE_REGION gSelectedToArchiveRegion; +void SelectToArchiveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Clicking on Price Check Box +MOUSE_REGION gSelectedPriceBoxRegion; +void SelectPriceBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +//Clicking on Explosive Check Box +MOUSE_REGION gSelectedExpBoxRegion; +void SelectExpBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +//Clicking on Markmanship Check Box +MOUSE_REGION gSelectedMarkBoxRegion; +void SelectMarkBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +//Clicking on Medical Check box +MOUSE_REGION gSelectedMedicalBoxRegion; +void SelectMedicalBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +//Clicking on Explosive Check Box +MOUSE_REGION gSelectedExplosiveBoxRegion; +void SelectExplosiveBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +//Clicking on Mechanical Check Box +MOUSE_REGION gSelectedMechanicalBoxRegion; +void SelectMechanicalBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +//Clicking on Ascending Check Box +MOUSE_REGION gSelectedAscendBoxRegion; +void SelectAscendBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +//Clicking on Descending Check Box +MOUSE_REGION gSelectedDescendBoxRegion; +void SelectDescendBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + + +void DrawSelectLight(UINT8 ubMode, UINT8 ubImage); +INT32 QsortCompare( const void *pNum1, const void *pNum2); +INT32 CompareValue(const INT32 Num1, const INT32 Num2); +BOOLEAN SortMercArray(void); + + +UINT32 guiSortByBox; +UINT32 guiToAlumni; +UINT32 guiToMugShots; +UINT32 guiToStats; +UINT32 guiSelectLight; + + + + + +void GameInitAimSort() +{ + gubCurrentSortMode=0; + gubOldSortMode=0; + gubCurrentListMode=AIM_DESCEND; + gubOldListMode=AIM_DESCEND; +} + +BOOLEAN EnterAimSort() +{ + VOBJECT_DESC VObjectDesc; + UINT8 ubCurNumber=0; + UINT16 ubWidth; + UINT8 i; + + AimSortCheckBoxLoc[0] = AIM_SORT_SORT_BY_X + 9; + AimSortCheckBoxLoc[1] = AIM_SORT_SORT_BY_Y + 34; + AimSortCheckBoxLoc[2] = AIM_SORT_SORT_BY_X + 9; + AimSortCheckBoxLoc[3] = AIM_SORT_SORT_BY_Y + 47; + AimSortCheckBoxLoc[4] = AIM_SORT_SORT_BY_X + 9; + AimSortCheckBoxLoc[5] = AIM_SORT_SORT_BY_Y + 60; + AimSortCheckBoxLoc[6] = AIM_SORT_SORT_BY_X + 111; + AimSortCheckBoxLoc[7] = AIM_SORT_SORT_BY_Y + 34; + AimSortCheckBoxLoc[8] = AIM_SORT_SORT_BY_X + 111; + AimSortCheckBoxLoc[9] = AIM_SORT_SORT_BY_Y + 47; + AimSortCheckBoxLoc[10] = AIM_SORT_SORT_BY_X + 111; + AimSortCheckBoxLoc[11] = AIM_SORT_SORT_BY_Y + 60; + AimSortCheckBoxLoc[12] = AIM_SORT_SORT_BY_X + 172; + AimSortCheckBoxLoc[13] = AIM_SORT_SORT_BY_Y + 4; + AimSortCheckBoxLoc[14] = AIM_SORT_SORT_BY_X + 172; + AimSortCheckBoxLoc[15] = AIM_SORT_SORT_BY_Y + 17; + + //Everytime into Aim Sort, reset array. + for(i=0; i Num2) + return(-1); + else if( Num1 == Num2) + return(0); + else + return(1); + } + + return( 0 ); +} + + + + + + diff --git a/Laptop/AimSort.h b/Laptop/AimSort.h new file mode 100644 index 00000000..ac0e2ea0 --- /dev/null +++ b/Laptop/AimSort.h @@ -0,0 +1,25 @@ +#ifndef __AIMSORT_H_ +#define __AIMSORT_H_ + +extern UINT8 gubCurrentSortMode; +extern UINT8 gubCurrentListMode; + + + +#define AIM_ASCEND 6 +#define AIM_DESCEND 7 + + +void GameInitAimSort(); +BOOLEAN EnterAimSort(); +void ExitAimSort(); +void HandleAimSort(); +void RenderAimSort(); + +#endif + + + + + + diff --git a/Laptop/BobbyR.cpp b/Laptop/BobbyR.cpp new file mode 100644 index 00000000..2367ea71 --- /dev/null +++ b/Laptop/BobbyR.cpp @@ -0,0 +1,923 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "BobbyR.h" + #include "BobbyRGuns.h" + #include "Utilities.h" + #include "WCheck.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "interface items.h" + #include "Weapons.h" + #include "Store Inventory.h" + #include "Game Event Hook.h" + #include "Game Clock.h" + #include "LaptopSave.h" + #include "Random.h" + #include "Text.h" + #include "Multi Language Graphic Utils.h" + #include "Utility.h" +#endif + + +#ifdef JA2TESTVERSION + #define BR_INVENTORY_TURNOVER_DEBUG +#endif + + +#define BOBBIES_SIGN_FONT FONT14ARIAL +#define BOBBIES_SIGN_COLOR 2 +#define BOBBIES_SIGN_BACKCOLOR FONT_MCOLOR_BLACK +#define BOBBIES_SIGN_BACKGROUNDCOLOR 78 + +#define BOBBIES_NUMBER_SIGNS 5 + +#define BOBBIES_SENTENCE_FONT FONT12ARIAL +#define BOBBIES_SENTENCE_COLOR FONT_MCOLOR_WHITE +#define BOBBIES_SENTENCE_BACKGROUNDCOLOR 2 + +#define BOBBY_WOOD_BACKGROUND_X LAPTOP_SCREEN_UL_X +#define BOBBY_WOOD_BACKGROUND_Y LAPTOP_SCREEN_WEB_UL_Y +#define BOBBY_WOOD_BACKGROUND_WIDTH 125 +#define BOBBY_WOOD_BACKGROUND_HEIGHT 100 + +#define BOBBY_RAYS_NAME_X LAPTOP_SCREEN_UL_X + 77 +#define BOBBY_RAYS_NAME_Y LAPTOP_SCREEN_WEB_UL_Y + 0 +#define BOBBY_RAYS_NAME_WIDTH 344 +#define BOBBY_RAYS_NAME_HEIGHT 66 + +#define BOBBYS_PLAQUES_X LAPTOP_SCREEN_UL_X + 39 +#define BOBBYS_PLAQUES_Y LAPTOP_SCREEN_WEB_UL_Y + 174 +#define BOBBYS_PLAQUES_WIDTH 414 +#define BOBBYS_PLAQUES_HEIGHT 190 + +#define BOBBIES_TOPHINGE_X LAPTOP_SCREEN_UL_X +#define BOBBIES_TOPHINGE_Y LAPTOP_SCREEN_WEB_UL_Y + 42 + +#define BOBBIES_BOTTOMHINGE_X LAPTOP_SCREEN_UL_X +#define BOBBIES_BOTTOMHINGE_Y LAPTOP_SCREEN_WEB_UL_Y + 338 + +#define BOBBIES_STORE_PLAQUE_X LAPTOP_SCREEN_UL_X + 148 +#define BOBBIES_STORE_PLAQUE_Y LAPTOP_SCREEN_WEB_UL_Y + 66 +#define BOBBIES_STORE_PLAQUE_HEIGHT 93 + +#define BOBBIES_HANDLE_X LAPTOP_SCREEN_UL_X + 457 +#define BOBBIES_HANDLE_Y LAPTOP_SCREEN_WEB_UL_Y + 147 + +#define BOBBIES_FIRST_SENTENCE_X LAPTOP_SCREEN_UL_X +#define BOBBIES_FIRST_SENTENCE_Y BOBBIES_STORE_PLAQUE_Y + BOBBIES_STORE_PLAQUE_HEIGHT - 3 +#define BOBBIES_FIRST_SENTENCE_WIDTH 500 + +#define BOBBIES_2ND_SENTENCE_X LAPTOP_SCREEN_UL_X +#define BOBBIES_2ND_SENTENCE_Y BOBBIES_FIRST_SENTENCE_Y + 13 +#define BOBBIES_2ND_SENTENCE_WIDTH 500 + +#define BOBBIES_CENTER_SIGN_OFFSET_Y 23 + +#define BOBBIES_USED_SIGN_X BOBBYS_PLAQUES_X + 93 +#define BOBBIES_USED_SIGN_Y BOBBYS_PLAQUES_Y + 32 +#define BOBBIES_USED_SIGN_WIDTH 92 +#define BOBBIES_USED_SIGN_HEIGHT 50 +#define BOBBIES_USED_SIGN_TEXT_OFFSET BOBBIES_USED_SIGN_Y + 10 + +#define BOBBIES_MISC_SIGN_X BOBBYS_PLAQUES_X + 238 +#define BOBBIES_MISC_SIGN_Y BOBBYS_PLAQUES_Y + 27 +#define BOBBIES_MISC_SIGN_WIDTH 103 +#define BOBBIES_MISC_SIGN_HEIGHT 57 +#define BOBBIES_MISC_SIGN_TEXT_OFFSET BOBBIES_MISC_SIGN_Y + BOBBIES_CENTER_SIGN_OFFSET_Y + +#define BOBBIES_GUNS_SIGN_X BOBBYS_PLAQUES_X + 3 +#define BOBBIES_GUNS_SIGN_Y BOBBYS_PLAQUES_Y + 102 +#define BOBBIES_GUNS_SIGN_WIDTH 116 +#define BOBBIES_GUNS_SIGN_HEIGHT 75 +#define BOBBIES_GUNS_SIGN_TEXT_OFFSET BOBBIES_GUNS_SIGN_Y + BOBBIES_CENTER_SIGN_OFFSET_Y + +#define BOBBIES_AMMO_SIGN_X BOBBYS_PLAQUES_X + 150 +#define BOBBIES_AMMO_SIGN_Y BOBBYS_PLAQUES_Y + 105 +#define BOBBIES_AMMO_SIGN_WIDTH 112 +#define BOBBIES_AMMO_SIGN_HEIGHT 71 +#define BOBBIES_AMMO_SIGN_TEXT_OFFSET BOBBIES_AMMO_SIGN_Y + BOBBIES_CENTER_SIGN_OFFSET_Y + +#define BOBBIES_ARMOUR_SIGN_X BOBBYS_PLAQUES_X + 290 +#define BOBBIES_ARMOUR_SIGN_Y BOBBYS_PLAQUES_Y + 108 +#define BOBBIES_ARMOUR_SIGN_WIDTH 114 +#define BOBBIES_ARMOUR_SIGN_HEIGHT 70 +#define BOBBIES_ARMOUR_SIGN_TEXT_OFFSET BOBBIES_ARMOUR_SIGN_Y + BOBBIES_CENTER_SIGN_OFFSET_Y + +#define BOBBIES_3RD_SENTENCE_X LAPTOP_SCREEN_UL_X +#define BOBBIES_3RD_SENTENCE_Y BOBBIES_BOTTOMHINGE_Y + 40 +#define BOBBIES_3RD_SENTENCE_WIDTH 500 + +#define BOBBY_R_NEW_PURCHASE_ARRIVAL_TIME (1 * 60 * 24) // minutes in 1 day + +#define BOBBY_R_USED_PURCHASE_OFFSET 1000 + +#define BOBBYR_UNDERCONSTRUCTION_ANI_DELAY 150 +#define BOBBYR_UNDERCONSTRUCTION_NUM_FRAMES 5 + +#define BOBBYR_UNDERCONSTRUCTION_X iScreenWidthOffset + 111 + ( 613 - 111 - BOBBYR_UNDERCONSTRUCTION_WIDTH) / 2 +#define BOBBYR_UNDERCONSTRUCTION_Y iScreenHeightOffset + 175 +#define BOBBYR_UNDERCONSTRUCTION1_Y iScreenHeightOffset + 378 + +#define BOBBYR_UNDERCONSTRUCTION_WIDTH 414 +#define BOBBYR_UNDERCONSTRUCTION_HEIGHT 64 + +#define BOBBYR_UNDER_CONSTRUCTION_TEXT_X LAPTOP_SCREEN_UL_X +#define BOBBYR_UNDER_CONSTRUCTION_TEXT_Y BOBBYR_UNDERCONSTRUCTION_Y + 62 + 60 +#define BOBBYR_UNDER_CONSTRUCTION_TEXT_WIDTH 613 - 111 + + + +UINT32 guiBobbyName; +UINT32 guiPlaque; +UINT32 guiTopHinge; +UINT32 guiBottomHinge; +UINT32 guiStorePlaque; +UINT32 guiHandle; +UINT32 guiWoodBackground; +UINT32 guiUnderConstructionImage; + +/* +UINT16 gusFirstGunIndex; +UINT16 gusLastGunIndex; +UINT8 gubNumGunPages; + +UINT16 gusFirstAmmoIndex; +UINT16 gusLastAmmoIndex; +UINT8 gubNumAmmoPages; + +UINT16 gusFirstMiscIndex; +UINT16 gusLastMiscIndex; +UINT8 gubNumMiscPages; + +UINT16 gusFirstArmourIndex; +UINT16 gusLastArmourIndex; +UINT8 gubNumArmourPages; + +UINT16 gusFirstUsedIndex; +UINT16 gusLastUsedIndex; +UINT8 gubNumUsedPages; +*/ + +UINT32 guiLastBobbyRayPage; + + + +UINT8 gubBobbyRPages[]={ + LAPTOP_MODE_BOBBY_R_USED, + LAPTOP_MODE_BOBBY_R_MISC, + LAPTOP_MODE_BOBBY_R_GUNS, + LAPTOP_MODE_BOBBY_R_AMMO, + LAPTOP_MODE_BOBBY_R_ARMOR}; + + +//Bobby's Sign menu mouse regions +MOUSE_REGION gSelectedBobbiesSignMenuRegion[ BOBBIES_NUMBER_SIGNS ]; +void SelectBobbiesSignMenuRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +BOOLEAN InitBobbiesMouseRegion(UINT8 ubNumerRegions, UINT16 *usMouseRegionPosArray, MOUSE_REGION *MouseRegion); +BOOLEAN RemoveBobbiesMouseRegion(UINT8 ubNumberRegions, MOUSE_REGION *Mouse_Region); +void HandleBobbyRUnderConstructionAni( BOOLEAN fReset ); + +void SimulateBobbyRayCustomer(STORE_INVENTORY *pInventoryArray, BOOLEAN fUsed); + + + +void GameInitBobbyR() +{ +} + + +BOOLEAN EnterBobbyR() +{ + VOBJECT_DESC VObjectDesc; + UINT8 i; + + // an array of mouse regions for the bobbies signs. Top Left corner, bottom right corner + UINT16 usMouseRegionPosArray[] = {BOBBIES_USED_SIGN_X, BOBBIES_USED_SIGN_Y, BOBBIES_USED_SIGN_X+BOBBIES_USED_SIGN_WIDTH, BOBBIES_USED_SIGN_Y+BOBBIES_USED_SIGN_HEIGHT, + BOBBIES_MISC_SIGN_X, BOBBIES_MISC_SIGN_Y, BOBBIES_MISC_SIGN_X+BOBBIES_MISC_SIGN_WIDTH, BOBBIES_MISC_SIGN_Y+BOBBIES_MISC_SIGN_HEIGHT, + BOBBIES_GUNS_SIGN_X, BOBBIES_GUNS_SIGN_Y, BOBBIES_GUNS_SIGN_X+BOBBIES_GUNS_SIGN_WIDTH, BOBBIES_GUNS_SIGN_Y+BOBBIES_GUNS_SIGN_HEIGHT, + BOBBIES_AMMO_SIGN_X, BOBBIES_AMMO_SIGN_Y, BOBBIES_AMMO_SIGN_X+BOBBIES_AMMO_SIGN_WIDTH, BOBBIES_AMMO_SIGN_Y+BOBBIES_AMMO_SIGN_HEIGHT, + BOBBIES_ARMOUR_SIGN_X, BOBBIES_ARMOUR_SIGN_Y, BOBBIES_ARMOUR_SIGN_X+BOBBIES_ARMOUR_SIGN_WIDTH, BOBBIES_ARMOUR_SIGN_Y+BOBBIES_ARMOUR_SIGN_HEIGHT}; + + InitBobbyRWoodBackground(); + + // load the Bobbyname graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_BOBBYNAME ); + CHECKF(AddVideoObject(&VObjectDesc, &guiBobbyName)); + + // load the plaque graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BobbyPlaques.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiPlaque)); + + // load the TopHinge graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BobbyTopHinge.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTopHinge)); + + // load the BottomHinge graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BobbyBottomHinge.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBottomHinge)); + + // load the Store Plaque graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_STOREPLAQUE ); + CHECKF(AddVideoObject(&VObjectDesc, &guiStorePlaque)); + + // load the Handle graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BobbyHandle.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiHandle)); + + + InitBobbiesMouseRegion(BOBBIES_NUMBER_SIGNS, usMouseRegionPosArray, gSelectedBobbiesSignMenuRegion); + + + if( !LaptopSaveInfo.fBobbyRSiteCanBeAccessed ) + { + // load the Handle graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\UnderConstruction.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiUnderConstructionImage)); + + for(i=0; i BOBBYR_UNDERCONSTRUCTION_ANI_DELAY )||( fReDrawScreenFlag ) ) + { + // The undercontsruction graphic + GetVideoObject(&hPixHandle, guiUnderConstructionImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, usCount, BOBBYR_UNDERCONSTRUCTION_X, BOBBYR_UNDERCONSTRUCTION_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + BltVideoObject( FRAME_BUFFER, hPixHandle, usCount, BOBBYR_UNDERCONSTRUCTION_X, BOBBYR_UNDERCONSTRUCTION1_Y, VO_BLT_SRCTRANSPARENCY,NULL ); + + DrawTextToScreen( BobbyRaysFrontText[ BOBBYR_UNDER_CONSTRUCTION ], BOBBYR_UNDER_CONSTRUCTION_TEXT_X, BOBBYR_UNDER_CONSTRUCTION_TEXT_Y, BOBBYR_UNDER_CONSTRUCTION_TEXT_WIDTH, FONT16ARIAL, BOBBIES_SENTENCE_COLOR, BOBBIES_SIGN_BACKCOLOR, FALSE, CENTER_JUSTIFIED | INVALIDATE_TEXT ); + + InvalidateRegion( BOBBYR_UNDERCONSTRUCTION_X, BOBBYR_UNDERCONSTRUCTION_Y, BOBBYR_UNDERCONSTRUCTION_X+BOBBYR_UNDERCONSTRUCTION_WIDTH, BOBBYR_UNDERCONSTRUCTION_Y+BOBBYR_UNDERCONSTRUCTION_HEIGHT ); + InvalidateRegion( BOBBYR_UNDERCONSTRUCTION_X, BOBBYR_UNDERCONSTRUCTION1_Y, BOBBYR_UNDERCONSTRUCTION_X+BOBBYR_UNDERCONSTRUCTION_WIDTH, BOBBYR_UNDERCONSTRUCTION1_Y+BOBBYR_UNDERCONSTRUCTION_HEIGHT ); + + uiLastTime = GetJA2Clock(); + + usCount++; + + if( usCount >= BOBBYR_UNDERCONSTRUCTION_NUM_FRAMES ) + usCount = 0; + } +} + + + +void InitBobbyRayInventory() +{ + //Initializes which NEW items can be bought at Bobby Rays + InitBobbyRayNewInventory(); + + //Initializes the starting values for Bobby Rays NEW Inventory + SetupStoreInventory( LaptopSaveInfo.BobbyRayInventory, FALSE ); + + //Initializes which USED items can be bought at Bobby Rays + InitBobbyRayUsedInventory(); + + //Initializes the starting values for Bobby Rays USED Inventory + SetupStoreInventory( LaptopSaveInfo.BobbyRayUsedInventory, TRUE); +} + + +BOOLEAN InitBobbyRayNewInventory() +{ + UINT16 i; + UINT16 usBobbyrIndex = 0; + + + memset( LaptopSaveInfo.BobbyRayInventory, 0, sizeof(STORE_INVENTORY) * MAXITEMS); + + // add all the NEW items he can ever sell into his possible inventory list, for now in order by item # + for( i = 0; i < MAXITEMS; i++ ) + { + if ( Item[i].usItemClass == 0 ) + break; + //if Bobby Ray sells this, it can be sold, and it's allowed into this game (some depend on e.g. gun-nut option) +// if( ( StoreInventory[ i ][ BOBBY_RAY_NEW ] != 0) && !( Item[ i ].fFlags & ITEM_NOT_BUYABLE ) && ItemIsLegal( i ) ) + if( ( StoreInventory[ i ][ BOBBY_RAY_NEW ] != 0) && !( Item[ i ].notbuyable ) && ItemIsLegal( i ) ) + { + LaptopSaveInfo.BobbyRayInventory[ usBobbyrIndex ].usItemIndex = i; + usBobbyrIndex++; + } + } + + if ( usBobbyrIndex > 1 ) + { + // sort this list by object category, and by ascending price within each category + qsort( LaptopSaveInfo.BobbyRayInventory, usBobbyrIndex, sizeof( STORE_INVENTORY ), BobbyRayItemQsortCompare ); + } + + + // remember how many entries in the list are valid + LaptopSaveInfo.usInventoryListLength[ BOBBY_RAY_NEW ] = usBobbyrIndex; + // also mark the end of the list of valid item entries + LaptopSaveInfo.BobbyRayInventory[ usBobbyrIndex ].usItemIndex = BOBBYR_NO_ITEMS; + + return(TRUE); +} + + +BOOLEAN InitBobbyRayUsedInventory() +{ + UINT16 i; + UINT16 usBobbyrIndex = 0; + + + memset( LaptopSaveInfo.BobbyRayUsedInventory, 0, sizeof(STORE_INVENTORY) * MAXITEMS); + + // add all the NEW items he can ever sell into his possible inventory list, for now in order by item # + for( i = 0; i < MAXITEMS; i++ ) + { + if ( Item[i].usItemClass == 0 ) + break; + //if Bobby Ray sells this, it can be sold, and it's allowed into this game (some depend on e.g. gun-nut option) +// if( ( StoreInventory[ i ][ BOBBY_RAY_USED ] != 0) && !( Item[ i ].fFlags & ITEM_NOT_BUYABLE ) && ItemIsLegal( i ) ) + if( ( StoreInventory[ i ][ BOBBY_RAY_USED ] != 0) && !( Item[ i ].notbuyable ) && ItemIsLegal( i ) ) + { +// if( (StoreInventory[ i ][ BOBBY_RAY_USED ] != 0) && !( Item[i].fFlags & ITEM_NOT_BUYABLE ) && ItemIsLegal( i )) + if( (StoreInventory[ i ][ BOBBY_RAY_USED ] != 0) && !( Item[i].notbuyable ) && ItemIsLegal( i )) + // in case his store inventory list is wrong, make sure this category of item can be sold used + if ( CanDealerItemBeSoldUsed( i ) ) + { + LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyrIndex ].usItemIndex = i; + usBobbyrIndex++; + } + } + } + + if ( usBobbyrIndex > 1 ) + { + // sort this list by object category, and by ascending price within each category + qsort( LaptopSaveInfo.BobbyRayUsedInventory, usBobbyrIndex, sizeof( STORE_INVENTORY ), BobbyRayItemQsortCompare ); + } + + // remember how many entries in the list are valid + LaptopSaveInfo.usInventoryListLength[BOBBY_RAY_USED] = usBobbyrIndex; + // also mark the end of the list of valid item entries + LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyrIndex ].usItemIndex = BOBBYR_NO_ITEMS; + + return(TRUE); +} + + + +void DailyUpdateOfBobbyRaysNewInventory() +{ + INT16 i; + UINT16 usItemIndex; + BOOLEAN fPrevElig; + + + //simulate other buyers by reducing the current quantity on hand + SimulateBobbyRayCustomer(LaptopSaveInfo.BobbyRayInventory, BOBBY_RAY_NEW); + + //loop through all items BR can stock to see what needs reordering + for(i = 0; i < LaptopSaveInfo.usInventoryListLength[BOBBY_RAY_NEW]; i++) + { + // the index is NOT the item #, get that from the table + usItemIndex = LaptopSaveInfo.BobbyRayInventory[ i ].usItemIndex; + + Assert(usItemIndex < MAXITEMS); + + // make sure this item is still sellable in the latest version of the store inventory + if ( StoreInventory[ usItemIndex ][ BOBBY_RAY_NEW ] == 0 ) + { + continue; + } + + //if the item isn't already on order + if( LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnOrder == 0) + { + //if the qty on hand is half the desired amount or fewer + if( LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnHand <= (StoreInventory[ usItemIndex ][ BOBBY_RAY_NEW ] / 2 ) ) + { + // remember value of the "previously eligible" flag + fPrevElig = LaptopSaveInfo.BobbyRayInventory[ i ].fPreviouslyEligible; + + //determine if any can/should be ordered, and how many + LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnOrder = HowManyBRItemsToOrder( usItemIndex, LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnHand, BOBBY_RAY_NEW); + + //if he found some to buy + if( LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnOrder > 0 ) + { + // if this is the first day the player is eligible to have access to this thing + if ( !fPrevElig || gGameOptions.ubBobbyRay == BR_AWESOME ) + { + // eliminate the ordering delay and stock the items instantly! + // This is just a way to reward the player right away for making progress without the reordering lag... + AddFreshBobbyRayInventory( usItemIndex ); + } + else + { + OrderBobbyRItem(usItemIndex); + +#ifdef BR_INVENTORY_TURNOVER_DEBUG + if ( usItemIndex == ROCKET_LAUNCHER ) + MapScreenMessage( 0, MSG_DEBUG, L"%s: BR Ordered %d, Has %d", WORLDTIMESTR, LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnOrder, LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnHand ); +#endif + } + } + } + } + } +} + + +void DailyUpdateOfBobbyRaysUsedInventory() +{ + INT16 i; + UINT16 usItemIndex; + BOOLEAN fPrevElig; + + + //simulate other buyers by reducing the current quantity on hand + SimulateBobbyRayCustomer(LaptopSaveInfo.BobbyRayUsedInventory, BOBBY_RAY_USED); + + for(i = 0; i < LaptopSaveInfo.usInventoryListLength[BOBBY_RAY_USED]; i++) + { + //if the used item isn't already on order + if( LaptopSaveInfo.BobbyRayUsedInventory[ i ].ubQtyOnOrder == 0 ) + { + //if we don't have ANY + if( LaptopSaveInfo.BobbyRayUsedInventory[ i ].ubQtyOnHand == 0 ) + { + // the index is NOT the item #, get that from the table + usItemIndex = LaptopSaveInfo.BobbyRayUsedInventory[ i ].usItemIndex; + Assert(usItemIndex < MAXITEMS); + + // make sure this item is still sellable in the latest version of the store inventory + if ( StoreInventory[ usItemIndex ][ BOBBY_RAY_USED ] == 0 ) + { + continue; + } + + // remember value of the "previously eligible" flag + fPrevElig = LaptopSaveInfo.BobbyRayUsedInventory[ i ].fPreviouslyEligible; + + //determine if any can/should be ordered, and how many + LaptopSaveInfo.BobbyRayUsedInventory[ i ].ubQtyOnOrder = HowManyBRItemsToOrder(usItemIndex, LaptopSaveInfo.BobbyRayUsedInventory[ i ].ubQtyOnHand, BOBBY_RAY_USED); + + //if he found some to buy + if( LaptopSaveInfo.BobbyRayUsedInventory[ i ].ubQtyOnOrder > 0 ) + { + // if this is the first day the player is eligible to have access to this thing + if ( !fPrevElig || gGameOptions.ubBobbyRay == BR_AWESOME ) + { + // eliminate the ordering delay and stock the items instantly! + // This is just a way to reward the player right away for making progress without the reordering lag... + AddFreshBobbyRayInventory( usItemIndex ); + } + else + { + OrderBobbyRItem((INT16) (usItemIndex + BOBBY_R_USED_PURCHASE_OFFSET)); + } + } + } + } + } +} + + +//returns the number of items to order +UINT8 HowManyBRItemsToOrder(UINT16 usItemIndex, UINT8 ubCurrentlyOnHand, UINT8 ubBobbyRayNewUsed ) +{ + UINT8 ubItemsOrdered = 0; + + + Assert(usItemIndex < MAXITEMS); + // formulas below will fail if there are more items already in stock than optimal + Assert(ubCurrentlyOnHand <= StoreInventory[ usItemIndex ][ ubBobbyRayNewUsed ]); + Assert(ubBobbyRayNewUsed < BOBBY_RAY_LISTS); + + + // decide if he can get stock for this item (items are reordered an entire batch at a time) + if (ItemTransactionOccurs( -1, usItemIndex, DEALER_BUYING, ubBobbyRayNewUsed )) + { + if (ubBobbyRayNewUsed == BOBBY_RAY_NEW) + { + ubItemsOrdered = HowManyItemsToReorder(StoreInventory[ usItemIndex ][ ubBobbyRayNewUsed ] * gGameOptions.ubBobbyRay, ubCurrentlyOnHand); + } + else + { + //Since these are used items we only should order 1 of each type + ubItemsOrdered = 1; + } + } + else + { + // can't obtain this item from suppliers + ubItemsOrdered = 0; + } + + + return(ubItemsOrdered); +} + + +void OrderBobbyRItem(UINT16 usItemIndex) +{ + UINT32 uiArrivalTime; + + //add the new item to the queue. The new item will arrive in 'uiArrivalTime' minutes. + uiArrivalTime = BOBBY_R_NEW_PURCHASE_ARRIVAL_TIME + Random( BOBBY_R_NEW_PURCHASE_ARRIVAL_TIME / 2 ); + uiArrivalTime += GetWorldTotalMin(); + AddStrategicEvent( EVENT_UPDATE_BOBBY_RAY_INVENTORY, uiArrivalTime, usItemIndex); +} + + +void AddFreshBobbyRayInventory( UINT16 usItemIndex ) +{ + INT16 sInventorySlot; + STORE_INVENTORY *pInventoryArray; + BOOLEAN fUsed; + UINT8 ubItemQuality; + + + if( usItemIndex >= BOBBY_R_USED_PURCHASE_OFFSET ) + { + usItemIndex -= BOBBY_R_USED_PURCHASE_OFFSET; + pInventoryArray = LaptopSaveInfo.BobbyRayUsedInventory; + fUsed = BOBBY_RAY_USED; + ubItemQuality = 20 + (UINT8) Random( 60 ); + } + else + { + pInventoryArray = LaptopSaveInfo.BobbyRayInventory; + fUsed = BOBBY_RAY_NEW; + ubItemQuality = 100; + } + + + // find out which inventory slot that item is stored in + sInventorySlot = GetInventorySlotForItem(pInventoryArray, usItemIndex, fUsed); + if (sInventorySlot == -1) + { + AssertMsg( FALSE, String( "AddFreshBobbyRayInventory(), Item %d not found. AM-0.", usItemIndex ) ); + return; + } + + + pInventoryArray[ sInventorySlot ].ubQtyOnHand += pInventoryArray[ sInventorySlot ].ubQtyOnOrder; + pInventoryArray[ sInventorySlot ].ubItemQuality = ubItemQuality; + +#ifdef BR_INVENTORY_TURNOVER_DEBUG + if ( usItemIndex == ROCKET_LAUNCHER && !fUsed ) + MapScreenMessage( 0, MSG_DEBUG, L"%s: BR Bought %d, Has %d", WORLDTIMESTR, pInventoryArray[ sInventorySlot ].ubQtyOnOrder, pInventoryArray[ sInventorySlot ].ubQtyOnHand ); +#endif + + // cancel order + pInventoryArray[ sInventorySlot ].ubQtyOnOrder = 0; +} + + +INT16 GetInventorySlotForItem(STORE_INVENTORY *pInventoryArray, UINT16 usItemIndex, BOOLEAN fUsed) +{ + INT16 i; + + for(i = 0; i < LaptopSaveInfo.usInventoryListLength[fUsed]; i++) + { + //if we have some of this item in stock + if( pInventoryArray[ i ].usItemIndex == usItemIndex) + { + return(i); + } + } + + // not found! + return(-1); +} + + +void SimulateBobbyRayCustomer(STORE_INVENTORY *pInventoryArray, BOOLEAN fUsed) +{ + INT16 i; + UINT8 ubItemsSold; + + //loop through all items BR can stock to see what gets sold + for(i = 0; i < LaptopSaveInfo.usInventoryListLength[fUsed]; i++) + { + //if we have some of this item in stock + if( pInventoryArray[ i ].ubQtyOnHand > 0) + { + ubItemsSold = HowManyItemsAreSold( -1, pInventoryArray[ i ].usItemIndex, pInventoryArray[ i ].ubQtyOnHand, fUsed); + pInventoryArray[ i ].ubQtyOnHand -= ubItemsSold; + +#ifdef BR_INVENTORY_TURNOVER_DEBUG + if (ubItemsSold > 0 ) + { + if ( i == ROCKET_LAUNCHER && !fUsed ) + MapScreenMessage( 0, MSG_DEBUG, L"%s: BR Sold %d, Has %d", WORLDTIMESTR, ubItemsSold, pInventoryArray[ i ].ubQtyOnHand ); + } +#endif + } + } +} + + +void CancelAllPendingBRPurchaseOrders(void) +{ + INT16 i; + + // remove all the BR-Order events off the event queue + DeleteAllStrategicEventsOfType( EVENT_UPDATE_BOBBY_RAY_INVENTORY ); + + // zero out all the quantities on order + for(i = 0; i < MAXITEMS; i++) + { + if ( Item[i].usItemClass == 0 ) + break; + LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnOrder = 0; + LaptopSaveInfo.BobbyRayUsedInventory[ i ].ubQtyOnOrder = 0; + } + + // do an extra daily update immediately to create new reorders ASAP + DailyUpdateOfBobbyRaysNewInventory(); + DailyUpdateOfBobbyRaysUsedInventory(); +} + + + + + + + diff --git a/Laptop/BobbyR.h b/Laptop/BobbyR.h new file mode 100644 index 00000000..d361fea7 --- /dev/null +++ b/Laptop/BobbyR.h @@ -0,0 +1,71 @@ +#ifndef __BOBBYR_H +#define __BOBBYR_H + +#include "Item Types.h" +#include "Store Inventory.h" + + +void GameInitBobbyR(); +BOOLEAN EnterBobbyR(); +void ExitBobbyR(); +void HandleBobbyR(); +void RenderBobbyR(); + + +#define BOBBYR_BACKGROUND_WIDTH 125 +#define BOBBYR_BACKGROUND_HEIGHT 100 +#define BOBBYR_NUM_HORIZONTAL_TILES 4 +#define BOBBYR_NUM_VERTICAL_TILES 4 + +#define BOBBYR_GRIDLOC_X LAPTOP_SCREEN_UL_X + 4 +#define BOBBYR_GRIDLOC_Y LAPTOP_SCREEN_WEB_UL_Y + 45 + + +/* +extern UINT16 gusFirstGunIndex; +extern UINT16 gusLastGunIndex; +extern UINT8 gubNumGunPages; + +extern UINT16 gusFirstAmmoIndex; +extern UINT16 gusLastAmmoIndex; +extern UINT8 gubNumAmmoPages; + +extern UINT16 gusFirstMiscIndex; +extern UINT16 gusLastMiscIndex; +extern UINT8 gubNumMiscPages; + +extern UINT16 gusFirstArmourIndex; +extern UINT16 gusLastArmourIndex; +extern UINT8 gubNumArmourPages; + +extern UINT16 gusFirstUsedIndex; +extern UINT16 gusLastUsedIndex; +extern UINT8 gubNumUsedPages; +*/ + +extern UINT32 guiLastBobbyRayPage; + + +//BOOLEAN WebPageTileBackground(UINT8 ubNumX, UINT8 ubNumY, UINT16 usWidth, UINT16 usHeight, UINT32 uiBackGround); +BOOLEAN DrawBobbyRWoodBackground(); +BOOLEAN DeleteBobbyRWoodBackground(); +BOOLEAN InitBobbyRWoodBackground(); +void DailyUpdateOfBobbyRaysNewInventory(); +void DailyUpdateOfBobbyRaysUsedInventory(); +void OrderBobbyRItem(UINT16 usItemIndex); +void AddFreshBobbyRayInventory( UINT16 usItemIndex ); +void InitBobbyRayInventory(); +BOOLEAN InitBobbyRayNewInventory(); +BOOLEAN InitBobbyRayUsedInventory(); +UINT8 HowManyBRItemsToOrder(UINT16 usItemIndex, UINT8 ubCurrentlyOnHand, UINT8 ubBobbyRayNewUsed); +void CancelAllPendingBRPurchaseOrders(void); +INT16 GetInventorySlotForItem(STORE_INVENTORY *pInventoryArray, UINT16 usItemIndex, BOOLEAN fUsed); + + +#endif + + + + + + diff --git a/Laptop/BobbyRAmmo.cpp b/Laptop/BobbyRAmmo.cpp new file mode 100644 index 00000000..683f4e92 --- /dev/null +++ b/Laptop/BobbyRAmmo.cpp @@ -0,0 +1,99 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "BobbyRAmmo.h" + #include "BobbyRGuns.h" + #include "BobbyR.h" + #include "Utilities.h" + #include "WCheck.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "interface items.h" + #include "Encrypted File.h" + #include "text.h" +#endif + +UINT32 guiAmmoBackground; +UINT32 guiAmmoGrid; + +BOOLEAN DisplayAmmoInfo(); + + +void GameInitBobbyRAmmo() +{ +} + +BOOLEAN EnterBobbyRAmmo() +{ + VOBJECT_DESC VObjectDesc; + + // load the background graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\ammobackground.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiAmmoBackground)); + + // load the gunsgrid graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\ammogrid.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiAmmoGrid)); + + InitBobbyBrTitle(); + + + SetFirstLastPagesForNew( IC_AMMO ); +// CalculateFirstAndLastIndexs(); + + //Draw menu bar + InitBobbyMenuBar( ); + + RenderBobbyRAmmo( ); + + return(TRUE); +} + +void ExitBobbyRAmmo() +{ + DeleteVideoObjectFromIndex(guiAmmoBackground); + DeleteVideoObjectFromIndex(guiAmmoGrid); + DeleteBobbyMenuBar(); + + DeleteBobbyBrTitle(); + DeleteMouseRegionForBigImage(); + + giCurrentSubPage = gusCurWeaponIndex; + guiLastBobbyRayPage = LAPTOP_MODE_BOBBY_R_AMMO; +} + +void HandleBobbyRAmmo() +{ +} + +void RenderBobbyRAmmo() +{ + HVOBJECT hPixHandle; + + WebPageTileBackground(BOBBYR_NUM_HORIZONTAL_TILES, BOBBYR_NUM_VERTICAL_TILES, BOBBYR_BACKGROUND_WIDTH, BOBBYR_BACKGROUND_HEIGHT, guiAmmoBackground); + + //Display title at top of page + DisplayBobbyRBrTitle(); + + // GunForm + GetVideoObject(&hPixHandle, guiAmmoGrid); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_GRIDLOC_X, BOBBYR_GRIDLOC_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + DisplayItemInfo(IC_AMMO); + + UpdateButtonText(guiCurrentLaptopMode); + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + + + + + + diff --git a/Laptop/BobbyRAmmo.h b/Laptop/BobbyRAmmo.h new file mode 100644 index 00000000..f2d3aee0 --- /dev/null +++ b/Laptop/BobbyRAmmo.h @@ -0,0 +1,18 @@ +#ifndef __BOBBYRAMMO_H +#define __BOBBYRAMMO_H + +void GameInitBobbyRAmmo(); +BOOLEAN EnterBobbyRAmmo(); +void ExitBobbyRAmmo(); +void HandleBobbyRAmmo(); +void RenderBobbyRAmmo(); + + + +#endif + + + + + + diff --git a/Laptop/BobbyRArmour.cpp b/Laptop/BobbyRArmour.cpp new file mode 100644 index 00000000..233234bb --- /dev/null +++ b/Laptop/BobbyRArmour.cpp @@ -0,0 +1,99 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "BobbyRArmour.h" + #include "BobbyRGuns.h" + #include "BobbyR.h" + #include "Utilities.h" + #include "WCheck.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Text.h" +#endif + + +UINT32 guiArmourBackground; +UINT32 guiArmourGrid; + + + +void GameInitBobbyRArmour() +{ + +} + +BOOLEAN EnterBobbyRArmour() +{ + VOBJECT_DESC VObjectDesc; + + // load the background graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Armourbackground.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiArmourBackground)); + + // load the gunsgrid graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Armourgrid.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiArmourGrid)); + + InitBobbyBrTitle(); + //Draw menu bar + InitBobbyMenuBar( ); + + SetFirstLastPagesForNew( IC_ARMOUR ); +// CalculateFirstAndLastIndexs(); + + RenderBobbyRArmour( ); + + return(TRUE); +} + +void ExitBobbyRArmour() +{ + DeleteVideoObjectFromIndex(guiArmourBackground); + DeleteVideoObjectFromIndex(guiArmourGrid); + DeleteBobbyMenuBar(); + + DeleteBobbyBrTitle(); + DeleteMouseRegionForBigImage(); + + giCurrentSubPage = gusCurWeaponIndex; + guiLastBobbyRayPage = LAPTOP_MODE_BOBBY_R_ARMOR; +} + +void HandleBobbyRArmour() +{ +} + +void RenderBobbyRArmour() +{ + + HVOBJECT hPixHandle; + + WebPageTileBackground(BOBBYR_NUM_HORIZONTAL_TILES, BOBBYR_NUM_VERTICAL_TILES, BOBBYR_BACKGROUND_WIDTH, BOBBYR_BACKGROUND_HEIGHT, guiArmourBackground); + + //Display title at top of page + DisplayBobbyRBrTitle(); + + // GunForm + GetVideoObject(&hPixHandle, guiArmourGrid); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_GRIDLOC_X, BOBBYR_GRIDLOC_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + DisplayItemInfo(IC_ARMOUR); + + UpdateButtonText(guiCurrentLaptopMode); + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + + + + + + + + diff --git a/Laptop/BobbyRArmour.h b/Laptop/BobbyRArmour.h new file mode 100644 index 00000000..b21329d5 --- /dev/null +++ b/Laptop/BobbyRArmour.h @@ -0,0 +1,18 @@ +#ifndef __BOBBYRARMOUR_H +#define __BOBBYRARMOUR_H + +void GameInitBobbyRArmour(); +BOOLEAN EnterBobbyRArmour(); +void ExitBobbyRArmour(); +void HandleBobbyRArmour(); +void RenderBobbyRArmour(); + + + +#endif + + + + + + diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp new file mode 100644 index 00000000..141cce4c --- /dev/null +++ b/Laptop/BobbyRGuns.cpp @@ -0,0 +1,1793 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "BobbyRGuns.h" + #include "BobbyR.h" + #include "Utilities.h" + #include "WCheck.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "interface items.h" + #include "Encrypted File.h" + #include "text.h" + #include "Store Inventory.h" + #include "LaptopSave.h" + #include "Finances.h" + #include "AimMembers.h" + #include "Overhead.h" + #include "Text.h" + #include "Weapons.h" +#endif + + +#define BOBBYR_DEFAULT_MENU_COLOR 255 + + +#define BOBBYR_GRID_PIC_WIDTH 118 +#define BOBBYR_GRID_PIC_HEIGHT 69 + +#define BOBBYR_GRID_PIC_X BOBBYR_GRIDLOC_X + 3 +#define BOBBYR_GRID_PIC_Y BOBBYR_GRIDLOC_Y + 3 + +#define BOBBYR_GRID_OFFSET 72 + +#define BOBBYR_ORDER_TITLE_FONT FONT14ARIAL +#define BOBBYR_ORDER_TEXT_FONT FONT10ARIAL +#define BOBBYR_ORDER_TEXT_COLOR 75 + +#define BOBBYR_STATIC_TEXT_COLOR 75 +#define BOBBYR_ITEM_DESC_TEXT_FONT FONT10ARIAL +#define BOBBYR_ITEM_DESC_TEXT_COLOR FONT_MCOLOR_WHITE +#define BOBBYR_ITEM_NAME_TEXT_FONT FONT10ARIAL +#define BOBBYR_ITEM_NAME_TEXT_COLOR FONT_MCOLOR_WHITE + +#define NUM_BOBBYRPAGE_MENU 6 +#define NUM_CATALOGUE_BUTTONS 5 +#define BOBBYR_NUM_WEAPONS_ON_PAGE 4 + +#define BOBBYR_BRTITLE_X LAPTOP_SCREEN_UL_X + 4 +#define BOBBYR_BRTITLE_Y LAPTOP_SCREEN_WEB_UL_Y + 3 +#define BOBBYR_BRTITLE_WIDTH 46 +#define BOBBYR_BRTITLE_HEIGHT 42 + +#define BOBBYR_TO_ORDER_TITLE_X iScreenWidthOffset + 195 +#define BOBBYR_TO_ORDER_TITLE_Y iScreenHeightOffset + 42 + LAPTOP_SCREEN_WEB_DELTA_Y + +#define BOBBYR_TO_ORDER_TEXT_X BOBBYR_TO_ORDER_TITLE_X + 75 +#define BOBBYR_TO_ORDER_TEXT_Y iScreenHeightOffset + 33 + LAPTOP_SCREEN_WEB_DELTA_Y +#define BOBBYR_TO_ORDER_TEXT_WIDTH 330 + +#define BOBBYR_PREVIOUS_BUTTON_X LAPTOP_SCREEN_UL_X + 5 //BOBBYR_HOME_BUTTON_X + BOBBYR_CATALOGUE_BUTTON_WIDTH + 5 +#define BOBBYR_PREVIOUS_BUTTON_Y LAPTOP_SCREEN_WEB_UL_Y + 340 //BOBBYR_HOME_BUTTON_Y + +#define BOBBYR_NEXT_BUTTON_X LAPTOP_SCREEN_UL_X + 412 //BOBBYR_ORDER_FORM_X + BOBBYR_ORDER_FORM_WIDTH + 5 +#define BOBBYR_NEXT_BUTTON_Y BOBBYR_PREVIOUS_BUTTON_Y //BOBBYR_PREVIOUS_BUTTON_Y + +#define BOBBYR_CATALOGUE_BUTTON_START_X BOBBYR_PREVIOUS_BUTTON_X + 92 //LAPTOP_SCREEN_UL_X + 93 - BOBBYR_CATALOGUE_BUTTON_WIDTH/2 +#define BOBBYR_CATALOGUE_BUTTON_GAP ( 318 - NUM_CATALOGUE_BUTTONS * BOBBYR_CATALOGUE_BUTTON_WIDTH) / (NUM_CATALOGUE_BUTTONS + 1) + BOBBYR_CATALOGUE_BUTTON_WIDTH + 1//80 +#define BOBBYR_CATALOGUE_BUTTON_Y LAPTOP_SCREEN_WEB_UL_Y + 340 +#define BOBBYR_CATALOGUE_BUTTON_WIDTH 56//75 + +#define BOBBYR_HOME_BUTTON_X iScreenWidthOffset + 120 +#define BOBBYR_HOME_BUTTON_Y iScreenHeightOffset + 400 + LAPTOP_SCREEN_WEB_DELTA_Y + +#define BOBBYR_CATALOGUE_BUTTON_TEXT_Y BOBBYR_CATALOGUE_BUTTON_Y + 5 + +#define BOBBYR_PREVIOUS_PAGE 0 +#define BOBBYR_NEXT_PAGE 1 + +#define BOBBYR_ITEM_DESC_START_X BOBBYR_GRIDLOC_X + 172 + 5 +#define BOBBYR_ITEM_DESC_START_Y BOBBYR_GRIDLOC_Y + 6 +#define BOBBYR_ITEM_DESC_START_WIDTH 214 - 10 + 20 + +#define BOBBYR_ITEM_NAME_X BOBBYR_GRIDLOC_X + 6 +#define BOBBYR_ITEM_NAME_Y_OFFSET 54 + +#define BOBBYR_ORDER_NUM_WIDTH 15 +#define BOBBYR_ORDER_NUM_X BOBBYR_GRIDLOC_X + 120 - BOBBYR_ORDER_NUM_WIDTH //BOBBYR_ITEM_STOCK_TEXT_X +#define BOBBYR_ORDER_NUM_Y_OFFSET 1 + +#define BOBBYR_ITEM_WEIGHT_TEXT_X BOBBYR_GRIDLOC_X + 409 + 3 +#define BOBBYR_ITEM_WEIGHT_TEXT_Y 3 + +#define BOBBYR_ITEM_WEIGHT_NUM_X BOBBYR_GRIDLOC_X + 429 - 2 +#define BOBBYR_ITEM_WEIGHT_NUM_Y 3 +#define BOBBYR_ITEM_WEIGHT_NUM_WIDTH 60 + +#define BOBBYR_ITEM_SPEC_GAP 2 + +#define BOBBYR_ITEM_COST_TEXT_X BOBBYR_GRIDLOC_X + 125 +#define BOBBYR_ITEM_COST_TEXT_Y BOBBYR_GRIDLOC_Y + 6 +#define BOBBYR_ITEM_COST_TEXT_WIDTH 42 + +#define BOBBYR_ITEM_COST_NUM_X BOBBYR_ITEM_COST_TEXT_X +#define BOBBYR_ITEM_COST_NUM_Y BOBBYR_ITEM_COST_TEXT_Y + 10 + +#define BOBBYR_ITEM_STOCK_TEXT_X BOBBYR_ITEM_COST_TEXT_X + +#define BOBBYR_ITEM_QTY_TEXT_X BOBBYR_GRIDLOC_X + 5//BOBBYR_ITEM_COST_TEXT_X +#define BOBBYR_ITEM_QTY_TEXT_Y BOBBYR_ITEM_COST_TEXT_Y + 28 +#define BOBBYR_ITEM_QTY_WIDTH 95 + +#define BOBBYR_ITEM_QTY_NUM_X BOBBYR_GRIDLOC_X + 105//BOBBYR_ITEM_COST_TEXT_X + 1 +#define BOBBYR_ITEM_QTY_NUM_Y BOBBYR_ITEM_QTY_TEXT_Y//BOBBYR_ITEM_COST_TEXT_Y + 40 + +#define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH//BOBBYR_ITEM_QTY_NUM_X + +#define BOBBY_RAY_NOT_PURCHASED 255 +#define BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE 200 + +#define BOBBYR_ORDER_FORM_X LAPTOP_SCREEN_UL_X + 200//204 +#define BOBBYR_ORDER_FORM_Y LAPTOP_SCREEN_WEB_UL_Y + 367 +#define BOBBYR_ORDER_FORM_WIDTH 95 + +#define BOBBYR_ORDER_SUBTOTAL_X iScreenWidthOffset + 490 +#define BOBBYR_ORDER_SUBTOTAL_Y BOBBYR_ORDER_FORM_Y+2//BOBBYR_HOME_BUTTON_Y + +#define BOBBYR_PERCENT_FUNTCIONAL_X BOBBYR_ORDER_SUBTOTAL_X +#define BOBBYR_PERCENT_FUNTCIONAL_Y BOBBYR_ORDER_SUBTOTAL_Y + 15 + + +BobbyRayPurchaseStruct BobbyRayPurchases[ MAX_PURCHASE_AMOUNT ]; + +//BobbyRayOrderStruct *BobbyRayOrdersOnDeliveryArray=NULL; +//UINT8 usNumberOfBobbyRayOrderItems = 0; +//UINT8 usNumberOfBobbyRayOrderUsed = 0; + + +extern BOOLEAN fExitingLaptopFlag; + +UINT32 guiGunBackground; +UINT32 guiGunsGrid; +UINT32 guiBrTitle; +UINT16 gusCurWeaponIndex; +UINT8 gubCurPage; +UINT8 ubCatalogueButtonValues[] = { + LAPTOP_MODE_BOBBY_R_GUNS, + LAPTOP_MODE_BOBBY_R_AMMO, + LAPTOP_MODE_BOBBY_R_ARMOR, + LAPTOP_MODE_BOBBY_R_MISC, + LAPTOP_MODE_BOBBY_R_USED}; + +UINT16 gusLastItemIndex=0; +UINT16 gusFirstItemIndex=0; +UINT8 gubNumItemsOnScreen; +UINT8 gubNumPages; + +BOOLEAN gfBigImageMouseRegionCreated; +UINT16 gusItemNumberForItemsOnScreen[ BOBBYR_NUM_WEAPONS_ON_PAGE ]; + + +BOOLEAN gfOnUsedPage; + +UINT16 gusOldItemNumOnTopOfPage=65535; + +//The menu bar at the bottom that changes to different pages +void BtnBobbyRPageMenuCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiBobbyRPageMenu[ NUM_CATALOGUE_BUTTONS ]; +INT32 guiBobbyRPageMenuImage; + +//The next and previous buttons +void BtnBobbyRNextPreviousPageCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiBobbyRPreviousPage; +INT32 guiBobbyRPreviousPageImage; + +UINT32 guiBobbyRNextPage; +INT32 guiBobbyRNextPageImage; + + +// Big Image Mouse region +MOUSE_REGION gSelectedBigImageRegion[ BOBBYR_NUM_WEAPONS_ON_PAGE ]; +void SelectBigImageRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +// The order form button +void BtnBobbyROrderFormCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiBobbyROrderForm; +INT32 guiBobbyROrderFormImage; + +// The Home button +void BtnBobbyRHomeButtonCallback(GUI_BUTTON *btn,INT32 reason); +extern UINT32 guiBobbyRHome; // symbol already defined in BobbyRMailOrder.cpp (jonathanl) +extern INT32 guiBobbyRHomeImage; // symbol already defined in BobbyRMailOrder.cpp (jonathanl) + + +// Link from the title +MOUSE_REGION gSelectedTitleImageLinkRegion; +void SelectTitleImageLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + + +UINT32 guiTempCurrentMode; + +BOOLEAN DisplayNonGunWeaponInfo(UINT16 usItemIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex); +BOOLEAN DisplayArmourInfo(UINT16 usItemIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex); +BOOLEAN DisplayMiscInfo(UINT16 usItemIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex); +BOOLEAN DisplayGunInfo(UINT16 usItemIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex); +BOOLEAN DisplayAmmoInfo(UINT16 usItemIndex, UINT16 usPosY, BOOLEAN fUsed, UINT16 usBobbyIndex); + +BOOLEAN DisplayBigItemImage(UINT16 ubIndex, UINT16 usPosY); +//void InitFirstAndLastGlobalIndex(UINT32 ubItemClassMask); +UINT16 DisplayCostAndQty(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight, UINT16 usBobbyIndex, BOOLEAN fUsed); +UINT16 DisplayRof(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); +UINT16 DisplayDamage(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); +UINT16 DisplayRange(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); +UINT16 DisplayMagazine(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); +void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, BOOLEAN fUsed); +UINT16 DisplayWeight(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); +UINT16 DisplayCaliber(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight); +void CreateMouseRegionForBigImage(UINT16 usPosY, UINT8 ubCount, INT16 *pItemNumbers ); +void PurchaseBobbyRayItem(UINT16 usItemNumber); +UINT8 CheckIfItemIsPurchased(UINT16 usItemNumber); +UINT8 GetNextPurchaseNumber(); +void UnPurchaseBobbyRayItem(UINT16 usItemNumber); +UINT32 CalculateTotalPurchasePrice(); +void DisableBobbyRButtons(); +void CalcFirstIndexForPage( STORE_INVENTORY *pInv, UINT32 uiItemClass ); +void OutOfStockMessageBoxCallBack( UINT8 bExitValue ); +UINT8 CheckPlayersInventoryForGunMatchingGivenAmmoID( INT16 sItemID ); +void BobbyrRGunsHelpTextDoneCallBack( void ); +#ifdef JA2BETAVERSION + void ReportBobbyROrderError( UINT16 usItemNumber, UINT8 ubPurchaseNum, UINT8 ubQtyOnHand, UINT8 ubNumPurchasing ); +#endif + +//ppp + + + + + +void GameInitBobbyRGuns() +{ + guiTempCurrentMode=0; + + memset(&BobbyRayPurchases, 0, MAX_PURCHASE_AMOUNT); +} + +void EnterInitBobbyRGuns() +{ + guiTempCurrentMode=0; + + memset(&BobbyRayPurchases, 0, MAX_PURCHASE_AMOUNT); +} + + + +BOOLEAN EnterBobbyRGuns() +{ + VOBJECT_DESC VObjectDesc; + + gfBigImageMouseRegionCreated = FALSE; + + // load the background graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\gunbackground.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiGunBackground)); + + // load the gunsgrid graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\gunsgrid.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiGunsGrid)); + + InitBobbyBrTitle(); + + + SetFirstLastPagesForNew( IC_BOBBY_GUN ); +// CalculateFirstAndLastIndexs(); +/* + if(giCurrentSubPage == 0) + gusCurWeaponIndex = gusFirstGunIndex; + else + gusCurWeaponIndex = (UINT8)giCurrentSubPage; +*/ + //Draw menu bar + InitBobbyMenuBar( /*IC_GUN*/ ); // no parameteres (jonathanl) + + // render once + RenderBobbyRGuns( ); + +// RenderBobbyRGuns(); + return(TRUE); +} + +void ExitBobbyRGuns() +{ + DeleteVideoObjectFromIndex(guiGunBackground); + DeleteVideoObjectFromIndex(guiGunsGrid); + DeleteBobbyBrTitle(); + DeleteBobbyMenuBar(); + + DeleteMouseRegionForBigImage(); + + giCurrentSubPage = gusCurWeaponIndex; + guiLastBobbyRayPage = LAPTOP_MODE_BOBBY_R_GUNS; +} + +void HandleBobbyRGuns() +{ +} + +void RenderBobbyRGuns() +{ + HVOBJECT hPixHandle; + + WebPageTileBackground(BOBBYR_NUM_HORIZONTAL_TILES, BOBBYR_NUM_VERTICAL_TILES, BOBBYR_BACKGROUND_WIDTH, BOBBYR_BACKGROUND_HEIGHT, guiGunBackground); + + //Display title at top of page + DisplayBobbyRBrTitle(); + + // GunForm + GetVideoObject(&hPixHandle, guiGunsGrid); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_GRIDLOC_X, BOBBYR_GRIDLOC_Y, VO_BLT_SRCTRANSPARENCY,NULL); + +// DeleteMouseRegionForBigImage(); + DisplayItemInfo( IC_BOBBY_GUN ); + UpdateButtonText(guiCurrentLaptopMode); + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); +} + + + +BOOLEAN DisplayBobbyRBrTitle() +{ + HVOBJECT hPixHandle; + + // BR title + GetVideoObject(&hPixHandle, guiBrTitle); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_BRTITLE_X, BOBBYR_BRTITLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // To Order Text + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_TO_ORDER], BOBBYR_TO_ORDER_TITLE_X, BOBBYR_TO_ORDER_TITLE_Y, 0, BOBBYR_ORDER_TITLE_FONT, BOBBYR_ORDER_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + //First put a shadow behind the image + ShadowVideoSurfaceRect( FRAME_BUFFER, BOBBYR_TO_ORDER_TEXT_X-2, BOBBYR_TO_ORDER_TEXT_Y-2, BOBBYR_TO_ORDER_TEXT_X+BOBBYR_TO_ORDER_TEXT_WIDTH, BOBBYR_TO_ORDER_TEXT_Y+31); + + //To Order text + DisplayWrappedString(BOBBYR_TO_ORDER_TEXT_X, BOBBYR_TO_ORDER_TEXT_Y, BOBBYR_TO_ORDER_TEXT_WIDTH, 2, BOBBYR_ORDER_TEXT_FONT, BOBBYR_ORDER_TEXT_COLOR, BobbyRText[BOBBYR_GUNS_CLICK_ON_ITEMS], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + return(TRUE); +} + + +BOOLEAN InitBobbyBrTitle() +{ + VOBJECT_DESC VObjectDesc; + + // load the br title graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\br.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBrTitle)); + + //initialize the link to the homepage by clicking on the title + MSYS_DefineRegion( &gSelectedTitleImageLinkRegion, BOBBYR_BRTITLE_X, BOBBYR_BRTITLE_Y, (BOBBYR_BRTITLE_X + BOBBYR_BRTITLE_WIDTH), (UINT16)(BOBBYR_BRTITLE_Y + BOBBYR_BRTITLE_HEIGHT), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectTitleImageLinkRegionCallBack); + MSYS_AddRegion( &gSelectedTitleImageLinkRegion ); + + + gusOldItemNumOnTopOfPage=65535; + + return(TRUE); +} + +BOOLEAN DeleteBobbyBrTitle() +{ + DeleteVideoObjectFromIndex(guiBrTitle); + + MSYS_RemoveRegion( &gSelectedTitleImageLinkRegion); + + DeleteMouseRegionForBigImage(); + + return(TRUE); +} + + +void SelectTitleImageLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; + } +} + + + + + + + +BOOLEAN InitBobbyMenuBar( ) +{ + UINT8 i; + UINT16 usPosX; + UINT8 bCurMode; + + // Previous button + guiBobbyRPreviousPageImage = LoadButtonImage("LAPTOP\\PreviousButton.sti", -1,0,-1,1,-1 ); + guiBobbyRPreviousPage = CreateIconAndTextButton( guiBobbyRPreviousPageImage, BobbyRText[BOBBYR_GUNS_PREVIOUS_ITEMS], BOBBYR_GUNS_BUTTON_FONT, + BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, + BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, + TEXT_CJUSTIFIED, + BOBBYR_PREVIOUS_BUTTON_X, BOBBYR_PREVIOUS_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnBobbyRNextPreviousPageCallback); + SetButtonCursor(guiBobbyRPreviousPage, CURSOR_LAPTOP_SCREEN); + MSYS_SetBtnUserData( guiBobbyRPreviousPage, 0, BOBBYR_PREVIOUS_PAGE); + SpecifyDisabledButtonStyle( guiBobbyRPreviousPage, DISABLED_STYLE_SHADED ); + + + guiBobbyRPageMenuImage = LoadButtonImage("LAPTOP\\CatalogueButton1.sti", -1,0,-1,1,-1 ); + + // Next button + guiBobbyRNextPageImage = LoadButtonImage("LAPTOP\\NextButton.sti", -1,0,-1,1,-1 ); + guiBobbyRNextPage = CreateIconAndTextButton( guiBobbyRNextPageImage, BobbyRText[BOBBYR_GUNS_MORE_ITEMS], BOBBYR_GUNS_BUTTON_FONT, + BOBBYR_GUNS_TEXT_COLOR_ON, BOBBYR_GUNS_SHADOW_COLOR, + BOBBYR_GUNS_TEXT_COLOR_OFF, BOBBYR_GUNS_SHADOW_COLOR, + TEXT_CJUSTIFIED, + BOBBYR_NEXT_BUTTON_X, BOBBYR_NEXT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnBobbyRNextPreviousPageCallback); + SetButtonCursor(guiBobbyRNextPage, CURSOR_LAPTOP_SCREEN); + MSYS_SetBtnUserData( guiBobbyRNextPage, 0, BOBBYR_NEXT_PAGE); + SpecifyDisabledButtonStyle( guiBobbyRNextPage, DISABLED_STYLE_SHADED ); + + + bCurMode = 0; + usPosX = BOBBYR_CATALOGUE_BUTTON_START_X; + for(i=0; iuiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + + guiTempCurrentMode = bNewValue; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiTempCurrentMode = BOBBYR_DEFAULT_MENU_COLOR; + UpdateButtonText(guiCurrentLaptopMode); + guiCurrentLaptopMode = bNewValue; + + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + guiTempCurrentMode = BOBBYR_DEFAULT_MENU_COLOR; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + +void BtnBobbyRNextPreviousPageCallback(GUI_BUTTON *btn,INT32 reason) +{ + UINT32 bNewValue; + + bNewValue = MSYS_GetBtnUserData( btn, 0 ); + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + + + //if previous screen + if( bNewValue == BOBBYR_PREVIOUS_PAGE) + { + if( gubCurPage > 0 ) + gubCurPage--; + } + //else next screen + else + { + if( gubCurPage < gubNumPages-1 ) + gubCurPage++; + } + + + DeleteMouseRegionForBigImage(); + + fReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + + +BOOLEAN DisplayItemInfo(UINT32 uiItemClass) +{ + UINT16 i; + UINT8 ubCount=0; + UINT16 PosY, usTextPosY; + UINT16 ubFirstIndex=0; + UINT16 usItemIndex; + wchar_t sDollarTemp[60]; + wchar_t sTemp[60]; + INT16 pItemNumbers[ BOBBYR_NUM_WEAPONS_ON_PAGE ]; + + PosY = BOBBYR_GRID_PIC_Y; + usTextPosY = BOBBYR_ITEM_DESC_START_Y; + +// InitFirstAndLastGlobalIndex( uiItemClass ); + + //if there are no items then return + if( gusFirstItemIndex == BOBBYR_NO_ITEMS ) + { + if( fExitingLaptopFlag ) + return( TRUE ); + + DisableBobbyRButtons(); + + //Display a popup saying we are out of stock + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, BobbyRText[ BOBBYR_NO_MORE_STOCK ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, OutOfStockMessageBoxCallBack ); + return( TRUE ); + } + + + if( uiItemClass == BOBBYR_USED_ITEMS ) + CalcFirstIndexForPage( LaptopSaveInfo.BobbyRayUsedInventory, uiItemClass ); + else + CalcFirstIndexForPage( LaptopSaveInfo.BobbyRayInventory, uiItemClass ); + + DisableBobbyRButtons(); + + if( gusOldItemNumOnTopOfPage != gusCurWeaponIndex ) + { + DeleteMouseRegionForBigImage(); + + } + + + + for(i=gusCurWeaponIndex; ((i<=gusLastItemIndex) && (ubCount < 4)); i++) + { + if( uiItemClass == BOBBYR_USED_ITEMS ) + { + //If there is not items in stock + if( LaptopSaveInfo.BobbyRayUsedInventory[ i ].ubQtyOnHand == 0 ) + continue; + + usItemIndex = LaptopSaveInfo.BobbyRayUsedInventory[ i ].usItemIndex; + gfOnUsedPage = TRUE; + } + else + { + //If there is not items in stock + if( LaptopSaveInfo.BobbyRayInventory[ i ].ubQtyOnHand == 0 ) + continue; + + usItemIndex = LaptopSaveInfo.BobbyRayInventory[ i ].usItemIndex; + gfOnUsedPage = FALSE; + } + + // skip items that aren't of the right item class + if( ! ( Item[ usItemIndex ].usItemClass & uiItemClass ) ) + { + continue; + } + + + pItemNumbers[ ubCount ] = usItemIndex; + + switch( Item[ usItemIndex ].usItemClass ) + { + case IC_GUN: + case IC_LAUNCHER: + gusItemNumberForItemsOnScreen[ ubCount ] = i; + + DisplayBigItemImage( usItemIndex, PosY); + + //Display Items Name + DisplayItemNameAndInfo(usTextPosY, usItemIndex, i, gfOnUsedPage); + + DisplayGunInfo(usItemIndex, usTextPosY, gfOnUsedPage, i); + + PosY += BOBBYR_GRID_OFFSET; + usTextPosY += BOBBYR_GRID_OFFSET; + ubCount++; + break; + + case IC_AMMO: + gusItemNumberForItemsOnScreen[ ubCount ] = i; + + DisplayBigItemImage( usItemIndex, PosY); + + //Display Items Name + DisplayItemNameAndInfo(usTextPosY, usItemIndex, i, gfOnUsedPage); + + DisplayAmmoInfo( usItemIndex, usTextPosY, gfOnUsedPage, i); + + PosY += BOBBYR_GRID_OFFSET; + usTextPosY += BOBBYR_GRID_OFFSET; + ubCount++; + break; + + case IC_ARMOUR: + gusItemNumberForItemsOnScreen[ ubCount ] = i; + + DisplayBigItemImage( usItemIndex, PosY); + + //Display Items Name + DisplayItemNameAndInfo(usTextPosY, usItemIndex, i, gfOnUsedPage); + + DisplayArmourInfo( usItemIndex, usTextPosY, gfOnUsedPage, i); + + PosY += BOBBYR_GRID_OFFSET; + usTextPosY += BOBBYR_GRID_OFFSET; + ubCount++; + break; + + case IC_BLADE: + case IC_THROWING_KNIFE: + case IC_PUNCH: + gusItemNumberForItemsOnScreen[ ubCount ] = i; + + DisplayBigItemImage( usItemIndex, PosY); + + //Display Items Name + DisplayItemNameAndInfo(usTextPosY, usItemIndex, i, gfOnUsedPage); + + DisplayNonGunWeaponInfo(usItemIndex, usTextPosY, gfOnUsedPage, i); + + PosY += BOBBYR_GRID_OFFSET; + usTextPosY += BOBBYR_GRID_OFFSET; + ubCount++; + break; + + case IC_GRENADE: + case IC_BOMB: + case IC_MISC: + case IC_MEDKIT: + case IC_KIT: + case IC_FACE: + gusItemNumberForItemsOnScreen[ ubCount ] = i; + + DisplayBigItemImage( usItemIndex, PosY); + + //Display Items Name + DisplayItemNameAndInfo(usTextPosY, usItemIndex, i, gfOnUsedPage); + + DisplayMiscInfo( usItemIndex, usTextPosY, gfOnUsedPage, i); + + PosY += BOBBYR_GRID_OFFSET; + usTextPosY += BOBBYR_GRID_OFFSET; + ubCount++; + break; + } + } + + if( gusOldItemNumOnTopOfPage != gusCurWeaponIndex ) + { + CreateMouseRegionForBigImage(BOBBYR_GRID_PIC_Y, ubCount, pItemNumbers ); + + gusOldItemNumOnTopOfPage = gusCurWeaponIndex; + } + + //Display the subtotal at the bottom of the screen + swprintf( sDollarTemp, L"%d", CalculateTotalPurchasePrice() ); + InsertCommasForDollarFigure( sDollarTemp ); + InsertDollarSignInToString( sDollarTemp ); + swprintf( sTemp, L"%s %s", BobbyRText[BOBBYR_GUNS_SUB_TOTAL], sDollarTemp ); + DrawTextToScreen(sTemp, BOBBYR_ORDER_SUBTOTAL_X, BOBBYR_ORDER_SUBTOTAL_Y, 0, BOBBYR_ORDER_TITLE_FONT, BOBBYR_ORDER_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED | TEXT_SHADOWED); + + //Display the Used item disclaimer + if( gfOnUsedPage ) + { + DrawTextToScreen( BobbyRText[BOBBYR_GUNS_PERCENT_FUNCTIONAL], BOBBYR_PERCENT_FUNTCIONAL_X, BOBBYR_PERCENT_FUNTCIONAL_Y, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ORDER_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED | TEXT_SHADOWED); + } + + return(TRUE); +} + + +BOOLEAN DisplayGunInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex) +{ + UINT16 usHeight; + UINT32 uiStartLoc=0; + UINT16 usFontHeight; + usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); + + //Display Items Name + //DisplayItemNameAndInfo(usTextPosY, usIndex, fUsed); + + usHeight = usTextPosY; + //Display the weight, caliber, mag, rng, dam, rof text + + //Weight + usHeight = DisplayWeight(usHeight, usIndex, usFontHeight); + + //Caliber + usHeight = DisplayCaliber(usHeight, usIndex, usFontHeight); + + //Magazine + usHeight = DisplayMagazine(usHeight, usIndex, usFontHeight); + + //Range + usHeight = DisplayRange(usHeight, usIndex, usFontHeight); + + //Damage + usHeight = DisplayDamage(usHeight, usIndex, usFontHeight); + + //ROF + usHeight = DisplayRof(usHeight, usIndex, usFontHeight); + + //Display the Cost and the qty bought and on hand + usHeight = DisplayCostAndQty(usTextPosY, usIndex, usFontHeight, usBobbyIndex, fUsed); + + return(TRUE); +} //DisplayGunInfo + +BOOLEAN DisplayNonGunWeaponInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex) +{ + UINT16 usHeight; + UINT32 uiStartLoc=0; + UINT16 usFontHeight; + usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); + + //Display Items Name +// DisplayItemNameAndInfo(usTextPosY, usIndex, fUsed); + + usHeight = usTextPosY; + //Display the weight, caliber, mag, rng, dam, rof text + + //Weight + usHeight = DisplayWeight(usHeight, usIndex, usFontHeight); + + //Damage + usHeight = DisplayDamage(usHeight, usIndex, usFontHeight); + + //Display the Cost and the qty bought and on hand + usHeight = DisplayCostAndQty(usTextPosY, usIndex, usFontHeight, usBobbyIndex, fUsed); + + return(TRUE); +} //DisplayNonGunWeaponInfo + + + +BOOLEAN DisplayAmmoInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex) +{ + UINT16 usHeight; + UINT32 uiStartLoc=0; + UINT16 usFontHeight; + usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); + + //Display Items Name +// DisplayItemNameAndInfo(usTextPosY, usIndex, fUsed); + + usHeight = usTextPosY; + //Display the weight, caliber, mag, rng, dam, rof text + + //Caliber + usHeight = DisplayCaliber(usHeight, usIndex, usFontHeight); + + //Magazine +// usHeight = DisplayMagazine(usHeight, usIndex, usFontHeight); + + //Display the Cost and the qty bought and on hand + usHeight = DisplayCostAndQty(usTextPosY, usIndex, usFontHeight, usBobbyIndex, fUsed); + + return(TRUE); +} //DisplayAmmoInfo + + +BOOLEAN DisplayBigItemImage(UINT16 usIndex, UINT16 PosY) +{ + INT16 PosX, sCenX, sCenY; + UINT32 usHeight, usWidth; + ETRLEObject *pTrav; + INVTYPE *pItem; + UINT32 uiImage; + HVOBJECT hPixHandle; + + PosX = BOBBYR_GRID_PIC_X; + + pItem = &Item[ usIndex ]; + LoadTileGraphicForItem(pItem, &uiImage); + + GetVideoObject(&hPixHandle, uiImage); + pTrav = &(hPixHandle->pETRLEObject[0]); + + //center picture in frame + usHeight = (UINT32)pTrav->usHeight; + usWidth = (UINT32)pTrav->usWidth; +// sCenX = PosX + ( abs( BOBBYR_GRID_PIC_WIDTH - usWidth ) / 2 ); +// sCenY = PosY + 8; + sCenX = PosX + ( abs( BOBBYR_GRID_PIC_WIDTH - usWidth ) / 2 ) - pTrav->sOffsetX; + sCenY = PosY + 8; + + + //blt the shadow of the item + BltVideoObjectOutlineShadowFromIndex( FRAME_BUFFER, uiImage, 0, sCenX-2, sCenY+2);//pItem->ubGraphicNum + + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, sCenX, sCenY, VO_BLT_SRCTRANSPARENCY,NULL); + DeleteVideoObjectFromIndex(uiImage); + + return(TRUE); +} + + +BOOLEAN DisplayArmourInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex) +{ + UINT16 usHeight; + UINT32 uiStartLoc=0; + UINT16 usFontHeight; + usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); + + //Display Items Name +// DisplayItemNameAndInfo(usTextPosY, usIndex, fUsed); + + usHeight = usTextPosY; + //Display the weight, caliber, mag, rng, dam, rof text + + //Weight + usHeight = DisplayWeight(usHeight, usIndex, usFontHeight); + + //Display the Cost and the qty bought and on hand + usHeight = DisplayCostAndQty(usTextPosY, usIndex, usFontHeight, usBobbyIndex, fUsed); + + return(TRUE); +} //DisplayArmourInfo + + +BOOLEAN DisplayMiscInfo(UINT16 usIndex, UINT16 usTextPosY, BOOLEAN fUsed, UINT16 usBobbyIndex) +{ + UINT16 usHeight; + UINT32 uiStartLoc=0; + UINT16 usFontHeight; + usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); + + //Display Items Name +// DisplayItemNameAndInfo(usTextPosY, usIndex, fUsed); + + //Display the Cost and the qty bought and on hand + usHeight = DisplayCostAndQty(usTextPosY, usIndex, usFontHeight, usBobbyIndex, fUsed); + + return(TRUE); +} //DisplayMiscInfo + + + +UINT16 DisplayCostAndQty(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight, UINT16 usBobbyIndex, BOOLEAN fUsed) +{ + wchar_t sTemp[20]; +// UINT8 ubPurchaseNumber; + + // + //Display the cost and the qty + // + + //Display the cost + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_COST], BOBBYR_ITEM_COST_TEXT_X, (UINT16)usPosY, BOBBYR_ITEM_COST_TEXT_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usPosY += usFontHeight + 2; + + swprintf(sTemp, L"%d", CalcBobbyRayCost( usIndex, usBobbyIndex, fUsed )); + InsertCommasForDollarFigure( sTemp ); + InsertDollarSignInToString( sTemp ); + + DrawTextToScreen(sTemp, BOBBYR_ITEM_COST_NUM_X, (UINT16)usPosY, BOBBYR_ITEM_COST_TEXT_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + usPosY += usFontHeight + 2; + + + +/* + //Display the # bought + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_QTY_ON_ORDER], BOBBYR_ITEM_QTY_TEXT_X, (UINT16)usPosY, BOBBYR_ITEM_COST_TEXT_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usPosY += usFontHeight + 2; + + ubPurchaseNumber = CheckIfItemIsPurchased(usBobbyIndex); + if( ubPurchaseNumber == BOBBY_RAY_NOT_PURCHASED) + swprintf(sTemp, L"% 4d", 0); + else + swprintf(sTemp, L"% 4d", BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased); + + DrawTextToScreen(sTemp, BOBBYR_ITEMS_BOUGHT_X, (UINT16)usPosY, BOBBYR_ITEM_COST_TEXT_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); +*/ + + //Display Weight Number + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_WGHT], BOBBYR_ITEM_STOCK_TEXT_X, (UINT16)(usPosY), BOBBYR_ITEM_COST_TEXT_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usPosY += usFontHeight + 2; + + + swprintf( sTemp, L"%3.2f", GetWeightBasedOnMetricOption( Item[ usIndex ].ubWeight ) / (FLOAT)( 10.0 ) ); + DrawTextToScreen(sTemp, BOBBYR_ITEM_STOCK_TEXT_X, (UINT16)(usPosY), BOBBYR_ITEM_COST_TEXT_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + usPosY += usFontHeight + 2; + + + //Display the # In Stock + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_IN_STOCK], BOBBYR_ITEM_STOCK_TEXT_X, (UINT16)usPosY, BOBBYR_ITEM_COST_TEXT_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usPosY += usFontHeight + 2; + + if( fUsed ) + swprintf(sTemp, L"% 4d", LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubQtyOnHand); + else + swprintf(sTemp, L"% 4d", LaptopSaveInfo.BobbyRayInventory[ usBobbyIndex ].ubQtyOnHand); + + DrawTextToScreen(sTemp, BOBBYR_ITEM_STOCK_TEXT_X, (UINT16)usPosY, BOBBYR_ITEM_COST_TEXT_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + usPosY += usFontHeight + 2; + + + return(usPosY); +} + +UINT16 DisplayRof(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) +{ + wchar_t sTemp[20]; + + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_ROF], BOBBYR_ITEM_WEIGHT_TEXT_X, (UINT16)usPosY, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + if( WeaponROF[ usIndex ] == -1 ) + swprintf(sTemp, L"? %s", pMessageStrings[ MSG_RPM ] ); + else + swprintf(sTemp, L"%3d/%s", WeaponROF[ usIndex ], pMessageStrings[ MSG_MINUTE_ABBREVIATION ]); + + + DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_NUM_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + usPosY += usFontHeight + 2; + return(usPosY); +} + +UINT16 DisplayDamage(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) +{ + wchar_t sTemp[20]; + + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_DAMAGE], BOBBYR_ITEM_WEIGHT_TEXT_X, (UINT16)usPosY, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + swprintf(sTemp, L"%4d", Weapon[ usIndex ].ubImpact); + DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_NUM_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + usPosY += usFontHeight + 2; + return(usPosY); +} + + +UINT16 DisplayRange(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) +{ + wchar_t sTemp[20]; + + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_RANGE], BOBBYR_ITEM_WEIGHT_TEXT_X, (UINT16)usPosY, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + swprintf(sTemp, L"%3d %s", Weapon[ usIndex ].usRange, pMessageStrings[ MSG_METER_ABBREVIATION ] ); + DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_NUM_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + usPosY += usFontHeight + 2; + return(usPosY); +} + +UINT16 DisplayMagazine(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) +{ + wchar_t sTemp[20]; + + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_MAGAZINE], BOBBYR_ITEM_WEIGHT_TEXT_X, (UINT16)usPosY, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + swprintf(sTemp, L"%3d %s", Weapon[usIndex].ubMagSize, pMessageStrings[ MSG_ROUNDS_ABBREVIATION ] ); + DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_NUM_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + usPosY += usFontHeight + 2; + return(usPosY); +} + + +UINT16 DisplayCaliber(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) +{ + CHAR16 zTemp[128]; + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_CALIBRE], BOBBYR_ITEM_WEIGHT_TEXT_X, (UINT16)usPosY, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + // if ammo is begin drawn + if( Item[ usIndex].usItemClass == IC_AMMO ) + { + swprintf( zTemp, L"%s", BobbyRayAmmoCaliber[ Magazine[ Item[ usIndex ].ubClassIndex ].ubCalibre] ); +// DrawTextToScreen( AmmoCaliber[ Magazine[ Item[ usIndex ].ubClassIndex ].ubCalibre], BOBBYR_ITEM_WEIGHT_NUM_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + } + else + { + //else a gun is being displayed + swprintf( zTemp, L"%s", BobbyRayAmmoCaliber[ Weapon[ Item[ usIndex ].ubClassIndex ].ubCalibre ] ); +// DrawTextToScreen( AmmoCaliber[ Weapon[ Item[ usIndex ].ubClassIndex ].ubCalibre ], BOBBYR_ITEM_WEIGHT_NUM_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + } + + + if( StringPixLength( zTemp, BOBBYR_ITEM_DESC_TEXT_FONT ) > BOBBYR_ITEM_WEIGHT_NUM_WIDTH ) + ReduceStringLength( zTemp, BOBBYR_GRID_PIC_WIDTH, BOBBYR_ITEM_NAME_TEXT_FONT ); + + DrawTextToScreen( zTemp, BOBBYR_ITEM_WEIGHT_NUM_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + + + usPosY += usFontHeight + 2; + return(usPosY); +} + + +UINT16 DisplayWeight(UINT16 usPosY, UINT16 usIndex, UINT16 usFontHeight) +{ + wchar_t sTemp[20]; + + //display the 'weight' string + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_WEIGHT], BOBBYR_ITEM_WEIGHT_TEXT_X, (UINT16)usPosY, 0, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + swprintf(sTemp, L"%3.2f %s", GetWeightBasedOnMetricOption(Item[ usIndex ].ubWeight)/10, GetWeightUnitString() ); + DrawTextToScreen(sTemp, BOBBYR_ITEM_WEIGHT_NUM_X, (UINT16)usPosY, BOBBYR_ITEM_WEIGHT_NUM_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + usPosY += usFontHeight + 2; + return(usPosY); +} + + +void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, BOOLEAN fUsed) +{ + wchar_t sText[400]; + wchar_t sTemp[20]; + UINT32 uiStartLoc=0; + + UINT8 ubPurchaseNumber; + UINT16 usFontHeight = GetFontHeight(BOBBYR_ITEM_DESC_TEXT_FONT); + + //Display Items Name + //uiStartLoc = BOBBYR_ITEM_DESC_FILE_SIZE * usIndex; + //LoadEncryptedDataFromFile(BOBBYRDESCFILE, sText, uiStartLoc, BOBBYR_ITEM_DESC_NAME_SIZE); + + LoadBRName(usIndex,sText); + + if( StringPixLength( sText, BOBBYR_ITEM_NAME_TEXT_FONT ) > ( BOBBYR_GRID_PIC_WIDTH - 6 ) ) + ReduceStringLength( sText, BOBBYR_GRID_PIC_WIDTH - 6, BOBBYR_ITEM_NAME_TEXT_FONT ); + + DrawTextToScreen(sText, BOBBYR_ITEM_NAME_X, (UINT16)(usPosY+BOBBYR_ITEM_NAME_Y_OFFSET), 0, BOBBYR_ITEM_NAME_TEXT_FONT, BOBBYR_ITEM_NAME_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + //number bought + //Display the # bought + ubPurchaseNumber = CheckIfItemIsPurchased(usBobbyIndex); + if( ubPurchaseNumber != BOBBY_RAY_NOT_PURCHASED) + { + DrawTextToScreen(BobbyRText[BOBBYR_GUNS_QTY_ON_ORDER], BOBBYR_ITEM_QTY_TEXT_X, (UINT16)usPosY, BOBBYR_ITEM_QTY_WIDTH, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + + if( ubPurchaseNumber != BOBBY_RAY_NOT_PURCHASED) + { + swprintf(sTemp, L"% 4d", BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased); + DrawTextToScreen(sTemp, BOBBYR_ITEMS_BOUGHT_X, (UINT16)usPosY, 0, FONT14ARIAL, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + } + + + + + //if it's a used item, display how damaged the item is + if( fUsed ) + { + swprintf( sTemp, L"*%3d%%%%", LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality ); + DrawTextToScreen(sTemp, (UINT16)(BOBBYR_ITEM_NAME_X-2), (UINT16)(usPosY - BOBBYR_ORDER_NUM_Y_OFFSET), BOBBYR_ORDER_NUM_WIDTH, BOBBYR_ITEM_NAME_TEXT_FONT, BOBBYR_ITEM_NAME_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + + //Display Items description + //uiStartLoc = (BOBBYR_ITEM_DESC_FILE_SIZE * usIndex) + BOBBYR_ITEM_DESC_NAME_SIZE; + //LoadEncryptedDataFromFile(BOBBYRDESCFILE, sText, uiStartLoc, BOBBYR_ITEM_DESC_INFO_SIZE); + LoadBRDesc(usIndex,sText); + DisplayWrappedString(BOBBYR_ITEM_DESC_START_X, usPosY, BOBBYR_ITEM_DESC_START_WIDTH, 2, BOBBYR_ITEM_DESC_TEXT_FONT, BOBBYR_ITEM_DESC_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); +} + +/* +void InitFirstAndLastGlobalIndex(UINT32 uiItemClass) +{ + switch(uiItemClass) + { + case IC_BOBBY_GUN: + gusLastItemIndex = gusLastGunIndex ; + gusFirstItemIndex = gusFirstGunIndex; + gubNumPages = gubNumGunPages; + break; + case IC_BOBBY_MISC: + gusLastItemIndex = gusLastMiscIndex ; + gusFirstItemIndex = gusFirstMiscIndex; + gubNumPages = gubNumMiscPages; + break; + case IC_AMMO: + gusLastItemIndex = gusLastAmmoIndex ; + gusFirstItemIndex = gusFirstAmmoIndex; + gubNumPages = gubNumAmmoPages; + break; + case IC_ARMOUR: + gusLastItemIndex = gusLastArmourIndex; + gusFirstItemIndex = gusFirstArmourIndex; + gubNumPages = gubNumArmourPages; + break; + case BOBBYR_USED_ITEMS: + gusLastItemIndex = gusLastUsedIndex; + gusFirstItemIndex = gusFirstUsedIndex; + gubNumPages = gubNumUsedPages; + break; + default: + Assert(0); + break; + } +} + +void CalculateFirstAndLastIndexs() +{ + //Get the first and last gun index + SetFirstLastPagesForNew( IC_BOBBY_GUN, &gusFirstGunIndex, &gusLastGunIndex, &gubNumGunPages ); + + //Get the first and last misc index + SetFirstLastPagesForNew( IC_BOBBY_MISC, &gusFirstMiscIndex, &gusLastMiscIndex, &gubNumMiscPages ); + + //Get the first and last Ammo index + SetFirstLastPagesForNew( IC_AMMO, &gusFirstAmmoIndex, &gusLastAmmoIndex, &gubNumAmmoPages ); + + //Get the first and last Armour index + SetFirstLastPagesForNew( IC_ARMOUR, &gusFirstArmourIndex, &gusLastArmourIndex, &gubNumArmourPages ); + + //Get the first and last Used index + SetFirstLastPagesForUsed( &gusFirstUsedIndex, &gusLastUsedIndex, &gubNumUsedPages ); +} +*/ + + +//Loops through Bobby Rays Inventory to find the first and last index +void SetFirstLastPagesForNew( UINT32 uiClassMask ) +{ + UINT16 i; + INT16 sFirst = -1; + INT16 sLast = -1; + UINT8 ubPages=0; + UINT8 ubNumItems=0; + + gubCurPage = 0; + + //First loop through to get the first and last index indexs + for(i=0; i= ( BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased + 1) ) + { + // If the item has not yet been purchased + if( ubPurchaseNumber == BOBBY_RAY_NOT_PURCHASED ) + { + ubPurchaseNumber = GetNextPurchaseNumber(); + + if( ubPurchaseNumber != BOBBY_RAY_NOT_PURCHASED ) + { + BobbyRayPurchases[ ubPurchaseNumber ].usItemIndex = LaptopSaveInfo.BobbyRayUsedInventory[ usItemNumber ].usItemIndex; + BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased = 1; + BobbyRayPurchases[ ubPurchaseNumber ].bItemQuality = LaptopSaveInfo.BobbyRayUsedInventory[ usItemNumber ].ubItemQuality; + BobbyRayPurchases[ ubPurchaseNumber ].usBobbyItemIndex = usItemNumber; + BobbyRayPurchases[ ubPurchaseNumber ].fUsed = TRUE; + } + else + { + //display error popup because the player is trying to purchase more thenn 10 items + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, BobbyRText[ BOBBYR_MORE_THEN_10_PURCHASES ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + + } + } + // Else If the item is already purchased increment purchase amount. Only if ordering less then the max amount! + else + { + if( BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased <= BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE) + BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased++; + } + } + else + { + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, BobbyRText[ BOBBYR_MORE_NO_MORE_IN_STOCK ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + + #ifdef JA2BETAVERSION + ReportBobbyROrderError( usItemNumber, ubPurchaseNumber, LaptopSaveInfo.BobbyRayUsedInventory[ usItemNumber ].ubQtyOnHand, BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased ); + #endif + } + } + //else the player is on a any other page except the used page + else + { + //if there is enough inventory in stock to cover the purchase + if( ubPurchaseNumber == BOBBY_RAY_NOT_PURCHASED || LaptopSaveInfo.BobbyRayInventory[ usItemNumber ].ubQtyOnHand >= ( BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased + 1) ) + { + // If the item has not yet been purchased + if( ubPurchaseNumber == BOBBY_RAY_NOT_PURCHASED ) + { + ubPurchaseNumber = GetNextPurchaseNumber(); + + if( ubPurchaseNumber != BOBBY_RAY_NOT_PURCHASED ) + { + BobbyRayPurchases[ ubPurchaseNumber ].usItemIndex = LaptopSaveInfo.BobbyRayInventory[ usItemNumber ].usItemIndex; + BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased = 1; + BobbyRayPurchases[ ubPurchaseNumber ].bItemQuality = 100; + BobbyRayPurchases[ ubPurchaseNumber ].usBobbyItemIndex = usItemNumber; + BobbyRayPurchases[ ubPurchaseNumber ].fUsed = FALSE; + } + else + { + //display error popup because the player is trying to purchase more thenn 10 items + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, BobbyRText[ BOBBYR_MORE_THEN_10_PURCHASES ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } + } + // Else If the item is already purchased increment purchase amount. Only if ordering less then the max amount! + else + { + if( BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased <= BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE) + BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased++; + } + } + else + { + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, BobbyRText[ BOBBYR_MORE_NO_MORE_IN_STOCK ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + + #ifdef JA2BETAVERSION + ReportBobbyROrderError( usItemNumber, ubPurchaseNumber, LaptopSaveInfo.BobbyRayInventory[ usItemNumber ].ubQtyOnHand, BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased ); + #endif + } + } +} + + +// Checks to see if the clicked item is already bought or not. +UINT8 CheckIfItemIsPurchased(UINT16 usItemNumber) +{ + UINT8 i; + + for(i=0; i 1) + BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased--; + else + { + BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased = 0; + BobbyRayPurchases[ ubPurchaseNumber ].usBobbyItemIndex = 0; + } + } +} + + + + +void BtnBobbyROrderFormCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R_MAILORDER; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnBobbyRHomeButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + +void UpdateButtonText(UINT32 uiCurPage) +{ + switch( uiCurPage ) + { + case LAPTOP_MODE_BOBBY_R_GUNS: + DisableButton( guiBobbyRPageMenu[0] ); + break; + + case LAPTOP_MODE_BOBBY_R_AMMO: + DisableButton( guiBobbyRPageMenu[1] ); + break; + + case LAPTOP_MODE_BOBBY_R_ARMOR: + DisableButton( guiBobbyRPageMenu[2] ); + break; + + case LAPTOP_MODE_BOBBY_R_MISC: + DisableButton( guiBobbyRPageMenu[3] ); + break; + + case LAPTOP_MODE_BOBBY_R_USED: + DisableButton( guiBobbyRPageMenu[4] ); + break; + } +} + + +UINT16 CalcBobbyRayCost( UINT16 usIndex, UINT16 usBobbyIndex, BOOLEAN fUsed) +{ + DOUBLE value; + if( fUsed ) + value = Item[ LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].usItemIndex ].usPrice * + ( .5 + .5 * ( LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality ) / 100 ) + .5; + else + value = Item[ LaptopSaveInfo.BobbyRayInventory[ usBobbyIndex ].usItemIndex ].usPrice; + + return( (UINT16) value); +} + + +UINT32 CalculateTotalPurchasePrice() +{ + UINT16 i; + UINT32 uiTotal = 0; + + for(i=0; i= gubNumPages-1 ) + DisableButton( guiBobbyRNextPage ); + else + EnableButton( guiBobbyRNextPage ); + } + + + // if it is the first page, disable the prev page buitton + if( gubCurPage == 0 ) + DisableButton( guiBobbyRPreviousPage ); + else + EnableButton( guiBobbyRPreviousPage ); + +/* + //if it is the last page, disable the next page button + if( !(gusCurWeaponIndex < (gusLastItemIndex - BOBBYR_NUM_WEAPONS_ON_PAGE) ) ) + DisableButton( guiBobbyRNextPage ); + else + EnableButton( guiBobbyRNextPage ); + + + // if it is the first page, disable the prev page buitton + if( (gusCurWeaponIndex == gusFirstItemIndex ) ) + DisableButton( guiBobbyRPreviousPage ); + else + EnableButton( guiBobbyRPreviousPage ); +*/ +} + +void CalcFirstIndexForPage( STORE_INVENTORY *pInv, UINT32 uiItemClass ) +{ + UINT16 i; + UINT16 usNumItems=0; + + //Reset the Current weapon Index + gusCurWeaponIndex = 0; + + if( uiItemClass == BOBBYR_USED_ITEMS ) + { + //Get to the first index on the page + for(i=gusFirstItemIndex; i<=gusLastItemIndex; i++) + { + //If we have some of the inventory on hand + if( pInv[ i ].ubQtyOnHand != 0 ) + { + if( gubCurPage == 0 ) + { + gusCurWeaponIndex = i; + break; + } + + if( usNumItems <= ( gubCurPage * 4 ) ) + gusCurWeaponIndex = i; + + usNumItems++; + } + } + } + else + { + //Get to the first index on the page + for(i=gusFirstItemIndex; i<=gusLastItemIndex; i++) + { + if( Item[ pInv[ i ].usItemIndex ].usItemClass & uiItemClass ) + { + //If we have some of the inventory on hand + if( pInv[ i ].ubQtyOnHand != 0 ) + { + if( gubCurPage == 0 ) + { + gusCurWeaponIndex = i; + break; + } + + if( usNumItems <= ( gubCurPage * 4 ) ) + gusCurWeaponIndex = i; + + usNumItems++; + } + } + } + } +} + + +void OutOfStockMessageBoxCallBack( UINT8 bExitValue ) +{ + // yes, load the game + if( bExitValue == MSG_BOX_RETURN_OK ) + { +// guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; + } +} + + + +UINT8 CheckPlayersInventoryForGunMatchingGivenAmmoID( INT16 sItemID ) +{ + UINT8 ubItemCount=0; + UINT8 ubMercCount; + UINT8 ubPocketCount; + + UINT8 ubFirstID = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + UINT8 ubLastID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + + + //loop through all the mercs on the team + for( ubMercCount = ubFirstID; ubMercCount <= ubLastID; ubMercCount++ ) + { + if( Menptr[ ubMercCount ].bActive ) + { + //loop through all the pockets on the merc + for( ubPocketCount=0; ubPocketCountuiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + memset(&BobbyRayPurchases, 0, sizeof(BobbyRayPurchaseStruct) * MAX_PURCHASE_AMOUNT); + gubSelectedLight = 0; + gfReDrawBobbyOrder = TRUE; + gbSelectedCity = -1; + gubCityAtTopOfList = 0; + + //Get rid of the city drop dowm, if it is being displayed + gubDropDownAction = BR_DROP_DOWN_DESTROY; + + //disable the accept order button + DisableButton( guiBobbyRAcceptOrder ); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnBobbyRAcceptOrderCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + if( guiSubTotal && gfCanAcceptOrder ) + { + //if the player doesnt have enough money + if( LaptopSaveInfo.iCurrentBalance < giGrandTotal ) + { + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, BobbyROrderFormText[BOBBYR_CANT_AFFORD_PURCHASE], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } + else + { + wchar_t zTemp[ 128 ]; + + //if the city is Drassen, and the airport sector is player controlled + if( gbSelectedCity == BR_DRASSEN && !StrategicMap[ SECTOR_INFO_TO_STRATEGIC_INDEX( SEC_B13 ) ].fEnemyControlled ) + { + //Quick hack to bypass the confirmation box + ConfirmBobbyRPurchaseMessageBoxCallBack( MSG_BOX_RETURN_YES ); + } + else + { + //else pop up a confirmation box + swprintf( zTemp, BobbyROrderFormText[BOBBYR_CONFIRM_DEST], *BobbyROrderLocations[gbSelectedCity].psCityLoc ); + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, zTemp, LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmBobbyRPurchaseMessageBoxCallBack ); + } + +/* //if the shipment is going to Drassen, add the inventory + if( gbSelectedCity == BR_DRASSEN ) + { +// BobbyRayOrderStruct *pBobbyRayPurchase; +// UINT32 uiResetTimeSec; + UINT8 i, ubCount; + UINT8 cnt; + INT8 bDaysAhead; + + //if we need to add more array elements for the Order Array + if( LaptopSaveInfo.usNumberOfBobbyRayOrderItems <= LaptopSaveInfo.usNumberOfBobbyRayOrderUsed ) + { + LaptopSaveInfo.usNumberOfBobbyRayOrderItems++; + LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray = MemRealloc( LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray, sizeof( BobbyRayOrderStruct ) * LaptopSaveInfo.usNumberOfBobbyRayOrderItems ); + if( LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray == NULL ) + return; + + memset( &LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[ LaptopSaveInfo.usNumberOfBobbyRayOrderItems - 1 ], 0, sizeof( BobbyRayOrderStruct ) ); + } + + for( cnt =0; cnt< LaptopSaveInfo.usNumberOfBobbyRayOrderItems; cnt++ ) + { + //get an empty element in the array + if( !LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[ cnt ].fActive ) + break; + } + + //gets reset when the confirm order graphic disappears + gfCanAcceptOrder = FALSE; + +// pBobbyRayPurchase = MemAlloc( sizeof( BobbyRayOrderStruct ) ); +// memset(pBobbyRayPurchase, 0, sizeof( BobbyRayOrderStruct ) ); + + + ubCount = 0; + for(i=0; iArea.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void DisplayPurchasedItems( BOOLEAN fCalledFromOrderPage, UINT16 usGridX, UINT16 usGridY, BobbyRayPurchaseStruct *pBobbyRayPurchase, BOOLEAN fJustDisplayTitles, INT32 iOrderNum ) +{ + UINT16 i,j; + wchar_t sText[400]; + wchar_t sBack[400]; + wchar_t sTemp[20]; + UINT16 usPosY; + UINT32 uiStartLoc=0; + UINT32 uiTotal; + UINT16 usStringLength; + UINT16 usPixLength; + wchar_t OneChar[2]; + INT32 iGrandTotal; + INT32 iSubTotal; + + + + //Output the qty + DrawTextToScreen(BobbyROrderFormText[BOBBYR_QTY], (UINT16)(usGridX+BOBBYR_GRID_FIRST_COLUMN_X), (UINT16)(usGridY+BOBBYR_GRID_FIRST_COLUMN_Y-BOBBYR_GRID_TITLE_OFFSET), BOBBYR_GRID_FIRST_COLUMN_WIDTH, BOBBYR_ORDER_STATIC_TEXT_FONT, BOBBYR_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Create a string for the weight ( %s ) ( where %s is the weight string, either kg or lbs ) + swprintf( sTemp, BobbyROrderFormText[BOBBYR_WEIGHT], GetWeightUnitString( ) ); + + //Output the Weight + DisplayWrappedString((UINT16)(usGridX+BOBBYR_GRID_SECOND_COLUMN_X), (UINT16)(usGridY+BOBBYR_GRID_SECOND_COLUMN_Y-30), BOBBYR_GRID_SECOND_COLUMN_WIDTH, 2, BOBBYR_ORDER_STATIC_TEXT_FONT, BOBBYR_ORDER_STATIC_TEXT_COLOR, sTemp, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Output the name + DrawTextToScreen(BobbyROrderFormText[BOBBYR_NAME], (UINT16)(usGridX+BOBBYR_GRID_THIRD_COLUMN_X), (UINT16)(usGridY+BOBBYR_GRID_THIRD_COLUMN_Y-BOBBYR_GRID_TITLE_OFFSET), BOBBYR_GRID_THIRD_COLUMN_WIDTH, BOBBYR_ORDER_STATIC_TEXT_FONT, BOBBYR_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Output the unit price + DisplayWrappedString((UINT16)(usGridX+BOBBYR_GRID_FOURTH_COLUMN_X), (UINT16)(usGridY+BOBBYR_GRID_FOURTH_COLUMN_Y-30), BOBBYR_GRID_FOURTH_COLUMN_WIDTH, 2, BOBBYR_ORDER_STATIC_TEXT_FONT, BOBBYR_ORDER_STATIC_TEXT_COLOR, BobbyROrderFormText[BOBBYR_UNIT_PRICE], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Output the total + DrawTextToScreen(BobbyROrderFormText[BOBBYR_TOTAL], (UINT16)(usGridX+BOBBYR_GRID_FIFTH_COLUMN_X), (UINT16)(usGridY+BOBBYR_GRID_FIFTH_COLUMN_Y-BOBBYR_GRID_TITLE_OFFSET), BOBBYR_GRID_FIFTH_COLUMN_WIDTH, BOBBYR_ORDER_STATIC_TEXT_FONT, BOBBYR_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Output the sub total, shipping and handling, and the grand total + DrawTextToScreen(BobbyROrderFormText[BOBBYR_SUB_TOTAL], (UINT16)(usGridX+BOBBYR_SUBTOTAL_X), (UINT16)(usGridY+BOBBYR_SUBTOTAL_Y), BOBBYR_SUBTOTAL_WIDTH, BOBBYR_ORDER_STATIC_TEXT_FONT, BOBBYR_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + DrawTextToScreen(BobbyROrderFormText[BOBBYR_S_H], (UINT16)(usGridX+BOBBYR_SUBTOTAL_X), (UINT16)(usGridY+BOBBYR_SHIPPING_N_HANDLE_Y), BOBBYR_SUBTOTAL_WIDTH, BOBBYR_ORDER_STATIC_TEXT_FONT, BOBBYR_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + DrawTextToScreen(BobbyROrderFormText[BOBBYR_GRAND_TOTAL], (UINT16)(usGridX+BOBBYR_SUBTOTAL_X), (UINT16)(usGridY+BOBBYR_GRAND_TOTAL_Y), BOBBYR_SUBTOTAL_WIDTH, BOBBYR_ORDER_STATIC_TEXT_FONT, BOBBYR_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); + + + if( fJustDisplayTitles ) + { + return; + } + + if( fCalledFromOrderPage ) + { + guiSubTotal = 0; + giGrandTotal = 0; + } + else + { + iSubTotal = 0; + iGrandTotal = 0; + } + + + if( pBobbyRayPurchase == NULL ) + { + return; + } + + //loop through the array of purchases to display only the items that are purchased + usPosY = usGridY+BOBBYR_GRID_FIRST_COLUMN_Y + 4; + for(i=0; i BOBBYR_GRID_THIRD_COLUMN_WIDTH-4 ) + { + usStringLength = wcslen(sText); + usPixLength=0; + OneChar[1] = L'\0'; + for(j=0; (iuiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + guiCurrentLaptopMode = guiLastBobbyRayPage; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnBobbyRHomeCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void SelectShippingSpeedRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + gubSelectedLight = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); + DrawShippingSpeedLights( gubSelectedLight ); + DisplayShippingCosts( TRUE, 0, BOBBYR_ORDERGRID_X, BOBBYR_ORDERGRID_Y, -1 ); + } +} + +BOOLEAN DrawShippingSpeedLights(UINT8 ubSelected) +{ + + if(ubSelected == 0) + ColorFillVideoSurfaceArea( FRAME_BUFFER, gShippingSpeedAreas[0], gShippingSpeedAreas[1], gShippingSpeedAreas[0]+SHIPPING_SPEED_LIGHT_WIDTH, gShippingSpeedAreas[1]+SHIPPING_SPEED_LIGHT_HEIGHT, Get16BPPColor( FROMRGB( 0, 255, 0 ) ) ); + else + ColorFillVideoSurfaceArea( FRAME_BUFFER, gShippingSpeedAreas[0], gShippingSpeedAreas[1], gShippingSpeedAreas[0]+SHIPPING_SPEED_LIGHT_WIDTH, gShippingSpeedAreas[1]+SHIPPING_SPEED_LIGHT_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + + if(ubSelected == 1) + ColorFillVideoSurfaceArea( FRAME_BUFFER, gShippingSpeedAreas[2], gShippingSpeedAreas[3], gShippingSpeedAreas[2]+SHIPPING_SPEED_LIGHT_WIDTH, gShippingSpeedAreas[3]+SHIPPING_SPEED_LIGHT_HEIGHT, Get16BPPColor( FROMRGB( 0, 255, 0 ) ) ); + else + ColorFillVideoSurfaceArea( FRAME_BUFFER, gShippingSpeedAreas[2], gShippingSpeedAreas[3], gShippingSpeedAreas[2]+SHIPPING_SPEED_LIGHT_WIDTH, gShippingSpeedAreas[3]+SHIPPING_SPEED_LIGHT_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + + if(ubSelected == 2) + ColorFillVideoSurfaceArea( FRAME_BUFFER, gShippingSpeedAreas[4], gShippingSpeedAreas[5], gShippingSpeedAreas[4]+SHIPPING_SPEED_LIGHT_WIDTH, gShippingSpeedAreas[5]+SHIPPING_SPEED_LIGHT_HEIGHT, Get16BPPColor( FROMRGB( 0, 255, 0 ) ) ); + else + ColorFillVideoSurfaceArea( FRAME_BUFFER, gShippingSpeedAreas[4], gShippingSpeedAreas[5], gShippingSpeedAreas[4]+SHIPPING_SPEED_LIGHT_WIDTH, gShippingSpeedAreas[5]+SHIPPING_SPEED_LIGHT_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + + InvalidateRegion(iScreenWidthOffset + 585, iScreenHeightOffset + 218, iScreenWidthOffset + 594, iScreenHeightOffset + 287); + return(TRUE); +} + + +void SelectConfirmOrderRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + //Remove the items for Boby Rqys Inventory + RemovePurchasedItemsFromBobbyRayInventory(); + + //delete the order + memset(&BobbyRayPurchases, 0, sizeof(BobbyRayPurchaseStruct) * MAX_PURCHASE_AMOUNT); + gubSelectedLight = 0; + gfDestroyConfirmGrphiArea = TRUE; + gubSelectedLight = 0; + + //Goto The homepage + guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; + + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + //Remove the items for Boby Rqys Inventory + RemovePurchasedItemsFromBobbyRayInventory(); + + //delete the order + memset(&BobbyRayPurchases, 0, sizeof(BobbyRayPurchaseStruct) * MAX_PURCHASE_AMOUNT); + gubSelectedLight = 0; + gfDestroyConfirmGrphiArea = TRUE; + gubSelectedLight = 0; + + } +} + + +BOOLEAN CreateDestroyBobbyRDropDown( UINT8 ubDropDownAction ) +{ + static UINT16 usHeight; + static BOOLEAN fMouseRegionsCreated=FALSE; + + switch( ubDropDownAction ) + { + case BR_DROP_DOWN_NO_ACTION: + { + + } + break; + + case BR_DROP_DOWN_CREATE: + { + UINT8 i; + UINT16 usPosX, usPosY, usHeight; + UINT16 usTemp; + UINT16 usFontHeight = GetFontHeight( BOBBYR_DROPDOWN_FONT ); + + if( fMouseRegionsCreated ) + { + gubDropDownAction = BR_DROP_DOWN_DESTROY; + + break; + } + fMouseRegionsCreated = TRUE; + + usPosX = BOBBYR_CITY_START_LOCATION_X; + usPosY = BOBBYR_CITY_START_LOCATION_Y; + for( i=0; i< BOBBYR_NUM_DISPLAYED_CITIES; i++) + { + MSYS_DefineRegion( &gSelectedDropDownRegion[i], usPosX, (UINT16)(usPosY+4), (UINT16)(usPosX+BOBBYR_DROP_DOWN_WIDTH-6), (UINT16)(usPosY+usFontHeight+7), MSYS_PRIORITY_HIGH, + CURSOR_WWW, SelectDropDownMovementCallBack, SelectDropDownRegionCallBack); + MSYS_AddRegion(&gSelectedDropDownRegion[i]); + MSYS_SetRegionUserData( &gSelectedDropDownRegion[ i ], 0, i); + + usPosY += usFontHeight + 2; + } + usTemp = BOBBYR_CITY_START_LOCATION_Y; + usHeight = usPosY - usTemp + 10; + + + //create the scroll bars regions + //up arrow + usPosX = BOBBYR_SCROLL_UP_ARROW_X; + usPosY = BOBBYR_SCROLL_UP_ARROW_Y; + for(i=0; i<2; i++) + { + MSYS_DefineRegion( &gSelectedUpDownArrowOnScrollAreaRegion[i], usPosX, usPosY, (UINT16)(usPosX+BOBBYR_SCROLL_ARROW_WIDTH), (UINT16)(usPosY+BOBBYR_SCROLL_ARROW_HEIGHT), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectUpDownArrowOnScrollAreaRegionCallBack); + MSYS_AddRegion(&gSelectedUpDownArrowOnScrollAreaRegion[i]); + MSYS_SetRegionUserData( &gSelectedUpDownArrowOnScrollAreaRegion[ i ], 0, i); + usPosX = BOBBYR_SCROLL_DOWN_ARROW_X; + usPosY = BOBBYR_SCROLL_DOWN_ARROW_Y; + } + + //the scroll area itself + usPosX = BOBBYR_SCROLL_AREA_X; + usPosY = BOBBYR_SCROLL_UP_ARROW_Y + BOBBYR_SCROLL_ARROW_HEIGHT; + usHeight = BOBBYR_SCROLL_AREA_HEIGHT_MINUS_ARROWS / BOBBYR_ORDER_NUM_SHIPPING_CITIES; + for(i=0; iuiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } + else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + pRegion->uiFlags |= BUTTON_CLICKED_ON ; + + gbSelectedCity = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ) + gubCityAtTopOfList; + + gubDropDownAction = BR_DROP_DOWN_DISPLAY; + + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } +} + + + +void DrawSelectedCity( UINT8 ubCityNumber ) +{ + UINT16 usPosY; + UINT16 usFontHeight = GetFontHeight( BOBBYR_DROPDOWN_FONT ); + UINT8 i; + + //DEBUG: make sure it wont go over array bounds + if( gubCityAtTopOfList+BOBBYR_NUM_DISPLAYED_CITIES > BOBBYR_ORDER_NUM_SHIPPING_CITIES ) + gubCityAtTopOfList = BOBBYR_ORDER_NUM_SHIPPING_CITIES - BOBBYR_NUM_DISPLAYED_CITIES - 1; + + + //Display the list of cities + usPosY = BOBBYR_CITY_START_LOCATION_Y + 5; + for( i=gubCityAtTopOfList; i< gubCityAtTopOfList+BOBBYR_NUM_DISPLAYED_CITIES; i++) + { + DrawTextToScreen( *(BobbyROrderLocations[i].psCityLoc), BOBBYR_CITY_START_LOCATION_X+BOBBYR_CITY_NAME_OFFSET, usPosY, 0, BOBBYR_DROPDOWN_FONT, BOBBYR_ORDER_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + usPosY += usFontHeight + 2; + } + + if( ubCityNumber != 255 ) + usPosY = (usFontHeight + 2) * (ubCityNumber - gubCityAtTopOfList) + BOBBYR_CITY_START_LOCATION_Y; + else + usPosY = (usFontHeight + 2) * (gubCityAtTopOfList) + BOBBYR_CITY_START_LOCATION_Y; + + + //display the name in the list + ColorFillVideoSurfaceArea( FRAME_BUFFER, BOBBYR_CITY_START_LOCATION_X+4, usPosY+4, BOBBYR_CITY_START_LOCATION_X+BOBBYR_DROP_DOWN_WIDTH-4, usPosY+usFontHeight+6, Get16BPPColor( FROMRGB( 200, 169, 87 ) ) ); + + SetFontShadow(NO_SHADOW); + if( ubCityNumber == 255 ) + DrawTextToScreen( *(BobbyROrderLocations[ 0 ].psCityLoc), BOBBYR_CITY_START_LOCATION_X+BOBBYR_CITY_NAME_OFFSET, (UINT16)(usPosY+5), 0, BOBBYR_DROPDOWN_FONT, BOBBYR_FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + else + DrawTextToScreen( *(BobbyROrderLocations[ubCityNumber].psCityLoc), BOBBYR_CITY_START_LOCATION_X+BOBBYR_CITY_NAME_OFFSET, (UINT16)(usPosY+5), 0, BOBBYR_DROPDOWN_FONT, BOBBYR_FONT_BLACK, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + SetFontShadow(DEFAULT_SHADOW); + + DisplayShippingLocationCity(); + + if( guiBobbyRAcceptOrder != -1 ) + { + //if there is anything to buy, dont disable the accept button + if( IsAnythingPurchasedFromBobbyRayPage() && gbSelectedCity != -1 ) + EnableButton( guiBobbyRAcceptOrder ); + } +} + +void DisplayShippingLocationCity() +{ + wchar_t sTemp[40]; + UINT16 usPosY; + + //display the name on the title bar + ColorFillVideoSurfaceArea( FRAME_BUFFER, BOBBYR_SHIPPING_LOC_AREA_L_X, BOBBYR_SHIPPING_LOC_AREA_T_Y, BOBBYR_SHIPPING_LOC_AREA_L_X+175, BOBBYR_SHIPPING_LOC_AREA_T_Y+BOBBYR_DROP_DOWN_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + + //if there is no city selected + if( gbSelectedCity == -1 ) + DrawTextToScreen( BobbyROrderFormText[BOBBYR_SELECT_DEST], BOBBYR_CITY_START_LOCATION_X+BOBBYR_CITY_NAME_OFFSET, BOBBYR_SHIPPING_LOC_AREA_T_Y+3, 0, BOBBYR_DROPDOWN_FONT, BOBBYR_ORDER_DROP_DOWN_SELEC_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + else + DrawTextToScreen( *(BobbyROrderLocations[gbSelectedCity].psCityLoc), BOBBYR_CITY_START_LOCATION_X+BOBBYR_CITY_NAME_OFFSET, BOBBYR_SHIPPING_LOC_AREA_T_Y+3, 0, BOBBYR_DROPDOWN_FONT, BOBBYR_ORDER_DROP_DOWN_SELEC_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + + DisplayShippingCosts( TRUE, 0, BOBBYR_ORDERGRID_X, BOBBYR_ORDERGRID_Y, -1 ); + + if( gubDropDownAction == BR_DROP_DOWN_DISPLAY) + return; + + + //Display the shipping cost + usPosY = BOBBYR_OVERNIGHT_EXPRESS_Y; + + wcscpy(sTemp, L"$0"); + + if( gbSelectedCity != -1 ) + { + swprintf( sTemp, L"%d", ( INT32 )(BobbyROrderLocations[gbSelectedCity].usOverNightExpress/GetWeightBasedOnMetricOption( 1 ) ) ); + InsertCommasForDollarFigure( sTemp ); + InsertDollarSignInToString( sTemp ); + } + + DrawTextToScreen(sTemp, BOBBYR_SHIPPING_SPEED_NUMBER_X, usPosY, BOBBYR_SHIPPING_SPEED_NUMBER_WIDTH, BOBBYR_DROPDOWN_FONT, BOBBYR_ORDER_DYNAMIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + usPosY +=BOBBYR_GRID_ROW_OFFSET; + + if( gbSelectedCity != -1 ) + { + swprintf( sTemp, L"%d", ( INT32 )( BobbyROrderLocations[gbSelectedCity].us2DaysService / GetWeightBasedOnMetricOption( 1 ) ) ); + InsertCommasForDollarFigure( sTemp ); + InsertDollarSignInToString( sTemp ); + } + + DrawTextToScreen(sTemp, BOBBYR_SHIPPING_SPEED_NUMBER_X, usPosY, BOBBYR_SHIPPING_SPEED_NUMBER_WIDTH, BOBBYR_DROPDOWN_FONT, BOBBYR_ORDER_DYNAMIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + usPosY +=BOBBYR_GRID_ROW_OFFSET; + + if( gbSelectedCity != -1 ) + { + swprintf( sTemp, L"%d", (INT32 )( BobbyROrderLocations[gbSelectedCity].usStandardService / GetWeightBasedOnMetricOption( 1 ) ) ); + InsertCommasForDollarFigure( sTemp ); + InsertDollarSignInToString( sTemp ); + } + + DrawTextToScreen(sTemp, BOBBYR_SHIPPING_SPEED_NUMBER_X, usPosY, BOBBYR_SHIPPING_SPEED_NUMBER_WIDTH, BOBBYR_DROPDOWN_FONT, BOBBYR_ORDER_DYNAMIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); +} + +void SelectCloseDroDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + gubDropDownAction = BR_DROP_DOWN_DESTROY; + } +} + + +void RemovePurchasedItemsFromBobbyRayInventory() +{ + INT16 i; + + for(i=0; i 0 ) + LaptopSaveInfo.BobbyRayUsedInventory[ BobbyRayPurchases[ i ].usBobbyItemIndex ].ubQtyOnHand -= BobbyRayPurchases[ i ].ubNumberPurchased; + else + LaptopSaveInfo.BobbyRayUsedInventory[ BobbyRayPurchases[ i ].usBobbyItemIndex ].ubQtyOnHand = 0; + } + + //else the purchase is new + else + { + //removee it from Bobby Rays Inventory + if( (LaptopSaveInfo.BobbyRayInventory[ BobbyRayPurchases[ i ].usBobbyItemIndex ].ubQtyOnHand - BobbyRayPurchases[ i ].ubNumberPurchased) > 0 ) + LaptopSaveInfo.BobbyRayInventory[ BobbyRayPurchases[ i ].usBobbyItemIndex ].ubQtyOnHand -= BobbyRayPurchases[ i ].ubNumberPurchased; + else + LaptopSaveInfo.BobbyRayInventory[ BobbyRayPurchases[ i ].usBobbyItemIndex ].ubQtyOnHand = 0; + } + } + } + gfRemoveItemsFromStock = FALSE; +} + + +BOOLEAN IsAnythingPurchasedFromBobbyRayPage() +{ + UINT16 i; + BOOLEAN fReturnType = FALSE; + + for(i=0; i gbSelectedCity ) + { + gbSelectedCity++; + if( ( gbSelectedCity - gubCityAtTopOfList ) >= BOBBYR_NUM_DISPLAYED_CITIES ) + gubCityAtTopOfList++; + } + + gubDropDownAction = BR_DROP_DOWN_DISPLAY; + } + else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT) + { + UINT8 ubCityNum = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); + + pRegion->uiFlags |= BUTTON_CLICKED_ON ; + + if( ubCityNum < gbSelectedCity ) + { + gbSelectedCity--; + if( gbSelectedCity < gubCityAtTopOfList ) + gubCityAtTopOfList--; + } + + if( ubCityNum > gbSelectedCity ) + { + gbSelectedCity++; + if( ( gbSelectedCity - gubCityAtTopOfList ) >= BOBBYR_NUM_DISPLAYED_CITIES ) + gubCityAtTopOfList++; + } + + gubDropDownAction = BR_DROP_DOWN_DISPLAY; + + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } +} + + +void SelectScrollAreaDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + pRegion->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } + else if (reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + if( gfLeftButtonState ) + { + UINT8 ubCityNum = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); + + pRegion->uiFlags |= BUTTON_CLICKED_ON ; + + if( ubCityNum < gbSelectedCity ) + { + gbSelectedCity = ubCityNum; + if( gbSelectedCity < gubCityAtTopOfList ) + gubCityAtTopOfList = gbSelectedCity; + } + + if( ubCityNum > gbSelectedCity ) + { + gbSelectedCity = ubCityNum; + if( ( gbSelectedCity - gubCityAtTopOfList ) >= BOBBYR_NUM_DISPLAYED_CITIES ) + gubCityAtTopOfList = gbSelectedCity - BOBBYR_NUM_DISPLAYED_CITIES + 1; + } + + gubDropDownAction = BR_DROP_DOWN_DISPLAY; + + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } + } +} + + +void SelectUpDownArrowOnScrollAreaRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP || iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + UINT8 ubUpArrow = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); + + if( ubUpArrow ) + { + if( gbSelectedCity < BOBBYR_ORDER_NUM_SHIPPING_CITIES-1 ) + { + gbSelectedCity++; + } + + if( ( gbSelectedCity - gubCityAtTopOfList ) >= BOBBYR_NUM_DISPLAYED_CITIES ) + { + gubCityAtTopOfList++; + } + } + else + { + if( gbSelectedCity != -1 ) + { + if( gbSelectedCity > 0 ) + gbSelectedCity--; + + if( gbSelectedCity < gubCityAtTopOfList ) + gubCityAtTopOfList--; + } + } + + gubDropDownAction = BR_DROP_DOWN_DISPLAY; + } +} + + +void DrawGoldRectangle( INT8 bCityNum ) +{ + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + UINT16 usWidth, usTempHeight, usTempPosY, usHeight; + UINT16 usPosX, usPosY; + + UINT16 temp; + + if( bCityNum == -1 ) + bCityNum = 0; + + usTempPosY = BOBBYR_SCROLL_UP_ARROW_Y; + usTempPosY += BOBBYR_SCROLL_ARROW_HEIGHT; + usPosX = BOBBYR_SCROLL_AREA_X; + usWidth = BOBBYR_SCROLL_AREA_WIDTH - 5; + usTempHeight = ( BOBBYR_SCROLL_AREA_HEIGHT - 2 * BOBBYR_SCROLL_ARROW_HEIGHT ) - 8; + + usHeight = usTempHeight / (BOBBYR_ORDER_NUM_SHIPPING_CITIES+1); + + usPosY = usTempPosY + (UINT16)( ( ( BOBBYR_SCROLL_AREA_HEIGHT - 2 * BOBBYR_SCROLL_ARROW_HEIGHT ) / (FLOAT)(BOBBYR_ORDER_NUM_SHIPPING_CITIES +1) ) * bCityNum ); + + temp = BOBBYR_SCROLL_AREA_Y + BOBBYR_SCROLL_AREA_HEIGHT - BOBBYR_SCROLL_ARROW_HEIGHT - usHeight - 1; + + if( usPosY >= temp ) + usPosY = BOBBYR_SCROLL_AREA_Y + BOBBYR_SCROLL_AREA_HEIGHT - BOBBYR_SCROLL_ARROW_HEIGHT - usHeight - 5; + + ColorFillVideoSurfaceArea( FRAME_BUFFER, BOBBYR_SCROLL_AREA_X, usPosY, BOBBYR_SCROLL_AREA_X+usWidth, usPosY+usHeight, Get16BPPColor( FROMRGB( 186, 165, 68 ) ) ); + + //display the line + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + + // draw the gold highlite line on the top and left + LineDraw(FALSE, usPosX, usPosY, usPosX+usWidth, usPosY, Get16BPPColor( FROMRGB( 235, 222, 171 ) ), pDestBuf); + LineDraw(FALSE, usPosX, usPosY, usPosX, usPosY+usHeight, Get16BPPColor( FROMRGB( 235, 222, 171 ) ), pDestBuf); + + // draw the shadow line on the bottom and right + LineDraw(FALSE, usPosX, usPosY+usHeight, usPosX+usWidth, usPosY+usHeight, Get16BPPColor( FROMRGB( 65, 49, 6 ) ), pDestBuf); + LineDraw(FALSE, usPosX+usWidth, usPosY, usPosX+usWidth, usPosY+usHeight, Get16BPPColor( FROMRGB( 65, 49, 6 ) ), pDestBuf); + + // unlock frame buffer + UnLockVideoSurface( FRAME_BUFFER ); +} + + +UINT32 CalcCostFromWeightOfPackage( UINT8 ubTypeOfService ) +{ + UINT32 uiTotalWeight = 0; + UINT16 usStandardCost=0; + UINT32 uiTotalCost=0; + + if( gbSelectedCity == -1 ) + { + // shipping rates unknown until destination selected + return(0); + } + + //Get the package's weight + uiTotalWeight = CalcPackageTotalWeight(); + +/* for(i=0; iuiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + guiCurrentLaptopMode = LAPTOP_MODE_BOBBYR_SHIPMENTS; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +BOOLEAN CreateBobbyRayOrderTitle() +{ + VOBJECT_DESC VObjectDesc; + + // load BobbyRayTitle graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BobbyRayTitle.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBobbyRayTitle)); + + //the link to home page from the title + MSYS_DefineRegion( &gSelectedTitleLinkRegion, BOBBYR_BOBBY_RAY_TITLE_X, BOBBYR_BOBBY_RAY_TITLE_Y, (BOBBYR_BOBBY_RAY_TITLE_X + BOBBYR_BOBBY_RAY_TITLE_WIDTH), (UINT16)(BOBBYR_BOBBY_RAY_TITLE_Y + BOBBYR_BOBBY_RAY_TITLE_HEIGHT), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectTitleLinkRegionCallBack); + MSYS_AddRegion( &gSelectedTitleLinkRegion ); + + return( TRUE ); +} + +void DestroyBobbyROrderTitle() +{ + MSYS_RemoveRegion( &gSelectedTitleLinkRegion); + DeleteVideoObjectFromIndex(guiBobbyRayTitle); +} + +void DrawBobbyROrderTitle() +{ + HVOBJECT hPixHandle; + + // Bobbyray title + GetVideoObject(&hPixHandle, guiBobbyRayTitle); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_BOBBY_RAY_TITLE_X, BOBBYR_BOBBY_RAY_TITLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); +} + + +BOOLEAN AddNewBobbyRShipment( BobbyRayPurchaseStruct *pPurchaseStruct, UINT8 ubDeliveryLoc, UINT8 ubDeliveryMethod, BOOLEAN fPruchasedFromBobbyR, UINT32 uiPackageWeight ) +{ + INT32 iCnt; + INT32 iFoundSpot = -1; + UINT8 ubItemCount=0; + UINT8 i; + INT8 bDaysAhead=0; +// UINT32 uiPackageWeight; +// gpNewBobbyrShipments = NULL; +// giNumberOfNewBobbyRShipment = 0; + + //loop through and see if there is a free spot to insert the new order + for( iCnt=0; iCntfActive ) + { + iFoundSpot = iCnt; + break; + } + } + + if( iFoundSpot == -1 ) + { + //increment the number of spots used + giNumberOfNewBobbyRShipment++; + + //allocate some more memory + gpNewBobbyrShipments = (NewBobbyRayOrderStruct *) MemRealloc( gpNewBobbyrShipments, sizeof( NewBobbyRayOrderStruct ) * giNumberOfNewBobbyRShipment ); + + iFoundSpot = giNumberOfNewBobbyRShipment - 1; + } + + //memset the memory + memset( &gpNewBobbyrShipments[ iFoundSpot ], 0, sizeof( NewBobbyRayOrderStruct ) ); + + gpNewBobbyrShipments[ iFoundSpot ].fActive = TRUE; + gpNewBobbyrShipments[ iFoundSpot ].ubDeliveryLoc = ubDeliveryLoc; + gpNewBobbyrShipments[ iFoundSpot ].ubDeliveryMethod = ubDeliveryMethod; + + if( fPruchasedFromBobbyR ) + gpNewBobbyrShipments[ iFoundSpot ].fDisplayedInShipmentPage = TRUE; + else + gpNewBobbyrShipments[ iFoundSpot ].fDisplayedInShipmentPage = FALSE; + + //get the apckage weight, if the weight is "below" the minimum, use the minimum + if( uiPackageWeight < MIN_SHIPPING_WEIGHT ) + { + gpNewBobbyrShipments[ iFoundSpot ].uiPackageWeight = MIN_SHIPPING_WEIGHT; + } + else + { + gpNewBobbyrShipments[ iFoundSpot ].uiPackageWeight = uiPackageWeight; + } + + gpNewBobbyrShipments[ iFoundSpot ].uiOrderedOnDayNum = GetWorldDay(); + + //count the number of purchases + ubItemCount = 0; + for(i=0; iuiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R_MAILORDER; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnBobbyRShipmentHomeCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_BOBBY_R; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void DisplayShipmentGrid() +{ + HVOBJECT hPixHandle; + + GetVideoObject(&hPixHandle, guiBobbyRShipmentGrid); + + // Shipment Order Grid + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_SHIPMENT_DELIVERY_GRID_X, BOBBYR_SHIPMENT_DELIVERY_GRID_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // Order Grid + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, BOBBYR_SHIPMENT_ORDER_GRID_X, BOBBYR_SHIPMENT_ORDER_GRID_Y, VO_BLT_SRCTRANSPARENCY,NULL); +} + + + +void DisplayShipmentTitles() +{ + //output the order # + DrawTextToScreen( gzBobbyRShipmentText[BOBBYR_SHIPMENT__ORDERED_ON], BOBBYR_SHIPMENT_SHIPMENT_ORDER_NUM_X, BOBBYR_SHIPMENT_SHIPMENT_ORDER_NUM_Y, BOBBYR_SHIPMENT_ORDER_NUM_WIDTH, BOBBYR_SHIPMENT_STATIC_TEXT_FONT, BOBBYR_SHIPMENT_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Output the # of items + DrawTextToScreen( gzBobbyRShipmentText[BOBBYR_SHIPMENT__NUM_ITEMS], BOBBYR_SHIPMENT_NUM_ITEMS_X, BOBBYR_SHIPMENT_NUM_ITEMS_Y, BOBBYR_SHIPMENT_NUM_ITEMS_WIDTH, BOBBYR_SHIPMENT_STATIC_TEXT_FONT, BOBBYR_SHIPMENT_STATIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); +} + +void DisplayPreviousShipments() +{ + UINT32 uiCnt; + CHAR16 zText[512]; + UINT16 usPosY = BOBBYR_SHIPMENT_ORDER_NUM_START_Y; + UINT32 uiNumItems = CountNumberValidShipmentForTheShipmentsPage(); + UINT32 uiNumberItemsInShipments = 0; + UINT32 uiItemCnt; + UINT8 ubFontColor = BOBBYR_SHIPMENT_STATIC_TEXT_COLOR; + + //loop through all the shipments + for( uiCnt=0; uiCnt iSlotID ) + { + INT32 iCnt; + INT32 iValidShipmentCounter=0; + + giBobbyRShipmentSelectedShipment = -1; + + //loop through and get the "x" iSlotID shipment + for( iCnt=0; iCnt BOBBYR_SHIPMENT_NUM_PREVIOUS_SHIPMENTS ) + return( BOBBYR_SHIPMENT_NUM_PREVIOUS_SHIPMENTS ); + else + return( giNumberOfNewBobbyRShipment ); +} + + + + + + + diff --git a/Laptop/BobbyRShipments.h b/Laptop/BobbyRShipments.h new file mode 100644 index 00000000..f9c71f05 --- /dev/null +++ b/Laptop/BobbyRShipments.h @@ -0,0 +1,21 @@ +#ifndef _BOBBYR_SHIPMENTS__H_ +#define _BOBBYR_SHIPMENTS__H_ + + + +void GameInitBobbyRShipments(); +BOOLEAN EnterBobbyRShipments(); +void ExitBobbyRShipments(); +void HandleBobbyRShipments(); +void RenderBobbyRShipments(); + + +#endif + + + + + + + + diff --git a/Laptop/BobbyRUsed.cpp b/Laptop/BobbyRUsed.cpp new file mode 100644 index 00000000..9ba8b85f --- /dev/null +++ b/Laptop/BobbyRUsed.cpp @@ -0,0 +1,96 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "BobbyRUsed.h" + #include "BobbyR.h" + #include "BobbyRGuns.h" + #include "Utilities.h" + #include "WCheck.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Text.h" + #include "LaptopSave.h" +#endif + +UINT32 guiUsedBackground; +UINT32 guiUsedGrid; + + +void GameInitBobbyRUsed() +{ + +} + +BOOLEAN EnterBobbyRUsed() +{ + VOBJECT_DESC VObjectDesc; + + // load the background graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\usedbackground.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiUsedBackground)); + + // load the gunsgrid graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\usedgrid.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiUsedGrid)); + + InitBobbyBrTitle(); + + SetFirstLastPagesForUsed(); +// CalculateFirstAndLastIndexs(); + + //Draw menu bar + InitBobbyMenuBar( ); + + RenderBobbyRUsed( ); + + return(TRUE); +} + +void ExitBobbyRUsed() +{ + DeleteVideoObjectFromIndex(guiUsedBackground); + DeleteVideoObjectFromIndex(guiUsedGrid); + DeleteBobbyMenuBar(); + DeleteBobbyBrTitle(); + DeleteMouseRegionForBigImage(); + + giCurrentSubPage = gusCurWeaponIndex; + guiLastBobbyRayPage = LAPTOP_MODE_BOBBY_R_USED; +} + +void HandleBobbyRUsed() +{ +} + +void RenderBobbyRUsed() +{ + HVOBJECT hPixHandle; + + WebPageTileBackground(BOBBYR_NUM_HORIZONTAL_TILES, BOBBYR_NUM_VERTICAL_TILES, BOBBYR_BACKGROUND_WIDTH, BOBBYR_BACKGROUND_HEIGHT, guiUsedBackground); + + //Display title at top of page + DisplayBobbyRBrTitle(); + + // GunForm + GetVideoObject(&hPixHandle, guiUsedGrid); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, BOBBYR_GRIDLOC_X, BOBBYR_GRIDLOC_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + DisplayItemInfo(BOBBYR_USED_ITEMS); + + UpdateButtonText(guiCurrentLaptopMode); + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + + + + + + + diff --git a/Laptop/BobbyRUsed.h b/Laptop/BobbyRUsed.h new file mode 100644 index 00000000..dfb5bdbe --- /dev/null +++ b/Laptop/BobbyRUsed.h @@ -0,0 +1,18 @@ +#ifndef __BOBBYRUSED_H +#define __BOBBYRUSED_H + +void GameInitBobbyRUsed(); +BOOLEAN EnterBobbyRUsed(); +void ExitBobbyRUsed(); +void HandleBobbyRUsed(); +void RenderBobbyRUsed(); + + + +#endif + + + + + + diff --git a/Laptop/BrokenLink.cpp b/Laptop/BrokenLink.cpp new file mode 100644 index 00000000..7fab0f20 --- /dev/null +++ b/Laptop/BrokenLink.cpp @@ -0,0 +1,67 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" + #include "BrokenLink.h" +#else + +#endif + +#define BROKEN_LINK__FONT FONT12ARIAL +#define BROKEN_LINK__COLOR FONT_MCOLOR_BLACK + +#define BROKEN_LINK__MESSAGE_X LAPTOP_SCREEN_UL_X + 20 +#define BROKEN_LINK__MESSAGE_Y LAPTOP_SCREEN_UL_Y + 50 +#define BROKEN_LINK__MESSAGE_WIDTH (LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X) + +#define BROKEN_LINK__SITE_NOT_FOUND_Y LAPTOP_SCREEN_UL_Y + 65 + + +void DrawBrokenLinkWhiteBackground(); + + + +BOOLEAN EnterBrokenLink() +{ +// RenderBrokenLink(); + return(TRUE); +} + +void ExitBrokenLink() +{ +} + +void HandleBrokenLink() +{ +} + + + +void RenderBrokenLink() +{ + //Color fill the laptop white + DrawBrokenLinkWhiteBackground(); + + SetFontShadow( NO_SHADOW ); + + //Put up a message saying the link is dead + DisplayWrappedString(BROKEN_LINK__MESSAGE_X, BROKEN_LINK__MESSAGE_Y, BROKEN_LINK__MESSAGE_WIDTH, 2, BROKEN_LINK__FONT, BROKEN_LINK__COLOR, BrokenLinkText[ BROKEN_LINK_TXT_ERROR_404 ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + //Put up a message saying the link is dead + DisplayWrappedString(BROKEN_LINK__MESSAGE_X, BROKEN_LINK__SITE_NOT_FOUND_Y, BROKEN_LINK__MESSAGE_WIDTH, 2, BROKEN_LINK__FONT, BROKEN_LINK__COLOR, BrokenLinkText[ BROKEN_LINK_TXT_SITE_NOT_FOUND ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + SetFontShadow( DEFAULT_SHADOW ); + + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); +} + + +void DrawBrokenLinkWhiteBackground() +{ + ColorFillVideoSurfaceArea( FRAME_BUFFER, LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y, Get16BPPColor( FROMRGB( 255, 255, 255) ) ); +} + + + + + + + diff --git a/Laptop/BrokenLink.h b/Laptop/BrokenLink.h new file mode 100644 index 00000000..7fc352db --- /dev/null +++ b/Laptop/BrokenLink.h @@ -0,0 +1,20 @@ +#ifndef _BROKEN_LINK__H_ +#define _BROKEN_LINK__H_ + + + +extern void RenderBrokenLink(); +extern void HandleBrokenLink(); +extern void ExitBrokenLink(); +extern BOOLEAN EnterBrokenLink(); + + + +#endif + + + + + + + diff --git a/Laptop/CharProfile.cpp b/Laptop/CharProfile.cpp new file mode 100644 index 00000000..442a21e6 --- /dev/null +++ b/Laptop/CharProfile.cpp @@ -0,0 +1,729 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" + #include "IMP Skill Trait.h" +#else + #include "laptop.h" + #include "cursors.h" + #include "CharProfile.h" + #include "IMP AboutUs.h" + #include "IMP Attribute Entrance.h" + #include "IMP Attribute Finish.h" + #include "IMP MainPage.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "IMP Text System.h" + #include "IMP Finish.h" + #include "IMP Skill Trait.h" + #include "IMP Portraits.h" + #include "IMP Voices.h" + #include "IMP Personality Entrance.h" + #include "IMP Attribute Selection.h" + #include "IMP Personality Quiz.h" + #include "IMP Begin Screen.h" + #include "IMP Personality Finish.h" + #include "IMPVideoObjects.h" + #include "IMP Confirm.h" + #include "messageboxscreen.h" +#endif + + +//BOOLEAN fIMPCompletedFlag = FALSE; +BOOLEAN fReDrawCharProfile = FALSE; +BOOLEAN fButtonPendingFlag = FALSE; +BOOLEAN fAddCreatedCharToPlayersTeam = FALSE; +BOOLEAN fReEnterIMP = FALSE; + +INT32 iCurrentImpPage = IMP_HOME_PAGE; +INT32 iPreviousImpPage = -1; + + +// attributes +INT32 iStrength = 55; +INT32 iDexterity = 55; +INT32 iAgility = 55; +INT32 iWisdom = 55; +INT32 iLeadership =55; +INT32 iHealth = 55; + +// skills +INT32 iMarksmanship = 55; +INT32 iMedical = 55; +INT32 iExplosives = 55; +INT32 iMechanical = 55; + +// gender +BOOLEAN fCharacterIsMale = TRUE; + +// name and nick name +CHAR16 pFullName[ 32 ]; +CHAR16 pNickName[ 32 ]; + +// skills +INT32 iSkillA = 0; +INT32 iSkillB = 0; + +// personality +INT32 iPersonality = 0; + +// attitude +INT32 iAttitude = 0; + + +// additives, but no preservatives +INT32 iAddStrength = 0; +INT32 iAddDexterity = 0; +INT32 iAddAgility= 0; +INT32 iAddWisdom= 0; +INT32 iAddHealth = 0; +INT32 iAddLeadership = 0; + +INT32 iAddMarksmanship = 0; +INT32 iAddMedical = 0; +INT32 iAddExplosives = 0; +INT32 iAddMechanical = 0; + + +// IMP global buttons +INT32 giIMPButton[1]; +INT32 giIMPButtonImage[1]; + +// visted subpages +BOOLEAN fVisitedIMPSubPages[ IMP_NUM_PAGES ]; +extern INT32 iCurrentPortrait; +extern iCurrentVoices; +extern INT32 giMaxPersonalityQuizQuestion; +extern BOOLEAN fStartOverFlag; + +void ExitOldIMPMode( void ); +void EnterNewIMPMode( void ); +void LoadImpGraphics( void ); +void RemoveImpGraphics( void ); +void CreateIMPButtons( void ); +void DestroyIMPButtons( void ); +void BtnIMPCancelCallback(GUI_BUTTON *btn,INT32 reason); +BOOLEAN HasTheCurrentIMPPageBeenVisited( void ); +extern void SetAttributes( void ); + + +void GameInitCharProfile() +{ + LaptopSaveInfo.iVoiceId = 0; + iCurrentPortrait = 0; + iCurrentVoices = 0; + iPortraitNumber = 0; + + return; +} + +void EnterCharProfile() +{ + // reset previous page + iPreviousImpPage = -1; + + // grab the graphics + LoadImpGraphics( ); +} + +void ExitCharProfile() +{ + // get rid of graphics + RemoveImpGraphics( ); + + // clean up past mode + ExitOldIMPMode( ); +} + +void HandleCharProfile() +{ + if( fReDrawCharProfile ) + { + // re draw + RenderCharProfile( ); + fReDrawCharProfile = FALSE; + + } + + // button pending, but not changing mode, still need a rernder, but under different circumstances + if( ( fButtonPendingFlag == TRUE )&&( iCurrentImpPage == iPreviousImpPage ) ) + { + RenderCharProfile( ); + } + + // page has changed, handle the fact..get rid of old page, load up new, and re render + if( ( iCurrentImpPage != iPreviousImpPage ) ) + { + if( fDoneLoadPending == FALSE ) + { + //make sure we are not hosing memory + Assert( iCurrentImpPage <= IMP_NUM_PAGES ); + + + fFastLoadFlag = HasTheCurrentIMPPageBeenVisited( ); + fVisitedIMPSubPages[ iCurrentImpPage ] = TRUE; + fConnectingToSubPage = TRUE; + + if( iPreviousImpPage != -1 ) + { + fLoadPendingFlag = TRUE; + MarkButtonsDirty(); + return; + } + else + { + fDoneLoadPending = TRUE; + } + + + } + + fVisitedIMPSubPages[ iCurrentImpPage ] = TRUE; + + if( fButtonPendingFlag == TRUE ) + { + // render screen + RenderCharProfile( ); + return; + } + + // exity old mode + ExitOldIMPMode( ); + + // set previous page + iPreviousImpPage = iCurrentImpPage; + + // enter new + EnterNewIMPMode( ); + + + // render screen + RenderCharProfile( ); + + // render title bar + + + + } + + // handle + switch( iCurrentImpPage ) + { + case( IMP_HOME_PAGE ): + HandleImpHomePage( ); + break; + case( IMP_BEGIN ): + HandleIMPBeginScreen( ); + break; + case( IMP_PERSONALITY ): + HandleIMPPersonalityEntrance( ); + break; + case( IMP_PERSONALITY_QUIZ ): + HandleIMPSkillTrait( ); + break; + case( IMP_PERSONALITY_FINISH ): + HandleIMPPersonalityFinish( ); + break; + case( IMP_ATTRIBUTE_ENTRANCE ): + HandleIMPAttributeEntrance( ); + break; + case( IMP_ATTRIBUTE_PAGE ): + HandleIMPAttributeSelection( ); + break; + case( IMP_ATTRIBUTE_FINISH ): + HandleIMPAttributeFinish( ); + break; + case( IMP_PORTRAIT ): + HandleIMPPortraits( ); + break; + case( IMP_VOICE ): + HandleIMPVoices( ); + break; + case( IMP_FINISH ): + HandleIMPFinish( ); + break; + case( IMP_ABOUT_US ): + HandleIMPAboutUs( ); + break; + case( IMP_MAIN_PAGE ): + HandleIMPMainPage( ); + break; + case( IMP_CONFIRM ): + HandleIMPConfirm( ); + break; + } + + return; +} + +void RenderCharProfile() +{ + // button is waiting to go up?...do nothing, + + if( fButtonPendingFlag ) + { + fPausedReDrawScreenFlag = TRUE; + fButtonPendingFlag = FALSE; + return; + } + + switch( iCurrentImpPage ) + { + case( IMP_HOME_PAGE ): + RenderImpHomePage( ); + break; + case( IMP_BEGIN ): + RenderIMPBeginScreen( ); + break; + case( IMP_PERSONALITY ): + RenderIMPPersonalityEntrance( ); + break; + case( IMP_PERSONALITY_QUIZ ): + RenderIMPSkillTrait( ); + break; + case( IMP_PERSONALITY_FINISH ): + RenderIMPPersonalityFinish( ); + break; + case( IMP_ATTRIBUTE_ENTRANCE ): + RenderIMPAttributeEntrance( ); + break; + case( IMP_ATTRIBUTE_PAGE ): + RenderIMPAttributeSelection( ); + break; + case( IMP_ATTRIBUTE_FINISH ): + RenderIMPAttributeFinish( ); + break; + case( IMP_PORTRAIT ): + RenderIMPPortraits( ); + break; + case( IMP_VOICE ): + RenderIMPVoices( ); + break; + case( IMP_FINISH ): + RenderIMPFinish( ); + break; + case( IMP_ABOUT_US ): + RenderIMPAboutUs( ); + break; + case( IMP_MAIN_PAGE ): + RenderIMPMainPage( ); + break; + case( IMP_CONFIRM ): + RenderIMPConfirm( ); + break; + } + + // render title bar + //RenderWWWProgramTitleBar( ); + + // render the text + PrintImpText( ); + + RenderWWWProgramTitleBar( ); + + DisplayProgramBoundingBox( TRUE ); + + //InvalidateRegion( 0, 0, 640, 480 ); + return; + +} + + +void ExitOldIMPMode( void ) +{ + // exit old mode + + if( iPreviousImpPage == -1 ) + { + // don't both, leave + return; + + } + // remove old mode + switch( iPreviousImpPage ) + { + case( IMP_HOME_PAGE ): + ExitImpHomePage( ); + break; + case( IMP_BEGIN ): + DestroyIMPButtons( ); + ExitIMPBeginScreen( ); + break; + case( IMP_FINISH ): + DestroyIMPButtons( ); + ExitIMPFinish( ); + break; + case( IMP_PERSONALITY ): + DestroyIMPButtons( ); + ExitIMPPersonalityEntrance( ); + break; + case( IMP_PERSONALITY_QUIZ ): + DestroyIMPButtons( ); +// ExitIMPPersonalityQuiz( ); + ExitIMPSkillTrait( ); + break; + case( IMP_PERSONALITY_FINISH ): + DestroyIMPButtons( ); + ExitIMPPersonalityFinish( ); + break; + case( IMP_ATTRIBUTE_ENTRANCE ): + DestroyIMPButtons( ); + ExitIMPAttributeEntrance( ); + break; + case( IMP_ATTRIBUTE_PAGE ): + DestroyIMPButtons( ); + ExitIMPAttributeSelection( ); + break; + case( IMP_ATTRIBUTE_FINISH ): + DestroyIMPButtons( ); + ExitIMPAttributeFinish( ); + break; + case( IMP_PORTRAIT ): + DestroyIMPButtons( ); + ExitIMPPortraits( ); + break; + case( IMP_VOICE ): + DestroyIMPButtons( ); + ExitIMPVoices( ); + break; + case( IMP_ABOUT_US ): + ExitIMPAboutUs( ); + break; + case( IMP_MAIN_PAGE ): + ExitIMPMainPage( ); + break; + case( IMP_CONFIRM ): + ExitIMPConfirm( ); + break; + } + + return; +} + + + +void EnterNewIMPMode( void ) +{ + // enter new mode + + switch( iCurrentImpPage ) + { + case( IMP_HOME_PAGE ): + EnterImpHomePage( ); + break; + case( IMP_BEGIN ): + CreateIMPButtons( ); + EnterIMPBeginScreen( ); + break; + case( IMP_FINISH ): + CreateIMPButtons( ); + EnterIMPFinish( ); + break; + case( IMP_PERSONALITY ): + CreateIMPButtons( ); + EnterIMPPersonalityEntrance( ); + break; + case( IMP_PERSONALITY_QUIZ ): + CreateIMPButtons( ); +// EnterIMPPersonalityQuiz( ); + EnterIMPSkillTrait( ); + break; + case( IMP_PERSONALITY_FINISH ): + CreateIMPButtons( ); + EnterIMPPersonalityFinish( ); + break; + case( IMP_ATTRIBUTE_ENTRANCE ): + CreateIMPButtons( ); + EnterIMPAttributeEntrance( ); + break; + case( IMP_ATTRIBUTE_PAGE ): + CreateIMPButtons( ); + EnterIMPAttributeSelection( ); + break; + case( IMP_ATTRIBUTE_FINISH ): + CreateIMPButtons( ); + EnterIMPAttributeFinish( ); + break; + case( IMP_PORTRAIT ): + CreateIMPButtons( ); + EnterIMPPortraits( ); + break; + case( IMP_VOICE ): + CreateIMPButtons( ); + EnterIMPVoices( ); + break; + case( IMP_ABOUT_US ): + EnterIMPAboutUs( ); + break; + case( IMP_MAIN_PAGE ): + EnterIMPMainPage( ); + break; + case( IMP_CONFIRM ): + EnterIMPConfirm( ); + break; + } + + + + return; +} + + +void ResetCharacterStats( void ) +{ + // attributes + iStrength = 55; + iDexterity = 55; + iAgility = 55; + iWisdom = 55; + iLeadership =55; + iHealth = 55; + + // skills + iMarksmanship = 55; + iMedical = 55; + iExplosives = 55; + iMechanical = 55; + + // skills + iSkillA = 0; + iSkillB = 0; + + // personality + iPersonality = 0; + + // attitude + iAttitude = 0; + + // names + memset( &pFullName, 0 , sizeof( pFullName) ); + memset( &pNickName, 0 , sizeof( pNickName) ); + + +} + + + +void LoadImpGraphics( void ) +{ + // load all graphics needed for IMP + + LoadProfileBackGround( ); + LoadIMPSymbol( ); + LoadBeginIndent( ); + LoadActivationIndent( ); + LoadFrontPageIndent( ); + LoadAnalyse( ); + LoadAttributeGraph( ); + LoadAttributeGraphBar( ); + + LoadFullNameIndent( ); + LoadNameIndent( ); + LoadGenderIndent( ); + LoadNickNameIndent( ); + + //LoadSmallFrame( ); + + LoadSmallSilhouette( ); + LoadLargeSilhouette( ); + + LoadAttributeFrame( ); + LoadSliderBar( ); + + LoadButton2Image( ); + LoadButton4Image( ); + LoadButton1Image( ); + + LoadPortraitFrame( ); + LoadMainIndentFrame( ); + + LoadQtnLongIndentFrame( ); + LoadQtnShortIndentFrame( ); + LoadQtnLongIndentHighFrame( ); + LoadQtnShortIndentHighFrame( ); + LoadQtnShort2IndentFrame( ); + LoadQtnShort2IndentHighFrame( ); + + LoadQtnIndentFrame( ); + LoadAttrib1IndentFrame( ); + LoadAttrib2IndentFrame( ); + LoadAvgMercIndentFrame( ); + LoadAboutUsIndentFrame( ); + + + return; + +} + +void RemoveImpGraphics( void ) +{ + // remove all graphics needed for IMP + + RemoveProfileBackGround( ); + DeleteIMPSymbol( ); + DeleteBeginIndent( ); + DeleteActivationIndent( ); + DeleteFrontPageIndent( ); + DeleteAnalyse( ); + DeleteAttributeGraph( ); + DeleteAttributeBarGraph( ); + + DeleteFullNameIndent( ); + DeleteNameIndent( ); + DeleteGenderIndent( ); + DeleteNickNameIndent( ); + + //DeleteSmallFrame( ); + + DeleteSmallSilhouette( ); + DeleteLargeSilhouette( ); + + DeleteAttributeFrame( ); + DeleteSliderBar( ); + + DeleteButton2Image( ); + DeleteButton4Image( ); + DeleteButton1Image( ); + + DeletePortraitFrame( ); + DeleteMainIndentFrame( ); + + DeleteQtnLongIndentFrame( ); + DeleteQtnShortIndentFrame( ); + DeleteQtnLongIndentHighFrame( ); + DeleteQtnShortIndentHighFrame( ); + DeleteQtnShort2IndentFrame( ); + DeleteQtnShort2IndentHighFrame( ); + + DeleteQtnIndentFrame( ); + DeleteAttrib1IndentFrame( ); + DeleteAttrib2IndentFrame( ); + DeleteAvgMercIndentFrame( ); + DeleteAboutUsIndentFrame( ); + return; +} + +void CreateIMPButtons( void ) +{ + // create all the buttons global to the IMP system + + giIMPButtonImage[ 0 ] = LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); + + + // cancel + giIMPButton[0] = CreateIconAndTextButton( giIMPButtonImage[0], pImpButtonText[ 19 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 15, LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPCancelCallback); + + SpecifyButtonTextSubOffsets( giIMPButton[0], 0, -1, FALSE ); + + // set up generic www cursor + SetButtonCursor(giIMPButton[ 0 ], CURSOR_WWW); + + return; +} + +void DestroyIMPButtons( void ) +{ + // destroy the buttons we created + RemoveButton(giIMPButton[0] ); + UnloadButtonImage(giIMPButtonImage[0] ); + + return; +} + +void BtnIMPCancelCallback(GUI_BUTTON *btn,INT32 reason) +{ + // btn callback for IMP cancel button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // back to the main page, otherwise, back to home page + if( iCurrentImpPage == IMP_MAIN_PAGE ) + { + iCurrentImpPage = IMP_HOME_PAGE; + fButtonPendingFlag = TRUE; + iCurrentProfileMode = 0; + fFinishedCharGeneration = FALSE; + ResetCharacterStats( ); + } + else if( iCurrentImpPage == IMP_FINISH ) + { + iCurrentImpPage = IMP_MAIN_PAGE; + iCurrentProfileMode = 4; + fFinishedCharGeneration = FALSE; + fButtonPendingFlag = TRUE; + //iCurrentProfileMode = 0; + //fFinishedCharGeneration = FALSE; + //ResetCharacterStats( ); + + } + + else if( iCurrentImpPage == IMP_PERSONALITY_QUIZ || iCurrentImpPage == IMP_PERSONALITY_FINISH) + { + giMaxPersonalityQuizQuestion = 0; + fStartOverFlag = TRUE; + iCurrentAnswer = -1; + iCurrentImpPage = IMP_PERSONALITY; + fButtonPendingFlag = TRUE; + } + + else + { + if( iCurrentImpPage == IMP_ATTRIBUTE_PAGE ) + { + SetAttributes( ); + fFirstIMPAttribTime = TRUE; + } + iCurrentImpPage = IMP_MAIN_PAGE; + iCurrentAnswer = -1; + } + } + } + + + return; +} + + +void InitIMPSubPageList( void ) +{ + INT32 iCounter = 0; + + for(iCounter = 0; iCounter < IMP_CONFIRM; iCounter++ ) + { + fVisitedIMPSubPages[ iCounter ] = FALSE ; + } + + return; +} + +BOOLEAN HasTheCurrentIMPPageBeenVisited( void ) +{ + // returns if we have vsisted the current IMP PageAlready + + //make sure we are not hosing memory + Assert( iCurrentImpPage <= IMP_NUM_PAGES ); + + return ( fVisitedIMPSubPages[ iCurrentImpPage ]); +} + + + + + + + diff --git a/Laptop/CharProfile.h b/Laptop/CharProfile.h new file mode 100644 index 00000000..c1776167 --- /dev/null +++ b/Laptop/CharProfile.h @@ -0,0 +1,93 @@ +#ifndef __CHARPROFILE_H +#define __CHARPROFILE_H + +#include "types.h" +void GameInitCharProfile(); +void EnterCharProfile(); +void ExitCharProfile(); +void HandleCharProfile(); +void RenderCharProfile(); +void ResetCharacterStats( void ); +void InitIMPSubPageList( void ); + +extern BOOLEAN fButtonPendingFlag; +extern BOOLEAN fReDrawCharProfile; +extern INT32 iCurrentImpPage; + +// attributes +extern INT32 iStrength; +extern INT32 iDexterity; +extern INT32 iAgility; +extern INT32 iWisdom; +extern INT32 iLeadership; +extern INT32 iHealth; + +// skills +extern INT32 iMarksmanship; +extern INT32 iMedical; +extern INT32 iExplosives; +extern INT32 iMechanical; + +// sex? +extern BOOLEAN fCharacterIsMale; + +// name? +extern CHAR16 pFullName[]; +extern CHAR16 pNickName[]; + +// skills +extern INT32 iSkillA; +extern INT32 iSkillB; + +// persoanlity +extern INT32 iPersonality; + +// attitude +extern INT32 iAttitude; + +//addtivies +extern INT32 iAddStrength; +extern INT32 iAddDexterity; +extern INT32 iAddAgility; +extern INT32 iAddWisdom; +extern INT32 iAddHealth ; +extern INT32 iAddLeadership ; + +extern INT32 iAddMarksmanship ; +extern INT32 iAddMedical ; +extern INT32 iAddExplosives ; +extern INT32 iAddMechanical ; + +// pop up strings +extern STR16 pImpPopUpStrings[]; + +//extern BOOLEAN fIMPCompletedFlag; + +enum{ + IMP_HOME_PAGE, + IMP_BEGIN, + IMP_FINISH, + IMP_MAIN_PAGE, + IMP_PERSONALITY, + IMP_PERSONALITY_QUIZ, + IMP_PERSONALITY_FINISH, + IMP_ATTRIBUTE_ENTRANCE, + IMP_ATTRIBUTE_PAGE, + IMP_ATTRIBUTE_FINISH, + IMP_PORTRAIT, + IMP_VOICE, + IMP_ABOUT_US, + IMP_CONFIRM, + + IMP_NUM_PAGES, +}; + +#define COST_OF_PROFILE 3000 + +#endif + + + + + + diff --git a/Laptop/GunEmporium.cpp b/Laptop/GunEmporium.cpp new file mode 100644 index 00000000..4584eda2 --- /dev/null +++ b/Laptop/GunEmporium.cpp @@ -0,0 +1,33 @@ +#include "laptop.h" +#include "GunEmporium.h" + +void GameInitGunEmporium() +{ + +} + +void EnterGunEmporium() +{ + +} + +void ExitGunEmporium() +{ + +} + +void HandleGunEmporium() +{ + +} + +void RenderGunEmporium() +{ + +} + + + + + + diff --git a/Laptop/GunEmporium.h b/Laptop/GunEmporium.h new file mode 100644 index 00000000..d6619137 --- /dev/null +++ b/Laptop/GunEmporium.h @@ -0,0 +1,16 @@ +#ifndef __GUNEMPORIUM_H +#define __GUNEMPORIUM_H + +void GameInitGunEmporium(); +void EnterGunEmporium(); +void ExitGunEmporium(); +void HandleGunEmporium(); +void RenderGunEmporium(); + +#endif + + + + + + diff --git a/Laptop/IMP AboutUs.cpp b/Laptop/IMP AboutUs.cpp new file mode 100644 index 00000000..fcbd76e1 --- /dev/null +++ b/Laptop/IMP AboutUs.cpp @@ -0,0 +1,133 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "IMP AboutUs.h" + #include "CharProfile.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Text System.h" +#endif + +// IMP AboutUs buttons +INT32 giIMPAboutUsButton[1]; +INT32 giIMPAboutUsButtonImage[1]; +void CreateIMPAboutUsButtons( void ); +void DeleteIMPAboutUsButtons( void );; + +// fucntions +void BtnIMPBackCallback(GUI_BUTTON *btn,INT32 reason); + + +void EnterIMPAboutUs( void ) +{ + + // create buttons + CreateIMPAboutUsButtons( ); + + // entry into IMP about us page + RenderIMPAboutUs( ); + + return; +} + + +void ExitIMPAboutUs( void ) +{ + // exit from IMP About us page + + // delete Buttons + DeleteIMPAboutUsButtons( ); + + return; +} + + +void RenderIMPAboutUs( void ) +{ + // rneders the IMP about us page + + // the background + RenderProfileBackGround( ); + + // the IMP symbol + RenderIMPSymbol( 106, 1 ); + + // about us indent + RenderAboutUsIndentFrame( 8, 130 ); + // about us indent + RenderAboutUsIndentFrame( 258, 130 ); + + return; +} + + +void HandleIMPAboutUs( void ) +{ + // handles the IMP about us page + + return; +} + + +void CreateIMPAboutUsButtons( void ) +{ + + // this function will create the buttons needed for th IMP about us page + // the back button button + giIMPAboutUsButtonImage[0]= LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); + /*giIMPAboutUsButton[0] = QuickCreateButton( giIMPAboutUsButtonImage[0], LAPTOP_SCREEN_UL_X + 426 , LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPBackCallback); */ + + giIMPAboutUsButton[0] = CreateIconAndTextButton( giIMPAboutUsButtonImage[0], pImpButtonText[6], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 216, LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPBackCallback); + + SetButtonCursor(giIMPAboutUsButton[0], CURSOR_WWW); + + return; +} + + +void DeleteIMPAboutUsButtons( void ) +{ + // this function destroys the buttons needed for the IMP about Us Page + + // the about back button + RemoveButton(giIMPAboutUsButton[0] ); + UnloadButtonImage(giIMPAboutUsButtonImage[0] ); + + + return; +} + +void BtnIMPBackCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP Homepage About US button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_HOME_PAGE; + } + } +} \ No newline at end of file diff --git a/Laptop/IMP AboutUs.h b/Laptop/IMP AboutUs.h new file mode 100644 index 00000000..7aff8212 --- /dev/null +++ b/Laptop/IMP AboutUs.h @@ -0,0 +1,10 @@ +#ifndef _IMP_ABOUTUS_H +#define _IMP_ABOUTUS_H + + +void RenderIMPAboutUs( void ); +void ExitIMPAboutUs( void ); +void EnterIMPAboutUs( void ); +void HandleIMPAboutUs( void ); + +#endif \ No newline at end of file diff --git a/Laptop/IMP Attribute Entrance.cpp b/Laptop/IMP Attribute Entrance.cpp new file mode 100644 index 00000000..244940bd --- /dev/null +++ b/Laptop/IMP Attribute Entrance.cpp @@ -0,0 +1,127 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "CharProfile.h" + #include "IMP Attribute Entrance.h" + #include "IMP MainPage.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Text System.h" +#endif + +// the buttons +UINT32 giIMPAttributeEntranceButtonImage[ 1 ]; +UINT32 giIMPAttributeEntranceButton[ 1 ]; + +// function definitions +void DestroyIMPAttributeEntranceButtons( void ); +void CreateIMPAttributeEntranceButtons( void ); + + +// callbacks +void BtnIMPAttributeBeginCallback(GUI_BUTTON *btn,INT32 reason); + + + +void EnterIMPAttributeEntrance( void ) +{ + + CreateIMPAttributeEntranceButtons( ); + + return; +} + +void RenderIMPAttributeEntrance( void ) +{ + // the background + RenderProfileBackGround( ); + + // avg merc indent + RenderAvgMercIndentFrame(90, 40 ); + + return; +} + +void ExitIMPAttributeEntrance( void ) +{ + // destroy the finish buttons + DestroyIMPAttributeEntranceButtons( ); + + return; +} + + +void HandleIMPAttributeEntrance( void ) +{ + + + + return; +} + + +void CreateIMPAttributeEntranceButtons( void ) +{ + + // the begin button + giIMPAttributeEntranceButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + /* + giIMPAttributeEntranceButton[0] = QuickCreateButton( giIMPAttributeEntranceButtonImage[0], LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeBeginCallback ); */ + + giIMPAttributeEntranceButton[0] = CreateIconAndTextButton( giIMPAttributeEntranceButtonImage[ 0 ], pImpButtonText[ 13 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeBeginCallback); + + SetButtonCursor(giIMPAttributeEntranceButton[0], CURSOR_WWW); + return; +} + + +void DestroyIMPAttributeEntranceButtons( void ) +{ + // this function will destroy the buttons needed for the IMP attrib enter page + + // the begin button + RemoveButton(giIMPAttributeEntranceButton[ 0 ] ); + UnloadButtonImage(giIMPAttributeEntranceButtonImage[ 0 ] ); + + + + return; +} + + +void BtnIMPAttributeBeginCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP attrbite begin button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_ATTRIBUTE_PAGE; + fButtonPendingFlag = TRUE; + } + } +} \ No newline at end of file diff --git a/Laptop/IMP Attribute Entrance.h b/Laptop/IMP Attribute Entrance.h new file mode 100644 index 00000000..843340a8 --- /dev/null +++ b/Laptop/IMP Attribute Entrance.h @@ -0,0 +1,11 @@ +#ifndef _IMP_ATTRIBUTE_ENTRANCE_H +#define _IMP_ATTRIBUTE_ENTRANCE_H + +void EnterIMPAttributeEntrance( void ); +void RenderIMPAttributeEntrance( void ); +void ExitIMPAttributeEntrance( void ); +void HandleIMPAttributeEntrance( void ); + + + +#endif \ No newline at end of file diff --git a/Laptop/IMP Attribute Finish.cpp b/Laptop/IMP Attribute Finish.cpp new file mode 100644 index 00000000..ca64467e --- /dev/null +++ b/Laptop/IMP Attribute Finish.cpp @@ -0,0 +1,211 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "CharProfile.h" + #include "IMP Attribute Finish.h" + #include "IMP MainPage.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "input.h" + #include "Isometric Utils.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Text System.h" + #include "IMP Attribute Selection.h" +#endif + +// buttons +INT32 giIMPAttributeFinishButtonImage[ 2 ]; +INT32 giIMPAttributeFinishButton[ 2 ]; + +// function definitions +void CreateAttributeFinishButtons( void ); +void DestroyAttributeFinishButtons( void ); +extern void SetGeneratedCharacterAttributes( void ); + +BOOLEAN CameBackToAttributesPageButNotFinished(); + +// callbacks +void BtnIMPAttributeFinishYesCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPAttributeFinishNoCallback(GUI_BUTTON *btn,INT32 reason); + + +void EnterIMPAttributeFinish( void ) +{ + // create the needed buttons + CreateAttributeFinishButtons( ); + + // render screen + RenderIMPAttributeFinish( ); + + + return; +} + + +void RenderIMPAttributeFinish( void ) +{ + // render background + RenderProfileBackGround( ); + + // indent for text + RenderBeginIndent( 110, 93 ); + + return; +} + + +void ExitIMPAttributeFinish( void ) +{ + // destroy the buttons for this screen + DestroyAttributeFinishButtons( ); + + return; +} + +void HandleIMPAttributeFinish( void ) +{ + + return; +} + + + +void CreateAttributeFinishButtons( void ) +{ + + // this procedure will create the buttons needed for the attribute finish screen + + // the yes button + giIMPAttributeFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); +/* giIMPAttributeFinishButton[0] = QuickCreateButton( giIMPAttributeFinishButtonImage[0], LAPTOP_SCREEN_UL_X + ( 90 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishYesCallback ); + +*/ + giIMPAttributeFinishButton[0] = CreateIconAndTextButton( giIMPAttributeFinishButtonImage[0], pImpButtonText[ 20 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 130 ), LAPTOP_SCREEN_WEB_UL_Y + ( 180 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishYesCallback ); + + // the no button + giIMPAttributeFinishButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); +/* giIMPAttributeFinishButton[1] = QuickCreateButton( giIMPAttributeFinishButtonImage[1], LAPTOP_SCREEN_UL_X + ( 276 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishNoCallback ); +*/ + giIMPAttributeFinishButton[1] = CreateIconAndTextButton( giIMPAttributeFinishButtonImage[1], pImpButtonText[ 21 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 130 ), LAPTOP_SCREEN_WEB_UL_Y + ( 264 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishNoCallback); + + SetButtonCursor(giIMPAttributeFinishButton[0], CURSOR_WWW); + SetButtonCursor(giIMPAttributeFinishButton[1], CURSOR_WWW); + + + + return; + +} + + +void DestroyAttributeFinishButtons( void ) +{ + + // this procedure will destroy the buttons for the attribute finish screen + + // the yes button + RemoveButton(giIMPAttributeFinishButton[ 0 ] ); + UnloadButtonImage(giIMPAttributeFinishButtonImage[ 0 ] ); + + // the no button + RemoveButton(giIMPAttributeFinishButton[ 1 ] ); + UnloadButtonImage(giIMPAttributeFinishButtonImage[ 1 ] ); + + return; +} + + +void BtnIMPAttributeFinishYesCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // gone far enough + iCurrentImpPage = IMP_MAIN_PAGE; +// if( iCurrentProfileMode < IMP__PORTRAIT ) + if( !CameBackToAttributesPageButNotFinished() ) + { + iCurrentProfileMode = IMP__FINISH;//IMP__PORTRAIT; + } + // if we are already done, leave + if( iCurrentProfileMode == IMP__FINISH) + { + iCurrentImpPage = IMP_FINISH; + } + + // SET ATTRIBUTES NOW + SetGeneratedCharacterAttributes( ); + fButtonPendingFlag = TRUE; + } + } +} + +BOOLEAN CameBackToAttributesPageButNotFinished() +{ + //if we are in a page that comes after this one + if( iCurrentProfileMode == IMP__PERSONALITY || + iCurrentProfileMode == IMP__VOICE ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + +void BtnIMPAttributeFinishNoCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // if no, return to attribute + iCurrentImpPage = IMP_ATTRIBUTE_PAGE; + fReturnStatus = TRUE; + fButtonPendingFlag = TRUE; + } + } +} diff --git a/Laptop/IMP Attribute Finish.h b/Laptop/IMP Attribute Finish.h new file mode 100644 index 00000000..3b6af623 --- /dev/null +++ b/Laptop/IMP Attribute Finish.h @@ -0,0 +1,10 @@ +#ifndef __ATTRIBUTE_FINISH_H +#define __ATTRIBUTE_FINISH_H + + +void EnterIMPAttributeFinish( void ); +void RenderIMPAttributeFinish( void ); +void ExitIMPAttributeFinish( void ); +void HandleIMPAttributeFinish( void ); + +#endif \ No newline at end of file diff --git a/Laptop/IMP Attribute Selection.cpp b/Laptop/IMP Attribute Selection.cpp new file mode 100644 index 00000000..dcd2a978 --- /dev/null +++ b/Laptop/IMP Attribute Selection.cpp @@ -0,0 +1,1821 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" + #include "IMP Skill Trait.h" + #include "GameSettings.h" +#else + #include "CharProfile.h" + #include "IMP Attribute Selection.h" + #include "IMP MainPage.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "input.h" + #include "Isometric Utils.h" + #include "IMP Skill Trait.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Text System.h" + #include "IMP Compile Character.h" + #include "text.h" + #include "GameSettings.h" +#endif + +// width of the slider bar region +#define BAR_WIDTH 423 - 197 + +// width of the slider bar itself +#define SLIDER_BAR_WIDTH 38 + +// the sizeof one skill unit on the sliding bar in pixels +#define BASE_SKILL_PIXEL_UNIT_SIZE ( ( 423 - 230 ) ) + +//#define MAX_ATTIBUTEPOINT 90 +//#define START_ATTRIBEPOINT 55 +//#define MIN_ATTIBUTEPOINT 35 +//#define MAX_ZERO_BONUS 15 + + +enum{ + HEALTH_ATTRIBUTE, + DEXTERITY_ATTRIBUTE, + AGILITY_ATTRIBUTE, + STRENGTH_ATTRIBUTE, + WISDOM_ATTRIBUTE, + LEADERSHIP_ATTRIBUTE, + MARKSMANSHIP_SKILL, + EXPLOSIVE_SKILL, + MEDICAL_SKILL, + MECHANICAL_SKILL, +}; + + +enum +{ + SLIDER_ERROR, + SLIDER_OK, + SLIDER_OUT_OF_RANGE, +}; + +// Snap: these globals will be properly initialized in SetAttributes + +// the skills as they stand +INT32 iCurrentStrength = 0; +INT32 iCurrentAgility = 0; +INT32 iCurrentDexterity = 0; +INT32 iCurrentHealth = 0; +INT32 iCurrentLeaderShip = 0; +INT32 iCurrentWisdom = 0; +INT32 iCurrentMarkmanship = 0; +INT32 iCurrentMechanical = 0; +INT32 iCurrentMedical = 0; +INT32 iCurrentExplosives = 0; + +// which stat is message about stat at zero about +INT32 iCurrentStatAtZero = 0; + +// total number of bonus points +// Kaiden: Externalized this value for option-ation +INT32 iCurrentBonusPoints = 0; +//INT32 iCurrentBonusPoints = 40; + +// diplsay the 0 skill point warning..if skill set to 0, warn character +BOOLEAN fSkillAtZeroWarning = FALSE; + +// is the sliding of the sliding bar active right now? +BOOLEAN fSlideIsActive = TRUE; + +// first time in game +BOOLEAN fFirstIMPAttribTime = TRUE; + +// review mode +BOOLEAN fReviewStats = FALSE; + +// buttons +UINT32 giIMPAttributeSelectionButton[ 1 ]; +UINT32 giIMPAttributeSelectionButtonImage[ 1 ]; + +// slider buttons +UINT32 giIMPAttributeSelectionSliderButton[ 20 ]; +UINT32 giIMPAttributeSelectionSliderButtonImage[ 20 ]; + +// mouse regions +MOUSE_REGION pSliderRegions[ 10 ]; +MOUSE_REGION pSliderBarRegions[ 10 ]; + + +//The currently "anchored scroll bar" +MOUSE_REGION *gpCurrentScrollBox = NULL; +INT32 giCurrentlySelectedStat = -1; + +// has any of the sliding bars moved?...for re-rendering puposes +BOOLEAN fHasAnySlidingBarMoved = FALSE; + +INT32 uiBarToReRender = -1; + +// are we actually coming back to edit, or are we restarting? +BOOLEAN fReturnStatus = FALSE; + +// function definition +void ProcessAttributes( void ); +void DestroyIMPAttributeSelectionButtons( void ); +void CreateIMPAttributeSelectionButtons( void ); +UINT8 IncrementStat( INT32 iStatToIncrement ); +UINT8 DecrementStat( INT32 iStatToDecrement ); +BOOLEAN DoWeHaveThisManyBonusPoints( INT32 iBonusPoints ); +void CreateAttributeSliderButtons( void ); +void DestroyAttributeSliderButtons( void ); +void CreateSlideRegionMouseRegions( void ); +void DestroySlideRegionMouseRegions( void ); +INT32 GetCurrentAttributeValue( INT32 iAttribute ); +void CreateSliderBarMouseRegions( void ); +void DestroySlideBarMouseRegions( void ); +void SetAttributes( void ); +void DrawBonusPointsRemaining( void ); +void SetGeneratedCharacterAttributes( void ); +INT32 DetermineNewValue( INT32 iNewX ); +INT32 DetermineNewPosition( INT32 iAttribute ); + +// callbacks +void BtnIMPAttributeFinishCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPAttributeSliderLeftCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPAttributeSliderRightCallback(GUI_BUTTON *btn,INT32 reason); +void SliderRegionButtonCallback(MOUSE_REGION * pRegion, INT32 iReason ); +void SliderBarRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ); +void StatAtZeroBoxCallBack( UINT8 bExitValue ); + + +void EnterIMPAttributeSelection( void ) +{ + + + // set attributes and skills + if( ( fReturnStatus == FALSE ) && ( fFirstIMPAttribTime == TRUE ) ) + { + // re starting + SetAttributes( ); + + gpCurrentScrollBox = NULL; + giCurrentlySelectedStat = -1; + + // does character have PROBLEMS!!?!?! + /* + if( DoesCharacterHaveAnAttitude() ) + { + iCurrentBonusPoints+= 10; + } + if( DoesCharacterHaveAPersoanlity( ) ) + { + iCurrentBonusPoints += 10; + } + */ + } + fReturnStatus = TRUE; + fFirstIMPAttribTime = FALSE; + + // create done button + CreateIMPAttributeSelectionButtons( ); + // create clider buttons + CreateAttributeSliderButtons( ); + + // the mouse regions + CreateSlideRegionMouseRegions( ); + //CreateSliderBarMouseRegions( ); + + // render background + RenderIMPAttributeSelection( ); + + + + return; +} + +void RenderIMPAlteredAttribute( void ) +{ + +} +void RenderIMPAttributeSelection( void ) +{ + // the background + RenderProfileBackGround( ); + + + // attribute frame + RenderAttributeFrame( 51, 87 ); + + // render attribute boxes + RenderAttributeBoxes( ); + + RenderAttrib1IndentFrame(51, 30 ); + + if( fReviewStats != TRUE ) + { + RenderAttrib2IndentFrame(350, 42 ); + } + + // reset rerender flag + fHasAnySlidingBarMoved = FALSE; + + // print text for screen + PrintImpText( ); + + // amt of bonus pts + DrawBonusPointsRemaining( ); + + return; +} + +void ExitIMPAttributeSelection( void ) +{ + // get rid of slider buttons + DestroyAttributeSliderButtons( ); + + // the mouse regions + DestroySlideRegionMouseRegions( ); + //DestroySlideBarMouseRegions( ); + + // get rid of done buttons + DestroyIMPAttributeSelectionButtons( ); + + fReturnStatus = FALSE; + + return; +} + + +void HandleIMPAttributeSelection( void ) +{ + + // review mode, do not allow changes + if( fReviewStats ) + { + return; + } + + // set the currently selectd slider bar + if( gfLeftButtonState && gpCurrentScrollBox != NULL ) + { + //if theuser is holding down the mouse cursor to left of the start of the slider bars + if( gusMouseXPos < ( SKILL_SLIDE_START_X + LAPTOP_SCREEN_UL_X ) ) + { + DecrementStat( giCurrentlySelectedStat ); + } + + //else if the user is holding down the mouse button to the right of the scroll bars + else if( gusMouseXPos > ( LAPTOP_SCREEN_UL_X + SKILL_SLIDE_START_X + BAR_WIDTH ) ) + { + IncrementStat( giCurrentlySelectedStat ); + } + else + { + INT32 iCurrentAttributeValue; + INT32 sNewX = gusMouseXPos; + INT32 iNewValue; + INT32 iCounter; + + + // get old stat value + iCurrentAttributeValue = GetCurrentAttributeValue( giCurrentlySelectedStat ); + iNewValue = DetermineNewValue( sNewX ); + + // chenged, move mouse region if change large enough + if( iCurrentAttributeValue != iNewValue ) + { + // update screen + fHasAnySlidingBarMoved = TRUE; + } + + // change is enough + if ( iNewValue - iCurrentAttributeValue > 0) + { + // positive, increment stat + iCounter = iNewValue - iCurrentAttributeValue; + for( iCounter; iCounter > 0; iCounter--) + { + IncrementStat( giCurrentlySelectedStat ); + } + } + else + { + // negative, decrement stat + iCounter = iCurrentAttributeValue - iNewValue; + for( iCounter; iCounter > 0; iCounter--) + { + DecrementStat( giCurrentlySelectedStat ); + } + } + } + + RenderIMPAttributeSelection( ); + } + else + { + gpCurrentScrollBox = NULL; + giCurrentlySelectedStat = -1; + } + + + // prcoess current state of attributes + ProcessAttributes( ); + + // has any bar moved? + if( fHasAnySlidingBarMoved ) + { + // render + if( uiBarToReRender == -1 ) + { + RenderIMPAttributeSelection( ); + } + else + { + + RenderAttributeFrameForIndex( 51, 87, uiBarToReRender ); + /* + // print text for screen + PrintImpText( ); + + // amt of bonus pts + DrawBonusPointsRemaining( ); + + RenderAttributeFrame( 51, 87 ); + + // render attribute boxes + RenderAttributeBoxes( ); + + PrintImpText( ); + + InvalidateRegion( LAPTOP_SCREEN_UL_X + 51, LAPTOP_SCREEN_WEB_UL_Y + 87, LAPTOP_SCREEN_UL_X + 51 + 400, LAPTOP_SCREEN_WEB_UL_Y + 87 + 220 ); +*/ + uiBarToReRender = -1; + MarkButtonsDirty(); + } + + fHasAnySlidingBarMoved = FALSE; + + } + if ( fSkillAtZeroWarning == TRUE ) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pSkillAtZeroWarning[ 0 ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, StatAtZeroBoxCallBack); + fSkillAtZeroWarning = FALSE; + + } + return; +} + + + +void ProcessAttributes( void ) +{ + + //Kaiden: Ignore the values in the below comment, this is now controlled by + // Values externalized in the Ja2_Options.ini file. + + // this function goes through and confirms thet state of attributes, ie not allowing attributes to + // drop below 35 or skills to go below 0...and if skill is 34 set to 0 + + // check any attribute below 35 + + INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; + INT32 iMaxAttribute = gGameExternalOptions.iMaxAttribute; + + // strength + if( iCurrentStrength <= iMinAttribute ) + { + iCurrentStrength = iMinAttribute; + // disable button too + + + } + + // dex + if( iCurrentDexterity <= iMinAttribute ) + { + iCurrentDexterity = iMinAttribute; + // disable button too + + + } + + // agility + if( iCurrentAgility <= iMinAttribute ) + { + iCurrentAgility = iMinAttribute; + // disable button too + + + } + + // wisdom + if( iCurrentWisdom <= iMinAttribute ) + { + iCurrentWisdom = iMinAttribute; + // disable button too + + + } + + // Kaiden: Leadership should be zero-able + // LeaderShip + //if( iCurrentLeaderShip <= MIN_ATTIBUTEPOINT ) + //{ + //iCurrentLeaderShip = MIN_ATTIBUTEPOINT; + // disable button too + //} + + // health + if( iCurrentHealth <= iMinAttribute ) + { + iCurrentHealth = iMinAttribute; + // disable button too + + } + + + + + // now check for above MAX_ATTIBUTEPOINT + // strength + if( iCurrentStrength >= iMaxAttribute ) + { + iCurrentStrength = iMaxAttribute; + // disable button too + + + } + + // dex + if( iCurrentDexterity >= iMaxAttribute ) + { + iCurrentDexterity = iMaxAttribute; + // disable button too + + + } + + // agility + if( iCurrentAgility >= iMaxAttribute ) + { + iCurrentAgility = iMaxAttribute; + // disable button too + + + } + + // wisdom + if( iCurrentWisdom >= iMaxAttribute ) + { + iCurrentWisdom = iMaxAttribute; + // disable button too + + + } + + // LeaderShip + if( iCurrentLeaderShip >= iMaxAttribute ) + { + iCurrentLeaderShip = iMaxAttribute; + // disable button too + + + } + + // health + if( iCurrentHealth >= iMaxAttribute ) + { + iCurrentHealth = iMaxAttribute; + // disable button too + + } + + return; +} + +UINT8 IncrementStat( INT32 iStatToIncrement ) +{ + // this function is responsable for incrementing a stat + + + INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; + INT32 iMaxAttribute = gGameExternalOptions.iMaxAttribute; + INT32 iMaxZeroBonus = gGameExternalOptions.iMaxZeroBonus; + + // review mode, do not allow changes + if( fReviewStats ) + { + return( SLIDER_ERROR ); + } + + // make sure we have enough bonus points + if( iCurrentBonusPoints < 1 ) + { + // nope...GO GET SOME BONUS POINTS, IDIOT! + return( SLIDER_ERROR ); + } + + // check to make sure stat isn't maxed out already + switch( iStatToIncrement ) + { + case( STRENGTH_ATTRIBUTE ): + if( iCurrentStrength > iMaxAttribute -1 ) + { + // too high, leave + return( SLIDER_OUT_OF_RANGE ); + } + else + { + iCurrentStrength++; + iCurrentBonusPoints--; + } + break; + case( DEXTERITY_ATTRIBUTE ): + if( iCurrentDexterity > iMaxAttribute -1 ) + { + // too high, leave + return( SLIDER_OUT_OF_RANGE ); + } + else + { + iCurrentDexterity++; + iCurrentBonusPoints--; + } + break; + case( AGILITY_ATTRIBUTE ): + if( iCurrentAgility > iMaxAttribute -1 ) + { + // too high, leave + return( SLIDER_OUT_OF_RANGE ); + } + else + { + iCurrentAgility++; + iCurrentBonusPoints--; + } + break; + case( WISDOM_ATTRIBUTE ): + if( iCurrentWisdom > iMaxAttribute -1 ) + { + // too high, leave + return( SLIDER_OUT_OF_RANGE ); + } + else + { + iCurrentWisdom++; + iCurrentBonusPoints--; + } + break; + case( HEALTH_ATTRIBUTE ): + if( iCurrentHealth > iMaxAttribute -1 ) + { + // too high, leave + return( SLIDER_OUT_OF_RANGE ); + } + else + { + iCurrentHealth++; + iCurrentBonusPoints--; + } + break; + case( LEADERSHIP_ATTRIBUTE ): + if( iCurrentLeaderShip > iMaxAttribute -1 ) + { + // too high, leave + return( SLIDER_OUT_OF_RANGE ); + } + else + { + if( iCurrentLeaderShip == 0) + { + if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) + { + iCurrentLeaderShip+=iMinAttribute; + iCurrentBonusPoints-=iMaxZeroBonus; + fSkillAtZeroWarning = FALSE; + } + else + { + return( SLIDER_OK ); + } + } + else + { + iCurrentLeaderShip++; + iCurrentBonusPoints--; + } + } + break; + case( MARKSMANSHIP_SKILL ): + if( iCurrentMarkmanship > iMaxAttribute -1 ) + { + // too high, leave + return( SLIDER_OUT_OF_RANGE ); + } + else + { + if( iCurrentMarkmanship == 0) + { + if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) + { + iCurrentMarkmanship+=iMinAttribute; + iCurrentBonusPoints-=iMaxZeroBonus; + fSkillAtZeroWarning = FALSE; + } + else + { + return( SLIDER_OK ); + } + } + else + { + iCurrentMarkmanship++; + iCurrentBonusPoints--; + } + } + break; + case( MECHANICAL_SKILL ): + if( iCurrentMechanical > iMaxAttribute -1 ) + { + // too high, leave + return( SLIDER_OUT_OF_RANGE ); + } + else + { + if( iCurrentMechanical == 0) + { + if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) + { + iCurrentMechanical+=iMinAttribute; + iCurrentBonusPoints-=iMaxZeroBonus; + fSkillAtZeroWarning = FALSE; + } + else + { + return( SLIDER_OK ); + } + } + else + { + iCurrentMechanical++; + iCurrentBonusPoints--; + } + } + break; + case( MEDICAL_SKILL ): + if( iCurrentMedical > iMaxAttribute -1 ) + { + // too high, leave + return( SLIDER_OUT_OF_RANGE ); + } + else + { + if( iCurrentMedical == 0) + { + if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) + { + iCurrentMedical+=iMinAttribute; + iCurrentBonusPoints-=iMaxZeroBonus; + fSkillAtZeroWarning = FALSE; + } + else + { + return( SLIDER_OK ); + } + } + else + { + iCurrentMedical++; + iCurrentBonusPoints--; + } + } + break; + case( EXPLOSIVE_SKILL ): + if( iCurrentExplosives > iMaxAttribute -1 ) + { + // too high, leave + return( SLIDER_OUT_OF_RANGE ); + } + else + { + if( iCurrentExplosives == 0) + { + if( DoWeHaveThisManyBonusPoints( iMaxZeroBonus ) == TRUE ) + { + iCurrentExplosives+=iMinAttribute; + iCurrentBonusPoints-=iMaxZeroBonus; + fSkillAtZeroWarning = FALSE; + } + else + { + return( SLIDER_OK ); + } + } + else + { + iCurrentExplosives++; + iCurrentBonusPoints--; + } + } + break; + + } + + return( SLIDER_OK ); +} + + +UINT8 DecrementStat( INT32 iStatToDecrement ) +{ + + INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; + INT32 iMaxZeroBonus = gGameExternalOptions.iMaxZeroBonus; + + + // review mode, do not allow changes + if( fReviewStats ) + { + return( SLIDER_ERROR ); + } + + // decrement a stat + // check to make sure stat isn't maxed out already + switch( iStatToDecrement ) + { + case( STRENGTH_ATTRIBUTE ): + if( iCurrentStrength > iMinAttribute ) + { + // ok to decrement + iCurrentStrength--; + iCurrentBonusPoints++; + } + else + { + return( SLIDER_OUT_OF_RANGE ); + } + break; + case( DEXTERITY_ATTRIBUTE ): + if( iCurrentDexterity > iMinAttribute ) + { + // ok to decrement + iCurrentDexterity--; + iCurrentBonusPoints++; + } + else + { + return( SLIDER_OUT_OF_RANGE ); + } + break; + case( AGILITY_ATTRIBUTE ): + if( iCurrentAgility > iMinAttribute ) + { + // ok to decrement + iCurrentAgility--; + iCurrentBonusPoints++; + } + else + { + return( SLIDER_OUT_OF_RANGE ); + } + break; + case( WISDOM_ATTRIBUTE ): + if( iCurrentWisdom > iMinAttribute ) + { + // ok to decrement + iCurrentWisdom--; + iCurrentBonusPoints++; + } + else + { + return( SLIDER_OUT_OF_RANGE ); + } + break; + case( LEADERSHIP_ATTRIBUTE ): + if( iCurrentLeaderShip > iMinAttribute ) + { + // ok to decrement + iCurrentLeaderShip--; + iCurrentBonusPoints++; + } + //Kaiden: Leadership couldn't be set to zero fixed below: + else if( iCurrentLeaderShip == iMinAttribute) + { + // ok to decrement + iCurrentLeaderShip-=iMinAttribute; + iCurrentBonusPoints+=iMaxZeroBonus; + fSkillAtZeroWarning = TRUE; + } + break; + case( HEALTH_ATTRIBUTE ): + if( iCurrentHealth > iMinAttribute ) + { + // ok to decrement + iCurrentHealth--; + iCurrentBonusPoints++; + } + else + { + return( SLIDER_OUT_OF_RANGE ); + } + break; + case( MARKSMANSHIP_SKILL ): + if( iCurrentMarkmanship > iMinAttribute ) + { + // ok to decrement + iCurrentMarkmanship--; + iCurrentBonusPoints++; + } + else if( iCurrentMarkmanship == iMinAttribute) + { + // ok to decrement + iCurrentMarkmanship-=iMinAttribute; + iCurrentBonusPoints+=iMaxZeroBonus; + fSkillAtZeroWarning = TRUE; + } + break; + case( MEDICAL_SKILL ): + if( iCurrentMedical > iMinAttribute ) + { + // ok to decrement + iCurrentMedical--; + iCurrentBonusPoints++; + } + else if( iCurrentMedical == iMinAttribute) + { + // ok to decrement + iCurrentMedical-=iMinAttribute; + iCurrentBonusPoints+=iMaxZeroBonus; + fSkillAtZeroWarning = TRUE; + } + break; + case( MECHANICAL_SKILL ): + if( iCurrentMechanical > iMinAttribute ) + { + // ok to decrement + iCurrentMechanical--; + iCurrentBonusPoints++; + } + else if( iCurrentMechanical == iMinAttribute) + { + // ok to decrement + iCurrentMechanical-=iMinAttribute; + iCurrentBonusPoints+=iMaxZeroBonus; + fSkillAtZeroWarning = TRUE; + } + break; + case( EXPLOSIVE_SKILL ): + if( iCurrentExplosives > iMinAttribute ) + { + // ok to decrement + iCurrentExplosives--; + iCurrentBonusPoints++; + } + else if( iCurrentExplosives == iMinAttribute) + { + // ok to decrement + iCurrentExplosives-=iMinAttribute; + iCurrentBonusPoints+=iMaxZeroBonus; + fSkillAtZeroWarning = TRUE; + } + break; + + + } + + if( fSkillAtZeroWarning == TRUE ) + { + // current stat at zero + iCurrentStatAtZero = iStatToDecrement; + } + + return( SLIDER_OK ); +} + +BOOLEAN DoWeHaveThisManyBonusPoints( INT32 iBonusPoints ) +{ + + // returns if player has at least this many bonus points + if( iCurrentBonusPoints >= iBonusPoints ) + { + // yep, return true + return ( TRUE ); + } + else + { + // nope, return false + return ( FALSE ); + } +} + + + +void CreateIMPAttributeSelectionButtons( void ) +{ + + // the finished button + giIMPAttributeSelectionButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); +/* giIMPAttributeSelectionButton[0] = QuickCreateButton( giIMPAttributeSelectionButtonImage[0], LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishCallback ); + */ + giIMPAttributeSelectionButton[0] = CreateIconAndTextButton( giIMPAttributeSelectionButtonImage[0], pImpButtonText[ 11 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeFinishCallback); + + + + SetButtonCursor(giIMPAttributeSelectionButton[0], CURSOR_WWW); + return; +} + +void DestroyIMPAttributeSelectionButtons( void ) +{ + // this function will destroy the buttons needed for the IMP attrib enter page + + // the begin button + RemoveButton(giIMPAttributeSelectionButton[ 0 ] ); + UnloadButtonImage(giIMPAttributeSelectionButtonImage[ 0 ] ); + + return; +} + + + +void BtnIMPAttributeFinishCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP attrbite begin button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + //are we done diting, or just reviewing the stats? + if( fReviewStats == TRUE ) + { + iCurrentImpPage = IMP_FINISH; + } + else + { + iCurrentImpPage = IMP_ATTRIBUTE_FINISH; + } + fButtonPendingFlag = TRUE; + } + } +} + + + +void RenderAttributeBoxes( void ) +{ + + INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; + + + // this function will render the boxes in the sliding attribute bar, based on position + INT32 iCnt=STRENGTH_ATTRIBUTE; + INT16 sX = 0; + INT16 sY = 0; + INT16 sTempY = 0; + INT16 sTempX = 0; + CHAR16 sString[3]; + + // set last char to null + sString[2] = 0; + + // font stuff + SetFont(FONT10ARIAL); + SetFontShadow(NO_SHADOW); + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + + // run through and render each slider bar + for( iCnt = HEALTH_ATTRIBUTE; iCnt <= MECHANICAL_SKILL; iCnt++) + { + // position is ( width * ( stat - 35 ) ) /50] + // unless 0, then it is 0 - for skills + + // get y position + sY = SKILL_SLIDE_START_Y + SKILL_SLIDE_HEIGHT * ( ( INT16 )iCnt ) ; + + switch( iCnt ) + { + case (STRENGTH_ATTRIBUTE): + // blt in strength slider + sX = DetermineNewPosition( iCurrentStrength - iMinAttribute ); + RenderSliderBar( sX, sY ); + + // set sliderbar mouse region + MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); + + // the text + swprintf( sString, L"%d", iCurrentStrength ); + sX += LAPTOP_SCREEN_UL_X; + sY += LAPTOP_SCREEN_WEB_UL_Y; + mprintf(sX + 13, sY + 3, sString); + break; + case (DEXTERITY_ATTRIBUTE): + // blt in strength slider + sX = DetermineNewPosition( iCurrentDexterity - iMinAttribute ); + RenderSliderBar( sX, sY ); + + // set sliderbar mouse region + MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); + + // the text + swprintf( sString, L"%d", iCurrentDexterity ); + sX += LAPTOP_SCREEN_UL_X; + sY += LAPTOP_SCREEN_WEB_UL_Y; + mprintf(sX + 13, sY + 3, sString); + + break; + case (AGILITY_ATTRIBUTE): + // blt in strength slider + sX = DetermineNewPosition( iCurrentAgility - iMinAttribute ); + RenderSliderBar( sX, sY ); + + // set sliderbar mouse region + MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); + + // the text + swprintf( sString, L"%d", iCurrentAgility ); + sX += LAPTOP_SCREEN_UL_X; + sY += LAPTOP_SCREEN_WEB_UL_Y; + mprintf(sX + 13, sY + 3, sString); + + break; + case (WISDOM_ATTRIBUTE): + // blt in strength slider + sX = DetermineNewPosition( iCurrentWisdom - iMinAttribute ); + RenderSliderBar( sX, sY ); + + // set sliderbar mouse region + MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); + + // the text + swprintf( sString, L"%d", iCurrentWisdom ); + sX += LAPTOP_SCREEN_UL_X; + sY += LAPTOP_SCREEN_WEB_UL_Y; + mprintf(sX + 13, sY + 3, sString); + break; + case (LEADERSHIP_ATTRIBUTE): + // blt in strength slider + sX = DetermineNewPosition( iCurrentLeaderShip - iMinAttribute ); + RenderSliderBar( sX, sY ); + // set sliderbar mouse region + MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); + + // the text + swprintf( sString, L"%d", iCurrentLeaderShip ); + sX += LAPTOP_SCREEN_UL_X; + sY += LAPTOP_SCREEN_WEB_UL_Y; + mprintf(sX + 13 , sY + 3, sString); + break; + case (HEALTH_ATTRIBUTE): + // blt in health slider + sX = DetermineNewPosition( iCurrentHealth - iMinAttribute ); + RenderSliderBar( sX, sY ); + + // set sliderbar mouse region + MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); + + // the text + swprintf( sString, L"%d", iCurrentHealth ); + sY += LAPTOP_SCREEN_WEB_UL_Y; + sX += LAPTOP_SCREEN_UL_X; + mprintf(sX + 13, sY + 3, sString); + break; + case (MARKSMANSHIP_SKILL): + // blt in marksmanship slider + + sX = DetermineNewPosition( iCurrentMarkmanship - iMinAttribute ); + RenderSliderBar( sX, sY ); + // set sliderbar mouse region + MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); + + + // the text + swprintf( sString, L"%d", iCurrentMarkmanship ); + sY += LAPTOP_SCREEN_WEB_UL_Y; + sX += LAPTOP_SCREEN_UL_X; + mprintf(sX + 13, sY + 3, sString); + break; + case (MEDICAL_SKILL): + // blt in medical slider + + sX = DetermineNewPosition( iCurrentMedical - iMinAttribute ); + RenderSliderBar( sX, sY ); + + // set sliderbar mouse region + MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); + + // the text + swprintf( sString, L"%d", iCurrentMedical ); + sY += LAPTOP_SCREEN_WEB_UL_Y; + sX += LAPTOP_SCREEN_UL_X; + mprintf(sX + 13, sY + 3, sString); + break; + case (MECHANICAL_SKILL): + // blt in mech slider + + sX = DetermineNewPosition( iCurrentMechanical - iMinAttribute ); + RenderSliderBar( sX, sY ); + + // set sliderbar mouse region + MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); + + + // the text + swprintf( sString, L"%d", iCurrentMechanical ); + sY += LAPTOP_SCREEN_WEB_UL_Y; + sX += LAPTOP_SCREEN_UL_X; + mprintf(sX + 13, sY + 3, sString); + break; + case (EXPLOSIVE_SKILL): + // blt in explosive slider + + sX = DetermineNewPosition( iCurrentExplosives - iMinAttribute ); + RenderSliderBar( sX, sY ); + + // set sliderbar mouse region + MSYS_MoveMouseRegionTo( &pSliderBarRegions[ iCnt ], ( INT16 )(sX + LAPTOP_SCREEN_UL_X ), ( INT16 )( sY + LAPTOP_SCREEN_WEB_UL_Y ) ); + + // the text + swprintf( sString, L"%d", iCurrentExplosives ); + sY += LAPTOP_SCREEN_WEB_UL_Y; + sX += LAPTOP_SCREEN_UL_X; + mprintf(sX + 13, sY + 3, sString); + break; + + } + } + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + + return; +} + + + +void CreateAttributeSliderButtons( void ) +{ + // this function will create the buttons for the attribute slider + // the finished button + INT32 iCounter =0; + + giIMPAttributeSelectionSliderButtonImage[ 0 ]= LoadButtonImage( "LAPTOP\\AttributeArrows.sti" ,-1,0,-1,1,-1 ); + giIMPAttributeSelectionSliderButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\AttributeArrows.sti" ,-1,3,-1,4,-1 ); + + for(iCounter = 0; iCounter < 20; iCounter+=2 ) + { + // left button - decrement stat + giIMPAttributeSelectionSliderButton[ iCounter ] = QuickCreateButton( giIMPAttributeSelectionSliderButtonImage[ 0 ], LAPTOP_SCREEN_UL_X + ( 163 ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + ( 99 + iCounter / 2 * 20 ) ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeSliderLeftCallback ); + + // right button - increment stat + giIMPAttributeSelectionSliderButton[ iCounter + 1 ] = QuickCreateButton( giIMPAttributeSelectionSliderButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 419 ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + ( 99 + iCounter / 2 * 20 ) ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAttributeSliderRightCallback ); + + SetButtonCursor(giIMPAttributeSelectionSliderButton[iCounter], CURSOR_WWW); + SetButtonCursor(giIMPAttributeSelectionSliderButton[iCounter + 1 ], CURSOR_WWW); + // set user data + MSYS_SetBtnUserData(giIMPAttributeSelectionSliderButton[iCounter],0, iCounter / 2 ); + MSYS_SetBtnUserData(giIMPAttributeSelectionSliderButton[iCounter + 1],0, iCounter / 2 ); + } + + MarkButtonsDirty( ); +} + + + +void DestroyAttributeSliderButtons( void ) +{ + // this function will destroy the buttons used for attribute manipulation + INT32 iCounter =0; + + // get rid of image + UnloadButtonImage(giIMPAttributeSelectionSliderButtonImage[ 0 ] ); + UnloadButtonImage(giIMPAttributeSelectionSliderButtonImage[ 1 ] ); + + for(iCounter = 0; iCounter < 20; iCounter++ ) + { + // get rid of button + RemoveButton(giIMPAttributeSelectionSliderButton[ iCounter ] ); + + } + + return; +} + + +void BtnIMPAttributeSliderLeftCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT32 iValue = -1; + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + + iValue = (INT32)MSYS_GetBtnUserData( btn, 0 ); + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + DecrementStat( iValue ); + // stat has changed, rerender + fHasAnySlidingBarMoved = TRUE; + uiBarToReRender = iValue; + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + + DecrementStat( iValue ); + fHasAnySlidingBarMoved = TRUE; + btn->uiFlags|=(BUTTON_CLICKED_ON); + uiBarToReRender = iValue; + } + + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + } + } +} + + +void BtnIMPAttributeSliderRightCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT32 iValue = -1; + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + iValue = (INT32)MSYS_GetBtnUserData( btn, 0 ); + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + IncrementStat( iValue ); + // stat has changed, rerender + fHasAnySlidingBarMoved = TRUE; + uiBarToReRender = iValue; + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + + IncrementStat( iValue ); + fHasAnySlidingBarMoved = TRUE; + uiBarToReRender = iValue; + btn->uiFlags|=(BUTTON_CLICKED_ON); + + } + + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + } + } +} + + + +void CreateSlideRegionMouseRegions( void ) +{ + // this function will create that mouse regions on the sliding area, that, if the player clicks on, the bar will automatically jump to + INT32 iCounter = 0; + + for( iCounter = 0; iCounter < 10; iCounter++ ) + { + // define the region + MSYS_DefineRegion( &pSliderRegions[ iCounter ], ( INT16 ) ( SKILL_SLIDE_START_X + LAPTOP_SCREEN_UL_X), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT ) , ( INT16 ) ( LAPTOP_SCREEN_UL_X + SKILL_SLIDE_START_X + BAR_WIDTH ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT + 15 ), + MSYS_PRIORITY_HIGH + 2, CURSOR_WWW, MSYS_NO_CALLBACK, SliderRegionButtonCallback); + + // define user data + MSYS_SetRegionUserData(&pSliderRegions[iCounter],0,iCounter); + // now add it + MSYS_AddRegion(&pSliderRegions[ iCounter ]); + } + + return; +} + +void CreateSliderBarMouseRegions( void ) +{ + + INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; + + // this function will create that mouse regions on the sliding bars, that, if the player clicks on, the bar will automatically jump to + INT32 iCounter = 0; + INT16 sX = 0; + + // set the starting X + sX = DetermineNewPosition( gGameExternalOptions.iStartAttribute - iMinAttribute ); + + for( iCounter = 0; iCounter < 10; iCounter++ ) + { + // define the region + MSYS_DefineRegion( &pSliderBarRegions[ iCounter ], ( INT16 ) ( sX ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT ) , ( INT16 ) (sX + SLIDER_BAR_WIDTH ), ( INT16 ) ( LAPTOP_SCREEN_WEB_UL_Y + SKILL_SLIDE_START_Y + iCounter * SKILL_SLIDE_HEIGHT + 15 ), + MSYS_PRIORITY_HIGH + 2, CURSOR_WWW, MSYS_NO_CALLBACK, SliderBarRegionButtonCallback); + + // define user data + MSYS_SetRegionUserData(&pSliderBarRegions[iCounter],0,iCounter); + // now add it + MSYS_AddRegion(&pSliderBarRegions[ iCounter ]); + } + + return; +} + + +void DestroySlideRegionMouseRegions( void ) +{ + // this function will destroy the regions user for the slider ' jumping' + INT32 iCounter=0; + + // delete the regions + for( iCounter=0; iCounter < 10; iCounter++ ) + { + MSYS_RemoveRegion( &pSliderRegions[ iCounter ] ); + } + + return; +} + + +void DestroySlideBarMouseRegions( void ) +{ + // this function will destroy the regions user for the slider ' jumping' + INT32 iCounter=0; + + // delete the regions + for( iCounter=0; iCounter < 10; iCounter++ ) + { + MSYS_RemoveRegion( &pSliderBarRegions[ iCounter ] ); + } + + return; +} + + +void SliderRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) +{ + + INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; + INT32 iMaxAttribute = gGameExternalOptions.iMaxAttribute; + + INT32 iCurrentAttributeValue = 0; + INT32 iNewAttributeValue = 0; + INT32 iAttributeDelta = 0; + INT32 iCounter =0; + INT16 sX =0; + INT16 sY = 0; + static INT16 sOldX = -1; + static INT16 sOldY = -1; + static INT32 iAttribute = -1; + INT32 iNewValue = 0; + INT32 iCurrentValue = 0; + INT16 sNewX = -1; + + + //if we already have an anchored slider bar + if( gpCurrentScrollBox != pRegion && gpCurrentScrollBox != NULL ) + return; + + + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + if (iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT) + { + if( fSlideIsActive == FALSE) + { + // not active leave + return; + } + + + // check to see if we have moved + if( MSYS_GetRegionUserData(pRegion, 0) != iAttribute ) + { + // different regions + iAttribute = MSYS_GetRegionUserData(pRegion, 0); + sOldX = -1; + sOldY = -1; + return; + } + + uiBarToReRender = iAttribute; + + giCurrentlySelectedStat = iAttribute; + gpCurrentScrollBox = pRegion; + + // get new attribute value x + sNewX = pRegion->MouseXPos; + + // sOldX has been reset, set to sNewX + if( sOldX == -1) + { + sOldX = sNewX; + return; + } + // check against old x + if( sNewX != sOldX ) + { + + // get old stat value + iCurrentAttributeValue = GetCurrentAttributeValue( iAttribute ); + iNewValue = DetermineNewValue( sNewX ); + // chenged, move mouse region if change large enough + if( iCurrentAttributeValue != iNewValue ) + { + // update screen + fHasAnySlidingBarMoved = TRUE; + } + + // change is enough + if ( iNewValue - iCurrentAttributeValue > 0) + { + // positive, increment stat + iCounter = iNewValue - iCurrentAttributeValue; + for( iCounter; iCounter > 0; iCounter--) + { + IncrementStat( iAttribute ); + } + } + else + { + // negative, decrement stat + iCounter = iCurrentAttributeValue - iNewValue; + for( iCounter; iCounter > 0; iCounter--) + { + DecrementStat( iAttribute ); + } + } + + sOldX = sNewX; + } + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + + if( fSlideIsActive ) + { + // reset slide is active flag + fSlideIsActive = FALSE; + return; + } + + + // get mouse XY + + sX = pRegion -> MouseXPos; + sY = pRegion -> MouseYPos; + + // which region are we in? + + // get attribute + iAttribute = MSYS_GetRegionUserData(pRegion, 0); + uiBarToReRender = iAttribute; + + // get value of attribute + iCurrentAttributeValue = GetCurrentAttributeValue( iAttribute ); + + // set the new attribute value based on position of mouse click + iNewAttributeValue = DetermineNewValue( sX ); + + // too high, reset to MAX_ATTIBUTEPOINT + if( iNewAttributeValue > iMaxAttribute ) + { + iNewAttributeValue = iMaxAttribute; + } + + // get the delta + iAttributeDelta = iCurrentAttributeValue - iNewAttributeValue; + + // set Counter + iCounter = iAttributeDelta; + + // check if increment or decrement + if( iAttributeDelta > 0) + { + // decrement + for( iCounter = 0; iCounter < iAttributeDelta; iCounter++ ) + { + DecrementStat( iAttribute ); + } + } + else + { + // increment attribute + for( iCounter = iAttributeDelta; iCounter < 0; iCounter++ ) + { + if( iCurrentAttributeValue == 0) + { + iCounter = 0; + } + IncrementStat( iAttribute ); + } + } + + // update screen + fHasAnySlidingBarMoved = TRUE; + + + } + else if ( iReason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + + + } + else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + + // get mouse positions + sX = pRegion -> MouseXPos; + sY = pRegion -> MouseYPos; + + // get attribute + iAttribute = MSYS_GetRegionUserData(pRegion, 0); + uiBarToReRender = iAttribute; + + // get value of attribute + iCurrentAttributeValue = GetCurrentAttributeValue( iAttribute ); + + // get the boxes bounding x + sNewX = DetermineNewPosition( iCurrentAttributeValue - iMinAttribute ); + sNewX += LAPTOP_SCREEN_UL_X; + + // the sNewX is below 0, reset to zero + if( sNewX < 0 ) + { + sNewX = 0; + } + + if( ( sX > sNewX )&&( sX < sNewX + SLIDER_BAR_WIDTH) ) + { + // we are within the slide bar, set fact we want to drag and draw + fSlideIsActive = TRUE; + } + else + { + // otherwise want to jump to position + fSlideIsActive =FALSE; + } + } + +} + +void SliderBarRegionButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) +{ + + + if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + fSlideIsActive = TRUE; + SliderRegionButtonCallback( &pSliderRegions[ MSYS_GetRegionUserData(pRegion, 0) ], MSYS_CALLBACK_REASON_LBUTTON_REPEAT); + } + if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + fSlideIsActive = FALSE; + } + +} + +INT32 GetCurrentAttributeValue( INT32 iAttribute ) +{ + // this function will get the value of the attribute that was passed to this fucntion via iAttribute + INT32 iValue =0; + + switch( iAttribute ) + { + case ( STRENGTH_ATTRIBUTE ): + iValue = iCurrentStrength; + break; + case ( DEXTERITY_ATTRIBUTE ): + iValue = iCurrentDexterity; + break; + case ( AGILITY_ATTRIBUTE ): + iValue = iCurrentAgility; + break; + case ( HEALTH_ATTRIBUTE ): + iValue = iCurrentHealth; + break; + case ( WISDOM_ATTRIBUTE ): + iValue = iCurrentWisdom; + break; + case ( LEADERSHIP_ATTRIBUTE ): + iValue = iCurrentLeaderShip; + break; + case ( MARKSMANSHIP_SKILL ): + iValue = iCurrentMarkmanship; + break; + case ( MEDICAL_SKILL ): + iValue = iCurrentMedical; + break; + case ( MECHANICAL_SKILL ): + iValue = iCurrentMechanical; + break; + case ( EXPLOSIVE_SKILL ): + iValue = iCurrentExplosives; + break; + + + } + + return iValue; +} + + +void SetAttributes( void ) +{ + INT8 bExtraPoints; +/* + // set attributes and skills based on what is in charprofile.c + + // attributes + iCurrentStrength = iStrength + iAddStrength; + iCurrentDexterity = iDexterity + iAddDexterity; + iCurrentHealth = iHealth + iAddHealth; + iCurrentLeaderShip = iLeadership + iAddLeadership; + iCurrentWisdom = iWisdom + iAddWisdom; + iCurrentAgility = iAgility + iAddAgility; + + // skills + iCurrentMarkmanship = iMarksmanship + iAddMarksmanship; + iCurrentMechanical = iMechanical + iAddMechanical; + iCurrentMedical = iMedical + iAddMedical; + iCurrentExplosives = iExplosives + iAddExplosives; + + // reset bonus pts + iCurrentBonusPoints = 40; +*/ + + iCurrentStrength = gGameExternalOptions.iStartAttribute; + iCurrentDexterity = gGameExternalOptions.iStartAttribute; + iCurrentHealth = gGameExternalOptions.iStartAttribute; + iCurrentLeaderShip = gGameExternalOptions.iStartAttribute; + iCurrentWisdom = gGameExternalOptions.iStartAttribute; + iCurrentAgility = gGameExternalOptions.iStartAttribute; + + // skills + iCurrentMarkmanship = gGameExternalOptions.iStartAttribute; + iCurrentMechanical = gGameExternalOptions.iStartAttribute; + iCurrentMedical = gGameExternalOptions.iStartAttribute; + iCurrentExplosives = gGameExternalOptions.iStartAttribute; + + + // reset bonus pts + //iCurrentBonusPoints = 40; + iCurrentBonusPoints = gGameExternalOptions.iImpAttributePoints; + + + //Determine if the player has any extra points + bExtraPoints = DoesPlayerHaveExtraAttibutePointsToDistributeBasedOnSkillSelection(); + + if( bExtraPoints > 0 ) + { + iCurrentBonusPoints += bExtraPoints; + } + + + ResetIncrementCharacterAttributes( ); + + return; +} + + +void DrawBonusPointsRemaining( void ) +{ + // draws the amount of points remaining player has + CHAR16 sString[64]; + + // just reviewing, don't blit stats + if( fReviewStats == TRUE ) + { + return; + } + // parse amountof bns pts remaining + swprintf(sString, L"%d", iCurrentBonusPoints); + + // set font color + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + SetFont( FONT12ARIAL ); + // print string + mprintf( LAPTOP_SCREEN_UL_X + 425 ,LAPTOP_SCREEN_WEB_UL_Y + 51, sString ); + + InvalidateRegion( LAPTOP_SCREEN_UL_X + 425, LAPTOP_SCREEN_WEB_UL_Y + 51, LAPTOP_SCREEN_UL_X + 475, LAPTOP_SCREEN_WEB_UL_Y + 71 ); + return; +} + + +void SetGeneratedCharacterAttributes( void ) +{ + // copies over the attributes of the player generated character + iStrength = iCurrentStrength ; + iDexterity = iCurrentDexterity; + iHealth = iCurrentHealth; + iLeadership = iCurrentLeaderShip; + iWisdom = iCurrentWisdom; + iAgility = iCurrentAgility; + + // skills + iMarksmanship = iCurrentMarkmanship; + iMechanical = iCurrentMechanical; + iMedical = iCurrentMedical; + iExplosives = iCurrentExplosives; + + + return; +} + + +void StatAtZeroBoxCallBack( UINT8 bExitValue ) +{ + // yes, so start over, else stay here and do nothing for now + if( bExitValue == MSG_BOX_RETURN_YES ) + { + MarkButtonsDirty(); + } + else if( bExitValue == MSG_BOX_RETURN_NO ) + { + IncrementStat( iCurrentStatAtZero ); + fHasAnySlidingBarMoved = TRUE; + MarkButtonsDirty(); + } + + return; +} + +INT32 DetermineNewValue( INT32 iNewX ) +{ + + INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; + INT32 iMaxAttribute = gGameExternalOptions.iMaxAttribute; + + INT32 iNewValue=0; + INT32 iStartLoc = SKILL_SLIDE_START_X + LAPTOP_SCREEN_UL_X; + INT32 iPositionX = iNewX - iStartLoc; + FLOAT fPercentOfBar=0.0f; + + + fPercentOfBar = iPositionX / ( FLOAT)( BAR_WIDTH - SLIDER_BAR_WIDTH ); + + iNewValue = (INT32)( fPercentOfBar * ( iMaxAttribute - (FLOAT)iMinAttribute ) ); + + iNewValue += iMinAttribute; + + // too high, reset to MAX_ATTIBUTEPOINT + if( iNewValue > iMaxAttribute ) + { + iNewValue = iMaxAttribute; + } + + return( iNewValue ); +} + + +INT32 DetermineNewPosition( INT32 iAttribute ) +{ + + INT32 iMinAttribute = gGameExternalOptions.iMinAttribute; + INT32 iMaxAttribute = gGameExternalOptions.iMaxAttribute; + + INT32 iNewLoc=0; + INT32 iStartLoc = SKILL_SLIDE_START_X; + FLOAT fPercentOfBar=0.0f; + FLOAT fBasePixelScaleWidth = ( ( BAR_WIDTH - SLIDER_BAR_WIDTH ) / (FLOAT)( iMaxAttribute - iMinAttribute ) ); + + iNewLoc = (INT32)(iAttribute * fBasePixelScaleWidth); + + if( iNewLoc < 0 ) + { + iNewLoc = 0; + } + + iNewLoc += iStartLoc; + + return( iNewLoc ); +} diff --git a/Laptop/IMP Attribute Selection.h b/Laptop/IMP Attribute Selection.h new file mode 100644 index 00000000..65434b93 --- /dev/null +++ b/Laptop/IMP Attribute Selection.h @@ -0,0 +1,24 @@ +#ifndef _IMP_ATTRIBUTE_SELECTION_H +#define _IMP_ATTRIBUTE_SELECTION_H + +void EnterIMPAttributeSelection( void ); +void RenderIMPAttributeSelection( void ); +void ExitIMPAttributeSelection( void ); +void HandleIMPAttributeSelection( void ); + +void RenderAttributeBoxes( void ); + +extern BOOLEAN fReviewStats; +extern BOOLEAN fSkillAtZeroWarning; + +extern BOOLEAN fFirstIMPAttribTime; + +extern BOOLEAN fReturnStatus; +// starting point of skill boxes on bar +#define SKILL_SLIDE_START_X 186 + +#define SKILL_SLIDE_START_Y 100 +#define SKILL_SLIDE_HEIGHT 20 + + +#endif \ No newline at end of file diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp new file mode 100644 index 00000000..4aff5b2f --- /dev/null +++ b/Laptop/IMP Begin Screen.cpp @@ -0,0 +1,1544 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "CharProfile.h" + #include "IMP Begin Screen.h" + #include "IMP MainPage.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Timer Control.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Finish.h" + #include "IMP Text System.h" + #include "Text Input.h" + #include "messageboxscreen.h" + #include "Soldier Profile Type.h" + #include "IMP Portraits.h" + #include "IMP Voices.h" + #include "IMP Attribute Selection.h" + #include "english.h" + #include "line.h" + #include "Merc Hiring.h" + #include "strategic.h" + #include "Game Clock.h" + #include "text.h" +#endif + +#define FULL_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 138 +#define NICK_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 195 +#define MALE_BOX_X 2 + 192 + LAPTOP_SCREEN_UL_X +#define MALE_BOX_Y 254 + LAPTOP_SCREEN_WEB_UL_Y +#define MALE_BOX_WIDTH 24 - 2 +#define MALE_BOX_HEIGHT 24 - 2 +#define FEMALE_BOX_X 2 + 302 + LAPTOP_SCREEN_UL_X +#define MAX_FULL_NAME 29 +#define MAX_NICK_NAME 8 +#define FULL_NAME_REGION_WIDTH 230 +#define NICK_NAME_REGION_WIDTH 100 + +// genders +enum{ + IMP_FEMALE = 0, + IMP_MALE, +}; + +// TextEnterMode .. whether user is entering full name or nick name, or gender selection +enum{ + FULL_NAME_MODE, + NICK_NAME_MODE, + MALE_GENDER_SELECT, + FEMALE_GENDER_SELECT, +}; + +// beginning character stats +CHAR16 pFullNameString[128]; +CHAR16 pNickNameString[128]; + + +// positions in name strings +UINT32 uiFullNameCharacterPosition = 0; +UINT32 uiNickNameCharacterPosition = 0; + +// non gender +INT8 bGenderFlag = -1; + +// IMP begin page buttons +INT32 giIMPBeginScreenButton[1]; +INT32 giIMPBeginScreenButtonImage[1]; + +// current mode of entering text we are in, ie FULL or Nick name? +UINT8 ubTextEnterMode =0; + +// cursor position +UINT32 uiNickNameCursorPosition =196 + LAPTOP_SCREEN_UL_X; +UINT32 uiFullNameCursorPosition =196 + LAPTOP_SCREEN_UL_X; + +// whther a new char has been entered ( to force redraw) +BOOLEAN fNewCharInString = FALSE; + + + +// mouse regions +MOUSE_REGION gIMPBeginScreenMouseRegions[ 4 ]; + + +// function definitions +void CreateIMPBeginScreenButtons( void ); +void RemoveIMPBeginScreenButtons( void ); +void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason); +void GetPlayerKeyBoardInputForIMPBeginScreen( void ); +void HandleBeginScreenTextEvent( UINT32 uiKey ); +void DisplayFullNameStringCursor( void ); +void DisplayNickNameStringCursor( void ); +void DisplayPlayerFullNameString( void ); +void DisplayPlayerNickNameString( void ); +void CopyFirstNameIntoNickName( void ); +void IncrementTextEnterMode( void ); +void DisplayMaleGlowCursor( void ); +void RenderMaleGenderIcon( void ); +void DisplayFemaleGlowCursor( void ); +void RenderFemaleGenderIcon( void ); +void CreateIMPBeginScreenMouseRegions( void ); +void DestroyIMPBeginScreenMouseRegions( void ); +void RenderGender( void ); +void DecrementTextEnterMode( void ); +void Print8CharacterOnlyString( void ); +BOOLEAN CheckCharacterInputForEgg( void ); + +// mouse region callbacks +void SelectFullNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectNickNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectFemaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void MvtOnMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void MvtOnFemaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + + + +void EnterIMPBeginScreen( void ) +{ + + // reset all variables + + memset( pFullNameString, 0, sizeof( pFullNameString ) ); + memset( pNickNameString, 0, sizeof( pNickNameString ) ); + + // if we are not restarting...then copy over name, set cursor and array positions + if( iCurrentProfileMode != IMP__REGISTRY ) + { + wcscpy( pFullNameString, pFullName ); + wcscpy( pNickNameString, pNickName ); + uiFullNameCharacterPosition = wcslen( pFullNameString ); + uiNickNameCharacterPosition = wcslen( pNickNameString ); + uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); + uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); + + // set gender too + bGenderFlag = fCharacterIsMale; + + } + else + { + uiNickNameCursorPosition =196 + LAPTOP_SCREEN_UL_X; + uiFullNameCursorPosition =196 + LAPTOP_SCREEN_UL_X; + uiFullNameCharacterPosition = 0; + uiNickNameCharacterPosition = 0; + bGenderFlag = -1; + } + + + + + ubTextEnterMode =0; + + // draw name if any + fNewCharInString = TRUE; + + + // render the screen on entry + RenderIMPBeginScreen( ); + + if( fFinishedCharGeneration ) + { + ubTextEnterMode = 5; + } + else + { + fFirstIMPAttribTime = TRUE; + } + + // create mouse regions + CreateIMPBeginScreenMouseRegions( ); + + // create buttons needed for begin screen + CreateIMPBeginScreenButtons( ); + + return; +} + +void RenderIMPBeginScreen( void ) +{ + // the background + RenderProfileBackGround( ); + + // fourth button image 3X + RenderButton4Image( 64, 118 ); + RenderButton4Image( 64, 178 ); + RenderButton4Image( 64, 238 ); + + // the begin screen indents + RenderBeginIndent( 105, 58); + + // full name indent + RenderNameIndent( 194, 132); + + // nick name + RenderNickNameIndent( 194, 192); + + + // gender indents + RenderGenderIndent( 192, 252 ); + RenderGenderIndent( 302, 252 ); + + // render warning string + Print8CharacterOnlyString( ); + + + + // display player name + DisplayPlayerFullNameString( ); + DisplayPlayerNickNameString( ); + RenderMaleGenderIcon( ); + RenderFemaleGenderIcon( ); + + // the gender itself + RenderGender( ); + + return; +} + +void ExitIMPBeginScreen( void ) +{ + + // remove buttons + RemoveIMPBeginScreenButtons( ); + + // remove mouse regions + DestroyIMPBeginScreenMouseRegions( ); + + wcscpy( pFullName, pFullNameString ); + + // is nick name too long?..shorten + if( wcslen( pNickNameString ) > 8 ) + { + // null out char 9 + pNickNameString[ 8 ] = 0; + } + + + wcscpy( pNickName, pNickNameString ); + + // set gender + fCharacterIsMale = bGenderFlag; + + return; +} + + +void HandleIMPBeginScreen( void ) +{ + + GetPlayerKeyBoardInputForIMPBeginScreen( ); + + // has a new char been added to activation string + + + + // render the cursor + switch( ubTextEnterMode ) + { + case( FULL_NAME_MODE ): + DisplayFullNameStringCursor( ); + break; + case( NICK_NAME_MODE ): + DisplayNickNameStringCursor( ); + break; + case( MALE_GENDER_SELECT ): + DisplayMaleGlowCursor( ); + break; + case( FEMALE_GENDER_SELECT ): + DisplayFemaleGlowCursor( ); + break; + } + + if( fNewCharInString ) + { + // display strings + DisplayPlayerFullNameString( ); + DisplayPlayerNickNameString( ); + RenderMaleGenderIcon( ); + RenderFemaleGenderIcon( ); + + // the gender itself + RenderGender( ); + } + + return; +} + + +void CreateIMPBeginScreenButtons( void ) +{ + // this procedure will create the buttons needed for the IMP BeginScreen + + // ths done button + giIMPBeginScreenButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); +/* giIMPBeginScreenButton[0] = QuickCreateButton( giIMPBeginScreenButtonImage[0], LAPTOP_SCREEN_UL_X + ( 134 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPBeginScreenDoneCallback); + */ + + giIMPBeginScreenButton[0] = CreateIconAndTextButton( giIMPBeginScreenButtonImage[ 0 ], pImpButtonText[ 6 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 134 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPBeginScreenDoneCallback); + + SetButtonCursor(giIMPBeginScreenButton[0], CURSOR_WWW); + return; + +} + + + +void RemoveIMPBeginScreenButtons( void ) +{ + // this procedure will destroy the already created buttosn for the IMP BeginScreen + + // the done button + RemoveButton(giIMPBeginScreenButton[0] ); + UnloadButtonImage(giIMPBeginScreenButtonImage[0] ); + + return; +} + + +void BtnIMPBeginScreenDoneCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // easter egg check + BOOLEAN fEggOnYouFace = FALSE; + + // btn callback for IMP Begin Screen done button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + + if( fFinishedCharGeneration ) + { + // simply reviewing name and gender, exit to finish page + iCurrentImpPage = IMP_FINISH; + fButtonPendingFlag = TRUE; + return; + } + else + { + if( CheckCharacterInputForEgg( ) ) + { + fEggOnYouFace = TRUE; + } + } + + + // back to mainpage + + + // check to see if a name has been selected, if not, do not allow player to proceed with more char generation + if( ( pFullNameString[ 0 ] != 0) && ( pFullNameString[ 0 ] != L' ' ) && ( bGenderFlag != -1 ) ) + { + // valid full name, check to see if nick name + if( ( pNickNameString[ 0 ] == 0 ) || ( pNickNameString[ 0 ] == L' ')) + { + // no nick name + // copy first name to nick name + CopyFirstNameIntoNickName( ); + } + // ok, now set back to main page, and set the fact we have completed part 1 + if ( ( iCurrentProfileMode < IMP__PERSONALITY ) &&( bGenderFlag != -1 ) ) + { + iCurrentProfileMode = IMP__PORTRAIT;//IMP__PERSONALITY; + } + else if( bGenderFlag == -1 ) + { + iCurrentProfileMode = IMP__REGISTRY; + } + // no easter egg?...then proceed along + if( fEggOnYouFace == FALSE ) + { + iCurrentImpPage = IMP_MAIN_PAGE; + fButtonPendingFlag = TRUE; + } + + } + else + { + // invalid name, reset current mode + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 2 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + iCurrentProfileMode = IMP__REGISTRY; + } + } + } +} + + + + + + + +void GetPlayerKeyBoardInputForIMPBeginScreen( void ) +{ + InputAtom InputEvent; + POINT MousePos; + + // get the current curosr position, might just need it. + GetCursorPos(&MousePos); + + // handle input events + while( DequeueEvent(&InputEvent) ) + { + /* + // HOOK INTO MOUSE HOOKS + switch(InputEvent.usEvent) + { + + case LEFT_BUTTON_DOWN: + MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_UP: + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_DOWN: + MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + } + */ + if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT) ) + { + switch( InputEvent.usParam ) + { + case (( ENTER )): + // check to see if gender was highlighted..if so, select it + if( FEMALE_GENDER_SELECT == ubTextEnterMode ) + { + bGenderFlag = IMP_FEMALE; + } + else if( MALE_GENDER_SELECT == ubTextEnterMode ) + { + bGenderFlag = IMP_MALE; + } + + // increment to next selection box + IncrementTextEnterMode( ); + fNewCharInString = TRUE; + break; + case( SPACE ): + // handle space bar + if( FEMALE_GENDER_SELECT == ubTextEnterMode ) + { + bGenderFlag = IMP_FEMALE; + DecrementTextEnterMode( ); + } + else if( MALE_GENDER_SELECT == ubTextEnterMode ) + { + bGenderFlag = IMP_MALE; + IncrementTextEnterMode( ); + } + else + { + HandleBeginScreenTextEvent( InputEvent.usParam ); + } + fNewCharInString = TRUE; + break; + case (( ESC )): + LeaveLapTopScreen( ); + break; + case (( TAB )): + // tab hit, increment to next selection box + IncrementTextEnterMode( ); + fNewCharInString = TRUE; + break; + case ( 265 ): + // tab and shift + DecrementTextEnterMode( ); + fNewCharInString = TRUE; + break; + default: + HandleBeginScreenTextEvent( InputEvent.usParam ); + break; + } + } + } + return; +} + + +void HandleBeginScreenTextEvent( UINT32 uiKey ) +{ + // this function checks to see if a letter or a backspace was pressed, if so, either put char to screen + // or delete it + + switch( uiKey ) + { + case ( BACKSPACE ): + + switch( ubTextEnterMode ) + { + case( FULL_NAME_MODE ): + if( uiFullNameCharacterPosition >= 0 ) + { + + + // decrement StringPosition + if( uiFullNameCharacterPosition > 0) + { + uiFullNameCharacterPosition-=1; + } + + + + + // null out char + pFullNameString[uiFullNameCharacterPosition] = 0; + + // move cursor back by sizeof char + uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); + + // string has been altered, redisplay + fNewCharInString = TRUE; + } + break; + case ( NICK_NAME_MODE ): + if( uiNickNameCharacterPosition >= 0 ) + { + + + // decrement StringPosition + if( uiNickNameCharacterPosition > 0 ) + uiNickNameCharacterPosition-=1; + + // null out char + pNickNameString[uiNickNameCharacterPosition] = 0; + + // move cursor back by sizeof char + uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); + + // string has been altered, redisplay + fNewCharInString = TRUE; + } + + break; + } + break; + + default: + if( uiKey >= 'A' && uiKey <= 'Z' || + uiKey >= 'a' && uiKey <= 'z' || + uiKey >= '0' && uiKey <= '9' || + uiKey == '_' || uiKey == '.' || + uiKey == ' ' ) + { + // if the current string position is at max or great, do nothing + switch( ubTextEnterMode ) + { + case( FULL_NAME_MODE ): + if( uiFullNameCharacterPosition >= MAX_FULL_NAME ) + { + break; + } + else + { + + if(uiFullNameCharacterPosition < 1 ) + { + uiFullNameCharacterPosition = 0; + } + // make sure we haven't moved too far + if( ( uiFullNameCursorPosition + StringPixLength( ( CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > FULL_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X) + { + // do nothing for now, when pop up is in place, display + break; + } + // valid char, capture and convert to CHAR16 + pFullNameString[uiFullNameCharacterPosition] = ( CHAR16 )uiKey; + + + // null out next char position + pFullNameString[uiFullNameCharacterPosition + 1] = 0; + + // move cursor position ahead + uiFullNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pFullNameString, FONT14ARIAL ); + + // increment string position + uiFullNameCharacterPosition +=1; + + // string has been altered, redisplay + fNewCharInString = TRUE; + } + break; + case ( NICK_NAME_MODE ): + if( uiNickNameCharacterPosition >= MAX_NICK_NAME ) + { + break; + } + else + { + + if(uiNickNameCharacterPosition == -1) + { + uiNickNameCharacterPosition = 0; + } + + // make sure we haven't moved too far + if( ( uiNickNameCursorPosition + StringPixLength( (CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > NICK_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X ) + { + // do nothing for now, when pop up is in place, display + break; + } + + // valid char, capture and convert to CHAR16 + pNickNameString[uiNickNameCharacterPosition] = ( CHAR16 )uiKey; + + // null out next char position + pNickNameString[uiNickNameCharacterPosition + 1] = 0; + + // move cursor position ahead + uiNickNameCursorPosition = 196 + LAPTOP_SCREEN_UL_X + StringPixLength( pNickNameString, FONT14ARIAL ); + + // increment string position + uiNickNameCharacterPosition +=1; + + // string has been altered, redisplay + fNewCharInString = TRUE; + } + + break; + } + } + break; + } + return; +} + + + +void DisplayFullNameStringCursor( void ) +{ + // this procdure will draw the activation string cursor on the screen at position cursorx cursory + UINT32 uiDestPitchBYTES; + static UINT32 uiBaseTime = 0; + UINT32 uiDeltaTime = 0; + static UINT32 iCurrentState = 0; + UINT8 *pDestBuf; + static BOOLEAN fIncrement = TRUE; + + if(uiBaseTime == 0) + { + uiBaseTime = GetJA2Clock(); + } + + // get difference + uiDeltaTime = GetJA2Clock() - uiBaseTime; + + // if difference is long enough, rotate colors + if(uiDeltaTime > MIN_GLOW_DELTA) + { + if( iCurrentState == 10) + { + // start rotating downward + fIncrement = FALSE; + } + if( iCurrentState == 0) + { + // rotate colors upward + fIncrement = TRUE; + } + // if increment upward, increment iCurrentState + if(fIncrement) + { + iCurrentState++; + } + else + { + // else downwards + iCurrentState--; + } + // reset basetime to current clock + uiBaseTime = GetJA2Clock( ); + } + + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + // draw line in current state + LineDraw(TRUE, (UINT16) uiFullNameCursorPosition, FULL_NAME_CURSOR_Y - 3, (UINT16)uiFullNameCursorPosition, FULL_NAME_CURSOR_Y + CURSOR_HEIGHT - 2, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), + pDestBuf); + + InvalidateRegion((UINT16) uiFullNameCursorPosition, FULL_NAME_CURSOR_Y - 3 , (UINT16)uiFullNameCursorPosition + 1, FULL_NAME_CURSOR_Y + CURSOR_HEIGHT + 1 - 2); + + // unlock frame buffer + UnLockVideoSurface( FRAME_BUFFER ); + return; +} + + +void DisplayNickNameStringCursor( void ) +{ + // this procdure will draw the activation string cursor on the screen at position cursorx cursory + UINT32 uiDestPitchBYTES; + static UINT32 uiBaseTime = 0; + UINT32 uiDeltaTime = 0; + UINT8 *pDestBuf; + static UINT32 iCurrentState = 0; + static BOOLEAN fIncrement = TRUE; + + if(uiBaseTime == 0) + { + uiBaseTime = GetJA2Clock(); + } + + // get difference + uiDeltaTime = GetJA2Clock() - uiBaseTime; + + // if difference is long enough, rotate colors + if(uiDeltaTime > MIN_GLOW_DELTA) + { + if( iCurrentState == 10) + { + // start rotating downward + fIncrement = FALSE; + } + if( iCurrentState == 0) + { + // rotate colors upward + fIncrement = TRUE; + } + // if increment upward, increment iCurrentState + if(fIncrement) + { + iCurrentState++; + } + else + { + // else downwards + iCurrentState--; + } + // reset basetime to current clock + uiBaseTime = GetJA2Clock( ); + } + + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + // draw line in current state + LineDraw(TRUE, (UINT16) uiNickNameCursorPosition, NICK_NAME_CURSOR_Y, (UINT16)uiNickNameCursorPosition, NICK_NAME_CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), + pDestBuf ); + + InvalidateRegion((UINT16) uiNickNameCursorPosition, NICK_NAME_CURSOR_Y, (UINT16)uiNickNameCursorPosition + 1, NICK_NAME_CURSOR_Y + CURSOR_HEIGHT + 1); + + // unlock frame buffer + UnLockVideoSurface( FRAME_BUFFER ); + return; +} + + +void DisplayPlayerFullNameString( void ) +{ + + // this function will grab the string that the player will enter for activation + INT32 iCounter=0; + + // player gone too far, move back + if(uiFullNameCharacterPosition > MAX_FULL_NAME) + { + uiFullNameCharacterPosition = MAX_FULL_NAME; + } + + // restore background + RenderNameIndent( 194, 132); + + // setup the font stuff + SetFont( FONT14ARIAL ); + SetFontForeground( 184 ); + SetFontBackground(FONT_BLACK); + + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + mprintf(LAPTOP_SCREEN_UL_X + 196, FULL_NAME_CURSOR_Y + 1, pFullNameString); + + + fNewCharInString = FALSE; + fReDrawScreenFlag = TRUE; + return; +} + + +void DisplayPlayerNickNameString( void ) +{ + + // this function will grab the string that the player will enter for activation + INT32 iCounter=0; + + // player gone too far, move back + if(uiNickNameCharacterPosition > MAX_NICK_NAME) + { + uiNickNameCharacterPosition = MAX_NICK_NAME; + } + + // restore background + RenderNickNameIndent( 194, 192); + + // setup the font stuff + SetFont( FONT14ARIAL ); + SetFontForeground( 184 ); + SetFontBackground(FONT_BLACK); + + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + mprintf( LAPTOP_SCREEN_UL_X + 196, NICK_NAME_CURSOR_Y + 4, pNickNameString); + + + fNewCharInString = FALSE; + fReDrawScreenFlag = TRUE; + return; +} + + +void DisplayMaleGlowCursor( void ) +{ + // this procdure will draw the activation string cursor on the screen at position cursorx cursory + UINT32 uiDestPitchBYTES; + static UINT32 uiBaseTime = 0; + UINT32 uiDeltaTime = 0; + static UINT32 iCurrentState = 0; + static BOOLEAN fIncrement = TRUE; + UINT8 *pDestBuf; + + if(uiBaseTime == 0) + { + uiBaseTime = GetJA2Clock(); + } + + // get difference + uiDeltaTime = GetJA2Clock() - uiBaseTime; + + // if difference is long enough, rotate colors + if(uiDeltaTime > MIN_GLOW_DELTA) + { + if( iCurrentState == 10) + { + // start rotating downward + fIncrement = FALSE; + } + if( iCurrentState == 0) + { + // rotate colors upward + fIncrement = TRUE; + } + // if increment upward, increment iCurrentState + if(fIncrement) + { + iCurrentState++; + } + else + { + // else downwards + iCurrentState--; + } + // reset basetime to current clock + uiBaseTime = GetJA2Clock( ); + } + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + // draw rectangle + RectangleDraw( TRUE, MALE_BOX_X, MALE_BOX_Y, MALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), pDestBuf ); + + + InvalidateRegion((UINT16) MALE_BOX_X, MALE_BOX_Y, MALE_BOX_X + MALE_BOX_WIDTH + 1, MALE_BOX_Y + MALE_BOX_HEIGHT + 1); + + // unlock frame buffer + UnLockVideoSurface( FRAME_BUFFER ); + return; +} + + + +void DisplayFemaleGlowCursor( void ) +{ + // this procdure will draw the activation string cursor on the screen at position cursorx cursory + UINT32 uiDestPitchBYTES; + static UINT32 uiBaseTime = 0; + UINT32 uiDeltaTime = 0; + static UINT32 iCurrentState = 0; + static BOOLEAN fIncrement = TRUE; + UINT8 *pDestBuf; + + if(uiBaseTime == 0) + { + uiBaseTime = GetJA2Clock(); + } + + // get difference + uiDeltaTime = GetJA2Clock() - uiBaseTime; + + // if difference is long enough, rotate colors + if(uiDeltaTime > MIN_GLOW_DELTA) + { + if( iCurrentState == 10) + { + // start rotating downward + fIncrement = FALSE; + } + if( iCurrentState == 0) + { + // rotate colors upward + fIncrement = TRUE; + } + // if increment upward, increment iCurrentState + if(fIncrement) + { + iCurrentState++; + } + else + { + // else downwards + iCurrentState--; + } + // reset basetime to current clock + uiBaseTime = GetJA2Clock( ); + } + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + // draw rectangle + RectangleDraw( TRUE, FEMALE_BOX_X, MALE_BOX_Y, FEMALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), pDestBuf ); + + + InvalidateRegion((UINT16) FEMALE_BOX_X, MALE_BOX_Y, FEMALE_BOX_X + MALE_BOX_WIDTH + 1, MALE_BOX_Y + MALE_BOX_HEIGHT + 1); + + // unlock frame buffer + UnLockVideoSurface( FRAME_BUFFER ); + return; +} + + +void CopyFirstNameIntoNickName( void ) +{ + // this procedure will copy the characters first name in to the nickname for the character + UINT32 iCounter=0; + while( ( pFullNameString[ iCounter ] != L' ' ) && ( iCounter < 20) && ( pFullNameString[ iCounter ] != 0 ) ) + { + // copy charcters into nick name + pNickNameString[ iCounter ] = pFullNameString[ iCounter ]; + iCounter++; + } + + return; +} + + +void IncrementTextEnterMode( void ) +{ + // this function will incrment which text enter mode we are in, FULLname, NICKname, IMP_MALE or IMP_FEMALE + + // if at IMP_FEMALE gender selection, reset to full name + if( FEMALE_GENDER_SELECT == ubTextEnterMode) + { + ubTextEnterMode = FULL_NAME_MODE; + } + else + { + // otherwise, next selection + ubTextEnterMode++; + } + +} + +void DecrementTextEnterMode( void ) +{ + // this function will incrment which text enter mode we are in, FULLname, NICKname, IMP_MALE or IMP_FEMALE + + // if at IMP_FEMALE gender selection, reset to full name + if( FULL_NAME_MODE == ubTextEnterMode) + { + ubTextEnterMode = FEMALE_GENDER_SELECT; + } + else + { + // otherwise, next selection + ubTextEnterMode--; + } + +} + +void RenderMaleGenderIcon( void ) +{ + // this function displays a filled box in the IMP_MALE gender box if IMP_MALE has been selected + + // re render indent + RenderGenderIndent( 192, 252 ); + + // IMP_MALE selected draw box + if( bGenderFlag == IMP_MALE ) + { + + } + + +} + +void RenderFemaleGenderIcon( void ) +{ + // this function displays a filled box in the IMP_MALE gender box if IMP_MALE has been selected + + // re render indent + RenderGenderIndent( 302, 252 ); + + // IMP_FEMALE selected draw box + if( bGenderFlag == IMP_FEMALE ) + { + + } + + +} + + +// mouse regions + +void CreateIMPBeginScreenMouseRegions( void ) +{ + // this function creates the IMP mouse regions + + // are we only reviewing text?.. if so, do not create regions + if( ubTextEnterMode == 5 ) + return; + + // full name region + MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 0 ] , LAPTOP_SCREEN_UL_X + 196, LAPTOP_SCREEN_WEB_UL_Y + 135, LAPTOP_SCREEN_UL_X + 196 + FULL_NAME_REGION_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + 135 + 24, MSYS_PRIORITY_HIGH, CURSOR_WWW, + MSYS_NO_CALLBACK, (MOUSE_CALLBACK)SelectFullNameRegionCallBack ); + + + // nick name region + MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 1 ] , LAPTOP_SCREEN_UL_X + 196, LAPTOP_SCREEN_WEB_UL_Y + 195, LAPTOP_SCREEN_UL_X + 196 + NICK_NAME_REGION_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + 195 + 24, MSYS_PRIORITY_HIGH, CURSOR_WWW, + MSYS_NO_CALLBACK, (MOUSE_CALLBACK)SelectNickNameRegionCallBack ); + + // IMP_MALE gender area + MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 2 ] , MALE_BOX_X, MALE_BOX_Y, MALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, MSYS_PRIORITY_HIGH, CURSOR_WWW, + (MOUSE_CALLBACK)MvtOnMaleRegionCallBack, (MOUSE_CALLBACK)SelectMaleRegionCallBack ); + + // IMP_FEMALE gender region + MSYS_DefineRegion(&gIMPBeginScreenMouseRegions[ 3 ] , FEMALE_BOX_X, MALE_BOX_Y, FEMALE_BOX_X + MALE_BOX_WIDTH, MALE_BOX_Y + MALE_BOX_HEIGHT, MSYS_PRIORITY_HIGH, CURSOR_WWW, + (MOUSE_CALLBACK)MvtOnFemaleRegionCallBack, (MOUSE_CALLBACK)SelectFemaleRegionCallBack ); + + + // add regions + MSYS_AddRegion(&gIMPBeginScreenMouseRegions[ 0 ]); + MSYS_AddRegion(&gIMPBeginScreenMouseRegions[ 1 ]); + MSYS_AddRegion(&gIMPBeginScreenMouseRegions[ 2 ]); + MSYS_AddRegion(&gIMPBeginScreenMouseRegions[ 3 ]); + + return; +} + +void DestroyIMPBeginScreenMouseRegions( void ) +{ + // this function destroys the IMP mouse regions + + // are we only reviewing text?.. if so, do not remove regions + if( ubTextEnterMode == 5 ) + return; + + // remove regions + MSYS_RemoveRegion(&gIMPBeginScreenMouseRegions[ 0 ]); + MSYS_RemoveRegion(&gIMPBeginScreenMouseRegions[ 1 ]); + MSYS_RemoveRegion(&gIMPBeginScreenMouseRegions[ 2 ]); + MSYS_RemoveRegion(&gIMPBeginScreenMouseRegions[ 3 ]); + + + return; +} + + +void SelectFullNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + + // set current mode to full name type in mode + ubTextEnterMode = FULL_NAME_MODE; + fNewCharInString = TRUE; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + +void SelectNickNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + + // set mode to nick name type in + ubTextEnterMode = NICK_NAME_MODE; + fNewCharInString = TRUE; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + +void SelectMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + + // set mode to nick name type in + bGenderFlag = IMP_MALE; + fNewCharInString = TRUE; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + +void SelectFemaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + + // set mode to nick name type in + bGenderFlag = IMP_FEMALE; + fNewCharInString = TRUE; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + +void MvtOnFemaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if ( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + //fNewCharInString = TRUE; + } + else if( iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE) + { + ubTextEnterMode = FEMALE_GENDER_SELECT; + fNewCharInString = TRUE; + } +} + + +void MvtOnMaleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if ( iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + //fNewCharInString = TRUE; + } + else if( iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE) + { + ubTextEnterMode = MALE_GENDER_SELECT; + fNewCharInString = TRUE; + } +} + +void RenderGender( void ) +{ + // this procedure will render the gender of the character int he appropriate box + + // check to see if gender has been in fact set + if( bGenderFlag == -1 ) + { + // nope, leave + return; + } + + SetFontBackground( FONT_BLACK ); + SetFontForeground( 184 ); + if( bGenderFlag == IMP_MALE ) + { + // IMP_MALE, render x in IMP_MALE box + mprintf( MALE_BOX_X + 9, MALE_BOX_Y + 6, L"X" ); + } + else + { + // IMP_FEMALE, render x in IMP_FEMALE box + mprintf(FEMALE_BOX_X + 9, MALE_BOX_Y + 6, L"X"); + } +} + +void Print8CharacterOnlyString( void ) +{ + + SetFontBackground( FONT_BLACK ); + SetFontForeground( FONT_BLACK ); + SetFont( FONT12ARIAL ); + SetFontShadow(NO_SHADOW); + + mprintf(iScreenWidthOffset + 430, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y + 228,pIMPBeginScreenStrings[ 0 ]); + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + + +} + +BOOLEAN CheckCharacterInputForEgg( void ) +{ + MERC_HIRE_STRUCT HireMercStruct; + +#ifndef JA2BETAVERSION + return( FALSE ); +#else +#ifndef _DEBUG + return( FALSE ); +#else + if( ( wcscmp( pFullNameString, L"retraC kraM") == 0 ) && ( wcscmp( pNickNameString, L"BdyCnt") ) ) + { + wcscpy( pFullNameString, L"Mark Carter"); + wcscpy( pNickNameString, L"BodyCount"); + bGenderFlag = IMP_MALE; + iHealth = 99; + iAgility = 99; + iStrength = 99; + iDexterity = 99; + iWisdom = 35; + iLeadership = 35; + iMarksmanship = 99; + iMechanical = 0; + iExplosives = 99; + iMedical = 0; + iSkillA = AMBIDEXT; + iSkillB = AUTO_WEAPS; + iPersonality = NO_PERSONALITYTRAIT; + iAttitude = ATT_ASSHOLE; + iCurrentImpPage = IMP_FINISH; + LaptopSaveInfo.iVoiceId = 1; + iPortraitNumber = 2; + return TRUE; + } + else if ( ( wcscmp( pFullNameString, L"hcnerF evaD") == 0)&&( wcscmp( pNickNameString, L"Feral") == 0)) + { + wcscpy( pFullNameString, L"Dave French"); + wcscpy( pNickNameString, L"Feral"); + bGenderFlag = IMP_MALE; + iHealth = 90; + iAgility = 95; + iStrength = 90; + iDexterity = 95; + iWisdom = 60; + iLeadership = 60; + iMarksmanship = 89; + iMechanical = 40; + iExplosives = 25; + iMedical = 60; + iSkillA = MARTIALARTS; + iSkillB = AUTO_WEAPS; + iPersonality = NO_PERSONALITYTRAIT; + iAttitude = ATT_FRIENDLY; + iCurrentImpPage = IMP_FINISH; + LaptopSaveInfo.iVoiceId = 1; + iPortraitNumber = 1; + return TRUE; + } + else if ( ( wcscmp( pFullNameString, L"Marnes") == 0)&&( wcscmp( pNickNameString, L"Marnes") == 0)) + { + wcscpy( pFullNameString, L"Kris Marnes"); + wcscpy( pNickNameString, L"Marnes"); + bGenderFlag = IMP_MALE; + iHealth = 100; + iAgility = 100; + iStrength = 100; + iDexterity = 100; + iWisdom = 100; + iLeadership = 100; + iMarksmanship = 100; + iMechanical = 100; + iExplosives = 100; + iMedical = 100; + iSkillA = MARTIALARTS; + iSkillB = AUTO_WEAPS; + iPersonality = NO_PERSONALITYTRAIT; + iAttitude = ATT_FRIENDLY; + iCurrentImpPage = IMP_FINISH; + LaptopSaveInfo.iVoiceId = 2; + iPortraitNumber = 1; + return TRUE; + } + else if( ( wcscmp( pFullNameString, L"neslO namroN") == 0 ) && ( wcscmp( pNickNameString, L"N.R.G") == 0) ) + { + wcscpy( pFullNameString, L"Norman Olsen"); + wcscpy( pNickNameString, L"N.R.G"); + bGenderFlag = IMP_MALE; + iHealth = 99; + iAgility = 99; + iStrength = 99; + iDexterity = 90; + iWisdom = 70; + iLeadership = 35; + + iMarksmanship = 70; + iMechanical = 65; + iExplosives = 99; + iMedical = 75; + + iSkillA = STEALTHY; + iSkillB = MARTIALARTS; + + iPersonality = NO_PERSONALITYTRAIT; + iAttitude = ATT_AGGRESSIVE; + iCurrentImpPage = IMP_FINISH; + LaptopSaveInfo.iVoiceId = 1; + iPortraitNumber = 4; + return TRUE; + } + else if( ( wcscmp( pFullNameString, L"snommE werdnA") == 0 ) && ( wcscmp( pNickNameString, L"Bubba") == 0) ) + { + wcscpy( pFullNameString, L"Andrew Emmons"); + wcscpy( pNickNameString, L"Bubba"); + bGenderFlag =IMP_MALE; + iHealth = 97; + iAgility = 98; + iStrength = 80; + iDexterity = 80; + iWisdom = 99; + iLeadership = 99; + + iMarksmanship = 99; + iMechanical = 0; + iExplosives = 0; + iMedical = 99; + + iSkillA = AUTO_WEAPS; + iSkillB = AMBIDEXT; + + iPersonality = NO_PERSONALITYTRAIT; + iAttitude = ATT_ARROGANT; + iCurrentImpPage = IMP_FINISH; + LaptopSaveInfo.iVoiceId = 1; + iPortraitNumber = 2; + return TRUE; + } + else if( ( wcscmp( pFullNameString, L"nalehW yeoJ") == 0 ) && ( wcscmp( pNickNameString, L"Joeker") == 0) ) + { + wcscpy( pFullNameString, L"Joey Whelan"); + wcscpy( pNickNameString, L"Joeker"); + bGenderFlag = 0; + iHealth = 99; + iAgility = 99; + iStrength = 99; + iDexterity = 99; + iWisdom = 70; + iLeadership = 80; + + iMarksmanship = 99; + iMechanical = 35; + iExplosives = 99; + iMedical = 35; + + iSkillA = AUTO_WEAPS; + iSkillB = MARTIALARTS; + + iPersonality = NO_PERSONALITYTRAIT; + iAttitude = ATT_AGGRESSIVE; + iCurrentImpPage = IMP_FINISH; + LaptopSaveInfo.iVoiceId = 1; + iPortraitNumber = 4; + return TRUE; + } + else if( ( wcscmp( pFullNameString, L"gnehC cirE") == 0 ) && ( wcscmp( pNickNameString, L"BlakAddr") == 0) ) + { + wcscpy( pFullNameString, L"Eric Cheng"); + wcscpy( pNickNameString, L"BlakAddr"); + bGenderFlag = IMP_MALE; + iHealth = 99; + iAgility = 99; + iStrength = 99; + iDexterity = 99; + iWisdom = 99; + iLeadership = 70; + + iMarksmanship = 99; + iMechanical = 50; + iExplosives = 99; + iMedical = 0; + + iSkillA = AUTO_WEAPS; + iSkillB = MARTIALARTS; + + iPersonality = NO_PERSONALITYTRAIT; + iAttitude = ATT_LONER; + iCurrentImpPage = IMP_FINISH; + LaptopSaveInfo.iVoiceId = 1; + iPortraitNumber = 3; + return TRUE; + } + else if( ( wcscmp( pFullNameString, L"Karters Killer Kru") == 0 ) && ( wcscmp( pNickNameString, L"Bitchin") == 0) ) + { + wcscpy( pFullNameString, L"Mark Carter"); + wcscpy( pNickNameString, L"BodyCount"); + bGenderFlag = IMP_MALE; + iHealth = 99; + iAgility = 99; + iStrength = 99; + iDexterity = 99; + iWisdom = 35; + iLeadership = 35; + iMarksmanship = 99; + iMechanical = 0; + iExplosives = 99; + iMedical = 0; + iSkillA = AMBIDEXT; + iSkillB = AUTO_WEAPS; + iPersonality = PSYCHO; + iAttitude = ATT_ASSHOLE; + iCurrentImpPage = IMP_FINISH; + LaptopSaveInfo.iVoiceId = 1; + iPortraitNumber = 2; + + //DEF: temp + HireMercStruct.sSectorX = gsMercArriveSectorX; + HireMercStruct.sSectorY = gsMercArriveSectorY; + HireMercStruct.bSectorZ = 0; + HireMercStruct.fUseLandingZoneForArrival = TRUE; + HireMercStruct.ubInsertionCode = INSERTION_CODE_ARRIVING_GAME; + HireMercStruct.fCopyProfileItemsOver = TRUE; + HireMercStruct.iTotalContractLength = 365; + //specify when the merc should arrive + HireMercStruct.uiTimeTillMercArrives = GetMercArrivalTimeOfDay( ); + + HireMercStruct.ubProfileID = 12; + HireMerc( &HireMercStruct ); + + HireMercStruct.ubProfileID = 10; + HireMerc( &HireMercStruct ); + + HireMercStruct.ubProfileID = 25; + HireMerc( &HireMercStruct ); + + HireMercStruct.ubProfileID = 2; + HireMerc( &HireMercStruct ); + + HireMercStruct.ubProfileID = 20; + HireMerc( &HireMercStruct ); + + return TRUE; + } + else if( ( wcscmp( pFullNameString, L"dleifmaC sirhC") == 0 ) && ( wcscmp( pNickNameString, L"SSR") == 0) ) + { + wcscpy( pFullNameString, L"James Bolivar DiGriz"); + wcscpy( pNickNameString, L"DiGriz"); + bGenderFlag = IMP_MALE; + iHealth = 99; + iAgility = 80; + iStrength = 80; + iDexterity = 99; + iWisdom = 70; + iLeadership = 70; + + iMarksmanship = 99; + iMechanical = 99; + iExplosives = 99; + iMedical = 60; + + iSkillA = ELECTRONICS; + iSkillB = LOCKPICKING; + + iPersonality = NO_PERSONALITYTRAIT; + iAttitude = ATT_LONER; + iCurrentImpPage = IMP_FINISH; + LaptopSaveInfo.iVoiceId = 1; + iPortraitNumber = 3; + return TRUE; + } + #endif + #endif + if( ( wcscmp( pFullNameString, L"Test Female") == 0 ) && ( wcscmp( pNickNameString, L"Test") == 0) ) + { + wcscpy( pFullNameString, L"Test Female"); + wcscpy( pNickNameString, L"Test"); + bGenderFlag = IMP_FEMALE; + iHealth = 55; + iAgility = 55; + iStrength = 55; + iDexterity = 55; + iWisdom = 55; + iLeadership = 55; + + iMarksmanship = 55; + iMechanical = 55; + iExplosives = 55; + iMedical = 55; + + iSkillA = 0; + iSkillB = 0; + + iPersonality = NO_PERSONALITYTRAIT; + iAttitude = ATT_LONER; + iCurrentImpPage = IMP_FINISH; + LaptopSaveInfo.iVoiceId = 1; + iPortraitNumber = 5; + return (TRUE ); + } + return FALSE; + +} \ No newline at end of file diff --git a/Laptop/IMP Begin Screen.h b/Laptop/IMP Begin Screen.h new file mode 100644 index 00000000..cbaa7594 --- /dev/null +++ b/Laptop/IMP Begin Screen.h @@ -0,0 +1,12 @@ +#ifndef _IMP_BEGINSCREEN_H +#define _IMP_BEGINSCREEN_H + + +void EnterIMPBeginScreen( void ); +void RenderIMPBeginScreen( void ); +void ExitIMPBeginScreen( void ); +void HandleIMPBeginScreen( void ); + + + +#endif \ No newline at end of file diff --git a/Laptop/IMP Compile Character.cpp b/Laptop/IMP Compile Character.cpp new file mode 100644 index 00000000..a4dfa4e8 --- /dev/null +++ b/Laptop/IMP Compile Character.cpp @@ -0,0 +1,1001 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" + #include "IMP Skill Trait.h" + #include "GameSettings.h" +#else + #include "laptop.h" + #include "CharProfile.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "GameSettings.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "IMP AboutUs.h" + #include "IMP MainPage.h" + #include "IMP Begin Screen.h" + #include "IMP Personality Entrance.h" + #include "IMP Personality Quiz.h" + #include "IMP Personality Finish.h" + #include "IMP Skill Trait.h" + #include "IMP Attribute Entrance.h" + #include "IMP Attribute Selection.h" + #include "IMP Attribute Finish.h" + #include "IMP Portraits.h" + #include "IMP Compile Character.h" + #include "IMP Voices.h" + #include "IMP Finish.h" + #include "Soldier Profile Type.h" + #include "Soldier Profile.h" + #include "Animation Data.h" + #include "random.h" +#endif + +// how many times should a 'die' be rolled for skills of the same type? + +#define HOW_MANY_ROLLS_FOR_SAME_SKILL_CHECK 20 + +INT32 AttitudeList[ ATTITUDE_LIST_SIZE ]; +INT32 iLastElementInAttitudeList = 0; + +INT32 SkillsList[ ATTITUDE_LIST_SIZE ]; +INT32 BackupSkillsList[ ATTITUDE_LIST_SIZE ]; +INT32 iLastElementInSkillsList = 0; + +INT32 PersonalityList[ ATTITUDE_LIST_SIZE ]; +INT32 iLastElementInPersonalityList = 0; + +extern BOOLEAN fLoadingCharacterForPreviousImpProfile; + +// positions of the face x and y for eyes and mouth for the 10 portraits +INT16 sFacePositions[ NUMBER_OF_PLAYER_PORTRAITS ][ 4 ]= +{ + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, + {0,0,0,0}, +}; + +STR8 pPlayerSelectedFaceFileNames[ NUMBER_OF_PLAYER_PORTRAITS ]= +{ + "Faces\\200.sti", + "Faces\\201.sti", + "Faces\\202.sti", + "Faces\\203.sti", + "Faces\\204.sti", + "Faces\\205.sti", + "Faces\\206.sti", + "Faces\\207.sti", + "Faces\\208.sti", + "Faces\\209.sti", + "Faces\\210.sti", + "Faces\\211.sti", + "Faces\\212.sti", + "Faces\\213.sti", + "Faces\\214.sti", + "Faces\\215.sti", +}; + +STR8 pPlayerSelectedBigFaceFileNames[ NUMBER_OF_PLAYER_PORTRAITS ]= +{ + "Faces\\BigFaces\\200.sti", + "Faces\\BigFaces\\201.sti", + "Faces\\BigFaces\\202.sti", + "Faces\\BigFaces\\203.sti", + "Faces\\BigFaces\\204.sti", + "Faces\\BigFaces\\205.sti", + "Faces\\BigFaces\\206.sti", + "Faces\\BigFaces\\207.sti", + "Faces\\BigFaces\\208.sti", + "Faces\\BigFaces\\209.sti", + "Faces\\BigFaces\\210.sti", + "Faces\\BigFaces\\211.sti", + "Faces\\BigFaces\\212.sti", + "Faces\\BigFaces\\213.sti", + "Faces\\BigFaces\\214.sti", + "Faces\\BigFaces\\215.sti", +}; + + +// function declarations +void SelectMercFace( void ); +void SetMercSkinAndHairColors( void ); +BOOLEAN ShouldThisMercHaveABigBody( void ); + + + + + +void CreateACharacterFromPlayerEnteredStats( void ) +{ + + // Kaiden: Seems like as good a place as any to stash this function call to + // ensure that these lists don't get overwritten or Nulled due to the amount + // of changes and revisions that have been made to personalities and attitudes. + CreatePlayersPersonalitySkillsAndAttitude(); + + + + // copy over full name + wcscpy( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].zName, pFullName ); + + // the nickname + wcscpy( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].zNickname, pNickName ); + + // gender + if ( fCharacterIsMale == TRUE ) + { + // male + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSex = MALE; + } + else + { + // female + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSex = FEMALE; + } + + + // attributes + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLifeMax = ( INT8 )iHealth; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLife = ( INT8 )iHealth; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bAgility = ( INT8 )iAgility; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bStrength = ( INT8 )iStrength; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bDexterity = ( INT8 )iDexterity; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bWisdom = ( INT8 )iWisdom; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLeadership = ( INT8 )iLeadership; + + + // skills + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMarksmanship = ( INT8 )iMarksmanship; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMedical = ( INT8 )iMedical; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMechanical = ( INT8 )iMechanical; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bExplosive = ( INT8 )iExplosives; + + + // personality + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bPersonalityTrait = ( INT8 )iPersonality; + + // attitude + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bAttitude = ( INT8 )iAttitude; + + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bExpLevel = 1; + + // set time away + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMercStatus = 0; + + + + // face + SelectMercFace( ); + + return; + +} + + +BOOLEAN DoesCharacterHaveAnAttitude( void ) +{ + + // simply checks if caracter has an attitude other than normal + switch( iAttitude ) + { + case ATT_LONER: + case ATT_PESSIMIST: + case ATT_ARROGANT: + case ATT_BIG_SHOT: + case ATT_ASSHOLE: + case ATT_COWARD: + return( TRUE ); + default: + return( FALSE ); + } +} + + +BOOLEAN DoesCharacterHaveAPersoanlity( void ) +{ + + + if( iPersonality != NO_PERSONALITYTRAIT ) + { + // yep + return ( TRUE ); + } + else + { + // nope + return ( FALSE ); + } + + + // Kaiden: Following is the original UB section: + // The fist return( FALSE ); Statement was the only + // thing uncommented. +/* + // only one we can get is PSYCHO, and that is not much of a penalty + return( FALSE ); + + // simply checks if caracter has a personality other than normal + if( iPersonality != NO_PERSONALITYTRAIT ) + { + // yep + return ( TRUE ); + } + else + { + // nope + return ( FALSE ); + } + */ + + +} + +void CreatePlayerAttitude( void ) +{ + + if(gGameExternalOptions.fPers_att) + { + AddAnAttitudeToAttitudeList( ATT_OPTIMIST ); + AddAnAttitudeToAttitudeList( ATT_LONER ); + AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); + AddAnAttitudeToAttitudeList( ATT_ARROGANT ); + AddAnAttitudeToAttitudeList( ATT_NORMAL ); + AddAnAttitudeToAttitudeList( ATT_ASSHOLE ); + AddAnAttitudeToAttitudeList( ATT_COWARD ); + AddAnAttitudeToAttitudeList( ATT_AGGRESSIVE ); + AddAnAttitudeToAttitudeList( ATT_PESSIMIST ); + AddAnAttitudeToAttitudeList( ATT_BIG_SHOT ); + + // this function will 'roll a die' and decide if any attitude does exists + INT32 iDiceValue = 0; + INT32 iCounter = 0, iCounter2 = 0; + + INT32 iAttitudeHits[NUM_ATTITUDES] = { 0 }; + INT32 iHighestHits = 0; + INT32 iNumAttitudesWithHighestHits = 0; + + iAttitude = ATT_NORMAL; + + if ( iLastElementInAttitudeList == 0 ) + { + return; + } + + // count # of hits for each attitude + for ( iCounter = 0; iCounter < iLastElementInAttitudeList; iCounter++ ) + { + iAttitudeHits[ AttitudeList[ iCounter ] ]++; + } + + // find highest # of hits for any attitude + for ( iCounter = 0; iCounter < NUM_ATTITUDES; iCounter++ ) + { + if ( iAttitudeHits[ iCounter ] ) + { + if ( iAttitudeHits[ iCounter ] > iHighestHits ) + { + iHighestHits = __max( iHighestHits, iAttitudeHits[ iCounter ] ); + iNumAttitudesWithHighestHits = 1; + } + else if ( iAttitudeHits[ iCounter ] == iHighestHits ) + { + iNumAttitudesWithHighestHits++; + } + } + } + + // roll dice + iDiceValue = Random( iNumAttitudesWithHighestHits + 1 ); + + // find attitude + for ( iCounter = 0; iCounter < NUM_ATTITUDES; iCounter++ ) + { + if ( iAttitudeHits[ iCounter ] == iHighestHits ) + { + if ( iCounter2 == iDiceValue ) + { + // this is it! + iAttitude = iCounter2; + break; + } + else + { + // one of the next attitudes... + iCounter2++; + } + } + } + } + else + { + iAttitude = gGameExternalOptions.iCustomAttitude; + } +} + + +void AddAnAttitudeToAttitudeList( INT8 bAttitude ) +{ + // adds an attitude to attitude list + + if( iLastElementInAttitudeList < ATTITUDE_LIST_SIZE) + { + // add element + AttitudeList[ iLastElementInAttitudeList ] = ( INT32 )bAttitude; + + // increment attitude list counter + iLastElementInAttitudeList++; + } + + return; +} + + +void AddSkillToSkillList( INT8 bSkill ) +{ + // adds a skill to skills list + + if( iLastElementInSkillsList < ATTITUDE_LIST_SIZE) + { + // add element + SkillsList[ iLastElementInSkillsList ] = ( INT32 )bSkill; + + // increment attitude list counter + iLastElementInSkillsList++; + } + + return; +} + +// Kaiden : Added to clear the list when first visiting the IMP homepage, +// Or for each visit there after. +void ClearAllSkillsList( void ) +{ + INT32 iLoop; + + for ( iLoop = 0; iLoop < iLastElementInSkillsList; iLoop++ ) + { + SkillsList[ iLoop ] = 0; + } + iLastElementInSkillsList = 0; + return; +} + + + +void RemoveSkillFromSkillsList( INT32 iIndex ) +{ + INT32 iLoop; + + // remove a skill from the index given and shorten the list + if ( iIndex < iLastElementInSkillsList ) + { + memset( BackupSkillsList, 0, ATTITUDE_LIST_SIZE * sizeof( INT32 ) ); + + // use the backup array to create a version of the array without + // this index + for ( iLoop = 0; iLoop < iIndex; iLoop++ ) + { + BackupSkillsList[ iLoop ] = SkillsList[ iLoop ]; + } + for ( iLoop = iIndex + 1; iLoop < iLastElementInSkillsList; iLoop++ ) + { + BackupSkillsList[ iLoop - 1 ] = SkillsList[ iLoop ]; + } + // now copy this over to the skills list + memcpy( SkillsList, BackupSkillsList, ATTITUDE_LIST_SIZE * sizeof( INT32 ) ); + + // reduce recorded size by 1 + iLastElementInSkillsList--; + } +} + +INT32 FindSkillInSkillsList( INT32 iSkill ) +{ + INT32 iLoop; + + for ( iLoop = 0; iLoop < iLastElementInSkillsList; iLoop++ ) + { + if ( SkillsList[ iLoop ] == iSkill ) + { + return( iLoop ); + } + } + + return( -1 ); +} + +void ValidateSkillsList( void ) +{ + INT32 iIndex;//, iValue; + MERCPROFILESTRUCT * pProfile; + + // remove from the generated traits list any traits that don't match + // the character's skills + pProfile = &(gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ]); + if ( pProfile->bMechanical == 0 ) + { + // without mechanical, electronics is useless + iIndex = FindSkillInSkillsList( ELECTRONICS ); + if ( iIndex != -1 ) + { + pProfile->bMechanical = 1; + } + } + + // Kaiden using UB's code, lockpicking can't be removed from the list "yet". + // special check for lockpicking + //iValue = pProfile->bMechanical; + //iValue = ( iValue * pProfile->bWisdom ) / 100; + //iValue = ( iValue * pProfile->bDexterity ) / 100; + //if ( iValue + gbSkillTraitBonus[ LOCKPICKING ] < 50 ) + //{ + // // not good enough for lockpicking! + // + // // so is lockpicking + // iIndex = FindSkillInSkillsList( LOCKPICKING ); + // while ( iIndex != -1 ) + // { + // RemoveSkillFromSkillsList( iIndex ); + // iIndex = FindSkillInSkillsList( LOCKPICKING ); + // } + //} + + if ( pProfile->bMarksmanship == 0 ) + { + // without marksmanship, the following traits are useless: + // auto weapons, heavy weapons + iIndex = FindSkillInSkillsList( AUTO_WEAPS ); + if( iIndex != -1 ) + { + //RemoveSkillFromSkillsList( iIndex ); + //iIndex = FindSkillInSkillsList( AUTO_WEAPS ); + pProfile->bMarksmanship = 1; + } + // so is lockpicking + iIndex = FindSkillInSkillsList( HEAVY_WEAPS ); + if( iIndex != -1 ) + { + //RemoveSkillFromSkillsList( iIndex ); + //iIndex = FindSkillInSkillsList( HEAVY_WEAPS ); + pProfile->bMarksmanship = 1; + } + } +} + +void CreatePlayerSkills( void ) +{ + + // this function will 'roll a die' and decide if any attitude does exists + INT32 iDiceValue = 0; + INT32 iCounter = 0; + + ValidateSkillsList(); +/* Kaiden - Commented out in UB to skip the whole random skill thing + // roll dice + iDiceValue = Random( iLastElementInSkillsList ); + + // set attitude + iSkillA = SkillsList[ iDiceValue ]; + + // second dice value + iDiceValue = Random( iLastElementInSkillsList ); + + iSkillB = SkillsList[ iDiceValue ]; +*/ + + // Kaiden: This section was added in it's place: + if( iLastElementInSkillsList > 0 ) + { + // set attitude + iSkillA = SkillsList[ 0 ]; + } + + if( iLastElementInSkillsList > 1 ) + { + iSkillB = SkillsList[ 1 ]; + } + else + { + iSkillB = SkillsList[ 0 ]; + } + + // allow expert level for generated merc so you CAN have two of the same + // but there is no such thing as expert level for electronics + + + while ( iSkillA == iSkillB && ( iSkillB == ELECTRONICS || iSkillB == AMBIDEXT ) ) + { + // remove electronics as an option and roll again + RemoveSkillFromSkillsList( iDiceValue ); + if ( iLastElementInSkillsList == 0 ) + { + // ok, only one trait! + iSkillB = NO_SKILLTRAIT; + break; + } + else + { + iDiceValue = Random( iLastElementInSkillsList ); + iSkillB = SkillsList[ iDiceValue ]; + } + } + + /* + // are the same, + // reroll until different, or until ATTITUDE_LIST_SIZE times + iSkillB = Random( iLastElementInSkillsList + 1 ); + + while( (iSkillA == iSkillB ) && ( iCounter < HOW_MANY_ROLLS_FOR_SAME_SKILL_CHECK ) ) + { + // increment counter + iCounter++; + + // next random + iSkillB = Random( iLastElementInSkillsList + 1 ); + + } + if( iCounter == ATTITUDE_LIST_SIZE ) + { + iSkillB = NO_SKILLTRAIT; + } + return; + + + */ +} + + +void AddAPersonalityToPersonalityList( INT8 bPersonlity ) +{ + // CJC, Oct 26 98: prevent personality list from being generated + // because no dialogue was written to support PC personality quotes + + // BUT we can manage this for PSYCHO okay + + //Kaiden: But we're going to try it anyway screw dialoge. + // Commenting out the below if test + + //if ( bPersonlity != PSYCHO ) + //{ + // return; + //} + + // will add a persoanlity to persoanlity list + if( iLastElementInPersonalityList < ATTITUDE_LIST_SIZE) + { + // add element + PersonalityList[ iLastElementInPersonalityList ] = ( INT32 )bPersonlity; + + // increment attitude list counter + iLastElementInPersonalityList++; + } + + return; +} + +void CreatePlayerPersonality( void ) +{ + + // Kaiden: Added for optional Mercenary personalities and attitudes + + if(gGameExternalOptions.fPers_att) + { + // Kaiden: More chances for Psycho and Normal. + AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); + AddAPersonalityToPersonalityList( PSYCHO ); + AddAPersonalityToPersonalityList( FORGETFUL ); + AddAPersonalityToPersonalityList( NERVOUS ); + AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); + AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); + AddAPersonalityToPersonalityList( PSYCHO ); + AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); + AddAPersonalityToPersonalityList( NONSWIMMER ); + AddAPersonalityToPersonalityList( FEAR_OF_INSECTS ); + AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); + AddAPersonalityToPersonalityList( PSYCHO ); + AddAPersonalityToPersonalityList( FORGETFUL ); + AddAPersonalityToPersonalityList( NERVOUS ); + AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); + AddAPersonalityToPersonalityList( NO_PERSONALITYTRAIT ); + AddAPersonalityToPersonalityList( PSYCHO ); + AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); + AddAPersonalityToPersonalityList( NONSWIMMER ); + AddAPersonalityToPersonalityList( FEAR_OF_INSECTS ); + + + INT32 iDiceValue = 0; + INT32 iCounter = 0; + INT32 iCounter2 = 0; + + // Kaiden: Roll dice 20 times just to be on the safe side + // was getting too many repeats. Will end up scrapping + // rand() later anyway so will worry about fixing it then. + for (iCounter2 = 0; iCounter < 20; iCounter2++) + { + iDiceValue = Random( iLastElementInPersonalityList + 1 ); + } + + // Kaiden two chances to avoid a normal personality. As IMP + // says, They check it twice just to make sure :p + for( iCounter = 0; iCounter < iLastElementInPersonalityList; iCounter++ ) + { + + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("iDiceValue = %d",iDiceValue)); + + if( PersonalityList[ iDiceValue ] = NO_PERSONALITYTRAIT ) + { + //Kaiden: Roll one more time for good measure: + iDiceValue = Random( iLastElementInPersonalityList + 1 ); + } + } + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("And our Personality is... = %d",PersonalityList[ iDiceValue ])); + iPersonality = PersonalityList[ iDiceValue ]; + } + else + { + iPersonality = gGameExternalOptions.iCustomPersonality; + } + return; + +} + + +void CreatePlayersPersonalitySkillsAndAttitude( void ) +{ + + + + + // creates personality, skills and attitudes from curretly built list + + // personality + CreatePlayerPersonality( ); + + // skills are now created later after stats have been chosen + //CreatePlayerSkills( ); + + // attitude + CreatePlayerAttitude( ); + + return; +} + + +void ResetSkillsAttributesAndPersonality( void ) +{ + + // reset count of skills attributes and personality + + iLastElementInPersonalityList = 0; + + iLastElementInSkillsList = 0; + + iLastElementInAttitudeList = 0; + +} + + +void ResetIncrementCharacterAttributes( void ) +{ + // this resets any increments due to character generation + + // attributes + iAddStrength = 0; + iAddDexterity = 0; + iAddWisdom = 0; + iAddAgility = 0; + iAddHealth = 0; + iAddLeadership = 0; + + // skills + iAddMarksmanship = 0; + iAddExplosives = 0; + iAddMedical = 0; + iAddMechanical = 0; + +} + +void SelectMercFace( void ) +{ + // this procedure will select the approriate face for the merc and save offsets + + // grab face filename +// strcpy( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].ubUnusedFaceFileName , pPlayerSelectedFaceFileNames[ iPortraitNumber ]); + + // now the offsets + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].ubFaceIndex = 200 + ( UINT8 )iPortraitNumber; + + // eyes + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].usEyesX = sFacePositions[ iPortraitNumber ][ 0 ]; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].usEyesY = sFacePositions[ iPortraitNumber ][ 1 ]; + + // mouth + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].usMouthX = sFacePositions[ iPortraitNumber ][ 2 ]; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].usMouthY = sFacePositions[ iPortraitNumber ][ 3 ]; + + // set merc skins and hair color + SetMercSkinAndHairColors( ); + return; +} + +void SetMercSkinAndHairColors( void ) +{ + enum{ PINKSKIN, TANSKIN, DARKSKIN, BLACKSKIN, NUMSKINS }; + enum{ BROWNHEAD, BLACKHEAD, //black skin (only this line ) + WHITEHEAD, //dark skin (this line plus all above) + BLONDHEAD, REDHEAD, //pink/tan skin (this line plus all above ) + NUMHEADS + }; + + enum + { + WHITEVEST, + GYELLOWSHIRT, + YELLOWVEST, + GREYVEST, + BROWNVEST, + PURPLESHIRT, + BLUEVEST, + JEANVEST, + GREENVEST, + REDVEST, + BLACKSHIRT, + NUMSHIRTS + };//shirts + + enum + { + BLUEPANTS, + BLACKPANTS, + JEANPANTS, + TANPANTS, + BEIGEPANTS, + GREENPANTS, + NUMPANTS + };//pants + + // skin strings + STR sSkinStrings[]={ + "PINKSKIN", + "TANSKIN", + "DARKSKIN", + "BLACKSKIN", + }; + + // the hair colors + STR sHairStrings[]={ + "BROWNHEAD", + "BLACKHEAD", + "WHITEHEAD", + "BLONDHEAD", + "REDHEAD", + }; + + // shirts + STR sShirtStrings[]={ + "WHITEVEST", + "GYELLOWSHIRT", + "YELLOWVEST", + "greyVEST", + "BROWNVEST", + "PURPLESHIRT", + "BLUEVEST", + "JEANVEST", + "GREENVEST", + "REDVEST", + "BLACKSHIRT", + };//shirts + + + // shirts + STR sPantStrings[]={ + "BLUEPANTS", + "BLACKPANTS", + "JEANPANTS", + "TANPANTS", + "BEIGEPANTS", + "GREENPANTS", + };//pants + + // given the portrait number, set the merc's skin and hair color + INT16 sSkinColor = 0, sHairColor = 0, sShirtColor, sPantColor; + + switch( iPortraitNumber ) + { + case( 0 ): + sSkinColor = BLACKSKIN; + sHairColor = BROWNHEAD; + sShirtColor = JEANVEST; + sPantColor = JEANPANTS; + break; + case( 1 ): + sSkinColor = TANSKIN; + sHairColor = BROWNHEAD; + sShirtColor = BROWNVEST; + sPantColor = TANPANTS; + break; + case( 2 ): + sSkinColor = TANSKIN; + sHairColor = BROWNHEAD; + sShirtColor = WHITEVEST; + sPantColor = BLUEPANTS; + break; + case( 3 ): + sSkinColor = DARKSKIN; + sHairColor = BROWNHEAD; + sShirtColor = WHITEVEST; + sPantColor = BLACKPANTS; + break; + case( 4 ): + sSkinColor = TANSKIN; + sHairColor = BROWNHEAD; + sShirtColor = GREYVEST; + sPantColor = GREENPANTS; + break; + case( 5 ): + sSkinColor = DARKSKIN; + sHairColor = BLACKHEAD; + sShirtColor = GREYVEST; + sPantColor = BLACKPANTS; + break; + case( 6 ): + sSkinColor = TANSKIN; + sHairColor = BROWNHEAD; + sShirtColor = BROWNVEST; + sPantColor = BLUEPANTS; + break; + case( 7 ): + sSkinColor = TANSKIN; + sHairColor = BROWNHEAD; + sShirtColor = BLACKSHIRT; + sPantColor = BLACKPANTS; + break; + case( 8 ): + sSkinColor = TANSKIN; + sHairColor = BROWNHEAD; + sShirtColor = BROWNVEST; + sPantColor = TANPANTS; + break; + case( 9 ): + sSkinColor = PINKSKIN; + sHairColor = BROWNHEAD; + sShirtColor = BROWNVEST; + sPantColor = BEIGEPANTS; + break; + case( 10 ): + sSkinColor = TANSKIN; + sHairColor = BLACKHEAD; + sShirtColor = BROWNVEST; + sPantColor = BLACKPANTS; + break; + case( 11 ): + sSkinColor = TANSKIN; + sHairColor = BLACKHEAD; + sShirtColor = BLACKSHIRT; + sPantColor = BLACKPANTS; + break; + case( 12 ): + sSkinColor = PINKSKIN; + sHairColor = BROWNHEAD; + sShirtColor = WHITEVEST; + sPantColor = GREENPANTS; + break; + case( 13 ): + sSkinColor = BLACKSKIN; + sHairColor = BROWNHEAD; + sShirtColor = GREYVEST; + sPantColor = BLACKPANTS; + break; + case( 14 ): + sSkinColor = TANSKIN; + sHairColor = REDHEAD; + sShirtColor = WHITEVEST; + sPantColor = JEANPANTS; + break; + case( 15 ): + sSkinColor = TANSKIN; + sHairColor = BLONDHEAD; + sShirtColor = BROWNVEST; + sPantColor = GREENPANTS; + break; + } + + // now set them + strcpy( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].HAIR, sHairStrings[ sHairColor ] ); + strcpy( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].SKIN, sSkinStrings[ sSkinColor ] ); + strcpy( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].PANTS, sPantStrings[ sPantColor ] ); + strcpy( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].VEST, sShirtStrings[ sShirtColor ] ); + +} + + +void HandleMercStatsForChangesInFace( ) +{ + if ( fLoadingCharacterForPreviousImpProfile ) + { + return; + } + + //add the skills to the skills list + AddSelectedSkillsToSkillsList(); + + // now figure out skills + CreatePlayerSkills(); + + // body type + if ( fCharacterIsMale ) + { + // male + // big or regular + // Madd - don't override the skills - override the body type instead + if( ShouldThisMercHaveABigBody() && iSkillA != MARTIALARTS && iSkillB != MARTIALARTS ) + { + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].ubBodyType = BIGMALE; + + //if( iSkillA == MARTIALARTS ) + //{ + // iSkillA = HANDTOHAND; + //} + //if( iSkillB == MARTIALARTS ) + //{ + // iSkillB = HANDTOHAND; + //} + } + else + { + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].ubBodyType = REGMALE; + } + } + else + { + // female + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].ubBodyType = REGFEMALE; + + if( iSkillA == MARTIALARTS ) + { + iSkillA = HANDTOHAND; + } + if( iSkillB == MARTIALARTS ) + { + iSkillB = HANDTOHAND; + } + } + + + // skill trait + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait = ( INT8 )iSkillA; + gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 = ( INT8 )iSkillB; + +} + +BOOLEAN ShouldThisMercHaveABigBody( void ) +{ + // should this merc be a big body type + // Madd - don't limit it by portrait + //if ( ( iPortraitNumber == 0 ) || ( iPortraitNumber == 6 ) || ( iPortraitNumber == 7 ) ) + //{ + if ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bStrength >= 75 ) + { + return( TRUE ); + } + //} + + return( FALSE ); +} \ No newline at end of file diff --git a/Laptop/IMP Compile Character.h b/Laptop/IMP Compile Character.h new file mode 100644 index 00000000..c6647b10 --- /dev/null +++ b/Laptop/IMP Compile Character.h @@ -0,0 +1,25 @@ +#ifndef __IMP_COMPILE_H +#define __IMP_COMPILE_H + +#define PLAYER_GENERATED_CHARACTER_ID 51 +#define ATTITUDE_LIST_SIZE 20 +#define NUMBER_OF_PLAYER_PORTRAITS 16 + +void AddAnAttitudeToAttitudeList( INT8 bAttitude ); +void CreatePlayerAttitude( void ); +BOOLEAN DoesCharacterHaveAnAttitude( void ); +void CreateACharacterFromPlayerEnteredStats( void ); +void CreatePlayerSkills( void ); +void CreatePlayersPersonalitySkillsAndAttitude( void ); +void AddAPersonalityToPersonalityList( INT8 bPersonlity ); +void CreatePlayerPersonality( void ); +BOOLEAN DoesCharacterHaveAPersoanlity( void ); +void AddSkillToSkillList( INT8 bSkill ); +void ResetSkillsAttributesAndPersonality( void ); +void ResetIncrementCharacterAttributes( void ); +void HandleMercStatsForChangesInFace( void ); +void ClearAllSkillsList( void ); + +extern STR8 pPlayerSelectedFaceFileNames[ NUMBER_OF_PLAYER_PORTRAITS ]; +extern STR8 pPlayerSelectedBigFaceFileNames[ NUMBER_OF_PLAYER_PORTRAITS ]; +#endif \ No newline at end of file diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp new file mode 100644 index 00000000..2c36827d --- /dev/null +++ b/Laptop/IMP Confirm.cpp @@ -0,0 +1,850 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "CharProfile.h" + #include "IMP MainPage.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Compile Character.h" + #include "soldier profile type.h" + #include "IMP Text System.h" + #include "IMP Confirm.h" + #include "finances.h" + #include "Soldier Profile.h" + #include "Soldier Profile Type.h" + #include "Soldier Control.h" + #include "IMP Portraits.h" + #include "IMP Voices.h" + #include "Overhead.h" + #include "finances.h" + #include "history.h" + #include "Game Clock.h" + #include "email.h" + #include "Game Event Hook.h" + #include "LaptopSave.h" + #include "strategic.h" +#endif + +#define IMP_MERC_FILE "IMP.dat" + +IMP_ITEM_CHOICE_TYPE gIMPItemChoices[MAX_IMP_ITEM_TYPES]; + +void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex ); +void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeIndex ); + +UINT32 giIMPConfirmButton[ 2 ]; +UINT32 giIMPConfirmButtonImage[ 2 ]; +BOOLEAN fNoAlreadySelected = FALSE; +UINT16 uiEyeXPositions[ ]={ + 8, + 9, + 8, + 6, + 13, + 11, + 8, + 8, + 4, //208 + 5, //209 + 7, + 5, //211 + 7, + 11, + 8, //214 + 5, +}; + +UINT16 uiEyeYPositions[ ]= +{ + 5, + 4, + 5, + 6, + 5, + 5, + 4, + 4, + 4, //208 + 5, + 5, //210 + 7, + 6, //212 + 5, + 5, //214 + 6, +}; + +UINT16 uiMouthXPositions[]= +{ + 8, + 9, + 7, + 7, + 11, + 10, + 8, + 8, + 5, //208 + 6, + 7, //210 + 6, + 7, //212 + 9, + 7, //214 + 5, +}; + +UINT16 uiMouthYPositions[]={ + 21, + 23, + 24, + 25, + 23, + 24, + 24, + 24, + 25, //208 + 24, + 24, //210 + 26, + 24, //212 + 23, + 24, //214 + 26, +}; + +BOOLEAN fLoadingCharacterForPreviousImpProfile = FALSE; + +void CreateConfirmButtons( void ); +void DestroyConfirmButtons( void ); +void GiveItemsToPC( UINT8 ubProfileId ); +void MakeProfileInvItemAnySlot(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany); +void MakeProfileInvItemThisSlot(MERCPROFILESTRUCT *pProfile, UINT32 uiPos, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany); +INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem); + +// callbacks +void BtnIMPConfirmNo( GUI_BUTTON *btn,INT32 reason ); +void BtnIMPConfirmYes( GUI_BUTTON *btn,INT32 reason ); + + +void EnterIMPConfirm( void ) +{ + // create buttons + CreateConfirmButtons( ); + return; +} + +void RenderIMPConfirm( void ) +{ + + // the background + RenderProfileBackGround( ); + + // indent + RenderAvgMercIndentFrame(90, 40 ); + + // highlight answer + PrintImpText( ); + + return; +} + +void ExitIMPConfirm( void ) +{ + + // destroy buttons + DestroyConfirmButtons( ); + return; +} + +void HandleIMPConfirm( void ) +{ + return; +} + +void CreateConfirmButtons( void ) +{ + // create buttons for confirm screen + + giIMPConfirmButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + giIMPConfirmButton[0] = CreateIconAndTextButton( giIMPConfirmButtonImage[0], pImpButtonText[ 16 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 254 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPConfirmYes); + + giIMPConfirmButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + giIMPConfirmButton[1] = CreateIconAndTextButton( giIMPConfirmButtonImage[ 1 ], pImpButtonText[ 17 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPConfirmNo); + + SetButtonCursor(giIMPConfirmButton[ 0 ], CURSOR_WWW); + SetButtonCursor(giIMPConfirmButton[ 1 ], CURSOR_WWW); + + return; +} + + +void DestroyConfirmButtons( void ) +{ + // destroy buttons for confirm screen + + RemoveButton(giIMPConfirmButton[ 0 ] ); + UnloadButtonImage(giIMPConfirmButtonImage[ 0 ] ); + + + RemoveButton(giIMPConfirmButton[ 1 ] ); + UnloadButtonImage(giIMPConfirmButtonImage[ 1 ] ); + return; +} + + + +BOOLEAN AddCharacterToPlayersTeam( void ) +{ + + MERC_HIRE_STRUCT HireMercStruct; + + + // last minute chage to make sure merc with right facehas not only the right body but body specific skills... + // ie..small mercs have martial arts..but big guys and women don't don't + + HandleMercStatsForChangesInFace( ); + + memset(&HireMercStruct, 0, sizeof(MERC_HIRE_STRUCT)); + + HireMercStruct.ubProfileID = ( UINT8 )( PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ) ; + + if( fLoadingCharacterForPreviousImpProfile == FALSE ) + { + // give them items + GiveItemsToPC( HireMercStruct.ubProfileID ); + } + + + HireMercStruct.sSectorX = gsMercArriveSectorX; + HireMercStruct.sSectorY = gsMercArriveSectorY; + HireMercStruct.fUseLandingZoneForArrival = TRUE; + + HireMercStruct.fCopyProfileItemsOver = TRUE; + + // indefinite contract length + HireMercStruct.iTotalContractLength = -1; + + HireMercStruct.ubInsertionCode = INSERTION_CODE_ARRIVING_GAME; + HireMercStruct.uiTimeTillMercArrives = GetMercArrivalTimeOfDay( ); + + SetProfileFaceData( HireMercStruct.ubProfileID , ( UINT8 ) ( 200 + iPortraitNumber ), uiEyeXPositions[ iPortraitNumber ], uiEyeYPositions[ iPortraitNumber ], uiMouthXPositions[ iPortraitNumber ], uiMouthYPositions[ iPortraitNumber ] ); + + //if we succesfully hired the merc + if( !HireMerc( &HireMercStruct ) ) + { + return(FALSE); + } + else + { + return ( TRUE ); + } +} + + +void BtnIMPConfirmYes(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP Homepage About US button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + + // reset button + btn->uiFlags&=~(BUTTON_CLICKED_ON); +// Madd +/* if( LaptopSaveInfo.fIMPCompletedFlag ) + { + // already here, leave + return; + } +*/ + if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE ) + { + // not enough + return; + } + + // line moved by CJC Nov 28 2002 to AFTER the check for money + LaptopSaveInfo.fIMPCompletedFlag = TRUE; + + // charge the player + AddTransactionToPlayersBook(IMP_PROFILE, (UINT8)(PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId), GetWorldTotalMin( ), - ( COST_OF_PROFILE ) ); + AddHistoryToPlayersLog( HISTORY_CHARACTER_GENERATED, 0,GetWorldTotalMin( ), -1, -1 ); + AddCharacterToPlayersTeam( ); + + // write the created imp merc + WriteOutCurrentImpCharacter( ( UINT8 )( PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ) ); + + fButtonPendingFlag = TRUE; + iCurrentImpPage = IMP_HOME_PAGE; + + //Kaiden: Below is the Imp personality E-mail as it was. +/* + // send email notice + //AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ) ); + AddFutureDayStrategicEvent( EVENT_DAY2_ADD_EMAIL_FROM_IMP, 60 * 7, 0, 2 ); +*/ + + //Kaiden: And here is my Answer to the IMP E-mails only + // profiling the last IMP made. You get the results immediately + // But they should become different per different IMP. + AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ) ); + + //RenderCharProfile( ); + + ResetCharacterStats(); + + //Display a popup msg box telling the user when and where the merc will arrive + //DisplayPopUpBoxExplainingMercArrivalLocationAndTime( PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ); + + //reset the id of the last merc so we dont get the DisplayPopUpBoxExplainingMercArrivalLocationAndTime() pop up box in another screen by accident + LaptopSaveInfo.sLastHiredMerc.iIdOfMerc = -1; + } + } + +} + +// fixed? by CJC Nov 28 2002 +void BtnIMPConfirmNo( GUI_BUTTON *btn,INT32 reason ) +{ + // btn callback for IMP Homepage About US button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + + iCurrentImpPage = IMP_FINISH; + + /* + + LaptopSaveInfo.fIMPCompletedFlag = FALSE; + ResetCharacterStats(); + + fButtonPendingFlag = TRUE; + iCurrentImpPage = IMP_HOME_PAGE; + */ + /* + if( fNoAlreadySelected == TRUE ) + { + // already selected no + fButtonPendingFlag = TRUE; + iCurrentImpPage = IMP_HOME_PAGE; + } + fNoAlreadySelected = TRUE; + */ + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} + +/* +void BtnIMPConfirmNo( GUI_BUTTON *btn,INT32 reason ) +{ + + + // btn callback for IMP Homepage About US button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + LaptopSaveInfo.fIMPCompletedFlag = TRUE; + if( fNoAlreadySelected == TRUE ) + { + // already selected no + fButtonPendingFlag = TRUE; + iCurrentImpPage = IMP_HOME_PAGE; + } + fNoAlreadySelected = TRUE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } +} +*/ + + +#define PROFILE_HAS_SKILL_TRAIT( p, t ) ((p->bSkillTrait == t) || (p->bSkillTrait2 == t)) + + +void GiveItemsToPC( UINT8 ubProfileId ) +{ + MERCPROFILESTRUCT *pProfile; + + + // gives starting items to merc + // NOTE: Any guns should probably be from those available in regular gun set + + pProfile = &(gMercProfiles[ubProfileId]); + + + // STANDARD EQUIPMENT + + GiveIMPItems(pProfile, 100, IMP_DEFAULT); + GiveIMPRandomItems(pProfile, IMP_RANDOMDEFAULT); + + + // kevlar vest, leggings, & helmet +// MakeProfileInvItemThisSlot(pProfile, VESTPOS, FLAK_JACKET, 100, 1); + + GiveIMPItems (pProfile,pProfile->bWisdom,IMP_WISDOM); + + + //if ( PreRandom( 100 ) < (UINT32) pProfile->bWisdom ) + //{ + // MakeProfileInvItemThisSlot(pProfile, HELMETPOS, STEEL_HELMET, 100, 1); + //} + + // canteen +// MakeProfileInvItemThisSlot(pProfile, SMALLPOCK4POS, CANTEEN, 100, 1); + + GiveIMPItems (pProfile,pProfile->bMarksmanship,IMP_MARKSMANSHIP); + + + //Give ANY imp the calico +// MakeProfileInvItemThisSlot( pProfile, HANDPOS, M950, 100, 1); + + + + //No ammo clip MakeProfileInvItemThisSlot( pProfile, SMALLPOCK1POS, CLIP9_30, 100, 2); + + /* + Ja25 IMP only gets 1 gun now + + + + + if (pProfile->bMarksmanship >= 80) + { + // good shooters get a better & matching ammo + MakeProfileInvItemThisSlot( pProfile, HANDPOS, MP5K, 100, 1); + MakeProfileInvItemThisSlot( pProfile, SMALLPOCK1POS, CLIP9_30, 100, 2); + } + else + { + // Automatic pistol, with matching ammo + MakeProfileInvItemThisSlot( pProfile, HANDPOS, BERETTA_93R, 100, 1 ); + MakeProfileInvItemThisSlot( pProfile, SMALLPOCK1POS, CLIP9_15, 100, 3 ); + } + */ + + // OPTIONAL EQUIPMENT: depends on skills & special skills + + GiveIMPItems (pProfile,pProfile->bMedical,IMP_MEDICAL); + + //if (pProfile->bMedical >= 60) + //{ + // // strong medics get full medic kit + // MakeProfileInvItemAnySlot(pProfile, MEDICKIT, 100, 1); + //} + //else + //if (pProfile->bMedical >= 30) + //{ + // // passable medics get first aid kit + // MakeProfileInvItemAnySlot(pProfile, FIRSTAIDKIT, 100, 1); + //} + + GiveIMPItems (pProfile,pProfile->bMechanical,IMP_MECHANICAL); + + //if (pProfile->bMechanical >= 50) + //{ + // // mechanics get toolkit + // MakeProfileInvItemAnySlot(pProfile, TOOLKIT, 100, 1); + //} + + GiveIMPItems (pProfile,pProfile->bExplosive,IMP_EXPLOSIVE); + + //if (pProfile->bExplosive >= 50) + //{ + // // loonies get TNT & Detonator + //MakeProfileInvItemAnySlot(pProfile, TNT, 100, 1); + //MakeProfileInvItemAnySlot(pProfile, DETONATOR, 100, 1); + //} + + GiveIMPItems (pProfile,pProfile->bAgility,IMP_AGILITY); + GiveIMPItems (pProfile,pProfile->bDexterity,IMP_DEXTERITY); + GiveIMPItems (pProfile,pProfile->bStrength,IMP_STRENGTH); + GiveIMPItems (pProfile,pProfile->bLifeMax,IMP_HEALTH); + GiveIMPItems (pProfile,pProfile->bLeadership,IMP_LEADERSHIP); + + // check for special skills + if (PROFILE_HAS_SKILL_TRAIT(pProfile, LOCKPICKING) && ( iMechanical ) ) + { + //MakeProfileInvItemAnySlot(pProfile, LOCKSMITHKIT, 100, 1); + GiveIMPRandomItems(pProfile,IMP_LOCKPICKING); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, HANDTOHAND)) + { + //MakeProfileInvItemAnySlot(pProfile, BRASS_KNUCKLES, 100, 1); + GiveIMPRandomItems(pProfile,IMP_HTH); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, ELECTRONICS) && ( iMechanical ) ) + { + //MakeProfileInvItemAnySlot(pProfile, METALDETECTOR, 100, 1); + GiveIMPRandomItems(pProfile,IMP_ELECTRONICS); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, NIGHTOPS)) + { +// MakeProfileInvItemAnySlot(pProfile, SILENCER, 100, 2); + GiveIMPRandomItems(pProfile,IMP_NIGHTOPS); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, THROWING)) + { +// MakeProfileInvItemAnySlot(pProfile, THROWING_KNIFE, 100, 1); + GiveIMPRandomItems(pProfile,IMP_THROWING); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, STEALTHY)) + { +// MakeProfileInvItemAnySlot(pProfile, SILENCER, 100, 1); + GiveIMPRandomItems(pProfile,IMP_STEALTHY); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, KNIFING)) + { +// MakeProfileInvItemAnySlot(pProfile, COMBAT_KNIFE, 100, 1); + GiveIMPRandomItems(pProfile,IMP_KNIFING); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, CAMOUFLAGED)) + { +// MakeProfileInvItemAnySlot(pProfile, CAMOUFLAGEKIT, 100, 1); + GiveIMPRandomItems(pProfile,IMP_CAMOUFLAGED); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, AMBIDEXT)) + { +// MakeProfileInvItemAnySlot(pProfile, M950, 100, 1); + GiveIMPRandomItems(pProfile,IMP_AMBIDEXTROUS); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, MARTIALARTS)) + { + GiveIMPRandomItems(pProfile,IMP_MARTIALARTS); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, ONROOF)) + { + GiveIMPRandomItems(pProfile,IMP_ROOFTOPS); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, TEACHING)) + { + GiveIMPRandomItems(pProfile,IMP_TEACHING); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, AUTO_WEAPS)) + { + GiveIMPRandomItems(pProfile,IMP_AUTOWEAPONS); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, HEAVY_WEAPS )) + { + GiveIMPRandomItems(pProfile,IMP_HEAVYWEAPONS); + } + + if (PROFILE_HAS_SKILL_TRAIT(pProfile, THIEF )) + { + GiveIMPRandomItems(pProfile,IMP_THIEF); + } +} + + +void MakeProfileInvItemAnySlot(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany) +{ + INT32 iSlot; + + iSlot = FirstFreeBigEnoughPocket(pProfile, usItem); + + if (iSlot == -1) + { + // no room, item not received + return; + } + + // put the item into that slot + MakeProfileInvItemThisSlot(pProfile, iSlot, usItem, ubStatus, ubHowMany); +} + + +void MakeProfileInvItemThisSlot(MERCPROFILESTRUCT *pProfile, UINT32 uiPos, UINT16 usItem, UINT8 ubStatus, UINT8 ubHowMany) +{ + pProfile->inv[uiPos] = usItem; + pProfile->bInvStatus[uiPos] = ubStatus; + pProfile->bInvNumber[uiPos] = ubHowMany; +} + + +INT32 FirstFreeBigEnoughPocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem) +{ + UINT32 uiPos; + + + // if it fits into a small pocket + if (Item[usItem].ubPerPocket != 0) + { + // check small pockets first + for (uiPos = SMALLPOCK1POS; uiPos <= SMALLPOCK8POS; uiPos++) + { + if (pProfile->inv[uiPos] == NONE) + { + return(uiPos); + } + } + } + + // check large pockets + for (uiPos = BIGPOCK1POS; uiPos <= BIGPOCK4POS; uiPos++) + { + if (pProfile->inv[uiPos] == NONE) + { + return(uiPos); + } + } + + + return(-1); +} + + +void WriteOutCurrentImpCharacter( INT32 iProfileId ) +{ + // grab the profile number and write out what is contained there in + HWFILE hFile; + UINT32 uiBytesWritten = 0; + + // open the file for writing + hFile = FileOpen(IMP_MERC_FILE, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE); + + // write out the profile id + if (!FileWrite(hFile, &iProfileId, sizeof( INT32 ), &uiBytesWritten)) + { + return; + } + + // write out the portrait id + if (!FileWrite(hFile, &iPortraitNumber, sizeof( INT32 ), &uiBytesWritten)) + { + return; + } + + // write out the profile itself + if (!FileWrite(hFile, &gMercProfiles[ iProfileId ], sizeof( MERCPROFILESTRUCT ), &uiBytesWritten)) + { + return; + } + + // close file + FileClose(hFile); + + return; +} + +void LoadInCurrentImpCharacter( void ) +{ + INT32 iProfileId = 0; + HWFILE hFile; + UINT32 uiBytesRead = 0; + + // open the file for writing + hFile = FileOpen(IMP_MERC_FILE, FILE_ACCESS_READ, FALSE); + + // valid file? + if( hFile == -1 ) + { + return; + } + + // read in the profile + if (!FileRead(hFile, &iProfileId,sizeof( INT32 ), &uiBytesRead)) + { + return; + } + + // read in the portrait + if (!FileRead(hFile, &iPortraitNumber ,sizeof( INT32 ), &uiBytesRead)) + { + return; + } + + // read in the profile + if (!FileRead(hFile, &gMercProfiles[ iProfileId ] ,sizeof( MERCPROFILESTRUCT ), &uiBytesRead)) + { + return; + } + + // close file + FileClose(hFile); + + if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE ) + { + // not enough + return; + } + + + // charge the player + // is the character male? + fCharacterIsMale = ( gMercProfiles[ iProfileId ].bSex == MALE ); + fLoadingCharacterForPreviousImpProfile = TRUE; + AddTransactionToPlayersBook(IMP_PROFILE,0, GetWorldTotalMin( ), - ( COST_OF_PROFILE ) ); + AddHistoryToPlayersLog( HISTORY_CHARACTER_GENERATED, 0,GetWorldTotalMin( ), -1, -1 ); + LaptopSaveInfo.iVoiceId = iProfileId - PLAYER_GENERATED_CHARACTER_ID; + AddCharacterToPlayersTeam( ); + AddFutureDayStrategicEvent( EVENT_DAY2_ADD_EMAIL_FROM_IMP, 60 * 7, 0, 2 ); + LaptopSaveInfo.fIMPCompletedFlag = TRUE; + fPausedReDrawScreenFlag = TRUE; + fLoadingCharacterForPreviousImpProfile = FALSE; + + return; +} + + + +void ResetIMPCharactersEyesAndMouthOffsets( UINT8 ubMercProfileID ) +{ + // ATE: Check boundary conditions! + if( ( ( gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ) > 16 ) || ( ubMercProfileID >= PROF_HUMMER ) ) + { + return; + } + + gMercProfiles[ ubMercProfileID ].usEyesX = uiEyeXPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; + gMercProfiles[ ubMercProfileID ].usEyesY = uiEyeYPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; + + + gMercProfiles[ ubMercProfileID ].usMouthX = uiMouthXPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; + gMercProfiles[ ubMercProfileID ].usMouthY = uiMouthYPositions[ gMercProfiles[ ubMercProfileID ].ubFaceIndex - 200 ]; +} + + +void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex ) +{ + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: typeIndex = %d",typeIndex )); + + UINT16 usItem = 0; + INT32 iChoice; + + if ( gIMPItemChoices[ typeIndex ].ubChoices <= 0 ) + return; + + for ( int i=0; i < gIMPItemChoices[typeIndex].ubNumItems ;i++ ) + { + iChoice = Random(gIMPItemChoices[ typeIndex ].ubChoices); + usItem = gIMPItemChoices[ typeIndex ].bItemNo[ iChoice ]; + + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: typeIndex = %d, usItem = %d ",typeIndex, usItem )); + if ( usItem > 0 ) + MakeProfileInvItemAnySlot(pProfile,usItem,100,1); + + // give ammo for guns + if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + { + usItem = DefaultMagazine(usItem); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: give ammo typeIndex = %d, usItem = %d ",typeIndex, usItem )); + MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + } + + // give launchables for launchers + if ( Item[usItem].usItemClass == IC_LAUNCHER ) + { + usItem = PickARandomLaunchable(usItem); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: give launchable typeIndex = %d, usItem = %d",typeIndex, usItem )); + MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + } + } + +} + +void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeIndex ) +{ + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: typeIndex = %d, abilityValue = %d",typeIndex,abilityValue )); + + UINT16 usItem = 0; + INT32 iChoice; + + if ( gIMPItemChoices[ typeIndex ].ubChoices <= 0 ) + return; + + iChoice = (UINT32) (abilityValue / (100 / gIMPItemChoices[ typeIndex ].ubChoices)) ; + + if ( iChoice >= gIMPItemChoices[ typeIndex ].ubChoices ) + iChoice = gIMPItemChoices[ typeIndex ].ubChoices - 1; + + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: 1 iChoice = %d",iChoice)); + for ( int i=0; i < gIMPItemChoices[typeIndex].ubNumItems ;i++ ) + { + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: 2 iChoice = %d",iChoice)); + usItem = gIMPItemChoices[ typeIndex ].bItemNo[ iChoice ]; + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: typeIndex = %d, usItem = %d, iChoice = %d, abilityValue = %d",typeIndex, usItem,iChoice, abilityValue )); + if ( usItem > 0 ) + MakeProfileInvItemAnySlot(pProfile,usItem,100,1); + + + // give ammo for guns + if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + { + usItem = DefaultMagazine(usItem); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give ammo typeIndex = %d, usItem = %d",typeIndex, usItem )); + MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + } + + // give launchables for launchers + if ( Item[usItem].usItemClass == IC_LAUNCHER ) + { + usItem = PickARandomLaunchable(usItem); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give launchable typeIndex = %d, usItem = %d",typeIndex, usItem )); + MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + } + + iChoice--; + if (iChoice < 0) + iChoice = 0; + } + + +} + diff --git a/Laptop/IMP Confirm.h b/Laptop/IMP Confirm.h new file mode 100644 index 00000000..1a92d399 --- /dev/null +++ b/Laptop/IMP Confirm.h @@ -0,0 +1,17 @@ +#ifndef __IMP_CONFIRM_H +#define __IMP_CONFIRM_H + +void EnterIMPConfirm( void ); +void RenderIMPConfirm( void ); +void ExitIMPConfirm( void ); +void HandleIMPConfirm( void ); + +BOOLEAN AddCharacterToPlayersTeam( void ); +void LoadInCurrentImpCharacter( void ); +void WriteOutCurrentImpCharacter( INT32 iProfileId ); + +void ResetIMPCharactersEyesAndMouthOffsets( UINT8 ubMercProfileID ); + + +#endif + diff --git a/Laptop/IMP Finish.cpp b/Laptop/IMP Finish.cpp new file mode 100644 index 00000000..97f8b0d8 --- /dev/null +++ b/Laptop/IMP Finish.cpp @@ -0,0 +1,694 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "CharProfile.h" + #include "IMP Finish.h" + #include "IMP Portraits.h" + #include "IMP HomePage.h" + #include "IMP MainPage.h" + #include "IMP Voices.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Timer Control.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Attribute Selection.h" + #include "IMP Text System.h" + #include "soundman.h" + #include "IMP Compile Character.h" + #include "text.h" +#endif + +// min time btween frames of animation +#define ANIMATE_MIN_TIME 200 + + +#define MAIN_PAGE_SPACE_BTN_BUTTONS 120 + +#define MAIN_PAGE__FIRST_BUTTON_POS_X ( LAPTOP_SCREEN_UL_X + 15 ) +#define MAIN_PAGE__SECOND_BUTTON_POS_X ( MAIN_PAGE__FIRST_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) +#define MAIN_PAGE__THIRD_BUTTON_POS_X ( MAIN_PAGE__SECOND_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) +#define MAIN_PAGE__FOURTH_BUTTON_POS_X (MAIN_PAGE__THIRD_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) + +// buttons +INT32 giIMPFinishButton[ 6 ]; +INT32 giIMPFinishButtonImage[ 6 ]; + +// we are in fact done +BOOLEAN fFinishedCharGeneration = FALSE; + +// portrait position +INT16 sFaceX = 253; +INT16 sFaceY = 245; + +// what voice are we playing? +UINT32 uiVoiceSound = 0; + +// image handle +UINT32 guiCHARACTERPORTRAIT; +extern INT32 iCurrentPortrait; +extern INT32 iCurrentVoices; + +// function definitions +void CreateIMPFinishButtons( void ); +void DeleteIMPFinishButtons( void ); +BOOLEAN RenderCharProfileFinishFace( void ); +void RenderCharFullName( void ); +BOOLEAN LoadCharacterPortrait( void ); +void DestroyCharacterPortrait( void ); + + +// callbacks +void BtnIMPFinishVoiceCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPFinishAttributesCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPFinishPersonalityCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPFinishStartOverCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPFinishDoneCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPFinishPortraitCallback(GUI_BUTTON *btn,INT32 reason); +void FinishMessageBoxCallBack( UINT8 bExitValue ); +extern void BtnIMPMainPageVoiceCallback(GUI_BUTTON *btn,INT32 reason); +extern void BtnIMPMainPagePortraitCallback(GUI_BUTTON *btn,INT32 reason); + + + + +void EnterIMPFinish( void ) +{ + + + // load graphic for portrait + LoadCharacterPortrait( ); + + // CREATE buttons for IMP finish screen + CreateIMPFinishButtons( ); + + // set review mode + fReviewStats = TRUE; + iCurrentProfileMode = IMP__FINISH; + + // note that we are in fact done char generation + fFinishedCharGeneration = TRUE; + + + return; +} + +void RenderIMPFinish( void ) +{ + // the background + RenderProfileBackGround( ); + + // render merc fullname + RenderCharFullName( ); + + // indent for text + RenderBeginIndent( 110, 50 ); + + return; +} + +void ExitIMPFinish( void ) +{ + + // remove buttons for IMP finish screen + DeleteIMPFinishButtons( ); + + // get rid of graphic for portrait + DestroyCharacterPortrait( ); + + return; +} + + +void HandleIMPFinish( void ) +{ + + + return; +} + + + +void CreateIMPFinishButtons( void ) +{ + CHAR16 sString[ 128 ]; + + // this function will create the buttons needed for th IMP about us page + // the start over button button + giIMPFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + /*giIMPFinishButton[0] = QuickCreateButton( giIMPFinishButtonImage[0], LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 114 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishStartOverCallback); + */ + giIMPFinishButton[ 0 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 0 ], pImpButtonText[ 7 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishStartOverCallback); + + // the done button + giIMPFinishButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); +/* giIMPFinishButton[1] = QuickCreateButton( giIMPFinishButtonImage[1], LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishDoneCallback); +*/ + giIMPFinishButton[ 1 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 1 ], pImpButtonText[ 6 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 114 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishDoneCallback); + + // the personality button + giIMPFinishButtonImage[2]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + +/* giIMPFinishButton[2] = QuickCreateButton( giIMPFinishButtonImage[2], LAPTOP_SCREEN_UL_X + 13 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishPersonalityCallback); + +*/ giIMPFinishButton[ 2 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 2 ], pImpButtonText[ 2 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__THIRD_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishPersonalityCallback); + + SpecifyButtonIcon( giIMPFinishButton[2] , guiANALYSE, 0, 33, 23, FALSE ); + + + + // the attribs button + giIMPFinishButtonImage[3]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); +/* giIMPFinishButton[3] = QuickCreateButton( giIMPFinishButtonImage[3], LAPTOP_SCREEN_UL_X + 133 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishAttributesCallback); +*/ + giIMPFinishButton[ 3 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 3 ], pImpButtonText[ 3 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__FOURTH_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishAttributesCallback); + + SpecifyButtonIcon( giIMPFinishButton[ 3 ], guiATTRIBUTEGRAPH, 0, + 25, 25, FALSE ); + + // the portrait button + giIMPFinishButtonImage[4]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); +/* giIMPFinishButton[4] = QuickCreateButton( giIMPFinishButtonImage[4], LAPTOP_SCREEN_UL_X + 253 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishPortraitCallback); + */ + giIMPFinishButton[ 4 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 4 ], pImpButtonText[ 4 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__FIRST_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePortraitCallback); + + SpecifyButtonIcon( giIMPFinishButton[ 4 ], guiCHARACTERPORTRAIT, 0, + 33, 23, FALSE ); + + swprintf( sString, pImpButtonText[ 5 ], iCurrentVoices + 1 ); + + // the voice button + giIMPFinishButtonImage[5]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + /* giIMPFinishButton[5] = QuickCreateButton( giIMPFinishButtonImage[5], LAPTOP_SCREEN_UL_X + 373 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPFinishVoiceCallback); + */ + giIMPFinishButton[ 5 ] = CreateIconAndTextButton( giIMPFinishButtonImage[ 5 ], sString, FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__SECOND_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageVoiceCallback); + + SpecifyButtonIcon( giIMPFinishButton[ 5 ], guiSMALLSILHOUETTE, 0, + 33, 23, FALSE ); + + + SetButtonCursor(giIMPFinishButton[0], CURSOR_WWW); + SetButtonCursor(giIMPFinishButton[1], CURSOR_WWW); + SetButtonCursor(giIMPFinishButton[2], CURSOR_WWW); + SetButtonCursor(giIMPFinishButton[3], CURSOR_WWW); + SetButtonCursor(giIMPFinishButton[4], CURSOR_WWW); + SetButtonCursor(giIMPFinishButton[5], CURSOR_WWW); + + + + + return; +} + + + +void DeleteIMPFinishButtons( void ) +{ + // this function destroys the buttons needed for the IMP about Us Page + + // the back button + RemoveButton(giIMPFinishButton[0] ); + UnloadButtonImage(giIMPFinishButtonImage[0] ); + + // begin profiling button + RemoveButton(giIMPFinishButton[1] ); + UnloadButtonImage(giIMPFinishButtonImage[1] ); + + // begin personna button + RemoveButton(giIMPFinishButton[2] ); + UnloadButtonImage(giIMPFinishButtonImage[2] ); + + // begin attribs button + RemoveButton(giIMPFinishButton[3] ); + UnloadButtonImage(giIMPFinishButtonImage[3] ); + + // begin portrait button + RemoveButton(giIMPFinishButton[4] ); + UnloadButtonImage(giIMPFinishButtonImage[4] ); + + // begin voice button + RemoveButton(giIMPFinishButton[5] ); + UnloadButtonImage(giIMPFinishButtonImage[5] ); + + + return; +} + + +void BtnIMPFinishStartOverCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP Homepage About US button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 1 ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, FinishMessageBoxCallBack); + + } + } +} + +void BtnIMPFinishDoneCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for Main Page Begin Profiling + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_CONFIRM; + CreateACharacterFromPlayerEnteredStats( ); + fButtonPendingFlag = TRUE; + iCurrentProfileMode = IMP__REGISTRY; + fFinishedCharGeneration = FALSE; + //ResetCharacterStats( ); + } + } +} + + +void BtnIMPFinishPersonalityCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for Main Page Begin Profiling + static BOOLEAN fAnimateFlag = FALSE; + static UINT32 uiBaseTime = 0; + static BOOLEAN fState = 0; + INT32 iDifference = 0; + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + uiBaseTime = GetJA2Clock(); + SpecifyButtonText( giIMPFinishButton[2], pImpButtonText[ 23 ] ); + fAnimateFlag = TRUE; + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fButtonPendingFlag = TRUE; + uiBaseTime = 0; + fAnimateFlag = FALSE; + iCurrentImpPage = IMP_PERSONALITY_QUIZ; + SpecifyButtonText( giIMPFinishButton[2], pImpButtonText[ 2 ] ); + } + } + + // get amount of time between callbacks + iDifference = GetJA2Clock() - uiBaseTime; + + if( fAnimateFlag ) + { + if( iDifference > ANIMATE_MIN_TIME ) + { + + uiBaseTime = GetJA2Clock(); + if( fState ) + { + SpecifyButtonIcon( giIMPFinishButton[2] , guiANALYSE, 1, 33, 23, FALSE ); + + fState = FALSE; + } + else + { + SpecifyButtonIcon( giIMPFinishButton[2] , guiANALYSE, 0, 33, 23, FALSE ); + + fState = TRUE; + } + + } + } + + +} + +void BtnIMPFinishAttributesCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for Main Page Begin Profiling + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + // if not this far in char generation, don't alot ANY action + if( iCurrentProfileMode < IMP__ATTRIBUTES ) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + return; + } + + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_ATTRIBUTE_PAGE; + fButtonPendingFlag = TRUE; + SpecifyButtonText( giIMPFinishButton[2], pImpButtonText[ 2 ] ); + } + } +} + +void BtnIMPFinishPortraitCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for Main Page Begin Profiling + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + // if not this far in char generation, don't alot ANY action + if( iCurrentProfileMode < IMP__PORTRAIT ) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + return; + } + + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + sFaceX = 253; + sFaceY = 247; + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + sFaceX = 253; + sFaceY = 245; + } + } +} + + +void BtnIMPFinishVoiceCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for Main Page Begin Profiling + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + // if not this far in char generation, don't alot ANY action + if( iCurrentProfileMode < IMP__PORTRAIT ) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fButtonPendingFlag = TRUE; + return; + } + + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // play voice + if( ! SoundIsPlaying( uiVoiceSound ) ) + { + uiVoiceSound = PlayVoice( ); + } + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fButtonPendingFlag = TRUE; + } + } +} + +BOOLEAN RenderCharProfileFinishFace( void ) +{ + +// render the portrait of the current picture + VOBJECT_DESC VObjectDesc; + HVOBJECT hHandle; + UINT32 uiGraphicHandle; + + if( fCharacterIsMale == TRUE ) + { + switch( LaptopSaveInfo.iVoiceId ) + { + case( 0 ): + // first portrait + + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\00.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + + + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); + + break; + case( 1 ): + // first portrait + + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\01.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + + + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); + + break; + case( 2 ): + // first portrait + + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\02.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + + + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); + + + break; + } + + } + else + { + switch( LaptopSaveInfo.iVoiceId ) + { + case( 0 ): + // first portrait + + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\03.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + + + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); + + break; + case( 1 ): + // first portrait + + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\04.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + + + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); + + break; + case( 2 ): + // first portrait + + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("Faces\\SmallFaces\\05.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sFaceX, LAPTOP_SCREEN_WEB_UL_Y + sFaceY , VO_BLT_SRCTRANSPARENCY,NULL); + + + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); + + break; + } + } + + // render the nickname + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + SetFont( FONT12ARIAL ); + + mprintf( 253, 350, pNickName ); + + return( TRUE ); + +} + +void RenderCharFullName( void ) +{ + + CHAR16 sString[ 64 ]; + INT16 sX, sY; + + // render the characters full name + SetFont( FONT14ARIAL ); + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + + swprintf( sString, pIMPFinishStrings[ 0 ], pFullName ); + + + FindFontCenterCoordinates(LAPTOP_SCREEN_UL_X - 111, 0, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, 0 , sString , FONT14ARIAL, &sX, &sY); + mprintf( sX, iScreenHeightOffset + LAPTOP_SCREEN_WEB_DELTA_Y + 33, sString ); + return; +} + + +BOOLEAN LoadCharacterPortrait( void ) +{ + // this function will load the character's portrait, to be used on portrait button + VOBJECT_DESC VObjectDesc; + + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pPlayerSelectedFaceFileNames[ iPortraitNumber ] , VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARACTERPORTRAIT)); + + return( TRUE ); +} + + +void DestroyCharacterPortrait( void ) +{ + // remove the portrait that was loaded by loadcharacterportrait + DeleteVideoObjectFromIndex( guiCHARACTERPORTRAIT ); + + + return; +} + + +void FinishMessageBoxCallBack( UINT8 bExitValue ) +{ + // yes, so start over, else stay here and do nothing for now + if( bExitValue == MSG_BOX_RETURN_YES ) + { + iCurrentImpPage = IMP_HOME_PAGE; + fButtonPendingFlag = TRUE; + iCurrentProfileMode = IMP__REGISTRY; + fFinishedCharGeneration = FALSE; + ResetCharacterStats( ); + } + + if( bExitValue == MSG_BOX_RETURN_NO ) + { + MarkButtonsDirty( ); + } + + return; +} diff --git a/Laptop/IMP Finish.h b/Laptop/IMP Finish.h new file mode 100644 index 00000000..789bef6d --- /dev/null +++ b/Laptop/IMP Finish.h @@ -0,0 +1,13 @@ +#ifndef __IMP_FINISH_H +#define __IMP_FINISH_H + + +void EnterIMPFinish( void ); +void RenderIMPFinish( void ); +void ExitIMPFinish( void ); +void HandleIMPFinish( void ); + +extern BOOLEAN fFinishedCharGeneration; + + +#endif \ No newline at end of file diff --git a/Laptop/IMP HomePage.cpp b/Laptop/IMP HomePage.cpp new file mode 100644 index 00000000..62f58eb1 --- /dev/null +++ b/Laptop/IMP HomePage.cpp @@ -0,0 +1,483 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" + #include "IMP Compile Character.h" +#else + #include "CharProfile.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "IMP Compile Character.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Text System.h" + #include "Timer Control.h" + #include "Text Input.h" + #include "LaptopSave.h" + #include "line.h" + #include "english.h" +#endif + +void GetPlayerKeyBoardInputForIMPHomePage( void ); +void DisplayPlayerActivationString( void ); +void ProcessPlayerInputActivationString( void ); +void GetPlayerKeyBoardInputForIMPHomePage( void ); +void HandleTextEvent( UINT32 uiKey ); +void CreateIMPHomePageButtons( void ); +void RemoveIMPHomePageButtons( void ); +void DisplayActivationStringCursor( void ); + +INT32 GlowColorsList[][3] ={ + { 0,0,0 }, + { 0,25,0 }, + { 0,50,0 }, + { 0,75,0 }, + { 0,100,0 }, + { 0,125,0 }, + { 0,150,0 }, + { 0,175,0 }, + { 0,200,0 }, + { 0,225,0 }, + { 0,255,0 }, +}; + +// btn callbacks +void BtnIMPAboutUsCallback(GUI_BUTTON *btn,INT32 reason); + +// position defines +#define IMP_PLAYER_ACTIVATION_STRING_X LAPTOP_SCREEN_UL_X + 261 +#define IMP_PLAYER_ACTIVATION_STRING_Y LAPTOP_SCREEN_WEB_UL_Y + 336 +#define CURSOR_Y IMP_PLAYER_ACTIVATION_STRING_Y - 5 +#define CURSOR_HEIGHT GetFontHeight( FONT14ARIAL ) + 6 + + +// IMP homepage buttons +INT32 giIMPHomePageButton[1]; +INT32 giIMPHomePageButtonImage[1]; + +// the player activation string +CHAR16 pPlayerActivationString[32]; + +// position within player activation string +INT32 iStringPos=0; +UINT16 uiCursorPosition = IMP_PLAYER_ACTIVATION_STRING_X; + + +// has a new char been added or deleted? +BOOLEAN fNewCharInActivationString = FALSE; + +void EnterImpHomePage( void ) +{ + // upon entry to Imp home page + memset(pPlayerActivationString, 0, sizeof(pPlayerActivationString)); + + // reset string position + iStringPos =0; + + // reset activation cursor position + uiCursorPosition = IMP_PLAYER_ACTIVATION_STRING_X; + + // load buttons + CreateIMPHomePageButtons( ); + + // we have now vsisited IMP, reset fact we haven't + fNotVistedImpYet = FALSE; + + // render screen once + RenderImpHomePage( ); + return; +} + +void RenderImpHomePage( void ) +{ + // the background + RenderProfileBackGround( ); + + // the IMP symbol + RenderIMPSymbol( 107, 45 ); + + // the second button image + RenderButton2Image( 134, 314); + + // render the indents + + //activation indents + RenderActivationIndent( 257, 328 ); + + // the two font page indents + RenderFrontPageIndent( 3, 64 ); + RenderFrontPageIndent( 396,64 ); + + + // render the activation string + DisplayPlayerActivationString( ); + + + return; +} + +void ExitImpHomePage( void ) +{ + + // remove buttons + RemoveIMPHomePageButtons( ); + + return; +} + + +void HandleImpHomePage( void ) +{ + + // handle keyboard input for this screen + GetPlayerKeyBoardInputForIMPHomePage( ); + + // has a new char been added to activation string + if( fNewCharInActivationString ) + { + // display string + DisplayPlayerActivationString( ); + } + + // render the cursor + DisplayActivationStringCursor( ); + + return; +} + +void DisplayPlayerActivationString( void ) +{ + + // this function will grab the string that the player will enter for activation + INT32 iCounter=0; + + // player gone too far, move back + if(iStringPos > 64) + { + iStringPos = 64; + } + + // restore background + RenderActivationIndent( 257, 328 ); + + // setup the font stuff + SetFont( FONT14ARIAL ); + SetFontForeground( 184 ); + SetFontBackground(FONT_BLACK); + + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + mprintf(IMP_PLAYER_ACTIVATION_STRING_X, IMP_PLAYER_ACTIVATION_STRING_Y, pPlayerActivationString); + + + fNewCharInActivationString = FALSE; + fReDrawScreenFlag = TRUE; + return; +} + + +void DisplayActivationStringCursor( void ) +{ + // this procdure will draw the activation string cursor on the screen at position cursorx cursory + UINT32 uiDestPitchBYTES; + static UINT32 uiBaseTime = 0; + UINT32 uiDeltaTime = 0; + UINT8 *pDestBuf; + static UINT32 iCurrentState = 0; + static BOOLEAN fIncrement = TRUE; + + if(uiBaseTime == 0) + { + uiBaseTime = GetJA2Clock(); + } + + // get difference + uiDeltaTime = GetJA2Clock() - uiBaseTime; + + // if difference is long enough, rotate colors + if(uiDeltaTime > MIN_GLOW_DELTA) + { + if( iCurrentState == 10) + { + // start rotating downward + fIncrement = FALSE; + } + if( iCurrentState == 0) + { + // rotate colors upward + fIncrement = TRUE; + } + // if increment upward, increment iCurrentState + if(fIncrement) + { + iCurrentState++; + } + else + { + // else downwards + iCurrentState--; + } + // reset basetime to current clock + uiBaseTime = GetJA2Clock( ); + } + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + + + // draw line in current state + LineDraw(TRUE, (UINT16) uiCursorPosition, CURSOR_Y, (UINT16)uiCursorPosition, CURSOR_Y + CURSOR_HEIGHT, Get16BPPColor( FROMRGB( GlowColorsList[ iCurrentState ][ 0 ], GlowColorsList[ iCurrentState ][ 1 ], GlowColorsList[ iCurrentState ][ 2 ] ) ), + pDestBuf ); + + // unlock frame buffer + UnLockVideoSurface( FRAME_BUFFER ); + + InvalidateRegion((UINT16) uiCursorPosition , CURSOR_Y , (UINT16)uiCursorPosition + 1, CURSOR_Y + CURSOR_HEIGHT + 1); + + + return; +} + + + +void GetPlayerKeyBoardInputForIMPHomePage( void ) +{ + InputAtom InputEvent; + POINT MousePos; + + GetCursorPos(&MousePos); + + while (DequeueEvent(&InputEvent) == TRUE) + { + // HOOK INTO MOUSE HOOKS + /* + switch(InputEvent.usEvent) + { + case LEFT_BUTTON_DOWN: + MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_UP: + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_DOWN: + MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + } +*/ + if( !HandleTextInput( &InputEvent ) && (InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT || InputEvent.usEvent == KEY_UP ) ) + { + switch( InputEvent.usParam ) + { + case (( ENTER ) ): + if(( InputEvent.usEvent == KEY_UP ) ) + { + // return hit, check to see if current player activation string is a valid one + ProcessPlayerInputActivationString( ); + + fNewCharInActivationString = TRUE; + } + break; + case (( ESC )): + LeaveLapTopScreen( ); + break; + default: + if(InputEvent.usEvent == KEY_DOWN || InputEvent.usEvent == KEY_REPEAT ) + { + HandleTextEvent( InputEvent.usParam ); + } + break; + } + } + } + + return; +} + + +void HandleTextEvent( UINT32 uiKey ) +{ + // this function checks to see if a letter or a backspace was pressed, if so, either put char to screen + // or delete it + + switch( uiKey ) + { + case ( BACKSPACE ): + + if( iStringPos >= 0 ) + { + + if( iStringPos > 0 ) + { + // decrement iStringPosition + iStringPos-=1; + } + + // null out char + pPlayerActivationString[iStringPos ] = 0; + + // move back cursor + uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; + + + + // string has been altered, redisplay + fNewCharInActivationString = TRUE; + + } + + break; + + default: + if( uiKey >= 'A' && uiKey <= 'Z' || + uiKey >= 'a' && uiKey <= 'z' || + uiKey >= '0' && uiKey <= '9' || + uiKey == '_' || uiKey == '.' ) + { + // if the current string position is at max or great, do nothing + if( iStringPos >= 6 ) + { + break; + } + else + { + if(iStringPos < 0 ) + { + iStringPos = 0; + } + // valid char, capture and convert to CHAR16 + pPlayerActivationString[iStringPos] = ( CHAR16 )uiKey; + + // null out next char position + pPlayerActivationString[iStringPos + 1] = 0; + + // move cursor position ahead + uiCursorPosition = StringPixLength( pPlayerActivationString, FONT14ARIAL ) + IMP_PLAYER_ACTIVATION_STRING_X; + + // increment string position + iStringPos +=1; + + // string has been altered, redisplay + fNewCharInActivationString = TRUE; + + } + + } + + break; + + } + + + return; +} + + +void ProcessPlayerInputActivationString( void ) +{ + // prcess string to see if it matches activation string + + if( NumberOfMercsOnPlayerTeam() >= 18 ) + return; + +//Madd multiple imps if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) )&&( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) + if( ( ( wcscmp(pPlayerActivationString, L"XEP624") == 0 ) || ( wcscmp(pPlayerActivationString, L"xep624") == 0 ) ) &&( LaptopSaveInfo.gfNewGameLaptop < 2 ) ) + { + // Kaiden: Need to reset skills, attributes and personalities with the new UB Method. + ResetSkillsAttributesAndPersonality( ); + ClearAllSkillsList( ); + iCurrentImpPage = IMP_MAIN_PAGE; + + } +//Madd multiple imps else if( ( wcscmp(pPlayerActivationString, L"90210") == 0 ) && ( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) ) + else if( ( wcscmp(pPlayerActivationString, L"90210") == 0 ) ) + { + LoadInCurrentImpCharacter( ); + } + + else + { + if( ( ( wcscmp(pPlayerActivationString, L"XEP624") != 0 ) && ( wcscmp(pPlayerActivationString, L"xep624") != 0 ) ) ) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 0 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } + else if( LaptopSaveInfo.fIMPCompletedFlag == TRUE ) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 6 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } + + + } + return; +} + + + +void CreateIMPHomePageButtons( void ) +{ + // this procedure will create the buttons needed for the IMP homepage + + // ths about us button + giIMPHomePageButtonImage[0]= LoadButtonImage( "LAPTOP\\button_1.sti" ,-1,0,-1,1,-1 ); + /* giIMPHomePageButton[0] = QuickCreateButton( giIMPHomePageButtonImage[0], LAPTOP_SCREEN_UL_X + ( 286 - 106 ), LAPTOP_SCREEN_WEB_UL_Y + ( 248 - 48 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAboutUsCallback); + */ + + giIMPHomePageButton[0] = CreateIconAndTextButton( giIMPHomePageButtonImage[0], pImpButtonText[ 0 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 286 - 106 ), LAPTOP_SCREEN_WEB_UL_Y + ( 248 - 48), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPAboutUsCallback); + + + SetButtonCursor(giIMPHomePageButton[ 0 ], CURSOR_WWW); + + return; + +} + + + +void RemoveIMPHomePageButtons( void ) +{ + // this procedure will destroy the already created buttosn for the IMP homepage + + // the about us button + RemoveButton(giIMPHomePageButton[0] ); + UnloadButtonImage(giIMPHomePageButtonImage[0] ); + + return; +} + + + +void BtnIMPAboutUsCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP Homepage About US button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_ABOUT_US; + fButtonPendingFlag = TRUE; + } + } +} diff --git a/Laptop/IMP HomePage.h b/Laptop/IMP HomePage.h new file mode 100644 index 00000000..500ba641 --- /dev/null +++ b/Laptop/IMP HomePage.h @@ -0,0 +1,16 @@ +#ifndef __IMP_HOME_H +#define __IMP_HOME_H + + + +void EnterImpHomePage( void ); +void RenderImpHomePage( void ); +void ExitImpHomePage( void ); +void HandleImpHomePage( void ); + +// minimun glow time +#define MIN_GLOW_DELTA 100 +#define CURSOR_HEIGHT GetFontHeight( FONT14ARIAL ) + 6 + +extern INT32 GlowColorsList[][3]; +#endif \ No newline at end of file diff --git a/Laptop/IMP MainPage.cpp b/Laptop/IMP MainPage.cpp new file mode 100644 index 00000000..df21a74f --- /dev/null +++ b/Laptop/IMP MainPage.cpp @@ -0,0 +1,881 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "IMP MainPage.h" + #include "CharProfile.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "finances.h" + #include "IMP Attribute Selection.h" + #include "IMP Text System.h" + #include "IMP Finish.h" + #include "mousesystem.h" + #include "Merc Hiring.h" + #include "LaptopSave.h" + #include "IMP Compile Character.h" + #include "IMP Portraits.h" +#endif + + +#define MAIN_PAGE_BUTTON_TEXT_WIDTH 95 + + +#define MAIN_PAGE_SPACE_BTN_BUTTONS 120 + +#define MAIN_PAGE__FIRST_BUTTON_POS_X ( LAPTOP_SCREEN_UL_X + 15 ) +#define MAIN_PAGE__SECOND_BUTTON_POS_X ( MAIN_PAGE__FIRST_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) +#define MAIN_PAGE__THIRD_BUTTON_POS_X ( MAIN_PAGE__SECOND_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) +#define MAIN_PAGE__FOURTH_BUTTON_POS_X ( MAIN_PAGE__THIRD_BUTTON_POS_X + MAIN_PAGE_SPACE_BTN_BUTTONS ) + + +// main page buttons +INT32 giIMPMainPageButton[6]; +INT32 giIMPMainPageButtonImage[6]; + +extern INT32 iCurrentVoices; + +// mouse regions for not entablable warning +MOUSE_REGION pIMPMainPageMouseRegions[ 4 ]; + +UINT32 guiCHARACTERPORTRAITFORMAINPAGE; + +// function definitions +void CreateIMPMainPageButtons( void ); +void DeleteIMPMainPageButtons( void ); +void BtnIMPMainPageBackCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPMainPageBeginCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPMainPagePersonalityCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPMainPagePortraitCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPMainPageAttributesCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPMainPagePortraitCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPMainPageVoiceCallback(GUI_BUTTON *btn,INT32 reason); +void ShadeUnSelectableButtons( void ); +void UpDateIMPMainPageButtons( void ); +void BeginMessageBoxCallBack( UINT8 bExitValue ); +void DestoryMouseRegionsForIMPMainPageBasedOnCharGenStatus( void ); +void CreateMouseRegionsForIMPMainPageBasedOnCharGenStatus( void ); +void IMPMainPageNotSelectableBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ); +BOOLEAN LoadCharacterPortraitForMainPage( void ); +BOOLEAN IMP_CanWeDisplayVoiceGraph( ); +BOOLEAN IMP_CanWeDisplaySpecialtiesGraph( ); +BOOLEAN IMP_CanWeDisplayAttributeGraph( ); +BOOLEAN IMP_CanWeDisplayPortrait( ); + + +BOOLEAN CheckIfFinishedCharacterGeneration( void ); + +// this is the current state of profiling the player is in. +/* + 0 - Beginning + 1 - Personnality + 2 - Attributes and Skills + 3 - Portrait + 4 - Voice + 5 - Done + */ + +INT32 iCurrentProfileMode = IMP__REGISTRY; + + + +void EnterIMPMainPage( void ) +{ + + // turn off review mode + fReviewStats = FALSE; + + + // create buttons + CreateIMPMainPageButtons( ); + + // load portrait for face button, if applicable + LoadCharacterPortraitForMainPage( ); + + // create button masks for this screen + CreateMouseRegionsForIMPMainPageBasedOnCharGenStatus( ); + + // alter states + UpDateIMPMainPageButtons( ); + + // entry into IMP about us page + RenderIMPMainPage( ); + + return; +} + + +void ExitIMPMainPage( void ) +{ + // exit from IMP About us page + + // delete Buttons + DeleteIMPMainPageButtons( ); + DestoryMouseRegionsForIMPMainPageBasedOnCharGenStatus( ); + + return; +} + + +void RenderIMPMainPage( void ) +{ + // rneders the IMP about us page + + // the background + RenderProfileBackGround( ); + + // the IMP symbol + //RenderIMPSymbol( 106, 1 ); + // indent + RenderMainIndentFrame( 164, 74 ); + + return; +} + + +void HandleIMPMainPage( void ) +{ + // handles the IMP about main page + + if ( CheckIfFinishedCharacterGeneration( ) ) + { + iCurrentImpPage = IMP_FINISH; + } + // shade out buttons that should be shaded/unselectable + //ShadeUnSelectableButtons( ); + return; +} + +// +// this function will create the buttons needed for th IMP about us page +// +void CreateIMPMainPageButtons( void ) +{ + UINT16 usPosX=0; + + CHAR16 sString[ 128 ]; + + + // the back button button + giIMPMainPageButtonImage[0]= LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); + + + /* giIMPMainPageButton[0] = QuickCreateButton( giIMPMainPageButtonImage[0], LAPTOP_SCREEN_UL_X + 10 , LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBackCallback); + + */ + + //Cancel/back button + giIMPMainPageButton[0] = CreateIconAndTextButton( giIMPMainPageButtonImage[0], pImpButtonText[ 19 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 15, LAPTOP_SCREEN_WEB_UL_Y + ( 360 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBackCallback); + + + SpecifyButtonTextSubOffsets( giIMPMainPageButton[0], 0, -1, FALSE ); + + // the begin profiling button + giIMPMainPageButtonImage[1]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + /*giIMPMainPageButton[1] = QuickCreateButton( giIMPMainPageButtonImage[1], LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBeginCallback); +*/ + + //Registry/Begin button + if(( iCurrentProfileMode == IMP__REGISTRY )||( iCurrentProfileMode > IMP__ATTRIBUTES) ) + { + giIMPMainPageButton[1] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 1 ], pImpButtonText[ 1 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBeginCallback); + } + else + { + giIMPMainPageButton[1] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 1 ], pImpButtonText[ 22 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + 136 , LAPTOP_SCREEN_WEB_UL_Y + ( 174 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageBeginCallback); + } + + + + // the personality button + giIMPMainPageButtonImage[2]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + + /* + giIMPMainPageButton[2] = QuickCreateButton( giIMPMainPageButtonImage[2], LAPTOP_SCREEN_UL_X + 13 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePersonalityCallback); +*/ + //Personality + giIMPMainPageButton[2] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 2 ], pImpButtonText[ 2 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__THIRD_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePersonalityCallback); + + + if( IMP_CanWeDisplaySpecialtiesGraph( ) ) + { + SpecifyButtonIcon( giIMPMainPageButton[2], guiANALYSE, 0, 33, 23, FALSE ); + } + + + + // the attribs button + giIMPMainPageButtonImage[3]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + + /* + giIMPMainPageButton[3] = QuickCreateButton( giIMPMainPageButtonImage[3], LAPTOP_SCREEN_UL_X + 133 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageAttributesCallback); +*/ + //Attributes + giIMPMainPageButton[3] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 3 ], pImpButtonText[ 3 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__FOURTH_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageAttributesCallback); + + if( IMP_CanWeDisplayAttributeGraph( ) ) + { + SpecifyButtonIcon( giIMPMainPageButton[3], guiATTRIBUTEGRAPH, 0, 25, 25, FALSE ); + } + + + // the portrait button + giIMPMainPageButtonImage[4]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + + /*giIMPMainPageButton[4] = QuickCreateButton( giIMPMainPageButtonImage[4], LAPTOP_SCREEN_UL_X + 253 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePortraitCallback); + */ + + //Portrait + giIMPMainPageButton[4] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 4 ], pImpButtonText[ 4 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__FIRST_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPagePortraitCallback); + + + + // the voice button + giIMPMainPageButtonImage[5]= LoadButtonImage( "LAPTOP\\button_8.sti" ,-1,0,-1,1,-1 ); + /*giIMPMainPageButton[5] = QuickCreateButton( giIMPMainPageButtonImage[5], LAPTOP_SCREEN_UL_X + 373 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageVoiceCallback); + */ + + if( iCurrentProfileMode != IMP__VOICE && iCurrentProfileMode != IMP__PORTRAIT ) + { + swprintf( sString, pImpButtonText[ 5 ], iCurrentVoices + 1 ); + } + else + { + swprintf( sString, pImpButtonText[ 25 ] ); + } + + //Voice + giIMPMainPageButton[5] = CreateIconAndTextButton( giIMPMainPageButtonImage[ 5 ], sString, FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MAIN_PAGE__SECOND_BUTTON_POS_X, LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPMainPageVoiceCallback); + + if( IMP_CanWeDisplayVoiceGraph( ) ) + { + SpecifyButtonIcon( giIMPMainPageButton[5], guiSMALLSILHOUETTE, 0, 33, 23, FALSE ); + } + + + + + + SetButtonCursor(giIMPMainPageButton[ 0 ], CURSOR_WWW); + SetButtonCursor(giIMPMainPageButton[ 1 ], CURSOR_WWW); + SetButtonCursor(giIMPMainPageButton[ 2 ], CURSOR_WWW); + SetButtonCursor(giIMPMainPageButton[ 3 ], CURSOR_WWW); + SetButtonCursor(giIMPMainPageButton[ 4 ], CURSOR_WWW); + SetButtonCursor(giIMPMainPageButton[ 5 ], CURSOR_WWW); + + SpecifyButtonTextOffsets( giIMPMainPageButton[ 2 ], 10, 40, TRUE ); + SpecifyButtonTextOffsets( giIMPMainPageButton[ 3 ], 10, 40, TRUE ); + SpecifyButtonTextOffsets( giIMPMainPageButton[ 4 ], 10, 40, TRUE ); + SpecifyButtonTextOffsets( giIMPMainPageButton[ 5 ], 10, 40, TRUE ); + + + SpecifyButtonTextWrappedWidth( giIMPMainPageButton[ 2 ], MAIN_PAGE_BUTTON_TEXT_WIDTH); + SpecifyButtonTextWrappedWidth( giIMPMainPageButton[ 3 ], MAIN_PAGE_BUTTON_TEXT_WIDTH); + SpecifyButtonTextWrappedWidth( giIMPMainPageButton[ 4 ], MAIN_PAGE_BUTTON_TEXT_WIDTH); + SpecifyButtonTextWrappedWidth( giIMPMainPageButton[ 5 ], MAIN_PAGE_BUTTON_TEXT_WIDTH); + return; +} + + +void DeleteIMPMainPageButtons( void ) +{ + // this function destroys the buttons needed for the IMP about Us Page + + // the back button + RemoveButton(giIMPMainPageButton[0] ); + UnloadButtonImage(giIMPMainPageButtonImage[0] ); + + // begin profiling button + RemoveButton(giIMPMainPageButton[1] ); + UnloadButtonImage(giIMPMainPageButtonImage[1] ); + + // begin personna button + RemoveButton(giIMPMainPageButton[2] ); + UnloadButtonImage(giIMPMainPageButtonImage[2] ); + + // begin attribs button + RemoveButton(giIMPMainPageButton[3] ); + UnloadButtonImage(giIMPMainPageButtonImage[3] ); + + // begin portrait button + RemoveButton(giIMPMainPageButton[4] ); + UnloadButtonImage(giIMPMainPageButtonImage[4] ); + + // begin voice button + RemoveButton(giIMPMainPageButton[5] ); + UnloadButtonImage(giIMPMainPageButtonImage[5] ); + + + return; +} + +void BtnIMPMainPageBackCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP Homepage About US button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_HOME_PAGE; + fButtonPendingFlag = TRUE; + iCurrentProfileMode = IMP__REGISTRY; + fFinishedCharGeneration = FALSE; + ResetCharacterStats( ); + } + } +} + +void BtnIMPMainPageBeginCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for Main Page Begin Profiling + + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + // too far along to change gender + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // are we going to change name, or do we have to start over from scratch + if( iCurrentProfileMode > IMP__ATTRIBUTES ) + { + // too far along, restart + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 1 ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, BeginMessageBoxCallBack); + + } + else + { + if( LaptopSaveInfo.iCurrentBalance < COST_OF_PROFILE ) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 3 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, BeginMessageBoxCallBack); + + } + else if( NumberOfMercsOnPlayerTeam() >= 18 ) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 5 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, BeginMessageBoxCallBack); + } + else + { + // change name + iCurrentImpPage = IMP_BEGIN; + fButtonPendingFlag = TRUE; + } + } + + } + } +} + + +void BtnIMPMainPagePersonalityCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for Main Page Begin Profiling + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + +/* + // if not this far in char generation, don't alot ANY action + if( iCurrentProfileMode != IMP__PERSONALITY ) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + return; + } +*/ + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_PERSONALITY; + fButtonPendingFlag = TRUE; + } + } +} + +void BtnIMPMainPageAttributesCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for Main Page Begin Profiling + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + // if not this far in char generation, don't alot ANY action + if( iCurrentProfileMode < IMP__ATTRIBUTES ) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + return; + } + + + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_ATTRIBUTE_ENTRANCE; + fButtonPendingFlag = TRUE; + } + } +} + +void BtnIMPMainPagePortraitCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for Main Page Begin Profiling + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + // if not this far in char generation, don't alot ANY action + if( ( iCurrentProfileMode != IMP__PORTRAIT )&&( iCurrentProfileMode != IMP__VOICE ) && ( iCurrentProfileMode > IMP__FINISH ) ) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + return; + } + + + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_PORTRAIT; + fButtonPendingFlag = TRUE; + } + } +} + + +void BtnIMPMainPageVoiceCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for Main Page Begin Profiling + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + // if not this far in char generation, don't alot ANY action + if( ( iCurrentProfileMode != IMP__PORTRAIT ) && ( iCurrentProfileMode > IMP__FINISH ) ) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + return; + } + + + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + iCurrentImpPage = IMP_VOICE; + fButtonPendingFlag = TRUE; + } + } +} + + +void NextProfilingMode( void ) +{ + // this function will change to mode the player is in for profiling + + // if less than done + if(iCurrentProfileMode < IMP__VOICE) + iCurrentProfileMode++; + + return; +} + +BOOLEAN CheckIfFinishedCharacterGeneration( void ) +{ + // this function checks to see if character is done character generation + + // are we done character generation + if( iCurrentProfileMode == IMP__FINISH ) + { + // yes + return ( TRUE ); + } + else + { + // no + return ( FALSE ); + } +} + +void ShadeUnSelectableButtons( void ) +{ + + INT32 iCounter =0; + // this function looks at the status ofiCurrentProfileMode and decides which buttons + // should be shaded ( unselectable ) + + for( iCounter = iCurrentProfileMode; iCounter < 5; iCounter++ ) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, 13 + (iCounter ) * 120 + 114, 245, 13 + ( iCounter + 1 ) * 120 + 90, 245 + 92 ); + InvalidateRegion(13 + (iCounter ) * 120 + 114, 245, 13 + (iCounter ) * 120 + 114, 245 + 92 ); + } + + fMarkButtonsDirtyFlag = FALSE; + return; +} + + +void UpDateIMPMainPageButtons( void ) +{ + // update mainpage button states + INT32 iCount = 0; + + // disable all + for( iCount = 2; iCount < 6; iCount++) + { + DisableButton( giIMPMainPageButton[ iCount ] ); + } + + for( iCount = 0; iCount < 4; iCount++ ) + { + MSYS_DisableRegion( &pIMPMainPageMouseRegions[ iCount ]); + } + // enable + switch( iCurrentProfileMode ) + { + //begin + case IMP__REGISTRY: + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); + break; + + //Personality ( 3RD BUTTON ) + case IMP__PERSONALITY: + EnableButton( giIMPMainPageButton[2] ); + EnableButton( giIMPMainPageButton[4] ); + EnableButton( giIMPMainPageButton[5] ); + +// MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); +// MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); +/* + EnableButton( giIMPMainPageButton[2] ); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); +*/ + break; + + //Attributes ( 4th button ) + case IMP__ATTRIBUTES: + EnableButton( giIMPMainPageButton[2] ); + EnableButton( giIMPMainPageButton[4] ); + EnableButton( giIMPMainPageButton[5] ); + EnableButton( giIMPMainPageButton[3] ); + +// MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); +// MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); +// MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); +/* + EnableButton( giIMPMainPageButton[3] ); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); +*/ + break; + + //Portrait ( ist button + case IMP__PORTRAIT: +// EnableButton( giIMPMainPageButton[3] ); + EnableButton( giIMPMainPageButton[4] ); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); +/* + EnableButton( giIMPMainPageButton[3] ); + EnableButton( giIMPMainPageButton[4] ); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); + //MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); +*/ + break; + + //Voice ( 2nd button ) + case IMP__VOICE: + EnableButton( giIMPMainPageButton[4] ); + EnableButton( giIMPMainPageButton[5] ); + +// MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 2 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 3 ]); +/* + //MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 1 ]); + MSYS_EnableRegion( &pIMPMainPageMouseRegions[ 0 ]); + EnableButton( giIMPMainPageButton[3] ); + EnableButton( giIMPMainPageButton[4] ); + EnableButton( giIMPMainPageButton[5] ); +*/ + break; + } + + return; +} + +void BeginMessageBoxCallBack( UINT8 bExitValue ) +{ + // yes, so start over, else stay here and do nothing for now + if( bExitValue == MSG_BOX_RETURN_YES ) + { + iCurrentImpPage = IMP_BEGIN; + iCurrentProfileMode = IMP__REGISTRY; + } + + else if( bExitValue == MSG_BOX_RETURN_OK ) + { + // if ok, then we are coming from financial warning, allow continue + } + return; +} + + +void CreateMouseRegionsForIMPMainPageBasedOnCharGenStatus( void ) +{ + // this procedure will create masks for the char generation main page + + + // mask for personality page button + MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 0 ],LAPTOP_SCREEN_UL_X + 13 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 13 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, + CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); + + // mask for attrib page button + MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 1 ],LAPTOP_SCREEN_UL_X + 133 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 133 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, + CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); + + + + // mask for portrait page button + MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 2 ],LAPTOP_SCREEN_UL_X + 253 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 253 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, + CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); + + + + + // mask for voice page button + MSYS_DefineRegion( &pIMPMainPageMouseRegions[ 3 ],LAPTOP_SCREEN_UL_X + 373 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ), LAPTOP_SCREEN_UL_X + 373 + 115 , LAPTOP_SCREEN_WEB_UL_Y + ( 245 ) + 93 , MSYS_PRIORITY_HIGH+5, + CURSOR_WWW, MSYS_NO_CALLBACK, IMPMainPageNotSelectableBtnCallback ); + + + + + + + return; +} + + + +void DestoryMouseRegionsForIMPMainPageBasedOnCharGenStatus( void ) +{ + // will destroy button masks for the char gen pages + + + MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 0 ]); + + MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 1 ]); + + MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 2 ]); + + MSYS_RemoveRegion( &pIMPMainPageMouseRegions[ 3 ]); + + + + return; +} + +void IMPMainPageNotSelectableBtnCallback(MOUSE_REGION * pRegion, INT32 iReason ) +{ + + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + return; + } + + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + DoLapTopMessageBox( MSG_BOX_IMP_STYLE, pImpPopUpStrings[ 4 ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, BeginMessageBoxCallBack); + } + + return; +} + + +BOOLEAN LoadCharacterPortraitForMainPage( void ) +{ + // this function will load the character's portrait, to be used on portrait button + VOBJECT_DESC VObjectDesc; + + if( IMP_CanWeDisplayPortrait( ) ) + { + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pPlayerSelectedFaceFileNames[ iPortraitNumber ] , VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCHARACTERPORTRAITFORMAINPAGE)); + + + // now specify + SpecifyButtonIcon( giIMPMainPageButton[4], guiCHARACTERPORTRAITFORMAINPAGE, 0, + 33, 23, FALSE ); + } + + return( TRUE ); +} + + + +BOOLEAN IMP_CanWeDisplayPortrait( ) +{ + if( iCurrentProfileMode == IMP__VOICE || + iCurrentProfileMode == IMP__ATTRIBUTES || + iCurrentProfileMode == IMP__PERSONALITY || + iCurrentProfileMode == IMP__FINISH ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + +BOOLEAN IMP_CanWeDisplayAttributeGraph( ) +{ + if( iCurrentProfileMode == IMP__FINISH ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + + + +BOOLEAN IMP_CanWeDisplaySpecialtiesGraph( ) +{ + if( iCurrentProfileMode == IMP__ATTRIBUTES || + iCurrentProfileMode == IMP__FINISH ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + + +BOOLEAN IMP_CanWeDisplayVoiceGraph( ) +{ + if( iCurrentProfileMode == IMP__ATTRIBUTES || +// iCurrentProfileMode == IMP__VOICE || + iCurrentProfileMode == IMP__PERSONALITY || + iCurrentProfileMode == IMP__FINISH ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} diff --git a/Laptop/IMP MainPage.h b/Laptop/IMP MainPage.h new file mode 100644 index 00000000..ec5e99c2 --- /dev/null +++ b/Laptop/IMP MainPage.h @@ -0,0 +1,28 @@ +#ifndef __IMP_MAINPAGE_H +#define __IMP_MAINPAGE_H +#include "types.h" + +void RenderIMPMainPage( void ); +void ExitIMPMainPage( void ); +void EnterIMPMainPage( void ); +void HandleIMPMainPage( void ); +void NextProfilingMode( void ); +void ShadeUnSelectableButtons( void ); + + +extern INT32 iCurrentProfileMode; + + +//enums for the various Profile modes +enum +{ + IMP__REGISTRY, + IMP__PERSONALITY, + IMP__ATTRIBUTES, + IMP__PORTRAIT, + IMP__VOICE, + IMP__FINISH, +}; + + +#endif \ No newline at end of file diff --git a/Laptop/IMP Personality Entrance.cpp b/Laptop/IMP Personality Entrance.cpp new file mode 100644 index 00000000..cd80dc13 --- /dev/null +++ b/Laptop/IMP Personality Entrance.cpp @@ -0,0 +1,130 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "CharProfile.h" + #include "IMP Personality Entrance.h" + #include "IMP MainPage.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Text System.h" +#endif + +// IMP personality entrance buttons +INT32 giIMPPersonalityEntranceButton[1]; +INT32 giIMPPersonalityEntranceButtonImage[1]; + + +// function definitions +void CreateIMPPersonalityEntranceButtons( void ); +void DestroyIMPPersonalityEntranceButtons( void ); +void BtnIMPPersonalityEntranceDoneCallback(GUI_BUTTON *btn,INT32 reason); + + +void EnterIMPPersonalityEntrance( void ) +{ + // create buttons needed + CreateIMPPersonalityEntranceButtons( ); + + + return; +} + +void RenderIMPPersonalityEntrance( void ) +{ + // the background + RenderProfileBackGround( ); + + // the IMP symbol + //RenderIMPSymbol( 112, 30 ); + + // indent + RenderAvgMercIndentFrame(90, 40 ); + return; +} + +void ExitIMPPersonalityEntrance( void ) +{ + // destroy buttons needed + DestroyIMPPersonalityEntranceButtons( ); + + + + return; +} + + +void HandleIMPPersonalityEntrance( void ) +{ + + + + return; +} + + +void CreateIMPPersonalityEntranceButtons( void ) +{ + // this function will create the buttons needed for the IMP personality Page + + // ths begin button + giIMPPersonalityEntranceButtonImage[0]= LoadButtonImage( "LAPTOP\\button_2.sti" ,-1,0,-1,1,-1 ); + /*giIMPPersonalityEntranceButton[0] = QuickCreateButton( giIMPPersonalityEntranceButtonImage[0], LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityEntranceDoneCallback); +*/ + giIMPPersonalityEntranceButton[0] = CreateIconAndTextButton( giIMPPersonalityEntranceButtonImage[0], pImpButtonText[ 1 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 136 ), LAPTOP_SCREEN_WEB_UL_Y + ( 314 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityEntranceDoneCallback); + + + SetButtonCursor(giIMPPersonalityEntranceButton[0], CURSOR_WWW); + + return; +} + +void DestroyIMPPersonalityEntranceButtons( void ) +{ + // this function will destroy the buttons needed for the IMP personality page + + // the begin button + RemoveButton(giIMPPersonalityEntranceButton[0] ); + UnloadButtonImage(giIMPPersonalityEntranceButtonImage[0] ); + + return; +} + + +void BtnIMPPersonalityEntranceDoneCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP Begin Screen done button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // done with begin screen, next screen + iCurrentImpPage = IMP_PERSONALITY_QUIZ; + fButtonPendingFlag = TRUE; + } + } +} \ No newline at end of file diff --git a/Laptop/IMP Personality Entrance.h b/Laptop/IMP Personality Entrance.h new file mode 100644 index 00000000..dc82d663 --- /dev/null +++ b/Laptop/IMP Personality Entrance.h @@ -0,0 +1,10 @@ +#ifndef _PERSONALITY_ENTRANCE_H +#define _PERSONALITY_ENTRANCE_H + + +void EnterIMPPersonalityEntrance( void ); +void RenderIMPPersonalityEntrance( void ); +void ExitIMPPersonalityEntrance( void ); +void HandleIMPPersonalityEntrance( void ); + +#endif \ No newline at end of file diff --git a/Laptop/IMP Personality Finish.cpp b/Laptop/IMP Personality Finish.cpp new file mode 100644 index 00000000..64271308 --- /dev/null +++ b/Laptop/IMP Personality Finish.cpp @@ -0,0 +1,392 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "CharProfile.h" + #include "IMP Personality Finish.h" + #include "IMP MainPage.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Timer Control.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Text System.h" + #include "IMP Compile Character.h" +#endif + +// this is the amount of time, the player waits until booted back to main profileing screen + +UINT8 bPersonalityEndState = 0; + +#define PERSONALITY_CONFIRM_FINISH_DELAY 2500 + + +// flag set when player hits YES/NO button +BOOLEAN fConfirmHasBeenSelectedFlag = FALSE; +BOOLEAN fConfirmIsYesFlag = FALSE; +BOOLEAN fOkToReturnIMPMainPageFromPersonalityFlag = FALSE; +BOOLEAN fCreatedOkIMPButton = FALSE; +BOOLEAN fExitDueFrIMPPerFinToOkButton = FALSE; +BOOLEAN fExitIMPPerFinAtOk = FALSE; +BOOLEAN fCreateFinishOkButton = FALSE; + + +// buttons +UINT32 giIMPPersonalityFinishButton[2]; +UINT32 giIMPPersonalityFinishButtonImage[2]; + + + +// function definitions +void CreateIMPPersonalityFinishButtons( void ); +void CheckIfConfirmHasBeenSelectedAndTimeDelayHasPassed( void ); +void DestroyIMPersonalityFinishButtons( void ); +void CreatePersonalityFinishOkButton( void ); +void DestroyPersonalityFinishOkButton( void ); + + + +// callbacks +void BtnIMPPersonalityFinishYesCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityFinishNoCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityFinishOkCallback(GUI_BUTTON *btn,INT32 reason); + + + +void EnterIMPPersonalityFinish( void ) +{ + + // reset states + fCreateFinishOkButton = FALSE; + bPersonalityEndState = 0; + fConfirmIsYesFlag = FALSE; + + // create the buttons + CreateIMPPersonalityFinishButtons( ); + + return; +} + +void RenderIMPPersonalityFinish( void ) +{ + // the background + RenderProfileBackGround( ); + + // indent for text + RenderBeginIndent( 110, 93 ); + + // check confirm flag to decide if we have to display appropriate response to button action + if( fConfirmHasBeenSelectedFlag ) + { + // confirm was yes, display yes string + if(fConfirmIsYesFlag == TRUE) + { + // display yes string + PrintImpText( ); + } + else + { + // display no string + PrintImpText( ); + } + } + return; +} + +void ExitIMPPersonalityFinish( void ) +{ + + // exit at IMP Ok button + if( fExitIMPPerFinAtOk ) + { + // destroy the finish ok buttons + DestroyPersonalityFinishOkButton( ); + } + + + if( ( fExitDueFrIMPPerFinToOkButton == FALSE ) &&( fExitIMPPerFinAtOk == FALSE ) ) + { + // exit due to cancel button, not ok or Yes/no button + // get rid of yes no + DestroyIMPersonalityFinishButtons( ); + } + + + fCreatedOkIMPButton = FALSE; + fOkToReturnIMPMainPageFromPersonalityFlag = FALSE; + fConfirmHasBeenSelectedFlag = FALSE; + return; +} + + +void HandleIMPPersonalityFinish( void ) +{ + + // check if confirm and delay + CheckIfConfirmHasBeenSelectedAndTimeDelayHasPassed( ); + + + return; +} + + +void CheckIfConfirmHasBeenSelectedAndTimeDelayHasPassed( void ) +{ + // this function will check to see if player has in fact confirmed selection and delay to + // read text has occurred + + + + // if not confirm selected, return + if( fConfirmHasBeenSelectedFlag == FALSE ) + { + return; + } + + if( fCreateFinishOkButton == TRUE ) + { + fCreateFinishOkButton = FALSE; + CreatePersonalityFinishOkButton( ); + fCreatedOkIMPButton = TRUE; + } + + // create ok button + if( fCreatedOkIMPButton == FALSE ) + { + DestroyIMPersonalityFinishButtons( ); + fCreateFinishOkButton = TRUE; + fExitIMPPerFinAtOk = TRUE; + } + + // ok to return + if( fOkToReturnIMPMainPageFromPersonalityFlag == TRUE ) + { + DestroyPersonalityFinishOkButton( ); + fCreatedOkIMPButton = FALSE; + fOkToReturnIMPMainPageFromPersonalityFlag = FALSE; + fConfirmHasBeenSelectedFlag = FALSE; + fExitDueFrIMPPerFinToOkButton = TRUE; + } + + return; +} + + +void CreateIMPPersonalityFinishButtons( void ) +{ + // this function will create the buttons needed for the IMP personality Finish Page + + // ths Yes button + giIMPPersonalityFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); +/* giIMPPersonalityFinishButton[0] = QuickCreateButton( giIMPPersonalityFinishButtonImage[0], LAPTOP_SCREEN_UL_X + ( 90 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishYesCallback); +*/ + giIMPPersonalityFinishButton[0] = CreateIconAndTextButton( giIMPPersonalityFinishButtonImage[0], pImpButtonText[ 9 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 90 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishYesCallback); + + // the no Button + giIMPPersonalityFinishButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); +/* giIMPPersonalityFinishButton[ 1 ] = QuickCreateButton( giIMPPersonalityFinishButtonImage[1], LAPTOP_SCREEN_UL_X + ( 276 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishNoCallback); + */ + giIMPPersonalityFinishButton[ 1 ] = CreateIconAndTextButton( giIMPPersonalityFinishButtonImage[ 1 ], pImpButtonText[ 10 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 276 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishNoCallback); + + SetButtonCursor(giIMPPersonalityFinishButton[0], CURSOR_WWW); + SetButtonCursor(giIMPPersonalityFinishButton[1], CURSOR_WWW); + + + return; +} + + +void DestroyIMPersonalityFinishButtons( void ) +{ + // this function will destroy the buttons needed for the IMP personality Finish page + + // the yes button + RemoveButton(giIMPPersonalityFinishButton[ 0 ] ); + UnloadButtonImage(giIMPPersonalityFinishButtonImage[ 0 ] ); + + // the no button + RemoveButton(giIMPPersonalityFinishButton[ 1 ] ); + UnloadButtonImage(giIMPPersonalityFinishButtonImage[ 1 ] ); + + return; +} + + +void BtnIMPPersonalityFinishYesCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + // confirm flag set, get out of HERE! + if( fConfirmHasBeenSelectedFlag ) + { + // now set this button off + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + return; + } + + btn->uiFlags|=(BUTTON_CLICKED_ON); + + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + + // now set this button off + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // set fact yes was selected + fConfirmIsYesFlag = TRUE; + + // set fact that confirmation has been done + fConfirmHasBeenSelectedFlag = TRUE; + + // now make skill, personality and attitude + CreatePlayersPersonalitySkillsAndAttitude( ); + fButtonPendingFlag = TRUE; + bPersonalityEndState = 1; + } + } +} + + + +void BtnIMPPersonalityFinishNoCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + // confirm flag set, get out of HERE! + if( fConfirmHasBeenSelectedFlag ) + { + // now set this button off + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + return; + } + + btn->uiFlags|=(BUTTON_CLICKED_ON); + + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + + // now set this button on + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // set fact yes was selected + fConfirmIsYesFlag = FALSE; + + // set fact that confirmation has been done + fConfirmHasBeenSelectedFlag = TRUE; + CreatePlayersPersonalitySkillsAndAttitude( ); + + bPersonalityEndState = 2; + fButtonPendingFlag = TRUE; + } + } +} + + + +void CreatePersonalityFinishOkButton( void ) +{ + + // create personality button finish button + giIMPPersonalityFinishButtonImage[0]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityFinishButton[0] = CreateIconAndTextButton( giIMPPersonalityFinishButtonImage[0], pImpButtonText[ 24 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 186 ), LAPTOP_SCREEN_WEB_UL_Y + ( 224 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityFinishOkCallback); + + SetButtonCursor(giIMPPersonalityFinishButton[0], CURSOR_WWW); + + + return; +} + + +void DestroyPersonalityFinishOkButton( void ) +{ + // the ok button + RemoveButton(giIMPPersonalityFinishButton[ 0 ] ); + UnloadButtonImage(giIMPPersonalityFinishButtonImage[ 0 ] ); +} + + + +void BtnIMPPersonalityFinishOkCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + + btn->uiFlags|=(BUTTON_CLICKED_ON); + + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // now set this button on + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // Testing UB stuff + // if( iCurrentProfileMode < 2 ) + // { + // iCurrentProfileMode = 2; + // } + + // button pending, wait a frame + fButtonPendingFlag = TRUE; + iCurrentImpPage = IMP_MAIN_PAGE; + + + if( iCurrentProfileMode != IMP__FINISH ) + { + iCurrentProfileMode = IMP__ATTRIBUTES; + } + else + { + iCurrentImpPage = IMP_FINISH;//IMP__ATTRIBUTES; + } + } + } +} \ No newline at end of file diff --git a/Laptop/IMP Personality Finish.h b/Laptop/IMP Personality Finish.h new file mode 100644 index 00000000..2d1400cd --- /dev/null +++ b/Laptop/IMP Personality Finish.h @@ -0,0 +1,12 @@ +#ifndef _PERSONALITY_FINISH_H +#define _PERSONALITY_FINISH_H + +void EnterIMPPersonalityFinish( void ); +void RenderIMPPersonalityFinish( void ); +void ExitIMPPersonalityFinish( void ); +void HandleIMPPersonalityFinish( void ); + +extern UINT8 bPersonalityEndState; + + +#endif \ No newline at end of file diff --git a/Laptop/IMP Personality Quiz.cpp b/Laptop/IMP Personality Quiz.cpp new file mode 100644 index 00000000..efc24239 --- /dev/null +++ b/Laptop/IMP Personality Quiz.cpp @@ -0,0 +1,1862 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "CharProfile.h" + #include "IMP Personality Quiz.h" + #include "IMP MainPage.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Compile Character.h" + #include "soldier profile type.h" + #include "IMP Text System.h" + #include "input.h" + #include "english.h" +#endif + +// Kaiden this line was commented before I screwed with it +//extern struct POINT; + +UINT32 giIMPPersonalityQuizButton[ 2 ]; +UINT32 giIMPPersonalityQuizButtonImage[ 2 ]; + + +// these are the buttons for the current question +INT32 giIMPPersonalityQuizAnswerButton[ 10 ]; +INT32 giIMPPersonalityQuizAnswerButtonImage[ 10 ]; + +INT32 giPreviousQuestionButton; +INT32 giNextQuestionButton; + +INT32 giPreviousQuestionButtonImage; +INT32 giNextQuestionButtonImage; + +// this the currently highlighted answer +INT32 iCurrentAnswer = -1; + +// the current quiz question +INT32 giCurrentPersonalityQuizQuestion = 0; +INT32 giPreviousPersonalityQuizQuestion = -1; +INT32 giMaxPersonalityQuizQuestion = 0; + +// start over flag +BOOLEAN fStartOverFlag = FALSE; + + +#define BTN_FIRST_COLUMN_X 15 +#define BTN_SECOND_COLUMN_X 256 + +#define INDENT_OFFSET 55 + +// number of IMP questions +#define MAX_NUMBER_OF_IMP_QUESTIONS 16 + +// answer list +INT32 iQuizAnswerList[MAX_NUMBER_OF_IMP_QUESTIONS]; +// current number of buttons being shown +INT32 iNumberOfPersonaButtons = 0; + +// function definitions +void DestroyIMPPersonalityQuizAnswerButtons(INT32 iNumberOfButtons ); +void CreateIMPPersonalityQuizAnswerButtons( void ); +void CreateIMPPersonalityQuizButtons( void ); +void DestroyIMPersonalityQuizButtons( void ); +void AddIMPPersonalityQuizAnswerButtons( INT32 iNumberOfButtons ); +void DestroyPersonalityQuizButtons( void ); +void ResetQuizAnswerButtons( ); +void CompileQuestionsInStatsAndWhatNot( void ); +void PrintQuizQuestionNumber( void ); +void CheckStateOfTheConfirmButton( void ); +void HandleIMPQuizKeyBoard( void ); +void ToggleQuestionNumberButtonOn( INT32 iAnswerNumber ); +void MoveBackAQuestion( void ); +void MoveAheadAQuestion( void ); +void CheckAndUpdateNextPreviousIMPQuestionButtonStates( void ); + + +// answer button callbacks +void BtnIMPPersonalityQuizAnswer0Callback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityQuizAnswer1Callback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityQuizAnswer2Callback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityQuizAnswer3Callback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityQuizAnswer4Callback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityQuizAnswer5Callback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityQuizAnswer6Callback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityQuizAnswer7Callback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityQuizAnswer8Callback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityQuizAnswer9Callback(GUI_BUTTON *btn,INT32 reason); + +// other callbacks +void BtnIMPPersonalityQuizAnswerConfirmCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPersonalityQuizStartOverCallback(GUI_BUTTON *btn,INT32 reason); +void PreviousQuestionButtonCallback( GUI_BUTTON *btn, INT32 iReason ); +void NextQuestionButtonCallback( GUI_BUTTON *btn, INT32 iReason ); + + + + + + + + + +void EnterIMPPersonalityQuiz( void ) +{ + + // void answers out the quiz + memset( &iQuizAnswerList, -1, sizeof( INT32 ) * MAX_NUMBER_OF_IMP_QUESTIONS ); + + // if we are entering for first time, reset + if( giCurrentPersonalityQuizQuestion == MAX_NUMBER_OF_IMP_QUESTIONS ) + { + giCurrentPersonalityQuizQuestion = 0; + } + // reset previous + giPreviousPersonalityQuizQuestion = -1; + + // reset skills, attributes and personality + ResetSkillsAttributesAndPersonality( ); + + // create/destroy buttons for questions, if needed + CreateIMPPersonalityQuizAnswerButtons( ); + + // now reset them + ResetQuizAnswerButtons( ); + + // create other buttons + CreateIMPPersonalityQuizButtons( ); + + return; +} + +void RenderIMPPersonalityQuiz( void ) +{ + // the background + RenderProfileBackGround( ); + + // highlight answer + PrintImpText( ); + + // indent for current and last page numbers + //RenderAttrib2IndentFrame(BTN_FIRST_COLUMN_X + 2, 365 ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + + + return; +} + +void ExitIMPPersonalityQuiz( void ) +{ + + + // set previous to current, we want it's buttons gone! + giPreviousPersonalityQuizQuestion = giCurrentPersonalityQuizQuestion; + + + // destroy regular quiz buttons: the done and start over buttons + DestroyIMPersonalityQuizButtons( ); + + // destroy the buttons used for answers + DestroyPersonalityQuizButtons( ); + + if( fStartOverFlag ) + { + fStartOverFlag = FALSE; + giCurrentPersonalityQuizQuestion = 0; + } + return; +} + + +void HandleIMPPersonalityQuiz( void ) +{ + + // create/destroy buttons for questions, if needed + CreateIMPPersonalityQuizAnswerButtons( ); + + // handle keyboard input + HandleIMPQuizKeyBoard( ); + + if( iCurrentAnswer == -1) + { + DisableButton( giIMPPersonalityQuizButton[0] ); + } + + return; +} + + +void CreateIMPPersonalityQuizButtons( void ) +{ + // this function will create the buttons needed for the IMP personality quiz Page + + + + + + // ths Done button + giIMPPersonalityQuizButtonImage[0]= LoadButtonImage( "LAPTOP\\button_7.sti" ,-1,0,-1,1,-1 ); + +/* giIMPPersonalityQuizButton[0] = QuickCreateButton( giIMPPersonalityQuizButtonImage[0], LAPTOP_SCREEN_UL_X + ( 197 ), LAPTOP_SCREEN_WEB_UL_Y + ( 310 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswerConfirmCallback); +*/ + giIMPPersonalityQuizButton[0] = CreateIconAndTextButton( giIMPPersonalityQuizButtonImage[0], pImpButtonText[ 8 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 197 ), LAPTOP_SCREEN_WEB_UL_Y + ( 302 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswerConfirmCallback); + + // start over + giIMPPersonalityQuizButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); + + /* giIMPPersonalityQuizButton[ 1 ] = QuickCreateButton( giIMPPersonalityQuizButtonImage[1], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 310 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityQuizStartOverCallback); +*/ + + giIMPPersonalityQuizButton[ 1 ] = CreateIconAndTextButton( giIMPPersonalityQuizButtonImage[ 1 ], pImpButtonText[ 7 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 302 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPersonalityQuizStartOverCallback); + + giPreviousQuestionButtonImage = LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); + giPreviousQuestionButton = CreateIconAndTextButton( giPreviousQuestionButtonImage, pImpButtonText[ 12 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 197 ), LAPTOP_SCREEN_WEB_UL_Y + ( 361 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PreviousQuestionButtonCallback); + + giNextQuestionButtonImage = LoadButtonImage( "LAPTOP\\button_3.sti" ,-1,0,-1,1,-1 ); + giNextQuestionButton = CreateIconAndTextButton( giNextQuestionButtonImage, pImpButtonText[ 13 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 417 ), LAPTOP_SCREEN_WEB_UL_Y + ( 361 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)NextQuestionButtonCallback); + + + SpecifyButtonTextSubOffsets( giNextQuestionButton, 0, -1, FALSE ); + SpecifyButtonTextSubOffsets( giPreviousQuestionButton, 0, -1, FALSE ); + + DisableButton( giPreviousQuestionButton ); + DisableButton( giNextQuestionButton ); + + SetButtonCursor( giIMPPersonalityQuizButton[0], CURSOR_WWW ); + SetButtonCursor( giIMPPersonalityQuizButton[1], CURSOR_WWW ); + SetButtonCursor( giPreviousQuestionButton, CURSOR_WWW ); + SetButtonCursor( giNextQuestionButton, CURSOR_WWW ); + + return; +} + +void DestroyIMPersonalityQuizButtons( void ) +{ + // this function will destroy the buttons needed for the IMP personality quiz page + + // the done button + RemoveButton(giIMPPersonalityQuizButton[ 0 ] ); + UnloadButtonImage(giIMPPersonalityQuizButtonImage[ 0 ] ); + + // the start over button + RemoveButton(giIMPPersonalityQuizButton[ 1 ] ); + UnloadButtonImage(giIMPPersonalityQuizButtonImage[ 1 ] ); + + // previosu button + RemoveButton( giPreviousQuestionButton ); + UnloadButtonImage( giPreviousQuestionButtonImage ); + + // next button + RemoveButton( giNextQuestionButton ); + UnloadButtonImage( giNextQuestionButtonImage ); + + + return; +} + +void CreateIMPPersonalityQuizAnswerButtons( void ) +{ + // this function will create the buttons for the personality quiz answer selections + + if( IMP_PERSONALITY_QUIZ != iCurrentImpPage ) + { + // not valid pagre, get out + return; + } + + + if( giCurrentPersonalityQuizQuestion == giPreviousPersonalityQuizQuestion ) + { + // mode has not changed, return; + return; + } + + // destroy old screens buttons + DestroyPersonalityQuizButtons( ); + + // re-render screen + RenderProfileBackGround( ); + + switch( giCurrentPersonalityQuizQuestion ) + { + case ( -1 ): + // do nothing + break; + case ( 0 ): + // 6 buttons + iNumberOfPersonaButtons = 6; + break; + case ( 3 ): + // 5 buttons + iNumberOfPersonaButtons = 5; + break; + case ( 5 ): + // 5 buttons + iNumberOfPersonaButtons = 5; + break; + case ( 10 ): + // 5 buttons + iNumberOfPersonaButtons = 5; + break; + case ( 11 ): + // 5 buttons + iNumberOfPersonaButtons = 8; + + break; + default: + // 4 buttons + iNumberOfPersonaButtons = 4; + + break; + } + + AddIMPPersonalityQuizAnswerButtons( iNumberOfPersonaButtons ); + + ToggleQuestionNumberButtonOn( iQuizAnswerList[ giCurrentPersonalityQuizQuestion ] ); + + // re render text + PrintImpText( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + // title bar + RenderWWWProgramTitleBar( ); + + return; +} + + +void DestroyPersonalityQuizButtons( void ) +{ + + // this function will destroy the buttons used in the previous personality question + // destroy old buttons + switch( giPreviousPersonalityQuizQuestion ) + { + case ( -1 ): + // do nothing + break; + case ( 0 ): + // 6 buttons + DestroyIMPPersonalityQuizAnswerButtons( 6 ); + break; + case ( 3 ): + // 5 buttons + DestroyIMPPersonalityQuizAnswerButtons( 5 ); + break; + case ( 5 ): + // 5 buttons + DestroyIMPPersonalityQuizAnswerButtons( 5 ); + break; + case ( 10 ): + // 5 buttons + DestroyIMPPersonalityQuizAnswerButtons( 5 ); + break; + case ( 11 ): + // 5 buttons + DestroyIMPPersonalityQuizAnswerButtons( 8 ); + break; + default: + // 4 buttons + DestroyIMPPersonalityQuizAnswerButtons( 4 ); + break; + } + + return; +} + +void AddIMPPersonalityQuizAnswerButtons( INT32 iNumberOfButtons ) +{ + // will add iNumberofbuttons to the answer button list + INT32 iCounter = 0; + CHAR16 sString[ 32 ]; + + for(iCounter = 0; iCounter < iNumberOfButtons; iCounter++) + { + switch( iCounter ) + { + case ( 0 ): + giIMPPersonalityQuizAnswerButtonImage[0]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[0] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[0], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 97 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer0Callback); + + break; + case ( 1 ): + giIMPPersonalityQuizAnswerButtonImage[1]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[1] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[1], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 147 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer1Callback); + + break; + case ( 2 ): + giIMPPersonalityQuizAnswerButtonImage[2]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[2] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[2], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 197 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer2Callback); + + break; + case ( 3 ): + giIMPPersonalityQuizAnswerButtonImage[3]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[3] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[3], LAPTOP_SCREEN_UL_X + ( BTN_FIRST_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 247 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer3Callback); + + break; + case ( 4 ): + giIMPPersonalityQuizAnswerButtonImage[4]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[4] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[4], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 97 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer4Callback); + + break; + case ( 5 ): + giIMPPersonalityQuizAnswerButtonImage[5]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[5] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[5], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 147 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer5Callback); + + break; + case ( 6 ): + giIMPPersonalityQuizAnswerButtonImage[6]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[6] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[6], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 197 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer6Callback); + + break; + case ( 7 ): + giIMPPersonalityQuizAnswerButtonImage[7]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[7] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[7], LAPTOP_SCREEN_UL_X + ( BTN_SECOND_COLUMN_X ), LAPTOP_SCREEN_WEB_UL_Y + ( 247 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer7Callback); + + break; + case ( 8 ): + giIMPPersonalityQuizAnswerButtonImage[8]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[8] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[8], LAPTOP_SCREEN_UL_X + ( ( BTN_SECOND_COLUMN_X ) ), LAPTOP_SCREEN_WEB_UL_Y + ( 268 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer8Callback); + + break; + case ( 9 ): + giIMPPersonalityQuizAnswerButtonImage[9]= LoadButtonImage( "LAPTOP\\button_6.sti" ,-1,0,-1,1,-1 ); + giIMPPersonalityQuizAnswerButton[9] = QuickCreateButton( giIMPPersonalityQuizAnswerButtonImage[9], LAPTOP_SCREEN_UL_X + ( ( 276 - 46 ) / 2 ), LAPTOP_SCREEN_WEB_UL_Y + ( 147 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPPersonalityQuizAnswer9Callback); + + break; + } + swprintf( sString, L"%d", iCounter + 1 ); + SpecifyButtonUpTextColors( giIMPPersonalityQuizAnswerButton[ iCounter ], FONT_WHITE, FONT_BLACK ); + SpecifyButtonDownTextColors( giIMPPersonalityQuizAnswerButton[ iCounter ], FONT_WHITE, FONT_BLACK ); + SpecifyButtonTextOffsets( giIMPPersonalityQuizAnswerButton[ iCounter ], +23, +12, TRUE ); + SpecifyButtonFont( giIMPPersonalityQuizAnswerButton[ iCounter ], FONT12ARIAL ); + SpecifyButtonText( giIMPPersonalityQuizAnswerButton[ iCounter ], sString ); + SetButtonCursor( giIMPPersonalityQuizAnswerButton[ iCounter ], CURSOR_WWW); + } + + // previous is current + giPreviousPersonalityQuizQuestion = giCurrentPersonalityQuizQuestion; + return; +} + + +void DestroyIMPPersonalityQuizAnswerButtons(INT32 iNumberOfButtons ) +{ + INT32 iCounter = 0; + for(iCounter = 0; iCounter < iNumberOfButtons; iCounter++) + { + RemoveButton(giIMPPersonalityQuizAnswerButton[ iCounter ] ); + UnloadButtonImage(giIMPPersonalityQuizAnswerButtonImage[ iCounter ] ); + giIMPPersonalityQuizAnswerButton[ iCounter ] = -1; + } + + + return; +} + + +void BtnIMPPersonalityQuizAnswer0Callback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = 0; + // now set this button on + btn->uiFlags|=(BUTTON_CLICKED_ON); + + + + // highlight answer + PrintImpText( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + fReDrawCharProfile = TRUE; + } + } +} + + +void BtnIMPPersonalityQuizAnswer1Callback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // now set this button on + btn->uiFlags|=(BUTTON_CLICKED_ON); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = 1; + + // highlight answer + PrintImpText( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + fReDrawCharProfile = TRUE; + } + } +} + +void BtnIMPPersonalityQuizAnswer2Callback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // now set this button on + btn->uiFlags|=(BUTTON_CLICKED_ON); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = 2; + + // highlight answer + PrintImpText( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + fReDrawCharProfile = TRUE; + + } + } +} + +void BtnIMPPersonalityQuizAnswer3Callback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // now set this button on + btn->uiFlags|=(BUTTON_CLICKED_ON); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = 3; + + + // highlight answer + PrintImpText( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + fReDrawCharProfile = TRUE; + + } + } +} + +void BtnIMPPersonalityQuizAnswer4Callback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // now set this button on + btn->uiFlags|=(BUTTON_CLICKED_ON); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = 4; + + // highlight answer + PrintImpText( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + fReDrawCharProfile = TRUE; + + } + } +} + +void BtnIMPPersonalityQuizAnswer5Callback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // now set this button on + btn->uiFlags|=(BUTTON_CLICKED_ON); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = 5; + + + // highlight answer + PrintImpText( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + fReDrawCharProfile = TRUE; + + } + } +} + +void BtnIMPPersonalityQuizAnswer6Callback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // now set this button on + btn->uiFlags|=(BUTTON_CLICKED_ON); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = 6; + + // highlight answer + PrintIMPPersonalityQuizQuestionAndAnsers( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + fReDrawCharProfile = TRUE; + + } + } +} + +void BtnIMPPersonalityQuizAnswer7Callback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // now set this button on + btn->uiFlags|=(BUTTON_CLICKED_ON); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = 7; + + // redraw text + PrintImpText( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + fReDrawCharProfile = TRUE; + } + } +} + +void BtnIMPPersonalityQuizAnswer8Callback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // now set this button on + btn->uiFlags|=(BUTTON_CLICKED_ON); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = 8; + + PrintImpText( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + fReDrawCharProfile = TRUE; + + } + } +} + +void BtnIMPPersonalityQuizAnswer9Callback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // now set this button on + btn->uiFlags|=(BUTTON_CLICKED_ON); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = 9; + + // highlight answer + PrintIMPPersonalityQuizQuestionAndAnsers( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + } + } +} + + + + + + +void BtnIMPPersonalityQuizAnswerConfirmCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + if( iCurrentAnswer != -1) + { + + // reset all the buttons + ResetQuizAnswerButtons( ); + + // copy the answer into the list + iQuizAnswerList[ giCurrentPersonalityQuizQuestion ] = iCurrentAnswer; + + // reset answer for next question + iCurrentAnswer = -1; + + // next question, JOHNNY! + if( giCurrentPersonalityQuizQuestion == giMaxPersonalityQuizQuestion ) + { + giMaxPersonalityQuizQuestion++; + } + + giCurrentPersonalityQuizQuestion++; + CheckAndUpdateNextPreviousIMPQuestionButtonStates(); + + // OPPS!, done..time to finish up + if( giCurrentPersonalityQuizQuestion > 15) + { + iCurrentImpPage = IMP_PERSONALITY_FINISH; + // process + CompileQuestionsInStatsAndWhatNot( ); + } + } + } + } +} + + + +void BtnIMPPersonalityQuizStartOverCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + + btn->uiFlags&=~(BUTTON_CLICKED_ON); + giPreviousPersonalityQuizQuestion = giCurrentPersonalityQuizQuestion; + giMaxPersonalityQuizQuestion = 0; + fStartOverFlag = TRUE; + + iCurrentImpPage = IMP_PERSONALITY; + fButtonPendingFlag = TRUE; + iCurrentAnswer = -1; + } + } +} + +void ResetQuizAnswerButtons( void ) +{ + + INT32 iCounter = 0; + INT32 iCnt = 0; + + // how many buttons to reset? + switch( giCurrentPersonalityQuizQuestion ) + { + case ( -1 ): + // do nothing + return; + break; + case ( 0 ): + // 6 buttons + iCounter =6; + break; + case ( 3 ): + // 5 buttons + iCounter = 5; + break; + case ( 5 ): + // 6 buttons + iCounter = 5; + break; + case ( 10 ): + // 6 buttons + iCounter = 5; + break; + case ( 11 ): + // 9 buttons + iCounter = 8; + break; + default: + // 4 buttons + iCounter = 4; + break; + } + + // now run through and reset the buttons + for(iCnt = 0; iCnt < iCounter; iCnt++) + { + ButtonList[ giIMPPersonalityQuizAnswerButton[ iCnt ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + } + + return; +} + + +void CompileQuestionsInStatsAndWhatNot( void ) +{ + // one BIG case/switch statement to determine what values are added where + INT32 iCurrentQuestion = 0; + + for( iCurrentQuestion= 0; iCurrentQuestion < MAX_NUMBER_OF_IMP_QUESTIONS; iCurrentQuestion++ ) + { + switch( iCurrentQuestion ) + { + + // ok, run throught he list of questions + case ( 0 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + if( fCharacterIsMale ) + { + // Martial arts + AddSkillToSkillList( MARTIALARTS ); + } + else + { + // for women, ambidexterious + AddSkillToSkillList( AMBIDEXT ); + } + break; + case( 1 ): + AddAnAttitudeToAttitudeList( ATT_LONER ); + break; + case( 2 ): + // hand to hand + AddSkillToSkillList( HANDTOHAND ); + break; + case( 3 ): + // lock picking + AddSkillToSkillList( LOCKPICKING ); + break; + case( 4 ): + // throwing + AddSkillToSkillList( THROWING ); + break; + case( 5 ): + // optimist + AddAnAttitudeToAttitudeList( ATT_OPTIMIST ); + break; + } + break; + case ( 1 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // teaching + AddSkillToSkillList( TEACHING ); + break; + case( 1 ): + AddSkillToSkillList( STEALTHY ); + break; + case( 2 ): + // psycho + AddAPersonalityToPersonalityList( PSYCHO ); + break; + case( 3 ): + AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); + break; + } + break; + case ( 2 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // lock picking + AddSkillToSkillList( LOCKPICKING ); + break; + case( 1 ): + // arrogant + AddAnAttitudeToAttitudeList( ATT_ARROGANT ); + break; + case( 2 ): + AddSkillToSkillList( STEALTHY ); + break; + case( 3 ): + // normal + AddAnAttitudeToAttitudeList( ATT_NORMAL ); + break; + + } + break; + case ( 3 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // automatic weapons + AddSkillToSkillList( AUTO_WEAPS ); + break; + case( 1 ): + // friendly + AddAnAttitudeToAttitudeList( ATT_FRIENDLY ); + + break; + case( 2 ): + // normal + AddAnAttitudeToAttitudeList( ATT_NORMAL ); + break; + case( 3 ): + // asshole + AddAnAttitudeToAttitudeList( ATT_ASSHOLE ); + break; + case( 4 ): + AddAnAttitudeToAttitudeList( ATT_LONER ); + break; + + } + break; + case ( 4 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // coward + AddAnAttitudeToAttitudeList( ATT_COWARD ); + break; + case( 1 ): + // none + break; + case( 2 ): + // aggressive + AddAnAttitudeToAttitudeList( ATT_AGGRESSIVE ); + break; + case( 3 ): + // none + break; + } + break; + case ( 5 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // coward + AddAnAttitudeToAttitudeList( ATT_COWARD ); + break; + case( 1 ): + AddSkillToSkillList( NIGHTOPS ); + break; + case( 2 ): + // dont like boxes much + AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); + break; + case( 3 ): + // none + break; + case( 4 ): + // none + break; + } + break; + case ( 6 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // electronics + AddSkillToSkillList( ELECTRONICS ); + break; + case( 1 ): + //knifing + AddSkillToSkillList( KNIFING ); + break; + case( 2 ): + AddSkillToSkillList( NIGHTOPS ); + break; + case( 3 ): + // none + break; + } + break; + case ( 7 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // ambidexterous + AddSkillToSkillList( AMBIDEXT ); + break; + case( 1 ): + // none + break; + case( 2 ): + // optimist + AddAnAttitudeToAttitudeList( ATT_OPTIMIST ); + break; + case( 3 ): + // psycho + AddAPersonalityToPersonalityList( PSYCHO ); + break; + } + break; + case ( 8 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // forgetful + AddAPersonalityToPersonalityList( FORGETFUL ); + break; + case( 1 ): + // none + case( 2 ): + // pessimist + AddAnAttitudeToAttitudeList( ATT_PESSIMIST ); + break; + case( 3 ): + // nervous + AddAPersonalityToPersonalityList( NERVOUS ); + break; + } + break; + case ( 9 ): + + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // none + break; + case( 1 ): + // pessimist + AddAnAttitudeToAttitudeList( ATT_PESSIMIST ); + break; + case( 2 ): + // asshole + AddAnAttitudeToAttitudeList( ATT_ASSHOLE ); + break; + case( 3 ): + // nervous + AddAPersonalityToPersonalityList( NERVOUS ); + break; + } + break; + case ( 10 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // none + break; + case( 1 ): + // teaching + AddSkillToSkillList( TEACHING ); + break; + case( 2 ): + // aggressive + AddAnAttitudeToAttitudeList( ATT_AGGRESSIVE ); + break; + case( 3 ): + // normal + AddAnAttitudeToAttitudeList( ATT_NORMAL ); + break; + case( 4 ): + // none + break; + } + break; + case ( 11 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + if( fCharacterIsMale ) + { + // Martial arts + AddSkillToSkillList( MARTIALARTS ); + } + else + { + // for women, ambidexterious + AddSkillToSkillList( AMBIDEXT ); + } + break; + case( 1 ): + //knifing + AddSkillToSkillList( KNIFING ); + break; + case( 2 ): + // none + break; + case( 3 ): + // automatic weapons + AddSkillToSkillList( AUTO_WEAPS ); + break; + case( 4 ): + // hand to hand + AddSkillToSkillList( HANDTOHAND ); + break; + case( 5 ): + // electronics + AddSkillToSkillList( ELECTRONICS ); + break; + case( 6 ): + // ashole + break; + case( 7 ): + // none + break; + } + break; + case ( 12 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // forgetful + AddAPersonalityToPersonalityList( FORGETFUL ); + break; + case( 1 ): + // normal + AddAnAttitudeToAttitudeList( ATT_NORMAL ); + break; + case( 2 ): + // normal + AddAnAttitudeToAttitudeList( ATT_NORMAL ); + break; + case( 3 ): + // heat problems + AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); + break; + } + break; + case ( 13 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // dont like boxes much + AddAPersonalityToPersonalityList( CLAUSTROPHOBIC ); + break; + case( 1 ): + // normal + AddAnAttitudeToAttitudeList( ATT_NORMAL ); + break; + case( 2 ): + // heat problems + AddAPersonalityToPersonalityList( HEAT_INTOLERANT ); + break; + case( 3 ): + // none + break; + } + break; + case ( 14 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // throwing + AddSkillToSkillList( THROWING ); + break; + case( 1 ): + // ambidexterous + AddSkillToSkillList( AMBIDEXT ); + break; + case( 3 ): + // none + break; + case( 2 ): + AddAnAttitudeToAttitudeList( ATT_ARROGANT ); + break; + + } + break; + case ( 15 ): + switch( iQuizAnswerList[ iCurrentQuestion ] ) + { + case( 0 ): + // none ! + break; + case( 1 ): + // none ! + break; + case( 2 ): + // none ! + break; + case( 3 ): + // none ! + break; + } + break; + } + } +} + + +void BltAnswerIndents( INT32 iNumberOfIndents ) +{ + INT32 iCounter = 0; + + + // the question indent + RenderQtnIndentFrame( 15, 20 ); + + + // the answers + + for( iCounter = 0; iCounter < iNumberOfIndents; iCounter++) + { + switch( iCounter ) + { + case( 0 ): + if( iNumberOfIndents < 5 ) + { + RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 93); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnLongIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 93 ); + } + } + else + { + RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 93); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 93 ); + } + } + break; + case( 1 ): + if( iNumberOfIndents < 5 ) + { + RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 143); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnLongIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 143 ); + } + } + else + { + RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 143); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 143 ); + } + } + break; + case( 2 ): + if( iNumberOfIndents < 5 ) + { + RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnLongIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193 ); + } + } + else + { + RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 193 ); + } + } + break; + case( 3 ): + + // is this question # 6 ..if so, need longer answer box + if( ( giCurrentPersonalityQuizQuestion == 5) ) + { + // render longer frame + RenderQtnShort2IndentFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); + + // is this answer currently selected? + if( iCurrentAnswer == iCounter ) + { + // need to highlight + RenderQtnShort2IndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); + + } + // done + break; + } + + if( iNumberOfIndents < 5 ) + { + RenderQtnLongIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnLongIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); + } + } + else + { + RenderQtnShortIndentFrame(BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_FIRST_COLUMN_X + INDENT_OFFSET, 243 ); + } + } + break; + case( 4 ): + + //is this question # 14 or 21?..if so, need longer answer box + if( ( giCurrentPersonalityQuizQuestion == 10)||( giCurrentPersonalityQuizQuestion == 5 ) ) + { + // render longer frame + RenderQtnShort2IndentFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93 ); + + // is this answer currently selected? + if( iCurrentAnswer == iCounter ) + { + // need to highlight + RenderQtnShort2IndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93 ); + + } + // done + break; + } + + RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93); + + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 93 ); + } + break; + case( 5 ): + + // special case?..longer frame needed if so + if( ( giCurrentPersonalityQuizQuestion == 19) ) + { + // render longer frame + RenderQtnShort2IndentFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143 ); + + // is this answer currently selected? + if( iCurrentAnswer == iCounter ) + { + // need to highlight + RenderQtnShort2IndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143 ); + } + // done + break; + } + RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143); + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 143 ); + } + break; + case( 6 ): + RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 193); + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 193 ); + } + break; + case( 7 ): + RenderQtnShortIndentFrame(BTN_SECOND_COLUMN_X + INDENT_OFFSET, 243); + if( iCurrentAnswer == iCounter ) + { + RenderQtnShortIndentHighFrame( BTN_SECOND_COLUMN_X + INDENT_OFFSET, 243 ); + } + break; + case( 8 ): + break; + } + } +} + +void PrintQuizQuestionNumber( void ) +{ + // this function will print the number of the current question and the numebr of questions + + CHAR16 sString[ 10 ]; + + + // setup font + SetFont( FONT12ARIAL); + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + + // get current question number into a string + swprintf(sString, L"%d", giCurrentPersonalityQuizQuestion + 1); + + // print current question number + mprintf( LAPTOP_SCREEN_UL_X + 345 , LAPTOP_SCREEN_WEB_UL_Y + 370 ,sString); + + // total number of questions + mprintf( LAPTOP_SCREEN_UL_X + 383 , LAPTOP_SCREEN_WEB_UL_Y + 370 , L"16"); + return; +} + + + +void CheckStateOfTheConfirmButton( void ) +{ + // will check the state of the confirm button, should it be enabled or disabled? + if( iCurrentAnswer == -1 ) + { + // was disabled, enable + EnableButton( giIMPPersonalityQuizButton[0] ); + } + + return; +} + +void HandleIMPQuizKeyBoard( void ) +{ + InputAtom InputEvent; + POINT MousePos; + BOOLEAN fSkipFrame = FALSE; + + GetCursorPos(&MousePos); + + while( ( DequeueEvent(&InputEvent) == TRUE ) ) + { + if( fSkipFrame == FALSE ) + { + // HOOK INTO MOUSE HOOKS + + + /* + if( (InputEvent.usEvent == KEY_DOWN ) && ( InputEvent.usParam >= '1' ) && ( InputEvent.usParam <= '9') ) + { + if( ( UINT16 )( iNumberOfPersonaButtons ) >= InputEvent.usParam - '0' ) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // ok, check to see if button was disabled, if so, re enable + CheckStateOfTheConfirmButton( ); + + // toggle this button on + ButtonList[ giIMPPersonalityQuizAnswerButton[ InputEvent.usParam - '1' ] ]->uiFlags |= (BUTTON_CLICKED_ON); + + iCurrentAnswer = InputEvent.usParam - '1'; + + PrintImpText( ); + + // the current and last question numbers + PrintQuizQuestionNumber( ); + + fReDrawCharProfile = TRUE; + fSkipFrame = TRUE; + } + } + else if( ( iCurrentAnswer != -1 ) && ( InputEvent.usEvent == KEY_DOWN ) && ( InputEvent.usParam == ENTER ) ) + { + // reset all the buttons + ResetQuizAnswerButtons( ); + + // copy the answer into the list + iQuizAnswerList[ giCurrentPersonalityQuizQuestion ] = iCurrentAnswer; + + // reset answer for next question + iCurrentAnswer = -1; + + // next question, JOHNNY! + giCurrentPersonalityQuizQuestion++; + giMaxPersonalityQuizQuestion++; + + + // OPPS!, done..time to finish up + if( giCurrentPersonalityQuizQuestion > 15) + { + iCurrentImpPage = IMP_PERSONALITY_FINISH; + // process + CompileQuestionsInStatsAndWhatNot( ); + } + + fSkipFrame = TRUE; + } + else if( ( InputEvent.usEvent == KEY_DOWN ) && ( InputEvent.usParam == '=' ) ) + { + MoveAheadAQuestion( ); + fSkipFrame = TRUE; + } + else if( ( InputEvent.usEvent == KEY_DOWN ) && ( InputEvent.usParam == '-' ) ) + { + MoveBackAQuestion( ); + fSkipFrame = TRUE; + } + else + { + +*/ switch(InputEvent.usEvent) + { + case LEFT_BUTTON_DOWN: + MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + + break; + case LEFT_BUTTON_UP: + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + + break; + case RIGHT_BUTTON_DOWN: + MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + + break; + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + + break; + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + + break; + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + + break; + default: + HandleKeyBoardShortCutsForLapTop( InputEvent.usEvent, InputEvent.usParam, InputEvent.usKeyState ); + break; +// } + } + } + } + return; +} + + +void CheckAndUpdateNextPreviousIMPQuestionButtonStates( void ) +{ + if( giCurrentPersonalityQuizQuestion >= giMaxPersonalityQuizQuestion ) + { + DisableButton( giNextQuestionButton ); + } + else + { + EnableButton( giNextQuestionButton ); + } + + if( giCurrentPersonalityQuizQuestion == 0 ) + { + DisableButton( giPreviousQuestionButton ); + } + else + { + EnableButton( giPreviousQuestionButton ); + } +} + + +void MoveAheadAQuestion( void ) +{ + + // move ahead a question in the personality question list + if( giCurrentPersonalityQuizQuestion < giMaxPersonalityQuizQuestion ) + { + giCurrentPersonalityQuizQuestion++; + + iCurrentAnswer = -1; + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = iQuizAnswerList[ giCurrentPersonalityQuizQuestion ]; + } + + CheckAndUpdateNextPreviousIMPQuestionButtonStates( ); + +/* + EnableButton( giPreviousQuestionButton ); + + if( giCurrentPersonalityQuizQuestion >= giMaxPersonalityQuizQuestion ) + { + DisableButton( giNextQuestionButton ); + iCurrentAnswer = -1; + } + else + { + EnableButton( giNextQuestionButton ); + } +*/ + return; +} + +void MoveBackAQuestion( void ) +{ + if( giCurrentPersonalityQuizQuestion > 0 ) + { + giCurrentPersonalityQuizQuestion--; + + iCurrentAnswer = -1; + CheckStateOfTheConfirmButton( ); + + iCurrentAnswer = iQuizAnswerList[ giCurrentPersonalityQuizQuestion ]; + } + + EnableButton( giNextQuestionButton ); + + CheckAndUpdateNextPreviousIMPQuestionButtonStates( ); +/* + if( giCurrentPersonalityQuizQuestion == 0 ) + { + DisableButton( giPreviousQuestionButton ); + } + else + { + EnableButton( giPreviousQuestionButton ); + } +*/ + return; +} + +void ToggleQuestionNumberButtonOn( INT32 iAnswerNumber ) +{ + if( ( giCurrentPersonalityQuizQuestion <= giMaxPersonalityQuizQuestion ) && ( iAnswerNumber != -1 ) ) + { + // reset buttons + ResetQuizAnswerButtons( ); + + // toggle this button on + ButtonList[ giIMPPersonalityQuizAnswerButton[ iAnswerNumber ] ]->uiFlags |= (BUTTON_CLICKED_ON); + iCurrentAnswer = iAnswerNumber; + } + + return; + +} + +void PreviousQuestionButtonCallback( GUI_BUTTON *btn, INT32 iReason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + MoveBackAQuestion( ); + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } + return; +} + + +void NextQuestionButtonCallback( GUI_BUTTON *btn, INT32 iReason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + MoveAheadAQuestion( ); + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + } + return; +} \ No newline at end of file diff --git a/Laptop/IMP Personality Quiz.h b/Laptop/IMP Personality Quiz.h new file mode 100644 index 00000000..c6c27bd9 --- /dev/null +++ b/Laptop/IMP Personality Quiz.h @@ -0,0 +1,15 @@ +#ifndef _IMP_PERSOANLITY_QUIZ_H +#define _IMP_PERSOANLITY_QUIZ_H + + +void EnterIMPPersonalityQuiz( void ); +void RenderIMPPersonalityQuiz( void ); +void ExitIMPPersonalityQuiz( void ); +void HandleIMPPersonalityQuiz( void ); + +void BltAnswerIndents( INT32 iNumberOfIndents ); + +extern INT32 giCurrentPersonalityQuizQuestion; +extern INT32 iCurrentAnswer; + +#endif \ No newline at end of file diff --git a/Laptop/IMP Portraits.cpp b/Laptop/IMP Portraits.cpp new file mode 100644 index 00000000..28b85b14 --- /dev/null +++ b/Laptop/IMP Portraits.cpp @@ -0,0 +1,393 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "CharProfile.h" + #include "IMP Portraits.h" + #include "IMP MainPage.h" + #include "IMP HomePage.h" + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "input.h" + #include "Isometric Utils.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "laptop.h" + #include "IMP Text System.h" + #include "IMP Voices.h" + #include "IMP Compile Character.h" +#endif + +//current and last pages +INT32 iCurrentPortrait = 0; +INT32 iLastPicture = 7; + +// buttons needed for the IMP portrait screen +INT32 giIMPPortraitButton[ 3 ]; +INT32 giIMPPortraitButtonImage[ 3 ]; + +// redraw protrait screen +BOOLEAN fReDrawPortraitScreenFlag = FALSE; + +// face index +INT32 iPortraitNumber = 0; + + +// function definitions + +void IncrementPictureIndex( void ); +void DecrementPicture( void ); +void CreateIMPPortraitButtons( void ); +void DestroyIMPPortraitButtons( void ); +BOOLEAN CameBackToPortraitsPageButNotFinished(); + +// callbacks +void BtnIMPPortraitNextCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPortraitPreviousCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPPortraitDoneCallback(GUI_BUTTON *btn,INT32 reason); + +void EnterIMPPortraits( void ) +{ + + // create buttons + CreateIMPPortraitButtons( ); + + // render background + RenderIMPPortraits( ); + + + return; +} + + +void RenderIMPPortraits( void ) +{ + + + // render background + RenderProfileBackGround( ); + + // the Voices frame + RenderPortraitFrame( 191, 167 ); + + // render the current portrait + RenderPortrait( 200, 176 ); + + // indent for the text + RenderAttrib1IndentFrame( 128, 65); + + // text + PrintImpText( ); + + return; +} + + +void ExitIMPPortraits( void ) +{ + // destroy buttons for IMP portrait page + DestroyIMPPortraitButtons( ); + + return; +} + +void HandleIMPPortraits( void ) +{ + + // do we need to re write screen + if ( fReDrawPortraitScreenFlag == TRUE ) + { + RenderIMPPortraits( ); + + // reset redraw flag + fReDrawPortraitScreenFlag = FALSE; + } + return; +} + + +BOOLEAN RenderPortrait( INT16 sX, INT16 sY ) +{ + // render the portrait of the current picture + VOBJECT_DESC VObjectDesc; + HVOBJECT hHandle; + UINT32 uiGraphicHandle; + + if( fCharacterIsMale ) + { + + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pPlayerSelectedBigFaceFileNames[ iCurrentPortrait ] , VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); + + + } + else + { + // load it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pPlayerSelectedBigFaceFileNames[ iCurrentPortrait + 8 ] , VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiGraphicHandle)); + + // show it + GetVideoObject(&hHandle, uiGraphicHandle); + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + // and kick it's sorry ..umm never mind, outta here + DeleteVideoObjectFromIndex( uiGraphicHandle ); + + } + + return ( TRUE ); +} + + + +void IncrementPictureIndex( void ) +{ + // cycle to next picture + + iCurrentPortrait++; + + // gone too far? + if( iCurrentPortrait > iLastPicture ) + { + iCurrentPortrait = 0; + } + + + return; +} + + +void DecrementPicture( void ) +{ + // cycle to previous picture + + iCurrentPortrait--; + + // gone too far? + if( iCurrentPortrait < 0 ) + { + iCurrentPortrait = iLastPicture; + } + + return; +} + + +void CreateIMPPortraitButtons( void ) +{ + // will create buttons need for the IMP portrait screen + + // next button + giIMPPortraitButtonImage[0]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,1,-1,3,-1 ); + /*giIMPPortraitButton[0] = QuickCreateButton( giIMPPortraitButtonImage[0], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 184 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitNextCallback ); + */ + giIMPPortraitButton[0] = CreateIconAndTextButton( giIMPPortraitButtonImage[0], pImpButtonText[ 13 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 343 ), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ),BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitNextCallback); + + + // previous button + giIMPPortraitButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,0,-1,2,-1 ); +/* giIMPPortraitButton[ 1 ] = QuickCreateButton( giIMPPortraitButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 254 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitPreviousCallback ); + */ + giIMPPortraitButton[ 1 ] = CreateIconAndTextButton( giIMPPortraitButtonImage[ 1 ], pImpButtonText[ 12 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 93), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitPreviousCallback); + + + // done button + giIMPPortraitButtonImage[ 2 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); + /* giIMPPortraitButton[ 2 ] = QuickCreateButton( giIMPPortraitButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 349 ), LAPTOP_SCREEN_WEB_UL_Y + ( 220 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitDoneCallback ); + */ + giIMPPortraitButton[ 2 ] = CreateIconAndTextButton( giIMPPortraitButtonImage[ 2 ], pImpButtonText[ 11 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 187 ), LAPTOP_SCREEN_WEB_UL_Y + ( 330 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPPortraitDoneCallback); + + + + SetButtonCursor(giIMPPortraitButton[0], CURSOR_WWW); + SetButtonCursor(giIMPPortraitButton[1], CURSOR_WWW); + SetButtonCursor(giIMPPortraitButton[2], CURSOR_WWW); +} + + + +void DestroyIMPPortraitButtons( void ) +{ + + // will destroy buttons created for IMP Portrait screen + + // the next button + RemoveButton(giIMPPortraitButton[ 0 ] ); + UnloadButtonImage(giIMPPortraitButtonImage[ 0 ] ); + + // the previous button + RemoveButton(giIMPPortraitButton[ 1 ] ); + UnloadButtonImage(giIMPPortraitButtonImage[ 1 ] ); + + // the done button + RemoveButton(giIMPPortraitButton[ 2 ] ); + UnloadButtonImage(giIMPPortraitButtonImage[ 2 ] ); + + return; +} + + +void BtnIMPPortraitNextCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP attrbite begin button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // next picture!! + IncrementPictureIndex( ); + + fReDrawPortraitScreenFlag = TRUE; + } + } +} + +void BtnIMPPortraitPreviousCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP attrbite begin button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // previous picture, please!!! + DecrementPicture( ); + + fReDrawPortraitScreenFlag = TRUE; + } + } +} + +void BtnIMPPortraitDoneCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP attrbite begin button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // go to main page + iCurrentImpPage = IMP_MAIN_PAGE; +/* + // current mode now is voice + if( iCurrentProfileMode < IMP__VOICE ) + { + iCurrentProfileMode = IMP__VOICE; + } +*/ + // if we are already done, leave + if( iCurrentProfileMode == IMP__FINISH ) + { + iCurrentImpPage = IMP_FINISH; + } + else + { + if( CameBackToPortraitsPageButNotFinished() ) + { +// iCurrentProfileMode = IMP__VOICE; + iCurrentImpPage = IMP_MAIN_PAGE; + } + else + { + iCurrentProfileMode = IMP__VOICE; + } + } + + // grab picture number + if( fCharacterIsMale ) + { + // male + iPortraitNumber = iCurrentPortrait; + } + else + { + // female + iPortraitNumber = iCurrentPortrait + ( 8 ); + + } + + fButtonPendingFlag = TRUE; + } + } +} + + +BOOLEAN CameBackToPortraitsPageButNotFinished() +{ + //if we are in a page that comes after this one + if( iCurrentProfileMode == IMP__PERSONALITY || + iCurrentProfileMode == IMP__ATTRIBUTES || + iCurrentProfileMode == IMP__VOICE ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} diff --git a/Laptop/IMP Portraits.h b/Laptop/IMP Portraits.h new file mode 100644 index 00000000..e51cda26 --- /dev/null +++ b/Laptop/IMP Portraits.h @@ -0,0 +1,13 @@ +#ifndef __IMP_PORTRAIT_H +#define __IMP_PORTRAIT_H + +void EnterIMPPortraits( void ); +void RenderIMPPortraits( void ); +void ExitIMPPortraits( void ); +void HandleIMPPortraits( void ); +BOOLEAN RenderPortrait( INT16 sX, INT16 sY ); + +extern INT32 iPortraitNumber; + + +#endif \ No newline at end of file diff --git a/Laptop/IMP Skill Trait.cpp b/Laptop/IMP Skill Trait.cpp new file mode 100644 index 00000000..fae0d6c5 --- /dev/null +++ b/Laptop/IMP Skill Trait.cpp @@ -0,0 +1,693 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" + #include "IMP Skill Trait.h" + #include "_Ja25Englishtext.h" +#else +#endif + + + +//******************************************************************* +// +// Local Defines +// +//******************************************************************* + +#define IMP_SKILL_TRAIT__TITLE_FONT FONT14ARIAL + +#define IMP_SKILL_TRAIT__FONT FONT12ARIAL +#define IMP_SKILL_TRAIT__COLOR FONT_MCOLOR_WHITE + + + +enum +{ + IMP_SKILL_TRAIT__TITLE_TEXT=IMP_SKILL_TRAITS__NUMBER_SKILLS, +}; + + + +#define IMP_SKILL_TRAIT__LEFT_COLUMN_START_X ( LAPTOP_SCREEN_UL_X + 15 ) +#define IMP_SKILL_TRAIT__LEFT_COLUMN_START_Y ( LAPTOP_SCREEN_WEB_UL_Y + 40 ) + +#define IMP_SKILL_TRAIT__RIGHT_COLUMN_START_X ( IMP_SKILL_TRAIT__LEFT_COLUMN_START_X + 241 ) +#define IMP_SKILL_TRAIT__RIGHT_COLUMN_START_Y IMP_SKILL_TRAIT__LEFT_COLUMN_START_Y + +#define IMP_SKILL_TRAIT__SPACE_BTN_BUTTONS 38 + +#define IMP_SKILL_TRAIT__SKILL_TRAIT_TO_START_RIGHT_COL 6 + +#define IMP_SKILL_TRAIT__NONE_BTN_LOC_X ( LAPTOP_SCREEN_UL_X + 136 ) + +#define IMP_SKILL_TRAIT__TEXT_OFFSET_X 65 +#define IMP_SKILL_TRAIT__TEXT_OFFSET_Y 12 + +#define IMP_SKILL_TRAIT__TITLE_X LAPTOP_SCREEN_UL_X - 111 +#define IMP_SKILL_TRAIT__TITLE_Y iScreenHeightOffset + 53 +#define IMP_SKILL_TRAIT__TITLE_WIDTH ( LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X ) + +#define IMP_SKILL_TRAIT__GREY_BOX_OFFSET_X 5 +#define IMP_SKILL_TRAIT__GREY_BOX_OFFSET_Y 7 + + +//******************************************************************* +// +// Global Variables +// +//******************************************************************* + +BOOLEAN gfIST_Redraw=FALSE; + +BOOLEAN gfSkillTraitQuestions[ IMP_SKILL_TRAITS__NUMBER_SKILLS ]; + +// these are the buttons for the questions +INT32 giIMPSkillTraitAnswerButton[ IMP_SKILL_TRAITS__NUMBER_SKILLS ]; +INT32 giIMPSkillTraitAnswerButtonImage[ IMP_SKILL_TRAITS__NUMBER_SKILLS ]; + +// this is the Done buttons +INT32 giIMPSkillTraitFinsihButton; +INT32 giIMPSkillTraitFinsihButtonImage; + + + +//BOOLEAN gfSkillTraitButtonChanged=FALSE; + +#define IST__NUM_SELECTABLE_TRAITS 2 +INT8 gbLastSelectedTraits[ IST__NUM_SELECTABLE_TRAITS ]; + +//image handle +UINT32 guiIST_GreyGoldBox; + +//******************************************************************* +// +// Function Prototypes +// +//******************************************************************* + +void BtnIMPSkillTraitAnswerCallback(GUI_BUTTON *btn,INT32 reason); +void BtnIMPSkillTraitFinishCallback(GUI_BUTTON *btn,INT32 reason); +void AddImpSkillTraitButtons(); +void HandleSkillTraitButtonStates( ); +void HandleIMPSkillTraitAnswers( UINT32 uiSkillPressed, BOOLEAN fResetAllButtons ); +void IMPSkillTraitDisplaySkills(); +INT8 CountNumSkillStraitsSelected( BOOLEAN fIncludeNoneSkill ); +BOOLEAN ShouldTraitBeSkipped( UINT32 uiTrait ); +void AddSelectedSkillsToSkillsList(); +void HandleLastSelectedTraits( INT8 bNewTrait ); +BOOLEAN CameBackToSpecialtiesPageButNotFinished(); +//ppp + +//******************************************************************* +// +// Functions +// +//******************************************************************* + + + +void EnterIMPSkillTrait( void ) +{ +// UINT32 uiCnt; + VOBJECT_DESC VObjectDesc; + + //add the skill trait buttons + AddImpSkillTraitButtons(); + + + // load the stats graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\SkillTraitSmallGreyIdent.sti", VObjectDesc.ImageFile); + if( !AddVideoObject(&VObjectDesc, &guiIST_GreyGoldBox ) ) + { + Assert( 0 ); + return; + } + + + + giIMPSkillTraitFinsihButtonImage = LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); + giIMPSkillTraitFinsihButton = CreateIconAndTextButton( giIMPSkillTraitFinsihButtonImage, pImpButtonText[ 24 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 350 ), LAPTOP_SCREEN_WEB_UL_Y + ( 340 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPSkillTraitFinishCallback ); + + + + SetButtonCursor( giIMPSkillTraitFinsihButton, CURSOR_WWW); + + //if we are not DONE and are just reviewing + if( iCurrentProfileMode != IMP__FINISH ) + { + //Have the NONE trait initially selected + gfSkillTraitQuestions[ IMP_SKILL_TRAITS__NONE ] = TRUE; + } + + HandleSkillTraitButtonStates( ); + + //reset last selecterd trait + memset( gbLastSelectedTraits, -1, IST__NUM_SELECTABLE_TRAITS ); +} + + +void RenderIMPSkillTrait( void ) +{ + //render the metal background graphic + RenderProfileBackGround(); + + IMPSkillTraitDisplaySkills(); +} + + +void ExitIMPSkillTrait( void ) +{ + INT32 iCnt; + + DeleteVideoObjectFromIndex( guiIST_GreyGoldBox ); + + //remove the skill buttons + for(iCnt = 0; iCnt < IMP_SKILL_TRAITS__NUMBER_SKILLS; iCnt++) + { + //if there is a button allocated + if( giIMPSkillTraitAnswerButton[iCnt] != -1 ) + { + RemoveButton(giIMPSkillTraitAnswerButton[ iCnt ] ); + UnloadButtonImage(giIMPSkillTraitAnswerButtonImage[ iCnt ] ); + } + } + + RemoveButton( giIMPSkillTraitFinsihButton ); + UnloadButtonImage( giIMPSkillTraitFinsihButtonImage ); +} + + +void HandleIMPSkillTrait( void ) +{ + if( gfIST_Redraw ) + { + RenderIMPSkillTrait( ); + gfIST_Redraw = FALSE; + } + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + +void AddImpSkillTraitButtons() +{ + INT32 iCnt = 0; + UINT16 usPosX, usPosY; + + usPosX = IMP_SKILL_TRAIT__LEFT_COLUMN_START_X; + usPosY = IMP_SKILL_TRAIT__LEFT_COLUMN_START_Y; + + + for(iCnt = 0; iCnt < IMP_SKILL_TRAITS__NUMBER_SKILLS; iCnt++) + { + //reset + giIMPSkillTraitAnswerButton[iCnt] = -1; + + //if we are not DONE and are just reviewing + if( iCurrentProfileMode != IMP__FINISH ) + { + gfSkillTraitQuestions[ iCnt ] = FALSE; + } + + //if the merc is a FEMALE, skip this skill cause there isnt any fenmal martial artists + if( ShouldTraitBeSkipped( iCnt ) ) + { + usPosY += IMP_SKILL_TRAIT__SPACE_BTN_BUTTONS; + + //if its the none button + if( iCnt == IMP_SKILL_TRAITS__NONE-1 ) + { + usPosX = IMP_SKILL_TRAIT__NONE_BTN_LOC_X; + } + continue; + } + + if( iCnt == 0 ) + giIMPSkillTraitAnswerButtonImage[ iCnt ] = LoadButtonImage( "LAPTOP\\button_6.sti", -1,0,-1,1,-1 ); + else + giIMPSkillTraitAnswerButtonImage[ iCnt ] = UseLoadedButtonImage( giIMPSkillTraitAnswerButtonImage[ 0 ], -1,0,-1,1,-1 ); + + giIMPSkillTraitAnswerButton[iCnt] = QuickCreateButton( giIMPSkillTraitAnswerButtonImage[ iCnt ], usPosX, usPosY, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 3, + MSYS_NO_CALLBACK, (GUI_CALLBACK)BtnIMPSkillTraitAnswerCallback); + + //Set the button data + MSYS_SetBtnUserData( giIMPSkillTraitAnswerButton[iCnt], 0, iCnt ); + SetButtonCursor( giIMPSkillTraitAnswerButton[iCnt], CURSOR_WWW); + + //Get rid of playing the button sound, it will be handled here + ButtonList[ giIMPSkillTraitAnswerButton[ iCnt ] ]->ubSoundSchemeID = 0; + + //Determine the next x location + if( iCnt < IMP_SKILL_TRAIT__SKILL_TRAIT_TO_START_RIGHT_COL ) + usPosX = IMP_SKILL_TRAIT__LEFT_COLUMN_START_X; + else + usPosX = IMP_SKILL_TRAIT__RIGHT_COLUMN_START_X; + + //Determine the next Y location + if( iCnt == IMP_SKILL_TRAIT__SKILL_TRAIT_TO_START_RIGHT_COL ) + usPosY = IMP_SKILL_TRAIT__RIGHT_COLUMN_START_Y; + else + usPosY += IMP_SKILL_TRAIT__SPACE_BTN_BUTTONS; + + //if its the none button + if( iCnt == IMP_SKILL_TRAITS__NONE-1 ) + { + usPosX = IMP_SKILL_TRAIT__NONE_BTN_LOC_X; + } + } +} + + +void BtnIMPSkillTraitAnswerCallback(GUI_BUTTON *btn,INT32 reason) +{ + // btn callback for IMP personality quiz answer button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { +// btn->uiFlags|=(BUTTON_CLICKED_ON); + + INT32 iSkillTrait = MSYS_GetBtnUserData( btn, 0 ); + + HandleIMPSkillTraitAnswers( iSkillTrait, FALSE ); + } +} + +void HandleIMPSkillTraitAnswers( UINT32 uiSkillPressed, BOOLEAN fResetAllButtons ) +{ + UINT32 uiCnt; + + //if we are DONE and are just reviewing + if( iCurrentProfileMode == IMP__FINISH ) + { + return; + } + + //if we are to reset all the buttons + if( fResetAllButtons ) + { + //loop through all the skill and reset them + for( uiCnt=0; uiCnt IMP_SKILL_TRAITS__NUMBER_SKILLS ) + { + Assert( 0 ); + return; + } + + + //if its allready set + if( gfSkillTraitQuestions[ uiSkillPressed ] ) + { + //dont need to do anything + return; + } + + HandleLastSelectedTraits( (INT8)uiSkillPressed ); + +/* + //if there are already 2 skills selected, and we are trying to PRESS a new button ( skill isnt currently set ) + if( CountNumSkillStraitsSelected() == 2 && + !gfSkillTraitQuestions[ uiSkillPressed ] && + uiSkillPressed != IMP_SKILL_TRAITS__NONE ) + { + //if we have to, unselect an existing trait + + //play the diosabld sound +// PlayButtonSound( giIMPSkillTraitAnswerButton[ uiSkillPressed ], BUTTON_SOUND_DISABLED_CLICK ); + + //dont select a new one +// return; + } +*/ + + //Set the skill +// gfSkillTraitQuestions[ uiSkillPressed ] = !gfSkillTraitQuestions[ uiSkillPressed ]; + gfSkillTraitQuestions[ uiSkillPressed ] = TRUE; + + //if the NONE trait was selected, clear the rest of the buttons + if( uiSkillPressed == IMP_SKILL_TRAITS__NONE ) + { + //reset all the traits + HandleIMPSkillTraitAnswers( 0, TRUE ); + + gfSkillTraitQuestions[ IMP_SKILL_TRAITS__NONE ] = TRUE; + } + + + //make sure the none skill is NOT selected if we select anything else + if( uiSkillPressed != IMP_SKILL_TRAITS__NONE ) + { + gfSkillTraitQuestions[ IMP_SKILL_TRAITS__NONE ] = FALSE; + } + + //Play the button sound + if( gfSkillTraitQuestions[ uiSkillPressed ] ) + { + PlayButtonSound( giIMPSkillTraitAnswerButton[ uiSkillPressed ], BUTTON_SOUND_CLICKED_ON ); + } + else + { + PlayButtonSound( giIMPSkillTraitAnswerButton[ uiSkillPressed ], BUTTON_SOUND_CLICKED_OFF ); + } + + //update buttons + HandleSkillTraitButtonStates( ); + + //redraw the screen + gfIST_Redraw = TRUE; +} + +INT8 CountNumSkillStraitsSelected( BOOLEAN fIncludeNoneSkill ) +{ + UINT32 uiCnt; + INT8 iNumberSkills=0; + UINT32 uiUpperLimit; + + if( fIncludeNoneSkill ) + { + uiUpperLimit = IMP_SKILL_TRAITS__NUMBER_SKILLS; + } + else + { + uiUpperLimit = IMP_SKILL_TRAITS__NONE; + } + + for( uiCnt=0; uiCnt < uiUpperLimit; uiCnt++ ) + { + //if the skill is selected ( ie depressed ) + if( gfSkillTraitQuestions[ uiCnt ] ) + { + iNumberSkills++; + } + } + + return( iNumberSkills ); +} + + +void HandleSkillTraitButtonStates( ) +{ + UINT32 uiCnt; + + for( uiCnt=0; uiCntuiFlags |= BUTTON_CLICKED_ON; + } + else + { + ButtonList[ giIMPSkillTraitAnswerButton[ uiCnt ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + } + } +} + +void IMPSkillTraitDisplaySkills() +{ + UINT32 uiCnt; + UINT16 usPosX, usPosY; + UINT16 usBoxPosX, usBoxPosY; + HVOBJECT hImageHandle; + + + //Display the title + DrawTextToScreen( gzIMPSkillTraitsText[ IMP_SKILL_TRAIT__TITLE_TEXT ], IMP_SKILL_TRAIT__TITLE_X, IMP_SKILL_TRAIT__TITLE_Y, IMP_SKILL_TRAIT__TITLE_WIDTH, IMP_SKILL_TRAIT__TITLE_FONT, IMP_SKILL_TRAIT__COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + // Stats + GetVideoObject(&hImageHandle, guiIST_GreyGoldBox ); + + usPosX = IMP_SKILL_TRAIT__LEFT_COLUMN_START_X + IMP_SKILL_TRAIT__TEXT_OFFSET_X; + usPosY = IMP_SKILL_TRAIT__LEFT_COLUMN_START_Y + IMP_SKILL_TRAIT__TEXT_OFFSET_Y; + + for( uiCnt=0; uiCntuiFlags & BUTTON_ENABLED)) + return; + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + + //if we are just reviewing the page + if( iCurrentProfileMode == IMP__FINISH ) + { + //go back tot he done screen + iCurrentImpPage = IMP_FINISH; + } + else + { + iCurrentImpPage = IMP_MAIN_PAGE; + + if( CameBackToSpecialtiesPageButNotFinished() ) + { + } + else + { + //We are finished on this page + iCurrentProfileMode = IMP__ATTRIBUTES; + } + } + } +} + + +BOOLEAN CameBackToSpecialtiesPageButNotFinished() +{ + //if we are in a page that comes after this one + if( iCurrentProfileMode == IMP__ATTRIBUTES ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + + + + + +INT8 DoesPlayerHaveExtraAttibutePointsToDistributeBasedOnSkillSelection() +{ + INT8 bExtraPoints=10; + INT8 bNumSkills=0; + + //Count the number of skills selected + bNumSkills = CountNumSkillStraitsSelected( FALSE ); + + //if there NONE selected + if( bNumSkills == 0 ) + { + bExtraPoints = 10; + } + + //if there is 1 trait selected + else if( bNumSkills == 1 ) + { + //if the trait is not the ones you cant be expert in ) + if( gfSkillTraitQuestions[ IMP_SKILL_TRAITS__ELECTRONICS ] || + gfSkillTraitQuestions[ IMP_SKILL_TRAITS__AMBIDEXTROUS ] || + gfSkillTraitQuestions[ IMP_SKILL_TRAITS__CAMO ] ) + { + bExtraPoints = 5; + } + else + { + bExtraPoints = 0; + } + } + + //else both traits selected + else + { + bExtraPoints = 0; + } + + return( bExtraPoints ); +} + + + +BOOLEAN ShouldTraitBeSkipped( UINT32 uiTrait ) +{ + if( uiTrait == IMP_SKILL_TRAITS__MARTIAL_ARTS && !fCharacterIsMale ) + return( TRUE ); + else + return( FALSE ); +} + + +void AddSelectedSkillsToSkillsList() +{ + UINT32 uiCnt; + + //loop through all the buttons and reset them + for( uiCnt=0; uiCnt iLastVoice ) + { + iCurrentVoices = iLastVoice; + } + + return; +} + + +void RenderIMPVoices( void ) +{ + + + // render background + RenderProfileBackGround( ); + + // the Voices frame + RenderPortraitFrame( 191, 167 ); + + // the sillouette + RenderLargeSilhouette( 200, 176 ); + + // indent for the text + RenderAttrib1IndentFrame( 128, 65); + + // render voice index value + RenderVoiceIndex( ); + + // text + PrintImpText( ); + + return; +} + + +void ExitIMPVoices( void ) +{ + // destroy buttons for IMP Voices page + DestroyIMPVoicesButtons( ); + + // destroy mouse regions for this screen + DestroyIMPVoiceMouseRegions( ); + + + return; +} + +void HandleIMPVoices( void ) +{ + + // do we need to re write screen + if ( fReDrawVoicesScreenFlag == TRUE ) + { + RenderIMPVoices( ); + + // reset redraw flag + fReDrawVoicesScreenFlag = FALSE; + } + return; +} + + + + +void IncrementVoice( void ) +{ + // cycle to next voice + + iCurrentVoices++; + + // gone too far? + if( iCurrentVoices > iLastVoice ) + { + iCurrentVoices = 0; + } + + + return; +} + + +void DecrementVoice( void ) +{ + // cycle to previous voice + + iCurrentVoices--; + + // gone too far? + if( iCurrentVoices < 0 ) + { + iCurrentVoices = iLastVoice; + } + + return; +} + + +void CreateIMPVoicesButtons( void ) +{ + // will create buttons need for the IMP Voices screen + + // next button + giIMPVoicesButtonImage[0]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,1,-1,3,-1 ); + /*giIMPVoicesButton[0] = QuickCreateButton( giIMPVoicesButtonImage[0], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 184 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesNextCallback ); + */ + giIMPVoicesButton[0] = CreateIconAndTextButton( giIMPVoicesButtonImage[0], pImpButtonText[ 13 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 343 ), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ),BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesNextCallback); + + + // previous button + giIMPVoicesButtonImage[ 1 ]= LoadButtonImage( "LAPTOP\\voicearrows.sti" ,-1,0,-1,2,-1 ); +/* giIMPVoicesButton[ 1 ] = QuickCreateButton( giIMPVoicesButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 18 ), LAPTOP_SCREEN_WEB_UL_Y + ( 254 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesPreviousCallback ); + */ + giIMPVoicesButton[ 1 ] = CreateIconAndTextButton( giIMPVoicesButtonImage[ 1 ], pImpButtonText[ 12 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 93), LAPTOP_SCREEN_WEB_UL_Y + ( 205 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesPreviousCallback); + + + // done button + giIMPVoicesButtonImage[ 2 ]= LoadButtonImage( "LAPTOP\\button_5.sti" ,-1,0,-1,1,-1 ); + /* giIMPVoicesButton[ 2 ] = QuickCreateButton( giIMPVoicesButtonImage[ 1 ], LAPTOP_SCREEN_UL_X + ( 349 ), LAPTOP_SCREEN_WEB_UL_Y + ( 220 ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesDoneCallback ); + */ + giIMPVoicesButton[ 2 ] = CreateIconAndTextButton( giIMPVoicesButtonImage[ 2 ], pImpButtonText[ 11 ], FONT12ARIAL, + FONT_WHITE, DEFAULT_SHADOW, + FONT_WHITE, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + LAPTOP_SCREEN_UL_X + ( 187 ), LAPTOP_SCREEN_WEB_UL_Y + ( 330 ), BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnIMPVoicesDoneCallback); + + + + SetButtonCursor(giIMPVoicesButton[0], CURSOR_WWW); + SetButtonCursor(giIMPVoicesButton[1], CURSOR_WWW); + SetButtonCursor(giIMPVoicesButton[2], CURSOR_WWW); +} + + + + +void DestroyIMPVoicesButtons( void ) +{ + + // will destroy buttons created for IMP Voices screen + + // the next button + RemoveButton(giIMPVoicesButton[ 0 ] ); + UnloadButtonImage(giIMPVoicesButtonImage[ 0 ] ); + + // the previous button + RemoveButton(giIMPVoicesButton[ 1 ] ); + UnloadButtonImage(giIMPVoicesButtonImage[ 1 ] ); + + // the done button + RemoveButton(giIMPVoicesButton[ 2 ] ); + UnloadButtonImage(giIMPVoicesButtonImage[ 2 ] ); + + return; +} + + +void BtnIMPVoicesNextCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP attrbite begin button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // next voice!! + IncrementVoice( ); + // play voice + if( ! SoundIsPlaying( uiVocVoiceSound ) ) + { + uiVocVoiceSound = PlayVoice( ); + } + else + { + SoundStop( uiVocVoiceSound ); + uiVocVoiceSound = PlayVoice( ); + } + + + fReDrawVoicesScreenFlag = TRUE; + } + } +} + +void BtnIMPVoicesPreviousCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP attrbite begin button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // previous voice, please!!! + DecrementVoice( ); + // play voice + if( ! SoundIsPlaying( uiVocVoiceSound ) ) + { + uiVocVoiceSound = PlayVoice( ); + } + else + { + SoundStop( uiVocVoiceSound ); + uiVocVoiceSound = PlayVoice( ); + } + + fReDrawVoicesScreenFlag = TRUE; + } + } +} + +void BtnIMPVoicesDoneCallback(GUI_BUTTON *btn,INT32 reason) +{ + + // btn callback for IMP attrbite begin button + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // go to main page + iCurrentImpPage = IMP_MAIN_PAGE; + + // if we are already done, leave + if( iCurrentProfileMode == IMP__FINISH ) + { + iCurrentImpPage = IMP_FINISH; + } + else + { + if( CameBackToVoicePageButNotFinished() ) + { + iCurrentImpPage = IMP_MAIN_PAGE; + } + else + { + iCurrentProfileMode = IMP__PERSONALITY; + } + } +/* + // current mode now is voice + else if( iCurrentProfileMode < IMP__PORTRAIT ) + { + iCurrentProfileMode = IMP__PORTRAIT; + } + + else if( iCurrentProfileMode == IMP__PORTRAIT ) + { + // all done profiling + iCurrentProfileMode = IMP__VOICE; + iCurrentImpPage = IMP_FINISH; + } +*/ + // set voice id, to grab character slot + if( fCharacterIsMale == TRUE ) + { + LaptopSaveInfo.iVoiceId = iCurrentVoices; + } + else + { + LaptopSaveInfo.iVoiceId = iCurrentVoices + 3; + } + + // set button up image pending + fButtonPendingFlag = TRUE; + } + } +} + +BOOLEAN CameBackToVoicePageButNotFinished() +{ + //if we are in a page that comes after this one + if( iCurrentProfileMode == IMP__PERSONALITY || + iCurrentProfileMode == IMP__ATTRIBUTES ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + + +UINT32 PlayVoice( void ) +{ +// CHAR16 sString[ 64 ]; + + // gender? + + if( fCharacterIsMale == TRUE ) + { + switch( iCurrentVoices ) + { + case( 0 ): + return( PlayJA2SampleFromFile( "Speech\\051_001.wav", RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ) ); + break; + case( 1 ): + return( PlayJA2SampleFromFile( "Speech\\052_001.wav", RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ) ); + break; + case( 2 ): + return( PlayJA2SampleFromFile( "Speech\\053_001.wav", RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ) ); + break; + case( 3 ): + return( PlayJA2SampleFromFile( "Speech\\057_001.wav", RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ) ); + break; + } + } + else + { + switch( iCurrentVoices ) + { + case( 0 ): + return( PlayJA2SampleFromFile( "Speech\\054_001.wav", RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ) ); + break; + case( 1 ): + return( PlayJA2SampleFromFile( "Speech\\055_001.wav", RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ) ); + break; + case( 2 ): + return( PlayJA2SampleFromFile( "Speech\\056_001.wav", RATE_11025, MIDVOLUME, 1 , MIDDLEPAN ) ); + break; + } + + } + return 0; +} + + +void CreateIMPVoiceMouseRegions( void ) +{ + // will create mouse regions needed for the IMP voices page + MSYS_DefineRegion( &gVoicePortraitRegion, LAPTOP_SCREEN_UL_X + 200, LAPTOP_SCREEN_WEB_UL_Y + 176 ,LAPTOP_SCREEN_UL_X + 200 + 100, LAPTOP_SCREEN_WEB_UL_Y + 176 + 100,MSYS_PRIORITY_HIGH, + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, IMPPortraitRegionButtonCallback ); + + + MSYS_AddRegion( &gVoicePortraitRegion ); + + return; +} + +void DestroyIMPVoiceMouseRegions( void ) +{ + // will destroy already created mouse reiogns for IMP voices page + MSYS_RemoveRegion( &gVoicePortraitRegion ); + + return; +} + + +void IMPPortraitRegionButtonCallback(MOUSE_REGION * pRegion, INT32 iReason ) +{ + // callback handler for imp portrait region button events + + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( ! SoundIsPlaying( uiVocVoiceSound ) ) + { + uiVocVoiceSound = PlayVoice( ); + } + + } + + return; +} + + +void RenderVoiceIndex( void ) +{ + + CHAR16 sString[ 32 ]; + INT16 sX, sY; + + // render the voice index value on the the blank portrait + swprintf( sString, L"%s %d", pIMPVoicesStrings[ 0 ], iCurrentVoices + 1 ); + + FindFontCenterCoordinates( 290 + LAPTOP_UL_X, 0, 100, 0, sString, FONT12ARIAL, &sX, &sY ); + + SetFont( FONT12ARIAL ); + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + + mprintf( sX, iScreenHeightOffset + 320, sString ); + + return; +} \ No newline at end of file diff --git a/Laptop/IMP Voices.h b/Laptop/IMP Voices.h new file mode 100644 index 00000000..00544ee9 --- /dev/null +++ b/Laptop/IMP Voices.h @@ -0,0 +1,12 @@ +#ifndef __IMP_VOICES_H +#define __IMP_VOICES_H + + +void EnterIMPVoices( void ); +void RenderIMPVoices( void ); +void ExitIMPVoices( void ); +void HandleIMPVoices( void ); +UINT32 PlayVoice( void ); + +extern INT32 iVoiceId; +#endif \ No newline at end of file diff --git a/Laptop/IMPVideoObjects.cpp b/Laptop/IMPVideoObjects.cpp new file mode 100644 index 00000000..baf08c4f --- /dev/null +++ b/Laptop/IMPVideoObjects.cpp @@ -0,0 +1,1423 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "IMPVideoObjects.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "IMP HomePage.h" + #include "laptop.h" +#endif + +// globals + + +// video object handles +UINT32 guiBACKGROUND; +UINT32 guiIMPSYMBOL; +UINT32 guiBEGININDENT; +UINT32 guiACTIVATIONINDENT; +UINT32 guiFRONTPAGEINDENT; +UINT32 guiFULLNAMEINDENT; +UINT32 guiNAMEINDENT; +UINT32 guiNICKNAMEINDENT; +UINT32 guiGENDERINDENT; +UINT32 guiSMALLFRAME; +UINT32 guiANALYSE; +UINT32 guiATTRIBUTEGRAPH; +UINT32 guiATTRIBUTEGRAPHBAR; +UINT32 guiSMALLSILHOUETTE; +UINT32 guiLARGESILHOUETTE; +UINT32 guiPORTRAITFRAME; +UINT32 guiSLIDERBAR; +UINT32 guiATTRIBUTEFRAME; +UINT32 guiATTRIBUTESCREENINDENT1; +UINT32 guiATTRIBUTESCREENINDENT2; +UINT32 guiATTRIBUTEBAR; +UINT32 guiBUTTON2IMAGE; +UINT32 guiBUTTON1IMAGE; +UINT32 guiBUTTON4IMAGE; +//UINT32 guiPORTRAITFRAME; // duplicate definition, look up a few lines (jonathanl) +UINT32 guiMAININDENT; +UINT32 guiLONGINDENT; +UINT32 guiSHORTINDENT; +UINT32 guiSHORTHINDENT; +UINT32 guiSHORT2INDENT; +UINT32 guiLONGHINDENT; +UINT32 guiQINDENT; +UINT32 guiA1INDENT; +UINT32 guiA2INDENT; +UINT32 guiAVGMERCINDENT; +UINT32 guiABOUTUSINDENT; +UINT32 guiSHORT2HINDENT; + + +// position defines +#define CHAR_PROFILE_BACKGROUND_TILE_WIDTH 125 +#define CHAR_PROFILE_BACKGROUND_TILE_HEIGHT 100 + +extern void DrawBonusPointsRemaining( void ); + + +BOOLEAN LoadProfileBackGround( void ) +{ + VOBJECT_DESC VObjectDesc; + + // this procedure will load in the graphics for the generic background + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\MetalBackGround.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBACKGROUND)); + + + return (TRUE) ; +} + +void RemoveProfileBackGround( void ) +{ + + // remove background + DeleteVideoObjectFromIndex( guiBACKGROUND ); + + return; +} + + +void RenderProfileBackGround( void ) +{ + + HVOBJECT hHandle; + INT32 iCurrentHeight = 0; + INT32 iCounter = 0; + + // this procedure will render the generic backgound to the screen + + // get the video object + GetVideoObject(&hHandle, guiBACKGROUND); + + // render each row 5 times wide, 5 tiles high + for(iCounter = 0; iCounter < 4; iCounter++) + { + + // blt background to screen from left to right + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 0 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 1 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 2 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X + 3 * CHAR_PROFILE_BACKGROUND_TILE_WIDTH, LAPTOP_SCREEN_WEB_UL_Y + iCounter * CHAR_PROFILE_BACKGROUND_TILE_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + } + + // dirty buttons + MarkButtonsDirty( ); + + // force refresh of screen + InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, SCREEN_WIDTH, SCREEN_HEIGHT ); + + return; +} + +BOOLEAN LoadIMPSymbol( void ) +{ + + // this procedure will load the IMP main symbol into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_IMPSYMBOL ); + CHECKF(AddVideoObject(&VObjectDesc, &guiIMPSYMBOL)); + + return (TRUE) ; +} + + +void DeleteIMPSymbol( void ) +{ + + // remove IMP symbol + DeleteVideoObjectFromIndex( guiIMPSYMBOL ); + + return; +} + +void RenderIMPSymbol(INT16 sX, INT16 sY) +{ + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiIMPSYMBOL); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + + + + +BOOLEAN LoadBeginIndent( void ) +{ + + // this procedure will load the indent main symbol into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BeginScreenIndent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBEGININDENT)); + + return (TRUE) ; +} + + +void DeleteBeginIndent( void ) +{ + + // remove indent symbol + + DeleteVideoObjectFromIndex( guiBEGININDENT ); + + return; +} + +void RenderBeginIndent(INT16 sX, INT16 sY) +{ + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiBEGININDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + + + + + + + +BOOLEAN LoadActivationIndent( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\ActivationIndent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiACTIVATIONINDENT)); + + return (TRUE) ; +} + + +void DeleteActivationIndent( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiACTIVATIONINDENT ); + + return; +} + +void RenderActivationIndent(INT16 sX, INT16 sY) +{ + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiACTIVATIONINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + + + +BOOLEAN LoadFrontPageIndent( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\FrontPageIndent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiFRONTPAGEINDENT)); + + return (TRUE) ; +} + + +void DeleteFrontPageIndent( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiFRONTPAGEINDENT ); + + return; +} + +void RenderFrontPageIndent(INT16 sX, INT16 sY) +{ + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiFRONTPAGEINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + + + + + +BOOLEAN LoadAnalyse( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Analyze.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiANALYSE)); + + return (TRUE) ; +} + + +void DeleteAnalyse( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiANALYSE ); + + return; +} + +void RenderAnalyse(INT16 sX, INT16 sY, INT8 bImageNumber) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiANALYSE); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, bImageNumber, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + + + + + +BOOLEAN LoadAttributeGraph( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Attributegraph.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiATTRIBUTEGRAPH)); + + return (TRUE) ; +} + + +void DeleteAttributeGraph( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiATTRIBUTEGRAPH ); + + return; +} + +void RenderAttributeGraph(INT16 sX, INT16 sY) +{ + + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiATTRIBUTEGRAPH); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + + + + +BOOLEAN LoadAttributeGraphBar( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\AttributegraphBar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiATTRIBUTEGRAPHBAR)); + + return (TRUE) ; +} + + +void DeleteAttributeBarGraph( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiATTRIBUTEGRAPHBAR ); + + return; +} + +void RenderAttributeBarGraph(INT16 sX, INT16 sY) +{ + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiATTRIBUTEGRAPHBAR); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + + + + + + +BOOLEAN LoadFullNameIndent( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\FullNameIndent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiFULLNAMEINDENT)); + + return (TRUE); +} + + +void DeleteFullNameIndent( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiFULLNAMEINDENT ); + + return; +} + +void RenderFullNameIndent(INT16 sX, INT16 sY) +{ + + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiFULLNAMEINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + + +BOOLEAN LoadNickNameIndent( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\NickName.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiNICKNAMEINDENT)); + + return (TRUE); +} + + +void DeleteNickNameIndent( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiNICKNAMEINDENT ); + + return; +} + +void RenderNickNameIndent(INT16 sX, INT16 sY) +{ + + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiNICKNAMEINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + +BOOLEAN LoadNameIndent( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\NameIndent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiNAMEINDENT)); + + return (TRUE); +} + + +void DeleteNameIndent( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiNAMEINDENT ); + + return; +} + +void RenderNameIndent(INT16 sX, INT16 sY) +{ + + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiNAMEINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + + + + +BOOLEAN LoadGenderIndent( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\GenderIndent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiGENDERINDENT)); + + return (TRUE); +} + + +void DeleteGenderIndent( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiGENDERINDENT ); + + return; +} + +void RenderGenderIndent(INT16 sX, INT16 sY) +{ + HVOBJECT hHandle; + + + // get the video object + GetVideoObject(&hHandle, guiGENDERINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + + + +BOOLEAN LoadSmallFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\SmallFrame.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSMALLFRAME)); + + return (TRUE); +} + + +void DeleteSmallFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiSMALLFRAME ); + + return; +} + +void RenderSmallFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiSMALLFRAME); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + + + +BOOLEAN LoadSmallSilhouette( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\SmallSilhouette.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSMALLSILHOUETTE)); + + return (TRUE); +} + + +void DeleteSmallSilhouette( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiSMALLSILHOUETTE ); + + return; +} + +void RenderSmallSilhouette(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiSMALLSILHOUETTE); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + + +BOOLEAN LoadLargeSilhouette( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\largesilhouette.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLARGESILHOUETTE)); + + return (TRUE); +} + + +void DeleteLargeSilhouette( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiLARGESILHOUETTE ); + + return; +} + +void RenderLargeSilhouette(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiLARGESILHOUETTE); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + +BOOLEAN LoadAttributeFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\attributeframe.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiATTRIBUTEFRAME)); + + return (TRUE); +} + + +void DeleteAttributeFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiATTRIBUTEFRAME ); + + return; +} + +void RenderAttributeFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + INT32 iCounter = 0; + INT16 sCurrentY = 0; + + // get the video object + GetVideoObject(&hHandle, guiATTRIBUTEFRAME); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + sCurrentY += 10; + for( iCounter = 0; iCounter < 10; iCounter++ ) + { + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 2, LAPTOP_SCREEN_UL_X + sX + 134, LAPTOP_SCREEN_WEB_UL_Y + sY + sCurrentY, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 1, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY + sCurrentY, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 3, LAPTOP_SCREEN_UL_X + sX + 368, LAPTOP_SCREEN_WEB_UL_Y + sY + sCurrentY, VO_BLT_SRCTRANSPARENCY,NULL); + + sCurrentY += 20; + } + + BltVideoObject(FRAME_BUFFER, hHandle, 4, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY + sCurrentY, VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + +void RenderAttributeFrameForIndex( INT16 sX, INT16 sY, INT32 iIndex ) +{ + INT16 sCurrentY = 0; + HVOBJECT hHandle; + + // valid index? + if( iIndex == -1 ) + { + return; + } + + sCurrentY = ( INT16 )( 10 + ( iIndex * 20 ) ); + + // get the video object + GetVideoObject(&hHandle, guiATTRIBUTEFRAME); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 2, LAPTOP_SCREEN_UL_X + sX + 134, LAPTOP_SCREEN_WEB_UL_Y + sY + sCurrentY, VO_BLT_SRCTRANSPARENCY,NULL); + + RenderAttrib2IndentFrame(350, 42 ); + + // amt of bonus pts + DrawBonusPointsRemaining( ); + + // render attribute boxes + RenderAttributeBoxes( ); + + InvalidateRegion( LAPTOP_SCREEN_UL_X + sX + 134, LAPTOP_SCREEN_WEB_UL_Y + sY + sCurrentY, LAPTOP_SCREEN_UL_X + sX + 400, LAPTOP_SCREEN_WEB_UL_Y + sY + sCurrentY + 21 ); + + + return; +} + + +BOOLEAN LoadSliderBar( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\attributeslider.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSLIDERBAR)); + + return (TRUE); +} + + +void DeleteSliderBar( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiSLIDERBAR ); + + return; +} + +void RenderSliderBar(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiSLIDERBAR); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + + + +BOOLEAN LoadButton2Image( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\button_2.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBUTTON2IMAGE)); + + return (TRUE); +} + + +void DeleteButton2Image( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiBUTTON2IMAGE ); + + return; +} + +void RenderButton2Image(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiBUTTON2IMAGE); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + +BOOLEAN LoadButton4Image( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\button_4.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBUTTON4IMAGE)); + + return (TRUE); +} + + +void DeleteButton4Image( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiBUTTON4IMAGE ); + + return; +} + +void RenderButton4Image(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiBUTTON4IMAGE); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + +BOOLEAN LoadButton1Image( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\button_1.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBUTTON1IMAGE)); + + return (TRUE); +} + + +void DeleteButton1Image( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiBUTTON1IMAGE ); + + return; +} + +void RenderButton1Image(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiBUTTON1IMAGE); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + +BOOLEAN LoadPortraitFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Voice_PortraitFrame.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiPORTRAITFRAME)); + + return (TRUE); +} + + +void DeletePortraitFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiPORTRAITFRAME ); + + return; +} + +void RenderPortraitFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiPORTRAITFRAME); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + + +BOOLEAN LoadMainIndentFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\mainprofilepageindent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMAININDENT)); + + return (TRUE); +} + + +void DeleteMainIndentFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiMAININDENT ); + + return; +} + +void RenderMainIndentFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiMAININDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + +BOOLEAN LoadQtnLongIndentFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\longindent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLONGINDENT)); + + return (TRUE); +} + + +void DeleteQtnLongIndentFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiLONGINDENT ); + + return; +} + +void RenderQtnLongIndentFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiLONGINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + +BOOLEAN LoadQtnShortIndentFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\shortindent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSHORTINDENT)); + + return (TRUE); +} + + +void DeleteQtnShortIndentFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiSHORTINDENT ); + + return; +} + +void RenderQtnShortIndentFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiSHORTINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + +BOOLEAN LoadQtnLongIndentHighFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\longindenthigh.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLONGHINDENT)); + + return (TRUE); +} + + +void DeleteQtnLongIndentHighFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiLONGHINDENT ); + + return; +} + +void RenderQtnLongIndentHighFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiLONGHINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + +BOOLEAN LoadQtnShortIndentHighFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\shortindenthigh.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSHORTHINDENT)); + + return (TRUE); +} + + +void DeleteQtnShortIndentHighFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiSHORTHINDENT ); + + return; +} + +void RenderQtnShortIndentHighFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiSHORTHINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + +BOOLEAN LoadQtnIndentFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\questionindent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiQINDENT)); + + return (TRUE); +} + + +void DeleteQtnIndentFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiQINDENT ); + + return; +} + +void RenderQtnIndentFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiQINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + +BOOLEAN LoadAttrib1IndentFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\attributescreenindent_1.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiA1INDENT)); + + return (TRUE); +} + + +void DeleteAttrib1IndentFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiA1INDENT ); + + return; +} + +void RenderAttrib1IndentFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiA1INDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + +BOOLEAN LoadAttrib2IndentFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\attributescreenindent_2.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiA2INDENT)); + + return (TRUE); +} + + +void DeleteAttrib2IndentFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiA2INDENT ); + + return; +} + +void RenderAttrib2IndentFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiA2INDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + +BOOLEAN LoadAvgMercIndentFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\anaveragemercindent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiAVGMERCINDENT)); + + return (TRUE); +} + + +void DeleteAvgMercIndentFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiAVGMERCINDENT ); + + return; +} + +void RenderAvgMercIndentFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiAVGMERCINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + + +BOOLEAN LoadAboutUsIndentFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\aboutusindent.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiABOUTUSINDENT)); + + return (TRUE); +} + + +void DeleteAboutUsIndentFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiABOUTUSINDENT ); + + return; +} + +void RenderAboutUsIndentFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiABOUTUSINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + +BOOLEAN LoadQtnShort2IndentFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\shortindent2.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSHORT2INDENT)); + + return (TRUE); +} + + +void DeleteQtnShort2IndentFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiSHORT2INDENT ); + + return; +} + +void RenderQtnShort2IndentFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiSHORT2INDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + +BOOLEAN LoadQtnShort2IndentHighFrame( void ) +{ + + // this procedure will load the activation indent into memory + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\shortindent2High.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSHORT2HINDENT)); + + return (TRUE); +} + + +void DeleteQtnShort2IndentHighFrame( void ) +{ + + // remove activation indent symbol + DeleteVideoObjectFromIndex( guiSHORT2HINDENT ); + + return; +} + +void RenderQtnShort2IndentHighFrame(INT16 sX, INT16 sY) +{ + + HVOBJECT hHandle; + + // get the video object + GetVideoObject(&hHandle, guiSHORT2HINDENT); + + // blt to sX, sY relative to upper left corner + BltVideoObject(FRAME_BUFFER, hHandle, 0, LAPTOP_SCREEN_UL_X + sX, LAPTOP_SCREEN_WEB_UL_Y + sY , VO_BLT_SRCTRANSPARENCY,NULL); + + return; +} + + + + + + diff --git a/Laptop/IMPVideoObjects.h b/Laptop/IMPVideoObjects.h new file mode 100644 index 00000000..e1c55e89 --- /dev/null +++ b/Laptop/IMPVideoObjects.h @@ -0,0 +1,175 @@ +#ifndef __IMP_VIDEO_H +#define __IMP_VIDEO_H + +#include "types.h" + +// the functions + +// metal background +void RenderProfileBackGround( void ); +void RemoveProfileBackGround( void ); +BOOLEAN LoadProfileBackGround( void ); + +// imp symbol +void RenderIMPSymbol( INT16 sX, INT16 sY ); +void DeleteIMPSymbol( void ); +BOOLEAN LoadIMPSymbol( void ); + +BOOLEAN LoadBeginIndent( void ); +void DeleteBeginIndent( void ); +void RenderBeginIndent(INT16 sX, INT16 sY); + +BOOLEAN LoadActivationIndent( void ); +void DeleteActivationIndent( void ); +void RenderActivationIndent(INT16 sX, INT16 sY); + +BOOLEAN LoadFrontPageIndent( void ); +void DeleteFrontPageIndent( void ); +void RenderFrontPageIndent(INT16 sX, INT16 sY); + +BOOLEAN LoadAnalyse( void ); +void DeleteAnalyse( void ); +void RenderAnalyse(INT16 sX, INT16 sY, INT8 bImageNumber); + +BOOLEAN LoadAttributeGraph( void ); +void DeleteAttributeGraph( void ); +void RenderAttributeGraph(INT16 sX, INT16 sY); + +BOOLEAN LoadAttributeGraphBar( void ); +void DeleteAttributeBarGraph( void ); +void RenderAttributeBarGraph(INT16 sX, INT16 sY); + +BOOLEAN LoadFullNameIndent( void ); +void DeleteFullNameIndent( void ); +void RenderFullNameIndent(INT16 sX, INT16 sY); + +BOOLEAN LoadNameIndent( void ); +void DeleteNameIndent( void ); +void RenderNameIndent(INT16 sX, INT16 sY); + +BOOLEAN LoadNickNameIndent( void ); +void DeleteNickNameIndent( void ); +void RenderNickNameIndent(INT16 sX, INT16 sY); + +BOOLEAN LoadGenderIndent( void ); +void DeleteGenderIndent( void ); +void RenderGenderIndent(INT16 sX, INT16 sY); + +BOOLEAN LoadSmallFrame( void ); +void DeleteSmallFrame( void ); +void RenderSmallFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadSmallSilhouette( void ); +void DeleteSmallSilhouette( void ); +void RenderSmallSilhouette(INT16 sX, INT16 sY); + +BOOLEAN LoadLargeSilhouette( void ); +void DeleteLargeSilhouette( void ); +void RenderLargeSilhouette(INT16 sX, INT16 sY); + +BOOLEAN LoadAttributeFrame( void ); +void DeleteAttributeFrame( void ); +void RenderAttributeFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadSliderBar( void ); +void DeleteSliderBar( void ); +void RenderSliderBar(INT16 sX, INT16 sY); + + +BOOLEAN LoadButton2Image( void ); +void DeleteButton2Image( void ); +void RenderButton2Image(INT16 sX, INT16 sY); + +BOOLEAN LoadButton4Image( void ); +void DeleteButton4Image( void ); +void RenderButton4Image(INT16 sX, INT16 sY); + +BOOLEAN LoadButton1Image( void ); +void DeleteButton1Image( void ); +void RenderButton1Image(INT16 sX, INT16 sY); + +BOOLEAN LoadPortraitFrame( void ); +void DeletePortraitFrame( void ); +void RenderPortraitFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadMainIndentFrame( void ); +void DeleteMainIndentFrame( void ); +void RenderMainIndentFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadQtnLongIndentFrame( void ); +void DeleteQtnLongIndentFrame( void ); +void RenderQtnLongIndentFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadQtnShortIndentFrame( void ); +void DeleteQtnShortIndentFrame( void ); +void RenderQtnShortIndentFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadQtnLongIndentHighFrame( void ); +void DeleteQtnLongIndentHighFrame( void ); +void RenderQtnLongIndentHighFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadQtnShortIndentHighFrame( void ); +void DeleteQtnShortIndentHighFrame( void ); +void RenderQtnShortIndentHighFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadQtnShort2IndentFrame( void ); +void DeleteQtnShort2IndentFrame( void ); +void RenderQtnShort2IndentFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadQtnShort2IndentHighFrame( void ); +void DeleteQtnShort2IndentHighFrame( void ); +void RenderQtnShort2IndentHighFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadQtnIndentFrame( void ); +void DeleteQtnIndentFrame( void ); +void RenderQtnIndentFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadAttrib1IndentFrame( void ); +void DeleteAttrib1IndentFrame( void ); +void RenderAttrib1IndentFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadAttrib2IndentFrame( void ); +void DeleteAttrib2IndentFrame( void ); +void RenderAttrib2IndentFrame(INT16 sX, INT16 sY); + +BOOLEAN LoadAvgMercIndentFrame( void ); +void DeleteAvgMercIndentFrame( void ); +void RenderAvgMercIndentFrame(INT16 sX, INT16 sY); + + +BOOLEAN LoadAboutUsIndentFrame( void ); +void DeleteAboutUsIndentFrame( void ); +void RenderAboutUsIndentFrame(INT16 sX, INT16 sY); + + +void RenderAttributeFrameForIndex( INT16 sX, INT16 sY, INT32 iIndex ); + + +// graphical handles + +extern UINT32 guiBACKGROUND; +extern UINT32 guiIMPSYMBOL; +extern UINT32 guiBEGININDENT; +extern UINT32 guiACTIVATIONINDENT; +extern UINT32 guiFRONTPAGEINDENT; +extern UINT32 guiFULLNAMEINDENT; +extern UINT32 guiGENDERINDENT; +extern UINT32 guiSMALLFRAME; +extern UINT32 guiANALYSE; +extern UINT32 guiATTRIBUTEGRAPH; +extern UINT32 guiATTRIBUTEGRAPHBAR; +extern UINT32 guiSMALLSILHOUETTE; +extern UINT32 guiLARGESILHOUETTE; +extern UINT32 guiPORTRAITFRAME; +extern UINT32 guiATTRIBUTEFRAME; +extern UINT32 guiATTRIBUTESCREENINDENT1; +extern UINT32 guiATTRIBUTESCREENINDENT2; +extern UINT32 guiSLIDERBAR; + +#endif + + + + + + diff --git a/Laptop/Insurance Text.h b/Laptop/Insurance Text.h new file mode 100644 index 00000000..8fd91250 --- /dev/null +++ b/Laptop/Insurance Text.h @@ -0,0 +1,97 @@ +#ifndef _INSURANCE_TEXT_H_ +#define _INSURANCE_TEXT_H_ + + +#define INSURANCE_TEXT_SINGLE_LINE_SIZE 80 * 2 + +#define INSURANCE_TEXT_MULTI_LINE_SIZE 5 * 80 * 2 + +#define INSURANCE_TEXT_SINGLE_FILE "BINARYDATA\\InsuranceSingle.edt" +#define INSURANCE_TEXT_MULTI_FILE "BINARYDATA\\InsuranceMulti.edt" + +#define INSURANCE_TEXT_SINGLE 1 +#define INSURANCE_TEXT_MULTI 2 + + +//Single line +enum +{ + INS_SNGL_MALLEUS_INCUS_STAPES, + INS_SNGL_WERE_LISTENING, + INS_SNGL_LIFE_INSURANCE_SPECIALISTS, + INS_SNGL_COMMENTSFROM_CLIENTS, + INS_SNGL_HOW_DOES_INS_WORK, + INS_SNGL_TO_ENTER_REVIEW, + INS_SNGL_GUS_TARBALLS, + INS_SNGL_ALI_HUSSEAN, + INS_SNGL_LANCE_ALLOT, + INS_SNGL_FRED_COUSTEAU, + INS_SNGL_WE_CAN_OFFER_U, + INS_SNGL_PREMIUMS, + INS_SNGL_RENEWL_PREMIUMS, + INS_SNGL_LOWER_PREMIUMS_4_RENEWING, + INS_SNGL_POLICY_CANCELATIONS, + INS_SNGL_SUBMITTING_CLAIM, + INS_SNGL_FRAUD, + INS_SNGL_ENTERING_REVIEWING_CLAIM, + INS_SNGL_EMPLOYMENT_CONTRACT, + INS_SNGL_LENGTH, + INS_SNGL_DAYS_REMAINING, + INS_SNGL_INSURANCE_CONTRACT, + INS_SNGL_PREMIUM_OWING, + INS_SNGL_PREMIUM_REFUND, + INS_SNGL_CHANGE_LENGTH, + INS_SNGL_CONTRACT, + INS_SNGL_NOCONTRACT, + INS_SNGL_DEAD_WITH_CONTRACT, + INS_SNGL_DEAD_NO_CONTRACT, + INS_SNGL_PARTIALLY_INSURED, + + + //Multi line + INS_MULTI_LINE_BEGINS, + + + INS_MLTI_EMPLOY_HIGH_RISK, + INS_MLTI_HIGH_FATALITY_RATE, + INS_MLTI_DRAIN_SALARY, + INS_MLTI_IF_ANSWERED_YES, + INS_MLTI_GUS_SPEECH, + INS_MLTI_ALI_HUSSEAN_SPEECH, + INS_MLTI_LANCE_ALLOT_SPEECH, + INS_MLTI_FRED_COUSTEAU_SPEECH, + INS_MLTI_HIRING_4_SHORT_TERM_HIGH_RISK_1, + INS_MLTI_HIRING_4_SHORT_TERM_HIGH_RISK_2, + INS_MLTI_REASONABLE_AND_FLEXIBLE, + INS_MLTI_EQUITABLE_RENEWL_PREMIUMS, + INS_MLTI_PREROGATIVE_TO_CANCEL, + INS_MLTI_QUICKLY_AND_EFFICIENT, + INS_MLTI_EACH_TIME_U_COME_TO_US, + INS_MLTI_LENGTH_OF_EMPLOYMENT_CONTRACT, + INS_MLTI_EMPLOYEES_AGE_AND_HEALTH, + INS_MLTI_EMPLOOYEES_TRAINING_AND_EXP, + INS_MLTI_WHEN_IT_COMES_TIME_TO_RENEW, + INS_MLTI_SHOULD_THE_PROJECT_BE_GOING_WELL, + INS_MLTI_IF_U_EXTEND_THE_CONTRACT, + INS_MLTI_WE_WILL_ACCEPT_INS_CANCELATION, + INS_MLTI_U_CAN_REST_ASSURED, + INS_MLTI_HAD_U_HIRED_AN_INDIVIDUAL, + INS_MLTI_WE_RESERVE_THE_RIGHT, + INS_MLTI_SHOULD_THERE_BE_GROUNDS, + INS_MLTI_SHOULD_SUCH_A_SITUATION, + INS_MLTI_TO_PURCHASE_INSURANCE, + INS_MLTI_ONCE_SATISFIED_CLICK_ACCEPT, + INS_MLTI_SORRY_U_CANT_CANCEL, + INS_MLTI_ARE_U_SURE_U_CANCEL, + INS_MLTI_NO_QUALIFIED_MERCS, + INS_MLTI_NOT_ENOUGH_FUNDS, + INS_MLTI_ALL_AIM_MERCS_ON_SHORT_CONTRACT, + INS_MLTI_1_HOUR_EXCLUSION_A, + INS_MLTI_1_HOUR_EXCLUSION_B, + +}; + + + + +#endif diff --git a/Laptop/Laptop All.h b/Laptop/Laptop All.h new file mode 100644 index 00000000..1b29e512 --- /dev/null +++ b/Laptop/Laptop All.h @@ -0,0 +1,141 @@ +#ifndef __LAPTOP_ALL_H +#define __LAPTOP_ALL_H + +#pragma message("GENERATED PCH FOR LAPTOP PROJECT.") + +#include "Types.h" +#include "laptop.h" +#include "aim.h" +#include "Utilities.h" +#include "WCheck.h" +#include "Debug.h" +#include "WordWrap.h" +#include "Encrypted File.h" +#include "email.h" +#include "Text.h" +#include "LaptopSave.h" +#include "Multi Language Graphic Utils.h" +#include "AimArchives.h" +#include "AimFacialIndex.h" +#include "stdio.h" +#include "Aim.h" +#include "AimHistory.h" +#include "AimLinks.h" +#include "AimMembers.h" +#include "sysutil.h" +#include "Soldier Control.h" +#include "Interface Items.h" +#include "overhead.h" +#include "finances.h" +#include "vsurface.h" +#include "VObject.h" +#include "Faces.h" +#include "dialogue control.h" +#include "History.h" +#include "Game Event Hook.h" +#include "MercTextBox.h" +#include "Render Dirty.h" +#include "Soldier Add.h" +#include "Merc Hiring.h" +#include "strategic.h" +#include "english.h" +#include "GameSettings.h" +#include "Random.h" +#include "Strategic Status.h" +#include "Merc Contract.h" +#include "Strategic Merc Handler.h" +#include "AimPolicies.h" +#include "AimSort.h" +#include +#include "BobbyR.h" +#include "Arms Dealer Init.h" +#include "ArmsDealerInvInit.h" +#include "BobbyRGuns.h" +#include "Cursors.h" +#include "Weapons.h" +#include "Store Inventory.h" +#include "BobbyRAmmo.h" +#include "BobbyRArmour.h" +#include "BobbyRMailOrder.h" +#include "input.h" +#include "line.h" +#include "Campaign Types.h" +#include "BobbyRMisc.h" +#include "BobbyRUsed.h" +#include "CharProfile.h" +#include "IMP AboutUs.h" +#include "IMP Attribute Entrance.h" +#include "IMP Attribute Finish.h" +#include "IMP MainPage.h" +#include "IMP HomePage.h" +#include "IMPVideoObjects.h" +#include "IMP Text System.h" +#include "IMP Finish.h" +#include "IMP Portraits.h" +#include "IMP Voices.h" +#include "IMP Personality Entrance.h" +#include "IMP Attribute Selection.h" +#include "IMP Personality Quiz.h" +#include "IMP Begin Screen.h" +#include "IMP Personality Finish.h" +#include "IMP Confirm.h" +#include "messageboxscreen.h" +#include "soldier profile.h" +#include "IMP Compile Character.h" +#include "environment.h" +#include +#include "files.h" +#include "Game clock.h" +#include "Strategic Mines.h" +#include "florist.h" +#include "florist Cards.h" +#include "Florist Gallery.h" +#include "florist Order Form.h" +#include "Text Input.h" +#include "funeral.h" +#include "strategicmap.h" +#include "QuestText.h" +#include "Isometric Utils.h" +#include "Timer Control.h" +#include "Soldier Profile Type.h" +#include "Animation Data.h" +#include "soundman.h" +#include "mousesystem.h" +#include "sgp.h" +#include "Sound Control.h" +#include "Insurance Text.h" +#include "insurance.h" +#include "Assignments.h" +#include "insurance Info.h" +#include "insurance Contract.h" +#include "screens.h" +#include "Event Pump.h" +#include "mercs Files.h" +#include "mercs Account.h" +#include "mercs No Account.h" +#include "insurance Comments.h" +#include "sirtech.h" +#include "personnel.h" +#include "Interface Control.h" +#include "Game init.h" +#include "vobject_blitters.h" +#include "LibraryDataBase.h" +#include "music control.h" +#include "SaveLoadGame.h" +#include "RenderWorld.h" +#include "gameloop.h" +#include "Map Screen Interface.h" +#include "ambient control.h" +#include "Message.h" +#include "Map Screen Interface Bottom.h" +#include "Cursor Control.h" +#include "Quests.h" +#include "mercs.h" +#include "Speck Quotes.h" +#include "Font.h" +#include "mapscreen.h" +#include "Map Screen Interface Map.h" +#include "ShopKeeper Interface.h" +#include "Cheats.h" + +#endif \ No newline at end of file diff --git a/Laptop/Laptop.dep b/Laptop/Laptop.dep new file mode 100644 index 00000000..16c0cec1 --- /dev/null +++ b/Laptop/Laptop.dep @@ -0,0 +1,9978 @@ +# Microsoft Developer Studio Generated Dependency File, included by Laptop.mak + +.\aim.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\AimArchives.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\AimFacialIndex.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\AimHistory.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\AimLinks.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\AimMembers.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\Strategic Town Loyalty.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\AimPolicies.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\AimSort.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\BobbyR.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\BobbyRAmmo.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\BobbyRArmour.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\BobbyRGuns.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\BobbyRMailOrder.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\BobbyRMisc.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\BobbyRShipments.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRShipments.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\BobbyRUsed.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\BrokenLink.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\BrokenLink.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\CharProfile.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\email.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\files.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\finances.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\florist Cards.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\florist Gallery.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\florist Order Form.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\strategic\meanwhile.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\florist.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\funeral.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\history.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP AboutUs.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Attribute Entrance.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Attribute Finish.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Attribute Selection.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Begin Screen.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Compile Character.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Confirm.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Finish.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP HomePage.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP MainPage.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Personality Entrance.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Personality Finish.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Personality Quiz.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Portraits.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Text System.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\IMP Voices.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\IMPVideoObjects.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\insurance Comments.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\insurance Contract.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\insurance Info.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\insurance.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\laptop.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\helpscreen.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRShipments.h"\ + ".\BobbyRUsed.h"\ + ".\BrokenLink.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\mercs Account.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\mercs Files.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\mercs No Account.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\mercs.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\personnel.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\Soldier macros.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\TeamTurns.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +.\sirtech.cpp : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + + +".\Store Inventory.cpp" : \ + "..\builddefines.h"\ + "..\cheats.h"\ + "..\gameloop.h"\ + "..\gamescreen.h"\ + "..\GameSettings.h"\ + "..\jascreens.h"\ + "..\Language Defines.h"\ + "..\local.h"\ + "..\MessageBoxScreen.h"\ + "..\SaveLoadGame.h"\ + "..\screenids.h"\ + "..\SCREENS.H"\ + "..\standard gaming platform\button sound control.h"\ + "..\Standard Gaming Platform\Button System.h"\ + "..\Standard Gaming Platform\container.h"\ + "..\Standard Gaming Platform\Cursor Control.h"\ + "..\Standard Gaming Platform\DbMan.h"\ + "..\Standard Gaming Platform\Debug.h"\ + "..\Standard Gaming Platform\DirectDraw Calls.h"\ + "..\Standard Gaming Platform\DirectX Common.h"\ + "..\Standard Gaming Platform\english.h"\ + "..\Standard Gaming Platform\FileMan.h"\ + "..\Standard Gaming Platform\font.h"\ + "..\Standard Gaming Platform\himage.h"\ + "..\Standard Gaming Platform\imgfmt.h"\ + "..\Standard Gaming Platform\Input.h"\ + "..\standard gaming platform\ja2 libs.h"\ + "..\Standard Gaming Platform\LibraryDataBase.h"\ + "..\Standard Gaming Platform\line.h"\ + "..\Standard Gaming Platform\MemMan.h"\ + "..\Standard Gaming Platform\mousesystem.h"\ + "..\Standard Gaming Platform\mousesystem_macros.h"\ + "..\standard gaming platform\mss.h"\ + "..\Standard Gaming Platform\Mutex Manager.h"\ + "..\Standard Gaming Platform\pcx.h"\ + "..\Standard Gaming Platform\random.h"\ + "..\Standard Gaming Platform\sgp.h"\ + "..\Standard Gaming Platform\shading.h"\ + "..\Standard Gaming Platform\soundman.h"\ + "..\Standard Gaming Platform\timer.h"\ + "..\Standard Gaming Platform\TopicIDs.h"\ + "..\Standard Gaming Platform\TopicOps.h"\ + "..\Standard Gaming Platform\Video.h"\ + "..\Standard Gaming Platform\vobject.h"\ + "..\Standard Gaming Platform\vobject_blitters.h"\ + "..\Standard Gaming Platform\vsurface.h"\ + "..\Standard Gaming Platform\WCheck.h"\ + "..\Strategic\Assignments.h"\ + "..\Strategic\Campaign Types.h"\ + "..\Strategic\Game Clock.h"\ + "..\Strategic\Game Event Hook.h"\ + "..\Strategic\Game Init.h"\ + "..\Strategic\Map Screen Interface Bottom.h"\ + "..\Strategic\Map Screen Interface Map.h"\ + "..\Strategic\Map Screen Interface.h"\ + "..\Strategic\mapscreen.h"\ + "..\Strategic\Merc Contract.h"\ + "..\Strategic\Quests.h"\ + "..\strategic\questtext.h"\ + "..\Strategic\Strategic Merc Handler.h"\ + "..\Strategic\Strategic Mines.h"\ + "..\Strategic\Strategic Movement.h"\ + "..\Strategic\Strategic Status.h"\ + "..\Strategic\strategic.h"\ + "..\Strategic\strategicmap.h"\ + "..\Tactical\animation cache.h"\ + "..\Tactical\Animation Data.h"\ + "..\Tactical\Arms Dealer Init.h"\ + "..\tactical\armsdealerinvinit.h"\ + "..\tactical\dialogue control.h"\ + "..\tactical\faces.h"\ + "..\Tactical\Handle Items.h"\ + "..\Tactical\Handle UI.h"\ + "..\tactical\interface control.h"\ + "..\Tactical\Interface Items.h"\ + "..\Tactical\Interface.h"\ + "..\Tactical\Item Types.h"\ + "..\Tactical\Items.h"\ + "..\Tactical\Merc Hiring.h"\ + "..\Tactical\overhead types.h"\ + "..\Tactical\Overhead.h"\ + "..\Tactical\ShopKeeper Interface.h"\ + "..\Tactical\Soldier Add.h"\ + "..\Tactical\Soldier Control.h"\ + "..\tactical\soldier find.h"\ + "..\Tactical\soldier profile type.h"\ + "..\Tactical\Soldier Profile.h"\ + "..\Tactical\Vehicles.h"\ + "..\Tactical\weapons.h"\ + "..\Tactical\World Items.h"\ + "..\TileEngine\Ambient Control.h"\ + "..\TileEngine\Ambient Types.h"\ + "..\TileEngine\environment.h"\ + "..\TileEngine\Isometric Utils.h"\ + "..\TileEngine\render dirty.h"\ + "..\TileEngine\renderworld.h"\ + "..\TileEngine\Structure Internals.h"\ + "..\TileEngine\structure.h"\ + "..\TileEngine\sysutil.h"\ + "..\TileEngine\TileDat.h"\ + "..\TileEngine\tiledef.h"\ + "..\TileEngine\worlddef.h"\ + "..\Utils\cursors.h"\ + "..\utils\encrypted file.h"\ + "..\Utils\Event Manager.h"\ + "..\Utils\Event Pump.h"\ + "..\Utils\Font Control.h"\ + "..\utils\merctextbox.h"\ + "..\Utils\message.h"\ + "..\Utils\Multi Language Graphic Utils.h"\ + "..\Utils\Music Control.h"\ + "..\Utils\Sound Control.h"\ + "..\Utils\Text Input.h"\ + "..\Utils\Text.h"\ + "..\Utils\Timer Control.h"\ + "..\Utils\utilities.h"\ + "..\utils\wordwrap.h"\ + ".\aim.h"\ + ".\aimarchives.h"\ + ".\aimfacialindex.h"\ + ".\aimhistory.h"\ + ".\aimlinks.h"\ + ".\AimMembers.h"\ + ".\aimpolicies.h"\ + ".\aimsort.h"\ + ".\bobbyr.h"\ + ".\BobbyRAmmo.h"\ + ".\BobbyRArmour.h"\ + ".\BobbyRGuns.h"\ + ".\BobbyRMailOrder.h"\ + ".\BobbyRMisc.h"\ + ".\BobbyRUsed.h"\ + ".\CharProfile.h"\ + ".\email.h"\ + ".\files.h"\ + ".\finances.h"\ + ".\florist Cards.h"\ + ".\florist Gallery.h"\ + ".\florist Order Form.h"\ + ".\florist.h"\ + ".\funeral.h"\ + ".\history.h"\ + ".\IMP AboutUs.h"\ + ".\IMP Attribute Entrance.h"\ + ".\IMP Attribute Finish.h"\ + ".\IMP Attribute Selection.h"\ + ".\IMP Begin Screen.h"\ + ".\IMP Compile Character.h"\ + ".\IMP Confirm.h"\ + ".\IMP Finish.h"\ + ".\IMP HomePage.h"\ + ".\IMP MainPage.h"\ + ".\IMP Personality Entrance.h"\ + ".\IMP Personality Finish.h"\ + ".\IMP Personality Quiz.h"\ + ".\IMP Portraits.h"\ + ".\IMP Text System.h"\ + ".\IMP Voices.h"\ + ".\IMPVideoObjects.h"\ + ".\insurance Comments.h"\ + ".\insurance Contract.h"\ + ".\insurance Info.h"\ + ".\Insurance Text.h"\ + ".\insurance.h"\ + ".\Laptop All.h"\ + ".\laptop.h"\ + ".\LaptopSave.h"\ + ".\mercs account.h"\ + ".\mercs files.h"\ + ".\mercs no account.h"\ + ".\mercs.h"\ + ".\personnel.h"\ + ".\sirtech.h"\ + ".\speck quotes.h"\ + ".\Store Inventory.h"\ + diff --git a/Laptop/Laptop.dsp b/Laptop/Laptop.dsp new file mode 100644 index 00000000..21cd0586 --- /dev/null +++ b/Laptop/Laptop.dsp @@ -0,0 +1,697 @@ +# Microsoft Developer Studio Project File - Name="Laptop" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=Laptop - Win32 Demo Bounds Checker +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Laptop.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Laptop.mak" CFG="Laptop - Win32 Demo Bounds Checker" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Laptop - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Release with Debug Info" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Bounds Checker" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Debug Demo" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Release Demo" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Demo Release with Debug Info" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Demo Bounds Checker" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName ""$/Jagged Alliance 2/Development/Programming/Jagged Alliance 2/Build", AVAAAAAA" +# PROP Scc_LocalPath "..\..\..\ja2\build" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Laptop - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"Laptop All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Laptop - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Laptop__" +# PROP BASE Intermediate_Dir "Laptop__" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I ".\\" /D "PRECOMPILEDHEADERS" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"Laptop All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Laptop - Win32 Release with Debug Info" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Laptop_0" +# PROP BASE Intermediate_Dir "Laptop_0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release with Debug" +# PROP Intermediate_Dir "Release with Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "JA2" /YX /FD /c +# ADD CPP /nologo /MT /W4 /GX /Zi /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\TileEngine" /I "..\Utils" /I "..\TacticalAI" /I "..\Editor" /I "..\Tactical" /I "..\strategic" /I ".\\" /D "NDEBUG" /D "RELEASE_WITH_DEBUG_INFO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"Laptop All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Laptop - Win32 Bounds Checker" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Laptop_2" +# PROP BASE Intermediate_Dir "Laptop_2" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Bounds Checker" +# PROP Intermediate_Dir "Bounds Checker" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "JA2" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /FR /YX"Laptop All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Laptop - Win32 Debug Demo" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Laptop_1" +# PROP BASE Intermediate_Dir "Laptop_1" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug Demo" +# PROP Intermediate_Dir "Debug Demo" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "JA2" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"Laptop All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Laptop - Win32 Release Demo" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Laptop_3" +# PROP BASE Intermediate_Dir "Laptop_3" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release Demo" +# PROP Intermediate_Dir "Release Demo" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "JA2" /D "RELEASE_WITH_DEBUG_INFO" /FR /YX /FD /c +# ADD CPP /nologo /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"Laptop All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Laptop - Win32 Demo Release with Debug Info" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Laptop_4" +# PROP BASE Intermediate_Dir "Laptop_4" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Demo Release with Debug" +# PROP Intermediate_Dir "Demo Release with Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "JA2" /D "RELEASE_WITH_DEBUG_INFO" /FR /YX /FD /c +# ADD CPP /nologo /MT /W4 /GX /Zi /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\TileEngine" /I "..\Utils" /I "..\TacticalAI" /I "..\Editor" /I "..\Tactical" /I "..\strategic" /I ".\\" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "XML_STATIC" /D "CINTERFACE" /FR /YX"Laptop All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "Laptop - Win32 Demo Bounds Checker" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Laptop_5" +# PROP BASE Intermediate_Dir "Laptop_5" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Demo Bounds Checker" +# PROP Intermediate_Dir "Demo Bounds Checker" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "BOUNDS_CHECKER" /FR /YX /FD /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR /YX"Laptop All.h" /FD /c +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "Laptop - Win32 Release" +# Name "Laptop - Win32 Debug" +# Name "Laptop - Win32 Release with Debug Info" +# Name "Laptop - Win32 Bounds Checker" +# Name "Laptop - Win32 Debug Demo" +# Name "Laptop - Win32 Release Demo" +# Name "Laptop - Win32 Demo Release with Debug Info" +# Name "Laptop - Win32 Demo Bounds Checker" +# Begin Group "Source Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\aim.cpp +# End Source File +# Begin Source File + +SOURCE=.\AimArchives.cpp +# End Source File +# Begin Source File + +SOURCE=.\AimFacialIndex.cpp +# End Source File +# Begin Source File + +SOURCE=.\AimHistory.cpp +# End Source File +# Begin Source File + +SOURCE=.\AimLinks.cpp +# End Source File +# Begin Source File + +SOURCE=.\AimMembers.cpp +# End Source File +# Begin Source File + +SOURCE=.\AimPolicies.cpp +# End Source File +# Begin Source File + +SOURCE=.\AimSort.cpp +# End Source File +# Begin Source File + +SOURCE=.\BobbyR.cpp +# End Source File +# Begin Source File + +SOURCE=.\BobbyRAmmo.cpp +# End Source File +# Begin Source File + +SOURCE=.\BobbyRArmour.cpp +# End Source File +# Begin Source File + +SOURCE=.\BobbyRGuns.cpp +# End Source File +# Begin Source File + +SOURCE=.\BobbyRMailOrder.cpp +# End Source File +# Begin Source File + +SOURCE=.\BobbyRMisc.cpp +# End Source File +# Begin Source File + +SOURCE=.\BobbyRShipments.cpp +# End Source File +# Begin Source File + +SOURCE=.\BobbyRUsed.cpp +# End Source File +# Begin Source File + +SOURCE=.\BrokenLink.cpp +# End Source File +# Begin Source File + +SOURCE=.\CharProfile.cpp +# End Source File +# Begin Source File + +SOURCE=.\email.cpp +# End Source File +# Begin Source File + +SOURCE=.\files.cpp +# End Source File +# Begin Source File + +SOURCE=.\finances.cpp +# End Source File +# Begin Source File + +SOURCE=".\florist Cards.cpp" +# End Source File +# Begin Source File + +SOURCE=".\florist Gallery.cpp" +# End Source File +# Begin Source File + +SOURCE=".\florist Order Form.cpp" +# End Source File +# Begin Source File + +SOURCE=.\florist.cpp +# End Source File +# Begin Source File + +SOURCE=.\funeral.cpp +# End Source File +# Begin Source File + +SOURCE=.\history.cpp +# End Source File +# Begin Source File + +SOURCE=".\IMP AboutUs.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Attribute Entrance.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Attribute Finish.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Attribute Selection.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Begin Screen.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Compile Character.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Confirm.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Finish.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP HomePage.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP MainPage.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Personality Entrance.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Personality Finish.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Personality Quiz.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Portraits.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Skill Trait.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Text System.cpp" +# End Source File +# Begin Source File + +SOURCE=".\IMP Voices.cpp" +# End Source File +# Begin Source File + +SOURCE=.\IMPVideoObjects.cpp +# End Source File +# Begin Source File + +SOURCE=".\insurance Comments.cpp" +# End Source File +# Begin Source File + +SOURCE=".\insurance Contract.cpp" +# End Source File +# Begin Source File + +SOURCE=".\insurance Info.cpp" +# End Source File +# Begin Source File + +SOURCE=.\insurance.cpp +# End Source File +# Begin Source File + +SOURCE=.\laptop.cpp +# End Source File +# Begin Source File + +SOURCE=".\mercs Account.cpp" +# End Source File +# Begin Source File + +SOURCE=".\mercs Files.cpp" +# End Source File +# Begin Source File + +SOURCE=".\mercs No Account.cpp" +# End Source File +# Begin Source File + +SOURCE=.\mercs.cpp +# End Source File +# Begin Source File + +SOURCE=.\personnel.cpp + +!IF "$(CFG)" == "Laptop - Win32 Release" + +!ELSEIF "$(CFG)" == "Laptop - Win32 Debug" + +!ELSEIF "$(CFG)" == "Laptop - Win32 Release with Debug Info" + +# ADD CPP /W4 /O2 + +!ELSEIF "$(CFG)" == "Laptop - Win32 Bounds Checker" + +!ELSEIF "$(CFG)" == "Laptop - Win32 Debug Demo" + +!ELSEIF "$(CFG)" == "Laptop - Win32 Release Demo" + +# ADD BASE CPP /W4 /O2 +# ADD CPP /W4 /O2 + +!ELSEIF "$(CFG)" == "Laptop - Win32 Demo Release with Debug Info" + +# ADD BASE CPP /W4 /O2 +# ADD CPP /W4 /O2 + +!ELSEIF "$(CFG)" == "Laptop - Win32 Demo Bounds Checker" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\sirtech.cpp +# End Source File +# Begin Source File + +SOURCE=".\Store Inventory.cpp" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\aim.h +# End Source File +# Begin Source File + +SOURCE=.\AimMembers.h +# End Source File +# Begin Source File + +SOURCE=.\BobbyRAmmo.h +# End Source File +# Begin Source File + +SOURCE=.\BobbyRArmour.h +# End Source File +# Begin Source File + +SOURCE=.\BobbyRGuns.h +# End Source File +# Begin Source File + +SOURCE=.\BobbyRMailOrder.h +# End Source File +# Begin Source File + +SOURCE=.\BobbyRMisc.h +# End Source File +# Begin Source File + +SOURCE=.\BobbyRShipments.h +# End Source File +# Begin Source File + +SOURCE=.\BobbyRUsed.h +# End Source File +# Begin Source File + +SOURCE=.\BrokenLink.h +# End Source File +# Begin Source File + +SOURCE=.\CharProfile.h +# End Source File +# Begin Source File + +SOURCE=.\email.h +# End Source File +# Begin Source File + +SOURCE=.\files.h +# End Source File +# Begin Source File + +SOURCE=.\finances.h +# End Source File +# Begin Source File + +SOURCE=".\florist Cards.h" +# End Source File +# Begin Source File + +SOURCE=".\florist Gallery.h" +# End Source File +# Begin Source File + +SOURCE=".\florist Order Form.h" +# End Source File +# Begin Source File + +SOURCE=.\florist.h +# End Source File +# Begin Source File + +SOURCE=.\funeral.h +# End Source File +# Begin Source File + +SOURCE=.\history.h +# End Source File +# Begin Source File + +SOURCE=".\IMP AboutUs.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Attribute Entrance.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Attribute Finish.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Attribute Selection.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Begin Screen.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Compile Character.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Confirm.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Finish.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP HomePage.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP MainPage.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Personality Entrance.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Personality Finish.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Personality Quiz.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Portraits.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Skill Trait.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Text System.h" +# End Source File +# Begin Source File + +SOURCE=".\IMP Voices.h" +# End Source File +# Begin Source File + +SOURCE=.\IMPVideoObjects.h +# End Source File +# Begin Source File + +SOURCE=".\insurance Comments.h" +# End Source File +# Begin Source File + +SOURCE=".\insurance Contract.h" +# End Source File +# Begin Source File + +SOURCE=".\insurance Info.h" +# End Source File +# Begin Source File + +SOURCE=".\Insurance Text.h" +# End Source File +# Begin Source File + +SOURCE=.\insurance.h +# End Source File +# Begin Source File + +SOURCE=".\Laptop All.h" +# End Source File +# Begin Source File + +SOURCE=.\laptop.h +# End Source File +# Begin Source File + +SOURCE=.\LaptopSave.h +# End Source File +# Begin Source File + +SOURCE=.\mercs.h +# End Source File +# Begin Source File + +SOURCE=.\personnel.h +# End Source File +# Begin Source File + +SOURCE=.\sirtech.h +# End Source File +# Begin Source File + +SOURCE=".\Store Inventory.h" +# End Source File +# End Group +# End Target +# End Project diff --git a/Laptop/Laptop.mak b/Laptop/Laptop.mak new file mode 100644 index 00000000..9c821a58 --- /dev/null +++ b/Laptop/Laptop.mak @@ -0,0 +1,2540 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on Laptop.dsp +!IF "$(CFG)" == "" +CFG=Laptop - Win32 Demo Bounds Checker +!MESSAGE No configuration specified. Defaulting to Laptop - Win32 Demo Bounds Checker. +!ENDIF + +!IF "$(CFG)" != "Laptop - Win32 Release" && "$(CFG)" != "Laptop - Win32 Debug" && "$(CFG)" != "Laptop - Win32 Release with Debug Info" && "$(CFG)" != "Laptop - Win32 Bounds Checker" && "$(CFG)" != "Laptop - Win32 Debug Demo" && "$(CFG)" != "Laptop - Win32 Release Demo" && "$(CFG)" != "Laptop - Win32 Demo Release with Debug Info" && "$(CFG)" != "Laptop - Win32 Demo Bounds Checker" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Laptop.mak" CFG="Laptop - Win32 Demo Bounds Checker" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Laptop - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Release with Debug Info" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Bounds Checker" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Debug Demo" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Release Demo" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Demo Release with Debug Info" (based on "Win32 (x86) Static Library") +!MESSAGE "Laptop - Win32 Demo Bounds Checker" (based on "Win32 (x86) Static Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Laptop - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release +# Begin Custom Macros +OutDir=.\Release +# End Custom Macros + +ALL : "$(OUTDIR)\Laptop.lib" "$(OUTDIR)\Laptop.bsc" + + +CLEAN : + -@erase "$(INTDIR)\aim.obj" + -@erase "$(INTDIR)\aim.sbr" + -@erase "$(INTDIR)\AimArchives.obj" + -@erase "$(INTDIR)\AimArchives.sbr" + -@erase "$(INTDIR)\AimFacialIndex.obj" + -@erase "$(INTDIR)\AimFacialIndex.sbr" + -@erase "$(INTDIR)\AimHistory.obj" + -@erase "$(INTDIR)\AimHistory.sbr" + -@erase "$(INTDIR)\AimLinks.obj" + -@erase "$(INTDIR)\AimLinks.sbr" + -@erase "$(INTDIR)\AimMembers.obj" + -@erase "$(INTDIR)\AimMembers.sbr" + -@erase "$(INTDIR)\AimPolicies.obj" + -@erase "$(INTDIR)\AimPolicies.sbr" + -@erase "$(INTDIR)\AimSort.obj" + -@erase "$(INTDIR)\AimSort.sbr" + -@erase "$(INTDIR)\BobbyR.obj" + -@erase "$(INTDIR)\BobbyR.sbr" + -@erase "$(INTDIR)\BobbyRAmmo.obj" + -@erase "$(INTDIR)\BobbyRAmmo.sbr" + -@erase "$(INTDIR)\BobbyRArmour.obj" + -@erase "$(INTDIR)\BobbyRArmour.sbr" + -@erase "$(INTDIR)\BobbyRGuns.obj" + -@erase "$(INTDIR)\BobbyRGuns.sbr" + -@erase "$(INTDIR)\BobbyRMailOrder.obj" + -@erase "$(INTDIR)\BobbyRMailOrder.sbr" + -@erase "$(INTDIR)\BobbyRMisc.obj" + -@erase "$(INTDIR)\BobbyRMisc.sbr" + -@erase "$(INTDIR)\BobbyRShipments.obj" + -@erase "$(INTDIR)\BobbyRShipments.sbr" + -@erase "$(INTDIR)\BobbyRUsed.obj" + -@erase "$(INTDIR)\BobbyRUsed.sbr" + -@erase "$(INTDIR)\BrokenLink.obj" + -@erase "$(INTDIR)\BrokenLink.sbr" + -@erase "$(INTDIR)\CharProfile.obj" + -@erase "$(INTDIR)\CharProfile.sbr" + -@erase "$(INTDIR)\email.obj" + -@erase "$(INTDIR)\email.sbr" + -@erase "$(INTDIR)\files.obj" + -@erase "$(INTDIR)\files.sbr" + -@erase "$(INTDIR)\finances.obj" + -@erase "$(INTDIR)\finances.sbr" + -@erase "$(INTDIR)\florist Cards.obj" + -@erase "$(INTDIR)\florist Cards.sbr" + -@erase "$(INTDIR)\florist Gallery.obj" + -@erase "$(INTDIR)\florist Gallery.sbr" + -@erase "$(INTDIR)\florist Order Form.obj" + -@erase "$(INTDIR)\florist Order Form.sbr" + -@erase "$(INTDIR)\florist.obj" + -@erase "$(INTDIR)\florist.sbr" + -@erase "$(INTDIR)\funeral.obj" + -@erase "$(INTDIR)\funeral.sbr" + -@erase "$(INTDIR)\history.obj" + -@erase "$(INTDIR)\history.sbr" + -@erase "$(INTDIR)\IMP AboutUs.obj" + -@erase "$(INTDIR)\IMP AboutUs.sbr" + -@erase "$(INTDIR)\IMP Attribute Entrance.obj" + -@erase "$(INTDIR)\IMP Attribute Entrance.sbr" + -@erase "$(INTDIR)\IMP Attribute Finish.obj" + -@erase "$(INTDIR)\IMP Attribute Finish.sbr" + -@erase "$(INTDIR)\IMP Attribute Selection.obj" + -@erase "$(INTDIR)\IMP Attribute Selection.sbr" + -@erase "$(INTDIR)\IMP Begin Screen.obj" + -@erase "$(INTDIR)\IMP Begin Screen.sbr" + -@erase "$(INTDIR)\IMP Compile Character.obj" + -@erase "$(INTDIR)\IMP Compile Character.sbr" + -@erase "$(INTDIR)\IMP Confirm.obj" + -@erase "$(INTDIR)\IMP Confirm.sbr" + -@erase "$(INTDIR)\IMP Finish.obj" + -@erase "$(INTDIR)\IMP Finish.sbr" + -@erase "$(INTDIR)\IMP HomePage.obj" + -@erase "$(INTDIR)\IMP HomePage.sbr" + -@erase "$(INTDIR)\IMP MainPage.obj" + -@erase "$(INTDIR)\IMP MainPage.sbr" + -@erase "$(INTDIR)\IMP Personality Entrance.obj" + -@erase "$(INTDIR)\IMP Personality Entrance.sbr" + -@erase "$(INTDIR)\IMP Personality Finish.obj" + -@erase "$(INTDIR)\IMP Personality Finish.sbr" + -@erase "$(INTDIR)\IMP Personality Quiz.obj" + -@erase "$(INTDIR)\IMP Personality Quiz.sbr" + -@erase "$(INTDIR)\IMP Portraits.obj" + -@erase "$(INTDIR)\IMP Portraits.sbr" + -@erase "$(INTDIR)\IMP Text System.obj" + -@erase "$(INTDIR)\IMP Text System.sbr" + -@erase "$(INTDIR)\IMP Voices.obj" + -@erase "$(INTDIR)\IMP Voices.sbr" + -@erase "$(INTDIR)\IMPVideoObjects.obj" + -@erase "$(INTDIR)\IMPVideoObjects.sbr" + -@erase "$(INTDIR)\insurance Comments.obj" + -@erase "$(INTDIR)\insurance Comments.sbr" + -@erase "$(INTDIR)\insurance Contract.obj" + -@erase "$(INTDIR)\insurance Contract.sbr" + -@erase "$(INTDIR)\insurance Info.obj" + -@erase "$(INTDIR)\insurance Info.sbr" + -@erase "$(INTDIR)\insurance.obj" + -@erase "$(INTDIR)\insurance.sbr" + -@erase "$(INTDIR)\laptop.obj" + -@erase "$(INTDIR)\laptop.sbr" + -@erase "$(INTDIR)\mercs Account.obj" + -@erase "$(INTDIR)\mercs Account.sbr" + -@erase "$(INTDIR)\mercs Files.obj" + -@erase "$(INTDIR)\mercs Files.sbr" + -@erase "$(INTDIR)\mercs No Account.obj" + -@erase "$(INTDIR)\mercs No Account.sbr" + -@erase "$(INTDIR)\mercs.obj" + -@erase "$(INTDIR)\mercs.sbr" + -@erase "$(INTDIR)\personnel.obj" + -@erase "$(INTDIR)\personnel.sbr" + -@erase "$(INTDIR)\sirtech.obj" + -@erase "$(INTDIR)\sirtech.sbr" + -@erase "$(INTDIR)\Store Inventory.obj" + -@erase "$(INTDIR)\Store Inventory.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Laptop.bsc" + -@erase "$(OUTDIR)\Laptop.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Laptop.bsc" +BSC32_SBRS= \ + "$(INTDIR)\aim.sbr" \ + "$(INTDIR)\AimArchives.sbr" \ + "$(INTDIR)\AimFacialIndex.sbr" \ + "$(INTDIR)\AimHistory.sbr" \ + "$(INTDIR)\AimLinks.sbr" \ + "$(INTDIR)\AimMembers.sbr" \ + "$(INTDIR)\AimPolicies.sbr" \ + "$(INTDIR)\AimSort.sbr" \ + "$(INTDIR)\BobbyR.sbr" \ + "$(INTDIR)\BobbyRAmmo.sbr" \ + "$(INTDIR)\BobbyRArmour.sbr" \ + "$(INTDIR)\BobbyRGuns.sbr" \ + "$(INTDIR)\BobbyRMailOrder.sbr" \ + "$(INTDIR)\BobbyRMisc.sbr" \ + "$(INTDIR)\BobbyRShipments.sbr" \ + "$(INTDIR)\BobbyRUsed.sbr" \ + "$(INTDIR)\BrokenLink.sbr" \ + "$(INTDIR)\CharProfile.sbr" \ + "$(INTDIR)\email.sbr" \ + "$(INTDIR)\files.sbr" \ + "$(INTDIR)\finances.sbr" \ + "$(INTDIR)\florist Cards.sbr" \ + "$(INTDIR)\florist Gallery.sbr" \ + "$(INTDIR)\florist Order Form.sbr" \ + "$(INTDIR)\florist.sbr" \ + "$(INTDIR)\funeral.sbr" \ + "$(INTDIR)\history.sbr" \ + "$(INTDIR)\IMP AboutUs.sbr" \ + "$(INTDIR)\IMP Attribute Entrance.sbr" \ + "$(INTDIR)\IMP Attribute Finish.sbr" \ + "$(INTDIR)\IMP Attribute Selection.sbr" \ + "$(INTDIR)\IMP Begin Screen.sbr" \ + "$(INTDIR)\IMP Compile Character.sbr" \ + "$(INTDIR)\IMP Confirm.sbr" \ + "$(INTDIR)\IMP Finish.sbr" \ + "$(INTDIR)\IMP HomePage.sbr" \ + "$(INTDIR)\IMP MainPage.sbr" \ + "$(INTDIR)\IMP Personality Entrance.sbr" \ + "$(INTDIR)\IMP Personality Finish.sbr" \ + "$(INTDIR)\IMP Personality Quiz.sbr" \ + "$(INTDIR)\IMP Portraits.sbr" \ + "$(INTDIR)\IMP Text System.sbr" \ + "$(INTDIR)\IMP Voices.sbr" \ + "$(INTDIR)\IMPVideoObjects.sbr" \ + "$(INTDIR)\insurance Comments.sbr" \ + "$(INTDIR)\insurance Contract.sbr" \ + "$(INTDIR)\insurance Info.sbr" \ + "$(INTDIR)\insurance.sbr" \ + "$(INTDIR)\laptop.sbr" \ + "$(INTDIR)\mercs Account.sbr" \ + "$(INTDIR)\mercs Files.sbr" \ + "$(INTDIR)\mercs No Account.sbr" \ + "$(INTDIR)\mercs.sbr" \ + "$(INTDIR)\personnel.sbr" \ + "$(INTDIR)\sirtech.sbr" \ + "$(INTDIR)\Store Inventory.sbr" + +"$(OUTDIR)\Laptop.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Laptop.lib" +LIB32_OBJS= \ + "$(INTDIR)\aim.obj" \ + "$(INTDIR)\AimArchives.obj" \ + "$(INTDIR)\AimFacialIndex.obj" \ + "$(INTDIR)\AimHistory.obj" \ + "$(INTDIR)\AimLinks.obj" \ + "$(INTDIR)\AimMembers.obj" \ + "$(INTDIR)\AimPolicies.obj" \ + "$(INTDIR)\AimSort.obj" \ + "$(INTDIR)\BobbyR.obj" \ + "$(INTDIR)\BobbyRAmmo.obj" \ + "$(INTDIR)\BobbyRArmour.obj" \ + "$(INTDIR)\BobbyRGuns.obj" \ + "$(INTDIR)\BobbyRMailOrder.obj" \ + "$(INTDIR)\BobbyRMisc.obj" \ + "$(INTDIR)\BobbyRShipments.obj" \ + "$(INTDIR)\BobbyRUsed.obj" \ + "$(INTDIR)\BrokenLink.obj" \ + "$(INTDIR)\CharProfile.obj" \ + "$(INTDIR)\email.obj" \ + "$(INTDIR)\files.obj" \ + "$(INTDIR)\finances.obj" \ + "$(INTDIR)\florist Cards.obj" \ + "$(INTDIR)\florist Gallery.obj" \ + "$(INTDIR)\florist Order Form.obj" \ + "$(INTDIR)\florist.obj" \ + "$(INTDIR)\funeral.obj" \ + "$(INTDIR)\history.obj" \ + "$(INTDIR)\IMP AboutUs.obj" \ + "$(INTDIR)\IMP Attribute Entrance.obj" \ + "$(INTDIR)\IMP Attribute Finish.obj" \ + "$(INTDIR)\IMP Attribute Selection.obj" \ + "$(INTDIR)\IMP Begin Screen.obj" \ + "$(INTDIR)\IMP Compile Character.obj" \ + "$(INTDIR)\IMP Confirm.obj" \ + "$(INTDIR)\IMP Finish.obj" \ + "$(INTDIR)\IMP HomePage.obj" \ + "$(INTDIR)\IMP MainPage.obj" \ + "$(INTDIR)\IMP Personality Entrance.obj" \ + "$(INTDIR)\IMP Personality Finish.obj" \ + "$(INTDIR)\IMP Personality Quiz.obj" \ + "$(INTDIR)\IMP Portraits.obj" \ + "$(INTDIR)\IMP Text System.obj" \ + "$(INTDIR)\IMP Voices.obj" \ + "$(INTDIR)\IMPVideoObjects.obj" \ + "$(INTDIR)\insurance Comments.obj" \ + "$(INTDIR)\insurance Contract.obj" \ + "$(INTDIR)\insurance Info.obj" \ + "$(INTDIR)\insurance.obj" \ + "$(INTDIR)\laptop.obj" \ + "$(INTDIR)\mercs Account.obj" \ + "$(INTDIR)\mercs Files.obj" \ + "$(INTDIR)\mercs No Account.obj" \ + "$(INTDIR)\mercs.obj" \ + "$(INTDIR)\personnel.obj" \ + "$(INTDIR)\sirtech.obj" \ + "$(INTDIR)\Store Inventory.obj" + +"$(OUTDIR)\Laptop.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Laptop - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +ALL : "$(OUTDIR)\Laptop.lib" "$(OUTDIR)\Laptop.bsc" + + +CLEAN : + -@erase "$(INTDIR)\aim.obj" + -@erase "$(INTDIR)\aim.sbr" + -@erase "$(INTDIR)\AimArchives.obj" + -@erase "$(INTDIR)\AimArchives.sbr" + -@erase "$(INTDIR)\AimFacialIndex.obj" + -@erase "$(INTDIR)\AimFacialIndex.sbr" + -@erase "$(INTDIR)\AimHistory.obj" + -@erase "$(INTDIR)\AimHistory.sbr" + -@erase "$(INTDIR)\AimLinks.obj" + -@erase "$(INTDIR)\AimLinks.sbr" + -@erase "$(INTDIR)\AimMembers.obj" + -@erase "$(INTDIR)\AimMembers.sbr" + -@erase "$(INTDIR)\AimPolicies.obj" + -@erase "$(INTDIR)\AimPolicies.sbr" + -@erase "$(INTDIR)\AimSort.obj" + -@erase "$(INTDIR)\AimSort.sbr" + -@erase "$(INTDIR)\BobbyR.obj" + -@erase "$(INTDIR)\BobbyR.sbr" + -@erase "$(INTDIR)\BobbyRAmmo.obj" + -@erase "$(INTDIR)\BobbyRAmmo.sbr" + -@erase "$(INTDIR)\BobbyRArmour.obj" + -@erase "$(INTDIR)\BobbyRArmour.sbr" + -@erase "$(INTDIR)\BobbyRGuns.obj" + -@erase "$(INTDIR)\BobbyRGuns.sbr" + -@erase "$(INTDIR)\BobbyRMailOrder.obj" + -@erase "$(INTDIR)\BobbyRMailOrder.sbr" + -@erase "$(INTDIR)\BobbyRMisc.obj" + -@erase "$(INTDIR)\BobbyRMisc.sbr" + -@erase "$(INTDIR)\BobbyRShipments.obj" + -@erase "$(INTDIR)\BobbyRShipments.sbr" + -@erase "$(INTDIR)\BobbyRUsed.obj" + -@erase "$(INTDIR)\BobbyRUsed.sbr" + -@erase "$(INTDIR)\BrokenLink.obj" + -@erase "$(INTDIR)\BrokenLink.sbr" + -@erase "$(INTDIR)\CharProfile.obj" + -@erase "$(INTDIR)\CharProfile.sbr" + -@erase "$(INTDIR)\email.obj" + -@erase "$(INTDIR)\email.sbr" + -@erase "$(INTDIR)\files.obj" + -@erase "$(INTDIR)\files.sbr" + -@erase "$(INTDIR)\finances.obj" + -@erase "$(INTDIR)\finances.sbr" + -@erase "$(INTDIR)\florist Cards.obj" + -@erase "$(INTDIR)\florist Cards.sbr" + -@erase "$(INTDIR)\florist Gallery.obj" + -@erase "$(INTDIR)\florist Gallery.sbr" + -@erase "$(INTDIR)\florist Order Form.obj" + -@erase "$(INTDIR)\florist Order Form.sbr" + -@erase "$(INTDIR)\florist.obj" + -@erase "$(INTDIR)\florist.sbr" + -@erase "$(INTDIR)\funeral.obj" + -@erase "$(INTDIR)\funeral.sbr" + -@erase "$(INTDIR)\history.obj" + -@erase "$(INTDIR)\history.sbr" + -@erase "$(INTDIR)\IMP AboutUs.obj" + -@erase "$(INTDIR)\IMP AboutUs.sbr" + -@erase "$(INTDIR)\IMP Attribute Entrance.obj" + -@erase "$(INTDIR)\IMP Attribute Entrance.sbr" + -@erase "$(INTDIR)\IMP Attribute Finish.obj" + -@erase "$(INTDIR)\IMP Attribute Finish.sbr" + -@erase "$(INTDIR)\IMP Attribute Selection.obj" + -@erase "$(INTDIR)\IMP Attribute Selection.sbr" + -@erase "$(INTDIR)\IMP Begin Screen.obj" + -@erase "$(INTDIR)\IMP Begin Screen.sbr" + -@erase "$(INTDIR)\IMP Compile Character.obj" + -@erase "$(INTDIR)\IMP Compile Character.sbr" + -@erase "$(INTDIR)\IMP Confirm.obj" + -@erase "$(INTDIR)\IMP Confirm.sbr" + -@erase "$(INTDIR)\IMP Finish.obj" + -@erase "$(INTDIR)\IMP Finish.sbr" + -@erase "$(INTDIR)\IMP HomePage.obj" + -@erase "$(INTDIR)\IMP HomePage.sbr" + -@erase "$(INTDIR)\IMP MainPage.obj" + -@erase "$(INTDIR)\IMP MainPage.sbr" + -@erase "$(INTDIR)\IMP Personality Entrance.obj" + -@erase "$(INTDIR)\IMP Personality Entrance.sbr" + -@erase "$(INTDIR)\IMP Personality Finish.obj" + -@erase "$(INTDIR)\IMP Personality Finish.sbr" + -@erase "$(INTDIR)\IMP Personality Quiz.obj" + -@erase "$(INTDIR)\IMP Personality Quiz.sbr" + -@erase "$(INTDIR)\IMP Portraits.obj" + -@erase "$(INTDIR)\IMP Portraits.sbr" + -@erase "$(INTDIR)\IMP Text System.obj" + -@erase "$(INTDIR)\IMP Text System.sbr" + -@erase "$(INTDIR)\IMP Voices.obj" + -@erase "$(INTDIR)\IMP Voices.sbr" + -@erase "$(INTDIR)\IMPVideoObjects.obj" + -@erase "$(INTDIR)\IMPVideoObjects.sbr" + -@erase "$(INTDIR)\insurance Comments.obj" + -@erase "$(INTDIR)\insurance Comments.sbr" + -@erase "$(INTDIR)\insurance Contract.obj" + -@erase "$(INTDIR)\insurance Contract.sbr" + -@erase "$(INTDIR)\insurance Info.obj" + -@erase "$(INTDIR)\insurance Info.sbr" + -@erase "$(INTDIR)\insurance.obj" + -@erase "$(INTDIR)\insurance.sbr" + -@erase "$(INTDIR)\laptop.obj" + -@erase "$(INTDIR)\laptop.sbr" + -@erase "$(INTDIR)\mercs Account.obj" + -@erase "$(INTDIR)\mercs Account.sbr" + -@erase "$(INTDIR)\mercs Files.obj" + -@erase "$(INTDIR)\mercs Files.sbr" + -@erase "$(INTDIR)\mercs No Account.obj" + -@erase "$(INTDIR)\mercs No Account.sbr" + -@erase "$(INTDIR)\mercs.obj" + -@erase "$(INTDIR)\mercs.sbr" + -@erase "$(INTDIR)\personnel.obj" + -@erase "$(INTDIR)\personnel.sbr" + -@erase "$(INTDIR)\sirtech.obj" + -@erase "$(INTDIR)\sirtech.sbr" + -@erase "$(INTDIR)\Store Inventory.obj" + -@erase "$(INTDIR)\Store Inventory.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Laptop.bsc" + -@erase "$(OUTDIR)\Laptop.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /GX /Z7 /Od /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I ".\\" /D "PRECOMPILEDHEADERS" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Laptop.bsc" +BSC32_SBRS= \ + "$(INTDIR)\aim.sbr" \ + "$(INTDIR)\AimArchives.sbr" \ + "$(INTDIR)\AimFacialIndex.sbr" \ + "$(INTDIR)\AimHistory.sbr" \ + "$(INTDIR)\AimLinks.sbr" \ + "$(INTDIR)\AimMembers.sbr" \ + "$(INTDIR)\AimPolicies.sbr" \ + "$(INTDIR)\AimSort.sbr" \ + "$(INTDIR)\BobbyR.sbr" \ + "$(INTDIR)\BobbyRAmmo.sbr" \ + "$(INTDIR)\BobbyRArmour.sbr" \ + "$(INTDIR)\BobbyRGuns.sbr" \ + "$(INTDIR)\BobbyRMailOrder.sbr" \ + "$(INTDIR)\BobbyRMisc.sbr" \ + "$(INTDIR)\BobbyRShipments.sbr" \ + "$(INTDIR)\BobbyRUsed.sbr" \ + "$(INTDIR)\BrokenLink.sbr" \ + "$(INTDIR)\CharProfile.sbr" \ + "$(INTDIR)\email.sbr" \ + "$(INTDIR)\files.sbr" \ + "$(INTDIR)\finances.sbr" \ + "$(INTDIR)\florist Cards.sbr" \ + "$(INTDIR)\florist Gallery.sbr" \ + "$(INTDIR)\florist Order Form.sbr" \ + "$(INTDIR)\florist.sbr" \ + "$(INTDIR)\funeral.sbr" \ + "$(INTDIR)\history.sbr" \ + "$(INTDIR)\IMP AboutUs.sbr" \ + "$(INTDIR)\IMP Attribute Entrance.sbr" \ + "$(INTDIR)\IMP Attribute Finish.sbr" \ + "$(INTDIR)\IMP Attribute Selection.sbr" \ + "$(INTDIR)\IMP Begin Screen.sbr" \ + "$(INTDIR)\IMP Compile Character.sbr" \ + "$(INTDIR)\IMP Confirm.sbr" \ + "$(INTDIR)\IMP Finish.sbr" \ + "$(INTDIR)\IMP HomePage.sbr" \ + "$(INTDIR)\IMP MainPage.sbr" \ + "$(INTDIR)\IMP Personality Entrance.sbr" \ + "$(INTDIR)\IMP Personality Finish.sbr" \ + "$(INTDIR)\IMP Personality Quiz.sbr" \ + "$(INTDIR)\IMP Portraits.sbr" \ + "$(INTDIR)\IMP Text System.sbr" \ + "$(INTDIR)\IMP Voices.sbr" \ + "$(INTDIR)\IMPVideoObjects.sbr" \ + "$(INTDIR)\insurance Comments.sbr" \ + "$(INTDIR)\insurance Contract.sbr" \ + "$(INTDIR)\insurance Info.sbr" \ + "$(INTDIR)\insurance.sbr" \ + "$(INTDIR)\laptop.sbr" \ + "$(INTDIR)\mercs Account.sbr" \ + "$(INTDIR)\mercs Files.sbr" \ + "$(INTDIR)\mercs No Account.sbr" \ + "$(INTDIR)\mercs.sbr" \ + "$(INTDIR)\personnel.sbr" \ + "$(INTDIR)\sirtech.sbr" \ + "$(INTDIR)\Store Inventory.sbr" + +"$(OUTDIR)\Laptop.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Laptop.lib" +LIB32_OBJS= \ + "$(INTDIR)\aim.obj" \ + "$(INTDIR)\AimArchives.obj" \ + "$(INTDIR)\AimFacialIndex.obj" \ + "$(INTDIR)\AimHistory.obj" \ + "$(INTDIR)\AimLinks.obj" \ + "$(INTDIR)\AimMembers.obj" \ + "$(INTDIR)\AimPolicies.obj" \ + "$(INTDIR)\AimSort.obj" \ + "$(INTDIR)\BobbyR.obj" \ + "$(INTDIR)\BobbyRAmmo.obj" \ + "$(INTDIR)\BobbyRArmour.obj" \ + "$(INTDIR)\BobbyRGuns.obj" \ + "$(INTDIR)\BobbyRMailOrder.obj" \ + "$(INTDIR)\BobbyRMisc.obj" \ + "$(INTDIR)\BobbyRShipments.obj" \ + "$(INTDIR)\BobbyRUsed.obj" \ + "$(INTDIR)\BrokenLink.obj" \ + "$(INTDIR)\CharProfile.obj" \ + "$(INTDIR)\email.obj" \ + "$(INTDIR)\files.obj" \ + "$(INTDIR)\finances.obj" \ + "$(INTDIR)\florist Cards.obj" \ + "$(INTDIR)\florist Gallery.obj" \ + "$(INTDIR)\florist Order Form.obj" \ + "$(INTDIR)\florist.obj" \ + "$(INTDIR)\funeral.obj" \ + "$(INTDIR)\history.obj" \ + "$(INTDIR)\IMP AboutUs.obj" \ + "$(INTDIR)\IMP Attribute Entrance.obj" \ + "$(INTDIR)\IMP Attribute Finish.obj" \ + "$(INTDIR)\IMP Attribute Selection.obj" \ + "$(INTDIR)\IMP Begin Screen.obj" \ + "$(INTDIR)\IMP Compile Character.obj" \ + "$(INTDIR)\IMP Confirm.obj" \ + "$(INTDIR)\IMP Finish.obj" \ + "$(INTDIR)\IMP HomePage.obj" \ + "$(INTDIR)\IMP MainPage.obj" \ + "$(INTDIR)\IMP Personality Entrance.obj" \ + "$(INTDIR)\IMP Personality Finish.obj" \ + "$(INTDIR)\IMP Personality Quiz.obj" \ + "$(INTDIR)\IMP Portraits.obj" \ + "$(INTDIR)\IMP Text System.obj" \ + "$(INTDIR)\IMP Voices.obj" \ + "$(INTDIR)\IMPVideoObjects.obj" \ + "$(INTDIR)\insurance Comments.obj" \ + "$(INTDIR)\insurance Contract.obj" \ + "$(INTDIR)\insurance Info.obj" \ + "$(INTDIR)\insurance.obj" \ + "$(INTDIR)\laptop.obj" \ + "$(INTDIR)\mercs Account.obj" \ + "$(INTDIR)\mercs Files.obj" \ + "$(INTDIR)\mercs No Account.obj" \ + "$(INTDIR)\mercs.obj" \ + "$(INTDIR)\personnel.obj" \ + "$(INTDIR)\sirtech.obj" \ + "$(INTDIR)\Store Inventory.obj" + +"$(OUTDIR)\Laptop.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Laptop - Win32 Release with Debug Info" + +OUTDIR=.\Release with Debug +INTDIR=.\Release with Debug +# Begin Custom Macros +OutDir=.\Release with Debug +# End Custom Macros + +ALL : "$(OUTDIR)\Laptop.lib" "$(OUTDIR)\Laptop.bsc" + + +CLEAN : + -@erase "$(INTDIR)\aim.obj" + -@erase "$(INTDIR)\aim.sbr" + -@erase "$(INTDIR)\AimArchives.obj" + -@erase "$(INTDIR)\AimArchives.sbr" + -@erase "$(INTDIR)\AimFacialIndex.obj" + -@erase "$(INTDIR)\AimFacialIndex.sbr" + -@erase "$(INTDIR)\AimHistory.obj" + -@erase "$(INTDIR)\AimHistory.sbr" + -@erase "$(INTDIR)\AimLinks.obj" + -@erase "$(INTDIR)\AimLinks.sbr" + -@erase "$(INTDIR)\AimMembers.obj" + -@erase "$(INTDIR)\AimMembers.sbr" + -@erase "$(INTDIR)\AimPolicies.obj" + -@erase "$(INTDIR)\AimPolicies.sbr" + -@erase "$(INTDIR)\AimSort.obj" + -@erase "$(INTDIR)\AimSort.sbr" + -@erase "$(INTDIR)\BobbyR.obj" + -@erase "$(INTDIR)\BobbyR.sbr" + -@erase "$(INTDIR)\BobbyRAmmo.obj" + -@erase "$(INTDIR)\BobbyRAmmo.sbr" + -@erase "$(INTDIR)\BobbyRArmour.obj" + -@erase "$(INTDIR)\BobbyRArmour.sbr" + -@erase "$(INTDIR)\BobbyRGuns.obj" + -@erase "$(INTDIR)\BobbyRGuns.sbr" + -@erase "$(INTDIR)\BobbyRMailOrder.obj" + -@erase "$(INTDIR)\BobbyRMailOrder.sbr" + -@erase "$(INTDIR)\BobbyRMisc.obj" + -@erase "$(INTDIR)\BobbyRMisc.sbr" + -@erase "$(INTDIR)\BobbyRShipments.obj" + -@erase "$(INTDIR)\BobbyRShipments.sbr" + -@erase "$(INTDIR)\BobbyRUsed.obj" + -@erase "$(INTDIR)\BobbyRUsed.sbr" + -@erase "$(INTDIR)\BrokenLink.obj" + -@erase "$(INTDIR)\BrokenLink.sbr" + -@erase "$(INTDIR)\CharProfile.obj" + -@erase "$(INTDIR)\CharProfile.sbr" + -@erase "$(INTDIR)\email.obj" + -@erase "$(INTDIR)\email.sbr" + -@erase "$(INTDIR)\files.obj" + -@erase "$(INTDIR)\files.sbr" + -@erase "$(INTDIR)\finances.obj" + -@erase "$(INTDIR)\finances.sbr" + -@erase "$(INTDIR)\florist Cards.obj" + -@erase "$(INTDIR)\florist Cards.sbr" + -@erase "$(INTDIR)\florist Gallery.obj" + -@erase "$(INTDIR)\florist Gallery.sbr" + -@erase "$(INTDIR)\florist Order Form.obj" + -@erase "$(INTDIR)\florist Order Form.sbr" + -@erase "$(INTDIR)\florist.obj" + -@erase "$(INTDIR)\florist.sbr" + -@erase "$(INTDIR)\funeral.obj" + -@erase "$(INTDIR)\funeral.sbr" + -@erase "$(INTDIR)\history.obj" + -@erase "$(INTDIR)\history.sbr" + -@erase "$(INTDIR)\IMP AboutUs.obj" + -@erase "$(INTDIR)\IMP AboutUs.sbr" + -@erase "$(INTDIR)\IMP Attribute Entrance.obj" + -@erase "$(INTDIR)\IMP Attribute Entrance.sbr" + -@erase "$(INTDIR)\IMP Attribute Finish.obj" + -@erase "$(INTDIR)\IMP Attribute Finish.sbr" + -@erase "$(INTDIR)\IMP Attribute Selection.obj" + -@erase "$(INTDIR)\IMP Attribute Selection.sbr" + -@erase "$(INTDIR)\IMP Begin Screen.obj" + -@erase "$(INTDIR)\IMP Begin Screen.sbr" + -@erase "$(INTDIR)\IMP Compile Character.obj" + -@erase "$(INTDIR)\IMP Compile Character.sbr" + -@erase "$(INTDIR)\IMP Confirm.obj" + -@erase "$(INTDIR)\IMP Confirm.sbr" + -@erase "$(INTDIR)\IMP Finish.obj" + -@erase "$(INTDIR)\IMP Finish.sbr" + -@erase "$(INTDIR)\IMP HomePage.obj" + -@erase "$(INTDIR)\IMP HomePage.sbr" + -@erase "$(INTDIR)\IMP MainPage.obj" + -@erase "$(INTDIR)\IMP MainPage.sbr" + -@erase "$(INTDIR)\IMP Personality Entrance.obj" + -@erase "$(INTDIR)\IMP Personality Entrance.sbr" + -@erase "$(INTDIR)\IMP Personality Finish.obj" + -@erase "$(INTDIR)\IMP Personality Finish.sbr" + -@erase "$(INTDIR)\IMP Personality Quiz.obj" + -@erase "$(INTDIR)\IMP Personality Quiz.sbr" + -@erase "$(INTDIR)\IMP Portraits.obj" + -@erase "$(INTDIR)\IMP Portraits.sbr" + -@erase "$(INTDIR)\IMP Text System.obj" + -@erase "$(INTDIR)\IMP Text System.sbr" + -@erase "$(INTDIR)\IMP Voices.obj" + -@erase "$(INTDIR)\IMP Voices.sbr" + -@erase "$(INTDIR)\IMPVideoObjects.obj" + -@erase "$(INTDIR)\IMPVideoObjects.sbr" + -@erase "$(INTDIR)\insurance Comments.obj" + -@erase "$(INTDIR)\insurance Comments.sbr" + -@erase "$(INTDIR)\insurance Contract.obj" + -@erase "$(INTDIR)\insurance Contract.sbr" + -@erase "$(INTDIR)\insurance Info.obj" + -@erase "$(INTDIR)\insurance Info.sbr" + -@erase "$(INTDIR)\insurance.obj" + -@erase "$(INTDIR)\insurance.sbr" + -@erase "$(INTDIR)\laptop.obj" + -@erase "$(INTDIR)\laptop.sbr" + -@erase "$(INTDIR)\mercs Account.obj" + -@erase "$(INTDIR)\mercs Account.sbr" + -@erase "$(INTDIR)\mercs Files.obj" + -@erase "$(INTDIR)\mercs Files.sbr" + -@erase "$(INTDIR)\mercs No Account.obj" + -@erase "$(INTDIR)\mercs No Account.sbr" + -@erase "$(INTDIR)\mercs.obj" + -@erase "$(INTDIR)\mercs.sbr" + -@erase "$(INTDIR)\personnel.obj" + -@erase "$(INTDIR)\personnel.sbr" + -@erase "$(INTDIR)\sirtech.obj" + -@erase "$(INTDIR)\sirtech.sbr" + -@erase "$(INTDIR)\Store Inventory.obj" + -@erase "$(INTDIR)\Store Inventory.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\Laptop.bsc" + -@erase "$(OUTDIR)\Laptop.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MT /W4 /GX /Zi /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\TileEngine" /I "..\Utils" /I "..\TacticalAI" /I "..\Editor" /I "..\Tactical" /I "..\strategic" /I ".\\" /D "NDEBUG" /D "RELEASE_WITH_DEBUG_INFO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Laptop.bsc" +BSC32_SBRS= \ + "$(INTDIR)\aim.sbr" \ + "$(INTDIR)\AimArchives.sbr" \ + "$(INTDIR)\AimFacialIndex.sbr" \ + "$(INTDIR)\AimHistory.sbr" \ + "$(INTDIR)\AimLinks.sbr" \ + "$(INTDIR)\AimMembers.sbr" \ + "$(INTDIR)\AimPolicies.sbr" \ + "$(INTDIR)\AimSort.sbr" \ + "$(INTDIR)\BobbyR.sbr" \ + "$(INTDIR)\BobbyRAmmo.sbr" \ + "$(INTDIR)\BobbyRArmour.sbr" \ + "$(INTDIR)\BobbyRGuns.sbr" \ + "$(INTDIR)\BobbyRMailOrder.sbr" \ + "$(INTDIR)\BobbyRMisc.sbr" \ + "$(INTDIR)\BobbyRShipments.sbr" \ + "$(INTDIR)\BobbyRUsed.sbr" \ + "$(INTDIR)\BrokenLink.sbr" \ + "$(INTDIR)\CharProfile.sbr" \ + "$(INTDIR)\email.sbr" \ + "$(INTDIR)\files.sbr" \ + "$(INTDIR)\finances.sbr" \ + "$(INTDIR)\florist Cards.sbr" \ + "$(INTDIR)\florist Gallery.sbr" \ + "$(INTDIR)\florist Order Form.sbr" \ + "$(INTDIR)\florist.sbr" \ + "$(INTDIR)\funeral.sbr" \ + "$(INTDIR)\history.sbr" \ + "$(INTDIR)\IMP AboutUs.sbr" \ + "$(INTDIR)\IMP Attribute Entrance.sbr" \ + "$(INTDIR)\IMP Attribute Finish.sbr" \ + "$(INTDIR)\IMP Attribute Selection.sbr" \ + "$(INTDIR)\IMP Begin Screen.sbr" \ + "$(INTDIR)\IMP Compile Character.sbr" \ + "$(INTDIR)\IMP Confirm.sbr" \ + "$(INTDIR)\IMP Finish.sbr" \ + "$(INTDIR)\IMP HomePage.sbr" \ + "$(INTDIR)\IMP MainPage.sbr" \ + "$(INTDIR)\IMP Personality Entrance.sbr" \ + "$(INTDIR)\IMP Personality Finish.sbr" \ + "$(INTDIR)\IMP Personality Quiz.sbr" \ + "$(INTDIR)\IMP Portraits.sbr" \ + "$(INTDIR)\IMP Text System.sbr" \ + "$(INTDIR)\IMP Voices.sbr" \ + "$(INTDIR)\IMPVideoObjects.sbr" \ + "$(INTDIR)\insurance Comments.sbr" \ + "$(INTDIR)\insurance Contract.sbr" \ + "$(INTDIR)\insurance Info.sbr" \ + "$(INTDIR)\insurance.sbr" \ + "$(INTDIR)\laptop.sbr" \ + "$(INTDIR)\mercs Account.sbr" \ + "$(INTDIR)\mercs Files.sbr" \ + "$(INTDIR)\mercs No Account.sbr" \ + "$(INTDIR)\mercs.sbr" \ + "$(INTDIR)\personnel.sbr" \ + "$(INTDIR)\sirtech.sbr" \ + "$(INTDIR)\Store Inventory.sbr" + +"$(OUTDIR)\Laptop.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Laptop.lib" +LIB32_OBJS= \ + "$(INTDIR)\aim.obj" \ + "$(INTDIR)\AimArchives.obj" \ + "$(INTDIR)\AimFacialIndex.obj" \ + "$(INTDIR)\AimHistory.obj" \ + "$(INTDIR)\AimLinks.obj" \ + "$(INTDIR)\AimMembers.obj" \ + "$(INTDIR)\AimPolicies.obj" \ + "$(INTDIR)\AimSort.obj" \ + "$(INTDIR)\BobbyR.obj" \ + "$(INTDIR)\BobbyRAmmo.obj" \ + "$(INTDIR)\BobbyRArmour.obj" \ + "$(INTDIR)\BobbyRGuns.obj" \ + "$(INTDIR)\BobbyRMailOrder.obj" \ + "$(INTDIR)\BobbyRMisc.obj" \ + "$(INTDIR)\BobbyRShipments.obj" \ + "$(INTDIR)\BobbyRUsed.obj" \ + "$(INTDIR)\BrokenLink.obj" \ + "$(INTDIR)\CharProfile.obj" \ + "$(INTDIR)\email.obj" \ + "$(INTDIR)\files.obj" \ + "$(INTDIR)\finances.obj" \ + "$(INTDIR)\florist Cards.obj" \ + "$(INTDIR)\florist Gallery.obj" \ + "$(INTDIR)\florist Order Form.obj" \ + "$(INTDIR)\florist.obj" \ + "$(INTDIR)\funeral.obj" \ + "$(INTDIR)\history.obj" \ + "$(INTDIR)\IMP AboutUs.obj" \ + "$(INTDIR)\IMP Attribute Entrance.obj" \ + "$(INTDIR)\IMP Attribute Finish.obj" \ + "$(INTDIR)\IMP Attribute Selection.obj" \ + "$(INTDIR)\IMP Begin Screen.obj" \ + "$(INTDIR)\IMP Compile Character.obj" \ + "$(INTDIR)\IMP Confirm.obj" \ + "$(INTDIR)\IMP Finish.obj" \ + "$(INTDIR)\IMP HomePage.obj" \ + "$(INTDIR)\IMP MainPage.obj" \ + "$(INTDIR)\IMP Personality Entrance.obj" \ + "$(INTDIR)\IMP Personality Finish.obj" \ + "$(INTDIR)\IMP Personality Quiz.obj" \ + "$(INTDIR)\IMP Portraits.obj" \ + "$(INTDIR)\IMP Text System.obj" \ + "$(INTDIR)\IMP Voices.obj" \ + "$(INTDIR)\IMPVideoObjects.obj" \ + "$(INTDIR)\insurance Comments.obj" \ + "$(INTDIR)\insurance Contract.obj" \ + "$(INTDIR)\insurance Info.obj" \ + "$(INTDIR)\insurance.obj" \ + "$(INTDIR)\laptop.obj" \ + "$(INTDIR)\mercs Account.obj" \ + "$(INTDIR)\mercs Files.obj" \ + "$(INTDIR)\mercs No Account.obj" \ + "$(INTDIR)\mercs.obj" \ + "$(INTDIR)\personnel.obj" \ + "$(INTDIR)\sirtech.obj" \ + "$(INTDIR)\Store Inventory.obj" + +"$(OUTDIR)\Laptop.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Laptop - Win32 Bounds Checker" + +OUTDIR=.\Bounds Checker +INTDIR=.\Bounds Checker +# Begin Custom Macros +OutDir=.\Bounds Checker +# End Custom Macros + +ALL : "$(OUTDIR)\Laptop.lib" "$(OUTDIR)\Laptop.bsc" + + +CLEAN : + -@erase "$(INTDIR)\aim.obj" + -@erase "$(INTDIR)\aim.sbr" + -@erase "$(INTDIR)\AimArchives.obj" + -@erase "$(INTDIR)\AimArchives.sbr" + -@erase "$(INTDIR)\AimFacialIndex.obj" + -@erase "$(INTDIR)\AimFacialIndex.sbr" + -@erase "$(INTDIR)\AimHistory.obj" + -@erase "$(INTDIR)\AimHistory.sbr" + -@erase "$(INTDIR)\AimLinks.obj" + -@erase "$(INTDIR)\AimLinks.sbr" + -@erase "$(INTDIR)\AimMembers.obj" + -@erase "$(INTDIR)\AimMembers.sbr" + -@erase "$(INTDIR)\AimPolicies.obj" + -@erase "$(INTDIR)\AimPolicies.sbr" + -@erase "$(INTDIR)\AimSort.obj" + -@erase "$(INTDIR)\AimSort.sbr" + -@erase "$(INTDIR)\BobbyR.obj" + -@erase "$(INTDIR)\BobbyR.sbr" + -@erase "$(INTDIR)\BobbyRAmmo.obj" + -@erase "$(INTDIR)\BobbyRAmmo.sbr" + -@erase "$(INTDIR)\BobbyRArmour.obj" + -@erase "$(INTDIR)\BobbyRArmour.sbr" + -@erase "$(INTDIR)\BobbyRGuns.obj" + -@erase "$(INTDIR)\BobbyRGuns.sbr" + -@erase "$(INTDIR)\BobbyRMailOrder.obj" + -@erase "$(INTDIR)\BobbyRMailOrder.sbr" + -@erase "$(INTDIR)\BobbyRMisc.obj" + -@erase "$(INTDIR)\BobbyRMisc.sbr" + -@erase "$(INTDIR)\BobbyRShipments.obj" + -@erase "$(INTDIR)\BobbyRShipments.sbr" + -@erase "$(INTDIR)\BobbyRUsed.obj" + -@erase "$(INTDIR)\BobbyRUsed.sbr" + -@erase "$(INTDIR)\BrokenLink.obj" + -@erase "$(INTDIR)\BrokenLink.sbr" + -@erase "$(INTDIR)\CharProfile.obj" + -@erase "$(INTDIR)\CharProfile.sbr" + -@erase "$(INTDIR)\email.obj" + -@erase "$(INTDIR)\email.sbr" + -@erase "$(INTDIR)\files.obj" + -@erase "$(INTDIR)\files.sbr" + -@erase "$(INTDIR)\finances.obj" + -@erase "$(INTDIR)\finances.sbr" + -@erase "$(INTDIR)\florist Cards.obj" + -@erase "$(INTDIR)\florist Cards.sbr" + -@erase "$(INTDIR)\florist Gallery.obj" + -@erase "$(INTDIR)\florist Gallery.sbr" + -@erase "$(INTDIR)\florist Order Form.obj" + -@erase "$(INTDIR)\florist Order Form.sbr" + -@erase "$(INTDIR)\florist.obj" + -@erase "$(INTDIR)\florist.sbr" + -@erase "$(INTDIR)\funeral.obj" + -@erase "$(INTDIR)\funeral.sbr" + -@erase "$(INTDIR)\history.obj" + -@erase "$(INTDIR)\history.sbr" + -@erase "$(INTDIR)\IMP AboutUs.obj" + -@erase "$(INTDIR)\IMP AboutUs.sbr" + -@erase "$(INTDIR)\IMP Attribute Entrance.obj" + -@erase "$(INTDIR)\IMP Attribute Entrance.sbr" + -@erase "$(INTDIR)\IMP Attribute Finish.obj" + -@erase "$(INTDIR)\IMP Attribute Finish.sbr" + -@erase "$(INTDIR)\IMP Attribute Selection.obj" + -@erase "$(INTDIR)\IMP Attribute Selection.sbr" + -@erase "$(INTDIR)\IMP Begin Screen.obj" + -@erase "$(INTDIR)\IMP Begin Screen.sbr" + -@erase "$(INTDIR)\IMP Compile Character.obj" + -@erase "$(INTDIR)\IMP Compile Character.sbr" + -@erase "$(INTDIR)\IMP Confirm.obj" + -@erase "$(INTDIR)\IMP Confirm.sbr" + -@erase "$(INTDIR)\IMP Finish.obj" + -@erase "$(INTDIR)\IMP Finish.sbr" + -@erase "$(INTDIR)\IMP HomePage.obj" + -@erase "$(INTDIR)\IMP HomePage.sbr" + -@erase "$(INTDIR)\IMP MainPage.obj" + -@erase "$(INTDIR)\IMP MainPage.sbr" + -@erase "$(INTDIR)\IMP Personality Entrance.obj" + -@erase "$(INTDIR)\IMP Personality Entrance.sbr" + -@erase "$(INTDIR)\IMP Personality Finish.obj" + -@erase "$(INTDIR)\IMP Personality Finish.sbr" + -@erase "$(INTDIR)\IMP Personality Quiz.obj" + -@erase "$(INTDIR)\IMP Personality Quiz.sbr" + -@erase "$(INTDIR)\IMP Portraits.obj" + -@erase "$(INTDIR)\IMP Portraits.sbr" + -@erase "$(INTDIR)\IMP Text System.obj" + -@erase "$(INTDIR)\IMP Text System.sbr" + -@erase "$(INTDIR)\IMP Voices.obj" + -@erase "$(INTDIR)\IMP Voices.sbr" + -@erase "$(INTDIR)\IMPVideoObjects.obj" + -@erase "$(INTDIR)\IMPVideoObjects.sbr" + -@erase "$(INTDIR)\insurance Comments.obj" + -@erase "$(INTDIR)\insurance Comments.sbr" + -@erase "$(INTDIR)\insurance Contract.obj" + -@erase "$(INTDIR)\insurance Contract.sbr" + -@erase "$(INTDIR)\insurance Info.obj" + -@erase "$(INTDIR)\insurance Info.sbr" + -@erase "$(INTDIR)\insurance.obj" + -@erase "$(INTDIR)\insurance.sbr" + -@erase "$(INTDIR)\laptop.obj" + -@erase "$(INTDIR)\laptop.sbr" + -@erase "$(INTDIR)\mercs Account.obj" + -@erase "$(INTDIR)\mercs Account.sbr" + -@erase "$(INTDIR)\mercs Files.obj" + -@erase "$(INTDIR)\mercs Files.sbr" + -@erase "$(INTDIR)\mercs No Account.obj" + -@erase "$(INTDIR)\mercs No Account.sbr" + -@erase "$(INTDIR)\mercs.obj" + -@erase "$(INTDIR)\mercs.sbr" + -@erase "$(INTDIR)\personnel.obj" + -@erase "$(INTDIR)\personnel.sbr" + -@erase "$(INTDIR)\sirtech.obj" + -@erase "$(INTDIR)\sirtech.sbr" + -@erase "$(INTDIR)\Store Inventory.obj" + -@erase "$(INTDIR)\Store Inventory.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Laptop.bsc" + -@erase "$(OUTDIR)\Laptop.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Laptop.bsc" +BSC32_SBRS= \ + "$(INTDIR)\aim.sbr" \ + "$(INTDIR)\AimArchives.sbr" \ + "$(INTDIR)\AimFacialIndex.sbr" \ + "$(INTDIR)\AimHistory.sbr" \ + "$(INTDIR)\AimLinks.sbr" \ + "$(INTDIR)\AimMembers.sbr" \ + "$(INTDIR)\AimPolicies.sbr" \ + "$(INTDIR)\AimSort.sbr" \ + "$(INTDIR)\BobbyR.sbr" \ + "$(INTDIR)\BobbyRAmmo.sbr" \ + "$(INTDIR)\BobbyRArmour.sbr" \ + "$(INTDIR)\BobbyRGuns.sbr" \ + "$(INTDIR)\BobbyRMailOrder.sbr" \ + "$(INTDIR)\BobbyRMisc.sbr" \ + "$(INTDIR)\BobbyRShipments.sbr" \ + "$(INTDIR)\BobbyRUsed.sbr" \ + "$(INTDIR)\BrokenLink.sbr" \ + "$(INTDIR)\CharProfile.sbr" \ + "$(INTDIR)\email.sbr" \ + "$(INTDIR)\files.sbr" \ + "$(INTDIR)\finances.sbr" \ + "$(INTDIR)\florist Cards.sbr" \ + "$(INTDIR)\florist Gallery.sbr" \ + "$(INTDIR)\florist Order Form.sbr" \ + "$(INTDIR)\florist.sbr" \ + "$(INTDIR)\funeral.sbr" \ + "$(INTDIR)\history.sbr" \ + "$(INTDIR)\IMP AboutUs.sbr" \ + "$(INTDIR)\IMP Attribute Entrance.sbr" \ + "$(INTDIR)\IMP Attribute Finish.sbr" \ + "$(INTDIR)\IMP Attribute Selection.sbr" \ + "$(INTDIR)\IMP Begin Screen.sbr" \ + "$(INTDIR)\IMP Compile Character.sbr" \ + "$(INTDIR)\IMP Confirm.sbr" \ + "$(INTDIR)\IMP Finish.sbr" \ + "$(INTDIR)\IMP HomePage.sbr" \ + "$(INTDIR)\IMP MainPage.sbr" \ + "$(INTDIR)\IMP Personality Entrance.sbr" \ + "$(INTDIR)\IMP Personality Finish.sbr" \ + "$(INTDIR)\IMP Personality Quiz.sbr" \ + "$(INTDIR)\IMP Portraits.sbr" \ + "$(INTDIR)\IMP Text System.sbr" \ + "$(INTDIR)\IMP Voices.sbr" \ + "$(INTDIR)\IMPVideoObjects.sbr" \ + "$(INTDIR)\insurance Comments.sbr" \ + "$(INTDIR)\insurance Contract.sbr" \ + "$(INTDIR)\insurance Info.sbr" \ + "$(INTDIR)\insurance.sbr" \ + "$(INTDIR)\laptop.sbr" \ + "$(INTDIR)\mercs Account.sbr" \ + "$(INTDIR)\mercs Files.sbr" \ + "$(INTDIR)\mercs No Account.sbr" \ + "$(INTDIR)\mercs.sbr" \ + "$(INTDIR)\personnel.sbr" \ + "$(INTDIR)\sirtech.sbr" \ + "$(INTDIR)\Store Inventory.sbr" + +"$(OUTDIR)\Laptop.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Laptop.lib" +LIB32_OBJS= \ + "$(INTDIR)\aim.obj" \ + "$(INTDIR)\AimArchives.obj" \ + "$(INTDIR)\AimFacialIndex.obj" \ + "$(INTDIR)\AimHistory.obj" \ + "$(INTDIR)\AimLinks.obj" \ + "$(INTDIR)\AimMembers.obj" \ + "$(INTDIR)\AimPolicies.obj" \ + "$(INTDIR)\AimSort.obj" \ + "$(INTDIR)\BobbyR.obj" \ + "$(INTDIR)\BobbyRAmmo.obj" \ + "$(INTDIR)\BobbyRArmour.obj" \ + "$(INTDIR)\BobbyRGuns.obj" \ + "$(INTDIR)\BobbyRMailOrder.obj" \ + "$(INTDIR)\BobbyRMisc.obj" \ + "$(INTDIR)\BobbyRShipments.obj" \ + "$(INTDIR)\BobbyRUsed.obj" \ + "$(INTDIR)\BrokenLink.obj" \ + "$(INTDIR)\CharProfile.obj" \ + "$(INTDIR)\email.obj" \ + "$(INTDIR)\files.obj" \ + "$(INTDIR)\finances.obj" \ + "$(INTDIR)\florist Cards.obj" \ + "$(INTDIR)\florist Gallery.obj" \ + "$(INTDIR)\florist Order Form.obj" \ + "$(INTDIR)\florist.obj" \ + "$(INTDIR)\funeral.obj" \ + "$(INTDIR)\history.obj" \ + "$(INTDIR)\IMP AboutUs.obj" \ + "$(INTDIR)\IMP Attribute Entrance.obj" \ + "$(INTDIR)\IMP Attribute Finish.obj" \ + "$(INTDIR)\IMP Attribute Selection.obj" \ + "$(INTDIR)\IMP Begin Screen.obj" \ + "$(INTDIR)\IMP Compile Character.obj" \ + "$(INTDIR)\IMP Confirm.obj" \ + "$(INTDIR)\IMP Finish.obj" \ + "$(INTDIR)\IMP HomePage.obj" \ + "$(INTDIR)\IMP MainPage.obj" \ + "$(INTDIR)\IMP Personality Entrance.obj" \ + "$(INTDIR)\IMP Personality Finish.obj" \ + "$(INTDIR)\IMP Personality Quiz.obj" \ + "$(INTDIR)\IMP Portraits.obj" \ + "$(INTDIR)\IMP Text System.obj" \ + "$(INTDIR)\IMP Voices.obj" \ + "$(INTDIR)\IMPVideoObjects.obj" \ + "$(INTDIR)\insurance Comments.obj" \ + "$(INTDIR)\insurance Contract.obj" \ + "$(INTDIR)\insurance Info.obj" \ + "$(INTDIR)\insurance.obj" \ + "$(INTDIR)\laptop.obj" \ + "$(INTDIR)\mercs Account.obj" \ + "$(INTDIR)\mercs Files.obj" \ + "$(INTDIR)\mercs No Account.obj" \ + "$(INTDIR)\mercs.obj" \ + "$(INTDIR)\personnel.obj" \ + "$(INTDIR)\sirtech.obj" \ + "$(INTDIR)\Store Inventory.obj" + +"$(OUTDIR)\Laptop.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Laptop - Win32 Debug Demo" + +OUTDIR=.\Debug Demo +INTDIR=.\Debug Demo +# Begin Custom Macros +OutDir=.\Debug Demo +# End Custom Macros + +ALL : "$(OUTDIR)\Laptop.lib" "$(OUTDIR)\Laptop.bsc" + + +CLEAN : + -@erase "$(INTDIR)\aim.obj" + -@erase "$(INTDIR)\aim.sbr" + -@erase "$(INTDIR)\AimArchives.obj" + -@erase "$(INTDIR)\AimArchives.sbr" + -@erase "$(INTDIR)\AimFacialIndex.obj" + -@erase "$(INTDIR)\AimFacialIndex.sbr" + -@erase "$(INTDIR)\AimHistory.obj" + -@erase "$(INTDIR)\AimHistory.sbr" + -@erase "$(INTDIR)\AimLinks.obj" + -@erase "$(INTDIR)\AimLinks.sbr" + -@erase "$(INTDIR)\AimMembers.obj" + -@erase "$(INTDIR)\AimMembers.sbr" + -@erase "$(INTDIR)\AimPolicies.obj" + -@erase "$(INTDIR)\AimPolicies.sbr" + -@erase "$(INTDIR)\AimSort.obj" + -@erase "$(INTDIR)\AimSort.sbr" + -@erase "$(INTDIR)\BobbyR.obj" + -@erase "$(INTDIR)\BobbyR.sbr" + -@erase "$(INTDIR)\BobbyRAmmo.obj" + -@erase "$(INTDIR)\BobbyRAmmo.sbr" + -@erase "$(INTDIR)\BobbyRArmour.obj" + -@erase "$(INTDIR)\BobbyRArmour.sbr" + -@erase "$(INTDIR)\BobbyRGuns.obj" + -@erase "$(INTDIR)\BobbyRGuns.sbr" + -@erase "$(INTDIR)\BobbyRMailOrder.obj" + -@erase "$(INTDIR)\BobbyRMailOrder.sbr" + -@erase "$(INTDIR)\BobbyRMisc.obj" + -@erase "$(INTDIR)\BobbyRMisc.sbr" + -@erase "$(INTDIR)\BobbyRShipments.obj" + -@erase "$(INTDIR)\BobbyRShipments.sbr" + -@erase "$(INTDIR)\BobbyRUsed.obj" + -@erase "$(INTDIR)\BobbyRUsed.sbr" + -@erase "$(INTDIR)\BrokenLink.obj" + -@erase "$(INTDIR)\BrokenLink.sbr" + -@erase "$(INTDIR)\CharProfile.obj" + -@erase "$(INTDIR)\CharProfile.sbr" + -@erase "$(INTDIR)\email.obj" + -@erase "$(INTDIR)\email.sbr" + -@erase "$(INTDIR)\files.obj" + -@erase "$(INTDIR)\files.sbr" + -@erase "$(INTDIR)\finances.obj" + -@erase "$(INTDIR)\finances.sbr" + -@erase "$(INTDIR)\florist Cards.obj" + -@erase "$(INTDIR)\florist Cards.sbr" + -@erase "$(INTDIR)\florist Gallery.obj" + -@erase "$(INTDIR)\florist Gallery.sbr" + -@erase "$(INTDIR)\florist Order Form.obj" + -@erase "$(INTDIR)\florist Order Form.sbr" + -@erase "$(INTDIR)\florist.obj" + -@erase "$(INTDIR)\florist.sbr" + -@erase "$(INTDIR)\funeral.obj" + -@erase "$(INTDIR)\funeral.sbr" + -@erase "$(INTDIR)\history.obj" + -@erase "$(INTDIR)\history.sbr" + -@erase "$(INTDIR)\IMP AboutUs.obj" + -@erase "$(INTDIR)\IMP AboutUs.sbr" + -@erase "$(INTDIR)\IMP Attribute Entrance.obj" + -@erase "$(INTDIR)\IMP Attribute Entrance.sbr" + -@erase "$(INTDIR)\IMP Attribute Finish.obj" + -@erase "$(INTDIR)\IMP Attribute Finish.sbr" + -@erase "$(INTDIR)\IMP Attribute Selection.obj" + -@erase "$(INTDIR)\IMP Attribute Selection.sbr" + -@erase "$(INTDIR)\IMP Begin Screen.obj" + -@erase "$(INTDIR)\IMP Begin Screen.sbr" + -@erase "$(INTDIR)\IMP Compile Character.obj" + -@erase "$(INTDIR)\IMP Compile Character.sbr" + -@erase "$(INTDIR)\IMP Confirm.obj" + -@erase "$(INTDIR)\IMP Confirm.sbr" + -@erase "$(INTDIR)\IMP Finish.obj" + -@erase "$(INTDIR)\IMP Finish.sbr" + -@erase "$(INTDIR)\IMP HomePage.obj" + -@erase "$(INTDIR)\IMP HomePage.sbr" + -@erase "$(INTDIR)\IMP MainPage.obj" + -@erase "$(INTDIR)\IMP MainPage.sbr" + -@erase "$(INTDIR)\IMP Personality Entrance.obj" + -@erase "$(INTDIR)\IMP Personality Entrance.sbr" + -@erase "$(INTDIR)\IMP Personality Finish.obj" + -@erase "$(INTDIR)\IMP Personality Finish.sbr" + -@erase "$(INTDIR)\IMP Personality Quiz.obj" + -@erase "$(INTDIR)\IMP Personality Quiz.sbr" + -@erase "$(INTDIR)\IMP Portraits.obj" + -@erase "$(INTDIR)\IMP Portraits.sbr" + -@erase "$(INTDIR)\IMP Text System.obj" + -@erase "$(INTDIR)\IMP Text System.sbr" + -@erase "$(INTDIR)\IMP Voices.obj" + -@erase "$(INTDIR)\IMP Voices.sbr" + -@erase "$(INTDIR)\IMPVideoObjects.obj" + -@erase "$(INTDIR)\IMPVideoObjects.sbr" + -@erase "$(INTDIR)\insurance Comments.obj" + -@erase "$(INTDIR)\insurance Comments.sbr" + -@erase "$(INTDIR)\insurance Contract.obj" + -@erase "$(INTDIR)\insurance Contract.sbr" + -@erase "$(INTDIR)\insurance Info.obj" + -@erase "$(INTDIR)\insurance Info.sbr" + -@erase "$(INTDIR)\insurance.obj" + -@erase "$(INTDIR)\insurance.sbr" + -@erase "$(INTDIR)\laptop.obj" + -@erase "$(INTDIR)\laptop.sbr" + -@erase "$(INTDIR)\mercs Account.obj" + -@erase "$(INTDIR)\mercs Account.sbr" + -@erase "$(INTDIR)\mercs Files.obj" + -@erase "$(INTDIR)\mercs Files.sbr" + -@erase "$(INTDIR)\mercs No Account.obj" + -@erase "$(INTDIR)\mercs No Account.sbr" + -@erase "$(INTDIR)\mercs.obj" + -@erase "$(INTDIR)\mercs.sbr" + -@erase "$(INTDIR)\personnel.obj" + -@erase "$(INTDIR)\personnel.sbr" + -@erase "$(INTDIR)\sirtech.obj" + -@erase "$(INTDIR)\sirtech.sbr" + -@erase "$(INTDIR)\Store Inventory.obj" + -@erase "$(INTDIR)\Store Inventory.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Laptop.bsc" + -@erase "$(OUTDIR)\Laptop.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Laptop.bsc" +BSC32_SBRS= \ + "$(INTDIR)\aim.sbr" \ + "$(INTDIR)\AimArchives.sbr" \ + "$(INTDIR)\AimFacialIndex.sbr" \ + "$(INTDIR)\AimHistory.sbr" \ + "$(INTDIR)\AimLinks.sbr" \ + "$(INTDIR)\AimMembers.sbr" \ + "$(INTDIR)\AimPolicies.sbr" \ + "$(INTDIR)\AimSort.sbr" \ + "$(INTDIR)\BobbyR.sbr" \ + "$(INTDIR)\BobbyRAmmo.sbr" \ + "$(INTDIR)\BobbyRArmour.sbr" \ + "$(INTDIR)\BobbyRGuns.sbr" \ + "$(INTDIR)\BobbyRMailOrder.sbr" \ + "$(INTDIR)\BobbyRMisc.sbr" \ + "$(INTDIR)\BobbyRShipments.sbr" \ + "$(INTDIR)\BobbyRUsed.sbr" \ + "$(INTDIR)\BrokenLink.sbr" \ + "$(INTDIR)\CharProfile.sbr" \ + "$(INTDIR)\email.sbr" \ + "$(INTDIR)\files.sbr" \ + "$(INTDIR)\finances.sbr" \ + "$(INTDIR)\florist Cards.sbr" \ + "$(INTDIR)\florist Gallery.sbr" \ + "$(INTDIR)\florist Order Form.sbr" \ + "$(INTDIR)\florist.sbr" \ + "$(INTDIR)\funeral.sbr" \ + "$(INTDIR)\history.sbr" \ + "$(INTDIR)\IMP AboutUs.sbr" \ + "$(INTDIR)\IMP Attribute Entrance.sbr" \ + "$(INTDIR)\IMP Attribute Finish.sbr" \ + "$(INTDIR)\IMP Attribute Selection.sbr" \ + "$(INTDIR)\IMP Begin Screen.sbr" \ + "$(INTDIR)\IMP Compile Character.sbr" \ + "$(INTDIR)\IMP Confirm.sbr" \ + "$(INTDIR)\IMP Finish.sbr" \ + "$(INTDIR)\IMP HomePage.sbr" \ + "$(INTDIR)\IMP MainPage.sbr" \ + "$(INTDIR)\IMP Personality Entrance.sbr" \ + "$(INTDIR)\IMP Personality Finish.sbr" \ + "$(INTDIR)\IMP Personality Quiz.sbr" \ + "$(INTDIR)\IMP Portraits.sbr" \ + "$(INTDIR)\IMP Text System.sbr" \ + "$(INTDIR)\IMP Voices.sbr" \ + "$(INTDIR)\IMPVideoObjects.sbr" \ + "$(INTDIR)\insurance Comments.sbr" \ + "$(INTDIR)\insurance Contract.sbr" \ + "$(INTDIR)\insurance Info.sbr" \ + "$(INTDIR)\insurance.sbr" \ + "$(INTDIR)\laptop.sbr" \ + "$(INTDIR)\mercs Account.sbr" \ + "$(INTDIR)\mercs Files.sbr" \ + "$(INTDIR)\mercs No Account.sbr" \ + "$(INTDIR)\mercs.sbr" \ + "$(INTDIR)\personnel.sbr" \ + "$(INTDIR)\sirtech.sbr" \ + "$(INTDIR)\Store Inventory.sbr" + +"$(OUTDIR)\Laptop.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Laptop.lib" +LIB32_OBJS= \ + "$(INTDIR)\aim.obj" \ + "$(INTDIR)\AimArchives.obj" \ + "$(INTDIR)\AimFacialIndex.obj" \ + "$(INTDIR)\AimHistory.obj" \ + "$(INTDIR)\AimLinks.obj" \ + "$(INTDIR)\AimMembers.obj" \ + "$(INTDIR)\AimPolicies.obj" \ + "$(INTDIR)\AimSort.obj" \ + "$(INTDIR)\BobbyR.obj" \ + "$(INTDIR)\BobbyRAmmo.obj" \ + "$(INTDIR)\BobbyRArmour.obj" \ + "$(INTDIR)\BobbyRGuns.obj" \ + "$(INTDIR)\BobbyRMailOrder.obj" \ + "$(INTDIR)\BobbyRMisc.obj" \ + "$(INTDIR)\BobbyRShipments.obj" \ + "$(INTDIR)\BobbyRUsed.obj" \ + "$(INTDIR)\BrokenLink.obj" \ + "$(INTDIR)\CharProfile.obj" \ + "$(INTDIR)\email.obj" \ + "$(INTDIR)\files.obj" \ + "$(INTDIR)\finances.obj" \ + "$(INTDIR)\florist Cards.obj" \ + "$(INTDIR)\florist Gallery.obj" \ + "$(INTDIR)\florist Order Form.obj" \ + "$(INTDIR)\florist.obj" \ + "$(INTDIR)\funeral.obj" \ + "$(INTDIR)\history.obj" \ + "$(INTDIR)\IMP AboutUs.obj" \ + "$(INTDIR)\IMP Attribute Entrance.obj" \ + "$(INTDIR)\IMP Attribute Finish.obj" \ + "$(INTDIR)\IMP Attribute Selection.obj" \ + "$(INTDIR)\IMP Begin Screen.obj" \ + "$(INTDIR)\IMP Compile Character.obj" \ + "$(INTDIR)\IMP Confirm.obj" \ + "$(INTDIR)\IMP Finish.obj" \ + "$(INTDIR)\IMP HomePage.obj" \ + "$(INTDIR)\IMP MainPage.obj" \ + "$(INTDIR)\IMP Personality Entrance.obj" \ + "$(INTDIR)\IMP Personality Finish.obj" \ + "$(INTDIR)\IMP Personality Quiz.obj" \ + "$(INTDIR)\IMP Portraits.obj" \ + "$(INTDIR)\IMP Text System.obj" \ + "$(INTDIR)\IMP Voices.obj" \ + "$(INTDIR)\IMPVideoObjects.obj" \ + "$(INTDIR)\insurance Comments.obj" \ + "$(INTDIR)\insurance Contract.obj" \ + "$(INTDIR)\insurance Info.obj" \ + "$(INTDIR)\insurance.obj" \ + "$(INTDIR)\laptop.obj" \ + "$(INTDIR)\mercs Account.obj" \ + "$(INTDIR)\mercs Files.obj" \ + "$(INTDIR)\mercs No Account.obj" \ + "$(INTDIR)\mercs.obj" \ + "$(INTDIR)\personnel.obj" \ + "$(INTDIR)\sirtech.obj" \ + "$(INTDIR)\Store Inventory.obj" + +"$(OUTDIR)\Laptop.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Laptop - Win32 Release Demo" + +OUTDIR=.\Release Demo +INTDIR=.\Release Demo +# Begin Custom Macros +OutDir=.\Release Demo +# End Custom Macros + +ALL : "$(OUTDIR)\Laptop.lib" "$(OUTDIR)\Laptop.bsc" + + +CLEAN : + -@erase "$(INTDIR)\aim.obj" + -@erase "$(INTDIR)\aim.sbr" + -@erase "$(INTDIR)\AimArchives.obj" + -@erase "$(INTDIR)\AimArchives.sbr" + -@erase "$(INTDIR)\AimFacialIndex.obj" + -@erase "$(INTDIR)\AimFacialIndex.sbr" + -@erase "$(INTDIR)\AimHistory.obj" + -@erase "$(INTDIR)\AimHistory.sbr" + -@erase "$(INTDIR)\AimLinks.obj" + -@erase "$(INTDIR)\AimLinks.sbr" + -@erase "$(INTDIR)\AimMembers.obj" + -@erase "$(INTDIR)\AimMembers.sbr" + -@erase "$(INTDIR)\AimPolicies.obj" + -@erase "$(INTDIR)\AimPolicies.sbr" + -@erase "$(INTDIR)\AimSort.obj" + -@erase "$(INTDIR)\AimSort.sbr" + -@erase "$(INTDIR)\BobbyR.obj" + -@erase "$(INTDIR)\BobbyR.sbr" + -@erase "$(INTDIR)\BobbyRAmmo.obj" + -@erase "$(INTDIR)\BobbyRAmmo.sbr" + -@erase "$(INTDIR)\BobbyRArmour.obj" + -@erase "$(INTDIR)\BobbyRArmour.sbr" + -@erase "$(INTDIR)\BobbyRGuns.obj" + -@erase "$(INTDIR)\BobbyRGuns.sbr" + -@erase "$(INTDIR)\BobbyRMailOrder.obj" + -@erase "$(INTDIR)\BobbyRMailOrder.sbr" + -@erase "$(INTDIR)\BobbyRMisc.obj" + -@erase "$(INTDIR)\BobbyRMisc.sbr" + -@erase "$(INTDIR)\BobbyRShipments.obj" + -@erase "$(INTDIR)\BobbyRShipments.sbr" + -@erase "$(INTDIR)\BobbyRUsed.obj" + -@erase "$(INTDIR)\BobbyRUsed.sbr" + -@erase "$(INTDIR)\BrokenLink.obj" + -@erase "$(INTDIR)\BrokenLink.sbr" + -@erase "$(INTDIR)\CharProfile.obj" + -@erase "$(INTDIR)\CharProfile.sbr" + -@erase "$(INTDIR)\email.obj" + -@erase "$(INTDIR)\email.sbr" + -@erase "$(INTDIR)\files.obj" + -@erase "$(INTDIR)\files.sbr" + -@erase "$(INTDIR)\finances.obj" + -@erase "$(INTDIR)\finances.sbr" + -@erase "$(INTDIR)\florist Cards.obj" + -@erase "$(INTDIR)\florist Cards.sbr" + -@erase "$(INTDIR)\florist Gallery.obj" + -@erase "$(INTDIR)\florist Gallery.sbr" + -@erase "$(INTDIR)\florist Order Form.obj" + -@erase "$(INTDIR)\florist Order Form.sbr" + -@erase "$(INTDIR)\florist.obj" + -@erase "$(INTDIR)\florist.sbr" + -@erase "$(INTDIR)\funeral.obj" + -@erase "$(INTDIR)\funeral.sbr" + -@erase "$(INTDIR)\history.obj" + -@erase "$(INTDIR)\history.sbr" + -@erase "$(INTDIR)\IMP AboutUs.obj" + -@erase "$(INTDIR)\IMP AboutUs.sbr" + -@erase "$(INTDIR)\IMP Attribute Entrance.obj" + -@erase "$(INTDIR)\IMP Attribute Entrance.sbr" + -@erase "$(INTDIR)\IMP Attribute Finish.obj" + -@erase "$(INTDIR)\IMP Attribute Finish.sbr" + -@erase "$(INTDIR)\IMP Attribute Selection.obj" + -@erase "$(INTDIR)\IMP Attribute Selection.sbr" + -@erase "$(INTDIR)\IMP Begin Screen.obj" + -@erase "$(INTDIR)\IMP Begin Screen.sbr" + -@erase "$(INTDIR)\IMP Compile Character.obj" + -@erase "$(INTDIR)\IMP Compile Character.sbr" + -@erase "$(INTDIR)\IMP Confirm.obj" + -@erase "$(INTDIR)\IMP Confirm.sbr" + -@erase "$(INTDIR)\IMP Finish.obj" + -@erase "$(INTDIR)\IMP Finish.sbr" + -@erase "$(INTDIR)\IMP HomePage.obj" + -@erase "$(INTDIR)\IMP HomePage.sbr" + -@erase "$(INTDIR)\IMP MainPage.obj" + -@erase "$(INTDIR)\IMP MainPage.sbr" + -@erase "$(INTDIR)\IMP Personality Entrance.obj" + -@erase "$(INTDIR)\IMP Personality Entrance.sbr" + -@erase "$(INTDIR)\IMP Personality Finish.obj" + -@erase "$(INTDIR)\IMP Personality Finish.sbr" + -@erase "$(INTDIR)\IMP Personality Quiz.obj" + -@erase "$(INTDIR)\IMP Personality Quiz.sbr" + -@erase "$(INTDIR)\IMP Portraits.obj" + -@erase "$(INTDIR)\IMP Portraits.sbr" + -@erase "$(INTDIR)\IMP Text System.obj" + -@erase "$(INTDIR)\IMP Text System.sbr" + -@erase "$(INTDIR)\IMP Voices.obj" + -@erase "$(INTDIR)\IMP Voices.sbr" + -@erase "$(INTDIR)\IMPVideoObjects.obj" + -@erase "$(INTDIR)\IMPVideoObjects.sbr" + -@erase "$(INTDIR)\insurance Comments.obj" + -@erase "$(INTDIR)\insurance Comments.sbr" + -@erase "$(INTDIR)\insurance Contract.obj" + -@erase "$(INTDIR)\insurance Contract.sbr" + -@erase "$(INTDIR)\insurance Info.obj" + -@erase "$(INTDIR)\insurance Info.sbr" + -@erase "$(INTDIR)\insurance.obj" + -@erase "$(INTDIR)\insurance.sbr" + -@erase "$(INTDIR)\laptop.obj" + -@erase "$(INTDIR)\laptop.sbr" + -@erase "$(INTDIR)\mercs Account.obj" + -@erase "$(INTDIR)\mercs Account.sbr" + -@erase "$(INTDIR)\mercs Files.obj" + -@erase "$(INTDIR)\mercs Files.sbr" + -@erase "$(INTDIR)\mercs No Account.obj" + -@erase "$(INTDIR)\mercs No Account.sbr" + -@erase "$(INTDIR)\mercs.obj" + -@erase "$(INTDIR)\mercs.sbr" + -@erase "$(INTDIR)\personnel.obj" + -@erase "$(INTDIR)\personnel.sbr" + -@erase "$(INTDIR)\sirtech.obj" + -@erase "$(INTDIR)\sirtech.sbr" + -@erase "$(INTDIR)\Store Inventory.obj" + -@erase "$(INTDIR)\Store Inventory.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\Laptop.bsc" + -@erase "$(OUTDIR)\Laptop.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Laptop.bsc" +BSC32_SBRS= \ + "$(INTDIR)\aim.sbr" \ + "$(INTDIR)\AimArchives.sbr" \ + "$(INTDIR)\AimFacialIndex.sbr" \ + "$(INTDIR)\AimHistory.sbr" \ + "$(INTDIR)\AimLinks.sbr" \ + "$(INTDIR)\AimMembers.sbr" \ + "$(INTDIR)\AimPolicies.sbr" \ + "$(INTDIR)\AimSort.sbr" \ + "$(INTDIR)\BobbyR.sbr" \ + "$(INTDIR)\BobbyRAmmo.sbr" \ + "$(INTDIR)\BobbyRArmour.sbr" \ + "$(INTDIR)\BobbyRGuns.sbr" \ + "$(INTDIR)\BobbyRMailOrder.sbr" \ + "$(INTDIR)\BobbyRMisc.sbr" \ + "$(INTDIR)\BobbyRShipments.sbr" \ + "$(INTDIR)\BobbyRUsed.sbr" \ + "$(INTDIR)\BrokenLink.sbr" \ + "$(INTDIR)\CharProfile.sbr" \ + "$(INTDIR)\email.sbr" \ + "$(INTDIR)\files.sbr" \ + "$(INTDIR)\finances.sbr" \ + "$(INTDIR)\florist Cards.sbr" \ + "$(INTDIR)\florist Gallery.sbr" \ + "$(INTDIR)\florist Order Form.sbr" \ + "$(INTDIR)\florist.sbr" \ + "$(INTDIR)\funeral.sbr" \ + "$(INTDIR)\history.sbr" \ + "$(INTDIR)\IMP AboutUs.sbr" \ + "$(INTDIR)\IMP Attribute Entrance.sbr" \ + "$(INTDIR)\IMP Attribute Finish.sbr" \ + "$(INTDIR)\IMP Attribute Selection.sbr" \ + "$(INTDIR)\IMP Begin Screen.sbr" \ + "$(INTDIR)\IMP Compile Character.sbr" \ + "$(INTDIR)\IMP Confirm.sbr" \ + "$(INTDIR)\IMP Finish.sbr" \ + "$(INTDIR)\IMP HomePage.sbr" \ + "$(INTDIR)\IMP MainPage.sbr" \ + "$(INTDIR)\IMP Personality Entrance.sbr" \ + "$(INTDIR)\IMP Personality Finish.sbr" \ + "$(INTDIR)\IMP Personality Quiz.sbr" \ + "$(INTDIR)\IMP Portraits.sbr" \ + "$(INTDIR)\IMP Text System.sbr" \ + "$(INTDIR)\IMP Voices.sbr" \ + "$(INTDIR)\IMPVideoObjects.sbr" \ + "$(INTDIR)\insurance Comments.sbr" \ + "$(INTDIR)\insurance Contract.sbr" \ + "$(INTDIR)\insurance Info.sbr" \ + "$(INTDIR)\insurance.sbr" \ + "$(INTDIR)\laptop.sbr" \ + "$(INTDIR)\mercs Account.sbr" \ + "$(INTDIR)\mercs Files.sbr" \ + "$(INTDIR)\mercs No Account.sbr" \ + "$(INTDIR)\mercs.sbr" \ + "$(INTDIR)\personnel.sbr" \ + "$(INTDIR)\sirtech.sbr" \ + "$(INTDIR)\Store Inventory.sbr" + +"$(OUTDIR)\Laptop.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Laptop.lib" +LIB32_OBJS= \ + "$(INTDIR)\aim.obj" \ + "$(INTDIR)\AimArchives.obj" \ + "$(INTDIR)\AimFacialIndex.obj" \ + "$(INTDIR)\AimHistory.obj" \ + "$(INTDIR)\AimLinks.obj" \ + "$(INTDIR)\AimMembers.obj" \ + "$(INTDIR)\AimPolicies.obj" \ + "$(INTDIR)\AimSort.obj" \ + "$(INTDIR)\BobbyR.obj" \ + "$(INTDIR)\BobbyRAmmo.obj" \ + "$(INTDIR)\BobbyRArmour.obj" \ + "$(INTDIR)\BobbyRGuns.obj" \ + "$(INTDIR)\BobbyRMailOrder.obj" \ + "$(INTDIR)\BobbyRMisc.obj" \ + "$(INTDIR)\BobbyRShipments.obj" \ + "$(INTDIR)\BobbyRUsed.obj" \ + "$(INTDIR)\BrokenLink.obj" \ + "$(INTDIR)\CharProfile.obj" \ + "$(INTDIR)\email.obj" \ + "$(INTDIR)\files.obj" \ + "$(INTDIR)\finances.obj" \ + "$(INTDIR)\florist Cards.obj" \ + "$(INTDIR)\florist Gallery.obj" \ + "$(INTDIR)\florist Order Form.obj" \ + "$(INTDIR)\florist.obj" \ + "$(INTDIR)\funeral.obj" \ + "$(INTDIR)\history.obj" \ + "$(INTDIR)\IMP AboutUs.obj" \ + "$(INTDIR)\IMP Attribute Entrance.obj" \ + "$(INTDIR)\IMP Attribute Finish.obj" \ + "$(INTDIR)\IMP Attribute Selection.obj" \ + "$(INTDIR)\IMP Begin Screen.obj" \ + "$(INTDIR)\IMP Compile Character.obj" \ + "$(INTDIR)\IMP Confirm.obj" \ + "$(INTDIR)\IMP Finish.obj" \ + "$(INTDIR)\IMP HomePage.obj" \ + "$(INTDIR)\IMP MainPage.obj" \ + "$(INTDIR)\IMP Personality Entrance.obj" \ + "$(INTDIR)\IMP Personality Finish.obj" \ + "$(INTDIR)\IMP Personality Quiz.obj" \ + "$(INTDIR)\IMP Portraits.obj" \ + "$(INTDIR)\IMP Text System.obj" \ + "$(INTDIR)\IMP Voices.obj" \ + "$(INTDIR)\IMPVideoObjects.obj" \ + "$(INTDIR)\insurance Comments.obj" \ + "$(INTDIR)\insurance Contract.obj" \ + "$(INTDIR)\insurance Info.obj" \ + "$(INTDIR)\insurance.obj" \ + "$(INTDIR)\laptop.obj" \ + "$(INTDIR)\mercs Account.obj" \ + "$(INTDIR)\mercs Files.obj" \ + "$(INTDIR)\mercs No Account.obj" \ + "$(INTDIR)\mercs.obj" \ + "$(INTDIR)\personnel.obj" \ + "$(INTDIR)\sirtech.obj" \ + "$(INTDIR)\Store Inventory.obj" + +"$(OUTDIR)\Laptop.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Laptop - Win32 Demo Release with Debug Info" + +OUTDIR=.\Demo Release with Debug +INTDIR=.\Demo Release with Debug +# Begin Custom Macros +OutDir=.\Demo Release with Debug +# End Custom Macros + +ALL : "$(OUTDIR)\Laptop.lib" "$(OUTDIR)\Laptop.bsc" + + +CLEAN : + -@erase "$(INTDIR)\aim.obj" + -@erase "$(INTDIR)\aim.sbr" + -@erase "$(INTDIR)\AimArchives.obj" + -@erase "$(INTDIR)\AimArchives.sbr" + -@erase "$(INTDIR)\AimFacialIndex.obj" + -@erase "$(INTDIR)\AimFacialIndex.sbr" + -@erase "$(INTDIR)\AimHistory.obj" + -@erase "$(INTDIR)\AimHistory.sbr" + -@erase "$(INTDIR)\AimLinks.obj" + -@erase "$(INTDIR)\AimLinks.sbr" + -@erase "$(INTDIR)\AimMembers.obj" + -@erase "$(INTDIR)\AimMembers.sbr" + -@erase "$(INTDIR)\AimPolicies.obj" + -@erase "$(INTDIR)\AimPolicies.sbr" + -@erase "$(INTDIR)\AimSort.obj" + -@erase "$(INTDIR)\AimSort.sbr" + -@erase "$(INTDIR)\BobbyR.obj" + -@erase "$(INTDIR)\BobbyR.sbr" + -@erase "$(INTDIR)\BobbyRAmmo.obj" + -@erase "$(INTDIR)\BobbyRAmmo.sbr" + -@erase "$(INTDIR)\BobbyRArmour.obj" + -@erase "$(INTDIR)\BobbyRArmour.sbr" + -@erase "$(INTDIR)\BobbyRGuns.obj" + -@erase "$(INTDIR)\BobbyRGuns.sbr" + -@erase "$(INTDIR)\BobbyRMailOrder.obj" + -@erase "$(INTDIR)\BobbyRMailOrder.sbr" + -@erase "$(INTDIR)\BobbyRMisc.obj" + -@erase "$(INTDIR)\BobbyRMisc.sbr" + -@erase "$(INTDIR)\BobbyRShipments.obj" + -@erase "$(INTDIR)\BobbyRShipments.sbr" + -@erase "$(INTDIR)\BobbyRUsed.obj" + -@erase "$(INTDIR)\BobbyRUsed.sbr" + -@erase "$(INTDIR)\BrokenLink.obj" + -@erase "$(INTDIR)\BrokenLink.sbr" + -@erase "$(INTDIR)\CharProfile.obj" + -@erase "$(INTDIR)\CharProfile.sbr" + -@erase "$(INTDIR)\email.obj" + -@erase "$(INTDIR)\email.sbr" + -@erase "$(INTDIR)\files.obj" + -@erase "$(INTDIR)\files.sbr" + -@erase "$(INTDIR)\finances.obj" + -@erase "$(INTDIR)\finances.sbr" + -@erase "$(INTDIR)\florist Cards.obj" + -@erase "$(INTDIR)\florist Cards.sbr" + -@erase "$(INTDIR)\florist Gallery.obj" + -@erase "$(INTDIR)\florist Gallery.sbr" + -@erase "$(INTDIR)\florist Order Form.obj" + -@erase "$(INTDIR)\florist Order Form.sbr" + -@erase "$(INTDIR)\florist.obj" + -@erase "$(INTDIR)\florist.sbr" + -@erase "$(INTDIR)\funeral.obj" + -@erase "$(INTDIR)\funeral.sbr" + -@erase "$(INTDIR)\history.obj" + -@erase "$(INTDIR)\history.sbr" + -@erase "$(INTDIR)\IMP AboutUs.obj" + -@erase "$(INTDIR)\IMP AboutUs.sbr" + -@erase "$(INTDIR)\IMP Attribute Entrance.obj" + -@erase "$(INTDIR)\IMP Attribute Entrance.sbr" + -@erase "$(INTDIR)\IMP Attribute Finish.obj" + -@erase "$(INTDIR)\IMP Attribute Finish.sbr" + -@erase "$(INTDIR)\IMP Attribute Selection.obj" + -@erase "$(INTDIR)\IMP Attribute Selection.sbr" + -@erase "$(INTDIR)\IMP Begin Screen.obj" + -@erase "$(INTDIR)\IMP Begin Screen.sbr" + -@erase "$(INTDIR)\IMP Compile Character.obj" + -@erase "$(INTDIR)\IMP Compile Character.sbr" + -@erase "$(INTDIR)\IMP Confirm.obj" + -@erase "$(INTDIR)\IMP Confirm.sbr" + -@erase "$(INTDIR)\IMP Finish.obj" + -@erase "$(INTDIR)\IMP Finish.sbr" + -@erase "$(INTDIR)\IMP HomePage.obj" + -@erase "$(INTDIR)\IMP HomePage.sbr" + -@erase "$(INTDIR)\IMP MainPage.obj" + -@erase "$(INTDIR)\IMP MainPage.sbr" + -@erase "$(INTDIR)\IMP Personality Entrance.obj" + -@erase "$(INTDIR)\IMP Personality Entrance.sbr" + -@erase "$(INTDIR)\IMP Personality Finish.obj" + -@erase "$(INTDIR)\IMP Personality Finish.sbr" + -@erase "$(INTDIR)\IMP Personality Quiz.obj" + -@erase "$(INTDIR)\IMP Personality Quiz.sbr" + -@erase "$(INTDIR)\IMP Portraits.obj" + -@erase "$(INTDIR)\IMP Portraits.sbr" + -@erase "$(INTDIR)\IMP Text System.obj" + -@erase "$(INTDIR)\IMP Text System.sbr" + -@erase "$(INTDIR)\IMP Voices.obj" + -@erase "$(INTDIR)\IMP Voices.sbr" + -@erase "$(INTDIR)\IMPVideoObjects.obj" + -@erase "$(INTDIR)\IMPVideoObjects.sbr" + -@erase "$(INTDIR)\insurance Comments.obj" + -@erase "$(INTDIR)\insurance Comments.sbr" + -@erase "$(INTDIR)\insurance Contract.obj" + -@erase "$(INTDIR)\insurance Contract.sbr" + -@erase "$(INTDIR)\insurance Info.obj" + -@erase "$(INTDIR)\insurance Info.sbr" + -@erase "$(INTDIR)\insurance.obj" + -@erase "$(INTDIR)\insurance.sbr" + -@erase "$(INTDIR)\laptop.obj" + -@erase "$(INTDIR)\laptop.sbr" + -@erase "$(INTDIR)\mercs Account.obj" + -@erase "$(INTDIR)\mercs Account.sbr" + -@erase "$(INTDIR)\mercs Files.obj" + -@erase "$(INTDIR)\mercs Files.sbr" + -@erase "$(INTDIR)\mercs No Account.obj" + -@erase "$(INTDIR)\mercs No Account.sbr" + -@erase "$(INTDIR)\mercs.obj" + -@erase "$(INTDIR)\mercs.sbr" + -@erase "$(INTDIR)\personnel.obj" + -@erase "$(INTDIR)\personnel.sbr" + -@erase "$(INTDIR)\sirtech.obj" + -@erase "$(INTDIR)\sirtech.sbr" + -@erase "$(INTDIR)\Store Inventory.obj" + -@erase "$(INTDIR)\Store Inventory.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\Laptop.bsc" + -@erase "$(OUTDIR)\Laptop.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MT /W4 /GX /Zi /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\TileEngine" /I "..\Utils" /I "..\TacticalAI" /I "..\Editor" /I "..\Tactical" /I "..\strategic" /I ".\\" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Laptop.bsc" +BSC32_SBRS= \ + "$(INTDIR)\aim.sbr" \ + "$(INTDIR)\AimArchives.sbr" \ + "$(INTDIR)\AimFacialIndex.sbr" \ + "$(INTDIR)\AimHistory.sbr" \ + "$(INTDIR)\AimLinks.sbr" \ + "$(INTDIR)\AimMembers.sbr" \ + "$(INTDIR)\AimPolicies.sbr" \ + "$(INTDIR)\AimSort.sbr" \ + "$(INTDIR)\BobbyR.sbr" \ + "$(INTDIR)\BobbyRAmmo.sbr" \ + "$(INTDIR)\BobbyRArmour.sbr" \ + "$(INTDIR)\BobbyRGuns.sbr" \ + "$(INTDIR)\BobbyRMailOrder.sbr" \ + "$(INTDIR)\BobbyRMisc.sbr" \ + "$(INTDIR)\BobbyRShipments.sbr" \ + "$(INTDIR)\BobbyRUsed.sbr" \ + "$(INTDIR)\BrokenLink.sbr" \ + "$(INTDIR)\CharProfile.sbr" \ + "$(INTDIR)\email.sbr" \ + "$(INTDIR)\files.sbr" \ + "$(INTDIR)\finances.sbr" \ + "$(INTDIR)\florist Cards.sbr" \ + "$(INTDIR)\florist Gallery.sbr" \ + "$(INTDIR)\florist Order Form.sbr" \ + "$(INTDIR)\florist.sbr" \ + "$(INTDIR)\funeral.sbr" \ + "$(INTDIR)\history.sbr" \ + "$(INTDIR)\IMP AboutUs.sbr" \ + "$(INTDIR)\IMP Attribute Entrance.sbr" \ + "$(INTDIR)\IMP Attribute Finish.sbr" \ + "$(INTDIR)\IMP Attribute Selection.sbr" \ + "$(INTDIR)\IMP Begin Screen.sbr" \ + "$(INTDIR)\IMP Compile Character.sbr" \ + "$(INTDIR)\IMP Confirm.sbr" \ + "$(INTDIR)\IMP Finish.sbr" \ + "$(INTDIR)\IMP HomePage.sbr" \ + "$(INTDIR)\IMP MainPage.sbr" \ + "$(INTDIR)\IMP Personality Entrance.sbr" \ + "$(INTDIR)\IMP Personality Finish.sbr" \ + "$(INTDIR)\IMP Personality Quiz.sbr" \ + "$(INTDIR)\IMP Portraits.sbr" \ + "$(INTDIR)\IMP Text System.sbr" \ + "$(INTDIR)\IMP Voices.sbr" \ + "$(INTDIR)\IMPVideoObjects.sbr" \ + "$(INTDIR)\insurance Comments.sbr" \ + "$(INTDIR)\insurance Contract.sbr" \ + "$(INTDIR)\insurance Info.sbr" \ + "$(INTDIR)\insurance.sbr" \ + "$(INTDIR)\laptop.sbr" \ + "$(INTDIR)\mercs Account.sbr" \ + "$(INTDIR)\mercs Files.sbr" \ + "$(INTDIR)\mercs No Account.sbr" \ + "$(INTDIR)\mercs.sbr" \ + "$(INTDIR)\personnel.sbr" \ + "$(INTDIR)\sirtech.sbr" \ + "$(INTDIR)\Store Inventory.sbr" + +"$(OUTDIR)\Laptop.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Laptop.lib" +LIB32_OBJS= \ + "$(INTDIR)\aim.obj" \ + "$(INTDIR)\AimArchives.obj" \ + "$(INTDIR)\AimFacialIndex.obj" \ + "$(INTDIR)\AimHistory.obj" \ + "$(INTDIR)\AimLinks.obj" \ + "$(INTDIR)\AimMembers.obj" \ + "$(INTDIR)\AimPolicies.obj" \ + "$(INTDIR)\AimSort.obj" \ + "$(INTDIR)\BobbyR.obj" \ + "$(INTDIR)\BobbyRAmmo.obj" \ + "$(INTDIR)\BobbyRArmour.obj" \ + "$(INTDIR)\BobbyRGuns.obj" \ + "$(INTDIR)\BobbyRMailOrder.obj" \ + "$(INTDIR)\BobbyRMisc.obj" \ + "$(INTDIR)\BobbyRShipments.obj" \ + "$(INTDIR)\BobbyRUsed.obj" \ + "$(INTDIR)\BrokenLink.obj" \ + "$(INTDIR)\CharProfile.obj" \ + "$(INTDIR)\email.obj" \ + "$(INTDIR)\files.obj" \ + "$(INTDIR)\finances.obj" \ + "$(INTDIR)\florist Cards.obj" \ + "$(INTDIR)\florist Gallery.obj" \ + "$(INTDIR)\florist Order Form.obj" \ + "$(INTDIR)\florist.obj" \ + "$(INTDIR)\funeral.obj" \ + "$(INTDIR)\history.obj" \ + "$(INTDIR)\IMP AboutUs.obj" \ + "$(INTDIR)\IMP Attribute Entrance.obj" \ + "$(INTDIR)\IMP Attribute Finish.obj" \ + "$(INTDIR)\IMP Attribute Selection.obj" \ + "$(INTDIR)\IMP Begin Screen.obj" \ + "$(INTDIR)\IMP Compile Character.obj" \ + "$(INTDIR)\IMP Confirm.obj" \ + "$(INTDIR)\IMP Finish.obj" \ + "$(INTDIR)\IMP HomePage.obj" \ + "$(INTDIR)\IMP MainPage.obj" \ + "$(INTDIR)\IMP Personality Entrance.obj" \ + "$(INTDIR)\IMP Personality Finish.obj" \ + "$(INTDIR)\IMP Personality Quiz.obj" \ + "$(INTDIR)\IMP Portraits.obj" \ + "$(INTDIR)\IMP Text System.obj" \ + "$(INTDIR)\IMP Voices.obj" \ + "$(INTDIR)\IMPVideoObjects.obj" \ + "$(INTDIR)\insurance Comments.obj" \ + "$(INTDIR)\insurance Contract.obj" \ + "$(INTDIR)\insurance Info.obj" \ + "$(INTDIR)\insurance.obj" \ + "$(INTDIR)\laptop.obj" \ + "$(INTDIR)\mercs Account.obj" \ + "$(INTDIR)\mercs Files.obj" \ + "$(INTDIR)\mercs No Account.obj" \ + "$(INTDIR)\mercs.obj" \ + "$(INTDIR)\personnel.obj" \ + "$(INTDIR)\sirtech.obj" \ + "$(INTDIR)\Store Inventory.obj" + +"$(OUTDIR)\Laptop.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Laptop - Win32 Demo Bounds Checker" + +OUTDIR=.\Demo Bounds Checker +INTDIR=.\Demo Bounds Checker +# Begin Custom Macros +OutDir=.\Demo Bounds Checker +# End Custom Macros + +ALL : "$(OUTDIR)\Laptop.lib" "$(OUTDIR)\Laptop.bsc" + + +CLEAN : + -@erase "$(INTDIR)\aim.obj" + -@erase "$(INTDIR)\aim.sbr" + -@erase "$(INTDIR)\AimArchives.obj" + -@erase "$(INTDIR)\AimArchives.sbr" + -@erase "$(INTDIR)\AimFacialIndex.obj" + -@erase "$(INTDIR)\AimFacialIndex.sbr" + -@erase "$(INTDIR)\AimHistory.obj" + -@erase "$(INTDIR)\AimHistory.sbr" + -@erase "$(INTDIR)\AimLinks.obj" + -@erase "$(INTDIR)\AimLinks.sbr" + -@erase "$(INTDIR)\AimMembers.obj" + -@erase "$(INTDIR)\AimMembers.sbr" + -@erase "$(INTDIR)\AimPolicies.obj" + -@erase "$(INTDIR)\AimPolicies.sbr" + -@erase "$(INTDIR)\AimSort.obj" + -@erase "$(INTDIR)\AimSort.sbr" + -@erase "$(INTDIR)\BobbyR.obj" + -@erase "$(INTDIR)\BobbyR.sbr" + -@erase "$(INTDIR)\BobbyRAmmo.obj" + -@erase "$(INTDIR)\BobbyRAmmo.sbr" + -@erase "$(INTDIR)\BobbyRArmour.obj" + -@erase "$(INTDIR)\BobbyRArmour.sbr" + -@erase "$(INTDIR)\BobbyRGuns.obj" + -@erase "$(INTDIR)\BobbyRGuns.sbr" + -@erase "$(INTDIR)\BobbyRMailOrder.obj" + -@erase "$(INTDIR)\BobbyRMailOrder.sbr" + -@erase "$(INTDIR)\BobbyRMisc.obj" + -@erase "$(INTDIR)\BobbyRMisc.sbr" + -@erase "$(INTDIR)\BobbyRShipments.obj" + -@erase "$(INTDIR)\BobbyRShipments.sbr" + -@erase "$(INTDIR)\BobbyRUsed.obj" + -@erase "$(INTDIR)\BobbyRUsed.sbr" + -@erase "$(INTDIR)\BrokenLink.obj" + -@erase "$(INTDIR)\BrokenLink.sbr" + -@erase "$(INTDIR)\CharProfile.obj" + -@erase "$(INTDIR)\CharProfile.sbr" + -@erase "$(INTDIR)\email.obj" + -@erase "$(INTDIR)\email.sbr" + -@erase "$(INTDIR)\files.obj" + -@erase "$(INTDIR)\files.sbr" + -@erase "$(INTDIR)\finances.obj" + -@erase "$(INTDIR)\finances.sbr" + -@erase "$(INTDIR)\florist Cards.obj" + -@erase "$(INTDIR)\florist Cards.sbr" + -@erase "$(INTDIR)\florist Gallery.obj" + -@erase "$(INTDIR)\florist Gallery.sbr" + -@erase "$(INTDIR)\florist Order Form.obj" + -@erase "$(INTDIR)\florist Order Form.sbr" + -@erase "$(INTDIR)\florist.obj" + -@erase "$(INTDIR)\florist.sbr" + -@erase "$(INTDIR)\funeral.obj" + -@erase "$(INTDIR)\funeral.sbr" + -@erase "$(INTDIR)\history.obj" + -@erase "$(INTDIR)\history.sbr" + -@erase "$(INTDIR)\IMP AboutUs.obj" + -@erase "$(INTDIR)\IMP AboutUs.sbr" + -@erase "$(INTDIR)\IMP Attribute Entrance.obj" + -@erase "$(INTDIR)\IMP Attribute Entrance.sbr" + -@erase "$(INTDIR)\IMP Attribute Finish.obj" + -@erase "$(INTDIR)\IMP Attribute Finish.sbr" + -@erase "$(INTDIR)\IMP Attribute Selection.obj" + -@erase "$(INTDIR)\IMP Attribute Selection.sbr" + -@erase "$(INTDIR)\IMP Begin Screen.obj" + -@erase "$(INTDIR)\IMP Begin Screen.sbr" + -@erase "$(INTDIR)\IMP Compile Character.obj" + -@erase "$(INTDIR)\IMP Compile Character.sbr" + -@erase "$(INTDIR)\IMP Confirm.obj" + -@erase "$(INTDIR)\IMP Confirm.sbr" + -@erase "$(INTDIR)\IMP Finish.obj" + -@erase "$(INTDIR)\IMP Finish.sbr" + -@erase "$(INTDIR)\IMP HomePage.obj" + -@erase "$(INTDIR)\IMP HomePage.sbr" + -@erase "$(INTDIR)\IMP MainPage.obj" + -@erase "$(INTDIR)\IMP MainPage.sbr" + -@erase "$(INTDIR)\IMP Personality Entrance.obj" + -@erase "$(INTDIR)\IMP Personality Entrance.sbr" + -@erase "$(INTDIR)\IMP Personality Finish.obj" + -@erase "$(INTDIR)\IMP Personality Finish.sbr" + -@erase "$(INTDIR)\IMP Personality Quiz.obj" + -@erase "$(INTDIR)\IMP Personality Quiz.sbr" + -@erase "$(INTDIR)\IMP Portraits.obj" + -@erase "$(INTDIR)\IMP Portraits.sbr" + -@erase "$(INTDIR)\IMP Text System.obj" + -@erase "$(INTDIR)\IMP Text System.sbr" + -@erase "$(INTDIR)\IMP Voices.obj" + -@erase "$(INTDIR)\IMP Voices.sbr" + -@erase "$(INTDIR)\IMPVideoObjects.obj" + -@erase "$(INTDIR)\IMPVideoObjects.sbr" + -@erase "$(INTDIR)\insurance Comments.obj" + -@erase "$(INTDIR)\insurance Comments.sbr" + -@erase "$(INTDIR)\insurance Contract.obj" + -@erase "$(INTDIR)\insurance Contract.sbr" + -@erase "$(INTDIR)\insurance Info.obj" + -@erase "$(INTDIR)\insurance Info.sbr" + -@erase "$(INTDIR)\insurance.obj" + -@erase "$(INTDIR)\insurance.sbr" + -@erase "$(INTDIR)\laptop.obj" + -@erase "$(INTDIR)\laptop.sbr" + -@erase "$(INTDIR)\mercs Account.obj" + -@erase "$(INTDIR)\mercs Account.sbr" + -@erase "$(INTDIR)\mercs Files.obj" + -@erase "$(INTDIR)\mercs Files.sbr" + -@erase "$(INTDIR)\mercs No Account.obj" + -@erase "$(INTDIR)\mercs No Account.sbr" + -@erase "$(INTDIR)\mercs.obj" + -@erase "$(INTDIR)\mercs.sbr" + -@erase "$(INTDIR)\personnel.obj" + -@erase "$(INTDIR)\personnel.sbr" + -@erase "$(INTDIR)\sirtech.obj" + -@erase "$(INTDIR)\sirtech.sbr" + -@erase "$(INTDIR)\Store Inventory.obj" + -@erase "$(INTDIR)\Store Inventory.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(OUTDIR)\Laptop.bsc" + -@erase "$(OUTDIR)\Laptop.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\Laptop.bsc" +BSC32_SBRS= \ + "$(INTDIR)\aim.sbr" \ + "$(INTDIR)\AimArchives.sbr" \ + "$(INTDIR)\AimFacialIndex.sbr" \ + "$(INTDIR)\AimHistory.sbr" \ + "$(INTDIR)\AimLinks.sbr" \ + "$(INTDIR)\AimMembers.sbr" \ + "$(INTDIR)\AimPolicies.sbr" \ + "$(INTDIR)\AimSort.sbr" \ + "$(INTDIR)\BobbyR.sbr" \ + "$(INTDIR)\BobbyRAmmo.sbr" \ + "$(INTDIR)\BobbyRArmour.sbr" \ + "$(INTDIR)\BobbyRGuns.sbr" \ + "$(INTDIR)\BobbyRMailOrder.sbr" \ + "$(INTDIR)\BobbyRMisc.sbr" \ + "$(INTDIR)\BobbyRShipments.sbr" \ + "$(INTDIR)\BobbyRUsed.sbr" \ + "$(INTDIR)\BrokenLink.sbr" \ + "$(INTDIR)\CharProfile.sbr" \ + "$(INTDIR)\email.sbr" \ + "$(INTDIR)\files.sbr" \ + "$(INTDIR)\finances.sbr" \ + "$(INTDIR)\florist Cards.sbr" \ + "$(INTDIR)\florist Gallery.sbr" \ + "$(INTDIR)\florist Order Form.sbr" \ + "$(INTDIR)\florist.sbr" \ + "$(INTDIR)\funeral.sbr" \ + "$(INTDIR)\history.sbr" \ + "$(INTDIR)\IMP AboutUs.sbr" \ + "$(INTDIR)\IMP Attribute Entrance.sbr" \ + "$(INTDIR)\IMP Attribute Finish.sbr" \ + "$(INTDIR)\IMP Attribute Selection.sbr" \ + "$(INTDIR)\IMP Begin Screen.sbr" \ + "$(INTDIR)\IMP Compile Character.sbr" \ + "$(INTDIR)\IMP Confirm.sbr" \ + "$(INTDIR)\IMP Finish.sbr" \ + "$(INTDIR)\IMP HomePage.sbr" \ + "$(INTDIR)\IMP MainPage.sbr" \ + "$(INTDIR)\IMP Personality Entrance.sbr" \ + "$(INTDIR)\IMP Personality Finish.sbr" \ + "$(INTDIR)\IMP Personality Quiz.sbr" \ + "$(INTDIR)\IMP Portraits.sbr" \ + "$(INTDIR)\IMP Text System.sbr" \ + "$(INTDIR)\IMP Voices.sbr" \ + "$(INTDIR)\IMPVideoObjects.sbr" \ + "$(INTDIR)\insurance Comments.sbr" \ + "$(INTDIR)\insurance Contract.sbr" \ + "$(INTDIR)\insurance Info.sbr" \ + "$(INTDIR)\insurance.sbr" \ + "$(INTDIR)\laptop.sbr" \ + "$(INTDIR)\mercs Account.sbr" \ + "$(INTDIR)\mercs Files.sbr" \ + "$(INTDIR)\mercs No Account.sbr" \ + "$(INTDIR)\mercs.sbr" \ + "$(INTDIR)\personnel.sbr" \ + "$(INTDIR)\sirtech.sbr" \ + "$(INTDIR)\Store Inventory.sbr" + +"$(OUTDIR)\Laptop.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LIB32=link.exe -lib +LIB32_FLAGS=/nologo /out:"$(OUTDIR)\Laptop.lib" +LIB32_OBJS= \ + "$(INTDIR)\aim.obj" \ + "$(INTDIR)\AimArchives.obj" \ + "$(INTDIR)\AimFacialIndex.obj" \ + "$(INTDIR)\AimHistory.obj" \ + "$(INTDIR)\AimLinks.obj" \ + "$(INTDIR)\AimMembers.obj" \ + "$(INTDIR)\AimPolicies.obj" \ + "$(INTDIR)\AimSort.obj" \ + "$(INTDIR)\BobbyR.obj" \ + "$(INTDIR)\BobbyRAmmo.obj" \ + "$(INTDIR)\BobbyRArmour.obj" \ + "$(INTDIR)\BobbyRGuns.obj" \ + "$(INTDIR)\BobbyRMailOrder.obj" \ + "$(INTDIR)\BobbyRMisc.obj" \ + "$(INTDIR)\BobbyRShipments.obj" \ + "$(INTDIR)\BobbyRUsed.obj" \ + "$(INTDIR)\BrokenLink.obj" \ + "$(INTDIR)\CharProfile.obj" \ + "$(INTDIR)\email.obj" \ + "$(INTDIR)\files.obj" \ + "$(INTDIR)\finances.obj" \ + "$(INTDIR)\florist Cards.obj" \ + "$(INTDIR)\florist Gallery.obj" \ + "$(INTDIR)\florist Order Form.obj" \ + "$(INTDIR)\florist.obj" \ + "$(INTDIR)\funeral.obj" \ + "$(INTDIR)\history.obj" \ + "$(INTDIR)\IMP AboutUs.obj" \ + "$(INTDIR)\IMP Attribute Entrance.obj" \ + "$(INTDIR)\IMP Attribute Finish.obj" \ + "$(INTDIR)\IMP Attribute Selection.obj" \ + "$(INTDIR)\IMP Begin Screen.obj" \ + "$(INTDIR)\IMP Compile Character.obj" \ + "$(INTDIR)\IMP Confirm.obj" \ + "$(INTDIR)\IMP Finish.obj" \ + "$(INTDIR)\IMP HomePage.obj" \ + "$(INTDIR)\IMP MainPage.obj" \ + "$(INTDIR)\IMP Personality Entrance.obj" \ + "$(INTDIR)\IMP Personality Finish.obj" \ + "$(INTDIR)\IMP Personality Quiz.obj" \ + "$(INTDIR)\IMP Portraits.obj" \ + "$(INTDIR)\IMP Text System.obj" \ + "$(INTDIR)\IMP Voices.obj" \ + "$(INTDIR)\IMPVideoObjects.obj" \ + "$(INTDIR)\insurance Comments.obj" \ + "$(INTDIR)\insurance Contract.obj" \ + "$(INTDIR)\insurance Info.obj" \ + "$(INTDIR)\insurance.obj" \ + "$(INTDIR)\laptop.obj" \ + "$(INTDIR)\mercs Account.obj" \ + "$(INTDIR)\mercs Files.obj" \ + "$(INTDIR)\mercs No Account.obj" \ + "$(INTDIR)\mercs.obj" \ + "$(INTDIR)\personnel.obj" \ + "$(INTDIR)\sirtech.obj" \ + "$(INTDIR)\Store Inventory.obj" + +"$(OUTDIR)\Laptop.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("Laptop.dep") +!INCLUDE "Laptop.dep" +!ELSE +!MESSAGE Warning: cannot find "Laptop.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "Laptop - Win32 Release" || "$(CFG)" == "Laptop - Win32 Debug" || "$(CFG)" == "Laptop - Win32 Release with Debug Info" || "$(CFG)" == "Laptop - Win32 Bounds Checker" || "$(CFG)" == "Laptop - Win32 Debug Demo" || "$(CFG)" == "Laptop - Win32 Release Demo" || "$(CFG)" == "Laptop - Win32 Demo Release with Debug Info" || "$(CFG)" == "Laptop - Win32 Demo Bounds Checker" +SOURCE=.\aim.cpp + +"$(INTDIR)\aim.obj" "$(INTDIR)\aim.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\AimArchives.cpp + +"$(INTDIR)\AimArchives.obj" "$(INTDIR)\AimArchives.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\AimFacialIndex.cpp + +"$(INTDIR)\AimFacialIndex.obj" "$(INTDIR)\AimFacialIndex.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\AimHistory.cpp + +"$(INTDIR)\AimHistory.obj" "$(INTDIR)\AimHistory.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\AimLinks.cpp + +"$(INTDIR)\AimLinks.obj" "$(INTDIR)\AimLinks.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\AimMembers.cpp + +"$(INTDIR)\AimMembers.obj" "$(INTDIR)\AimMembers.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\AimPolicies.cpp + +"$(INTDIR)\AimPolicies.obj" "$(INTDIR)\AimPolicies.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\AimSort.cpp + +"$(INTDIR)\AimSort.obj" "$(INTDIR)\AimSort.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\BobbyR.cpp + +"$(INTDIR)\BobbyR.obj" "$(INTDIR)\BobbyR.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\BobbyRAmmo.cpp + +"$(INTDIR)\BobbyRAmmo.obj" "$(INTDIR)\BobbyRAmmo.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\BobbyRArmour.cpp + +"$(INTDIR)\BobbyRArmour.obj" "$(INTDIR)\BobbyRArmour.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\BobbyRGuns.cpp + +"$(INTDIR)\BobbyRGuns.obj" "$(INTDIR)\BobbyRGuns.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\BobbyRMailOrder.cpp + +"$(INTDIR)\BobbyRMailOrder.obj" "$(INTDIR)\BobbyRMailOrder.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\BobbyRMisc.cpp + +"$(INTDIR)\BobbyRMisc.obj" "$(INTDIR)\BobbyRMisc.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\BobbyRShipments.cpp + +"$(INTDIR)\BobbyRShipments.obj" "$(INTDIR)\BobbyRShipments.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\BobbyRUsed.cpp + +"$(INTDIR)\BobbyRUsed.obj" "$(INTDIR)\BobbyRUsed.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\BrokenLink.cpp + +"$(INTDIR)\BrokenLink.obj" "$(INTDIR)\BrokenLink.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\CharProfile.cpp + +"$(INTDIR)\CharProfile.obj" "$(INTDIR)\CharProfile.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\email.cpp + +"$(INTDIR)\email.obj" "$(INTDIR)\email.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\files.cpp + +"$(INTDIR)\files.obj" "$(INTDIR)\files.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\finances.cpp + +"$(INTDIR)\finances.obj" "$(INTDIR)\finances.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\florist Cards.cpp" + +"$(INTDIR)\florist Cards.obj" "$(INTDIR)\florist Cards.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\florist Gallery.cpp" + +"$(INTDIR)\florist Gallery.obj" "$(INTDIR)\florist Gallery.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\florist Order Form.cpp" + +"$(INTDIR)\florist Order Form.obj" "$(INTDIR)\florist Order Form.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\florist.cpp + +"$(INTDIR)\florist.obj" "$(INTDIR)\florist.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\funeral.cpp + +"$(INTDIR)\funeral.obj" "$(INTDIR)\funeral.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\history.cpp + +"$(INTDIR)\history.obj" "$(INTDIR)\history.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP AboutUs.cpp" + +"$(INTDIR)\IMP AboutUs.obj" "$(INTDIR)\IMP AboutUs.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Attribute Entrance.cpp" + +"$(INTDIR)\IMP Attribute Entrance.obj" "$(INTDIR)\IMP Attribute Entrance.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Attribute Finish.cpp" + +"$(INTDIR)\IMP Attribute Finish.obj" "$(INTDIR)\IMP Attribute Finish.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Attribute Selection.cpp" + +"$(INTDIR)\IMP Attribute Selection.obj" "$(INTDIR)\IMP Attribute Selection.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Begin Screen.cpp" + +"$(INTDIR)\IMP Begin Screen.obj" "$(INTDIR)\IMP Begin Screen.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Compile Character.cpp" + +"$(INTDIR)\IMP Compile Character.obj" "$(INTDIR)\IMP Compile Character.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Confirm.cpp" + +"$(INTDIR)\IMP Confirm.obj" "$(INTDIR)\IMP Confirm.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Finish.cpp" + +"$(INTDIR)\IMP Finish.obj" "$(INTDIR)\IMP Finish.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP HomePage.cpp" + +"$(INTDIR)\IMP HomePage.obj" "$(INTDIR)\IMP HomePage.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP MainPage.cpp" + +"$(INTDIR)\IMP MainPage.obj" "$(INTDIR)\IMP MainPage.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Personality Entrance.cpp" + +"$(INTDIR)\IMP Personality Entrance.obj" "$(INTDIR)\IMP Personality Entrance.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Personality Finish.cpp" + +"$(INTDIR)\IMP Personality Finish.obj" "$(INTDIR)\IMP Personality Finish.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Personality Quiz.cpp" + +"$(INTDIR)\IMP Personality Quiz.obj" "$(INTDIR)\IMP Personality Quiz.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Portraits.cpp" + +"$(INTDIR)\IMP Portraits.obj" "$(INTDIR)\IMP Portraits.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Text System.cpp" + +"$(INTDIR)\IMP Text System.obj" "$(INTDIR)\IMP Text System.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\IMP Voices.cpp" + +"$(INTDIR)\IMP Voices.obj" "$(INTDIR)\IMP Voices.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\IMPVideoObjects.cpp + +"$(INTDIR)\IMPVideoObjects.obj" "$(INTDIR)\IMPVideoObjects.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\insurance Comments.cpp" + +"$(INTDIR)\insurance Comments.obj" "$(INTDIR)\insurance Comments.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\insurance Contract.cpp" + +"$(INTDIR)\insurance Contract.obj" "$(INTDIR)\insurance Contract.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\insurance Info.cpp" + +"$(INTDIR)\insurance Info.obj" "$(INTDIR)\insurance Info.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\insurance.cpp + +"$(INTDIR)\insurance.obj" "$(INTDIR)\insurance.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\laptop.cpp + +"$(INTDIR)\laptop.obj" "$(INTDIR)\laptop.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\mercs Account.cpp" + +"$(INTDIR)\mercs Account.obj" "$(INTDIR)\mercs Account.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\mercs Files.cpp" + +"$(INTDIR)\mercs Files.obj" "$(INTDIR)\mercs Files.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\mercs No Account.cpp" + +"$(INTDIR)\mercs No Account.obj" "$(INTDIR)\mercs No Account.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\mercs.cpp + +"$(INTDIR)\mercs.obj" "$(INTDIR)\mercs.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=.\personnel.cpp + +!IF "$(CFG)" == "Laptop - Win32 Release" + +CPP_SWITCHES=/nologo /MT /W3 /GX /O2 /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I ".\\" /D "PRECOMPILEDHEADERS" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\personnel.obj" "$(INTDIR)\personnel.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "Laptop - Win32 Debug" + +CPP_SWITCHES=/nologo /MTd /W3 /GX /Z7 /Od /I "..\Standard Gaming Platform" /I "..\TileEngine" /I "..\\" /I "..\Tactical" /I "..\Utils" /I "..\tacticalai" /I "..\Editor" /I "..\strategic" /I ".\\" /D "PRECOMPILEDHEADERS" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\personnel.obj" "$(INTDIR)\personnel.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "Laptop - Win32 Release with Debug Info" + +CPP_SWITCHES=/nologo /MT /W4 /GX /Zi /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\TileEngine" /I "..\Utils" /I "..\TacticalAI" /I "..\Editor" /I "..\Tactical" /I "..\strategic" /I ".\\" /D "NDEBUG" /D "RELEASE_WITH_DEBUG_INFO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\personnel.obj" "$(INTDIR)\personnel.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "Laptop - Win32 Bounds Checker" + +CPP_SWITCHES=/nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "_VTUNE_PROFILING" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\personnel.obj" "$(INTDIR)\personnel.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "Laptop - Win32 Debug Demo" + +CPP_SWITCHES=/nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\personnel.obj" "$(INTDIR)\personnel.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "Laptop - Win32 Release Demo" + +CPP_SWITCHES=/nologo /MT /W4 /GX /Zi /O2 /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\personnel.obj" "$(INTDIR)\personnel.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "Laptop - Win32 Demo Release with Debug Info" + +CPP_SWITCHES=/nologo /MT /W4 /GX /Zi /O2 /I "..\Standard Gaming Platform" /I "..\\" /I "..\TileEngine" /I "..\Utils" /I "..\TacticalAI" /I "..\Editor" /I "..\Tactical" /I "..\strategic" /I ".\\" /D "RELEASE_WITH_DEBUG_INFO" /D "NDEBUG" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /D "XML_STATIC" /D "CINTERFACE" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\personnel.obj" "$(INTDIR)\personnel.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "Laptop - Win32 Demo Bounds Checker" + +CPP_SWITCHES=/nologo /MTd /W3 /GX /Z7 /Od /I "\Standard Gaming Platform" /I "\ja2\Build" /I "\ja2\Build\TileEngine" /I "\ja2\Build\Utils" /I "\ja2\build\TacticalAI" /I "\ja2\build\Communications" /I "\ja2\build\Editor" /I "\ja2\build\Tactical" /I "\ja2\build\strategic" /D "_DEBUG" /D "BOUNDS_CHECKER" /D "JA2DEMO" /D "WIN32" /D "_WINDOWS" /D "JA2" /D "PRECOMPILEDHEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\Laptop.pch" /YX"Laptop All.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\personnel.obj" "$(INTDIR)\personnel.sbr" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\sirtech.cpp + +"$(INTDIR)\sirtech.obj" "$(INTDIR)\sirtech.sbr" : $(SOURCE) "$(INTDIR)" + + +SOURCE=".\Store Inventory.cpp" + +"$(INTDIR)\Store Inventory.obj" "$(INTDIR)\Store Inventory.sbr" : $(SOURCE) "$(INTDIR)" + + + +!ENDIF + diff --git a/Laptop/Laptop.vcproj b/Laptop/Laptop.vcproj new file mode 100644 index 00000000..937eb4c6 --- /dev/null +++ b/Laptop/Laptop.vcproj @@ -0,0 +1,4865 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Laptop/LaptopSave.h b/Laptop/LaptopSave.h new file mode 100644 index 00000000..ead55d8a --- /dev/null +++ b/Laptop/LaptopSave.h @@ -0,0 +1,184 @@ +#ifndef _LAPTOP_SAVE_H_ +#define _LAPTOP_SAVE_H_ + +#include "Item Types.h" +#include "FileMan.h" +#include "Store Inventory.h" + +#define MAX_BOOKMARKS 20 + + + +#define MAX_PURCHASE_AMOUNT 10 + + + + +#define SPECK_QUOTE__ALREADY_TOLD_PLAYER_THAT_LARRY_RELAPSED 0x00000001 +#define SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT 0x00000002 + + +typedef struct +{ + BOOLEAN fActive; + UINT8 ubSoldierID; + UINT8 ubMercID; + INT32 iPayOutPrice; +} LIFE_INSURANCE_PAYOUT; + + +typedef struct +{ + BOOLEAN fHaveDisplayedPopUpInLaptop; // Is set when the popup gets displayed, reset when entering laptop again. + INT32 iIdOfMerc; + UINT32 uiArrivalTime; +} LAST_HIRED_MERC_STRUCT; + + +typedef struct +{ + UINT16 usItemIndex; + UINT8 ubNumberPurchased; + INT8 bItemQuality; + UINT16 usBobbyItemIndex; //Item number in the BobbyRayInventory structure + BOOLEAN fUsed; //Indicates wether or not the item is from the used inventory or the regular inventory +} BobbyRayPurchaseStruct; + + + +typedef struct +{ + BOOLEAN fActive; + BobbyRayPurchaseStruct BobbyRayPurchase[ MAX_PURCHASE_AMOUNT ]; + UINT8 ubNumberPurchases; +} BobbyRayOrderStruct; + + +//used when the player goes to bobby rays when it is still down +enum +{ + BOBBYR_NEVER_BEEN_TO_SITE, + BOBBYR_BEEN_TO_SITE_ONCE, + BOBBYR_ALREADY_SENT_EMAIL, +}; + + +typedef struct +{ + //General Laptop Info + BOOLEAN gfNewGameLaptop; //Is it the firs time in Laptop + BOOLEAN fVisitedBookmarkAlready[20]; // have we visitied this site already? + INT32 iBookMarkList[MAX_BOOKMARKS]; + + + INT32 iCurrentBalance; // current players balance + + + //IMP Information + BOOLEAN fIMPCompletedFlag; // Has the player Completed the IMP process + BOOLEAN fSentImpWarningAlready; // Has the Imp email warning already been sent + + + //Personnel Info + INT16 ubDeadCharactersList[ 256 ]; + INT16 ubLeftCharactersList[ 256 ]; + INT16 ubOtherCharactersList[ 256 ]; + + + // MERC site info + UINT8 gubPlayersMercAccountStatus; + UINT32 guiPlayersMercAccountNumber; + UINT8 gubLastMercIndex; + + + // Aim Site + + + // BobbyRay Site + STORE_INVENTORY BobbyRayInventory[ MAXITEMS ]; + STORE_INVENTORY BobbyRayUsedInventory[ MAXITEMS ]; + + BobbyRayOrderStruct *BobbyRayOrdersOnDeliveryArray; + UINT8 usNumberOfBobbyRayOrderItems; // The number of elements in the array + UINT8 usNumberOfBobbyRayOrderUsed; // The number of items in the array that are used + + + // Flower Site + //NONE + + // Insurance Site + LIFE_INSURANCE_PAYOUT *pLifeInsurancePayouts; + UINT8 ubNumberLifeInsurancePayouts; // The number of elements in the array + UINT8 ubNumberLifeInsurancePayoutUsed; // The number of items in the array that are used + + BOOLEAN fBobbyRSiteCanBeAccessed; + + UINT8 ubPlayerBeenToMercSiteStatus; + BOOLEAN fFirstVisitSinceServerWentDown; + BOOLEAN fNewMercsAvailableAtMercSite; + BOOLEAN fSaidGenericOpeningInMercSite; + BOOLEAN fSpeckSaidFloMarriedCousinQuote; + BOOLEAN fHasAMercDiedAtMercSite; + +#ifdef CRIPPLED_VERSION + UINT8 ubCrippleFiller[20]; +#endif + + + INT8 gbNumDaysTillFirstMercArrives; + INT8 gbNumDaysTillSecondMercArrives; + INT8 gbNumDaysTillThirdMercArrives; + INT8 gbNumDaysTillFourthMercArrives; + + UINT32 guiNumberOfMercPaymentsInDays; // Keeps track of each day of payment the MERC site gets + + UINT16 usInventoryListLength[BOBBY_RAY_LISTS]; + + INT32 iVoiceId; + + UINT8 ubHaveBeenToBobbyRaysAtLeastOnceWhileUnderConstruction; + + BOOLEAN fMercSiteHasGoneDownYet; + + UINT8 ubSpeckCanSayPlayersLostQuote; + + LAST_HIRED_MERC_STRUCT sLastHiredMerc; + + INT32 iCurrentHistoryPage; + INT32 iCurrentFinancesPage; + INT32 iCurrentEmailPage; + + UINT32 uiSpeckQuoteFlags; + + UINT32 uiFlowerOrderNumber; + + UINT32 uiTotalMoneyPaidToSpeck; + + UINT8 ubLastMercAvailableId; + UINT8 bPadding[ 86 ]; + +} LaptopSaveInfoStruct; + + + + + +extern LaptopSaveInfoStruct LaptopSaveInfo; + +extern BobbyRayPurchaseStruct BobbyRayPurchases[ MAX_PURCHASE_AMOUNT ]; + + + +void LaptopSaveVariablesInit(); +BOOLEAN LoadLaptopInfoFromSavedGame( HWFILE hFile ); +BOOLEAN SaveLaptopInfoToSavedGame( HWFILE hFile ); + + +#endif + + + + + + + diff --git a/Laptop/Speck Quotes.h b/Laptop/Speck Quotes.h new file mode 100644 index 00000000..27e6613d --- /dev/null +++ b/Laptop/Speck Quotes.h @@ -0,0 +1,119 @@ +#ifndef _SPECK_QUOTES_H_ +#define _SPECK_QUOTES_H_ + +//Enum,s for all of specks quotes +enum +{ + SPECK_QUOTE_FIRST_TIME_IN_0, //0 + SPECK_QUOTE_FIRST_TIME_IN_1, + SPECK_QUOTE_FIRST_TIME_IN_2, + SPECK_QUOTE_FIRST_TIME_IN_3, + SPECK_QUOTE_FIRST_TIME_IN_4, + SPECK_QUOTE_FIRST_TIME_IN_5, + SPECK_QUOTE_FIRST_TIME_IN_6, + SPECK_QUOTE_FIRST_TIME_IN_7, + SPECK_QUOTE_FIRST_TIME_IN_8, + SPECK_QUOTE_THANK_PLAYER_FOR_OPENING_ACCOUNT, + + SPECK_QUOTE_ALTERNATE_OPENING_1_TOUGH_START, //10 + SPECK_QUOTE_ALTERNATE_OPENING_2_BUSINESS_BAD, + SPECK_QUOTE_ALTERNATE_OPENING_3_BUSINESS_GOOD, + SPECK_QUOTE_ALTERNATE_OPENING_4_TRYING_TO_RECRUIT, + SPECK_QUOTE_ALTERNATE_OPENING_5_PLAYER_OWES_SPECK_ACCOUNT_SUSPENDED, + SPECK_QUOTE_ALTERNATE_OPENING_6_PLAYER_OWES_SPECK_ALMOST_BANKRUPT_1, + SPECK_QUOTE_ALTERNATE_OPENING_6_PLAYER_OWES_SPECK_ALMOST_BANKRUPT_2, + SPECK_QUOTE_ALTERNATE_OPENING_7_PLAYER_ACCOUNT_OK, + SPECK_QUOTE_ALTERNATE_OPENING_8_MADE_PARTIAL_PAYMENT, + SPECK_QUOTE_ALTERNATE_OPENING_9_FIRST_VISIT_SINCE_SERVER_WENT_DOWN, + + SPECK_QUOTE_ALTERNATE_OPENING_10_GENERIC_OPENING, //20 + SPECK_QUOTE_ALTERNATE_OPENING_10_TAG_FOR_20, + SPECK_QUOTE_ALTERNATE_OPENING_11_NEW_MERCS_AVAILABLE, + SPECK_QUOTE_ALTERNATE_OPENING_12_PLAYERS_LOST_MERCS, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_PLAYER_OWES_MONEY, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_PLAYER_CLEARED_DEBT, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_PLAYER_CLEARED_OVERDUE_ACCOUNT, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_FIRST_MERC_DIES, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_BIFF_IS_DEAD, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_HAYWIRE_IS_DEAD, + + SPECK_QUOTE_ALTERNATE_OPENING_TAG_GASKET_IS_DEAD, //30 + SPECK_QUOTE_ALTERNATE_OPENING_TAG_RAZOR_IS_DEAD, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_FLO_IS_DEAD_BIFF_ALIVE, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_FLO_IS_DEAD_BIFF_IS_DEAD, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_FLO_MARRIED_A_COUSIN_BIFF_IS_ALIVE, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_GUMPY_IS_DEAD, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_LARRY_IS_DEAD, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_LARRY_RELAPSED, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_COUGER_IS_DEAD, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_NUMB_IS_DEAD, + + SPECK_QUOTE_ALTERNATE_OPENING_TAG_BUBBA_IS_DEAD, //40 + SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_1, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_2, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_3, + SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_4, + SPECK_QUOTE_PLAYER_MAKES_FULL_PAYMENT, + SPECK_QUOTE_PLAYER_MAKES_PARTIAL_PAYMENT, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_BIFF, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_HAYWIRE, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_GASKET, + + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_RAZOR, //50 + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_FLO, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_GUMPY, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_LARRY, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_COUGER, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_NUMB, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_BUBBA, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_TAG_GETTING_MORE_MERCS, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_1, + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_2, + + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_3, //60 + SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_4, + SPECK_QUOTE_BIFF_UNAVALIABLE, + SPECK_QUOTE_PLAYERS_HIRES_BIFF_SPECK_PLUGS_LARRY, + SPECK_QUOTE_PLAYERS_HIRES_BIFF_SPECK_PLUGS_FLO, + SPECK_QUOTE_PLAYERS_HIRES_HAYWIRE_SPECK_PLUGS_RAZOR, + SPECK_QUOTE_PLAYERS_HIRES_RAZOR_SPECK_PLUGS_HAYWIRE, + SPECK_QUOTE_PLAYERS_HIRES_FLO_SPECK_PLUGS_BIFF, + SPECK_QUOTE_PLAYERS_HIRES_LARRY_SPECK_PLUGS_BIFF, + SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_1, + + SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_2, //70 + SPECK_QUOTE_PLAYER_TRIES_TO_HIRE_ALREADY_HIRED_MERC, + SPECK_QUOTE_GOOD_BYE_1, + SPECK_QUOTE_GOOD_BYE_2, + SPECK_QUOTE_GOOD_BYE_3, + SPECK_QUOTE_GOOD_BYE_TAG_PLAYER_OWES_MONEY, + + //TODO: Madd - don't forget the sounds for these + SPECK_QUOTE_ADVERTISE_GASTON, //76 + SPECK_QUOTE_ADVERTISE_STOGIE, + SPECK_QUOTE_GASTON_DEAD, + SPECK_QUOTE_STOGIE_DEAD, + SPECK_QUOTE_PLAYER_HIRES_GASTON, + SPECK_QUOTE_PLAYER_HIRES_STOGIE, + + SPECK_QUOTE_RANDOM_CHIT_CHAT_1, + SPECK_QUOTE_RANDOM_CHIT_CHAT_2, +/* + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + + SPECK_QUOTE_, //80 + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, + SPECK_QUOTE_, +*/ +}; + +#endif \ No newline at end of file diff --git a/Laptop/Store Inventory.cpp b/Laptop/Store Inventory.cpp new file mode 100644 index 00000000..6bde574f --- /dev/null +++ b/Laptop/Store Inventory.cpp @@ -0,0 +1,924 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "Types.h" + #include "Store Inventory.h" + #include "Random.h" + #include "Weapons.h" + #include "Debug.h" + #include "LaptopSave.h" + #include "ShopKeeper Interface.h" +#endif + + +UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; //= +//{ +//// +//// The first column is for Bobby Rays new inventory, BOBBY_RAY_NEW, +//// The second column is for Bobby Rays used inventory, BOBBY_RAY_USED, +//// +// {0, 0 }, /* nothing */ +//// MADD MARKER +////---WEAPONS--- +// {8, 1 }, /* Glock 17 */ +// {6, 1 }, /* Glock 18 */ +// {8, 1 }, /* Beretta 92F */ +// {6, 1 }, /* Beretta 93R */ +// {8, 1 }, /* .38 S&W Special */ +// {8, 1 }, /* .357 Barracuda */ +// {6, 1 }, /* .357 DesertEagle*/ +// {7, 1 }, /* .45 M1911 */ +// {4, 1 }, /* H&K MP5K */ +// {4, 1 }, /* .45 MAC-10 */ // 10 +// +// {4, 1 }, /* Thompson M1A1 */ +// {4, 1 }, /* Colt Commando */ +// {4, 1 }, /* H&K MP53 */ +// {4, 1 }, /* AKSU-74 */ +// {2, 1 }, /* 5.7mm FN P90 */ +// {4, 1 }, /* Type-85 */ +// {3, 1 }, /* SKS */ +// {2, 1 }, /* Dragunov */ +// {2, 1 }, /* M24 */ +// {3, 1 }, /* Steyr AUG */ //20 +// +// {3, 1 }, /* H&K G41 */ +// {3, 1 }, /* Ruger Mini-14 */ +// {3, 1 }, /* C-7 */ +// {3, 1 }, /* FA-MAS */ +// {3, 1 }, /* AK-74 */ +// {3, 1 }, /* AKM */ +// {3, 1 }, /* M-14 */ +// {3, 1 }, /* FN-FAL */ +// {3, 1 }, /* H&K G3A3 */ +// {3, 1 }, /* H&K G11 */ // 30 +// +// {5, 1 }, /* Remington M870 */ +// {3, 1 }, /* SPAS-15 */ +// {2, 1 }, /* CAWS */ +// {2, 1 }, /* FN Minimi */ +// {2, 1 }, /* RPK-74 */ +// {2, 1 }, /* H&K 21E */ +// {5, 0 }, /* combat knife */ +// {7, 0 }, /* throwing knife */ +// {0, 0 }, /* rock */ +// {2, 0 }, /* grenade launcher*/ // 40 +// +// {2, 0 }, /* mortar */ +// {0, 0 }, /* another rock */ +// {0, 0 }, /* claws */ +// {0, 0 }, /* claws */ +// {0, 0 }, /* claws */ +// {0, 0 }, /* claws */ +// {0, 0 }, /* tentacles */ +// {0, 0 }, /* spit */ +// {2, 0 }, /* brass knuckles */ +// {6, 0 }, /* underslung g.l. */ // 50 +// +// {4, 0 }, /* rocket launcher */ +// {0, 0 }, /* bloodcat claws */ +// {0, 0 }, /* bloodcat bite */ +// {2, 0 }, /* machete */ +// {1, 0 }, /* rocket rifle */ +// {0, 0 }, /* Automag III */ +// {0, 0 }, /* spit */ +// {0, 0 }, /* spit */ +// {0, 0 }, /* spit */ +// {0, 0 }, /* tank cannon */ // 60 +// +// {2, 1 }, /* dart gun */ +// {0, 0 }, /* bloody throwing knife */ +// {0, 0 }, /* flamethrower */ +// {3, 0 }, /* Crowbar */ +// {1, 0 }, /* Auto Rocket Rifle */ +// {2, 1 }, /* barrett - nothing */ +// {2, 1 }, /* val silent - nothing */ +// {2, 1 }, /* psg - nothing */ +// {2, 1 }, /* tar 21 - nothing */ +// {0, 0 }, /* nothing */ // 70 +// +////---AMMO--- +// {50, 0 }, /* CLIP9_15 */ +// {40, 0 }, /* CLIP9_30 */ +// {8, 0 }, /* CLIP9_15_AP */ +// {4, 0 }, /* CLIP9_30_AP */ +// {7, 0 }, /* CLIP9_15_HP */ +// {4, 0 }, /* CLIP9_30_HP */ +// {50, 0 }, /* CLIP38_6 */ +// {8, 0 }, /* CLIP38_6_AP */ +// {6, 0 }, /* CLIP38_6_HP */ +// {40, 0 }, /* CLIP45_7 */ // 80 +// +// {25, 0 }, /* CLIP45_30 */ +// {6, 0 }, /* CLIP45_7_AP */ +// {8, 0 }, /* CLIP45_30_AP */ +// {6, 0 }, /* CLIP45_7_HP */ +// {5, 0 }, /* CLIP45_30_HP */ +// {40, 0 }, /* CLIP357_6 */ +// {20, 0 }, /* CLIP357_9 */ +// {6, 0 }, /* CLIP357_6_AP */ +// {5, 0 }, /* CLIP357_9_AP */ +// {4, 0 }, /* CLIP357_6_HP */ //90 +// +// {4, 0 }, /* CLIP357_9_HP */ +// {25, 0 }, /* CLIP545_30_AP */ +// {5, 0 }, /* CLIP545_30_HP */ +// {15, 0 }, /* CLIP556_30_AP */ +// {5, 0 }, /* CLIP556_30_HP */ +// {15, 0 }, /* CLIP762W_10_AP */ +// {12, 0 }, /* CLIP762W_30_AP */ +// {4, 0 }, /* CLIP762W_10_HP */ +// {5, 0 }, /* CLIP762W_30_HP */ +// {10, 0 }, /* CLIP762N_5_AP */ //100 +// +// {10, 0 }, /* CLIP762N_20_AP */ +// {5, 0 }, /* CLIP762N_5_HP */ +// {5, 0 }, /* CLIP762N_20_HP */ +// {10, 0 }, /* CLIP47_50_SAP */ +// {10, 0 }, /* CLIP57_50_AP */ +// {5, 0 }, /* CLIP57_50_HP */ +// {20, 0 }, /* CLIP12G_7 */ +// {40, 0 }, /* CLIP12G_7_BUCKSHOT */ +// {10, 0 }, /* CLIPCAWS_10_SAP */ +// {10, 0 }, /* CLIPCAWS_10_FLECH */ //110 +// +// {5, 0 }, /* CLIPROCKET_AP */ +// {5, 0 }, /* CLIPROCKET_HE */ +// {5, 0 }, /* CLIPROCKET_HEAT */ +// {20, 0 }, /* sleep dart */ +// {0, 0 }, /* Clip Flame */ +// {6, 0 }, /* CLIP50_11 */ +// {5, 0 }, /* CLIP9H_20 */ //120 +// {8, 0 }, /* CLIP9_50 */ +// {4, 0 }, /* CLIP9_50_AP */ +// {4, 0 }, /* CLIP9_50_HP */ +// +// {2, 0 }, /* DRUM545_75_AP */ +// {1, 0 }, /* DRUM545_75_HP */ +// {2, 0 }, /* BELT556_200_AP */ +// {1, 0 }, /* BELT556_200_HP */ +// {2, 0 }, /* BELT762N_100_AP */ +// {1, 0 }, /* BELT762N_100_HP */ +// {10, 0 }, /* CLIP57_20_AP */ +// {5, 0 }, /* CLIP57_20_HP */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ //130 +// +////---EXPLOSIVES--- +// {7, 0 }, /* stun grenade */ +// {7, 0 }, /* tear gas grenade */ +// {5, 0 }, /* mustard gas grenade*/ +// {7, 0 }, /* mini hand grenade */ +// {6, 0 }, /* reg hand grenade */ +// {0, 0 }, /* RDX */ +// {6, 0 }, /* TNT (="explosives")*/ +// {0, 0 }, /* HMX (=RDX+TNT) */ +// {0, 0 }, /* C1 (=RDX+min oil) */ +// {6, 0 }, /* mortar shell */ //140 +// +// {0, 0 }, /* mine */ +// {2, 0 }, /* C4 ("plastique") */ +// {0, 0 }, /* trip flare */ +// {0, 0 }, /* trip klaxon */ +// {4, 0 }, /* shaped charge */ +// {4, 0 }, /* break light */ +// {5, 0 }, /* 40mm HE grenade */ +// {5, 0 }, /* 40mm gas grenade */ +// {5, 0 }, /* 40mm stun grenade */ +// {5, 0 }, /* 40mm smoke grenade */ //150 +// +// {7, 0 }, /* smoke hand grenade */ +// {0, 0 }, /* tank shell */ +// {0, 0 }, /* structure ignite */ +// {0, 0 }, /* creature cocktail */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ //160 +// +////---ARMOUR--- +// {2, 1 }, /* Flak jacket */ +// {0, 0 }, /* Flak jacket w X */ +// {0, 0 }, /* Flak jacket w Y */ +// {1, 1 }, /* Kevlar vest */ +// {0, 0 }, /* Kevlar vest w X */ +// {0, 0 }, /* Kevlar vest w Y */ +// {1, 1 }, /* Spectra vest */ +// {0, 0 }, /* Spectra vest w X*/ +// {0, 0 }, /* Spectra vest w Y*/ +// {1, 1 }, /* Kevlar leggings */ //170 +// +// {0, 0 }, /* Kevlar legs w X */ +// {0, 0 }, /* Kevlar legs w Y */ +// {1, 1 }, /* Spectra leggings*/ +// {0, 0 }, /* Spectra legs w X*/ +// {0, 0 }, /* Spectra legs w Y*/ +// {3, 1 }, /* Steel helmet */ +// {1, 1 }, /* Kevlar helmet */ +// {0, 0 }, /* Kevlar helm w X */ +// {0, 0 }, /* Kevlar helm w Y */ +// {1, 1 }, /* Spectra helmet */ //180 +// +// {0, 0 }, /* Spectra helm w X*/ +// {0, 0 }, /* Spectra helm w Y*/ +// {0, 0 }, /* Ceramic plates */ +// {0, 0 }, /* hide */ +// {0, 0 }, /* hide */ +// {0, 0 }, /* hide */ +// {0, 0 }, /* hide */ +// {1, 0 }, /* Leather jacket */ +// {1, 0 }, /* Leather jacket w kevlar */ +// {0, 0 }, /* Leather jacket w kevlar 18 */ //190 +// +// {1, 0 }, /* Leather jacket w kevlar Y */ +// {0, 0 }, /* hide */ +// {0, 0 }, /* hide */ +// {0, 0 }, /* T-shirt (Arulco) */ +// {0, 0 }, /* T-shirt (Deidranna) */ +// {1, 1 }, /* Kevlar 2 Vest */ +// {0, 0 }, /* Kevlar 2 Vest w 18 */ +// {0, 0 }, /* Kevlar 2 Vest w Y */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ //200 +// +////---MISC--- +// {8, 0 }, /* First aid kit */ +// {6, 0 }, /* Medical Kit */ +// {4, 1 }, /* Tool Kit */ +// {3, 1 }, /* Locksmith kit */ +// {4, 0 }, /* Camouflage kit*/ +// {0, 0 }, /* nothing */ // Boobytrap kit - unused +// {6, 1 }, /* Silencer */ +// {6, 1 }, /* Sniper scope */ +// {6, 1 }, /* Bipod */ +// {6, 1 }, /* Extended ear */ // 210 +// +// {6, 1 }, /* Night goggles */ +// {8, 0 }, /* Sun goggles */ +// {6, 1 }, /* Gas mask */ +// {10, 0 }, /* Canteen */ +// {2, 0 }, /* Metal detector*/ +// {6, 0 }, /* Compound 18 */ +// {0, 0 }, /* Jar w/Queen Blood */ +// {0, 0 }, /* Jar w/Elixir */ +// {0, 0 }, /* Money */ +// {0, 0 }, /* Glass jar */ //220 +// +// {0, 0 }, /* Jar w/Creature Blood */ +// {0, 0 }, /* Adrenaline Booster */ +// {6, 0 }, /* Detonator */ +// {6, 0 }, /* Rem Detonator */ +// {0, 0 }, /* VideoTape */ +// {0, 0 }, /* Deed */ +// {0, 0 }, /* Letter */ +// {0, 0 }, /* Terrorist Info */ +// {0, 0 }, /* Chalice */ +// {0, 0 }, /* Mission4 */ //230 +// +// {0, 0 }, /* Mission5 */ +// {0, 0 }, /* Mission6 */ +// {0, 0 }, /* Switch */ +// {0, 0 }, /* Action Item */ +// {0, 0 }, /* Syringe2 */ +// {0, 0 }, /* Syringe3 */ +// {0, 0 }, /* Syringe4 */ +// {0, 0 }, /* Syringe5 */ +// {0, 0 }, /* Jar w/Human blood */ +// {0, 0 }, /* Ownership item */ //240 +// +// {6, 1 }, /* Laser scope */ +// {6, 0 }, /* Remote trigger*/ +// {3, 0 }, /* Wirecutters */ //243 +// {3, 0 }, /* Duckbill */ +// {0, 0 }, /* Alcohol */ +// {1, 1 }, /* UV Goggles */ +// {0, 0 }, /* Discarded LAW */ +// {0, 0 }, /* head - generic */ +// {0, 0 }, /* head - Imposter*/ +// {0, 0 }, /* head - T-Rex */ // 250 +// +// {0, 0 }, /* head - Slay */ +// {0, 0 }, /* head - Druggist */ +// {0, 0 }, /* head - Matron */ +// {0, 0 }, /* head - Tiffany */ +// {0, 0 }, /* wine */ +// {0, 0 }, /* beer */ +// {0, 0 }, /* pornos */ +// {0, 0 }, /* video camera */ +// {0, 0 }, /* robot remote control */ +// {0, 0 }, /* creature claws */ // 260 +// +// {0, 0 }, /* creature flesh */ +// {0, 0 }, /* creature organ */ +// {0, 0 }, /* remote trigger */ +// {0, 0 }, /* gold watch */ +// {0, 0 }, /* golf clubs */ +// {0, 0 }, /* walkman */ +// {0, 0 }, /* portable TV */ +// {0, 0 }, /* Money for player's account */ +// {0, 0 }, /* cigars */ +// {0, 0 }, /* nothing */ // 270 +// +// {0, 0 }, /* key */ // 271 +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// +// {6, 1 }, /* flash suppressor */ // 281 +// {2, 1 }, /* rpg 7 */ +// {4, 0 }, /* RPG_HE_ROCKET */ +// {4, 0 }, /* RPG_AP_ROCKET */ +// {4, 0 }, /* RPG_FRAG_ROCKET */ +// {6, 1 }, /* reflex_scoped */ +// {6, 1 }, /* reflex_unscoped */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// +// {0, 0 }, /* key */ // 291 +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// {0, 0 }, /* key */ +// +// {0, 0 }, /* key */ // 301 +// {0, 0 }, /* key */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// +// {0, 0 }, /* nothing */ // 311 +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// +// {0, 0 }, /* nothing */ // 321 +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {3, 1 }, /* m900 */ +// {6, 1 }, /* m950 */ +// {3, 1 }, /* m960a - 330 */ +// +// {4, 1 }, /* micro uzi - 331 */ +// {2, 1 }, /* enfield */ +// {5, 1 }, /* MP5 */ +// {3, 1 }, /* mp5sd */ +// {2, 1 }, /* mp5n */ +// {3, 1 }, /* ump45 */ +// {4, 1 }, /* five7 */ +// {6, 1 }, /* p7m8 */ +// {5, 1 }, /* g36k */ +// {4, 1 }, /* g36c */ +// +// {2, 1 }, /* MSG */ // 341 +// {3, 1 }, /* Bennelli */ +// {3, 1 }, /* AK103 */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// {0, 0 }, /* nothing */ +// +//}; + + + //MADD MARKER +INT16 WeaponROF[ MAXITEMS ];//= +//{ +// 0, /* Nothing */ +// +// 40, /* Glock 17 */ +// 1300, /* Glock 18 */ +// 45, /* Beretta 92F */ +// 1100, /* Beretta 93R */ +// 25, /* .38 S&W Special */ +// 23, /* .357 Barracuda */ +// 27, /* .357 DesertEagle*/ +// 35, /* .45 M1911 */ +// 900, /* H&K MP5K */ +// 1090, /* .45 MAC-10 */ // 10 +// +// 700, /* Thompson M1A1 */ +// 900, /* Colt Commando */ +// 800, /* H&K MP53 */ +// 900, /* AKSU-74 */ +// 900, /* 5.7mm FN P90 */ +// 780, /* Type-85 */ +// 40, /* SKS */ +// 20, /* Dragunov */ +// 20, /* M24 */ +// 650, /* Steyr AUG */ //20 +// +// 850, /* H&K G41 */ +// 750, /* Ruger Mini-14 */ +// 600, /* C-7 */ +// 900, /* FA-MAS */ +// 650, /* AK-74 */ +// 600, /* AKM */ +// 750, /* M-14 */ +// 650, /* FN-FAL */ +// 500, /* H&K G3A3 */ +// 600, /* H&K G11 */ // 30 +// +// 21, /* Remington M870 */ +// 30, /* SPAS-15 */ +// -1, /* CAWS */ +// 750, /* FN Minimi */ +// 800, /* RPK-74 */ +// 800, /* H&K 21E */ +// 0, /* combat knife */ +// 0, /* throwing knife */ +// 0, /* rock */ +// 1, /* grenade launcher */ // 40 +// +// 1, /* mortar */ +// 0, /* another rock */ +// 0, /* claws */ +// 0, /* claws */ +// 0, /* claws */ +// 0, /* claws */ +// 0, /* tentacles */ +// 0, /* spit */ +// 0, /* brass knuckles */ +// 1, /* underslung g.l. */ // 50 +// +// 1, /* rocket launcher */ +// 0, /* nothing */ +// 0, /* nothing */ +// 0, /* machete */ +// 1, /* rocket rifle */ +// 666, /* Automag III */ +// 0, /* spit */ +// 0, /* spit */ +// 0, /* spit */ +// 1, /* tank cannon */ +// 1, /* dart gun */ +// +//0, // BLOODY_THROWING_KNIFE, +//1, // FLAMETHROWER, +//0, // CROWBAR, +//1, // AUTO_ROCKET_RIFLE, //65 +// +//20, // BARRETT, //previously unused +//25, // VAL_SILENT, //previously unused +//22,// PSG, //previously unused +//900, // TAR21, //previously unused +// +// 0, // Max_weapons 70 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 80 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 90 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 100 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 110 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 120 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 130 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 140 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 150 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 160 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 170 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 180 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 190 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 200 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 210 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 220 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 230 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 240 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 250 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 260 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 270 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 280 +// 0, // nothing +// 1, // rpg 7 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 290 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 300 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 310 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 320 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 1300, /* m900 */ +// 600, /* m950 */ +// 600, /* m960a - 330 */ +// 800, /* micro uzi */ +// 600, /* enfield */ +// 800, // mp5 +// 800, // mp5sd +// 900, // mp5n +// 800, // ump45 +// 45, // five7 +// 50, // p7m8 +// 750, // G36k +// 750, // G36c 340 +// 2, // MSG90A1 +// 35, // bennelli +// 600, // ak103 +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing +// 0, // nothing 350 +//}; + + + + + + + + + + +// SetupStoreInventory sets up the initial quantity on hand for all of Bobby Ray's inventory items +void SetupStoreInventory( STORE_INVENTORY *pInventoryArray, BOOLEAN fUsed ) +{ + UINT16 i; + UINT16 usItemIndex; + UINT8 ubNumBought; + + //loop through all items BR can stock to init a starting quantity on hand + for(i = 0; i < LaptopSaveInfo.usInventoryListLength[fUsed]; i++) + { + usItemIndex = pInventoryArray[ i ].usItemIndex; + Assert(usItemIndex < MAXITEMS); + + ubNumBought = DetermineInitialInvItems( -1, usItemIndex, StoreInventory[ usItemIndex ][ fUsed ], fUsed); + if ( ubNumBought > 0) + { + // If doing used items + if( fUsed ) + { + // then there should only be 1 of them, and it's damaged + pInventoryArray[i].ubQtyOnHand = 1; + pInventoryArray[i].ubItemQuality = 20 + (UINT8) Random( 60 ); + } + else // new + { + // Madd + pInventoryArray[i].ubQtyOnHand = ubNumBought * gGameOptions.ubBobbyRay; + pInventoryArray[i].ubItemQuality = 100; + } + } + else + { + // doesn't sell / not in stock + pInventoryArray[i].ubQtyOnHand = 0; + pInventoryArray[i].ubItemQuality = 0; + } + } +} + + +BOOLEAN DoesGunOfSameClassExistInInventory( UINT8 ubItemIndex, UINT8 ubDealerID ) +{ + UINT16 i; + + STORE_INVENTORY *pInventoryArray; + + pInventoryArray = GetPtrToStoreInventory( ubDealerID ); + if( pInventoryArray == NULL ) + return( FALSE ); + + + //go through all of the guns + for(i=0; i= 4) + { + //if there is already a qty on hand, then we found a match + if( pInventoryArray[ i ].ubQtyOnHand ) + { + return(TRUE); + } + } + } + } + return(FALSE); +} + + + + + +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + +STORE_INVENTORY *GetPtrToStoreInventory( UINT8 ubDealerID ) +{ + if( ubDealerID >= BOBBY_RAY_LISTS ) + return( NULL ); + + + if( ubDealerID == BOBBY_RAY_NEW ) + return( LaptopSaveInfo.BobbyRayInventory ); + else if( ubDealerID == BOBBY_RAY_USED ) + return( LaptopSaveInfo.BobbyRayUsedInventory ); + else + Assert( 0 ); +// else +// return( gArmsDealersInventory[ ubDealerID - TONYS_ITEMS ] ); + + + return( NULL ); +} + + + +/* +INT16 CountNumberOfItemsInStoreInventory( UINT8 ubArmsDealerID ) +{ + UINT16 cnt; + INT16 ubNumItems=0; + + STORE_INVENTORY *pInventoryArray; + + pInventoryArray = GetPtrToStoreInventory( ubArmsDealerID ); + if( pInventoryArray == NULL ) + return( -1 ); + + + for( cnt=0; cnt 0 ) + ubNumItems++; + } + + return( ubNumItems ); +} +*/ +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// +//////////////////////////////////////////////////// + + + + + + + diff --git a/Laptop/Store Inventory.h b/Laptop/Store Inventory.h new file mode 100644 index 00000000..5dd46c5e --- /dev/null +++ b/Laptop/Store Inventory.h @@ -0,0 +1,39 @@ +#ifndef __STORE_INVENTORY_H_ +#define __STORE_INVENTORY_H_ + +#include "Items.h" + + +typedef struct +{ + UINT16 usItemIndex; //Index into the item table + UINT8 ubQtyOnHand; + UINT8 ubQtyOnOrder; //The number of items on order + UINT8 ubItemQuality; // the % damaged listed from 0 to 100 + BOOLEAN fPreviouslyEligible; // whether or not dealer has been eligible to sell this item in days prior to today + + UINT8 filler; + +} STORE_INVENTORY; + + +//Enums used for the access the MAX dealers array +enum +{ + BOBBY_RAY_NEW, + BOBBY_RAY_USED, + + BOBBY_RAY_LISTS, +}; + +extern UINT8 StoreInventory[MAXITEMS][BOBBY_RAY_LISTS]; +extern INT16 WeaponROF[ MAXITEMS ]; + + + +void SetupStoreInventory( STORE_INVENTORY *pInventoryArray, BOOLEAN fUsed ); +BOOLEAN DoesGunOfSameClassExistInInventory( UINT8 ubItemIndex, UINT8 ubDealerID ); +STORE_INVENTORY *GetPtrToStoreInventory( UINT8 ubDealerID ); +//INT16 CountNumberOfItemsInStoreInventory( UINT8 ubArmsDealerID ); + +#endif diff --git a/Laptop/aim.cpp b/Laptop/aim.cpp new file mode 100644 index 00000000..2806b8f6 --- /dev/null +++ b/Laptop/aim.cpp @@ -0,0 +1,1262 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "aim.h" + #include "Utilities.h" + #include "WCheck.h" + #include "timer control.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Encrypted File.h" + #include "email.h" + #include "Game Clock.h" + #include "Text.h" + #include "LaptopSave.h" + #include "Multi Language Graphic Utils.h" +#endif + + + +UINT8 AimMercArray[ MAX_NUMBER_MERCS ]; + +UINT8 gCurrentAimPage[ NUM_AIM_SCREENS ] = +{ + LAPTOP_MODE_AIM, + LAPTOP_MODE_AIM_MEMBERS_SORTED_FILES, + LAPTOP_MODE_AIM_MEMBERS_ARCHIVES, + LAPTOP_MODE_AIM_POLICIES, + LAPTOP_MODE_AIM_HISTORY, + LAPTOP_MODE_AIM_LINKS +}; + + +// +//*** Defines ** +// + + +#define BOBBYR_UNDER_CONSTRUCTION_AD_FONT FONT14HUMANIST//FONT16ARIAL +#define BOBBYR_UNDER_CONSTRUCTION_AD_COLOR FONT_MCOLOR_DKRED//FONT_MCOLOR_WHITE + + +// Link Images +#define LINK_SIZE_X 101 +#define LINK_SIZE_Y 76 + +#define MEMBERCARD_X IMAGE_OFFSET_X + 118 +#define MEMBERCARD_Y IMAGE_OFFSET_Y + 190 + +#define POLICIES_X IMAGE_OFFSET_X + 284 +#define POLICIES_Y MEMBERCARD_Y + +#define HISTORY_X MEMBERCARD_X +#define HISTORY_Y IMAGE_OFFSET_Y + 279 + +#define LINKS_X POLICIES_X +#define LINKS_Y HISTORY_Y + +#define WARNING_X IMAGE_OFFSET_X + 126 +#define WARNING_Y IMAGE_OFFSET_Y + 79 + +#define MEMBERS_TEXT_Y MEMBERCARD_Y + 77 +#define HISTORY_TEXT_Y HISTORY_Y + 77 +#define POLICIES_TEXT_Y MEMBERS_TEXT_Y +#define LINK_TEXT_Y HISTORY_TEXT_Y + +#define AIM_WARNING_TEXT_X WARNING_X + 15 +#define AIM_WARNING_TEXT_Y WARNING_Y + 46 +#define AIM_WARNING_TEXT_WIDTH 220 + +#define AIM_FLOWER_LINK_TEXT_Y AIM_WARNING_TEXT_Y + 25 + +#define AIM_BOBBYR1_LINK_TEXT_X WARNING_X + 20 +#define AIM_BOBBYR1_LINK_TEXT_Y WARNING_Y + 20 + +#define AIM_BOBBYR2_LINK_TEXT_X WARNING_X + 50 +#define AIM_BOBBYR2_LINK_TEXT_Y WARNING_Y + 58 + +#define AIM_BOBBYR3_LINK_TEXT_X WARNING_X + 20 +#define AIM_BOBBYR3_LINK_TEXT_Y WARNING_Y + 20 + +#define AIM_AD_TOP_LEFT_X WARNING_X +#define AIM_AD_TOP_LEFT_Y WARNING_Y +#define AIM_AD_BOTTOM_RIGHT_X AIM_AD_TOP_LEFT_X + 248 +#define AIM_AD_BOTTOM_RIGHT_Y AIM_AD_TOP_LEFT_Y + 110 + +#define AIM_COPYRIGHT_X iScreenWidthOffset + 160 +#define AIM_COPYRIGHT_Y iScreenHeightOffset + 415 // + LAPTOP_SCREEN_WEB_DELTA_Y +#define AIM_COPYRIGHT_WIDTH 400 +#define AIM_COPYRIGHT_GAP 9 + +#define AIM_WARNING_TIME 10000 +#define AIM_ADVERTISING_DELAY 500 + +#define AIM_FLOWER_AD_DELAY 150 +#define AIM_FLOWER_NUM_SUBIMAGES 16 + +#define AIM_AD_FOR_ADS_DELAY 150 +#define AIM_AD_FOR_ADS__NUM_SUBIMAGES 13 + +#define AIM_AD_INSURANCE_AD_DELAY 150 +#define AIM_AD_INSURANCE_AD__NUM_SUBIMAGES 10 + +#define AIM_AD_FUNERAL_AD_DELAY 250 +#define AIM_AD_FUNERAL_AD__NUM_SUBIMAGES 9 + +#define AIM_AD_BOBBYR_AD_STARTS 2 +#define AIM_AD_DAY_FUNERAL_AD_STARTS 4 +#define AIM_AD_DAY_FLOWER_AD_STARTS 7 +#define AIM_AD_DAY_INSURANCE_AD_STARTS 12 + +#define AIM_AD_BOBBYR_AD_DELAY 300 +#define AIM_AD_BOBBYR_AD__NUM_SUBIMAGES 21 +#define AIM_AD_BOBBYR_AD_NUM_DUCK_SUBIMAGES 6 + + +//#define + +enum +{ + AIM_AD_NOT_DONE, + AIM_AD_DONE, + AIM_AD_WARNING_BOX, + AIM_AD_FOR_ADS, + AIM_AD_BOBBY_RAY_AD, + AIM_AD_FUNERAL_ADS, + AIM_AD_FLOWER_SHOP, + AIM_AD_INSURANCE_AD, + AIM_AD_LAST_AD +}; + + +// Aim Screen Handle +UINT32 guiAimSymbol; +UINT32 guiRustBackGround; +UINT32 guiMemberCard; +UINT32 guiPolicies; +UINT32 guiHistory; +UINT32 guiLinks; +UINT32 guiWarning; +extern UINT32 guiBottomButton; // symbol already declared globally in AimPolicies.cpp (jonathanl) +extern UINT32 guiBottomButton2; // symbol already declared globally in AimPolicies.cpp (jonathanl) +UINT32 guiFlowerAdvertisement; +UINT32 guiAdForAdsImages; +UINT32 guiInsuranceAdImages; +UINT32 guiFuneralAdImages; +UINT32 guiBobbyRAdImages; + + +UINT8 gubAimMenuButtonDown=255; +UINT32 gubWarningTimer; +UINT8 gubCurrentAdvertisment; + +BOOLEAN gfInitAdArea; + +// MemberCard +MOUSE_REGION gSelectedMemberCardRegion; +void SelectMemberCardRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + +// Policies +MOUSE_REGION gSelectedPoliciesRegion; +void SelectPoliciesRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//History +MOUSE_REGION gSelectedHistoryRegion; +void SelectHistoryRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Links +MOUSE_REGION gSelectedLinksRegion; +void SelectLinksRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Bottom Buttons +void BtnAimBottomButtonsCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiBottomButtons[ NUM_AIM_SCREENS ]; +INT32 guiBottomButtonImage; + +//Banner Area +MOUSE_REGION gSelectedBannerRegion; +void SelectBannerRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Aim logo click +MOUSE_REGION gSelectedAimLogo; +void SelectAimLogoRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + + +BOOLEAN DrawWarningBox( BOOLEAN fInit, BOOLEAN fRedraw ); +BOOLEAN DisplayFlowerAd( BOOLEAN fInit, BOOLEAN fRedraw ); +void HandleAdAndWarningArea( BOOLEAN fInit, BOOLEAN fRedraw ); +void LaptopInitAim(); +BOOLEAN DisplayAd( BOOLEAN fInit, BOOLEAN fRedraw, UINT16 usDelay, UINT16 usNumberOfSubImages, UINT32 uiAdImageIdentifier ); +void HandleTextOnAimAdd( UINT8 ubCurSubImage ); +BOOLEAN DisplayBobbyRAd( BOOLEAN fInit, BOOLEAN fRedraw ); +UINT8 GetNextAimAd( UINT8 ubCurrentAd ); + + + +BOOLEAN fFirstTimeIn=TRUE; + +// +// *********************** Functions ************************* +// + +void GameInitAIM() +{ + LaptopInitAim(); +} + + + +BOOLEAN EnterAIM() +{ + VOBJECT_DESC VObjectDesc; + + gubWarningTimer = 0; + gubCurrentAdvertisment = AIM_AD_WARNING_BOX; + LaptopInitAim(); + + InitAimDefaults(); + + // load the MemberShipcard graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\membercard.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMemberCard)); + + // load the Policies graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Policies.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiPolicies)); + + // load the Links graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Links.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLinks)); + + // load the History graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_HISTORY ); + CHECKF(AddVideoObject(&VObjectDesc, &guiHistory)); + + // load the Wanring graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_WARNING ); + CHECKF(AddVideoObject(&VObjectDesc, &guiWarning)); + + // load the flower advertisment and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\flowerad_16.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiFlowerAdvertisement)); + + // load the your ad advertisment and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_YOURAD13 ); + CHECKF(AddVideoObject(&VObjectDesc, &guiAdForAdsImages)); + + // load the insurance advertisment and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_INSURANCEAD10 ); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsuranceAdImages)); + + // load the funeral advertisment and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_FUNERALAD9 ); + CHECKF(AddVideoObject(&VObjectDesc, &guiFuneralAdImages)); + + // load the funeral advertisment and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_BOBBYRAYAD21 ); + CHECKF(AddVideoObject(&VObjectDesc, &guiBobbyRAdImages )); + + + + //** Mouse Regions ** + + //Mouse region for the MebershipCard + MSYS_DefineRegion( &gSelectedMemberCardRegion, MEMBERCARD_X, MEMBERCARD_Y , (MEMBERCARD_X + LINK_SIZE_X), (MEMBERCARD_Y + LINK_SIZE_Y), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectMemberCardRegionCallBack ); + MSYS_AddRegion(&gSelectedMemberCardRegion); + + //Mouse region for the Policies + MSYS_DefineRegion( &gSelectedPoliciesRegion, POLICIES_X, POLICIES_Y , (POLICIES_X + LINK_SIZE_X), (POLICIES_Y + LINK_SIZE_Y), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectPoliciesRegionCallBack ); + MSYS_AddRegion(&gSelectedPoliciesRegion); + + //Mouse region for the History + MSYS_DefineRegion( &gSelectedHistoryRegion, HISTORY_X, HISTORY_Y , (HISTORY_X + LINK_SIZE_X), (HISTORY_Y + LINK_SIZE_Y), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectHistoryRegionCallBack ); + MSYS_AddRegion(&gSelectedHistoryRegion); + + //Mouse region for the Links + MSYS_DefineRegion( &gSelectedLinksRegion, LINKS_X, LINKS_Y , (LINKS_X + LINK_SIZE_X), (LINKS_Y + LINK_SIZE_Y), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectLinksRegionCallBack ); + MSYS_AddRegion(&gSelectedLinksRegion); + + //Mouse region for the Links + MSYS_DefineRegion( &gSelectedBannerRegion, AIM_AD_TOP_LEFT_X, AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X, AIM_AD_BOTTOM_RIGHT_Y, MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectBannerRegionCallBack); + MSYS_AddRegion(&gSelectedBannerRegion); + + // disable the region because only certain banners will be 'clickable' + MSYS_DisableRegion(&gSelectedBannerRegion); + + gubAimMenuButtonDown=255; + + fFirstTimeIn = FALSE; + RenderAIM(); + + return( TRUE ); +} + +void LaptopInitAim() +{ + gfInitAdArea = TRUE; +} + +void ExitAIM() +{ + RemoveAimDefaults(); + + DeleteVideoObjectFromIndex(guiMemberCard); + DeleteVideoObjectFromIndex(guiPolicies); + DeleteVideoObjectFromIndex(guiLinks); + DeleteVideoObjectFromIndex(guiHistory); + DeleteVideoObjectFromIndex(guiWarning); + DeleteVideoObjectFromIndex(guiFlowerAdvertisement); + DeleteVideoObjectFromIndex(guiAdForAdsImages); + DeleteVideoObjectFromIndex(guiInsuranceAdImages); + DeleteVideoObjectFromIndex(guiFuneralAdImages); + DeleteVideoObjectFromIndex(guiBobbyRAdImages); + + + // Remove Mouse Regions + MSYS_RemoveRegion( &gSelectedMemberCardRegion); + MSYS_RemoveRegion( &gSelectedPoliciesRegion); + MSYS_RemoveRegion( &gSelectedLinksRegion); + MSYS_RemoveRegion( &gSelectedHistoryRegion); + MSYS_RemoveRegion( &gSelectedBannerRegion); +} + +void HandleAIM() +{ + HandleAdAndWarningArea( gfInitAdArea, FALSE ); + gfInitAdArea = FALSE; +} + +void RenderAIM() +{ + HVOBJECT hMemberCardHandle; + HVOBJECT hPoliciesHandle; + HVOBJECT hLinksHandle; + HVOBJECT hHistoryHandle; +// UINT16 x,y, uiPosX, uiPosY; + + DrawAimDefaults(); + + //MemberCard + GetVideoObject(&hMemberCardHandle, guiMemberCard); + BltVideoObject(FRAME_BUFFER, hMemberCardHandle, 0,MEMBERCARD_X, MEMBERCARD_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //Policies + GetVideoObject(&hPoliciesHandle, guiPolicies); + BltVideoObject(FRAME_BUFFER, hPoliciesHandle, 0,POLICIES_X, POLICIES_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //Links + GetVideoObject(&hLinksHandle, guiLinks); + BltVideoObject(FRAME_BUFFER, hLinksHandle, 0,LINKS_X, LINKS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //History + GetVideoObject(&hHistoryHandle, guiHistory); + BltVideoObject(FRAME_BUFFER, hHistoryHandle, 0,HISTORY_X, HISTORY_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // Draw the aim slogan under the symbol + DisplayAimSlogan(); + + DisplayAimCopyright(); + + //Draw text under boxes + // members + DrawTextToScreen(AimBottomMenuText[AIM_MEMBERS], MEMBERCARD_X, MEMBERS_TEXT_Y, LINK_SIZE_X, FONT12ARIAL, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + // Policies + DrawTextToScreen(AimBottomMenuText[AIM_POLICIES], POLICIES_X, POLICIES_TEXT_Y, LINK_SIZE_X, FONT12ARIAL, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + // History + DrawTextToScreen(AimBottomMenuText[AIM_HISTORY], HISTORY_X, HISTORY_TEXT_Y, LINK_SIZE_X, FONT12ARIAL, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + // Links + DrawTextToScreen(AimBottomMenuText[AIM_LINKS], LINKS_X, LINK_TEXT_Y, LINK_SIZE_X, FONT12ARIAL, AIM_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + HandleAdAndWarningArea( gfInitAdArea, TRUE ); + + RenderWWWProgramTitleBar( ); + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + +void SelectMemberCardRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if(!fFirstTimeIn) + guiCurrentLaptopMode = LAPTOP_MODE_AIM_MEMBERS_SORTED_FILES; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + +void SelectPoliciesRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_AIM_POLICIES; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + +void SelectHistoryRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_AIM_HISTORY; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + + +void SelectLinksRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_AIM_LINKS; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + + +BOOLEAN InitAimDefaults() +{ + VOBJECT_DESC VObjectDesc; + + // load the Rust bacground graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\rustbackground.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiRustBackGround)); + + // load the Aim Symbol graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_AIMSYMBOL ); + CHECKF(AddVideoObject(&VObjectDesc, &guiAimSymbol)); + + //Mouse region for the Links + MSYS_DefineRegion( &gSelectedAimLogo, AIM_SYMBOL_X, AIM_SYMBOL_Y, AIM_SYMBOL_X+AIM_SYMBOL_WIDTH, AIM_SYMBOL_Y+AIM_SYMBOL_HEIGHT, MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectAimLogoRegionCallBack); + MSYS_AddRegion(&gSelectedAimLogo); + + + return(TRUE); +} + +BOOLEAN RemoveAimDefaults() +{ + DeleteVideoObjectFromIndex(guiRustBackGround); + DeleteVideoObjectFromIndex(guiAimSymbol); + MSYS_RemoveRegion( &gSelectedAimLogo); + + return(TRUE); +} + +BOOLEAN DrawAimDefaults() +{ + HVOBJECT hRustBackGroundHandle; + HVOBJECT hAimSymbolHandle; + UINT16 x,y, uiPosX, uiPosY; + + // Blt the rust background + GetVideoObject(&hRustBackGroundHandle, guiRustBackGround); + + uiPosY = RUSTBACKGROUND_1_Y; + for(y=0; y<4; y++) + { + uiPosX = RUSTBACKGROUND_1_X; + for(x=0; x<4; x++) + { + BltVideoObject(FRAME_BUFFER, hRustBackGroundHandle, 0,uiPosX, uiPosY, VO_BLT_SRCTRANSPARENCY,NULL); + uiPosX += RUSTBACKGROUND_SIZE_X; + } + uiPosY += RUSTBACKGROUND_SIZE_Y; + } + + // Aim Symbol + GetVideoObject(&hAimSymbolHandle, guiAimSymbol); + BltVideoObject(FRAME_BUFFER, hAimSymbolHandle, 0,AIM_SYMBOL_X, AIM_SYMBOL_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + return(TRUE); +} + + +void SelectAimLogoRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_AIM; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + + + +BOOLEAN DisplayAimSlogan() +{ + wchar_t sSlogan[400]; + + LoadEncryptedDataFromFile(AIMHISTORYFILE, sSlogan, 0, AIM_HISTORY_LINE_SIZE); + //Display Aim Text under the logo + DisplayWrappedString(AIM_LOGO_TEXT_X, AIM_LOGO_TEXT_Y, AIM_LOGO_TEXT_WIDTH, 2, AIM_LOGO_FONT, AIM_FONT_MCOLOR_WHITE, sSlogan, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + return(TRUE); +} + + + +BOOLEAN DisplayAimCopyright() +{ + wchar_t sSlogan[400]; + UINT32 uiStartLoc=0; + + //Load and Display the copyright notice + + uiStartLoc = AIM_HISTORY_LINE_SIZE * AIM_COPYRIGHT_1; + LoadEncryptedDataFromFile(AIMHISTORYFILE, sSlogan, uiStartLoc, AIM_HISTORY_LINE_SIZE); + DrawTextToScreen(sSlogan, AIM_COPYRIGHT_X, AIM_COPYRIGHT_Y, AIM_COPYRIGHT_WIDTH, AIM_COPYRIGHT_FONT, FONT_MCOLOR_DKWHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + uiStartLoc = AIM_HISTORY_LINE_SIZE * AIM_COPYRIGHT_2; + LoadEncryptedDataFromFile(AIMHISTORYFILE, sSlogan, uiStartLoc, AIM_HISTORY_LINE_SIZE); + DrawTextToScreen(sSlogan, AIM_COPYRIGHT_X, AIM_COPYRIGHT_Y + AIM_COPYRIGHT_GAP, AIM_COPYRIGHT_WIDTH, AIM_COPYRIGHT_FONT, FONT_MCOLOR_DKWHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + uiStartLoc = AIM_HISTORY_LINE_SIZE * AIM_COPYRIGHT_3; + LoadEncryptedDataFromFile(AIMHISTORYFILE, sSlogan, uiStartLoc, AIM_HISTORY_LINE_SIZE); + DrawTextToScreen(sSlogan, AIM_COPYRIGHT_X, AIM_COPYRIGHT_Y + AIM_COPYRIGHT_GAP*2, AIM_COPYRIGHT_WIDTH, AIM_COPYRIGHT_FONT, FONT_MCOLOR_DKWHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + + return(TRUE); +} + +// Buttons +BOOLEAN InitAimMenuBar(void) +{ + UINT8 i; + UINT16 usPosX; + + guiBottomButtonImage = LoadButtonImage("LAPTOP\\BottomButtons2.sti", -1,0,-1,1,-1 ); + + usPosX = BOTTOM_BUTTON_START_X; + for(i=0; iuiFlags |= BUTTON_CLICKED_ON; + + gubAimMenuButtonDown = (UINT8)MSYS_GetBtnUserData( btn, 1 ); + InvalidateRegion(BOTTOM_BUTTON_START_X,BOTTOM_BUTTON_START_Y,BOTTOM_BUTTON_END_X,BOTTOM_BUTTON_END_Y); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + ResetAimButtons(guiBottomButtons, NUM_AIM_BOTTOMBUTTONS); + + guiCurrentLaptopMode = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + InvalidateRegion(BOTTOM_BUTTON_START_X,BOTTOM_BUTTON_START_Y,BOTTOM_BUTTON_END_X,BOTTOM_BUTTON_END_Y); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(BOTTOM_BUTTON_START_X,BOTTOM_BUTTON_START_Y,BOTTOM_BUTTON_END_X,BOTTOM_BUTTON_END_Y); + } + DisableAimButton(); +} + + +void ResetAimButtons(UINT32 *Buttons, UINT16 uNumberOfButtons) +{ + UINT32 cnt; + + for ( cnt = 0; cnt < uNumberOfButtons; cnt++ ) + { + ButtonList[ Buttons[ cnt ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + } +} + +void DisableAimButton() +{ + int i=0; + + for(i=0; iuiFlags |= BUTTON_CLICKED_ON; + } +} + +void HandleAdAndWarningArea( BOOLEAN fInit, BOOLEAN fRedraw ) +{ + static UINT8 ubPreviousAdvertisment; + + if( fInit ) + gubCurrentAdvertisment = AIM_AD_WARNING_BOX; + else + { + if( ubPreviousAdvertisment == AIM_AD_DONE ) + { + gubCurrentAdvertisment = GetNextAimAd( gubCurrentAdvertisment ); + + fInit = TRUE; + +/* + UINT32 uiDay = GetWorldDay(); + BOOLEAN fSkip=FALSE; + gubCurrentAdvertisment++; + + //if the add should be for Bobby rays + if( gubCurrentAdvertisment == AIM_AD_BOBBY_RAY_AD ) + { + //if the player has NOT ever been to drassen + if( !LaptopSaveInfo.fBobbyRSiteCanBeAccessed ) + { + //advance to the next add + gubCurrentAdvertisment++; + } + else + { + fSkip = TRUE; + fInit = TRUE; + } + } + else + fSkip = FALSE; + + + if( !fSkip ) + { + //if the current ad is not supposed to be available, loop back to the first ad + switch( gubCurrentAdvertisment ) + { + case AIM_AD_FUNERAL_ADS: + if( uiDay < AIM_AD_DAY_FUNERAL_AD_STARTS ) + gubCurrentAdvertisment = AIM_AD_WARNING_BOX; + break; + + case AIM_AD_FLOWER_SHOP: + if( uiDay < AIM_AD_DAY_FLOWER_AD_STARTS ) + gubCurrentAdvertisment = AIM_AD_WARNING_BOX; + break; + + case AIM_AD_INSURANCE_AD: + if( uiDay < AIM_AD_DAY_INSURANCE_AD_STARTS ) + gubCurrentAdvertisment = AIM_AD_WARNING_BOX; + break; + } + fInit = TRUE; + } +*/ + } + + if( gubCurrentAdvertisment >= AIM_AD_LAST_AD) + { + gubCurrentAdvertisment = AIM_AD_WARNING_BOX; + } + } + + switch( gubCurrentAdvertisment ) + { + case AIM_AD_WARNING_BOX: + MSYS_DisableRegion(&gSelectedBannerRegion); + ubPreviousAdvertisment = DrawWarningBox( fInit, fRedraw ); + break; + + case AIM_AD_FLOWER_SHOP: + ubPreviousAdvertisment = DisplayFlowerAd( fInit, fRedraw ); + break; + + case AIM_AD_FOR_ADS: + // disable the region because only certain banners will be 'clickable' + MSYS_DisableRegion(&gSelectedBannerRegion); + ubPreviousAdvertisment = DisplayAd( fInit, fRedraw, AIM_AD_FOR_ADS_DELAY, AIM_AD_FOR_ADS__NUM_SUBIMAGES, guiAdForAdsImages ); + break; + + case AIM_AD_INSURANCE_AD: + MSYS_EnableRegion(&gSelectedBannerRegion); + ubPreviousAdvertisment = DisplayAd( fInit, fRedraw, AIM_AD_INSURANCE_AD_DELAY, AIM_AD_INSURANCE_AD__NUM_SUBIMAGES, guiInsuranceAdImages ); + break; + + case AIM_AD_FUNERAL_ADS: + MSYS_EnableRegion(&gSelectedBannerRegion); + ubPreviousAdvertisment = DisplayAd( fInit, fRedraw, AIM_AD_FUNERAL_AD_DELAY, AIM_AD_FUNERAL_AD__NUM_SUBIMAGES, guiFuneralAdImages ); + break; + + case AIM_AD_BOBBY_RAY_AD: + MSYS_EnableRegion(&gSelectedBannerRegion); +// ubPreviousAdvertisment = DisplayAd( fInit, fRedraw, AIM_AD_BOBBYR_AD_DELAY, AIM_AD_BOBBYR_AD__NUM_SUBIMAGES, guiBobbyRAdImages ); + ubPreviousAdvertisment = DisplayBobbyRAd( fInit, fRedraw ); + break; + } +} + + + +BOOLEAN DisplayFlowerAd( BOOLEAN fInit, BOOLEAN fRedraw ) +{ + static UINT32 uiLastTime; + static UINT8 ubSubImage=0; + static UINT8 ubCount=0; + UINT32 uiCurTime = GetJA2Clock(); + + if( fInit ) + { + uiLastTime = 0; + ubSubImage = 0; + ubCount = 0; + MSYS_EnableRegion(&gSelectedBannerRegion); + } + + if( ((uiCurTime - uiLastTime) > AIM_FLOWER_AD_DELAY) || fRedraw) + { + HVOBJECT hAdHandle; + + if( ubSubImage == AIM_FLOWER_NUM_SUBIMAGES) + { + if(ubCount == 0 || fRedraw) + { + //Blit the blue sky frame with text on top + GetVideoObject(&hAdHandle, guiFlowerAdvertisement); + BltVideoObject(FRAME_BUFFER, hAdHandle, 0,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // redraw new mail warning, and create new mail button, if nessacary + fReDrawNewMailFlag = TRUE; + + //Display Aim Warning Text + DisplayWrappedString(AIM_WARNING_TEXT_X, AIM_WARNING_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, FONT14ARIAL, FONT_GREEN, AimScreenText[AIM_INFO_6], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Display Aim Warning Text + SetFontShadow( FONT_MCOLOR_WHITE ); + DisplayWrappedString(AIM_WARNING_TEXT_X, AIM_FLOWER_LINK_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, FONT12ARIAL, 2, AimScreenText[AIM_INFO_7], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + SetFontShadow( DEFAULT_SHADOW ); + + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + } + + uiLastTime = GetJA2Clock(); + + ubCount++; + if( ubCount > 40 ) + { + return( AIM_AD_DONE ); + } + else + return( AIM_AD_NOT_DONE ); + + } + else + { + GetVideoObject(&hAdHandle, guiFlowerAdvertisement); + BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // redraw new mail warning, and create new mail button, if nessacary + fReDrawNewMailFlag = TRUE; + + ubSubImage++; + } + + uiLastTime = GetJA2Clock(); + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + } + return( AIM_AD_NOT_DONE ); +} + + +BOOLEAN DrawWarningBox( BOOLEAN fInit, BOOLEAN fRedraw ) +{ + static UINT32 uiLastTime; + static UINT8 ubSubImage=0; + UINT32 uiCurTime = GetJA2Clock(); + + + if( fInit || fRedraw) + { + wchar_t sText[400]; + UINT32 uiStartLoc=0; + UINT16 usLocY = AIM_WARNING_TEXT_Y + (GetFontHeight(AIM_WARNING_FONT) + 2) * 2; + HVOBJECT hWarningHandle; + + //Warning + GetVideoObject(&hWarningHandle, guiWarning); + BltVideoObject(FRAME_BUFFER, hWarningHandle, 0,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + uiStartLoc = AIM_HISTORY_LINE_SIZE * AIM_WARNING_1; + LoadEncryptedDataFromFile(AIMHISTORYFILE, sText, uiStartLoc, AIM_HISTORY_LINE_SIZE); + + //Display Aim Warning Text + DisplayWrappedString(AIM_WARNING_TEXT_X, AIM_WARNING_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, AIM_WARNING_FONT, FONT_RED, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + + // redraw new mail warning, and create new mail button, if nessacary + fReDrawNewMailFlag = TRUE; + + if( fInit ) + uiLastTime = uiCurTime; + } + + if( (uiCurTime - uiLastTime) > AIM_WARNING_TIME) + return(AIM_AD_DONE); + else + { + return(AIM_AD_NOT_DONE); + } +} + +void SelectBannerRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( gubCurrentAdvertisment == AIM_AD_FLOWER_SHOP ) + GoToWebPage( FLORIST_BOOKMARK ); + else if( gubCurrentAdvertisment == AIM_AD_INSURANCE_AD ) + GoToWebPage( INSURANCE_BOOKMARK ); + else if( gubCurrentAdvertisment == AIM_AD_FUNERAL_ADS ) + GoToWebPage( FUNERAL_BOOKMARK ); + else if( gubCurrentAdvertisment == AIM_AD_BOBBY_RAY_AD ) + GoToWebPage( BOBBYR_BOOKMARK ); + + + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + + + +BOOLEAN DisplayAd( BOOLEAN fInit, BOOLEAN fRedraw, UINT16 usDelay, UINT16 usNumberOfSubImages, UINT32 uiAdImageIdentifier ) +{ + static UINT32 uiLastTime; + static UINT8 ubSubImage=0; + static UINT8 ubCount=0; + UINT32 uiCurTime = GetJA2Clock(); + UINT8 ubRetVal = 0; + + if( fInit ) + { + uiLastTime = 0; + ubSubImage = 0; + ubCount = 0; + } + + if( ((uiCurTime - uiLastTime) > usDelay) || fRedraw) + { + HVOBJECT hAdHandle; + + if( ubSubImage == 0 ) + { + if(ubCount == 0 || fRedraw) + { + //Blit the ad + GetVideoObject(&hAdHandle, uiAdImageIdentifier); + BltVideoObject(FRAME_BUFFER, hAdHandle, 0,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // redraw new mail warning, and create new mail button, if nessacary + fReDrawNewMailFlag = TRUE; + + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + } + + uiLastTime = GetJA2Clock(); + + //display first frame longer then rest + ubCount++; + if( ubCount > 12 ) + { + ubCount=0; + ubSubImage++; + } + + ubRetVal = AIM_AD_NOT_DONE; + + } + else if( ubSubImage == usNumberOfSubImages-1 ) + { + if(ubCount == 0 || fRedraw) + { + //Blit the ad + GetVideoObject(&hAdHandle, uiAdImageIdentifier); + BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // redraw new mail warning, and create new mail button, if nessacary + fReDrawNewMailFlag = TRUE; + + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + } + + uiLastTime = GetJA2Clock(); + + //display first frame longer then rest + ubCount++; + if( ubCount > 12 ) + { + ubRetVal = AIM_AD_DONE; + } + } + else + { + GetVideoObject(&hAdHandle, uiAdImageIdentifier); + BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // redraw new mail warning, and create new mail button, if nessacary + fReDrawNewMailFlag = TRUE; + + ubSubImage++; + } + + //if the add it to have text on it, then put the text on it. + HandleTextOnAimAdd( ubSubImage ); + + uiLastTime = GetJA2Clock(); + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + } + return( ubRetVal ); +} + +void HandleTextOnAimAdd( UINT8 ubCurSubImage ) +{ + switch( gubCurrentAdvertisment ) + { + case AIM_AD_WARNING_BOX: + break; + + case AIM_AD_FLOWER_SHOP: + break; + + case AIM_AD_FOR_ADS: + break; + + case AIM_AD_INSURANCE_AD: + break; + + case AIM_AD_FUNERAL_ADS: + break; + + case AIM_AD_BOBBY_RAY_AD: + + //if the subimage is the first couple + if( ubCurSubImage <= AIM_AD_BOBBYR_AD_NUM_DUCK_SUBIMAGES ) + { + //Display Aim Warning Text + SetFontShadow( 2 ); + DisplayWrappedString(AIM_BOBBYR1_LINK_TEXT_X, AIM_BOBBYR1_LINK_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, BOBBYR_UNDER_CONSTRUCTION_AD_FONT, BOBBYR_UNDER_CONSTRUCTION_AD_COLOR, AimScreenText[AIM_BOBBYR_ADD1], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED | INVALIDATE_TEXT ); + SetFontShadow( DEFAULT_SHADOW ); + } + + + else if( ubCurSubImage >= AIM_AD_BOBBYR_AD__NUM_SUBIMAGES-5 ) + { + //Display Aim Warning Text + SetFontShadow( 2 ); + DisplayWrappedString(AIM_BOBBYR2_LINK_TEXT_X, AIM_BOBBYR2_LINK_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, BOBBYR_UNDER_CONSTRUCTION_AD_FONT, BOBBYR_UNDER_CONSTRUCTION_AD_COLOR, AimScreenText[AIM_BOBBYR_ADD2], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED | INVALIDATE_TEXT ) ; + SetFontShadow( DEFAULT_SHADOW ); + } +/* + else + { + //Display Aim Warning Text + SetFontShadow( 2 ); +// DisplayWrappedString( AIM_BOBBYR3_LINK_TEXT_X, AIM_BOBBYR3_LINK_TEXT_Y, AIM_WARNING_TEXT_WIDTH, 2, BOBBYR_UNDER_CONSTRUCTION_AD_FONT, FONT_MCOLOR_WHITE, AimScreenText[AIM_BOBBYR_ADD3], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED | INVALIDATE_TEXT ); + SetFontShadow( DEFAULT_SHADOW ); + } +*/ + break; + } +} + + + +BOOLEAN DisplayBobbyRAd( BOOLEAN fInit, BOOLEAN fRedraw ) +{ + static UINT32 uiLastTime; + static UINT8 ubSubImage=0; + static UINT8 ubDuckCount=0; + static UINT8 ubCount=0; + UINT32 uiCurTime = GetJA2Clock(); + UINT8 ubRetVal = 0; + UINT16 usDelay = AIM_AD_BOBBYR_AD_DELAY; + + + if( fInit ) + { + ubDuckCount = 0; + uiLastTime = 0; + ubSubImage = 0; + ubCount = 0; + } + + if( ((uiCurTime - uiLastTime) > usDelay) || fRedraw) + { + HVOBJECT hAdHandle; + + //Loop through the first 6 images twice, then start into the later ones + GetVideoObject(&hAdHandle, guiBobbyRAdImages); + + //if we are still looping through the first 6 animations + if( ubDuckCount < 2 ) + { + BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage, WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + ubSubImage ++; + + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + + // if we do the first set of images + if( ubSubImage > AIM_AD_BOBBYR_AD_NUM_DUCK_SUBIMAGES ) + { + ubDuckCount++; + + if( ubDuckCount < 2 ) + ubSubImage = 0; + else + ubSubImage = AIM_AD_BOBBYR_AD_NUM_DUCK_SUBIMAGES+1; + } + ubRetVal = AIM_AD_NOT_DONE; + } + + else + { + //Blit the ad + BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + ubSubImage ++; + + if( ubSubImage >= AIM_AD_BOBBYR_AD__NUM_SUBIMAGES-1 ) + { + //display last frame longer then rest + ubCount++; + if( ubCount > 12 ) + { + ubRetVal = AIM_AD_DONE; + } + + ubSubImage = AIM_AD_BOBBYR_AD__NUM_SUBIMAGES - 1; + } + + // redraw new mail warning, and create new mail button, if nessacary + fReDrawNewMailFlag = TRUE; + + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + } + + //if the add it to have text on it, then put the text on it. + HandleTextOnAimAdd( ubSubImage ); + + + uiLastTime = GetJA2Clock(); + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + } + +/* + + if( ubDuckImage < AIM_AD_BOBBYR_AD_NUM_DUCK_SUBIMAGES ) + { + ubDuckImage++; + } + + GetVideoObject(&hAdHandle, guiBobbyRAdImages); + + if( ubDuckImage < AIM_AD_BOBBYR_AD_NUM_DUCK_SUBIMAGES * 2 ) + { + if( ubDuckImage >= AIM_AD_BOBBYR_AD_NUM_DUCK_SUBIMAGES ) + BltVideoObject(FRAME_BUFFER, hAdHandle, (UINT16)(ubDuckImage-AIM_AD_BOBBYR_AD_NUM_DUCK_SUBIMAGES), WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + else + BltVideoObject(FRAME_BUFFER, hAdHandle, ubDuckImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + ubDuckImage++; + } + else + ubSubImage = 5; + + + if( ubSubImage == 5 ) + { + if(ubCount == 0 || fRedraw) + { + //Blit the ad + BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // redraw new mail warning, and create new mail button, if nessacary + fReDrawNewMailFlag = TRUE; + + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + } + + uiLastTime = GetJA2Clock(); + + + ubRetVal = AIM_AD_NOT_DONE; + + } + else if( ubSubImage == AIM_AD_BOBBYR_AD__NUM_SUBIMAGES-1 ) + { + if(ubCount == 0 || fRedraw) + { + //Blit the ad + GetVideoObject(&hAdHandle, guiBobbyRAdImages); + BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // redraw new mail warning, and create new mail button, if nessacary + fReDrawNewMailFlag = TRUE; + + InvalidateRegion(AIM_AD_TOP_LEFT_X,AIM_AD_TOP_LEFT_Y, AIM_AD_BOTTOM_RIGHT_X ,AIM_AD_BOTTOM_RIGHT_Y); + } + + uiLastTime = GetJA2Clock(); + + //display last frame longer then rest + ubCount++; + if( ubCount > 12 ) + { + ubRetVal = AIM_AD_DONE; + } + } + else + { + GetVideoObject(&hAdHandle, guiBobbyRAdImages); + BltVideoObject(FRAME_BUFFER, hAdHandle, ubSubImage,WARNING_X, WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // redraw new mail warning, and create new mail button, if nessacary + fReDrawNewMailFlag = TRUE; + + ubSubImage++; + } +*/ + + return( ubRetVal ); +} + + +UINT8 GetNextAimAd( UINT8 ubCurrentAd ) +{ + UINT8 ubNextAd; + UINT32 uiDay = GetWorldDay(); + BOOLEAN fSkip=FALSE; + + if( ubCurrentAd == AIM_AD_WARNING_BOX ) + { + if( uiDay < AIM_AD_BOBBYR_AD_STARTS ) + { + //if the player has NOT ever been to drassen + if( !LaptopSaveInfo.fBobbyRSiteCanBeAccessed ) + { + ubNextAd = AIM_AD_FOR_ADS; + } + else + { + ubNextAd = AIM_AD_BOBBY_RAY_AD; + } + } + + else if( uiDay < AIM_AD_DAY_FUNERAL_AD_STARTS ) + ubNextAd = AIM_AD_FUNERAL_ADS; + + else if( uiDay < AIM_AD_DAY_FLOWER_AD_STARTS ) + ubNextAd = AIM_AD_FLOWER_SHOP; + + else //if( uiDay < AIM_AD_DAY_INSURANCE_AD_STARTS ) + ubNextAd = AIM_AD_INSURANCE_AD; + } + else + { + ubNextAd = AIM_AD_WARNING_BOX; + } + + return( ubNextAd ); +} + + + + + + + diff --git a/Laptop/aim.h b/Laptop/aim.h new file mode 100644 index 00000000..7995a778 --- /dev/null +++ b/Laptop/aim.h @@ -0,0 +1,105 @@ +#ifndef __AIM_H +#define __AIM_H + +#include "Cursors.h" + + +// +// AIM defines +// + + +#define AIMHISTORYFILE "BINARYDATA\\AimHist.edt" +#define AIM_HISTORY_LINE_SIZE 400 * 2 + +#define MAX_NUMBER_MERCS 40 +extern UINT8 AimMercArray[ MAX_NUMBER_MERCS ]; + +#define NUM_AIM_SCREENS 6 + +#define IMAGE_OFFSET_X LAPTOP_SCREEN_UL_X +#define IMAGE_OFFSET_Y LAPTOP_SCREEN_WEB_UL_Y + +#define AIM_LOGO_TEXT_X iScreenWidthOffset + 175 +#define AIM_LOGO_TEXT_Y iScreenHeightOffset + 101 +#define AIM_LOGO_TEXT_WIDTH 360 + +// Aim Symbol 203, 51 +#define AIM_SYMBOL_SIZE_X 203 +#define AIM_SYMBOL_SIZE_Y 51 + +//262, 28 +#define AIM_SYMBOL_X IMAGE_OFFSET_X + 149 +#define AIM_SYMBOL_Y IMAGE_OFFSET_Y + 3 +#define AIM_SYMBOL_WIDTH 203 +#define AIM_SYMBOL_HEIGHT 51 + +// RustBackGround +#define RUSTBACKGROUND_SIZE_X 125 +#define RUSTBACKGROUND_SIZE_Y 100 + +#define RUSTBACKGROUND_1_X IMAGE_OFFSET_X +#define RUSTBACKGROUND_1_Y IMAGE_OFFSET_Y + +//Bottom Buttons +#define NUM_AIM_BOTTOMBUTTONS 6 +#define BOTTOM_BUTTON_START_WIDTH 75 +#define BOTTOM_BUTTON_START_HEIGHT 18 +#define BOTTOM_BUTTON_START_X LAPTOP_SCREEN_UL_X + 25 + +#define BOTTOM_BUTTON_START_Y LAPTOP_SCREEN_WEB_LR_Y - BOTTOM_BUTTON_START_HEIGHT - 57 +#define BOTTOM_BUTTON_AMOUNT NUM_AIM_SCREENS +#define BOTTOM_BUTTON_GAP 0 +#define BOTTOM_BUTTON_TEXT_Y BOTTOM_BUTTON_START_Y + 6 +#define BOTTOM_BUTTON_END_X BOTTOM_BUTTON_START_X + BOTTOM_BUTTON_START_WIDTH * 6 +#define BOTTOM_BUTTON_END_Y BOTTOM_BUTTON_START_Y + BOTTOM_BUTTON_START_HEIGHT + +#define AIM_FONT10ROMAN FONT10ROMAN +#define AIM_FONT12ROMAN FONT12ROMAN +#define AIM_FONT14SANSERIF FONT14SANSERIF +#define AIM_LOGO_FONT FONT10ARIAL +#define AIM_COPYRIGHT_FONT FONT10ARIAL +#define AIM_WARNING_FONT FONT12ARIAL +#define AIM_FONT12ARIAL FONT12ARIAL +#define AIM_FONT_MCOLOR_WHITE FONT_MCOLOR_WHITE +#define IM_FONT_MCOLOR_DKRED FONT_MCOLOR_RED +#define AIM_GREEN 157 +#define AIM_MAINTITLE_COLOR AIM_GREEN +#define AIM_MAINTITLE_FONT FONT14ARIAL +#define AIM_BUTTON_ON_COLOR FONT_MCOLOR_DKWHITE +#define AIM_BUTTON_OFF_COLOR 138 +#define AIM_BUTTON_DISABLED_COLOR 141 +#define AIM_CONTENTBUTTON_WIDTH 205 +#define AIM_CONTENTBUTTON_HEIGHT 19 +#define AIM_FONT_GOLD 170 + +enum +{ + AIM_SLOGAN, + AIM_WARNING_1, + AIM_WARNING_2, + AIM_COPYRIGHT_1, + AIM_COPYRIGHT_2, + AIM_COPYRIGHT_3 +}; + +void GameInitAIM(); +BOOLEAN EnterAIM(); +void ExitAIM(); +void HandleAIM(); +void RenderAIM(); + +BOOLEAN ExitAimMenuBar(void); +BOOLEAN InitAimMenuBar(void); + +BOOLEAN RemoveAimDefaults(); +BOOLEAN InitAimDefaults(); +BOOLEAN DrawAimDefaults(); + +BOOLEAN DisplayAimSlogan(); +BOOLEAN DisplayAimCopyright(); + +void ResetAimButtons(UINT32 *Buttons, UINT16 uNumberOfButtons); +void DisableAimButton(); + +#endif diff --git a/Laptop/email.cpp b/Laptop/email.cpp new file mode 100644 index 00000000..83fd1d61 --- /dev/null +++ b/Laptop/email.cpp @@ -0,0 +1,5171 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "email.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "soldier profile.h" + #include "IMP Compile Character.h" + #include "IMP Voices.h" + #include "IMP Portraits.h" + #include "Game Clock.h" + #include "environment.h" + #include "AimMembers.h" + #include "Random.h" + #include "Text.h" +#endif + +//static EmailPtr pEmailList; +EmailPtr pEmailList; +static PagePtr pPageList; +static INT32 iLastPage=-1; +static INT32 iCurrentPage=0; +INT32 iDeleteId=0; +BOOLEAN fUnReadMailFlag=FALSE; +BOOLEAN fOldUnreadFlag=TRUE; +BOOLEAN fNewMailFlag=FALSE; +BOOLEAN fOldNewMailFlag=FALSE; +BOOLEAN fDisplayMessageFlag=FALSE; +BOOLEAN fOldDisplayMessageFlag=FALSE; +BOOLEAN fReDraw=FALSE; +BOOLEAN fDeleteMailFlag=FALSE; +BOOLEAN fReDrawMessageFlag = FALSE; +BOOLEAN fOnLastPageFlag=FALSE; +BOOLEAN fJustStartedEmail = FALSE; +BOOLEAN fDeleteInternal = FALSE; +BOOLEAN fOpenMostRecentUnReadFlag = FALSE; +INT32 iViewerPositionY=0; + +INT32 giMessageId = -1; +INT32 giPrevMessageId = -1; +INT32 giMessagePage = -1; +INT32 giNumberOfPagesToCurrentEmail = -1; +UINT32 guiEmailWarning; + +#define EMAIL_TOP_BAR_HEIGHT 22 + +#define LIST_MIDDLE_COUNT 18 +// object positions +#define TITLE_X 0+LAPTOP_SCREEN_UL_X +#define TITLE_Y 0+LAPTOP_SCREEN_UL_Y + +#define STAMP_X LAPTOP_SCREEN_UL_X +#define STAMP_Y LAPTOP_SCREEN_UL_Y +/* +#define TOP_X 0+LAPTOP_SCREEN_UL_X +#define TOP_Y 62+LAPTOP_SCREEN_UL_Y + +#define BOTTOM_X 0+LAPTOP_SCREEN_UL_X +#define BOTTOM_Y 359+LAPTOP_SCREEN_UL_Y +*/ +#define MIDDLE_X 0+LAPTOP_SCREEN_UL_X +#define MIDDLE_Y iScreenHeightOffset + 72 + EMAIL_TOP_BAR_HEIGHT +#define MIDDLE_WIDTH 19 + + +// new graphics +#define EMAIL_LIST_WINDOW_Y iScreenHeightOffset + 22 +#define EMAIL_TITLE_BAR_X iScreenWidthOffset + 5 + +// email columns +#define SENDER_X LAPTOP_SCREEN_UL_X+65 +#define SENDER_WIDTH 246-158 + +#define DATE_X LAPTOP_SCREEN_UL_X+428 +#define DATE_WIDTH 592-527 + +#define SUBJECT_X LAPTOP_SCREEN_UL_X+175 +#define SUBJECT_WIDTH 254 +#define INDIC_X iScreenWidthOffset + 128 +#define INDIC_WIDTH 155-123 +#define INDIC_HEIGHT 145-128 + +#define LINE_WIDTH 592-121 + +#define MESSAGE_WIDTH 528 - 125 +#define MESSAGE_COLOR FONT_BLACK +#define MESSAGE_GAP 2 + +#define MESSAGE_HEADER_WIDTH 209-151 +#define MESSAGE_HEADER_X VIEWER_X+4 + +#define VIEWER_HEAD_X iScreenWidthOffset + 140 +#define VIEWER_HEAD_Y iScreenHeightOffset + 9 +#define VIEWER_HEAD_WIDTH 445-VIEWER_HEAD_X +#define MAX_BUTTON_COUNT 1 +#define VIEWER_WIDTH 500 +#define VIEWER_HEIGHT 195 + +#define MESSAGEX_X iScreenWidthOffset + 425 +#define MESSAGEX_Y iScreenHeightOffset + 6 + +#define EMAIL_WARNING_X iScreenWidthOffset + 210 +#define EMAIL_WARNING_Y iScreenHeightOffset + 140 +#define EMAIL_WARNING_WIDTH 254 +#define EMAIL_WARNING_HEIGHT 138 + +#define NEW_BTN_X EMAIL_WARNING_X +(338-245) +#define NEW_BTN_Y EMAIL_WARNING_Y +(278-195) + +#define EMAIL_TEXT_FONT FONT10ARIAL +#define TRAVERSE_EMAIL_FONT FONT14ARIAL +#define EMAIL_BOX_FONT FONT14ARIAL +#define MESSAGE_FONT EMAIL_TEXT_FONT +#define EMAIL_HEADER_FONT FONT14ARIAL +#define EMAIL_WARNING_FONT FONT12ARIAL + + +// the max number of pages to an email +#define MAX_NUMBER_EMAIL_PAGES 100 + +#define PREVIOUS_PAGE 0 +#define NEXT_PAGE 1 + +#define NEXT_PAGE_X LAPTOP_UL_X + 562 +#define NEXT_PAGE_Y iScreenHeightOffset + 51 + +#define PREVIOUS_PAGE_X NEXT_PAGE_X - 21 +#define PREVIOUS_PAGE_Y NEXT_PAGE_Y + +#define ENVELOPE_BOX_X iScreenWidthOffset + 116 + +#define FROM_BOX_X iScreenWidthOffset + 166 +#define FROM_BOX_WIDTH 246-160 + +#define SUBJECT_BOX_X iScreenWidthOffset + 276 +#define SUBJECT_BOX_WIDTH 528-249 + +#define DATE_BOX_X iScreenWidthOffset + 530 +#define DATE_BOX_WIDTH 594-530 + +#define FROM_BOX_Y iScreenHeightOffset + 51 + EMAIL_TOP_BAR_HEIGHT +#define TOP_HEIGHT 118-95 + +#define EMAIL_TITLE_FONT FONT14ARIAL +#define EMAIL_TITLE_X iScreenWidthOffset + 140 +#define EMAIL_TITLE_Y iScreenHeightOffset + 33 +#define VIEWER_MESSAGE_BODY_START_Y VIEWER_Y+72 +#define MIN_MESSAGE_HEIGHT_IN_LINES 5 + + +#define INDENT_Y_OFFSET 310 +#define INDENT_X_OFFSET 325 +#define INDENT_X_WIDTH 544 - 481 + +// the position of the page number being displayed in the email program +#define PAGE_NUMBER_X iScreenWidthOffset + 516 +#define PAGE_NUMBER_Y iScreenHeightOffset + 58 + +// defines for location of message 'title'/'headers' + +#define MESSAGE_FROM_Y VIEWER_Y+28 + +#define MESSAGE_DATE_Y MESSAGE_FROM_Y + +#define MESSAGE_SUBJECT_Y MESSAGE_DATE_Y+16 + + +#define SUBJECT_LINE_X VIEWER_X+47 +#define SUBJECT_LINE_Y VIEWER_Y+42 +#define SUBJECT_LINE_WIDTH 278-47 + + +// maximum size of a email message page, so not to overrun the bottom of the screen +#define MAX_EMAIL_MESSAGE_PAGE_SIZE ( GetFontHeight( MESSAGE_FONT ) + MESSAGE_GAP ) * 20 +enum{ + PREVIOUS_BUTTON=0, + NEXT_BUTTON, +}; + + +// X button position +#define BUTTON_X VIEWER_X + 396 +#define BUTTON_Y VIEWER_Y + 3 +#define BUTTON_LOWER_Y BUTTON_Y + 22 +#define PREVIOUS_PAGE_BUTTON_X VIEWER_X + 302 +#define NEXT_PAGE_BUTTON_X VIEWER_X +395 +#define DELETE_BUTTON_X NEXT_PAGE_BUTTON_X +#define LOWER_BUTTON_Y BUTTON_Y + 299 + + +BOOLEAN fSortDateUpwards = FALSE; +BOOLEAN fSortSenderUpwards = FALSE; +BOOLEAN fSortSubjectUpwards = FALSE; +BOOLEAN gfPageButtonsWereCreated = FALSE; + +// mouse regions +MOUSE_REGION pEmailRegions[MAX_MESSAGES_PAGE]; +extern MOUSE_REGION pScreenMask; // symbol already defined in laptop.cpp (jonathanl) +MOUSE_REGION pDeleteScreenMask; + +// the email info struct to speed up email +EmailPageInfoStruct pEmailPageInfo[ MAX_NUMBER_EMAIL_PAGES ]; + +//buttons +INT32 giMessageButton[MAX_BUTTON_COUNT]; +INT32 giMessageButtonImage[MAX_BUTTON_COUNT]; +INT32 giDeleteMailButton[2]; +INT32 giDeleteMailButtonImage[2]; +INT32 giSortButton[4]; +INT32 giSortButtonImage[4]; +INT32 giNewMailButton[1]; +INT32 giNewMailButtonImage[1]; +INT32 giMailMessageButtons[3]; +INT32 giMailMessageButtonsImage[3]; +INT32 giMailPageButtons[ 2 ]; +INT32 giMailPageButtonsImage[ 2 ]; + + +// mouse regions +MOUSE_REGION pEmailMoveRegions[NEXT_BUTTON+1]; +MOUSE_REGION pSortMailRegions[3]; + +// the message record list, for the currently displayed message +RecordPtr pMessageRecordList=NULL; + +// video handles +UINT32 guiEmailTitle; +UINT32 guiEmailStamp; +UINT32 guiEmailBackground; +UINT32 guiEmailIndicator; +UINT32 guiEmailMessage; +UINT32 guiMAILDIVIDER; + + + +// the enumeration of headers +enum{ + FROM_HEADER=0, + SUBJECT_HEADER, + RECD_HEADER, +}; + + +// position of header text on the email list +#define FROM_X iScreenWidthOffset + 205 +#define FROM_Y FROM_BOX_Y + 5 +#define SUBJECTHEAD_X iScreenWidthOffset + 368 +#define RECD_X iScreenWidthOffset + 550 + +// size of prev/next strings +#define PREVIOUS_WIDTH StringPixLength(pTraverseStrings[PREVIOUS_BUTTON], TRAVERSE_EMAIL_FONT) +#define NEXT_WIDTH StringPixLength(pTraverseStrings[NEXT_BUTTON], TRAVERSE_EMAIL_FONT) +#define PREVIOUS_HEIGHT GetFontHeight(TRAVERSE_EMAIL_FONT) +#define NEXT_HEIGHT GetFontHeight(TRAVERSE_EMAIL_FONT) + + +// current line in the email list that is highlighted, -1 is no line highlighted +INT32 iHighLightLine=-1; + +// whther or not we need to redraw the new mail box +BOOLEAN fReDrawNewMailFlag = FALSE; +INT32 giNumberOfMessageToEmail = 0; +INT32 iTotalHeight = 0; + +// function list +void SwapMessages(INT32 iIdA, INT32 iIdB); +void PlaceMessagesinPages(); +BOOLEAN fFirstTime=TRUE; +void EmailBtnCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void EmailMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void PreviousRegionButtonCallback(GUI_BUTTON *btn,INT32 reason); +void NextRegionButtonCallback(GUI_BUTTON *btn,INT32 reason); +void SetUnNewMessages(); +INT32 DisplayEmailMessage(EmailPtr pMail); +void AddDeleteRegionsToMessageRegion(INT32 iViewerY); +void DetermineNextPrevPageDisplay(); +void CreateDestroyNextPreviousRegions(); +void ReDraw(); +void DeleteEmail(); +BOOLEAN DisplayDeleteNotice(EmailPtr pMail); +void CreateDestroyDeleteNoticeMailButton(); +void SetUpSortRegions(); +void DeleteSortRegions(); +void DisplayTextOnTitleBar( void ); +void DisplayEmailMessageSubjectDateFromLines( EmailPtr pMail, INT32 iViewerY ); +void DrawEmailMessageDisplayTitleText( INT32 iViewerY ); +void CreateMailScreenButtons( void ); +void DestroyMailScreenButtons( void ); +void DrawLineDividers( void ); +void FromCallback(GUI_BUTTON *btn, INT32 iReason ); +void SubjectCallback(GUI_BUTTON *btn, INT32 iReason ); +void DateCallback(GUI_BUTTON *btn, INT32 iReason ); +void ReadCallback(GUI_BUTTON *btn, INT32 iReason ); +void BtnPreviousEmailPageCallback(GUI_BUTTON *btn,INT32 reason); +void BtnNextEmailPageCallback(GUI_BUTTON *btn,INT32 reason); +void DisplayEmailList(); +void ClearOutEmailMessageRecordsList( void ); +void AddEmailRecordToList( STR16 pString ); +void UpDateMessageRecordList( void ); +void HandleAnySpecialEmailMessageEvents(INT32 iMessageId ); +BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail ); +void HandleIMPCharProfileResultsMessage( void ); +void HandleEmailViewerButtonStates( void ); +void SetUpIconForButton( void ); +void DeleteCurrentMessage( void ); +void BtnDeleteCallback(GUI_BUTTON *btn, INT32 iReason ); +void CreateNextPreviousEmailPageButtons( void ); +void UpdateStatusOfNextPreviousButtons( void ); +void DisplayWhichPageOfEmailProgramIsDisplayed( void ); +void OpenMostRecentUnreadEmail( void ); +BOOLEAN DisplayNumberOfPagesToThisEmail( INT32 iViewerY ); +INT32 GetNumberOfPagesToEmail( ); +void PreProcessEmail( EmailPtr pMail ); +void ModifyInsuranceEmails( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail, UINT8 ubNumberOfRecords ); +BOOLEAN ReplaceMercNameAndAmountWithProperData( CHAR16 *pFinishedString, EmailPtr pMail ); + + + +void InitializeMouseRegions() +{ + INT32 iCounter=0; + + // init mouseregions + for(iCounter=0; iCounter iId >iId) + iId=pEmail->iId; + pEmail=pEmail->Next; + } + } + + // reset pEmail + pEmail=pEmailList; + + // move to end of list + if( pEmail ) + { + while( pEmail -> Next) + pEmail = pEmail -> Next; + } + + // add new element onto list + pTempEmail = (EmailPtr) MemAlloc(sizeof(Email)); + // add in strings + //while(pMessage !=NULL) + //{ + //pTempEmail->pText[iCounter]=MemAlloc((wcslen(pMessage->pString)+2)*2); + //wcscpy(pTempEmail->pText[iCounter],pMessage->pString); + //pMessage=pMessage->Next; + //iCounter++; + //} + //pTempEmail->pText[iCounter]=NULL; + + // copy subject + pTempEmail->pSubject = (STR16) MemAlloc( 128 * 2 ); + memset( pTempEmail->pSubject, 0, sizeof( CHAR16 ) * 128 ); + wcscpy(pTempEmail->pSubject,pSubject); + + // copy offset and length of the actual message in email.edt + pTempEmail->usOffset =(UINT16)iMessageOffset; + pTempEmail->usLength =(UINT16)iMessageLength; + + // null out last byte of subject + pTempEmail->pSubject[wcslen(pSubject)+1]=0; + + + // set date and sender, Id + if(pEmail) + pTempEmail->iId=iId+1; + else + pTempEmail->iId=0; + + // copy date and sender id's + pTempEmail->iDate=iDate; + pTempEmail->ubSender=ubSender; + + // the special data + pTempEmail->iFirstData = iFirstData; + pTempEmail->uiSecondData = uiSecondData; + + // place into list + if(pEmail) + { + // list exists, place at end + pEmail->Next=pTempEmail; + pTempEmail->Prev=pEmail; + } + else + { + // no list, becomes head of a new list + pEmail=pTempEmail; + pTempEmail->Prev=NULL; + pEmailList=pEmail; + } + + // reset Next ptr + pTempEmail->Next=NULL; + + // set flag that new mail has arrived + fNewMailFlag=TRUE; + + // add this message to the pages of email + AddMessageToPages(pTempEmail->iId); + + // reset read flag of this particular message + pTempEmail->fRead=fAlreadyRead; + + // set fact this message is new + pTempEmail->fNew=TRUE; + return; +} + + +void RemoveEmailMessage(INT32 iId) +{ + // run through list and remove message, update everyone afterwards + EmailPtr pEmail=pEmailList; + EmailPtr pTempEmail=NULL; + INT32 iCounter=0; + + + // error check + if(!pEmail) + return; + + // look for message + pEmail = GetEmailMessage( iId ); + //while((pEmail->iId !=iId)&&(pEmail -> Next)) + // pEmail=pEmail->Next; + + // end of list, no mail found, leave + if(!pEmail) + return; + // found + + // set tempt o current + pTempEmail=pEmail; + + // check position of message in list + if((pEmail->Prev)&&(pTempEmail->Next)) + { + // in the middle of the list + pEmail=pEmail->Prev; + pTempEmail=pTempEmail->Next; + MemFree(pEmail->Next->pSubject); + //while(pEmail->Next->pText[iCounter]) + //{ + //MemFree(pEmail->Next->pText[iCounter]); + //iCounter++; + //} + MemFree(pEmail->Next); + pEmail->Next=pTempEmail; + pTempEmail->Prev=pEmail; + } + else if(pEmail->Prev) + { + // end of the list + pEmail=pEmail->Prev; + MemFree(pEmail->Next->pSubject); + //while(pEmail->Next->pText[iCounter]) + //{ + //MemFree(pEmail->Next->pText[iCounter]); + //iCounter++; + //} + MemFree(pEmail->Next); + pEmail->Next=NULL; + } + else if(pTempEmail->Next) + { + // beginning of the list + pEmail=pTempEmail; + pTempEmail=pTempEmail->Next; + MemFree(pEmail->pSubject); + //while(pEmail->pText[iCounter]) + //{ + //MemFree(pEmail->pText[iCounter]); + //iCounter++; + //} + MemFree(pEmail); + pTempEmail->Prev=NULL; + pEmailList=pTempEmail; + } + else + { + // all alone + MemFree(pEmail->pSubject); + // while(pEmail->pText[iCounter]) + //{ + //MemFree(pEmail->pText[iCounter]); + //iCounter++; + //} + MemFree(pEmail); + pEmailList=NULL; + } +} + +EmailPtr GetEmailMessage(INT32 iId) +{ + EmailPtr pEmail=pEmailList; + // return pointer to message with iId + + // invalid id + if(iId==-1) + return NULL; + + // invalid list + if( pEmail == NULL ) + { + return NULL; + } + + // look for message + while( (pEmail->iId !=iId)&&(pEmail->Next) ) + pEmail=pEmail->Next; + + if( ( pEmail ->iId != iId ) && ( pEmail->Next == NULL ) ) + { + pEmail = NULL; + } + + // no message, or is there? + if(!pEmail) + return NULL; + else + return pEmail; +} + + +void AddEmailPage() +{ + // simple adds a page to the list + PagePtr pPage=pPageList; + if(pPage) + { + while(pPage->Next) + pPage=pPage->Next; + } + + + if(pPage) + { + + // there is a page, add current page after it + pPage->Next = (pagemessages *) MemAlloc(sizeof(Page)); + pPage->Next->Prev=pPage; + pPage=pPage->Next; + pPage->Next=NULL; + pPage->iPageId=pPage->Prev->iPageId+1; + memset(pPage->iIds, -1, sizeof(INT32) * MAX_MESSAGES_PAGE ); + } + else + { + + // page becomes head of page list + pPageList = (PagePtr) MemAlloc(sizeof(Page)); + pPage=pPageList; + pPage->Prev=NULL; + pPage->Next=NULL; + pPage->iPageId=0; + memset(pPage->iIds, -1, sizeof(INT32) * MAX_MESSAGES_PAGE ); + pPageList=pPage; + } + iLastPage++; + return; + +} + + +void RemoveEmailPage(INT32 iPageId) +{ + PagePtr pPage=pPageList; + PagePtr pTempPage=NULL; + + // run through list until page is matched, or out of pages + while((pPage->iPageId !=iPageId)&&(pPage)) + pPage=pPage->Next; + + // error check + if(!pPage) + return; + + + // found + pTempPage=pPage; + if((pPage->Prev)&&(pTempPage->Next)) + { + // in the middle of the list + pPage=pPage->Prev; + pTempPage=pTempPage->Next; + MemFree(pPage->Next); + pPage->Next=pTempPage; + pTempPage->Prev=pPage; + } + else if(pPage->Prev) + { + // end of the list + pPage=pPage->Prev; + MemFree(pPage->Next); + pPage->Next=NULL; + } + else if(pTempPage->Next) + { + // beginning of the list + pPage=pTempPage; + pTempPage=pTempPage->Next; + MemFree(pPage); + pTempPage->Prev=NULL; + } + else + { + // all alone + + MemFree(pPage); + pPageList=NULL; + } + if(iLastPage !=0) + iLastPage--; +} + +void AddMessageToPages(INT32 iMessageId) +{ + // go to end of page list + PagePtr pPage=pPageList; + INT32 iCounter=0; + if(!pPage) + AddEmailPage(); + pPage=pPageList; + while((pPage->Next)&&(pPage->iIds[MAX_MESSAGES_PAGE-1]!=-1)) + pPage=pPage->Next; + // if list is full, add new page + while(iCounter iIds[iCounter]==-1) + break; + iCounter++; + } + if(iCounter==MAX_MESSAGES_PAGE) + { + AddEmailPage(); + AddMessageToPages(iMessageId); + return; + } + else + { + pPage->iIds[iCounter]=iMessageId; + } + return; +} + +void SortMessages(INT32 iCriteria) +{ + EmailPtr pA=pEmailList; + EmailPtr pB=pEmailList; + CHAR16 pSubjectA[256]; + CHAR16 pSubjectB[256]; + INT32 iId=0; + + // no messages to sort? + if( ( pA == NULL) ||( pB == NULL ) ) + { + return; + } + + // nothing here either? + if(!pA->Next) + return; + + pB=pA->Next; + switch(iCriteria) + { + case RECEIVED: + while(pA) + { + + // set B to next in A + pB=pA -> Next; + while(pB) + { + + if( fSortDateUpwards ) + { + // if date is lesser, swap + if(pA->iDate > pB->iDate) + SwapMessages(pA->iId, pB->iId); + } + else + { + // if date is lesser, swap + if(pA->iDate < pB->iDate) + SwapMessages(pA->iId, pB->iId); + } + + + // next in B's list + pB=pB->Next; + } + + // next in A's List + pA=pA->Next; + } + break; + case SENDER: + while(pA) + { + + pB = pA ->Next; + while(pB) + { + // lesser string?...need sorting + if( fSortSenderUpwards ) + { + if(( wcscmp( pSenderNameList[pA->ubSender] , pSenderNameList[pB->ubSender] ) ) < 0 ) + SwapMessages(pA->iId, pB->iId); + } + else + { + if(( wcscmp( pSenderNameList[pA->ubSender] , pSenderNameList[pB->ubSender] ) ) > 0 ) + SwapMessages(pA->iId, pB->iId); + } + // next in B's list + pB=pB->Next; + } + // next in A's List + pA=pA->Next; + } + break; + case SUBJECT: + while(pA) + { + + pB = pA ->Next; + while(pB) + { + // clear out control codes + CleanOutControlCodesFromString( pA->pSubject, pSubjectA ); + CleanOutControlCodesFromString( pB->pSubject, pSubjectB ); + + // lesser string?...need sorting + if( fSortSubjectUpwards ) + { + if( ( wcscmp( pA->pSubject ,pB->pSubject ) ) < 0) + SwapMessages(pA->iId, pB->iId); + } + else + { + if( ( wcscmp( pA->pSubject ,pB->pSubject ) ) > 0) + SwapMessages(pA->iId, pB->iId); + } + // next in B's list + pB=pB->Next; + } + // next in A's List + pA=pA->Next; + } + break; + + case READ: + while(pA) + { + + pB = pA ->Next; + while(pB) + { + // one read and another not?...need sorting + if( ( pA->fRead ) && ( ! ( pB -> fRead ) ) ) + SwapMessages(pA->iId, pB->iId); + + // next in B's list + pB=pB->Next; + } + // next in A's List + pA=pA->Next; + } + break; + } + + + // place new list into pages of email + //PlaceMessagesinPages(); + + // redraw the screen + fReDrawScreenFlag=TRUE; +} + +void SwapMessages(INT32 iIdA, INT32 iIdB) +{ + // swaps locations of messages in the linked list + EmailPtr pA=pEmailList; + EmailPtr pB=pEmailList; + EmailPtr pTemp= (EmailPtr) MemAlloc(sizeof(Email) ); + pTemp->pSubject = (STR16) MemAlloc( 128 * 2 ); + + memset( pTemp->pSubject, 0, sizeof( CHAR16 ) * 128 ); + + if(!pA->Next) + return; + //find pA + while(pA->iId!=iIdA) + pA=pA->Next; + // find pB + while(pB->iId!=iIdB) + pB=pB->Next; + + // swap + + // pTemp becomes pA + pTemp->iId=pA->iId; + pTemp->fRead=pA->fRead; + pTemp->fNew=pA->fNew; + pTemp->usOffset=pA->usOffset; + pTemp->usLength=pA->usLength; + pTemp->iDate=pA->iDate; + pTemp->ubSender=pA->ubSender; + wcscpy(pTemp->pSubject,pA->pSubject); + + // pA becomes pB + pA->iId=pB->iId; + pA->fRead=pB->fRead; + pA->fNew=pB->fNew; + pA->usOffset=pB->usOffset; + pA->usLength=pB->usLength; + pA->iDate=pB->iDate; + pA->ubSender=pB->ubSender; + wcscpy(pA->pSubject, pB->pSubject); + +// pB becomes pTemp + pB->iId=pTemp->iId; + pB->fRead=pTemp->fRead; + pB->fNew=pTemp->fNew; + pB->usOffset=pTemp->usOffset; + pB->usLength=pTemp->usLength; + pB->iDate=pTemp->iDate; + pB->ubSender=pTemp->ubSender; + wcscpy(pB->pSubject, pTemp->pSubject); + + // free up memory + MemFree(pTemp -> pSubject); + MemFree( pTemp ); + return; +} + +void ClearPages() +{ + // run through list of message pages and set to -1 + PagePtr pPage=pPageList; + + // error check + if( pPageList == NULL ) + { + return; + } + + while(pPage->Next) + { + pPage=pPage->Next; + MemFree(pPage->Prev); + } + if(pPage) + MemFree(pPage); + pPageList=NULL; + iLastPage=-1; + + return; +} + +void PlaceMessagesinPages() +{ + EmailPtr pEmail=pEmailList; + // run through the list of messages and add to pages + ClearPages(); + while(pEmail) + { + AddMessageToPages(pEmail->iId); + pEmail=pEmail->Next; + + } + if(iCurrentPage >iLastPage) + iCurrentPage=iLastPage; + return; +} + +void DisplayMessageList(INT32 iPageNum) +{ + // will display page with idNumber iPageNum + PagePtr pPage=pPageList; + while(pPage->iPageId!=iPageNum) + { + pPage=pPage->Next; + if(!pPage) + return; + } + // found page show it + return; +} + +void DrawLetterIcon(INT32 iCounter, BOOLEAN fRead) +{ + HVOBJECT hHandle; + // will draw the icon for letter in mail list depending if the mail has been read or not + + // grab video object + GetVideoObject(&hHandle, guiEmailIndicator); + + // is it read or not? + if(fRead) + BltVideoObject(FRAME_BUFFER, hHandle, 0,INDIC_X, (MIDDLE_Y+iCounter*MIDDLE_WIDTH+2), VO_BLT_SRCTRANSPARENCY,NULL); + else + BltVideoObject(FRAME_BUFFER, hHandle, 1,INDIC_X, (MIDDLE_Y+iCounter*MIDDLE_WIDTH+2), VO_BLT_SRCTRANSPARENCY,NULL); + return; +} + +void DrawSubject(INT32 iCounter, STR16 pSubject, BOOLEAN fRead) +{ + wchar_t pTempSubject[320]; + + + // draw subject line of mail being viewed in viewer + + // lock buffer to prevent overwrite + SetFontDestBuffer(FRAME_BUFFER, SUBJECT_X , ((UINT16)(MIDDLE_Y+iCounter*MIDDLE_WIDTH)) , SUBJECT_X + SUBJECT_WIDTH , ( ( UINT16 ) ( MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) + MIDDLE_WIDTH, FALSE ); + SetFontShadow(NO_SHADOW); + SetFontForeground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); + + + wcscpy( pTempSubject, pSubject ); + + if( fRead ) + { + //if the subject will be too long, cap it, and add the '...' + if( StringPixLength( pTempSubject, MESSAGE_FONT ) >= SUBJECT_WIDTH - 10 ) + { + ReduceStringLength( pTempSubject, SUBJECT_WIDTH - 10, MESSAGE_FONT ); + } + + // display string subject + IanDisplayWrappedString(SUBJECT_X, (( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) , SUBJECT_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR ,pTempSubject,0 ,FALSE ,LEFT_JUSTIFIED ); + } + else + { + //if the subject will be too long, cap it, and add the '...' + if( StringPixLength( pTempSubject, FONT10ARIALBOLD ) >= SUBJECT_WIDTH - 10 ) + { + ReduceStringLength( pTempSubject, SUBJECT_WIDTH - 10, FONT10ARIALBOLD ); + } + + // display string subject + IanDisplayWrappedString(SUBJECT_X, (( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) , SUBJECT_WIDTH, MESSAGE_GAP, FONT10ARIALBOLD, MESSAGE_COLOR ,pTempSubject,0 ,FALSE ,LEFT_JUSTIFIED ); + + } + SetFontShadow(DEFAULT_SHADOW); + // reset font dest buffer + SetFontDestBuffer(FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + + return; +} + +void DrawSender(INT32 iCounter, UINT8 ubSender, BOOLEAN fRead) +{ + + // draw name of sender in mail viewer + SetFontShadow(NO_SHADOW); + + SetFontShadow(NO_SHADOW); + SetFontForeground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); + + if( fRead ) + { + SetFont( MESSAGE_FONT ); + } + else + { + SetFont( FONT10ARIALBOLD ); + } + + mprintf(SENDER_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ) ,pSenderNameList[ubSender]); + + SetFont( MESSAGE_FONT ); + SetFontShadow(DEFAULT_SHADOW); + return; +} + +void DrawDate(INT32 iCounter, INT32 iDate, BOOLEAN fRead) +{ + wchar_t sString[20]; + + SetFontShadow(NO_SHADOW); + SetFontForeground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); + + if( fRead ) + { + SetFont( MESSAGE_FONT ); + } + else + { + SetFont( FONT10ARIALBOLD ); + } + // draw date of message being displayed in mail viewer + swprintf(sString, L"%s %d", pDayStrings[ 0 ], iDate/ ( 24 * 60 ) ); + mprintf(DATE_X,(( UINT16 )( 4 + MIDDLE_Y + iCounter * MIDDLE_WIDTH ) ),sString); + + SetFont( MESSAGE_FONT ); + SetFontShadow(DEFAULT_SHADOW); + return; +} + +void DisplayEmailList() +{ + INT32 iCounter=0; + // look at current page, and display + PagePtr pPage=pPageList; + EmailPtr pEmail=NULL; + + + // error check, if no page, return + if(!pPage) + return; + + // if current page ever ends up negative, reset to 0 + if(iCurrentPage==-1) + iCurrentPage=0; + + // loop until we get to the current page + while((pPage->iPageId!=iCurrentPage)&&(iCurrentPage <=iLastPage)) + pPage=pPage->Next; + + // now we have current page, display it + pEmail=GetEmailMessage(pPage->iIds[iCounter]); + SetFontShadow(NO_SHADOW); + SetFont(EMAIL_TEXT_FONT); + + + // draw each line of the list for this page + while(pEmail) + { + + // highlighted message, set text of message in list to blue + if(iCounter==iHighLightLine) + { + SetFontForeground(FONT_BLUE); + } + else if(pEmail->fRead) + { + // message has been read, reset color to black + SetFontForeground(FONT_BLACK); + //SetFontBackground(FONT_BLACK); + + } + else + { + // defualt, message is not read, set font red + SetFontForeground(FONT_RED); + //SetFontBackground(FONT_BLACK); + } + SetFontBackground(FONT_BLACK); + + //draw the icon, sender, date, subject + DrawLetterIcon(iCounter,pEmail->fRead ); + DrawSubject(iCounter, pEmail->pSubject, pEmail->fRead ); + DrawSender(iCounter, pEmail->ubSender, pEmail->fRead ); + DrawDate(iCounter, pEmail->iDate, pEmail->fRead ); + + iCounter++; + + // too many messages onthis page, reset pEmail, so no more are drawn + if(iCounter >=MAX_MESSAGES_PAGE) + pEmail=NULL; + else + pEmail=GetEmailMessage(pPage->iIds[iCounter]); + + } + + + + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_LR_Y); + + SetFontShadow(DEFAULT_SHADOW); + return; +} + + +void LookForUnread() +{ + BOOLEAN fStatusOfNewEmailFlag = fUnReadMailFlag; + + // simply runrs through list of messages, if any unread, set unread flag + + EmailPtr pA=pEmailList; + + // reset unread flag + fUnReadMailFlag=FALSE; + + // look for unread mail + while(pA) + { + // unread mail found, set flag + if(!(pA->fRead)) + fUnReadMailFlag=TRUE; + pA=pA->Next; + } + + if( fStatusOfNewEmailFlag != fUnReadMailFlag ) + { + //Since there is no new email, get rid of the hepl text + CreateFileAndNewEmailIconFastHelpText( LAPTOP_BN_HLP_TXT_YOU_HAVE_NEW_MAIL, (BOOLEAN )!fUnReadMailFlag ); + } + + return; +} + +void EmailBtnCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + INT32 iCount; + PagePtr pPage=pPageList; + INT32 iId=0; + EmailPtr pEmail=NULL; + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + if(fDisplayMessageFlag) + return; + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + + // error check + iCount=MSYS_GetRegionUserData(pRegion, 0); + // check for valid email + // find surrent page + if(!pPage) + return; + while((pPage->Next)&&(pPage->iPageId!=iCurrentPage)) + pPage=pPage->Next; + if(!pPage) + return; + // found page + + // get id for element iCount + iId=pPage->iIds[iCount]; + + // invalid message + if(iId==-1) + { + fDisplayMessageFlag=FALSE; + return; + } + // Get email and display + fDisplayMessageFlag=TRUE; + giMessagePage = 0; + giPrevMessageId = giMessageId; + giMessageId=iId; + + + } + else if(iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + iCount=MSYS_GetRegionUserData(pRegion, 0); + + // error check + if(!pPage) + { + HandleRightButtonUpEvent( ); + return; + } + + giMessagePage = 0; + + while((pPage->Next)&&(pPage->iPageId!=iCurrentPage)) + pPage=pPage->Next; + if(!pPage) + { + HandleRightButtonUpEvent( ); + return; + } + // found page + // get id for element iCount + iId=pPage->iIds[iCount]; + if(!GetEmailMessage(iId)) + { + // no mail here, handle right button up event + HandleRightButtonUpEvent( ); + return; + } + else + { + fDeleteMailFlag=TRUE; + iDeleteId=iId; + //DisplayDeleteNotice(GetEmailMessage(iDeleteId)); + //DeleteEmail(); + } + } +} +void EmailMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + if(fDisplayMessageFlag) + return; + if (iReason == MSYS_CALLBACK_REASON_MOVE) + { + + // set highlight to current regions data, this is the message to display + iHighLightLine=MSYS_GetRegionUserData(pRegion, 0); + } + if (iReason == MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + + // reset highlight line to invalid message + iHighLightLine=-1; + } +} + +void BtnMessageXCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if((reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )||(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN)) + { + + btn->uiFlags |= BUTTON_CLICKED_ON; + + } + else if((reason & MSYS_CALLBACK_REASON_LBUTTON_UP )||(reason & MSYS_CALLBACK_REASON_RBUTTON_UP)) + { + + if(btn->uiFlags& BUTTON_CLICKED_ON) + { + // X button has been pressed and let up, this means to stop displaying the currently displayed message + + // reset display message flag + fDisplayMessageFlag=FALSE; + + // reset button flag + btn->uiFlags &= ~BUTTON_CLICKED_ON; + + // reset page being displayed + giMessagePage = 0; + + // redraw icons + DrawLapTopIcons(); + + // force update of entire screen + fPausedReDrawScreenFlag=TRUE; + + // rerender email + //RenderEmail(); + } + } + +} +void +SetUnNewMessages() +{ + // on exit from the mailer, set all new messages as 'un'new + EmailPtr pEmail=pEmailList; + // run through the list of messages and add to pages + + while(pEmail) + { + pEmail->fNew=FALSE; + pEmail=pEmail->Next; + } + return; +} + +INT32 DisplayEmailMessage(EmailPtr pMail) +{ + HVOBJECT hHandle; + INT32 iCnt=0; + INT32 iHeight=0; + INT32 iCounter=1; +// wchar_t pString[MAIL_STRING_SIZE/2 + 1]; + wchar_t pString[MAIL_STRING_SIZE]; + INT32 iOffSet=0; + INT32 iHeightTemp=0; + INT32 iHeightSoFar = 0; + RecordPtr pTempRecord; + INT32 iPageSize = 0; + INT32 iPastHeight=0; + INT32 iYPositionOnPage = 0; + INT32 iTotalYPosition = 0; + BOOLEAN fGoingOffCurrentPage = FALSE; + BOOLEAN fDonePrintingMessage = FALSE; + + + + if(!pMail) + return 0; + + iOffSet=(INT32)pMail->usOffset; + + // reset redraw email message flag + fReDrawMessageFlag = FALSE; + + // we KNOW the player is going to "read" this, so mark it as so + pMail->fRead=TRUE; + + // draw text for title bar + //swprintf(pString, L"%s / %s", pSenderNameList[pMail->ubSender],pMail->pSubject); + //DisplayWrappedString(VIEWER_X+VIEWER_HEAD_X+4, VIEWER_Y+VIEWER_HEAD_Y+4, VIEWER_HEAD_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR, pString, 0,FALSE,0); + + // increment height for size of one line + iHeight+=GetFontHeight( MESSAGE_FONT ); + + // is there any special event meant for this mail?..if so, handle it + HandleAnySpecialEmailMessageEvents( iOffSet ); + + HandleMailSpecialMessages( ( UINT16 ) ( iOffSet ), &iViewerPositionY, pMail); + + PreProcessEmail( pMail ); + + + pTempRecord = pMessageRecordList; + + + + // blt in top line of message as a blank graphic + // get a handle to the bitmap of EMAIL VIEWER Background + GetVideoObject( &hHandle, guiEmailMessage ); + + // place the graphic on the frame buffer + BltVideoObject( FRAME_BUFFER, hHandle, 1,VIEWER_X, VIEWER_MESSAGE_BODY_START_Y + iViewerPositionY, VO_BLT_SRCTRANSPARENCY,NULL ); + BltVideoObject( FRAME_BUFFER, hHandle, 1,VIEWER_X, VIEWER_MESSAGE_BODY_START_Y + GetFontHeight( MESSAGE_FONT ) + iViewerPositionY, VO_BLT_SRCTRANSPARENCY,NULL ); + + // set shadow + SetFontShadow(NO_SHADOW); + + // get a handle to the bitmap of EMAIL VIEWER + GetVideoObject(&hHandle, guiEmailMessage); + + // place the graphic on the frame buffer + BltVideoObject(FRAME_BUFFER, hHandle, 0,VIEWER_X, VIEWER_Y + iViewerPositionY, VO_BLT_SRCTRANSPARENCY,NULL); + + + // the icon for the title of this box + GetVideoObject( &hHandle, guiTITLEBARICONS ); + BltVideoObject( FRAME_BUFFER, hHandle, 0,VIEWER_X + 5, VIEWER_Y + iViewerPositionY + 2, VO_BLT_SRCTRANSPARENCY,NULL ); + + // display header text + DisplayEmailMessageSubjectDateFromLines( pMail, iViewerPositionY ); + + // display title text + DrawEmailMessageDisplayTitleText( iViewerPositionY ); + + + + iCounter=0; + // now blit the text background based on height + for (iCounter=2; iCounter < ( ( iTotalHeight ) / ( GetFontHeight( MESSAGE_FONT ) ) ); iCounter++ ) + { + // get a handle to the bitmap of EMAIL VIEWER Background + GetVideoObject( &hHandle, guiEmailMessage ); + + // place the graphic on the frame buffer + BltVideoObject( FRAME_BUFFER, hHandle, 1,VIEWER_X, iViewerPositionY + VIEWER_MESSAGE_BODY_START_Y+( (GetFontHeight( MESSAGE_FONT ) ) * ( iCounter )), VO_BLT_SRCTRANSPARENCY,NULL ); + + } + + // now the bottom piece to the message viewer + GetVideoObject( &hHandle, guiEmailMessage ); + + if( giNumberOfPagesToCurrentEmail <= 2 ) + { + // place the graphic on the frame buffer + BltVideoObject( FRAME_BUFFER, hHandle, 2,VIEWER_X, iViewerPositionY + VIEWER_MESSAGE_BODY_START_Y+( ( GetFontHeight( MESSAGE_FONT ) ) * ( iCounter )), VO_BLT_SRCTRANSPARENCY,NULL ); + } + else + { + // place the graphic on the frame buffer + BltVideoObject( FRAME_BUFFER, hHandle, 3,VIEWER_X, iViewerPositionY + VIEWER_MESSAGE_BODY_START_Y+( ( GetFontHeight( MESSAGE_FONT ) ) * ( iCounter )), VO_BLT_SRCTRANSPARENCY,NULL ); + } + + // reset iCounter and iHeight + iCounter = 1; + iHeight = GetFontHeight(MESSAGE_FONT); + + // draw body of text. Any particular email can encompass more than one "record" in the + // email file. Draw each record (length is number of records) + + // now place the text + + // reset ptemprecord to head of list + pTempRecord = pMessageRecordList; + // reset shadow + SetFontShadow( NO_SHADOW ); + + pTempRecord = pEmailPageInfo[ giMessagePage ].pFirstRecord; + + if( pTempRecord ) + { + while( fDonePrintingMessage == FALSE ) + { + + + // copy over string + wcscpy( pString, pTempRecord -> pRecord ); + + // get the height of the string, ONLY!...must redisplay ON TOP OF background graphic + iHeight += IanDisplayWrappedString(VIEWER_X + 9, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + iHeight + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); + + + // increment email record ptr + pTempRecord = pTempRecord -> Next; + + + + if( pTempRecord == NULL ) + { + fDonePrintingMessage = TRUE; + } + else if( ( pTempRecord == pEmailPageInfo[ giMessagePage ].pLastRecord ) && ( pEmailPageInfo[ giMessagePage + 1 ].pFirstRecord != NULL ) ) + { + fDonePrintingMessage = TRUE; + } + } + } + + /* + if(iTotalHeight < MAX_EMAIL_MESSAGE_PAGE_SIZE) + { + fOnLastPageFlag = TRUE; + while( pTempRecord ) + { + // copy over string + wcscpy( pString, pTempRecord -> pRecord ); + + // get the height of the string, ONLY!...must redisplay ON TOP OF background graphic + iHeight += IanDisplayWrappedString(VIEWER_X + MESSAGE_X + 4, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + iHeight + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); + + // increment email record ptr + pTempRecord = pTempRecord -> Next; + } + + + } + else + { + + iYPositionOnPage = 0; + // go to the right record + pTempRecord = GetFirstRecordOnThisPage( pMessageRecordList, MESSAGE_FONT, MESSAGE_WIDTH, MESSAGE_GAP, giMessagePage, MAX_EMAIL_MESSAGE_PAGE_SIZE ); + while( pTempRecord ) + { + // copy over string + wcscpy( pString, pTempRecord -> pRecord ); + + if( pString[ 0 ] == 0 ) + { + // on last page + fOnLastPageFlag = TRUE; + } + + + if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, MESSAGE_WIDTH, MESSAGE_GAP, + MESSAGE_FONT, 0, pTempRecord->pRecord, + 0, 0, 0 ) ) <= MAX_EMAIL_MESSAGE_PAGE_SIZE ) + { + // now print it + iYPositionOnPage += IanDisplayWrappedString(VIEWER_X + MESSAGE_X + 4, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + 10 +iYPositionOnPage + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); + fGoingOffCurrentPage = FALSE; + } + else + { + // gonna get cut off...end now + fGoingOffCurrentPage = TRUE; + } + + + pTempRecord = pTempRecord ->Next; + + + if( ( pTempRecord == NULL ) && ( fGoingOffCurrentPage == FALSE ) ) + { + // on last page + fOnLastPageFlag = TRUE; + } + else + { + fOnLastPageFlag = FALSE; + } + + // record get cut off?...end now + + if( fGoingOffCurrentPage == TRUE ) + { + pTempRecord = NULL; + } + } + + } + + */ + // show number of pages to this email + DisplayNumberOfPagesToThisEmail( iViewerPositionY ); + + // mark this area dirty + InvalidateRegion( LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_LR_Y ); + + + // reset shadow + SetFontShadow( DEFAULT_SHADOW ); + + + return iViewerPositionY; +} + + + +void BtnNewOkback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fNewMailFlag=FALSE; + + } + } +} + +void AddDeleteRegionsToMessageRegion(INT32 iViewerY) +{ + // will create/destroy mouse region for message display + + if((fDisplayMessageFlag)&&(!fOldDisplayMessageFlag)) + { + + // set old flag + fOldDisplayMessageFlag=TRUE; + + + // add X button + giMessageButtonImage[0]= LoadButtonImage( "LAPTOP\\X.sti" ,-1,0,-1,1,-1 ); + giMessageButton[0] = QuickCreateButton( giMessageButtonImage[0], BUTTON_X + 2,(INT16) ( BUTTON_Y + ( INT16 )iViewerY + 1), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnMessageXCallback ); + SetButtonCursor(giMessageButton[0], CURSOR_LAPTOP_SCREEN); + + if( giNumberOfPagesToCurrentEmail > 2 ) + { + // add next and previous mail page buttons + giMailMessageButtonsImage[0]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,0,-1,3,-1 ); + giMailMessageButtons[0] = QuickCreateButton( giMailMessageButtonsImage[0], PREVIOUS_PAGE_BUTTON_X,(INT16) ( LOWER_BUTTON_Y + ( INT16 )iViewerY + 2), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnPreviousEmailPageCallback ); + + giMailMessageButtonsImage[1]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,1,-1,4,-1 ); + giMailMessageButtons[1] = QuickCreateButton( giMailMessageButtonsImage[1], NEXT_PAGE_BUTTON_X ,(INT16) ( LOWER_BUTTON_Y + ( INT16 )iViewerY + 2), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnNextEmailPageCallback ); + + gfPageButtonsWereCreated = TRUE; + + } + + giMailMessageButtonsImage[2]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,2,-1,5,-1 ); + giMailMessageButtons[2] = QuickCreateButton( giMailMessageButtonsImage[2], DELETE_BUTTON_X,(INT16) ( BUTTON_LOWER_Y + ( INT16 )iViewerY + 2), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnDeleteCallback ); +/* + // set up disable methods + SpecifyDisabledButtonStyle( giMailMessageButtons[1], DISABLED_STYLE_SHADED ); + SpecifyDisabledButtonStyle( giMailMessageButtons[0], DISABLED_STYLE_SHADED ); +*/ + // set cursors + SetButtonCursor(giMailMessageButtons[0], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giMailMessageButtons[1], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giMailMessageButtons[2], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giMessageButton[0], CURSOR_LAPTOP_SCREEN); + + // force update of screen + fReDrawScreenFlag=TRUE; + } + else if((!fDisplayMessageFlag)&&(fOldDisplayMessageFlag)) + { + // delete region + fOldDisplayMessageFlag=FALSE; + RemoveButton(giMessageButton[0] ); + UnloadButtonImage( giMessageButtonImage[0] ); + + // net/previous email page buttons + if( gfPageButtonsWereCreated ) + { + RemoveButton(giMailMessageButtons[0] ); + UnloadButtonImage( giMailMessageButtonsImage[0] ); + RemoveButton(giMailMessageButtons[1] ); + UnloadButtonImage( giMailMessageButtonsImage[1] ); + gfPageButtonsWereCreated = FALSE; + } + RemoveButton(giMailMessageButtons[2] ); + UnloadButtonImage( giMailMessageButtonsImage[2] ); + // force update of screen + fReDrawScreenFlag=TRUE; + } + +} + +void CreateDestroyNewMailButton() +{ + static BOOLEAN fOldNewMailFlag=FALSE; + + // check if we are video conferencing, if so, do nothing + if( gubVideoConferencingMode != 0 ) + { + return ; + } + + + if((fNewMailFlag)&&(!fOldNewMailFlag)) + { + // create new mail dialog box button + + // set old flag (stating button has been created) + fOldNewMailFlag=TRUE; + + // load image and setup button + giNewMailButtonImage[0]=LoadButtonImage( "LAPTOP\\YesNoButtons.sti" ,-1,0,-1,1,-1 ); + giNewMailButton[0]= QuickCreateButton( giNewMailButtonImage[0], NEW_BTN_X+10, NEW_BTN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST-2, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnNewOkback); + + // set cursor + SetButtonCursor(giNewMailButton[0], CURSOR_LAPTOP_SCREEN); + + // set up screen mask region + MSYS_DefineRegion(&pScreenMask,0, 0,SCREEN_WIDTH, SCREEN_HEIGHT, + MSYS_PRIORITY_HIGHEST-3,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, LapTopScreenCallBack); + MSYS_AddRegion(&pScreenMask); + MarkAButtonDirty( giNewMailButton[0] ); + fReDrawScreenFlag = TRUE; + } + else if((!fNewMailFlag)&&(fOldNewMailFlag)) + { + + + // reset old flag + fOldNewMailFlag=FALSE; + + // remove the button + RemoveButton( giNewMailButton[0] ); + UnloadButtonImage( giNewMailButtonImage[0] ); + + // remove screen mask + MSYS_RemoveRegion( &pScreenMask ); + + + //re draw screen + fReDraw=TRUE; + + // redraw screen + fPausedReDrawScreenFlag=TRUE; + } +} + + +BOOLEAN DisplayNewMailBox( void ) +{ + + + + HVOBJECT hHandle; + static BOOLEAN fOldNewMailFlag=FALSE; + // will display a new mail box whenever new mail has arrived + + // check if we are video conferencing, if so, do nothing + if( gubVideoConferencingMode != 0 ) + { + return( FALSE ); + } + + // just stopped displaying box, reset old flag + if( ( !fNewMailFlag ) && ( fOldNewMailFlag ) ) + { + fOldNewMailFlag=FALSE; + return ( FALSE ); + } + + // not even set, leave NOW! + if( !fNewMailFlag ) + return ( FALSE ); + + + + // is set but already drawn, LEAVE NOW! + //if( ( fNewMailFlag ) && ( fOldNewMailFlag ) ) + // return ( FALSE ); + + + + GetVideoObject( &hHandle, guiEmailWarning ); + BltVideoObject( FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X, EMAIL_WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL ); + + + // the icon for the title of this box + GetVideoObject( &hHandle, guiTITLEBARICONS ); + BltVideoObject( FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X + 5, EMAIL_WARNING_Y + 2, VO_BLT_SRCTRANSPARENCY,NULL ); + + // font stuff + SetFont( EMAIL_HEADER_FONT ); + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + SetFontShadow( DEFAULT_SHADOW ); + + // print warning + mprintf(EMAIL_WARNING_X + 30, EMAIL_WARNING_Y + 8, pEmailTitleText[0] ); + + // font stuff + SetFontShadow( NO_SHADOW ); + SetFont( EMAIL_WARNING_FONT ); + SetFontForeground( FONT_BLACK ); + + // printf warning string + mprintf(EMAIL_WARNING_X + 60, EMAIL_WARNING_Y + 63, pNewMailStrings[0] ); + DrawLapTopIcons( ); + + // invalidate region + InvalidateRegion( EMAIL_WARNING_X, EMAIL_WARNING_Y, EMAIL_WARNING_X + 270, EMAIL_WARNING_Y + 200 ); + + // mark button + MarkAButtonDirty( giNewMailButton[0] ); + + // reset shadow + SetFontShadow( DEFAULT_SHADOW ); + + // redraw icons + + // set box as displayed + fOldNewMailFlag=TRUE; + + + + // return + return ( TRUE ); +} + +void ReDrawNewMailBox( void ) +{ + + // this function will check to see if the new mail region needs to be redrawn + if( fReDrawNewMailFlag == TRUE ) + { + if( fNewMailFlag ) + { + // set display flag back to orginal + fNewMailFlag = FALSE; + + // display new mail box + DisplayNewMailBox( ); + + // dirty buttons + MarkAButtonDirty( giNewMailButton[0] ); + + + + // set display flag back to orginal + fNewMailFlag = TRUE; + + // time to redraw + DisplayNewMailBox( ); + } + + // return; + + // reset flag for redraw + fReDrawNewMailFlag = FALSE; + + return; + } +} + +void SwitchEmailPages( void ) +{ + // this function will switch current page + + // gone too far, reset page to start + if( iCurrentPage >iLastPage ) + iCurrentPage=0; + + // set to last page + if( iCurrentPage < 0 ) + iCurrentPage=iLastPage; + return; + +} + + +void DetermineNextPrevPageDisplay( void ) +{ + // will determine which of previous and next page graphics to display + + + + if( iCurrentPage > 0 ) + { + // display Previous graphic + + // font stuff + SetFont( TRAVERSE_EMAIL_FONT ); + SetFontForeground( FONT_RED ); + SetFontBackground( FONT_BLACK ); + + // print previous string + mprintf( PREVIOUS_PAGE_X, PREVIOUS_PAGE_Y, pTraverseStrings[PREVIOUS_PAGE] ); + } + + // less than last page, so there is a next page + if(iCurrentPage uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // not on last page, move ahead one + if(iCurrentPage uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + if( giMessagePage > 0 ) + { + giMessagePage--; + } + + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + fReDraw=TRUE; + RenderEmail(); + MarkButtonsDirty( ); + } + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + // nothing yet + } + +} + +void BtnNextEmailPageCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + // not on last page, move ahead one + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + if( ( giNumberOfPagesToCurrentEmail - 1 ) <= giMessagePage ) + { + return; + } + + if( ! ( fOnLastPageFlag ) ) + { + if( ( giNumberOfPagesToCurrentEmail - 1 ) > ( giMessagePage + 1 ) ) + giMessagePage++; + } + + MarkButtonsDirty( ); + fReDrawScreenFlag = TRUE; + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + // nothing yet + } + +} + +void PreviousRegionButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // if we are not on forst page, more back one + if(iCurrentPage>0) + { + iCurrentPage--; + fReDraw=TRUE; + RenderEmail(); + MarkButtonsDirty( ); + } + } + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + // nothing yet + } + +} + + +void BtnDeleteNoback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fDeleteMailFlag=FALSE; + fReDrawScreenFlag=TRUE; + } + } +} + + +void BtnDeleteYesback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + DeleteEmail(); + + } + } +} + + +void CreateDestroyNextPreviousRegions() +{ + static BOOLEAN fCreated=FALSE; + if(fCreated) + { + // destroy already create next, previous mouse regions + fCreated=FALSE; + + RemoveButton( giMailPageButtons[ 1 ] ); + UnloadButtonImage( giMailPageButtonsImage[ 1 ] ); + + RemoveButton( giMailPageButtons[ 0 ] ); + UnloadButtonImage( giMailPageButtonsImage[ 0 ] ); + + } + else + { + // create uncreated mouse regions + fCreated=TRUE; + + CreateNextPreviousEmailPageButtons( ); + + /* + // ' next' region + MSYS_DefineRegion(&pEmailMoveRegions[NEXT_BUTTON],NEXT_PAGE_X, NEXT_PAGE_Y,(INT16) (NEXT_PAGE_X+NEXT_WIDTH), (INT16)(NEXT_PAGE_Y+NEXT_HEIGHT), + MSYS_PRIORITY_NORMAL+2,MSYS_NO_CURSOR, MSYS_NO_CALLBACK, NextRegionButtonCallback); + + // ' previous ' region + MSYS_DefineRegion(&pEmailMoveRegions[PREVIOUS_BUTTON],PREVIOUS_PAGE_X,PREVIOUS_PAGE_Y, (INT16)(PREVIOUS_PAGE_X+PREVIOUS_WIDTH),(INT16)(PREVIOUS_PAGE_Y+PREVIOUS_HEIGHT), + MSYS_PRIORITY_NORMAL+2,MSYS_NO_CURSOR, MSYS_NO_CALLBACK, PreviousRegionButtonCallback ); + + // add regions + MSYS_AddRegion(&pEmailMoveRegions[PREVIOUS_BUTTON]); + MSYS_AddRegion(&pEmailMoveRegions[NEXT_BUTTON]); + */ + } +} + +void ReDraw() +{ + // forces update of entire laptop screen + if(fReDraw) + { + RenderLaptop( ); + //EnterNewLaptopMode(); + DrawLapTopText(); + ReDrawHighLight(); + MarkButtonsDirty( ); + fReDraw=FALSE; + } + +} + +void CreateDestroyDeleteNoticeMailButton() +{ + static BOOLEAN fOldDeleteMailFlag=FALSE; + if((fDeleteMailFlag)&&(!fOldDeleteMailFlag)) + { + // confirm delete email buttons + + // YES button + fOldDeleteMailFlag=TRUE; + giDeleteMailButtonImage[0]=LoadButtonImage( "LAPTOP\\YesNoButtons.sti" ,-1,0,-1,1,-1 ); + giDeleteMailButton[0]= QuickCreateButton( giDeleteMailButtonImage[0], NEW_BTN_X+1, NEW_BTN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnDeleteYesback); + + // NO button + giDeleteMailButtonImage[1]=LoadButtonImage( "LAPTOP\\YesNoButtons.sti" ,-1,2,-1,3,-1 ); + giDeleteMailButton[1]= QuickCreateButton( giDeleteMailButtonImage[1], NEW_BTN_X+40, NEW_BTN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnDeleteNoback); + + // set up cursors + SetButtonCursor(giDeleteMailButton[0], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giDeleteMailButton[1], CURSOR_LAPTOP_SCREEN); + + // set up screen mask to prevent other actions while delete mail box is destroyed + MSYS_DefineRegion(&pDeleteScreenMask,0, 0,SCREEN_WIDTH, SCREEN_HEIGHT, + MSYS_PRIORITY_HIGHEST-3,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, LapTopScreenCallBack); + MSYS_AddRegion(&pDeleteScreenMask); + + // force update + fReDrawScreenFlag = TRUE; + + } + else if((!fDeleteMailFlag)&&(fOldDeleteMailFlag)) + { + + // clear out the buttons and screen mask + fOldDeleteMailFlag=FALSE; + RemoveButton( giDeleteMailButton[0] ); + UnloadButtonImage( giDeleteMailButtonImage[0] ); + RemoveButton( giDeleteMailButton[1] ); + UnloadButtonImage( giDeleteMailButtonImage[1] ); + + // the region + MSYS_RemoveRegion(&pDeleteScreenMask); + + // force refresh + fReDrawScreenFlag=TRUE; + + } + return; +} +BOOLEAN DisplayDeleteNotice(EmailPtr pMail) +{ + + + HVOBJECT hHandle; + // will display a delete mail box whenever delete mail has arrived + if(!fDeleteMailFlag) + return(FALSE); + + if( !fReDrawScreenFlag ) + { + // no redraw flag, leave + return( FALSE ); + } + + // error check.. no valid message passed + if( pMail == NULL ) + { + return ( FALSE ); + } + + + // load graphics + + GetVideoObject(&hHandle, guiEmailWarning); + BltVideoObject(FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X, EMAIL_WARNING_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + // font stuff + SetFont( EMAIL_HEADER_FONT ); + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + SetFontShadow( DEFAULT_SHADOW ); + + // the icon for the title of this box + GetVideoObject( &hHandle, guiTITLEBARICONS ); + BltVideoObject( FRAME_BUFFER, hHandle, 0,EMAIL_WARNING_X + 5, EMAIL_WARNING_Y + 2, VO_BLT_SRCTRANSPARENCY,NULL ); + + // title + mprintf(EMAIL_WARNING_X + 30, EMAIL_WARNING_Y + 8, pEmailTitleText[0] ); + + // shadow, font, and foreground + SetFontShadow( NO_SHADOW ); + SetFont( EMAIL_WARNING_FONT ); + SetFontForeground( FONT_BLACK ); + + // draw text based on mail being read or not + if((pMail->fRead)) + mprintf(EMAIL_WARNING_X + 95 , EMAIL_WARNING_Y + 65,pDeleteMailStrings[0]); + else + mprintf(EMAIL_WARNING_X + 70, EMAIL_WARNING_Y + 65,pDeleteMailStrings[1]); + + + // invalidate screen area, for refresh + + if( ! fNewMailFlag ) + { + // draw buttons + MarkButtonsDirty( ); + InvalidateRegion(EMAIL_WARNING_X, EMAIL_WARNING_Y ,EMAIL_WARNING_X+EMAIL_WARNING_WIDTH,EMAIL_WARNING_Y+EMAIL_WARNING_HEIGHT); + } + + // reset font shadow + SetFontShadow(DEFAULT_SHADOW); + + return ( TRUE ); +} + +void DeleteEmail() +{ + + // error check, invalid mail, or not time to delete mail + if( fDeleteInternal != TRUE ) + { + if((iDeleteId==-1)||(!fDeleteMailFlag)) + return; + } + // remove the message + RemoveEmailMessage(iDeleteId); + + // stop displaying message, if so + fDisplayMessageFlag = FALSE; + + // upadte list + PlaceMessagesinPages(); + + // redraw icons (if deleted message was last unread, remove checkmark) + DrawLapTopIcons(); + + // if all of a sudden we are beyond last page, move back one + if(iCurrentPage > iLastPage) + iCurrentPage=iLastPage; + + // rerender mail list + RenderEmail(); + + // nolong time to delete mail + fDeleteMailFlag=FALSE; + fReDrawScreenFlag=TRUE; + // refresh screen (get rid of dialog box image) + //ReDraw(); + + // invalidate + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); +} + + + +void FromCallback(GUI_BUTTON *btn, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + + // sort messages based on sender name, then replace into pages of email + fSortSenderUpwards = !fSortSenderUpwards; + + SortMessages(SENDER); + + //SpecifyButtonIcon( giSortButton[1] , giArrowsForEmail, UINT16 usVideoObjectIndex, INT8 bXOffset, INT8 bYOffset, TRUE ); + + fJustStartedEmail = FALSE; + + PlaceMessagesinPages(); + btn->uiFlags&= ~(BUTTON_CLICKED_ON); + } + + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + // nothing yet + } + +} + +void SubjectCallback(GUI_BUTTON *btn, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + // sort message on subject and reorder list + fSortSubjectUpwards = !fSortSubjectUpwards; + + SortMessages(SUBJECT); + fJustStartedEmail = FALSE; + PlaceMessagesinPages(); + + + + btn->uiFlags&= ~(BUTTON_CLICKED_ON); + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + // nothing yet + } + +} + + +void BtnDeleteCallback(GUI_BUTTON *btn, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + + btn->uiFlags&= ~(BUTTON_CLICKED_ON); + iDeleteId = giMessageId; + fDeleteMailFlag = TRUE; + + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + // nothing yet + } + +} + +void DateCallback(GUI_BUTTON *btn, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + // sort messages based on date recieved and reorder lsit + fSortDateUpwards = !fSortDateUpwards; + SortMessages(RECEIVED); + PlaceMessagesinPages(); + + fJustStartedEmail = FALSE; + + btn->uiFlags&= ~(BUTTON_CLICKED_ON); + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + // nothing yet + } + +} + + +void ReadCallback(GUI_BUTTON *btn, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + // sort messages based on date recieved and reorder lsit + SortMessages(READ); + PlaceMessagesinPages(); + + fJustStartedEmail = FALSE; + + btn->uiFlags&= ~(BUTTON_CLICKED_ON); + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + // nothing yet + } + +} + + +void SetUpSortRegions() +{ + + // have been replaced by buttons + return; + + // will set up sort mail regions + + // from region + /* + MSYS_DefineRegion(&pSortMailRegions[0],FROM_BOX_X ,FROM_BOX_Y, FROM_BOX_X+FROM_BOX_WIDTH ,FROM_BOX_Y+TOP_HEIGHT, + MSYS_PRIORITY_NORMAL+2,MSYS_NO_CURSOR,MSYS_NO_CALLBACK, FromCallback ); + + // subject region + MSYS_DefineRegion(&pSortMailRegions[1],SUBJECT_X ,FROM_BOX_Y, SUBJECT_BOX_X+SUBJECT_WIDTH ,FROM_BOX_Y+TOP_HEIGHT, + MSYS_PRIORITY_NORMAL+2,MSYS_NO_CURSOR,MSYS_NO_CALLBACK, SubjectCallback ); + + // date region + MSYS_DefineRegion(&pSortMailRegions[2],DATE_X ,FROM_BOX_Y, DATE_BOX_X+DATE_WIDTH ,FROM_BOX_Y+TOP_HEIGHT, + MSYS_PRIORITY_NORMAL+2,MSYS_NO_CURSOR,MSYS_NO_CALLBACK, DateCallback ); + + //add regions + MSYS_AddRegion(&pSortMailRegions[0]); + MSYS_AddRegion(&pSortMailRegions[1]); + MSYS_AddRegion(&pSortMailRegions[2]); + + return; + */ +} + +void DeleteSortRegions() +{ + + // have been replaced by buttons + return; + /* + MSYS_RemoveRegion(&pSortMailRegions[0]); + MSYS_RemoveRegion(&pSortMailRegions[1]); + MSYS_RemoveRegion(&pSortMailRegions[2]); + */ +} + + + +void DisplayTextOnTitleBar( void ) +{ + // draw email screen title text + + // font stuff + SetFont( EMAIL_TITLE_FONT ); + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + + // printf the title + mprintf( EMAIL_TITLE_X, EMAIL_TITLE_Y, pEmailTitleText[0] ); + + // reset the shadow + +} + +void DestroyMailScreenButtons( void ) +{ + // this function will destory the buttons used in the email screen + + // the sort email buttons + RemoveButton( giSortButton[0] ); + UnloadButtonImage( giSortButtonImage[0] ); + RemoveButton( giSortButton[1] ); + UnloadButtonImage( giSortButtonImage[1] ); + RemoveButton( giSortButton[2] ); + UnloadButtonImage( giSortButtonImage[2] ); + RemoveButton( giSortButton[3] ); + UnloadButtonImage( giSortButtonImage[3] ); + + return; +} + +void CreateMailScreenButtons( void ) +{ + + // create sort buttons, right now - not finished + + // read sort + giSortButtonImage[0]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,0,-1,4,-1 ); + giSortButton[0] = QuickCreateButton( giSortButtonImage[0], ENVELOPE_BOX_X, FROM_BOX_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ReadCallback); + SetButtonCursor(giSortButton[0], CURSOR_LAPTOP_SCREEN); + + + // subject sort + giSortButtonImage[1]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,1,-1,5,-1 ); + giSortButton[1] = QuickCreateButton( giSortButtonImage[1], FROM_BOX_X, FROM_BOX_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)FromCallback); + SetButtonCursor(giSortButton[1], CURSOR_LAPTOP_SCREEN); + SpecifyFullButtonTextAttributes( giSortButton[1], pEmailHeaders[FROM_HEADER], EMAIL_WARNING_FONT, + FONT_BLACK, FONT_BLACK, + FONT_BLACK, FONT_BLACK, TEXT_CJUSTIFIED ); + + + // sender sort + giSortButtonImage[2]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,2,-1,6,-1 ); + giSortButton[2] = QuickCreateButton( giSortButtonImage[2], SUBJECT_BOX_X, FROM_BOX_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)SubjectCallback ); + SetButtonCursor(giSortButton[2], CURSOR_LAPTOP_SCREEN); + SpecifyFullButtonTextAttributes( giSortButton[2], pEmailHeaders[SUBJECT_HEADER], EMAIL_WARNING_FONT, + FONT_BLACK, FONT_BLACK, + FONT_BLACK, FONT_BLACK, TEXT_CJUSTIFIED ); + + + + // date sort + giSortButtonImage[3]= LoadButtonImage( "LAPTOP\\mailbuttons.sti" ,-1,3,-1,7,-1 ); + giSortButton[3] = QuickCreateButton( giSortButtonImage[3], DATE_BOX_X, FROM_BOX_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)DateCallback); + SetButtonCursor(giSortButton[3], CURSOR_LAPTOP_SCREEN); + SpecifyFullButtonTextAttributes( giSortButton[3], pEmailHeaders[RECD_HEADER], EMAIL_WARNING_FONT, + FONT_BLACK, FONT_BLACK, + FONT_BLACK, FONT_BLACK, TEXT_CJUSTIFIED ); + + + return; +} + + +void DisplayEmailMessageSubjectDateFromLines( EmailPtr pMail , INT32 iViewerY) +{ + // this procedure will draw the title/headers to From, Subject, Date fields in the display + // message box + UINT16 usX, usY; + wchar_t sString[100]; + + // font stuff + SetFont(MESSAGE_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + + + // all headers, but not info are right justified + + // print from + FindFontRightCoordinates( MESSAGE_HEADER_X-20, ( INT16 ) ( MESSAGE_FROM_Y + (INT16)iViewerY ) , MESSAGE_HEADER_WIDTH, ( INT16 ) ( MESSAGE_FROM_Y + GetFontHeight ( MESSAGE_FONT ) ) ,pEmailHeaders[0] ,MESSAGE_FONT, &usX, &usY); + mprintf( usX, MESSAGE_FROM_Y + (UINT16)iViewerY, pEmailHeaders[0]); + + // the actual from info + mprintf( MESSAGE_HEADER_X+MESSAGE_HEADER_WIDTH-13, MESSAGE_FROM_Y + iViewerY, pSenderNameList[pMail->ubSender]); + + + // print date + FindFontRightCoordinates( MESSAGE_HEADER_X+168, ( INT16 ) ( MESSAGE_DATE_Y + (UINT16)iViewerY ), MESSAGE_HEADER_WIDTH, ( INT16 ) ( MESSAGE_DATE_Y + GetFontHeight ( MESSAGE_FONT ) ) ,pEmailHeaders[2] ,MESSAGE_FONT, &usX, &usY); + mprintf( usX, MESSAGE_DATE_Y+ (UINT16)iViewerY , pEmailHeaders[2]); + + // the actual date info + swprintf(sString, L"%d", ( ( pMail->iDate ) / ( 24 * 60) ) ); + mprintf( MESSAGE_HEADER_X+235, MESSAGE_DATE_Y + (UINT16)iViewerY, sString); + + + + // print subject + FindFontRightCoordinates( MESSAGE_HEADER_X-20, MESSAGE_SUBJECT_Y , MESSAGE_HEADER_WIDTH, ( INT16 ) (MESSAGE_SUBJECT_Y + GetFontHeight ( MESSAGE_FONT )),pEmailHeaders[1] ,MESSAGE_FONT, &usX, &usY); + mprintf( usX, MESSAGE_SUBJECT_Y + (UINT16)iViewerY, pEmailHeaders[1]); + + // the actual subject info + //mprintf( , MESSAGE_SUBJECT_Y, pMail->pSubject); + IanDisplayWrappedString(SUBJECT_LINE_X+2, (INT16) ( SUBJECT_LINE_Y+2 + (UINT16)iViewerY ), SUBJECT_LINE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pMail->pSubject,0,FALSE,0); + + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + return; +} + + +void DrawEmailMessageDisplayTitleText( INT32 iViewerY ) +{ + // this procedure will display the title of the email message display box + + // font stuff + SetFont( EMAIL_HEADER_FONT ); + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + + // dsiplay mail viewer title on message viewer + mprintf( VIEWER_X + 30, VIEWER_Y + 8 + (UINT16) iViewerY, pEmailTitleText[0] ); + + return; +} + +void DrawLineDividers( void ) +{ + // this function draws divider lines between lines of text + INT32 iCounter=0; + HVOBJECT hHandle; + + for(iCounter=1; iCounter < 19; iCounter++) + { + GetVideoObject( &hHandle, guiMAILDIVIDER ); + BltVideoObject(FRAME_BUFFER, hHandle, 0,INDIC_X-10, (MIDDLE_Y+iCounter*MIDDLE_WIDTH - 1), VO_BLT_SRCTRANSPARENCY,NULL); + } + + + return; +} + + +void ClearOutEmailMessageRecordsList( void ) +{ + RecordPtr pTempRecord; + INT32 iCounter = 0; + + // runt hrough list freeing records up + while(pMessageRecordList) + { + // set temp to current + pTempRecord = pMessageRecordList; + + // next element + pMessageRecordList = pMessageRecordList -> Next; + + MemFree( pTempRecord ); + } + + for( iCounter = 0; iCounter < MAX_NUMBER_EMAIL_PAGES; iCounter++ ) + { + pEmailPageInfo[ iCounter ].pFirstRecord = NULL; + pEmailPageInfo[ iCounter ].pLastRecord = NULL; + pEmailPageInfo[ iCounter ].iPageNumber = iCounter; + } + + // null out list + pMessageRecordList = NULL; + + return; +} + +void AddEmailRecordToList( STR16 pString ) +{ + RecordPtr pTempRecord; + + // set to head of list + pTempRecord=pMessageRecordList; + + if(!pTempRecord) + { + + // list empty, set this node to head + pTempRecord = (RecordPtr) MemAlloc( sizeof(Record)); + pMessageRecordList = pTempRecord; + } + else + { + // run to end of list + while(pTempRecord -> Next) + { + pTempRecord = pTempRecord -> Next; + } + + // found, alloc + pTempRecord -> Next = (messagerecord *) MemAlloc( sizeof(Record) ); + + // move to node + pTempRecord = pTempRecord -> Next; + } + + // set next to null + pTempRecord -> Next = NULL; + + // copy in string + wcscpy( pTempRecord -> pRecord, pString ); + + // done return + + return; + +} + + +void UpDateMessageRecordList( void ) +{ + + // simply checks to see if old and new message ids are the same, if so, do nothing + // otherwise clear list + + if( giMessageId != giPrevMessageId ) + { + // if chenged, clear list + ClearOutEmailMessageRecordsList( ); + + // set prev to current + giPrevMessageId = giMessageId; + } + +} + +void HandleAnySpecialEmailMessageEvents(INT32 iMessageId ) +{ + + // handles any special message events + + switch( iMessageId ) + { + + case( IMP_EMAIL_AGAIN ): + SetBookMark(IMP_BOOKMARK); + break; + case( IMP_EMAIL_INTRO ): + SetBookMark(IMP_BOOKMARK); + break; + } +} + +void ReDisplayBoxes( void ) +{ + + + + + // the email message itself + if(fDisplayMessageFlag) + { + // this simply redraws message with button manipulation + DisplayEmailMessage(GetEmailMessage(giMessageId)); + } + + if(fDeleteMailFlag) + { + // delete message, redisplay + DisplayDeleteNotice(GetEmailMessage(iDeleteId)); + } + + if(fNewMailFlag) + { + // if new mail, redisplay box + DisplayNewMailBox( ); + } +} + + +BOOLEAN HandleMailSpecialMessages( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail ) +{ + BOOLEAN fSpecialCase = FALSE; + + // this procedure will handle special cases of email messages that are not stored in email.edt, or need special processing + switch( usMessageId ) + { + case( IMP_EMAIL_PROFILE_RESULTS ): + + HandleIMPCharProfileResultsMessage( ); + fSpecialCase = TRUE; + + break; + case( MERC_INTRO ): + SetBookMark( MERC_BOOKMARK ); + fReDrawScreenFlag = TRUE; + break; + + + case INSUR_PAYMENT: + case INSUR_SUSPIC: + case INSUR_SUSPIC_2: + case INSUR_INVEST_OVER: + ModifyInsuranceEmails( usMessageId, iResults, pMail, INSUR_PAYMENT_LENGTH ); + break; + + case INSUR_1HOUR_FRAUD: + ModifyInsuranceEmails( usMessageId, iResults, pMail, INSUR_1HOUR_FRAUD_LENGTH ); + break; + + case MERC_NEW_SITE_ADDRESS: + //Set the book mark so the player can access the site + SetBookMark( MERC_BOOKMARK ); + break; + + case MERC_DIED_ON_OTHER_ASSIGNMENT: + ModifyInsuranceEmails( usMessageId, iResults, pMail, MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH ); + break; + + case AIM_MEDICAL_DEPOSIT_REFUND: + case AIM_MEDICAL_DEPOSIT_NO_REFUND: + case AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND: + ModifyInsuranceEmails( usMessageId, iResults, pMail, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH ); + break; + } + + return fSpecialCase; +} + + + +#define IMP_RESULTS_INTRO_LENGTH 9 + +#define IMP_RESULTS_PERSONALITY_INTRO IMP_RESULTS_INTRO_LENGTH +#define IMP_RESULTS_PERSONALITY_INTRO_LENGTH 5 +#define IMP_PERSONALITY_NORMAL IMP_RESULTS_PERSONALITY_INTRO + IMP_RESULTS_PERSONALITY_INTRO_LENGTH +#define IMP_PERSONALITY_LENGTH 4 +#define IMP_PERSONALITY_HEAT IMP_PERSONALITY_NORMAL + IMP_PERSONALITY_LENGTH +#define IMP_PERSONALITY_NERVOUS IMP_PERSONALITY_HEAT + IMP_PERSONALITY_LENGTH +#define IMP_PERSONALITY_CLAUSTROPHOBIC IMP_PERSONALITY_NERVOUS + IMP_PERSONALITY_LENGTH +#define IMP_PERSONALITY_NONSWIMMER IMP_PERSONALITY_CLAUSTROPHOBIC + IMP_PERSONALITY_LENGTH +#define IMP_PERSONALITY_FEAR_OF_INSECTS IMP_PERSONALITY_NONSWIMMER + IMP_PERSONALITY_LENGTH +#define IMP_PERSONALITY_FORGETFUL IMP_PERSONALITY_FEAR_OF_INSECTS + IMP_PERSONALITY_LENGTH + 1 +#define IMP_PERSONALITY_PSYCHO IMP_PERSONALITY_FORGETFUL + IMP_PERSONALITY_LENGTH +#define IMP_RESULTS_ATTITUDE_INTRO IMP_PERSONALITY_PSYCHO + IMP_PERSONALITY_LENGTH + 1 +#define IMP_RESULTS_ATTITUDE_LENGTH 5 +#define IMP_ATTITUDE_LENGTH 5 +#define IMP_ATTITUDE_NORMAL IMP_RESULTS_ATTITUDE_INTRO + IMP_RESULTS_ATTITUDE_LENGTH +#define IMP_ATTITUDE_FRIENDLY IMP_ATTITUDE_NORMAL + IMP_ATTITUDE_LENGTH +#define IMP_ATTITUDE_LONER IMP_ATTITUDE_FRIENDLY + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_OPTIMIST IMP_ATTITUDE_LONER + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_PESSIMIST IMP_ATTITUDE_OPTIMIST + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_AGGRESSIVE IMP_ATTITUDE_PESSIMIST + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_ARROGANT IMP_ATTITUDE_AGGRESSIVE + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_ASSHOLE IMP_ATTITUDE_ARROGANT + IMP_ATTITUDE_LENGTH + 1 +#define IMP_ATTITUDE_COWARD IMP_ATTITUDE_ASSHOLE + IMP_ATTITUDE_LENGTH +#define IMP_RESULTS_SKILLS IMP_ATTITUDE_COWARD + IMP_ATTITUDE_LENGTH + 1 +#define IMP_RESULTS_SKILLS_LENGTH 7 +#define IMP_SKILLS_IMPERIAL_SKILLS IMP_RESULTS_SKILLS + IMP_RESULTS_SKILLS_LENGTH + 1 +#define IMP_SKILLS_IMPERIAL_MARK IMP_SKILLS_IMPERIAL_SKILLS + 1 +#define IMP_SKILLS_IMPERIAL_MECH IMP_SKILLS_IMPERIAL_SKILLS + 2 +#define IMP_SKILLS_IMPERIAL_EXPL IMP_SKILLS_IMPERIAL_SKILLS + 3 +#define IMP_SKILLS_IMPERIAL_MED IMP_SKILLS_IMPERIAL_SKILLS + 4 + +#define IMP_SKILLS_NEED_TRAIN_SKILLS IMP_SKILLS_IMPERIAL_MED + 1 +#define IMP_SKILLS_NEED_TRAIN_MARK IMP_SKILLS_NEED_TRAIN_SKILLS + 1 +#define IMP_SKILLS_NEED_TRAIN_MECH IMP_SKILLS_NEED_TRAIN_SKILLS + 2 +#define IMP_SKILLS_NEED_TRAIN_EXPL IMP_SKILLS_NEED_TRAIN_SKILLS + 3 +#define IMP_SKILLS_NEED_TRAIN_MED IMP_SKILLS_NEED_TRAIN_SKILLS + 4 + +#define IMP_SKILLS_NO_SKILL IMP_SKILLS_NEED_TRAIN_MED + 1 +#define IMP_SKILLS_NO_SKILL_MARK IMP_SKILLS_NO_SKILL + 1 +#define IMP_SKILLS_NO_SKILL_MECH IMP_SKILLS_NO_SKILL + 2 +#define IMP_SKILLS_NO_SKILL_EXPL IMP_SKILLS_NO_SKILL + 3 +#define IMP_SKILLS_NO_SKILL_MED IMP_SKILLS_NO_SKILL + 4 + +#define IMP_SKILLS_SPECIAL_INTRO IMP_SKILLS_NO_SKILL_MED + 1 +#define IMP_SKILLS_SPECIAL_INTRO_LENGTH 2 +#define IMP_SKILLS_SPECIAL_LOCK IMP_SKILLS_SPECIAL_INTRO + IMP_SKILLS_SPECIAL_INTRO_LENGTH +#define IMP_SKILLS_SPECIAL_HAND IMP_SKILLS_SPECIAL_LOCK + 1 +#define IMP_SKILLS_SPECIAL_ELEC IMP_SKILLS_SPECIAL_HAND + 1 +#define IMP_SKILLS_SPECIAL_NIGHT IMP_SKILLS_SPECIAL_ELEC + 1 +#define IMP_SKILLS_SPECIAL_THROW IMP_SKILLS_SPECIAL_NIGHT + 1 +#define IMP_SKILLS_SPECIAL_TEACH IMP_SKILLS_SPECIAL_THROW + 1 +#define IMP_SKILLS_SPECIAL_HEAVY IMP_SKILLS_SPECIAL_TEACH + 1 +#define IMP_SKILLS_SPECIAL_AUTO IMP_SKILLS_SPECIAL_HEAVY + 1 +#define IMP_SKILLS_SPECIAL_STEALTH IMP_SKILLS_SPECIAL_AUTO + 1 +#define IMP_SKILLS_SPECIAL_AMBI IMP_SKILLS_SPECIAL_STEALTH + 1 +#define IMP_SKILLS_SPECIAL_THIEF IMP_SKILLS_SPECIAL_AMBI + 1 +#define IMP_SKILLS_SPECIAL_MARTIAL IMP_SKILLS_SPECIAL_THIEF + 1 +#define IMP_SKILLS_SPECIAL_KNIFE IMP_SKILLS_SPECIAL_MARTIAL + 1 + +#define IMP_RESULTS_PHYSICAL IMP_SKILLS_SPECIAL_KNIFE + 1 +#define IMP_RESULTS_PHYSICAL_LENGTH 7 + +#define IMP_PHYSICAL_SUPER IMP_RESULTS_PHYSICAL + IMP_RESULTS_PHYSICAL_LENGTH +#define IMP_PHYSICAL_SUPER_LENGTH 1 + +#define IMP_PHYSICAL_SUPER_HEALTH IMP_PHYSICAL_SUPER + IMP_PHYSICAL_SUPER_LENGTH +#define IMP_PHYSICAL_SUPER_AGILITY IMP_PHYSICAL_SUPER_HEALTH + 1 +#define IMP_PHYSICAL_SUPER_DEXTERITY IMP_PHYSICAL_SUPER_AGILITY + 1 +#define IMP_PHYSICAL_SUPER_STRENGTH IMP_PHYSICAL_SUPER_DEXTERITY + 1 +#define IMP_PHYSICAL_SUPER_LEADERSHIP IMP_PHYSICAL_SUPER_STRENGTH + 1 +#define IMP_PHYSICAL_SUPER_WISDOM IMP_PHYSICAL_SUPER_LEADERSHIP + 1 + +#define IMP_PHYSICAL_LOW IMP_PHYSICAL_SUPER_WISDOM + 1 +#define IMP_PHYSICAL_LOW_LENGTH 1 + +#define IMP_PHYSICAL_LOW_HEALTH IMP_PHYSICAL_LOW + IMP_PHYSICAL_LOW_LENGTH +#define IMP_PHYSICAL_LOW_AGILITY IMP_PHYSICAL_LOW_HEALTH + 1 +#define IMP_PHYSICAL_LOW_DEXTERITY IMP_PHYSICAL_LOW_AGILITY + 2 +#define IMP_PHYSICAL_LOW_STRENGTH IMP_PHYSICAL_LOW_DEXTERITY + 1 +#define IMP_PHYSICAL_LOW_LEADERSHIP IMP_PHYSICAL_LOW_STRENGTH + 1 +#define IMP_PHYSICAL_LOW_WISDOM IMP_PHYSICAL_LOW_LEADERSHIP + 1 + + +#define IMP_PHYSICAL_VERY_LOW IMP_PHYSICAL_LOW_WISDOM + 1 +#define IMP_PHYSICAL_VERY_LOW_LENGTH 1 + +#define IMP_PHYSICAL_VERY_LOW_HEALTH IMP_PHYSICAL_VERY_LOW + IMP_PHYSICAL_VERY_LOW_LENGTH +#define IMP_PHYSICAL_VERY_LOW_AGILITY IMP_PHYSICAL_VERY_LOW_HEALTH + 1 +#define IMP_PHYSICAL_VERY_LOW_DEXTERITY IMP_PHYSICAL_VERY_LOW_AGILITY + 1 +#define IMP_PHYSICAL_VERY_LOW_STRENGTH IMP_PHYSICAL_VERY_LOW_DEXTERITY + 1 +#define IMP_PHYSICAL_VERY_LOW_LEADERSHIP IMP_PHYSICAL_VERY_LOW_STRENGTH + 1 +#define IMP_PHYSICAL_VERY_LOW_WISDOM IMP_PHYSICAL_VERY_LOW_LEADERSHIP + 1 + + +#define IMP_PHYSICAL_END IMP_PHYSICAL_VERY_LOW_WISDOM + 1 +#define IMP_PHYSICAL_END_LENGTH 3 + +#define IMP_RESULTS_PORTRAIT IMP_PHYSICAL_END + IMP_PHYSICAL_END_LENGTH +#define IMP_RESULTS_PORTRAIT_LENGTH 6 + + +#define IMP_PORTRAIT_MALE_1 IMP_RESULTS_PORTRAIT + IMP_RESULTS_PORTRAIT_LENGTH +#define IMP_PORTRAIT_MALE_2 IMP_PORTRAIT_MALE_1 + 4 +#define IMP_PORTRAIT_MALE_3 IMP_PORTRAIT_MALE_2 + 4 +#define IMP_PORTRAIT_MALE_4 IMP_PORTRAIT_MALE_3 + 4 +#define IMP_PORTRAIT_MALE_5 IMP_PORTRAIT_MALE_4 + 4 +#define IMP_PORTRAIT_MALE_6 IMP_PORTRAIT_MALE_5 + 4 + +#define IMP_PORTRAIT_FEMALE_1 IMP_PORTRAIT_MALE_6 + 4 +#define IMP_PORTRAIT_FEMALE_2 IMP_PORTRAIT_FEMALE_1 + 4 +#define IMP_PORTRAIT_FEMALE_3 IMP_PORTRAIT_FEMALE_2 + 4 +#define IMP_PORTRAIT_FEMALE_4 IMP_PORTRAIT_FEMALE_3 + 4 +#define IMP_PORTRAIT_FEMALE_5 IMP_PORTRAIT_FEMALE_4 + 4 +#define IMP_PORTRAIT_FEMALE_6 IMP_PORTRAIT_FEMALE_5 + 4 + + + +#define IMP_RESULTS_END IMP_PORTRAIT_FEMALE_6 + 1 +#define IMP_RESULTS_END_LENGTH 3 + + + + +void HandleIMPCharProfileResultsMessage( void) +{ + // special case, IMP profile return + INT32 iTotalHeight=0; + INT32 iCnt=0; + INT32 iHeight=0; + INT32 iCounter=0; +// wchar_t pString[MAIL_STRING_SIZE/2 + 1]; + wchar_t pString[MAIL_STRING_SIZE]; + INT32 iOffSet=0; + INT32 iViewerY=0; + INT32 iHeightTemp=0; + INT32 iHeightSoFar = 0; + RecordPtr pTempRecord; + INT32 iEndOfSection =0; + INT32 iRand = 0; + BOOLEAN fSufficientMechSkill = FALSE, fSufficientMarkSkill = FALSE, fSufficientMedSkill = FALSE, fSufficientExplSkill = FALSE; + BOOLEAN fSufficientHlth = FALSE, fSufficientStr = FALSE, fSufficientWis = FALSE, fSufficientAgi = FALSE, fSufficientDex = FALSE, fSufficientLdr = FALSE; + + iRand = Random( 32767 ); + + // set record ptr to head of list + pTempRecord=pMessageRecordList; + + // increment height for size of one line + iHeight+=GetFontHeight( MESSAGE_FONT ); + + // load intro + iEndOfSection = IMP_RESULTS_INTRO_LENGTH; + + // list doesn't exist, reload + if( !pTempRecord ) + { + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // have to place players name into string for first record + if( iCounter == 0) + { + wchar_t zTemp[512]; + + swprintf( zTemp, L" %s", gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].zName ); + wcscat( pString, zTemp ); + } + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + // now the personality intro + iOffSet = IMP_RESULTS_PERSONALITY_INTRO; + iEndOfSection = IMP_RESULTS_PERSONALITY_INTRO_LENGTH + 1; + iCounter = 0; + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + // personality itself + switch( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bPersonalityTrait) + { + // normal as can be + case( NO_PERSONALITYTRAIT ): + iOffSet = IMP_PERSONALITY_NORMAL; + break; + case( HEAT_INTOLERANT ): + iOffSet = IMP_PERSONALITY_HEAT; + break; + case( NERVOUS ): + iOffSet = IMP_PERSONALITY_NERVOUS; + break; + case( CLAUSTROPHOBIC ): + iOffSet = IMP_PERSONALITY_CLAUSTROPHOBIC; + break; + case( NONSWIMMER ): + iOffSet = IMP_PERSONALITY_NONSWIMMER; + break; + case( FEAR_OF_INSECTS ): + iOffSet = IMP_PERSONALITY_FEAR_OF_INSECTS; + break; + case( FORGETFUL ): + iOffSet = IMP_PERSONALITY_FORGETFUL; + break; + case( PSYCHO ): + iOffSet = IMP_PERSONALITY_PSYCHO; + break; + } + + // personality tick +// DEF: removed 1/12/99, cause it was changing the length of email that were already calculated +// LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + Random( IMP_PERSONALITY_LENGTH - 1 ) + 1 ), MAIL_STRING_SIZE ); + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + 1 ), MAIL_STRING_SIZE ); + // add to list + AddEmailRecordToList( pString ); + + // persoanlity paragraph + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + IMP_PERSONALITY_LENGTH ), MAIL_STRING_SIZE ); + // add to list + AddEmailRecordToList( pString ); + + // extra paragraph for bugs + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bPersonalityTrait == FEAR_OF_INSECTS ) + { + // persoanlity paragraph + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + IMP_PERSONALITY_LENGTH + 1 ), MAIL_STRING_SIZE ); + // add to list + AddEmailRecordToList( pString ); + } + + // attitude intro + // now the personality intro + iOffSet = IMP_RESULTS_ATTITUDE_INTRO; + iEndOfSection = IMP_RESULTS_ATTITUDE_LENGTH; + iCounter = 0; + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + // personality itself + switch( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bAttitude ) + { + // normal as can be + case( ATT_NORMAL ): + iOffSet = IMP_ATTITUDE_NORMAL; + break; + case( ATT_FRIENDLY ): + iOffSet = IMP_ATTITUDE_FRIENDLY; + break; + case( ATT_LONER ): + iOffSet = IMP_ATTITUDE_LONER; + break; + case( ATT_OPTIMIST ): + iOffSet = IMP_ATTITUDE_OPTIMIST; + break; + case( ATT_PESSIMIST ): + iOffSet = IMP_ATTITUDE_PESSIMIST; + break; + case( ATT_AGGRESSIVE ): + iOffSet = IMP_ATTITUDE_AGGRESSIVE; + break; + case( ATT_ARROGANT ): + iOffSet = IMP_ATTITUDE_ARROGANT; + break; + case( ATT_ASSHOLE ): + iOffSet = IMP_ATTITUDE_ASSHOLE; + break; + case( ATT_COWARD ): + iOffSet = IMP_ATTITUDE_COWARD; + break; + + } + + // attitude title + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet ), MAIL_STRING_SIZE ); + // add to list + AddEmailRecordToList( pString ); + + + // attitude tick +// DEF: removed 1/12/99, cause it was changing the length of email that were already calculated +// LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + Random( IMP_ATTITUDE_LENGTH - 2 ) + 1 ), MAIL_STRING_SIZE ); + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + 1 ), MAIL_STRING_SIZE ); + // add to list + AddEmailRecordToList( pString ); + + // attitude paragraph + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + IMP_ATTITUDE_LENGTH - 1 ), MAIL_STRING_SIZE ); + // add to list + AddEmailRecordToList( pString ); + + //check for second paragraph + if( iOffSet != IMP_ATTITUDE_NORMAL ) + { + // attitude paragraph + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + IMP_ATTITUDE_LENGTH ), MAIL_STRING_SIZE ); + // add to list + AddEmailRecordToList( pString ); + } + + + // skills + // now the skills intro + iOffSet = IMP_RESULTS_SKILLS; + iEndOfSection = IMP_RESULTS_SKILLS_LENGTH; + iCounter = 0; + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + // imperial skills + iOffSet = IMP_SKILLS_IMPERIAL_SKILLS; + iEndOfSection = 0; + iCounter = 0; + + // marksmanship + if ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMarksmanship >= SUPER_SKILL_VALUE ) + { + fSufficientMarkSkill = TRUE; + iEndOfSection = 1; + } + + // medical + if ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMedical >= SUPER_SKILL_VALUE ) + { + fSufficientMedSkill = TRUE; + iEndOfSection = 1; + } + + // mechanical + if ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMechanical >= SUPER_SKILL_VALUE ) + { + fSufficientMechSkill = TRUE; + iEndOfSection = 1; + } + + if ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bExplosive >= SUPER_SKILL_VALUE ) + { + fSufficientExplSkill = TRUE; + iEndOfSection = 1; + } + + while (iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + // now handle skills + if ( fSufficientMarkSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_MARK ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + + if ( fSufficientMedSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_MED ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if ( fSufficientMechSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_MECH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + // explosives + if ( fSufficientExplSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_IMPERIAL_EXPL ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + fSufficientMechSkill = FALSE; + fSufficientMarkSkill = FALSE; + fSufficientExplSkill = FALSE; + fSufficientMedSkill = FALSE; + + // imperial skills + iOffSet = IMP_SKILLS_NEED_TRAIN_SKILLS; + iEndOfSection = 0; + iCounter = 0; + + + + // now the needs training values + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMarksmanship > NO_CHANCE_IN_HELL_SKILL_VALUE ) &&( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMarksmanship <= NEEDS_TRAINING_SKILL_VALUE ) ) + { + fSufficientMarkSkill = TRUE; + iEndOfSection = 1; + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMedical > NO_CHANCE_IN_HELL_SKILL_VALUE ) &&( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMedical <= NEEDS_TRAINING_SKILL_VALUE ) ) + { + fSufficientMedSkill = TRUE; + iEndOfSection = 1; + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMechanical > NO_CHANCE_IN_HELL_SKILL_VALUE ) &&( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMechanical <= NEEDS_TRAINING_SKILL_VALUE ) ) + { + fSufficientMechSkill = TRUE; + iEndOfSection = 1; + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bExplosive > NO_CHANCE_IN_HELL_SKILL_VALUE ) &&( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bExplosive <= NEEDS_TRAINING_SKILL_VALUE ) ) + { + fSufficientExplSkill = TRUE; + iEndOfSection = 1; + } + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + if( fSufficientMarkSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NEED_TRAIN_MARK ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientMedSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NEED_TRAIN_MED ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientMechSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NEED_TRAIN_MECH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientExplSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NEED_TRAIN_EXPL ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + fSufficientMechSkill = FALSE; + fSufficientMarkSkill = FALSE; + fSufficientExplSkill = FALSE; + fSufficientMedSkill = FALSE; + + // and the no chance in hell of doing anything useful values + + // no skill + iOffSet = IMP_SKILLS_NO_SKILL; + iEndOfSection = 0; + iCounter = 0; + + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMarksmanship <= NO_CHANCE_IN_HELL_SKILL_VALUE ) + { + fSufficientMarkSkill = TRUE; + iEndOfSection = 1; + } + + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMedical <= NO_CHANCE_IN_HELL_SKILL_VALUE ) + { + fSufficientMedSkill = TRUE; + iEndOfSection = 1; + } + + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bMechanical <= NO_CHANCE_IN_HELL_SKILL_VALUE ) + { + fSufficientMechSkill = TRUE; + iEndOfSection = 1; + } + + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bExplosive <= NO_CHANCE_IN_HELL_SKILL_VALUE ) + { + fSufficientExplSkill = TRUE; + iEndOfSection = 1; + } + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + if( fSufficientMechSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NO_SKILL_MECH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientMarkSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NO_SKILL_MARK ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientMedSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NO_SKILL_MED ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + if( fSufficientExplSkill ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_NO_SKILL_EXPL ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + // now the specialized skills + // imperial skills + iOffSet = IMP_SKILLS_SPECIAL_INTRO; + iEndOfSection = IMP_SKILLS_SPECIAL_INTRO_LENGTH; + iCounter = 0; + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == KNIFING )||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == KNIFING ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_KNIFE ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + // lockpick + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == LOCKPICKING)||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == LOCKPICKING) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_LOCK ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + // hand to hand + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == HANDTOHAND )||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == HANDTOHAND ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_HAND ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + // electronics + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == ELECTRONICS )||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == ELECTRONICS ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_ELEC ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == NIGHTOPS )||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == NIGHTOPS ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_NIGHT ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == THROWING)||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == THROWING) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_THROW ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == TEACHING )||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == TEACHING ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_TEACH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == HEAVY_WEAPS )||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == HEAVY_WEAPS ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_HEAVY ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == AUTO_WEAPS )||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == AUTO_WEAPS ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_AUTO ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == STEALTHY )||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == STEALTHY ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_STEALTH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == AMBIDEXT)||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == AMBIDEXT) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_AMBI ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == THIEF )||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == THIEF ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_THIEF ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait == MARTIALARTS )||( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bSkillTrait2 == MARTIALARTS ) ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_SKILLS_SPECIAL_MARTIAL ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + + // now the physical + // imperial physical + iOffSet = IMP_RESULTS_PHYSICAL; + iEndOfSection = IMP_RESULTS_PHYSICAL_LENGTH; + iCounter = 0; + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + // super physical + iOffSet = IMP_PHYSICAL_SUPER; + iEndOfSection = 0; + iCounter = 0; + + + // health + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLife >= SUPER_STAT_VALUE ) + { + fSufficientHlth = TRUE; + iEndOfSection = 1; + } + + // dex + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bDexterity >= SUPER_STAT_VALUE ) + { + fSufficientDex = TRUE; + iEndOfSection = 1; + } + + // agility + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bAgility >= SUPER_STAT_VALUE ) + { + fSufficientAgi = TRUE; + iEndOfSection = 1; + } + + // strength + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bStrength >= SUPER_STAT_VALUE ) + { + fSufficientStr = TRUE; + iEndOfSection = 1; + } + + // wisdom + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bWisdom >= SUPER_STAT_VALUE ) + { + fSufficientWis = TRUE; + iEndOfSection =1; + } + + // leadership + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLeadership >= SUPER_STAT_VALUE ) + { + fSufficientLdr = TRUE; + iEndOfSection = 1; + } + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + if( fSufficientHlth ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_HEALTH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + + if( fSufficientDex ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_DEXTERITY ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientStr ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_STRENGTH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientAgi ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_AGILITY ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientWis ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_WISDOM ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientLdr ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_SUPER_LEADERSHIP ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + fSufficientHlth = FALSE; + fSufficientStr = FALSE; + fSufficientWis = FALSE; + fSufficientAgi = FALSE; + fSufficientDex = FALSE; + fSufficientLdr = FALSE; + + // now the low attributes + // super physical + iOffSet = IMP_PHYSICAL_LOW; + iEndOfSection = 0; + iCounter = 0; + + // health + if( ( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLife < NEEDS_TRAINING_STAT_VALUE ) &&( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLife > NO_CHANCE_IN_HELL_STAT_VALUE ) ) + { + fSufficientHlth = TRUE; + iEndOfSection = 1; + } + + // strength + if( (gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bStrength < NEEDS_TRAINING_STAT_VALUE )&&( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bStrength > NO_CHANCE_IN_HELL_STAT_VALUE ) ) + { + fSufficientStr = TRUE; + iEndOfSection = 1; + } + + // agility + if( (gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bAgility < NEEDS_TRAINING_STAT_VALUE )&&( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bAgility <= NO_CHANCE_IN_HELL_STAT_VALUE ) ) + { + fSufficientAgi = TRUE; + iEndOfSection = 1; + } + + // wisdom + if( (gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bWisdom < NEEDS_TRAINING_STAT_VALUE)&&( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bWisdom > NO_CHANCE_IN_HELL_STAT_VALUE ) ) + { + fSufficientWis = TRUE; + iEndOfSection = 1; + } + + // leadership + if( (gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLeadership < NEEDS_TRAINING_STAT_VALUE)&&( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLeadership > NO_CHANCE_IN_HELL_STAT_VALUE ) ) + { + fSufficientLdr = TRUE; + iEndOfSection = 1; + } + + // dex + if( (gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bDexterity < NEEDS_TRAINING_STAT_VALUE )&&( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bDexterity > NO_CHANCE_IN_HELL_STAT_VALUE ) ) + { + fSufficientDex = TRUE; + iEndOfSection = 1; + } + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + if( fSufficientHlth ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_HEALTH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + + if( fSufficientDex ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_DEXTERITY ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientStr ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_STRENGTH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + + + if( fSufficientAgi ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_AGILITY ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientWis ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_WISDOM ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientLdr ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_LOW_LEADERSHIP ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + + + + + + + + + // very low physical + iOffSet = IMP_PHYSICAL_VERY_LOW; + iEndOfSection = 0; + iCounter = 0; + + fSufficientHlth = FALSE; + fSufficientStr = FALSE; + fSufficientWis = FALSE; + fSufficientAgi = FALSE; + fSufficientDex = FALSE; + fSufficientLdr = FALSE; + + // health + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLife <= NO_CHANCE_IN_HELL_STAT_VALUE ) + { + fSufficientHlth = TRUE; + iEndOfSection =1; + } + + // dex + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bDexterity <= NO_CHANCE_IN_HELL_STAT_VALUE ) + { + fSufficientDex = TRUE; + iEndOfSection =1; + } + + // strength + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bStrength <= NO_CHANCE_IN_HELL_STAT_VALUE ) + { + fSufficientStr = TRUE; + iEndOfSection = 1; + } + + // agility + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bAgility <= NO_CHANCE_IN_HELL_STAT_VALUE ) + { + fSufficientAgi = TRUE; + iEndOfSection = 1; + } + + // wisdom + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bWisdom <= NO_CHANCE_IN_HELL_STAT_VALUE ) + { + fSufficientWis = TRUE; + iEndOfSection =1; + } + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + if( fSufficientHlth ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_HEALTH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + + + if( fSufficientDex ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_DEXTERITY ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + if( fSufficientStr ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_STRENGTH ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + + + if( fSufficientAgi ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_AGILITY ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + + + if( fSufficientWis ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_WISDOM ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + + // leadership + if( gMercProfiles[ PLAYER_GENERATED_CHARACTER_ID + LaptopSaveInfo.iVoiceId ].bLeadership <= NO_CHANCE_IN_HELL_STAT_VALUE ) + { + fSufficientLdr = TRUE; + } + + if( fSufficientLdr ) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( IMP_PHYSICAL_VERY_LOW_LEADERSHIP ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + } + + // very low physical + iOffSet = IMP_RESULTS_PORTRAIT; + iEndOfSection = IMP_RESULTS_PORTRAIT_LENGTH; + iCounter = 0; + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + + // portraits + + switch( iPortraitNumber ) + { + case( 0 ): + iOffSet = IMP_PORTRAIT_MALE_1; + break; + case( 1 ): + iOffSet = IMP_PORTRAIT_MALE_2; + break; + case( 2 ): + iOffSet = IMP_PORTRAIT_MALE_3; + break; + case( 3 ): + iOffSet = IMP_PORTRAIT_MALE_4; + break; + case( 4 ): + case( 5 ): + iOffSet = IMP_PORTRAIT_MALE_5; + break; + case( 6 ): + case( 7 ): + iOffSet = IMP_PORTRAIT_MALE_6; + break; + case( 8 ): + iOffSet = IMP_PORTRAIT_FEMALE_1; + break; + case( 9 ): + iOffSet = IMP_PORTRAIT_FEMALE_2; + break; + case( 10 ): + iOffSet = IMP_PORTRAIT_FEMALE_3; + break; + case( 11 ): + case( 12 ): + iOffSet = IMP_PORTRAIT_FEMALE_4; + break; + case( 13 ): + case( 14 ): + iOffSet = IMP_PORTRAIT_FEMALE_5; + break; + } + + if( ( iRand % 2 ) == 0 ) + { + iOffSet += 2; + } + + iEndOfSection = 2; + iCounter = 0; + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + iOffSet = IMP_RESULTS_END; + iEndOfSection = IMP_RESULTS_END_LENGTH; + iCounter = 0; + + while(iEndOfSection > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Impass.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + + giPrevMessageId = giMessageId; + + } + + pTempRecord = pMessageRecordList; + + +} + +void HandleEmailViewerButtonStates( void ) +{ + // handle state of email viewer buttons + + if( fDisplayMessageFlag == FALSE ) + { + // not displaying message, leave + return; + } + + + + if( giNumberOfPagesToCurrentEmail <= 2 ) + { + return; + } + + // turn off previous page button + if( giMessagePage == 0 ) + { + DisableButton( giMailMessageButtons[ 0 ] ); + } + else + { + EnableButton( giMailMessageButtons[ 0 ] ); + } + + + // turn off next page button + if( pEmailPageInfo[ giMessagePage + 1 ].pFirstRecord == NULL ) + { + DisableButton( giMailMessageButtons[ 1 ] ); + } + else + { + EnableButton( giMailMessageButtons[ 1 ] ); + } + + return; + +} + + +void SetUpIconForButton( ) +{ + // if we just got in, return, don't set any + + if( fJustStartedEmail == TRUE ) + { + return; + } + + + + + return; +} + + +void DeleteCurrentMessage( void ) +{ + // will delete the currently displayed message + + // set current message to be deleted + iDeleteId = giMessageId; + + // set the currently displayed message to none + giMessageId = -1; + + // reset display message flag + fDisplayMessageFlag=FALSE; + + // reset page being displayed + giMessagePage = 0; + + fDeleteInternal = TRUE; + + // delete message + DeleteEmail( ); + + fDeleteInternal = FALSE; + + // force update of entire screen + fReDrawScreenFlag=TRUE; + + // rerender email + RenderEmail(); + + return; +} + + +void CreateNextPreviousEmailPageButtons( void ) +{ + + // this function will create the buttons to advance and go back email pages + + // next button + giMailPageButtonsImage[0]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,1,-1,4,-1 ); + giMailPageButtons[0] = QuickCreateButton( giMailPageButtonsImage[0],NEXT_PAGE_X, NEXT_PAGE_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)NextRegionButtonCallback ); + SetButtonCursor(giMailPageButtons[0], CURSOR_LAPTOP_SCREEN); + + // previous button + giMailPageButtonsImage[1]= LoadButtonImage( "LAPTOP\\NewMailButtons.sti" ,-1,0,-1,3,-1 ); + giMailPageButtons[1] = QuickCreateButton( giMailPageButtonsImage[1],PREVIOUS_PAGE_X, NEXT_PAGE_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PreviousRegionButtonCallback ); + SetButtonCursor(giMailPageButtons[1], CURSOR_LAPTOP_SCREEN); + + /* + // set up disable methods + SpecifyDisabledButtonStyle( giMailPageButtons[1], DISABLED_STYLE_SHADED ); + SpecifyDisabledButtonStyle( giMailPageButtons[0], DISABLED_STYLE_SHADED ); +*/ + + return; +} + + +void UpdateStatusOfNextPreviousButtons( void ) +{ + + // set the states of the page advance buttons + + DisableButton( giMailPageButtons[ 0 ]); + DisableButton( giMailPageButtons[ 1 ]); + + if( iCurrentPage > 0 ) + { + EnableButton( giMailPageButtons[ 1 ]); + } + + if( iCurrentPage < iLastPage ) + { + EnableButton( giMailPageButtons[ 0 ] ); + } +} + + +void DisplayWhichPageOfEmailProgramIsDisplayed( void ) +{ + // will draw the number of the email program we are viewing right now + CHAR16 sString[ 10 ]; + + // font stuff + SetFont(MESSAGE_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // page number + if( iLastPage < 0 ) + swprintf( sString, L"%d / %d", 1, 1); + else + swprintf( sString, L"%d / %d", iCurrentPage + 1, iLastPage + 1); + + // print it + mprintf( PAGE_NUMBER_X ,PAGE_NUMBER_Y, sString ); + + // restore shadow + SetFontShadow( DEFAULT_SHADOW ); + + return; +} + +void OpenMostRecentUnreadEmail( void ) +{ + // will open the most recent email the player has recieved and not read + INT32 iMostRecentMailId = -1; + EmailPtr pB=pEmailList; + UINT32 iLowestDate = 9999999; + + while( pB ) + { + // if date is lesser and unread , swap + if( ( pB->iDate < iLowestDate )&&( pB->fRead == FALSE ) ) + { + iMostRecentMailId = pB -> iId; + iLowestDate = pB -> iDate; + } + + // next in B's list + pB=pB->Next; + } + + // set up id + giMessageId = iMostRecentMailId; + + // valid message, show it + if( giMessageId != -1 ) + { + fDisplayMessageFlag = TRUE; + } + + return; +} + + +BOOLEAN DisplayNumberOfPagesToThisEmail( INT32 iViewerY ) +{ + // display the indent for the display of pages to this email..along with the current page/number of pages + + + INT32 iCounter=0; + INT16 sX = 0, sY = 0; + CHAR16 sString[ 32 ]; + + + // get and blt the email list background + // load, blt and delete graphics + //VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; +// FilenameForBPP( "LAPTOP\\mailindent.sti", VObjectDesc.ImageFile ); + //CHECKF( AddVideoObject( &VObjectDesc, &uiMailIndent ) ); + // GetVideoObject( &hHandle, uiMailIndent ); + // BltVideoObject( FRAME_BUFFER, hHandle, 0,VIEWER_X + INDENT_X_OFFSET, VIEWER_Y + iViewerY + INDENT_Y_OFFSET - 10, VO_BLT_SRCTRANSPARENCY,NULL ); + // DeleteVideoObjectFromIndex( uiMailIndent ); + + giNumberOfPagesToCurrentEmail = ( giNumberOfPagesToCurrentEmail ); + + // parse current page and max number of pages to email + swprintf( sString,L"%d / %d", ( giMessagePage + 1 ), ( giNumberOfPagesToCurrentEmail - 1 ) ); + + SetFont( FONT12ARIAL ); + SetFontForeground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); + + // turn off the shadows + SetFontShadow(NO_SHADOW); + + SetFontDestBuffer(FRAME_BUFFER, 0 , 0 , SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + + FindFontCenterCoordinates(VIEWER_X + INDENT_X_OFFSET, 0,INDENT_X_WIDTH, 0, sString, FONT12ARIAL, &sX, &sY); + mprintf( sX, VIEWER_Y + iViewerY + INDENT_Y_OFFSET - 2, sString ); + + + // restore shadows + SetFontShadow( DEFAULT_SHADOW ); + + return ( TRUE ); +} + + +INT32 GetNumberOfPagesToEmail( ) +{ + RecordPtr pTempRecord; + INT32 iNumberOfPagesToEmail = 0; + + + // set temp record to head of list + pTempRecord=pMessageRecordList; + + // run through messages, and find out how many + while( pTempRecord ) + { + pTempRecord = GetFirstRecordOnThisPage( pMessageRecordList, MESSAGE_FONT, MESSAGE_WIDTH, MESSAGE_GAP, iNumberOfPagesToEmail, MAX_EMAIL_MESSAGE_PAGE_SIZE ); + iNumberOfPagesToEmail++; + } + + + return( iNumberOfPagesToEmail ); +} + + +void ShutDownEmailList() +{ + EmailPtr pEmail = pEmailList; + EmailPtr pTempEmail = NULL; + + //loop through all the emails to delete them + while( pEmail ) + { + pTempEmail = pEmail; + + pEmail = pEmail->Next; + + MemFree( pTempEmail->pSubject ); + pTempEmail->pSubject = NULL; + + MemFree( pTempEmail ); + pTempEmail = NULL; + } + pEmailList = NULL; + + ClearPages(); +} + +void PreProcessEmail( EmailPtr pMail ) +{ + RecordPtr pTempRecord, pCurrentRecord, pLastRecord , pTempList; + CHAR16 pString[ 512 ]; + INT32 iCounter = 0, iHeight = 0, iOffSet = 0; + BOOLEAN fGoingOffCurrentPage = FALSE; + INT32 iYPositionOnPage = 0; + + iOffSet=(INT32)pMail->usOffset; + + // set record ptr to head of list + pTempRecord=pMessageRecordList; + + if( pEmailPageInfo[ 0 ].pFirstRecord != NULL ) + { + // already processed + return; + } + + // list doesn't exist, reload + if( !pTempRecord ) + { + while(pMail->usLength > iCounter) + { + // read one record from email file + LoadEncryptedDataFromFile( "BINARYDATA\\Email.edt", pString, MAIL_STRING_SIZE * ( iOffSet + iCounter ), MAIL_STRING_SIZE ); + + // add to list + AddEmailRecordToList( pString ); + + // increment email record counter + iCounter++; + } + giPrevMessageId = giMessageId; + + } + + // set record ptr to head of list + pTempRecord=pMessageRecordList; +//def removed + // pass the subject line + if( pTempRecord && pMail->usOffset != IMP_EMAIL_PROFILE_RESULTS) + { + pTempRecord = pTempRecord->Next; + } + + // get number of pages to this email + giNumberOfPagesToCurrentEmail = GetNumberOfPagesToEmail( ); + + + while( pTempRecord ) + { + + // copy over string + wcscpy(pString, pTempRecord -> pRecord); + + // get the height of the string, ONLY!...must redisplay ON TOP OF background graphic + iHeight += IanWrappedStringHeight(VIEWER_X + 9, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + iHeight + GetFontHeight(MESSAGE_FONT)), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE,0); + + // next message record string + pTempRecord = pTempRecord -> Next; + + } + + iViewerPositionY = ( 261 - iHeight ) / 2; + + if ( iViewerPositionY < 0 ) + { + iViewerPositionY = 0; + } + + // set total height to height of records displayed + iTotalHeight=iHeight; + + // if the message background is less than MIN_MESSAGE_HEIGHT_IN_LINES, set to that number + if( ( iTotalHeight / GetFontHeight( MESSAGE_FONT ) ) < MIN_MESSAGE_HEIGHT_IN_LINES) + { + iTotalHeight=GetFontHeight( MESSAGE_FONT ) * MIN_MESSAGE_HEIGHT_IN_LINES; + } + + if(iTotalHeight > MAX_EMAIL_MESSAGE_PAGE_SIZE) + { + // if message to big to fit on page + iTotalHeight = MAX_EMAIL_MESSAGE_PAGE_SIZE + 10; + } + else + { + iTotalHeight += 10; + } + + pTempRecord=pMessageRecordList; + + if( iTotalHeight < MAX_EMAIL_MESSAGE_PAGE_SIZE ) + { + fOnLastPageFlag = TRUE; + + if( pTempRecord && pMail->usOffset != IMP_EMAIL_PROFILE_RESULTS) + { + pTempRecord = pTempRecord->Next; + } + +/* +//Def removed + if( pTempRecord ) + { + pTempRecord = pTempRecord->Next; + } +*/ + + pEmailPageInfo[ 0 ].pFirstRecord = pTempRecord ; + pEmailPageInfo[ 0 ].iPageNumber = 0; + + + Assert(pTempRecord); // required, otherwise we're testing pCurrentRecord when undefined later + + while( pTempRecord ) + { + pCurrentRecord = pTempRecord; + + // increment email record ptr + pTempRecord = pTempRecord -> Next; + + } + + // only one record to this email?..then set next to null + if( pCurrentRecord == pEmailPageInfo[ 0 ].pFirstRecord ) + { + pCurrentRecord = NULL; + } + + // set up the last record for the page + pEmailPageInfo[ 0 ].pLastRecord = pCurrentRecord; + + // now set up the next page + pEmailPageInfo[ 1 ].pFirstRecord = NULL; + pEmailPageInfo[ 1 ].pLastRecord = NULL; + pEmailPageInfo[ 1 ].iPageNumber = 1; + } + else + { + fOnLastPageFlag = FALSE; + pTempList = pMessageRecordList; + + if( pTempList && pMail->usOffset != IMP_EMAIL_PROFILE_RESULTS) + { + pTempList = pTempList->Next; + } + +/* +//def removed + // skip the subject + if( pTempList ) + { + pTempList = pTempList->Next; + } + +*/ + iCounter = 0; + + // more than one page + //for( iCounter = 0; iCounter < giNumberOfPagesToCurrentEmail; iCounter++ ) + while( pTempRecord = GetFirstRecordOnThisPage( pTempList, MESSAGE_FONT, MESSAGE_WIDTH, MESSAGE_GAP, iCounter, MAX_EMAIL_MESSAGE_PAGE_SIZE ) ) + { + iYPositionOnPage = 0; + + pEmailPageInfo[ iCounter ].pFirstRecord = pTempRecord; + pEmailPageInfo[ iCounter ].iPageNumber = iCounter; + pLastRecord = NULL; + + // go to the right record + while( pTempRecord ) + { + // copy over string + wcscpy( pString, pTempRecord -> pRecord ); + + if( pString[ 0 ] == 0 ) + { + // on last page + fOnLastPageFlag = TRUE; + } + + if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, MESSAGE_WIDTH, MESSAGE_GAP, + MESSAGE_FONT, 0, pTempRecord->pRecord, + 0, 0, 0 ) ) <= MAX_EMAIL_MESSAGE_PAGE_SIZE ) + { + // now print it + + iYPositionOnPage += IanWrappedStringHeight(VIEWER_X + 9, ( UINT16 )( VIEWER_MESSAGE_BODY_START_Y + 10 +iYPositionOnPage + iViewerPositionY), MESSAGE_WIDTH, MESSAGE_GAP, MESSAGE_FONT, MESSAGE_COLOR,pString,0,FALSE, IAN_WRAP_NO_SHADOW); + fGoingOffCurrentPage = FALSE; + } + else + { + // gonna get cut off...end now + fGoingOffCurrentPage = TRUE; + } + + + + pCurrentRecord = pTempRecord; + pTempRecord = pTempRecord ->Next; + + if( fGoingOffCurrentPage == FALSE ) + { + pLastRecord = pTempRecord; + } + // record get cut off?...end now + + if( fGoingOffCurrentPage == TRUE ) + { + pTempRecord = NULL; + } + } + + if( pLastRecord == pEmailPageInfo[ iCounter ].pFirstRecord ) + { + pLastRecord = NULL; + } + + pEmailPageInfo[ iCounter ].pLastRecord = pLastRecord; + iCounter++; + } + + pEmailPageInfo[ iCounter ].pFirstRecord = NULL; + pEmailPageInfo[ iCounter ].pLastRecord = NULL; + pEmailPageInfo[ iCounter ].iPageNumber = iCounter; + } + + + +} + + +void ModifyInsuranceEmails( UINT16 usMessageId, INT32 *iResults, EmailPtr pMail, UINT8 ubNumberOfRecords ) +{ + INT32 iHeight=0; + RecordPtr pTempRecord; +// wchar_t pString[MAIL_STRING_SIZE/2 + 1]; + wchar_t pString[MAIL_STRING_SIZE]; + UINT8 ubCnt; + + + // Replace the name in the subject line +// swprintf( pMail->pSubject, gMercProfiles[ pMail->ubFirstData ].zNickname ); + + // set record ptr to head of list + pTempRecord=pMessageRecordList; + + // increment height for size of one line + iHeight+=GetFontHeight( MESSAGE_FONT ); + + for( ubCnt=0; ubCntuiSecondData ].zName ); + } + else + { + CHAR16 sDollarAmount[64]; + + swprintf( sDollarAmount, L"%d", pMail->iFirstData ); + + InsertCommasForDollarFigure( sDollarAmount ); + InsertDollarSignInToString( sDollarAmount ); + + //add the mercs name to the string + wcscat( pFinishedString, sDollarAmount ); + } + } + else + { + //add the rest of the string + wcscat( pFinishedString, &pTempString[ iCurLocInSourceString ] ); + + iCurLocInSourceString += wcslen( &pTempString[ iCurLocInSourceString ] ); + } + } + + return( TRUE ); +} + +#ifdef JA2BETAVERSION +void AddAllEmails() +{ + UINT32 uiCnt; + UINT32 uiOffset; + + AddEmail(IMP_EMAIL_INTRO,IMP_EMAIL_INTRO_LENGTH,CHAR_PROFILE_SITE, GetWorldTotalMin() ); + AddEmail(ENRICO_CONGRATS,ENRICO_CONGRATS_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + AddEmail(IMP_EMAIL_AGAIN,IMP_EMAIL_AGAIN_LENGTH,1, GetWorldTotalMin( ) ); + AddEmail(MERC_INTRO, MERC_INTRO_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin( ) ); + AddEmail( MERC_NEW_SITE_ADDRESS, MERC_NEW_SITE_ADDRESS_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin() ); + + AddEmail(IMP_EMAIL_PROFILE_RESULTS, IMP_EMAIL_PROFILE_RESULTS_LENGTH, IMP_PROFILE_RESULTS, GetWorldTotalMin( ) ); + + AddEmail( MERC_WARNING, MERC_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + AddEmail( MERC_INVALID, MERC_INVALID_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + AddEmail( MERC_FIRST_WARNING, MERC_FIRST_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + + uiOffset = MERC_UP_LEVEL_BIFF; + for( uiCnt=0; uiCnt<10; uiCnt++) + { + AddEmail( uiOffset, MERC_UP_LEVEL_LENGTH_BIFF, SPECK_FROM_MERC, GetWorldTotalMin() ); + uiOffset += MERC_UP_LEVEL_LENGTH_BIFF; + } + +// AddEmail( ( UINT8 )( AIM_REPLY_BARRY + ( AIM_REPLY_LENGTH_BARRY ) ), AIM_REPLY_LENGTH_BARRY, AIM_REPLY_BARRY, GetWorldTotalMin() ); + + uiOffset = AIM_REPLY_BARRY; + for( uiCnt=0; uiCnt<40; uiCnt++) + { + AddEmail( ( UINT8 )( uiOffset + ( uiCnt * AIM_REPLY_LENGTH_BARRY ) ), AIM_REPLY_LENGTH_BARRY, ( UINT8 )( 6 + uiCnt ), GetWorldTotalMin() ); + } + + AddEmail(OLD_ENRICO_1,OLD_ENRICO_1_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + AddEmail(OLD_ENRICO_2,OLD_ENRICO_2_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + AddEmail(OLD_ENRICO_3,OLD_ENRICO_3_LENGTH,MAIL_ENRICO, GetWorldTotalMin() ); + AddEmail(RIS_REPORT,RIS_REPORT_LENGTH,RIS_EMAIL, GetWorldTotalMin() ); + + AddEmail( ENRICO_MIGUEL, ENRICO_MIGUEL_LENGTH, MAIL_ENRICO, GetWorldTotalMin() ); + AddEmail(ENRICO_PROG_20, ENRICO_PROG_20_LENGTH, MAIL_ENRICO, GetWorldTotalMin()); + AddEmail(ENRICO_PROG_55, ENRICO_PROG_55_LENGTH, MAIL_ENRICO, GetWorldTotalMin()); + AddEmail(ENRICO_PROG_80, ENRICO_PROG_80_LENGTH, MAIL_ENRICO, GetWorldTotalMin()); + AddEmail(ENRICO_SETBACK, ENRICO_SETBACK_LENGTH, MAIL_ENRICO, GetWorldTotalMin()); + AddEmail(ENRICO_SETBACK_2, ENRICO_SETBACK_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin()); + AddEmail(LACK_PLAYER_PROGRESS_1, LACK_PLAYER_PROGRESS_1_LENGTH, MAIL_ENRICO, GetWorldTotalMin()); + AddEmail(LACK_PLAYER_PROGRESS_2, LACK_PLAYER_PROGRESS_2_LENGTH, MAIL_ENRICO, GetWorldTotalMin()); + AddEmail(LACK_PLAYER_PROGRESS_3, LACK_PLAYER_PROGRESS_3_LENGTH, MAIL_ENRICO, GetWorldTotalMin()); + AddEmail(ENRICO_CREATURES, ENRICO_CREATURES_LENGTH, MAIL_ENRICO, GetWorldTotalMin()); + + + //Add an email telling the user that he received an insurance payment + AddEmailWithSpecialData( INSUR_PAYMENT, INSUR_PAYMENT_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0 ); + AddEmailWithSpecialData( INSUR_SUSPIC, INSUR_SUSPIC_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0 ); + AddEmailWithSpecialData( INSUR_SUSPIC_2, INSUR_SUSPIC_2_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0 ); + AddEmail( BOBBYR_NOW_OPEN, BOBBYR_NOW_OPEN_LENGTH, BOBBY_R, GetWorldTotalMin()); + AddEmail( KING_PIN_LETTER, KING_PIN_LETTER_LENGTH, KING_PIN, GetWorldTotalMin() ); + AddEmail( BOBBYR_SHIPMENT_ARRIVED, BOBBYR_SHIPMENT_ARRIVED_LENGTH, BOBBY_R, GetWorldTotalMin() ); + + AddEmail( JOHN_KULBA_GIFT_IN_DRASSEN, JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH, JOHN_KULBA, GetWorldTotalMin() ); + + AddEmailWithSpecialData(MERC_DIED_ON_OTHER_ASSIGNMENT, MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH, AIM_SITE, GetWorldTotalMin(), 0, 0 ); + + AddEmailWithSpecialData( INSUR_1HOUR_FRAUD, INSUR_1HOUR_FRAUD_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), 20, 0 ); + + //add an email + AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_REFUND, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), 20, 0 ); + + AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND, AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), 20, 0 ); + + AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_NO_REFUND, AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), 20, 0 ); +} +#endif + + + + + + diff --git a/Laptop/email.h b/Laptop/email.h new file mode 100644 index 00000000..64ca48c7 --- /dev/null +++ b/Laptop/email.h @@ -0,0 +1,302 @@ +#ifndef __EMAIL_H +#define __EMAIL_H + +#include "types.h" + +// defines +#define MAX_EMAIL_LINES 10 //max number of lines can be shown in a message +#define MAX_MESSAGES_PAGE 18 // max number of messages per page + + +#define IMP_EMAIL_INTRO 0 +#define IMP_EMAIL_INTRO_LENGTH 10 +#define ENRICO_CONGRATS (IMP_EMAIL_INTRO + IMP_EMAIL_INTRO_LENGTH) +#define ENRICO_CONGRATS_LENGTH 3 +#define IMP_EMAIL_AGAIN (ENRICO_CONGRATS + ENRICO_CONGRATS_LENGTH) +#define IMP_EMAIL_AGAIN_LENGTH 6 +#define MERC_INTRO (IMP_EMAIL_AGAIN + IMP_EMAIL_AGAIN_LENGTH) +#define MERC_INTRO_LENGTH 5 +#define MERC_NEW_SITE_ADDRESS ( MERC_INTRO + MERC_INTRO_LENGTH ) +#define MERC_NEW_SITE_ADDRESS_LENGTH 2 +#define AIM_MEDICAL_DEPOSIT_REFUND ( MERC_NEW_SITE_ADDRESS + MERC_NEW_SITE_ADDRESS_LENGTH ) +#define AIM_MEDICAL_DEPOSIT_REFUND_LENGTH 3 +#define IMP_EMAIL_PROFILE_RESULTS ( AIM_MEDICAL_DEPOSIT_REFUND + AIM_MEDICAL_DEPOSIT_REFUND_LENGTH ) +#define IMP_EMAIL_PROFILE_RESULTS_LENGTH 1 +#define MERC_WARNING ( IMP_EMAIL_PROFILE_RESULTS_LENGTH + IMP_EMAIL_PROFILE_RESULTS ) +#define MERC_WARNING_LENGTH 2 +#define MERC_INVALID ( MERC_WARNING + MERC_WARNING_LENGTH ) +#define MERC_INVALID_LENGTH 2 +#define NEW_MERCS_AT_MERC ( MERC_INVALID + MERC_INVALID_LENGTH ) +#define NEW_MERCS_AT_MERC_LENGTH 2 +#define MERC_FIRST_WARNING ( NEW_MERCS_AT_MERC + NEW_MERCS_AT_MERC_LENGTH ) +#define MERC_FIRST_WARNING_LENGTH 2 +// merc up a level emails +#define MERC_UP_LEVEL_BIFF ( MERC_FIRST_WARNING + MERC_FIRST_WARNING_LENGTH ) +#define MERC_UP_LEVEL_LENGTH_BIFF 2 +#define MERC_UP_LEVEL_HAYWIRE ( MERC_UP_LEVEL_LENGTH_BIFF + MERC_UP_LEVEL_BIFF ) +#define MERC_UP_LEVEL_LENGTH_HAYWIRE 2 +#define MERC_UP_LEVEL_GASKET ( MERC_UP_LEVEL_LENGTH_HAYWIRE + MERC_UP_LEVEL_HAYWIRE ) +#define MERC_UP_LEVEL_LENGTH_GASKET 2 +#define MERC_UP_LEVEL_RAZOR ( MERC_UP_LEVEL_LENGTH_GASKET + MERC_UP_LEVEL_GASKET ) +#define MERC_UP_LEVEL_LENGTH_RAZOR 2 +#define MERC_UP_LEVEL_FLO ( MERC_UP_LEVEL_LENGTH_RAZOR + MERC_UP_LEVEL_RAZOR ) +#define MERC_UP_LEVEL_LENGTH_FLO 2 +#define MERC_UP_LEVEL_GUMPY ( MERC_UP_LEVEL_LENGTH_FLO + MERC_UP_LEVEL_FLO ) +#define MERC_UP_LEVEL_LENGTH_GUMPY 2 +#define MERC_UP_LEVEL_LARRY ( MERC_UP_LEVEL_LENGTH_GUMPY + MERC_UP_LEVEL_GUMPY ) +#define MERC_UP_LEVEL_LENGTH_LARRY 2 +#define MERC_UP_LEVEL_COUGAR ( MERC_UP_LEVEL_LENGTH_LARRY + MERC_UP_LEVEL_LARRY ) +#define MERC_UP_LEVEL_LENGTH_COUGAR 2 +#define MERC_UP_LEVEL_NUMB ( MERC_UP_LEVEL_LENGTH_COUGAR + MERC_UP_LEVEL_COUGAR ) +#define MERC_UP_LEVEL_LENGTH_NUMB 2 +#define MERC_UP_LEVEL_BUBBA ( MERC_UP_LEVEL_LENGTH_NUMB + MERC_UP_LEVEL_NUMB ) +#define MERC_UP_LEVEL_LENGTH_BUBBA 2 +// merc left-me-a-message-and-now-I'm-back emails +#define AIM_REPLY_BARRY ( MERC_UP_LEVEL_LENGTH_BUBBA + MERC_UP_LEVEL_BUBBA ) +#define AIM_REPLY_LENGTH_BARRY 2 +#define AIM_REPLY_MELTDOWN (AIM_REPLY_BARRY + ( 39 * AIM_REPLY_LENGTH_BARRY )) +#define AIM_REPLY_LENGTH_MELTDOWN AIM_REPLY_LENGTH_BARRY + +// old EXISTING emails when player starts game. They must look "read" +#define OLD_ENRICO_1 ( AIM_REPLY_LENGTH_MELTDOWN + AIM_REPLY_MELTDOWN ) +#define OLD_ENRICO_1_LENGTH 3 +#define OLD_ENRICO_2 ( OLD_ENRICO_1 + OLD_ENRICO_1_LENGTH ) +#define OLD_ENRICO_2_LENGTH 3 +#define RIS_REPORT ( OLD_ENRICO_2 + OLD_ENRICO_2_LENGTH ) +#define RIS_REPORT_LENGTH 2 +#define OLD_ENRICO_3 ( RIS_REPORT + RIS_REPORT_LENGTH ) +#define OLD_ENRICO_3_LENGTH 3 + +// emails that occur from Enrico once player accomplishes things +#define ENRICO_MIGUEL ( OLD_ENRICO_3 + OLD_ENRICO_3_LENGTH ) +#define ENRICO_MIGUEL_LENGTH 3 +#define ENRICO_PROG_20 ( ENRICO_MIGUEL + ENRICO_MIGUEL_LENGTH ) +#define ENRICO_PROG_20_LENGTH 3 +#define ENRICO_PROG_55 ( ENRICO_PROG_20 + ENRICO_PROG_20_LENGTH ) +#define ENRICO_PROG_55_LENGTH 3 +#define ENRICO_PROG_80 ( ENRICO_PROG_55 + ENRICO_PROG_55_LENGTH ) +#define ENRICO_PROG_80_LENGTH 3 +#define ENRICO_SETBACK ( ENRICO_PROG_80 + ENRICO_PROG_80_LENGTH ) +#define ENRICO_SETBACK_LENGTH 3 +#define ENRICO_SETBACK_2 ( ENRICO_SETBACK + ENRICO_SETBACK_LENGTH ) +#define ENRICO_SETBACK_2_LENGTH 3 +#define ENRICO_CREATURES ( ENRICO_SETBACK_2 + ENRICO_SETBACK_2_LENGTH ) +#define ENRICO_CREATURES_LENGTH 3 + +// insurance company emails +#define INSUR_PAYMENT ( ENRICO_CREATURES + ENRICO_CREATURES_LENGTH ) +#define INSUR_PAYMENT_LENGTH 3 +#define INSUR_SUSPIC ( INSUR_PAYMENT + INSUR_PAYMENT_LENGTH ) +#define INSUR_SUSPIC_LENGTH 3 +#define INSUR_INVEST_OVER ( INSUR_SUSPIC + INSUR_SUSPIC_LENGTH ) +#define INSUR_INVEST_OVER_LENGTH 3 +#define INSUR_SUSPIC_2 ( INSUR_INVEST_OVER + INSUR_INVEST_OVER_LENGTH ) +#define INSUR_SUSPIC_2_LENGTH 3 + +#define BOBBYR_NOW_OPEN ( INSUR_SUSPIC_2 + INSUR_SUSPIC_2_LENGTH ) +#define BOBBYR_NOW_OPEN_LENGTH 3 + +#define KING_PIN_LETTER ( BOBBYR_NOW_OPEN + BOBBYR_NOW_OPEN_LENGTH ) +#define KING_PIN_LETTER_LENGTH 4 + +#define LACK_PLAYER_PROGRESS_1 ( KING_PIN_LETTER + KING_PIN_LETTER_LENGTH ) +#define LACK_PLAYER_PROGRESS_1_LENGTH 3 + +#define LACK_PLAYER_PROGRESS_2 ( LACK_PLAYER_PROGRESS_1 + LACK_PLAYER_PROGRESS_1_LENGTH ) +#define LACK_PLAYER_PROGRESS_2_LENGTH 3 + +#define LACK_PLAYER_PROGRESS_3 ( LACK_PLAYER_PROGRESS_2 + LACK_PLAYER_PROGRESS_2_LENGTH ) +#define LACK_PLAYER_PROGRESS_3_LENGTH 3 + +//A package from bobby r has arrived in Drassen +#define BOBBYR_SHIPMENT_ARRIVED ( LACK_PLAYER_PROGRESS_3 + LACK_PLAYER_PROGRESS_3_LENGTH ) +#define BOBBYR_SHIPMENT_ARRIVED_LENGTH 4 + +// John Kulba has left the gifts for theplayers in drassen +#define JOHN_KULBA_GIFT_IN_DRASSEN ( BOBBYR_SHIPMENT_ARRIVED + BOBBYR_SHIPMENT_ARRIVED_LENGTH ) +#define JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH 4 + +//when a merc dies on ANOTHER assignment ( ie not with the player ) +#define MERC_DIED_ON_OTHER_ASSIGNMENT ( JOHN_KULBA_GIFT_IN_DRASSEN + JOHN_KULBA_GIFT_IN_DRASSEN_LENGTH ) +#define MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH 5 + +#define INSUR_1HOUR_FRAUD ( MERC_DIED_ON_OTHER_ASSIGNMENT + MERC_DIED_ON_OTHER_ASSIGNMENT_LENGTH ) +#define INSUR_1HOUR_FRAUD_LENGTH 3 + +//when a merc is fired, and is injured +#define AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND ( INSUR_1HOUR_FRAUD + INSUR_1HOUR_FRAUD_LENGTH ) +#define AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH 3 + +//when a merc is fired, and is dead +#define AIM_MEDICAL_DEPOSIT_NO_REFUND ( AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND + AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH ) +#define AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH 3 + +#define BOBBY_R_MEDUNA_SHIPMENT ( AIM_MEDICAL_DEPOSIT_NO_REFUND + AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH ) +#define BOBBY_R_MEDUNA_SHIPMENT_LENGTH 4 + + +struct message{ + STR16 pString; + struct message *Next; + struct message *Prev; +}; + +typedef struct message EmailMessage; +typedef EmailMessage *MessagePtr; + + +struct email +{ + STR16 pSubject; + UINT16 usOffset; + UINT16 usLength; + UINT8 ubSender; + UINT32 iDate; + INT32 iId; + INT32 iFirstData; + UINT32 uiSecondData; + BOOLEAN fRead; + BOOLEAN fNew; + + INT32 iThirdData; + INT32 iFourthData; + UINT32 uiFifthData; + UINT32 uiSixData; + + struct email *Next; + struct email *Prev; +}; + +typedef struct email Email; +typedef Email *EmailPtr; + + +// This used when saving the emails to disk. +typedef struct +{ + UINT16 usOffset; + UINT16 usLength; + UINT8 ubSender; + UINT32 iDate; + INT32 iId; + INT32 iFirstData; + UINT32 uiSecondData; + + INT32 iThirdData; + INT32 iFourthData; + UINT32 uiFifthData; + UINT32 uiSixData; + + BOOLEAN fRead; + BOOLEAN fNew; +} SavedEmailStruct; + + + +struct pagemessages{ + INT32 iIds[MAX_MESSAGES_PAGE]; + INT32 iPageId; + struct pagemessages *Next; + struct pagemessages *Prev; +}; + + +typedef struct pagemessages Page; +typedef Page *PagePtr; + +struct messagerecord{ +// CHAR16 pRecord[ 320 ]; + CHAR16 pRecord[ 640 ]; + struct messagerecord *Next; +}; + +typedef struct messagerecord Record; +typedef Record *RecordPtr; + +typedef struct +{ + RecordPtr pFirstRecord; + RecordPtr pLastRecord; + INT32 iPageNumber; +} EmailPageInfoStruct; + +enum { + SENDER=0, + RECEIVED, + SUBJECT, + READ, +}; + +enum { + MAIL_ENRICO=0, + CHAR_PROFILE_SITE, + GAME_HELP, + IMP_PROFILE_RESULTS, + SPECK_FROM_MERC, + RIS_EMAIL, + BARRY_MAIL, + MELTDOWN_MAIL = BARRY_MAIL+ 39, + INSURANCE_COMPANY, + BOBBY_R, + KING_PIN, + JOHN_KULBA, + AIM_SITE, +}; + +// the length of the subject in char +#define EMAIL_SUBJECT_LENGTH 128 + +extern BOOLEAN fUnReadMailFlag; +extern BOOLEAN fNewMailFlag; +extern BOOLEAN fOldUnreadFlag; +extern BOOLEAN fOldNewMailFlag; +extern BOOLEAN fDeleteMailFlag; +extern BOOLEAN fDisplayMessageFlag; +extern BOOLEAN fReDrawNewMailFlag; +extern BOOLEAN fOpenMostRecentUnReadFlag; +extern EmailPtr pEmailList; +extern UINT32 guiEmailWarning; + + +void GameInitEmail(); +BOOLEAN EnterEmail(); +void ExitEmail(); +void HandleEmail(); +void RenderEmail(); + +#define CHECK_X iScreenWidthOffset + 15 +#define CHECK_Y iScreenHeightOffset + 13 +#define VIEWER_X iScreenWidthOffset + 155 +#define VIEWER_Y iScreenHeightOffset + 70 + 21 +#define MAIL_STRING_SIZE 640 + + +// message manipulation +void AddEmailMessage(INT32 iMessageOffset, INT32 iMessageLength,STR16 pSubject, INT32 iDate, UINT8 ubSender, BOOLEAN fAlreadyRead, INT32 uiFirstData, UINT32 uiSecondData ); +void RemoveEmailMessage(INT32 iId); +EmailPtr GetEmailMessage(INT32 iId); +void LookForUnread(); +void AddEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate); +void AddPreReadEmail(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate); +BOOLEAN DisplayNewMailBox(); +void CreateDestroyNewMailButton(); +void CreateDestroyDeleteNoticeMailButton(); +void AddDeleteRegionsToMessageRegion(INT32 iViewerY); +void DisplayEmailHeaders( void ); +void ReDrawNewMailBox( void ); +void ReDisplayBoxes( void ); +void ShutDownEmailList(); +void AddMessageToPages(INT32 iMessageId); +void AddEmailWithSpecialData(INT32 iMessageOffset, INT32 iMessageLength, UINT8 ubSender, INT32 iDate, INT32 iFirstData, UINT32 uiSecondData ); + +#ifdef JA2BETAVERSION + void AddAllEmails(); +#endif + +#endif + + + + + + diff --git a/Laptop/files.cpp b/Laptop/files.cpp new file mode 100644 index 00000000..d1a1a237 --- /dev/null +++ b/Laptop/files.cpp @@ -0,0 +1,1834 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include + #include "laptop.h" + #include "files.h" + #include "Game clock.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "email.h" + #include "text.h" +#endif + +#define TOP_X LAPTOP_SCREEN_UL_X +#define TOP_Y LAPTOP_SCREEN_UL_Y +#define BLOCK_FILE_HEIGHT 10 +#define BOX_HEIGHT 14 +#define TITLE_X iScreenWidthOffset + 140 +#define TITLE_Y iScreenHeightOffset + 33 +#define TEXT_X iScreenWidthOffset + 140 +#define PAGE_SIZE 22 +#define FILES_TITLE_FONT FONT14ARIAL +#define FILES_TEXT_FONT FONT10ARIAL +#define BLOCK_HEIGHT 10 +#define FILES_SENDER_TEXT_X TOP_X + 15 +#define MAX_FILES_LIST_LENGTH 28 +#define NUMBER_OF_FILES_IN_FILE_MANAGER 20 +#define FILE_VIEWER_X iScreenWidthOffset + 236 +#define FILE_VIEWER_Y iScreenHeightOffset + 85 +#define FILE_VIEWER_WIDTH 598 - 240 +#define FILE_GAP 2 +#define FILE_TEXT_COLOR FONT_BLACK +#define FILE_STRING_SIZE 400 +#define MAX_FILES_PAGE MAX_FILES_LIST_LENGTH +#define FILES_LIST_X FILES_SENDER_TEXT_X +#define FILES_LIST_Y ( 9 * BLOCK_HEIGHT ) +#define FILES_LIST_WIDTH 100 +#define LENGTH_OF_ENRICO_FILE 68 +#define MAX_FILE_MESSAGE_PAGE_SIZE 325 +#define VIEWER_MESSAGE_BODY_START_Y FILES_LIST_Y +#define PREVIOUS_FILE_PAGE_BUTTON_X iScreenWidthOffset + 553 +#define PREVIOUS_FILE_PAGE_BUTTON_Y iScreenHeightOffset + 53 +#define NEXT_FILE_PAGE_BUTTON_X iScreenWidthOffset + 577 +#define NEXT_FILE_PAGE_BUTTON_Y PREVIOUS_FILE_PAGE_BUTTON_Y + +#define FILES_COUNTER_1_WIDTH 7 +#define FILES_COUNTER_2_WIDTH 43 +#define FILES_COUNTER_3_WIDTH 45 + + +// the highlighted line +INT32 iHighLightFileLine=-1; + + +// the files record list +FilesUnitPtr pFilesListHead=NULL; + +FileStringPtr pFileStringList = NULL; + +// are we in files mode +BOOLEAN fInFilesMode=FALSE; +BOOLEAN fOnLastFilesPageFlag = FALSE; + + +//. did we enter due to new file icon? +BOOLEAN fEnteredFileViewerFromNewFileIcon = FALSE; +BOOLEAN fWaitAFrame = FALSE; + +// are there any new files +BOOLEAN fNewFilesInFileViewer = FALSE; + +// graphics handles +extern UINT32 guiTITLE; // symbol already defined in laptop.cpp (jonathanl) +UINT32 guiFileBack; +extern UINT32 guiTOP; // symbol already defined in finances.cpp (jonathanl) +UINT32 guiHIGHLIGHT; + + +// currewnt page of multipage files we are on +INT32 giFilesPage = 0; +// strings + +#define SLAY_LENGTH 12 +#define ENRICO_LENGTH 0 + + +UINT8 ubFileRecordsLength[]={ + ENRICO_LENGTH, + SLAY_LENGTH, + SLAY_LENGTH, + SLAY_LENGTH, + SLAY_LENGTH, + SLAY_LENGTH, + SLAY_LENGTH, +}; + +UINT16 ubFileOffsets[]={ + 0, + ENRICO_LENGTH, + SLAY_LENGTH + ENRICO_LENGTH, + 2 * SLAY_LENGTH + ENRICO_LENGTH, + 3 * SLAY_LENGTH + ENRICO_LENGTH, + 4 * SLAY_LENGTH + ENRICO_LENGTH, + 5 * SLAY_LENGTH + ENRICO_LENGTH, +}; + + +UINT16 usProfileIdsForTerroristFiles[]={ + 0, // no body + 112, // elgin + 64, // slay + 82, // mom + 83, // imposter + 110, // tiff + 111, // t-rex + 112, // elgin +}; +// buttons for next and previous pages +UINT32 giFilesPageButtons[ 2 ]; +UINT32 giFilesPageButtonsImage[ 2 ]; + + +// the previous and next pages buttons + +enum{ + PREVIOUS_FILES_PAGE_BUTTON=0, + NEXT_FILES_PAGE_BUTTON, +}; +// mouse regions +MOUSE_REGION pFilesRegions[MAX_FILES_PAGE]; + + + +// function definitions +void RenderFilesBackGround( void ); +BOOLEAN LoadFiles( void ); +void RemoveFiles( void ); +UINT32 ProcessAndEnterAFilesRecord( UINT8 ubCode, UINT32 uiDate, UINT8 ubFormat,STR8 pFirstPicFile, STR8 pSecondPicFile, BOOLEAN fRead ); +void OpenAndReadFilesFile( void ); +BOOLEAN OpenAndWriteFilesFile( void ); +void ClearFilesList( void ); +void DrawFilesTitleText( void ); +void DrawFilesListBackGround( void ); +void DisplayFilesList( void ); +BOOLEAN OpenAndWriteFilesFile( void ); +void DisplayFileMessage( void ); +void InitializeFilesMouseRegions( void ); +void RemoveFilesMouseRegions( void ); +BOOLEAN DisplayFormattedText( void ); + + +// buttons +void CreateButtonsForFilesPage( void ); +void DeleteButtonsForFilesPage( void ); +void HandleFileViewerButtonStates( void ); + + +// open new files for viewing +void OpenFirstUnreadFile( void ); +void CheckForUnreadFiles( void ); + + + +// file string structure manipulations +void ClearFileStringList( void ); +void AddStringToFilesList( STR16 pString ); +BOOLEAN HandleSpecialFiles( UINT8 ubFormat ); +BOOLEAN HandleSpecialTerroristFile( INT32 iFileNumber, STR sPictureName ); + + +// callbacks +void FilesBtnCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void BtnPreviousFilePageCallback(GUI_BUTTON *btn,INT32 reason); +void BtnNextFilePageCallback(GUI_BUTTON *btn,INT32 reason); + +// file width manipulation +void ClearOutWidthRecordsList( FileRecordWidthPtr pFileRecordWidthList ); +FileRecordWidthPtr CreateWidthRecordsForAruloIntelFile( void ); +FileRecordWidthPtr CreateWidthRecordsForTerroristFile( void ); +FileRecordWidthPtr CreateRecordWidth( INT32 iRecordNumber, INT32 iRecordWidth, INT32 iRecordHeightAdjustment, UINT8 ubFlags ); + + +UINT32 AddFilesToPlayersLog(UINT8 ubCode, UINT32 uiDate, UINT8 ubFormat, STR8 pFirstPicFile, STR8 pSecondPicFile ) +{ + // adds Files item to player's log(Files List), returns unique id number of it + // outside of the Files system(the code in this .c file), this is the only function you'll ever need + UINT32 uiId=0; + + // if not in Files mode, read in from file + if(!fInFilesMode) + OpenAndReadFilesFile( ); + + // process the actual data + uiId = ProcessAndEnterAFilesRecord(ubCode, uiDate, ubFormat ,pFirstPicFile, pSecondPicFile, FALSE ); + + // set unread flag, if nessacary + CheckForUnreadFiles( ); + + // write out to file if not in Files mode + if(!fInFilesMode) + OpenAndWriteFilesFile( ); + + // return unique id of this transaction + return uiId; +} +void GameInitFiles( ) +{ + + if ( (FileExists( FILES_DAT_FILE ) == TRUE ) ) + { + FileClearAttributes( FILES_DAT_FILE ); + FileDelete( FILES_DAT_FILE ); + } + + ClearFilesList( ); + + // add background check by RIS + AddFilesToPlayersLog( ENRICO_BACKGROUND, 0,255, NULL, NULL ); + +} + +void EnterFiles() +{ + + // load grpahics for files system + LoadFiles( ); + + //AddFilesToPlayersLog(1, 0, 0,"LAPTOP\\portrait.sti", "LAPTOP\\portrait.sti"); + //AddFilesToPlayersLog(0, 0, 3,"LAPTOP\\portrait.sti", "LAPTOP\\portrait.sti"); + //AddFilesToPlayersLog(2, 0, 1,"LAPTOP\\portrait.sti", "LAPTOP\\portrait.sti"); + // in files mode now, set the fact + fInFilesMode=TRUE; + + // initialize mouse regions + InitializeFilesMouseRegions( ); + + // create buttons + CreateButtonsForFilesPage( ); + + // now set start states + HandleFileViewerButtonStates( ); + + // build files list + OpenAndReadFilesFile( ); + + // render files system + RenderFiles( ); + + // entered due to icon + if( fEnteredFileViewerFromNewFileIcon == TRUE ) + { + OpenFirstUnreadFile( ); + fEnteredFileViewerFromNewFileIcon = FALSE; + } + + +} + +void ExitFiles() +{ + + // write files list out to disk + OpenAndWriteFilesFile( ); + + // remove mouse regions + RemoveFilesMouseRegions( ); + + // delete buttons + DeleteButtonsForFilesPage( ); + + fInFilesMode = FALSE; + + // remove files + RemoveFiles( ); +} + +void HandleFiles() +{ + CheckForUnreadFiles( ); +} + +void RenderFiles() +{ + HVOBJECT hHandle; + + + // render the background + RenderFilesBackGround( ); + + // draw the title bars text + DrawFilesTitleText( ); + + // the columns + DrawFilesListBackGround( ); + + // display the list of senders + DisplayFilesList( ); + + // draw the highlighted file + DisplayFileMessage( ); + + // title bar icon + BlitTitleBarIcons( ); + + + // display border + GetVideoObject(&hHandle, guiLaptopBACKGROUND); + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 108, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); + +} + + +void RenderFilesBackGround( void ) +{ + // render generic background for file system + HVOBJECT hHandle; + INT32 iCounter=0; + + // get title bar object + GetVideoObject(&hHandle, guiTITLE); + + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y - 2, VO_BLT_SRCTRANSPARENCY,NULL); + + // get and blt the top part of the screen, video object and blt to screen + GetVideoObject( &hHandle, guiTOP ); + BltVideoObject( FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y + 22, VO_BLT_SRCTRANSPARENCY, NULL ); + + + + return; +} + +void DrawFilesTitleText( void ) +{ + // setup the font stuff + SetFont(FILES_TITLE_FONT); + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + + // draw the pages title + mprintf(TITLE_X,TITLE_Y,pFilesTitle[0]); + + + return; +} + + +BOOLEAN LoadFiles( void ) +{ + VOBJECT_DESC VObjectDesc; + // load files video objects into memory + + // title bar + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTITLE)); + + // top portion of the screen background + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\fileviewer.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTOP)); + + + // the highlight + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\highlight.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiHIGHLIGHT)); + + // top portion of the screen background + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\fileviewerwhite.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiFileBack)); + + return (TRUE); +} + +void RemoveFiles( void ) +{ + + // delete files video objects from memory + + + DeleteVideoObjectFromIndex(guiTOP); + DeleteVideoObjectFromIndex(guiTITLE); + DeleteVideoObjectFromIndex(guiHIGHLIGHT); + DeleteVideoObjectFromIndex(guiFileBack); + + + return; +} + +UINT32 ProcessAndEnterAFilesRecord( UINT8 ubCode, UINT32 uiDate, UINT8 ubFormat ,STR8 pFirstPicFile, STR8 pSecondPicFile, BOOLEAN fRead ) +{ + UINT32 uiId=0; + FilesUnitPtr pFiles=pFilesListHead; + + // add to Files list + if(pFiles) + { + while(pFiles) + { + // check to see if the file is already there + if(pFiles->ubCode==ubCode) + { + // if so, return it's id number + return ( pFiles->uiIdNumber ); + } + + // next in the list + pFiles = pFiles->Next; + } + + // reset pointer + pFiles=pFilesListHead; + + // go to end of list + while(pFiles->Next) + { + pFiles = pFiles->Next; + } + // alloc space + pFiles->Next = (files *) MemAlloc(sizeof(FilesUnit)); + + // increment id number + uiId = pFiles->uiIdNumber + 1; + + // set up information passed + pFiles = pFiles->Next; + pFiles->Next = NULL; + pFiles->ubCode = ubCode; + pFiles->uiDate = uiDate; + pFiles->uiIdNumber = uiId; + pFiles->ubFormat = ubFormat; + pFiles->fRead = fRead; + } + else + { + // alloc space + pFiles = (FilesUnitPtr) MemAlloc(sizeof(FilesUnit)); + + // setup info passed + pFiles->Next = NULL; + pFiles->ubCode = ubCode; + pFiles->uiDate = uiDate; + pFiles->uiIdNumber = uiId; + pFilesListHead = pFiles; + pFiles->ubFormat=ubFormat; + pFiles -> fRead = fRead; + } + + // null out ptr's to picture file names + pFiles -> pPicFileNameList[0] = NULL; + pFiles -> pPicFileNameList[1] = NULL; + + // copy file name strings + + // first file + if(pFirstPicFile) + { + if((pFirstPicFile[0]) != 0) + { + pFiles -> pPicFileNameList[0] = (STR8) MemAlloc(strlen(pFirstPicFile) + 1 ); + strcpy( pFiles -> pPicFileNameList[0], pFirstPicFile); + pFiles -> pPicFileNameList[0][strlen(pFirstPicFile)] = 0; + } + } + + // second file + + if(pSecondPicFile) + { + if((pSecondPicFile[0]) != 0) + { + pFiles->pPicFileNameList[1] = (STR8) MemAlloc(strlen(pSecondPicFile) + 1 ); + strcpy( pFiles->pPicFileNameList[1], pSecondPicFile); + pFiles->pPicFileNameList[1][ strlen( pSecondPicFile ) ] = 0; + } + } + + // return unique id + return uiId; +} + +void OpenAndReadFilesFile( void ) +{ + // this procedure will open and read in data to the finance list + HWFILE hFileHandle; + UINT8 ubCode; + UINT32 uiDate; + INT32 iBytesRead=0; + UINT32 uiByteCount=0; + CHAR8 pFirstFilePath[128]; + CHAR8 pSecondFilePath[128]; + UINT8 ubFormat; + BOOLEAN fRead; + + // clear out the old list + ClearFilesList( ); + + // no file, return + if ( ! (FileExists( FILES_DAT_FILE ) ) ) + return; + + // open file + hFileHandle=FileOpen( FILES_DAT_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + return; + } + + // make sure file is more than 0 length + if ( FileGetSize( hFileHandle ) == 0 ) + { + FileClose( hFileHandle ); + return; + } + + // file exists, read in data, continue until file end + while( FileGetSize( hFileHandle ) > uiByteCount) + { + + // read in data + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + + FileRead( hFileHandle, &pFirstFilePath, 128, (UINT32 *)&iBytesRead ); + + FileRead( hFileHandle, &pSecondFilePath, 128, (UINT32 *)&iBytesRead ); + + FileRead( hFileHandle, &ubFormat, sizeof(UINT8), (UINT32 *)&iBytesRead ); + + FileRead( hFileHandle, &fRead, sizeof(UINT8), (UINT32 *)&iBytesRead ); + // add transaction + ProcessAndEnterAFilesRecord(ubCode, uiDate, ubFormat,pFirstFilePath, pSecondFilePath, fRead); + + // increment byte counter + uiByteCount += sizeof( UINT32 ) + sizeof( UINT8 )+ 128 + 128 + sizeof(UINT8) + sizeof( BOOLEAN ); + } + + // close file + FileClose( hFileHandle ); + + return; +} + + +BOOLEAN OpenAndWriteFilesFile( void ) +{ + // this procedure will open and write out data from the finance list + HWFILE hFileHandle; + INT32 iBytesWritten=0; + FilesUnitPtr pFilesList=pFilesListHead; + CHAR8 pFirstFilePath[128]; + CHAR8 pSecondFilePath[128]; + + memset(&pFirstFilePath, 0, sizeof( pFirstFilePath ) ); + memset(&pSecondFilePath, 0, sizeof( pSecondFilePath ) ); + + if( pFilesList != NULL ) + { + if(pFilesList->pPicFileNameList[0]) + { + strcpy(pFirstFilePath, pFilesList->pPicFileNameList[0]); + } + if(pFilesList->pPicFileNameList[1]) + { + strcpy(pSecondFilePath, pFilesList->pPicFileNameList[1]); + } + } + + // open file + hFileHandle=FileOpen( FILES_DAT_FILE, FILE_ACCESS_WRITE|FILE_CREATE_ALWAYS, FALSE); + + // if no file exits, do nothing + if(!hFileHandle) + { + return ( FALSE ); + } + // write info, while there are elements left in the list + while(pFilesList) + { + // now write date and amount, and code + FileWrite( hFileHandle, &(pFilesList->ubCode), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pFilesList->uiDate), sizeof ( UINT32 ), NULL ); + FileWrite( hFileHandle, &(pFirstFilePath), 128, NULL ); + FileWrite( hFileHandle, &(pSecondFilePath), 128, NULL ); + FileWrite( hFileHandle, &(pFilesList->ubFormat), sizeof(UINT8), NULL ); + FileWrite( hFileHandle, &(pFilesList->fRead), sizeof(UINT8), NULL ); + + // next element in list + pFilesList = pFilesList->Next; + + } + + // close file + FileClose( hFileHandle ); + // clear out the old list + ClearFilesList( ); + + return ( TRUE ); +} + +void ClearFilesList( void ) +{ + // remove each element from list of transactions + FilesUnitPtr pFilesList=pFilesListHead; + FilesUnitPtr pFilesNode=pFilesList; + + // while there are elements in the list left, delete them + while( pFilesList ) + { + // set node to list head + pFilesNode=pFilesList; + + // set list head to next node + pFilesList=pFilesList->Next; + + // if present, dealloc string + if(pFilesNode->pPicFileNameList[0]) + { + MemFree(pFilesNode->pPicFileNameList[0]); + } + + if(pFilesNode->pPicFileNameList[1]) + { + MemFree(pFilesNode->pPicFileNameList[1]); + } + // delete current node + MemFree(pFilesNode); + } + pFilesListHead=NULL; + return; +} + +void DrawFilesListBackGround( void ) +{ + // proceudre will draw the background for the list of files + INT32 iCounter=7; + // HVOBJECT hHandle; + + // now the columns + + + + return; + +} + + +void DisplayFilesList( void ) +{ + // this function will run through the list of files of files and display the 'sender' + FilesUnitPtr pFilesList=pFilesListHead; + INT32 iCounter=0; + HVOBJECT hHandle; + + + // font stuff + SetFont(FILES_TEXT_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // runt hrough list displaying 'sender' + while((pFilesList))//&&(iCounter < MAX_FILES_LIST_LENGTH)) + { + if (iCounter==iHighLightFileLine) + { + // render highlight + GetVideoObject(&hHandle, guiHIGHLIGHT); + BltVideoObject(FRAME_BUFFER, hHandle, 0, FILES_SENDER_TEXT_X - 5, iScreenHeightOffset + ( ( iCounter + 9 ) * BLOCK_HEIGHT) + ( iCounter * 2 ) - 4 , VO_BLT_SRCTRANSPARENCY,NULL); + + } + + mprintf(FILES_SENDER_TEXT_X, iScreenHeightOffset + (( iCounter + 9 ) * BLOCK_HEIGHT) + ( iCounter * 2 ) - 2 ,pFilesSenderList[pFilesList->ubCode]); + iCounter++; + pFilesList=pFilesList->Next; + } + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + + return; + +} + + + +void DisplayFileMessage( void ) +{ + + + + + + // get the currently selected message + if(iHighLightFileLine!=-1) + { + // display text + DisplayFormattedText( ); + } + else + { + HandleFileViewerButtonStates( ); + } + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + + return; +} + + +void InitializeFilesMouseRegions( void ) +{ + INT32 iCounter=0; + // init mouseregions + for(iCounter=0; iCounter Next; + + // increment counter + iCounter++; + } + + fReDrawScreenFlag=TRUE; + + + return; + } + +} + + +BOOLEAN DisplayFormattedText( void ) +{ + FilesUnitPtr pFilesList=pFilesListHead; + + UINT16 usFirstWidth = 0; + UINT16 usFirstHeight = 0; + UINT16 usSecondWidth; + UINT16 usSecondHeight; + INT16 sTextWidth = 0; + INT32 iCounter=0; + INT32 iLength=0; + INT32 iHeight=0; + INT32 iOffSet=0; + INT32 iMessageCode; + wchar_t sString[2048]; + HVOBJECT hHandle; + UINT32 uiFirstTempPicture; + UINT32 uiSecondTempPicture; + VOBJECT_DESC VObjectDesc; + INT16 usFreeSpace = 0; + static INT32 iOldMessageCode = 0; + + fWaitAFrame = FALSE; + + // get the file that was highlighted + while(iCounter < iHighLightFileLine) + { + iCounter++; + pFilesList=pFilesList->Next; + } + + // message code found, reset counter + iMessageCode = pFilesList->ubCode; + iCounter=0; + + // set file as read + pFilesList->fRead = TRUE; + + // clear the file string structure list + // get file background object + GetVideoObject(&hHandle, guiFileBack); + + // blt background to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X, FILE_VIEWER_Y - 4, VO_BLT_SRCTRANSPARENCY,NULL); + + // get the offset in the file + while( iCounter < iMessageCode) + { + // increment increment offset + iOffSet+=ubFileRecordsLength[iCounter]; + + // increment counter + iCounter++; + } + + iLength = ubFileRecordsLength[pFilesList->ubCode]; + + if( pFilesList->ubFormat < ENRICO_BACKGROUND ) + { + + LoadEncryptedDataFromFile("BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * (iOffSet) * 2, FILE_STRING_SIZE * iLength * 2); + } + + // reset counter + iCounter=0; + + // no shadow + SetFontShadow(NO_SHADOW); + + switch( pFilesList->ubFormat ) + { + case 0: + + // no format, all text + + while(iLength > iCounter) + { + // read one record from file manager file + LoadEncryptedDataFromFile( "BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * ( iOffSet + iCounter ) * 2, FILE_STRING_SIZE * 2 ); + + // display string and get height + iHeight += IanDisplayWrappedString(FILE_VIEWER_X + 4, ( UINT16 )( FILE_VIEWER_Y + iHeight ), FILE_VIEWER_WIDTH, FILE_GAP, FILES_TEXT_FONT, FILE_TEXT_COLOR, sString,0,FALSE,0); + + // increment file record counter + iCounter++; + } + break; + + case 1: + + // second format, one picture, all text below + + // load graphic + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pFilesList->pPicFileNameList[ 0 ], VObjectDesc.ImageFile ); + CHECKF(AddVideoObject( &VObjectDesc, &uiFirstTempPicture ) ); + + GetVideoObjectETRLESubregionProperties( uiFirstTempPicture, 0, &usFirstWidth, &usFirstHeight ); + + + // get file background object + GetVideoObject(&hHandle, uiFirstTempPicture); + + // blt background to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X + 4 + ( FILE_VIEWER_WIDTH - usFirstWidth ) / 2, FILE_VIEWER_Y + 10, VO_BLT_SRCTRANSPARENCY,NULL); + + iHeight = usFirstHeight + 20; + + + while(iLength > iCounter) + { + + // read one record from file manager file + LoadEncryptedDataFromFile( "BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * ( iOffSet + iCounter ) * 2, FILE_STRING_SIZE * 2 ); + + // display string and get height + iHeight += IanDisplayWrappedString(FILE_VIEWER_X + 4, ( UINT16 )( FILE_VIEWER_Y + iHeight ), FILE_VIEWER_WIDTH, FILE_GAP, FILES_TEXT_FONT, FILE_TEXT_COLOR, sString,0,FALSE,0); + + // increment file record counter + iCounter++; + } + + // delete video object + DeleteVideoObjectFromIndex( uiFirstTempPicture ); + + break; + case 2: + + // third format, two pictures, side by side with all text below + + // load first graphic + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pFilesList->pPicFileNameList[ 0 ], VObjectDesc.ImageFile ); + CHECKF(AddVideoObject( &VObjectDesc, &uiFirstTempPicture)); + + // load second graphic + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + FilenameForBPP( pFilesList->pPicFileNameList[ 1 ] , VObjectDesc.ImageFile ); + CHECKF(AddVideoObject( &VObjectDesc, &uiSecondTempPicture ) ); + + GetVideoObjectETRLESubregionProperties( uiFirstTempPicture, 0, &usFirstWidth, &usFirstHeight ); + GetVideoObjectETRLESubregionProperties( uiSecondTempPicture, 0, &usSecondWidth, &usSecondHeight ); + + // get free space; + usFreeSpace = FILE_VIEWER_WIDTH - usFirstWidth - usSecondWidth; + + usFreeSpace /= 3; + // get file background object + GetVideoObject(&hHandle, uiFirstTempPicture); + + + // blt background to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X + usFreeSpace, FILE_VIEWER_Y + 10, VO_BLT_SRCTRANSPARENCY,NULL); + + // get file background object + GetVideoObject(&hHandle, uiSecondTempPicture); + + // get position for second picture + usFreeSpace *= 2; + usFreeSpace += usFirstWidth; + + // blt background to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0, FILE_VIEWER_X + usFreeSpace, FILE_VIEWER_Y + 10, VO_BLT_SRCTRANSPARENCY,NULL); + + + + // delete video object + DeleteVideoObjectFromIndex(uiFirstTempPicture); + DeleteVideoObjectFromIndex(uiSecondTempPicture); + + // put in text + iHeight = usFirstHeight + 20; + + + while(iLength > iCounter) + { + + // read one record from file manager file + LoadEncryptedDataFromFile( "BINARYDATA\\Files.edt", sString, FILE_STRING_SIZE * ( iOffSet + iCounter ) * 2, FILE_STRING_SIZE * 2 ); + + // display string and get height + iHeight += IanDisplayWrappedString(FILE_VIEWER_X + 4, ( UINT16 )( FILE_VIEWER_Y + iHeight ), FILE_VIEWER_WIDTH, FILE_GAP, FILES_TEXT_FONT, FILE_TEXT_COLOR, sString,0,FALSE,0); + + // increment file record counter + iCounter++; + } + + + break; + + case 3: + // picture on the left, with text on right and below + // load first graphic + HandleSpecialTerroristFile( pFilesList->ubCode, pFilesList->pPicFileNameList[ 0 ] ); + break; + default: + HandleSpecialFiles( pFilesList -> ubFormat ); + break; + + } + + HandleFileViewerButtonStates( ); + SetFontShadow(DEFAULT_SHADOW); + + return ( TRUE ); +} + + +BOOLEAN HandleSpecialFiles( UINT8 ubFormat ) +{ + INT32 iCounter = 0; + wchar_t sString[2048]; + FileStringPtr pTempString = NULL ; + FileStringPtr pLocatorString = NULL; + INT32 iTotalYPosition = 0; + INT32 iYPositionOnPage = 0; + INT32 iFileLineWidth = 0; + INT32 iFileStartX = 0; + UINT32 uiFlags = 0; + UINT32 uiFont = 0; + BOOLEAN fGoingOffCurrentPage = FALSE; + FileRecordWidthPtr WidthList = NULL; + + + UINT32 uiPicture; + HVOBJECT hHandle; + VOBJECT_DESC VObjectDesc; + + + ClearFileStringList( ); + + switch( ubFormat ) + { + case( 255 ): + // load data + // read one record from file manager file + + WidthList = CreateWidthRecordsForAruloIntelFile( ); + while( iCounter < LENGTH_OF_ENRICO_FILE ) + { + LoadEncryptedDataFromFile( "BINARYDATA\\RIS.EDT", sString, FILE_STRING_SIZE * ( iCounter ) * 2, FILE_STRING_SIZE * 2 ); + AddStringToFilesList( sString ); + iCounter++; + } + + pTempString = pFileStringList; + + + iYPositionOnPage = 0; + iCounter = 0; + pLocatorString = pTempString; + + pTempString = GetFirstStringOnThisPage( pFileStringList,FILES_TEXT_FONT, 350, FILE_GAP, giFilesPage, MAX_FILE_MESSAGE_PAGE_SIZE, WidthList); + + // find out where this string is + while( pLocatorString != pTempString ) + { + iCounter++; + pLocatorString = pLocatorString->Next; + } + + + // move through list and display + while( pTempString ) + { + uiFlags = IAN_WRAP_NO_SHADOW; + // copy over string + wcscpy( sString, pTempString->pString ); + + if( sString[ 0 ] == 0 ) + { + // on last page + fOnLastFilesPageFlag = TRUE; + } + + + // set up font + uiFont = FILES_TEXT_FONT; + if( giFilesPage == 0 ) + { + switch( iCounter ) + { + case( 0 ): + uiFont = FILES_TITLE_FONT; + break; + + } + } + + // reset width + iFileLineWidth = 350; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + + // based on the record we are at, selected X start position and the width to wrap the line, to fit around pictures + + if( iCounter == 0 ) + { + // title + iFileLineWidth = 350; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + + } + else if( iCounter == 1 ) + { + // opening on first page + iFileLineWidth = 350; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + + } + else if( ( iCounter > 1) &&( iCounter < FILES_COUNTER_1_WIDTH ) ) + { + iFileLineWidth = 350; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + + } + else if( iCounter == FILES_COUNTER_1_WIDTH ) + { + if( giFilesPage == 0 ) + { + iYPositionOnPage += ( MAX_FILE_MESSAGE_PAGE_SIZE - iYPositionOnPage ); + } + iFileLineWidth = 350; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + } + + else if( iCounter == FILES_COUNTER_2_WIDTH ) + { + iFileLineWidth = 200; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 150 ); + } + else if( iCounter == FILES_COUNTER_3_WIDTH ) + { + iFileLineWidth = 200; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 150 ); + } + + else + { + iFileLineWidth = 350; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + } + // not far enough, advance + + if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, ( UINT16 )iFileLineWidth, FILE_GAP, + uiFont, 0, sString, + 0, 0, 0 ) ) < MAX_FILE_MESSAGE_PAGE_SIZE ) + { + // now print it + iYPositionOnPage += ( INT32 )IanDisplayWrappedString((UINT16) ( iFileStartX ), ( UINT16 )( FILE_VIEWER_Y + iYPositionOnPage), ( INT16 )iFileLineWidth, FILE_GAP, uiFont, FILE_TEXT_COLOR, sString,0,FALSE, uiFlags ); + + fGoingOffCurrentPage = FALSE; + } + else + { + // gonna get cut off...end now + fGoingOffCurrentPage = TRUE; + } + + pTempString = pTempString ->Next; + + if( pTempString == NULL ) + { + // on last page + fOnLastFilesPageFlag = TRUE; + } + else + { + fOnLastFilesPageFlag = FALSE; + } + + // going over the edge, stop now + if( fGoingOffCurrentPage == TRUE ) + { + pTempString = NULL; + } + iCounter++; + } + ClearOutWidthRecordsList( WidthList ); + ClearFileStringList( ); + break; + } + + // place pictures + // page 1 picture of country + if( giFilesPage == 0 ) + { + // title bar + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\ArucoFilesMap.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); + + // get title bar object + GetVideoObject(&hHandle, uiPicture); + + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 300, iScreenHeightOffset + 270, VO_BLT_SRCTRANSPARENCY,NULL); + + DeleteVideoObjectFromIndex( uiPicture ); + + } + else if( giFilesPage == 4 ) + { + // kid pic + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Enrico_Y.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); + + // get title bar object + GetVideoObject(&hHandle, uiPicture); + + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 260, iScreenHeightOffset + 225, VO_BLT_SRCTRANSPARENCY,NULL); + + DeleteVideoObjectFromIndex( uiPicture ); + + } + else if( giFilesPage == 5 ) + { + + + // wedding pic + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Enrico_W.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); + + // get title bar object + GetVideoObject(&hHandle, uiPicture); + + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 260, iScreenHeightOffset + 85, VO_BLT_SRCTRANSPARENCY,NULL); + + DeleteVideoObjectFromIndex( uiPicture ); + } + + return ( TRUE ); +} + + +void AddStringToFilesList( STR16 pString ) +{ + + FileStringPtr pFileString; + FileStringPtr pTempString = pFileStringList; + + // create string structure + pFileString = (FileStringPtr) MemAlloc( sizeof( FileString ) ); + + + // alloc string and copy + pFileString-> pString = (STR16) MemAlloc( ( wcslen( pString ) * 2 ) + 2 ); + wcscpy( pFileString->pString, pString ); + pFileString->pString[ wcslen( pString ) ] = 0; + + // set Next to NULL + + pFileString -> Next = NULL; + if( pFileStringList == NULL ) + { + pFileStringList = pFileString; + } + else + { + while( pTempString -> Next ) + { + pTempString = pTempString -> Next; + } + pTempString->Next = pFileString; + } + + + return; +} + + +void ClearFileStringList( void ) +{ + FileStringPtr pFileString; + FileStringPtr pDeleteFileString; + + pFileString = pFileStringList; + + if( pFileString == NULL ) + { + return; + } + while( pFileString -> Next) + { + pDeleteFileString = pFileString; + pFileString = pFileString -> Next; + MemFree( pDeleteFileString ); + } + + // last one + MemFree( pFileString ); + + pFileStringList = NULL; + + +} + + +void CreateButtonsForFilesPage( void ) +{ + // will create buttons for the files page + giFilesPageButtonsImage[0]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); + giFilesPageButtons[0] = QuickCreateButton( giFilesPageButtonsImage[0], PREVIOUS_FILE_PAGE_BUTTON_X, PREVIOUS_FILE_PAGE_BUTTON_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnPreviousFilePageCallback ); + + giFilesPageButtonsImage[ 1 ]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,6,-1,7,-1 ); + giFilesPageButtons[ 1 ] = QuickCreateButton( giFilesPageButtonsImage[ 1 ], NEXT_FILE_PAGE_BUTTON_X, NEXT_FILE_PAGE_BUTTON_Y , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnNextFilePageCallback ); + + SetButtonCursor(giFilesPageButtons[ 0 ], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giFilesPageButtons[ 1 ], CURSOR_LAPTOP_SCREEN); + + return; +} + + + +void DeleteButtonsForFilesPage( void ) +{ + + // destroy buttons for the files page + + RemoveButton(giFilesPageButtons[ 0 ] ); + UnloadButtonImage( giFilesPageButtonsImage[ 0 ] ); + + RemoveButton(giFilesPageButtons[ 1 ] ); + UnloadButtonImage( giFilesPageButtonsImage[ 1 ] ); + + return; +} + + +// callbacks +void BtnPreviousFilePageCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + + if( fWaitAFrame == TRUE ) + { + return; + } + + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + + if( fWaitAFrame == TRUE ) + { + return; + } + + if((btn->uiFlags & BUTTON_CLICKED_ON)) + { + + if( giFilesPage > 0 ) + { + giFilesPage--; + fWaitAFrame = TRUE; + } + + fReDrawScreenFlag = TRUE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + MarkButtonsDirty( ); + } + } + + return; +} + + +void BtnNextFilePageCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if( fWaitAFrame == TRUE ) + { + return; + } + + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( fWaitAFrame == TRUE ) + { + return; + } + + if((btn->uiFlags & BUTTON_CLICKED_ON)) + { + + if( ( fOnLastFilesPageFlag ) == FALSE ) + { + fWaitAFrame = TRUE; + giFilesPage++; + } + + fReDrawScreenFlag = TRUE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + MarkButtonsDirty( ); + } + } + + return; +} + +void HandleFileViewerButtonStates( void ) +{ + // handle state of email viewer buttons + + if( iHighLightFileLine == -1 ) + { + // not displaying message, leave + DisableButton( giFilesPageButtons[ 0 ] ); + DisableButton( giFilesPageButtons[ 1 ] ); + ButtonList[ giFilesPageButtons[ 0 ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); + ButtonList[ giFilesPageButtons[ 1 ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); + + + return; + } + + // turn off previous page button + if( giFilesPage == 0 ) + { + DisableButton( giFilesPageButtons[ 0 ] ); + ButtonList[ giFilesPageButtons[ 0 ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); + + } + else + { + EnableButton( giFilesPageButtons[ 0 ] ); + } + + + // turn off next page button + if( fOnLastFilesPageFlag == TRUE ) + { + DisableButton( giFilesPageButtons[ 1 ] ); + ButtonList[ giFilesPageButtons[ 1 ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); + } + else + { + EnableButton( giFilesPageButtons[ 1 ] ); + } + + return; + +} + + +FileRecordWidthPtr CreateRecordWidth( INT32 iRecordNumber, INT32 iRecordWidth, INT32 iRecordHeightAdjustment, UINT8 ubFlags) +{ + FileRecordWidthPtr pTempRecord = NULL; + + // allocs and inits a width info record for the multipage file viewer...this will tell the procedure that does inital computation on which record is the start of the current page + // how wide special records are ( ones that share space with pictures ) + pTempRecord = (FileRecordWidthPtr) MemAlloc( sizeof( FileRecordWidth ) ); + + pTempRecord -> Next = NULL; + pTempRecord -> iRecordNumber = iRecordNumber; + pTempRecord -> iRecordWidth = iRecordWidth; + pTempRecord -> iRecordHeightAdjustment = iRecordHeightAdjustment; + pTempRecord -> ubFlags = ubFlags; + + return ( pTempRecord ); +} + +FileRecordWidthPtr CreateWidthRecordsForAruloIntelFile( void ) +{ + // this fucntion will create the width list for the Arulco intelligence file + FileRecordWidthPtr pTempRecord = NULL; + FileRecordWidthPtr pRecordListHead = NULL; + + + // first record width +// pTempRecord = CreateRecordWidth( 7, 350, 200,0 ); + pTempRecord = CreateRecordWidth( FILES_COUNTER_1_WIDTH, 350, MAX_FILE_MESSAGE_PAGE_SIZE,0 ); + + // set up head of list now + pRecordListHead = pTempRecord; + + // next record +// pTempRecord -> Next = CreateRecordWidth( 43, 200,0, 0 ); + pTempRecord -> Next = CreateRecordWidth( FILES_COUNTER_2_WIDTH, 200,0, 0 ); + pTempRecord = pTempRecord->Next; + + // and the next.. +// pTempRecord -> Next = CreateRecordWidth( 45, 200,0, 0 ); + pTempRecord -> Next = CreateRecordWidth( FILES_COUNTER_3_WIDTH, 200,0, 0 ); + pTempRecord = pTempRecord->Next; + + return( pRecordListHead ); + +} + +FileRecordWidthPtr CreateWidthRecordsForTerroristFile( void ) +{ + // this fucntion will create the width list for the Arulco intelligence file + FileRecordWidthPtr pTempRecord = NULL; + FileRecordWidthPtr pRecordListHead = NULL; + + + // first record width + pTempRecord = CreateRecordWidth( 4, 170, 0,0 ); + + // set up head of list now + pRecordListHead = pTempRecord; + + // next record + pTempRecord -> Next = CreateRecordWidth( 5, 170,0, 0 ); + pTempRecord = pTempRecord->Next; + + pTempRecord -> Next = CreateRecordWidth( 6, 170,0, 0 ); + pTempRecord = pTempRecord->Next; + + + return( pRecordListHead ); + +} + + +void ClearOutWidthRecordsList( FileRecordWidthPtr pFileRecordWidthList ) +{ + FileRecordWidthPtr pTempRecord = NULL; + FileRecordWidthPtr pDeleteRecord = NULL; + + // set up to head of the list + pTempRecord = pDeleteRecord = pFileRecordWidthList; + + // error check + if( pFileRecordWidthList == NULL ) + { + return; + } + + while( pTempRecord -> Next ) + { + // set up delete record + pDeleteRecord = pTempRecord; + + // move to next record + pTempRecord = pTempRecord -> Next; + + MemFree( pDeleteRecord ); + } + + // now get the last element + MemFree( pTempRecord ); + + // null out passed ptr + pFileRecordWidthList = NULL; + + + return; +} + + +void OpenFirstUnreadFile( void ) +{ + // open the first unread file in the list + INT32 iCounter = 0; + FilesUnitPtr pFilesList=pFilesListHead; + + // make sure is a valid + while( pFilesList ) + { + + // if iCounter = iFileId, is a valid file + if( pFilesList -> fRead == FALSE ) + { + iHighLightFileLine = iCounter; + } + + // next element in list + pFilesList = pFilesList->Next; + + // increment counter + iCounter++; + } + + return; +} + + +void CheckForUnreadFiles( void ) +{ + BOOLEAN fStatusOfNewFileFlag = fNewFilesInFileViewer; + + // willc heck for any unread files and set flag if any + FilesUnitPtr pFilesList=pFilesListHead; + + fNewFilesInFileViewer = FALSE; + + + while( pFilesList ) + { + // unread?...if so, set flag + if( pFilesList -> fRead == FALSE ) + { + fNewFilesInFileViewer = TRUE; + } + // next element in list + pFilesList = pFilesList->Next; + } + + //if the old flag and the new flag arent the same, either create or destory the fast help region + if( fNewFilesInFileViewer != fStatusOfNewFileFlag ) + { + CreateFileAndNewEmailIconFastHelpText( LAPTOP_BN_HLP_TXT_YOU_HAVE_NEW_FILE, (BOOLEAN)!fNewFilesInFileViewer ); + } +} + +BOOLEAN HandleSpecialTerroristFile( INT32 iFileNumber, STR sPictureName ) +{ + + INT32 iCounter = 0; + wchar_t sString[2048]; + FileStringPtr pTempString = NULL ; + FileStringPtr pLocatorString = NULL; + INT32 iTotalYPosition = 0; + INT32 iYPositionOnPage = 0; + INT32 iFileLineWidth = 0; + INT32 iFileStartX = 0; + UINT32 uiFlags = 0; + UINT32 uiFont = 0; + BOOLEAN fGoingOffCurrentPage = FALSE; + FileRecordWidthPtr WidthList = NULL; + INT32 iOffset = 0; + UINT32 uiPicture; + HVOBJECT hHandle; + VOBJECT_DESC VObjectDesc; + CHAR sTemp[ 128 ]; + + iOffset = ubFileOffsets[ iFileNumber ] ; + + // grab width list + WidthList = CreateWidthRecordsForTerroristFile( ); + + + while( iCounter < ubFileRecordsLength[ iFileNumber ] ) + { + LoadEncryptedDataFromFile( "BINARYDATA\\files.EDT", sString, FILE_STRING_SIZE * ( iOffset + iCounter ) * 2, FILE_STRING_SIZE * 2 ); + AddStringToFilesList( sString ); + iCounter++; + } + + pTempString = pFileStringList; + + + iYPositionOnPage = 0; + iCounter = 0; + pLocatorString = pTempString; + + pTempString = GetFirstStringOnThisPage( pFileStringList,FILES_TEXT_FONT, 350, FILE_GAP, giFilesPage, MAX_FILE_MESSAGE_PAGE_SIZE, WidthList); + + // find out where this string is + while( pLocatorString != pTempString ) + { + iCounter++; + pLocatorString = pLocatorString -> Next; + } + + + // move through list and display + while( pTempString ) + { + uiFlags = IAN_WRAP_NO_SHADOW; + // copy over string + wcscpy( sString, pTempString -> pString ); + + if( sString[ 0 ] == 0 ) + { + // on last page + fOnLastFilesPageFlag = TRUE; + } + + + // set up font + uiFont = FILES_TEXT_FONT; + if( giFilesPage == 0 ) + { + switch( iCounter ) + { + case( 0 ): + uiFont = FILES_TITLE_FONT; + break; + + } + } + + if( ( iCounter > 3 ) && ( iCounter < 7 ) ) + { + iFileLineWidth = 170; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 180 ); + } + else + { + // reset width + iFileLineWidth = 350; + iFileStartX = (UINT16) ( FILE_VIEWER_X + 10 ); + } + + // based on the record we are at, selected X start position and the width to wrap the line, to fit around pictures + if( ( iYPositionOnPage + IanWrappedStringHeight(0, 0, ( UINT16 )iFileLineWidth, FILE_GAP, + uiFont, 0, sString, + 0, 0, 0 ) ) < MAX_FILE_MESSAGE_PAGE_SIZE ) + { + // now print it + iYPositionOnPage += ( INT32 )IanDisplayWrappedString((UINT16) ( iFileStartX ), ( UINT16 )( FILE_VIEWER_Y + iYPositionOnPage), ( INT16 )iFileLineWidth, FILE_GAP, uiFont, FILE_TEXT_COLOR, sString,0,FALSE, uiFlags ); + + fGoingOffCurrentPage = FALSE; + } + else + { + // gonna get cut off...end now + fGoingOffCurrentPage = TRUE; + } + + pTempString = pTempString ->Next; + + if( ( pTempString == NULL ) && ( fGoingOffCurrentPage == FALSE ) ) + { + // on last page + fOnLastFilesPageFlag = TRUE; + } + else + { + fOnLastFilesPageFlag = FALSE; + } + + // going over the edge, stop now + if( fGoingOffCurrentPage == TRUE ) + { + pTempString = NULL; + } + + // show picture + if( ( giFilesPage == 0 ) && ( iCounter == 5 ) ) + { + if( usProfileIdsForTerroristFiles[ iFileNumber + 1 ] < 100 ) + { + sprintf(sTemp, "%s%02d.sti", "FACES\\BIGFACES\\", usProfileIdsForTerroristFiles[ iFileNumber + 1 ]); + } + else + { + sprintf(sTemp, "%s%03d.sti", "FACES\\BIGFACES\\", usProfileIdsForTerroristFiles[ iFileNumber + 1 ]); + } + + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP(sTemp, VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); + + //Blt face to screen to + GetVideoObject(&hHandle, uiPicture); + +//def: 3/24/99 +// BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( FILE_VIEWER_X + 30 ), ( INT16 ) ( iYPositionOnPage + 5), VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( FILE_VIEWER_X + 30 ), ( INT16 ) ( iYPositionOnPage + 21), VO_BLT_SRCTRANSPARENCY,NULL); + + DeleteVideoObjectFromIndex( uiPicture ); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\InterceptBorder.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiPicture)); + + //Blt face to screen to + GetVideoObject(&hHandle, uiPicture); + + BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( FILE_VIEWER_X + 25 ), ( INT16 ) ( iYPositionOnPage + 16 ), VO_BLT_SRCTRANSPARENCY,NULL); + + DeleteVideoObjectFromIndex( uiPicture ); + } + + iCounter++; + } + + + + ClearOutWidthRecordsList( WidthList ); + ClearFileStringList( ); + + return( TRUE ); +} + +// add a file about this terrorist +BOOLEAN AddFileAboutTerrorist( INT32 iProfileId ) +{ + INT32 iCounter = 0; + + for( iCounter = 1; iCounter < 7; iCounter++ ) + { + if( usProfileIdsForTerroristFiles[ iCounter ] == iProfileId ) + { + // checked, and this file is there + AddFilesToPlayersLog( ( UINT8 )iCounter, 0, 3, NULL, NULL ); + return( TRUE ); + } + } + + return( FALSE ); +} + + + + + + diff --git a/Laptop/files.h b/Laptop/files.h new file mode 100644 index 00000000..fd28da36 --- /dev/null +++ b/Laptop/files.h @@ -0,0 +1,83 @@ +#ifndef __FILES_H +#define __FILES_H + + +#define FILES_DAT_FILE "TEMP\\files.dat" + +void GameInitFiles(); +void EnterFiles(); +void ExitFiles(); +void HandleFiles(); +void RenderFiles(); + + +struct files{ + UINT8 ubCode; // the code index in the files code table + UINT8 ubFormat; // layout format + UINT32 uiIdNumber; // unique id number + UINT32 uiDate; // time in the world in global time (resolution, minutes) + BOOLEAN fRead; + STR8 pPicFileNameList[2]; + + struct files *Next; // next unit in the list + +}; + +struct filestring{ + STR16 pString; + struct filestring *Next; +}; + +typedef struct filestring FileString; +typedef struct filestring *FileStringPtr; + +// files codes +enum{ + FILES_WELCOME_NOTICE, +}; + + +// special codes for special files +enum{ + ENRICO_BACKGROUND = 0, + SLAY_BACKGROUND, + MATRON_BACKGROUND, + IMPOSTER_BACKGROUND, + TIFFANY_BACKGROUND, + REXALL_BACKGROUND, + ELGIN_BACKGROUND, + +}; +extern UINT8 ubFileRecordsLength[]; +extern BOOLEAN fEnteredFileViewerFromNewFileIcon; +extern BOOLEAN fNewFilesInFileViewer; + + + +typedef struct files FilesUnit; +typedef struct files *FilesUnitPtr; + +extern FilesUnitPtr pFilesListHead; + +struct filerecordwidth{ + INT32 iRecordNumber; + INT32 iRecordWidth; + INT32 iRecordHeightAdjustment; + UINT8 ubFlags; + struct filerecordwidth *Next; +}; + +typedef struct filerecordwidth FileRecordWidth; +typedef struct filerecordwidth *FileRecordWidthPtr; +UINT32 AddFilesToPlayersLog(UINT8 ubCode, UINT32 uiDate , UINT8 ubFormat, STR8 pFirstPicFile, STR8 pSecondPicFile ); + +// add a file about this terrorist +BOOLEAN AddFileAboutTerrorist( INT32 iProfileId ); + +#endif + + + + + + diff --git a/Laptop/finances.cpp b/Laptop/finances.cpp new file mode 100644 index 00000000..adc5d804 --- /dev/null +++ b/Laptop/finances.cpp @@ -0,0 +1,2717 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "finances.h" + #include "Game clock.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Debug.h" + #include "WordWrap.h" + #include "Render Dirty.h" + #include "Encrypted File.h" + #include "cursors.h" + #include "Soldier Profile.h" + #include "Text.h" + #include "Strategic Mines.h" + #include "LaptopSave.h" +#endif + +// the global defines + +// graphical positions +#define TOP_X LAPTOP_SCREEN_UL_X +#define TOP_Y LAPTOP_SCREEN_UL_Y +#define BLOCK_HEIGHT 10 +#define TOP_DIVLINE_Y iScreenHeightOffset + 102 +#define DIVLINE_X iScreenWidthOffset + 130 +#define MID_DIVLINE_Y iScreenHeightOffset + 205 +#define BOT_DIVLINE_Y iScreenHeightOffset + 180 +#define MID_DIVLINE_Y2 iScreenHeightOffset + 263 + 20 +#define BOT_DIVLINE_Y2 MID_DIVLINE_Y2 + MID_DIVLINE_Y - BOT_DIVLINE_Y +#define TITLE_X iScreenWidthOffset + 140 +#define TITLE_Y iScreenHeightOffset + 33 +#define TEXT_X iScreenWidthOffset + 140 +#define PAGE_SIZE 17 + +// yesterdyas/todays income and balance text positions +#define YESTERDAYS_INCOME iScreenHeightOffset + 114 +#define YESTERDAYS_OTHER iScreenHeightOffset + 138 +#define YESTERDAYS_DEBITS iScreenHeightOffset + 162 +#define YESTERDAYS_BALANCE iScreenHeightOffset + 188 +#define TODAYS_INCOME iScreenHeightOffset + 215 +#define TODAYS_OTHER iScreenHeightOffset + 239 +#define TODAYS_DEBITS iScreenHeightOffset + 263 +#define TODAYS_CURRENT_BALANCE iScreenHeightOffset + 263 + 28 +#define TODAYS_CURRENT_FORCAST_INCOME iScreenHeightOffset + 330 +#define TODAYS_CURRENT_FORCAST_BALANCE iScreenHeightOffset + 354 +//#define SUMMARY_NUMBERS_X +#define FINANCE_HEADER_FONT FONT14ARIAL +#define FINANCE_TEXT_FONT FONT12ARIAL +#define NUM_RECORDS_PER_PAGE PAGE_SIZE + +// records text positions +#define RECORD_CREDIT_WIDTH 106-47 +#define RECORD_DEBIT_WIDTH RECORD_CREDIT_WIDTH +#define RECORD_DATE_X TOP_X+10 +#define RECORD_TRANSACTION_X RECORD_DATE_X+RECORD_DATE_WIDTH +#define RECORD_TRANSACTION_WIDTH 500-280 +#define RECORD_DEBIT_X RECORD_TRANSACTION_X+RECORD_TRANSACTION_WIDTH +#define RECORD_CREDIT_X RECORD_DEBIT_X+RECORD_DEBIT_WIDTH +#define RECORD_Y iScreenHeightOffset + 107-10 +#define RECORD_DATE_WIDTH 47 +#define RECORD_BALANCE_X RECORD_DATE_X+385 +#define RECORD_BALANCE_WIDTH 479-385 +#define RECORD_HEADER_Y iScreenHeightOffset + 90 + + +#define PAGE_NUMBER_X TOP_X+297 +#define PAGE_NUMBER_Y TOP_Y+33 + + +// BUTTON defines +enum{ + PREV_PAGE_BUTTON=0, + NEXT_PAGE_BUTTON, + FIRST_PAGE_BUTTON, + LAST_PAGE_BUTTON, +}; + + +// button positions + +#define FIRST_PAGE_X iScreenWidthOffset + 505 +#define NEXT_BTN_X iScreenWidthOffset + 553//577 +#define PREV_BTN_X iScreenWidthOffset + 529//553 +#define LAST_PAGE_X iScreenWidthOffset + 577 +#define BTN_Y iScreenHeightOffset + 53 + + + +// sizeof one record +#define RECORD_SIZE ( sizeof( UINT32 ) + sizeof( INT32 ) + sizeof( INT32 ) + sizeof( UINT8 ) + sizeof( UINT8 ) ) + + + + +// the financial record list +FinanceUnitPtr pFinanceListHead=NULL; + +// current players balance +//INT32 iCurrentBalance=0; + +// current page displayed +INT32 iCurrentPage=0; + +// current financial record (the one at the top of the current page) +FinanceUnitPtr pCurrentFinance=NULL; + +// video object id's +UINT32 guiTITLE; +UINT32 guiGREYFRAME; +UINT32 guiTOP; +UINT32 guiMIDDLE; +UINT32 guiBOTTOM; +UINT32 guiLINE; +UINT32 guiLONGLINE; +UINT32 guiLISTCOLUMNS; + +// are in the financial system right now? +BOOLEAN fInFinancialMode=FALSE; +extern BOOLEAN fMapScreenBottomDirty; + + +// the last page loaded +UINT32 guiLastPageLoaded = 0; + +// the last page altogether +UINT32 guiLastPageInRecordsList = 0; + +// finance screen buttons +INT32 giFinanceButton[4]; +INT32 giFinanceButtonImage[4]; + +// internal functions +UINT32 ProcessAndEnterAFinacialRecord( UINT8 ubCode, UINT32 uiDate, INT32 iAmount, UINT8 ubSecondCode, INT32 iBalanceToDate); +void RenderBackGround( void ); +BOOLEAN LoadFinances(); +void DrawSummary( void ); +void DrawSummaryLines( void ); +void DrawFinanceTitleText( void ); +void InvalidateLapTopScreen( void ); +void RemoveFinances( void ); +void DrawSummaryText( void ); +INT32 GetCurrentBalance( void ); +void ClearFinanceList( void ); +void OpenAndReadFinancesFile( void ); +void DrawAPageOfRecords( void ); +void DrawRecordsBackGround( void ); +void DrawRecordsText( void ); +void DrawRecordsColumnHeadersText( void ); +void BtnFinanceDisplayNextPageCallBack(GUI_BUTTON *btn,INT32 reason); +void BtnFinanceFirstLastPageCallBack(GUI_BUTTON *btn,INT32 reason); +void BtnFinanceDisplayPrevPageCallBack(GUI_BUTTON *btn,INT32 reason); +void CreateFinanceButtons( void ); +void DestroyFinanceButtons( void ); +void IncrementCurrentPageFinancialDisplay( void ); +void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance); +void DisplayFinancePageNumberAndDateRange( void ); +void GetBalanceFromDisk( void ); +BOOLEAN WriteBalanceToDisk( void ); +BOOLEAN AppendFinanceToEndOfFile( FinanceUnitPtr pFinance ); +UINT32 ReadInLastElementOfFinanceListAndReturnIdNumber( void ); +void SetLastPageInRecords( void ); +BOOLEAN LoadInRecords( UINT32 uiPage ); +BOOLEAN LoadPreviousPage( void ); +BOOLEAN LoadNextPage( void ); + +INT32 GetPreviousBalanceToDate( void ); +INT32 GetPreviousDaysIncome( void ); +INT32 GetPreviousDaysBalance( void ); + +void SetFinanceButtonStates( void ); +INT32 GetTodaysBalance( void ); +INT32 GetTodaysDebits( void ); +INT32 GetYesterdaysOtherDeposits( void ); +INT32 GetTodaysOtherDeposits( void ); +INT32 GetYesterdaysDebits( void ); + + +UINT32 AddTransactionToPlayersBook (UINT8 ubCode, UINT8 ubSecondCode, UINT32 uiDate, INT32 iAmount) +{ + // adds transaction to player's book(Financial List), returns unique id number of it + // outside of the financial system(the code in this .c file), this is the only function you'll ever need + + INT32 iCurPage = iCurrentPage; + UINT32 uiId=0; + FinanceUnitPtr pFinance=pFinanceListHead; + + // read in balance from file + + GetBalanceFromDisk( ); + // process the actual data + + + // + // If this transaction is for the hiring/extending of a mercs contract + // + if( ubCode == HIRED_MERC || + ubCode == IMP_PROFILE || + ubCode == PAYMENT_TO_NPC || + ubCode == EXTENDED_CONTRACT_BY_1_DAY || + ubCode == EXTENDED_CONTRACT_BY_1_WEEK || + ubCode == EXTENDED_CONTRACT_BY_2_WEEKS + ) + { + gMercProfiles[ ubSecondCode ].uiTotalCostToDate += -iAmount; + } + + // clear list + ClearFinanceList( ); + + pFinance=pFinanceListHead; + + // update balance + LaptopSaveInfo.iCurrentBalance += iAmount; + + uiId = ProcessAndEnterAFinacialRecord(ubCode, uiDate, iAmount, ubSecondCode, LaptopSaveInfo.iCurrentBalance); + + // write balance to disk + WriteBalanceToDisk( ); + + // append to end of file + AppendFinanceToEndOfFile( pFinance ); + + // set number of pages + SetLastPageInRecords( ); + + if( !fInFinancialMode ) + { + ClearFinanceList( ); + } + else + { + SetFinanceButtonStates( ); + + // force update + fPausedReDrawScreenFlag = TRUE; + } + + fMapScreenBottomDirty = TRUE; + + // return unique id of this transaction + return uiId; +} + +FinanceUnitPtr GetFinance(UINT32 uiId) +{ + FinanceUnitPtr pFinance=pFinanceListHead; + + // get a finance object and return a pointer to it, the obtaining of the + // finance object is via a unique ID the programmer must store + // , it is returned on addition of a financial transaction + + // error check + if(!pFinance) + return ( NULL ); + + // look for finance object with Id + while(pFinance) + { + if(pFinance->uiIdNumber == uiId) + break; + + // next finance record + pFinance = pFinance->Next; + } + + return (pFinance); +} + +UINT32 GetTotalDebits() +{ + // returns the total of the debits + UINT32 uiDebits=0; + FinanceUnitPtr pFinance=pFinanceListHead; + + // run to end of list + while(pFinance) + { + // if a debit, add to debit total + if(pFinance->iAmount > 0) + uiDebits+=( (UINT32) (pFinance->iAmount)); + + // next finance record + pFinance=pFinance->Next; + } + + return uiDebits; +} + +UINT32 GetTotalCredits() +{ + // returns the total of the credits + UINT32 uiCredits = 0; + FinanceUnitPtr pFinance=pFinanceListHead; + + // run to end of list + while( pFinance ) + { + // if a credit, add to credit total + if( pFinance->iAmount < 0 ) + uiCredits += ( (UINT32) ( pFinance->iAmount )); + + // next finance record + pFinance = pFinance->Next; + } + + return uiCredits; +} + +UINT32 GetDayCredits(UINT32 usDayNumber) +{ + // returns the total of the credits for day( note resolution of usDayNumber is days) + UINT32 uiCredits = 0; + FinanceUnitPtr pFinance = pFinanceListHead; + + while( pFinance ) + { + // if a credit and it occurs on day passed + if(( pFinance->iAmount < 0)&&( (pFinance->uiDate / (60*24)) ==usDayNumber )) + uiCredits+=((UINT32)(pFinance->iAmount)); + + // next finance record + pFinance=pFinance->Next; + } + + return uiCredits; +} + +UINT32 GetDayDebits(UINT32 usDayNumber) +{ + // returns the total of the debits + UINT32 uiDebits=0; + FinanceUnitPtr pFinance=pFinanceListHead; + + while(pFinance) + { + if(( pFinance->iAmount > 0 )&&( (pFinance->uiDate / (60*24) ) ==usDayNumber ) ) + uiDebits += ( (UINT32) (pFinance->iAmount)); + + // next finance record + pFinance=pFinance->Next; + } + + return uiDebits; +} + +INT32 GetTotalToDay( INT32 sTimeInMins ) +{ + // gets the total amount to this day + UINT32 uiTotal = 0; + FinanceUnitPtr pFinance = pFinanceListHead; + + while(pFinance) + { + if(((INT32)( pFinance->uiDate / (60*24)) <= sTimeInMins/(24*60) )) + uiTotal += ((UINT32)(pFinance->iAmount)); + + // next finance record + pFinance=pFinance->Next; + } + + return uiTotal; +} +INT32 GetYesterdaysIncome( void ) +{ + // get income for yesterday + return ( GetDayDebits(( ( GetWorldTotalMin() - (24*60) ) / (24*60) )) + GetDayCredits(( (UINT32) ( GetWorldTotalMin() -(24*60) )/ (24*60) ))); +} + +INT32 GetCurrentBalance( void ) +{ + // get balance to this minute + return ( LaptopSaveInfo.iCurrentBalance ); + + // return(GetTotalDebits((GetWorldTotalMin()))+GetTotalCredits((GetWorldTotalMin()))); +} + +INT32 GetTodaysIncome( void ) +{ + // get income + return ( GetCurrentBalance() - GetTotalToDay( GetWorldTotalMin() - ( 24*60 ) )); +} + + +INT32 GetProjectedTotalDailyIncome( void ) +{ + // return total projected income, including what is earned today already + + // CJC: I DON'T THINK SO! + // The point is: PredictIncomeFromPlayerMines isn't dependant on the time of day + // (anymore) and this would report income of 0 at midnight! + /* + if (GetWorldMinutesInDay() <= 0) + { + return ( 0 ); + } + */ + // look at we earned today + + // then there is how many deposits have been made, now look at how many mines we have, thier rate, amount of ore left and predict if we still + // had these mines how much more would we get? + + return( PredictIncomeFromPlayerMines() ); +} + +INT32 GetProjectedBalance( void ) +{ + // return the projected balance for tommorow - total for today plus the total income, projected. + return( GetProjectedTotalDailyIncome( ) + GetCurrentBalance( ) ); +} + +INT32 GetConfidenceValue() +{ + // return confidence that the projected income is infact correct + return(( ( GetWorldMinutesInDay()*100 ) / (60*24) )); +} + +void GameInitFinances() +{ + // initialize finances on game start up + // unlink Finances data file + if( (FileExists( FINANCES_DATA_FILE ) ) ) + { + FileClearAttributes( FINANCES_DATA_FILE ); + FileDelete( FINANCES_DATA_FILE ); + } + GetBalanceFromDisk( ); +} + +void EnterFinances() +{ + //entry into finanacial system, load graphics, set variables..draw screen once + // set the fact we are in the financial display system + + fInFinancialMode=TRUE; + // build finances list + //OpenAndReadFinancesFile( ); + + // reset page we are on + iCurrentPage = LaptopSaveInfo.iCurrentFinancesPage; + + + // get the balance + GetBalanceFromDisk( ); + + // clear the list + ClearFinanceList( ); + + // force redraw of the entire screen + fReDrawScreenFlag=TRUE; + + // set number of pages + SetLastPageInRecords( ); + + // load graphics into memory + LoadFinances( ); + + // create buttons + CreateFinanceButtons( ); + + // set button state + SetFinanceButtonStates( ); + + // draw finance + RenderFinances( ); + +// DrawSummary( ); + + // draw page number + DisplayFinancePageNumberAndDateRange( ); + + + + //InvalidateRegion(0,0,640,480); + return; +} + +void ExitFinances( void ) +{ + LaptopSaveInfo.iCurrentFinancesPage = iCurrentPage; + + + // not in finance system anymore + fInFinancialMode=FALSE; + + // destroy buttons + DestroyFinanceButtons( ); + + // clear out list + ClearFinanceList( ); + + + // remove graphics + RemoveFinances( ); + return; + +} + +void HandleFinances( void ) +{ + +} + +void RenderFinances( void ) +{ + HVOBJECT hHandle; + + // draw background + RenderBackGround(); + + // if we are on the first page, draw the summary + if(iCurrentPage==0) + DrawSummary( ); + else + DrawAPageOfRecords( ); + + + + //title + DrawFinanceTitleText( ); + + // draw pages and dates + DisplayFinancePageNumberAndDateRange( ); + + + // display border + GetVideoObject(&hHandle, guiLaptopBACKGROUND); + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 108, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); + + + // title bar icon + BlitTitleBarIcons( ); + + + + return; +} + +BOOLEAN LoadFinances( void ) +{ + VOBJECT_DESC VObjectDesc; + // load Finance video objects into memory + + // title bar + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTITLE)); + + // top portion of the screen background + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Financeswindow.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTOP)); + + // black divider line - long ( 480 length) + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\divisionline480.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLONGLINE)); + + // the records columns + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\recordcolumns.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLISTCOLUMNS)); + + // black divider line - long ( 480 length) + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\divisionline.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLINE)); + + return (TRUE); +} + +void RemoveFinances( void ) +{ + + // delete Finance video objects from memory + DeleteVideoObjectFromIndex(guiLONGLINE); + DeleteVideoObjectFromIndex(guiLINE); + DeleteVideoObjectFromIndex(guiLISTCOLUMNS); + DeleteVideoObjectFromIndex(guiTOP); + DeleteVideoObjectFromIndex(guiTITLE); + + + return; +} + +void RenderBackGround( void ) +{ + // render generic background for Finance system + HVOBJECT hHandle; + INT32 iCounter=0; + + // get title bar object + GetVideoObject(&hHandle, guiTITLE); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y - 2, VO_BLT_SRCTRANSPARENCY,NULL); + + // get and blt the top part of the screen, video object and blt to screen + GetVideoObject(&hHandle, guiTOP); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y + 22, VO_BLT_SRCTRANSPARENCY,NULL); + DrawFinanceTitleText( ); + return; +} + + + + +void DrawSummary( void ) +{ + // draw day's summary to screen + DrawSummaryLines( ); + DrawSummaryText( ); + DrawFinanceTitleText( ); + return; +} + +void DrawSummaryLines( void ) +{ + // draw divider lines on screen + HVOBJECT hHandle; + + // the summary LINE object handle + GetVideoObject(&hHandle, guiLINE); + + // blit summary LINE object to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, TOP_DIVLINE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, TOP_DIVLINE_Y+2, VO_BLT_SRCTRANSPARENCY,NULL); + //BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, MID_DIVLINE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, BOT_DIVLINE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, MID_DIVLINE_Y2, VO_BLT_SRCTRANSPARENCY,NULL); + //BltVideoObject(FRAME_BUFFER, hHandle, 0,DIVLINE_X, BOT_DIVLINE_Y2, VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + +void DrawAPageOfRecords( void ) +{ + // this procedure will draw a series of financial records to the screen + INT32 iCurPage=1; + INT32 iCount=0; + pCurrentFinance=pFinanceListHead; + + // (re-)render background + DrawRecordsBackGround( ); + + // error check + if(iCurrentPage==-1) + return; + + + // current page is found, render from here + DrawRecordsText( ); + DisplayFinancePageNumberAndDateRange( ); + return; +} + +void DrawRecordsBackGround( void ) +{ + // proceudre will draw the background for the list of financial records + INT32 iCounter=6; + HVOBJECT hHandle; + + // render the generic background + RenderBackGround( ); + + + // now the columns + for(iCounter; iCounter <35; iCounter++) + { + // get and blt middle background to screen + GetVideoObject(&hHandle, guiLISTCOLUMNS); + BltVideoObject(FRAME_BUFFER, hHandle, 0, TOP_X + 10, TOP_Y + 18 + ( iCounter * BLOCK_HEIGHT ) + 1, VO_BLT_SRCTRANSPARENCY,NULL); + } + + // the divisorLines + GetVideoObject(&hHandle, guiLONGLINE); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 10, TOP_Y + 17 + ( 6 * ( BLOCK_HEIGHT ) ), VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiLONGLINE); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 10, TOP_Y + 19 + ( 6 * ( BLOCK_HEIGHT ) ) , VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hHandle, guiLONGLINE); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 10, TOP_Y + 19 + ( ( iCounter ) * ( BLOCK_HEIGHT ) ) , VO_BLT_SRCTRANSPARENCY,NULL); + + + // the header text + DrawRecordsColumnHeadersText( ); + + return; + +} + +void DrawRecordsColumnHeadersText( void ) +{ + // write the headers text for each column + UINT16 usX, usY; + + // font stuff + SetFont(FINANCE_TEXT_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // the date header + FindFontCenterCoordinates(RECORD_DATE_X,0,RECORD_DATE_WIDTH,0, pFinanceHeaders[0], FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, RECORD_HEADER_Y, pFinanceHeaders[0]); + + // debit header + FindFontCenterCoordinates(RECORD_DEBIT_X,0,RECORD_DEBIT_WIDTH,0, pFinanceHeaders[1], FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, RECORD_HEADER_Y, pFinanceHeaders[1]); + + // credit header + FindFontCenterCoordinates(RECORD_CREDIT_X,0,RECORD_CREDIT_WIDTH,0, pFinanceHeaders[2], FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, RECORD_HEADER_Y, pFinanceHeaders[2]); + + // balance header + FindFontCenterCoordinates(RECORD_BALANCE_X,0,RECORD_BALANCE_WIDTH,0, pFinanceHeaders[4], FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, RECORD_HEADER_Y, pFinanceHeaders[4]); + + // transaction header + FindFontCenterCoordinates(RECORD_TRANSACTION_X,0,RECORD_TRANSACTION_WIDTH,0, pFinanceHeaders[3], FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, RECORD_HEADER_Y, pFinanceHeaders[3]); + + SetFontShadow(DEFAULT_SHADOW); + return; +} + +void DrawRecordsText( void ) +{ + // draws the text of the records + FinanceUnitPtr pCurFinance=pCurrentFinance; + FinanceUnitPtr pTempFinance=pFinanceListHead; + wchar_t sString[512]; + INT32 iCounter=0; + UINT16 usX, usY; + INT32 iBalance=0; + + // setup the font stuff + SetFont(FINANCE_TEXT_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + + // anything to print + if( pCurrentFinance == NULL ) + { + // nothing to print + return; + } + + // get balance to this point + while( pTempFinance !=pCurFinance) + { + // increment balance by amount of transaction + iBalance += pTempFinance->iAmount; + + // next element + pTempFinance = pTempFinance->Next; + } + + // loop through record list + for(iCounter; iCounter uiDate / ( 24*60 ) ); + + + + FindFontCenterCoordinates(RECORD_DATE_X,0,RECORD_DATE_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, 12+RECORD_Y + ( iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); + + // get and write debit/ credit + if(pCurFinance->iAmount >=0) + { + // increase in asset - debit + swprintf(sString, L"%d", pCurFinance->iAmount); + // insert commas + InsertCommasForDollarFigure( sString ); + // insert dollar sight for first record in the list +//DEF: 3/19/99: removed cause we want to see the dollar sign on ALL entries +// if( iCounter == 0 ) + { + InsertDollarSignInToString( sString ); + } + + FindFontCenterCoordinates(RECORD_DEBIT_X,0,RECORD_DEBIT_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); + } + else + { + // decrease in asset - credit + swprintf(sString, L"%d", pCurFinance->iAmount * (-1)); + SetFontForeground(FONT_RED); + InsertCommasForDollarFigure( sString ); + // insert dollar sight for first record in the list +//DEF: 3/19/99: removed cause we want to see the dollar sign on ALL entries +// if( iCounter == 0 ) + { + InsertDollarSignInToString( sString ); + } + + FindFontCenterCoordinates(RECORD_CREDIT_X ,0 , RECORD_CREDIT_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); + SetFontForeground(FONT_BLACK); + } + + // the balance to this point + iBalance = pCurFinance->iBalanceToDate; + + // set font based on balance + if(iBalance >=0) + { + SetFontForeground(FONT_BLACK); + } + else + { + SetFontForeground(FONT_RED); + iBalance = ( iBalance ) * ( -1 ); + } + + // transaction string + ProcessTransactionString(sString, pCurFinance); + FindFontCenterCoordinates(RECORD_TRANSACTION_X,0,RECORD_TRANSACTION_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); + + + // print the balance string + swprintf(sString, L"%d", iBalance); + InsertCommasForDollarFigure( sString ); + // insert dollar sight for first record in the list +//DEF: 3/19/99: removed cause we want to see the dollar sign on ALL entries +// if( iCounter == 0 ) + { + InsertDollarSignInToString( sString ); + } + + FindFontCenterCoordinates(RECORD_BALANCE_X,0,RECORD_BALANCE_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY); + mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString); + + // restore font color + SetFontForeground(FONT_BLACK); + + // next finance + pCurFinance = pCurFinance->Next; + + // last page, no finances left, return + if( ! pCurFinance ) + { + + // restore shadow + SetFontShadow(DEFAULT_SHADOW); + return; + } + + } + + // restore shadow + SetFontShadow(DEFAULT_SHADOW); + return; +} +void DrawFinanceTitleText( void ) +{ + // setup the font stuff + SetFont(FINANCE_HEADER_FONT); + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + + // draw the pages title + mprintf(TITLE_X,TITLE_Y,pFinanceTitle[0]); + + + return; +} + +void InvalidateLapTopScreen( void ) +{ + // invalidates blit region to force refresh of screen + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_LR_Y); + + return; +} + +void DrawSummaryText( void ) +{ + INT16 usX, usY; + wchar_t pString[100]; + INT32 iBalance = 0; + + + // setup the font stuff + SetFont(FINANCE_TEXT_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // draw summary text to the screen + mprintf(TEXT_X,YESTERDAYS_INCOME,pFinanceSummary[2]); + mprintf(TEXT_X,YESTERDAYS_OTHER,pFinanceSummary[3]); + mprintf(TEXT_X,YESTERDAYS_DEBITS,pFinanceSummary[4]); + mprintf(TEXT_X,YESTERDAYS_BALANCE,pFinanceSummary[5]); + mprintf(TEXT_X,TODAYS_INCOME,pFinanceSummary[6]); + mprintf(TEXT_X,TODAYS_OTHER,pFinanceSummary[7]); + mprintf(TEXT_X,TODAYS_DEBITS,pFinanceSummary[8]); + mprintf(TEXT_X,TODAYS_CURRENT_BALANCE, pFinanceSummary[9]); + mprintf(TEXT_X,TODAYS_CURRENT_FORCAST_INCOME, pFinanceSummary[10]); + mprintf(TEXT_X,TODAYS_CURRENT_FORCAST_BALANCE, pFinanceSummary[11]); + + // draw the actual numbers + + + + // yesterdays income + iBalance = GetPreviousDaysIncome( ); + swprintf(pString, L"%d", iBalance ); + + InsertCommasForDollarFigure( pString ); + + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + + mprintf(usX,YESTERDAYS_INCOME,pString); + + SetFontForeground( FONT_BLACK ); + + // yesterdays other + iBalance = GetYesterdaysOtherDeposits( ); + swprintf(pString, L"%d", iBalance ); + + InsertCommasForDollarFigure( pString ); + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + + mprintf(usX,YESTERDAYS_OTHER,pString); + + SetFontForeground( FONT_RED ); + + // yesterdays debits + iBalance = GetYesterdaysDebits( ); + if( iBalance < 0 ) + { + SetFontForeground( FONT_RED ); + iBalance *= -1; + } + + swprintf(pString, L"%d", iBalance ); + + InsertCommasForDollarFigure( pString ); + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + + mprintf(usX,YESTERDAYS_DEBITS,pString); + + SetFontForeground( FONT_BLACK ); + + // yesterdays balance..ending balance..so todays balance then + iBalance = GetTodaysBalance( ); + + if( iBalance < 0 ) + { + SetFontForeground( FONT_RED ); + iBalance *= -1; + } + + swprintf(pString, L"%d", iBalance ); + InsertCommasForDollarFigure( pString ); + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + + mprintf(usX,YESTERDAYS_BALANCE,pString); + + SetFontForeground( FONT_BLACK ); + + // todays income + iBalance = GetTodaysDaysIncome( ); + swprintf(pString, L"%d", iBalance ); + + InsertCommasForDollarFigure( pString ); + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + + mprintf(usX,TODAYS_INCOME,pString); + + SetFontForeground( FONT_BLACK ); + + // todays other + iBalance = GetTodaysOtherDeposits( ); + swprintf(pString, L"%d", iBalance ); + + InsertCommasForDollarFigure( pString ); + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + + mprintf(usX,TODAYS_OTHER,pString); + + SetFontForeground( FONT_RED ); + + // todays debits + iBalance = GetTodaysDebits( ); + + // absolute value + if( iBalance < 0 ) + { + iBalance *= ( -1 ); + } + + swprintf(pString, L"%d", iBalance ); + + InsertCommasForDollarFigure( pString ); + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + + mprintf(usX,TODAYS_DEBITS,pString); + + SetFontForeground( FONT_BLACK ); + + // todays current balance + iBalance = GetCurrentBalance( ); + if( iBalance < 0 ) + { + iBalance *= -1; + SetFontForeground( FONT_RED ); + swprintf(pString, L"%d", iBalance ); + iBalance *= -1; + } + else + { + swprintf(pString, L"%d", iBalance ); + } + + InsertCommasForDollarFigure( pString ); + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,TODAYS_CURRENT_BALANCE,pString); + SetFontForeground( FONT_BLACK ); + + + // todays forcast income + iBalance = GetProjectedTotalDailyIncome( ); + swprintf(pString, L"%d", iBalance ); + + InsertCommasForDollarFigure( pString ); + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + + mprintf(usX,TODAYS_CURRENT_FORCAST_INCOME,pString); + + SetFontForeground( FONT_BLACK ); + + + // todays forcast balance + iBalance = GetCurrentBalance( ) + GetProjectedTotalDailyIncome( ); + if( iBalance < 0 ) + { + iBalance *= -1; + SetFontForeground( FONT_RED ); + swprintf(pString, L"%d", iBalance ); + iBalance *= -1; + } + else + { + swprintf(pString, L"%d", iBalance ); + } + + InsertCommasForDollarFigure( pString ); + if( iBalance != 0 ) + InsertDollarSignInToString( pString ); + + FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY); + mprintf(usX,TODAYS_CURRENT_FORCAST_BALANCE,pString); + SetFontForeground( FONT_BLACK ); + + + + // reset the shadow + SetFontShadow(DEFAULT_SHADOW); + + return; +} + + +void OpenAndReadFinancesFile( void ) +{ + // this procedure will open and read in data to the finance list + HWFILE hFileHandle; + UINT8 ubCode, ubSecondCode; + UINT32 uiDate; + INT32 iAmount; + INT32 iBalanceToDate; + INT32 iBytesRead=0; + UINT32 uiByteCount=0; + + // clear out the old list + ClearFinanceList( ); + + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return; + } + + // make sure file is more than 0 length + if ( FileGetSize( hFileHandle ) == 0 ) + { + FileClose( hFileHandle ); + return; + } + + // read in balance + // write balance to disk first + FileRead( hFileHandle, &(LaptopSaveInfo.iCurrentBalance), sizeof ( INT32 ), (UINT32 *)&iBytesRead ); + uiByteCount += sizeof( INT32 ); + + AssertMsg( iBytesRead, "Failed To Read Data Entry"); + + // file exists, read in data, continue until file end + while( FileGetSize( hFileHandle ) > uiByteCount) + { + + // read in other data + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + + AssertMsg( iBytesRead, "Failed To Read Data Entry"); + + // add transaction + ProcessAndEnterAFinacialRecord(ubCode, uiDate, iAmount, ubSecondCode, iBalanceToDate); + + // increment byte counter + uiByteCount += sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ); + } + + // close file + FileClose( hFileHandle ); + + return; +} + + +void ClearFinanceList( void ) +{ + // remove each element from list of transactions + FinanceUnitPtr pFinanceList=pFinanceListHead; + FinanceUnitPtr pFinanceNode=pFinanceList; + + // while there are elements in the list left, delete them + while( pFinanceList ) + { + // set node to list head + pFinanceNode=pFinanceList; + + // set list head to next node + pFinanceList=pFinanceList->Next; + + // delete current node + MemFree(pFinanceNode); + } + pCurrentFinance = NULL; + pFinanceListHead = NULL; + return; +} + + +UINT32 ProcessAndEnterAFinacialRecord( UINT8 ubCode, UINT32 uiDate, INT32 iAmount, UINT8 ubSecondCode, INT32 iBalanceToDate ) +{ + UINT32 uiId = 0; + FinanceUnitPtr pFinance=pFinanceListHead; + + // add to finance list + if(pFinance) + { + // go to end of list + while(pFinance->Next) + pFinance=pFinance->Next; + + // alloc space + pFinance->Next = (finance *) MemAlloc(sizeof(FinanceUnit)); + + // increment id number + uiId = pFinance->uiIdNumber + 1; + + // set up information passed + pFinance = pFinance->Next; + pFinance->Next = NULL; + pFinance->ubCode = ubCode; + pFinance->ubSecondCode = ubSecondCode; + pFinance->uiDate = uiDate; + pFinance->iAmount = iAmount; + pFinance->uiIdNumber = uiId; + pFinance->iBalanceToDate = iBalanceToDate; + + + } + else + { + // alloc space + uiId = ReadInLastElementOfFinanceListAndReturnIdNumber( ); + pFinance = (FinanceUnitPtr) MemAlloc(sizeof(FinanceUnit)); + + // setup info passed + pFinance->Next = NULL; + pFinance->ubCode = ubCode; + pFinance->ubSecondCode = ubSecondCode; + pFinance->uiDate = uiDate; + pFinance->iAmount= iAmount; + pFinance->uiIdNumber = uiId; + pFinance->iBalanceToDate = iBalanceToDate; + pFinanceListHead = pFinance; + } + pCurrentFinance = pFinanceListHead; + + return uiId; +} + +void CreateFinanceButtons( void ) +{ + giFinanceButtonImage[PREV_PAGE_BUTTON] = LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); + giFinanceButton[PREV_PAGE_BUTTON] = QuickCreateButton( giFinanceButtonImage[PREV_PAGE_BUTTON], PREV_BTN_X, BTN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnFinanceDisplayPrevPageCallBack); + + + giFinanceButtonImage[NEXT_PAGE_BUTTON]= UseLoadedButtonImage( giFinanceButtonImage[PREV_PAGE_BUTTON] ,-1,6,-1,7,-1 ); + giFinanceButton[NEXT_PAGE_BUTTON] = QuickCreateButton( giFinanceButtonImage[NEXT_PAGE_BUTTON], NEXT_BTN_X, BTN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnFinanceDisplayNextPageCallBack); + + + //button to go to the first page + giFinanceButtonImage[FIRST_PAGE_BUTTON]= UseLoadedButtonImage( giFinanceButtonImage[PREV_PAGE_BUTTON], -1,3,-1,4,-1 ); + giFinanceButton[FIRST_PAGE_BUTTON] = QuickCreateButton( giFinanceButtonImage[FIRST_PAGE_BUTTON], FIRST_PAGE_X, BTN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnFinanceFirstLastPageCallBack); + + MSYS_SetBtnUserData( giFinanceButton[FIRST_PAGE_BUTTON], 0, 0 ); + + //button to go to the last page + giFinanceButtonImage[LAST_PAGE_BUTTON]= UseLoadedButtonImage( giFinanceButtonImage[PREV_PAGE_BUTTON], -1,9,-1,10,-1 ); + giFinanceButton[LAST_PAGE_BUTTON] = QuickCreateButton( giFinanceButtonImage[LAST_PAGE_BUTTON], LAST_PAGE_X, BTN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnFinanceFirstLastPageCallBack); + MSYS_SetBtnUserData( giFinanceButton[LAST_PAGE_BUTTON], 0, 1 ); + + + + + SetButtonCursor(giFinanceButton[0], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giFinanceButton[1], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giFinanceButton[2], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giFinanceButton[3], CURSOR_LAPTOP_SCREEN); + return; +} + + +void DestroyFinanceButtons( void ) +{ + UINT32 uiCnt; + + for( uiCnt=0; uiCnt<4; uiCnt++ ) + { + RemoveButton( giFinanceButton[ uiCnt ] ); + UnloadButtonImage( giFinanceButtonImage[ uiCnt ] ); + } +} +void BtnFinanceDisplayPrevPageCallBack(GUI_BUTTON *btn,INT32 reason) +{ + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + // if greater than page zero, we can move back, decrement iCurrentPage counter + LoadPreviousPage( ); + pCurrentFinance=pFinanceListHead; + + // set button state + SetFinanceButtonStates( ); + fReDrawScreenFlag=TRUE; + } + +} + +void BtnFinanceDisplayNextPageCallBack(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // increment currentPage + //IncrementCurrentPageFinancialDisplay( ); + LoadNextPage( ); + + // set button state + SetFinanceButtonStates( ); + + pCurrentFinance=pFinanceListHead; + // redraw screen + fReDrawScreenFlag=TRUE; + } +} + +void BtnFinanceFirstLastPageCallBack(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + UINT32 uiButton = MSYS_GetBtnUserData( btn, 0 ); + + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + //if its the first page button + if( uiButton == 0 ) + { + iCurrentPage = 0; + LoadInRecords( iCurrentPage ); + } + + //else its the last page button + else + { + LoadInRecords( guiLastPageInRecordsList + 1 ); + + iCurrentPage = guiLastPageInRecordsList + 1; + } + + // set button state + SetFinanceButtonStates( ); + + pCurrentFinance=pFinanceListHead; + // redraw screen + fReDrawScreenFlag=TRUE; + } +} + + +void IncrementCurrentPageFinancialDisplay( void ) +{ + // run through list, from pCurrentFinance, to NUM_RECORDS_PER_PAGE +1 FinancialUnits + FinanceUnitPtr pTempFinance=pCurrentFinance; + BOOLEAN fOkToIncrementPage=FALSE; + INT32 iCounter=0; + + // on the overview page, simply set iCurrent to head of list, and page to 1 + if(iCurrentPage==0) + { + + pCurrentFinance=pFinanceListHead; + iCurrentPage=1; + + return; + } + + // no list, we are on page 2 + if( pTempFinance == NULL ) + { + iCurrentPage = 2; + return; + } + + // haven't reached end of list and not yet at beginning of next page + while( ( pTempFinance )&&( ! fOkToIncrementPage ) ) + { + // found the next page, first record thereof + if(iCounter==NUM_RECORDS_PER_PAGE+1) + { + fOkToIncrementPage=TRUE; + pCurrentFinance=pTempFinance->Next; + } + + //next record + pTempFinance=pTempFinance->Next; + iCounter++; + } + + // if ok to increment, increment + if(fOkToIncrementPage) + { + iCurrentPage++; + + } + + return; +} + +void ProcessTransactionString(STR16 pString, FinanceUnitPtr pFinance) +{ + + switch( pFinance->ubCode) + { + case ACCRUED_INTEREST: + swprintf(pString, L"%s", pTransactionText[ACCRUED_INTEREST]); + break; + + case ANONYMOUS_DEPOSIT: + swprintf(pString, L"%s", pTransactionText[ANONYMOUS_DEPOSIT]); + break; + + case TRANSACTION_FEE: + swprintf(pString, L"%s", pTransactionText[TRANSACTION_FEE]); + break; + + case HIRED_MERC: + swprintf(pString, pMessageStrings[ MSG_HIRED_MERC ], gMercProfiles[pFinance->ubSecondCode].zNickname ); + break; + + case BOBBYR_PURCHASE: + swprintf(pString, L"%s", pTransactionText[ BOBBYR_PURCHASE ]); + break; + + case PAY_SPECK_FOR_MERC: + swprintf(pString, L"%s", pTransactionText[ PAY_SPECK_FOR_MERC ], gMercProfiles[pFinance->ubSecondCode].zName); + break; + + case MEDICAL_DEPOSIT: + swprintf(pString, pTransactionText[ MEDICAL_DEPOSIT ] , gMercProfiles[pFinance->ubSecondCode].zNickname); + break; + + case IMP_PROFILE: + swprintf(pString, L"%s", pTransactionText[ IMP_PROFILE ] ); + break; + + case PURCHASED_INSURANCE: + swprintf(pString, pTransactionText[ PURCHASED_INSURANCE ], gMercProfiles[pFinance->ubSecondCode].zNickname ); + break; + + case REDUCED_INSURANCE: + swprintf(pString, pTransactionText[ REDUCED_INSURANCE ], gMercProfiles[pFinance->ubSecondCode].zNickname ); + break; + + case EXTENDED_INSURANCE: + swprintf(pString, pTransactionText[ EXTENDED_INSURANCE ], gMercProfiles[pFinance->ubSecondCode].zNickname ); + break; + + case CANCELLED_INSURANCE: + swprintf(pString, pTransactionText[ CANCELLED_INSURANCE ], gMercProfiles[pFinance->ubSecondCode].zNickname ); + break; + + case INSURANCE_PAYOUT: + swprintf(pString, pTransactionText[ INSURANCE_PAYOUT ], gMercProfiles[pFinance->ubSecondCode].zNickname); + break; + + case EXTENDED_CONTRACT_BY_1_DAY: + swprintf(pString, pTransactionAlternateText[ 1 ], gMercProfiles[pFinance->ubSecondCode].zNickname ); + break; + + case EXTENDED_CONTRACT_BY_1_WEEK: + swprintf(pString, pTransactionAlternateText[ 2 ], gMercProfiles[pFinance->ubSecondCode].zNickname ); + break; + + case EXTENDED_CONTRACT_BY_2_WEEKS: + swprintf(pString, pTransactionAlternateText[ 3 ], gMercProfiles[pFinance->ubSecondCode].zNickname ); + break; + + case DEPOSIT_FROM_GOLD_MINE: + case DEPOSIT_FROM_SILVER_MINE: + swprintf( pString, pTransactionText[ 16 ] ); + break; + + case PURCHASED_FLOWERS: + swprintf(pString, L"%s", pTransactionText[ PURCHASED_FLOWERS ] ); + break; + + case FULL_MEDICAL_REFUND: + swprintf(pString, pTransactionText[ FULL_MEDICAL_REFUND ], gMercProfiles[pFinance->ubSecondCode].zNickname); + break; + + case PARTIAL_MEDICAL_REFUND: + swprintf(pString, pTransactionText[ PARTIAL_MEDICAL_REFUND ], gMercProfiles[pFinance->ubSecondCode].zNickname); + break; + + case NO_MEDICAL_REFUND: + swprintf(pString, pTransactionText[ NO_MEDICAL_REFUND ], gMercProfiles[pFinance->ubSecondCode].zNickname); + break; + + case TRANSFER_FUNDS_TO_MERC: + swprintf(pString,pTransactionText[ TRANSFER_FUNDS_TO_MERC ], gMercProfiles[pFinance->ubSecondCode].zNickname); + break; + case TRANSFER_FUNDS_FROM_MERC: + swprintf(pString, pTransactionText[ TRANSFER_FUNDS_FROM_MERC ], gMercProfiles[pFinance->ubSecondCode].zNickname); + break; + case PAYMENT_TO_NPC: + swprintf(pString, pTransactionText[ PAYMENT_TO_NPC ], gMercProfiles[ pFinance->ubSecondCode ].zNickname ); + break; + case( TRAIN_TOWN_MILITIA ): + { + UINT16 str[ 128 ]; + UINT8 ubSectorX; + UINT8 ubSectorY; + ubSectorX = (UINT8)SECTORX( pFinance->ubSecondCode ); + ubSectorY = (UINT8)SECTORY( pFinance->ubSecondCode ); + GetSectorIDString( ubSectorX, ubSectorY, 0, str, TRUE ); + swprintf(pString, pTransactionText[ TRAIN_TOWN_MILITIA ], str ); + } + break; + + case( SOLD_ITEMS ): + swprintf(pString, L"%s", pTransactionText[ SOLD_ITEMS ] ); + break; + + case( PURCHASED_ITEM_FROM_DEALER ): + swprintf(pString, pTransactionText[ PURCHASED_ITEM_FROM_DEALER ], gMercProfiles[ pFinance->ubSecondCode ].zNickname ); + break; + + case( MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT ): + swprintf(pString, pTransactionText[ MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT ], gMercProfiles[ pFinance->ubSecondCode ].zNickname ); + break; + + } + + +} + + +void DisplayFinancePageNumberAndDateRange( void ) +{ + // this function will go through the list of 'histories' starting at current until end or + // MAX_PER_PAGE...it will get the date range and the page number + INT32 iLastPage=0; + INT32 iCounter=0; + UINT32 uiLastDate; + FinanceUnitPtr pTempFinance=pFinanceListHead; + wchar_t sString[50]; + + + // setup the font stuff + SetFont(FINANCE_TEXT_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + if( !pCurrentFinance ) + { + pCurrentFinance = pFinanceListHead; + if( !pCurrentFinance ) + { + swprintf( sString, L"%s %d / %d",pFinanceHeaders[5], iCurrentPage + 1 , guiLastPageInRecordsList + 2 ); + mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString ); + return; + } + } + + uiLastDate=pCurrentFinance->uiDate; + // find last page + while(pTempFinance) + { + iCounter++; + pTempFinance=pTempFinance->Next; + } + + // get the last page + + swprintf( sString, L"%s %d / %d",pFinanceHeaders[5], iCurrentPage + 1 , guiLastPageInRecordsList + 2 ); + mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString ); + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); +} + + +BOOLEAN WriteBalanceToDisk( void ) +{ + // will write the current balance to disk + HWFILE hFileHandle; + INT32 iBytesWritten=0; + FinanceUnitPtr pFinanceList=pFinanceListHead; + + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE, FILE_ACCESS_WRITE|FILE_CREATE_ALWAYS, FALSE); + + // write balance to disk + FileWrite( hFileHandle, &(LaptopSaveInfo.iCurrentBalance), sizeof ( INT32 ), NULL ); + + // close file + FileClose( hFileHandle ); + + + return( TRUE ); +} + +void GetBalanceFromDisk( void ) +{ + // will grab the current blanace from disk + // assuming file already openned + // this procedure will open and read in data to the finance list + HWFILE hFileHandle; + INT32 iBytesRead=0; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + LaptopSaveInfo.iCurrentBalance = 0; + // close file + FileClose( hFileHandle ); + return; + } + + // start at beginning + FileSeek( hFileHandle, 0, FILE_SEEK_FROM_START); + + // get balance from disk first + FileRead( hFileHandle, &(LaptopSaveInfo.iCurrentBalance), sizeof ( INT32 ), (UINT32 *)&iBytesRead ); + + AssertMsg( iBytesRead, "Failed To Read Data Entry"); + + // close file + FileClose( hFileHandle ); + + return; +} + + +BOOLEAN AppendFinanceToEndOfFile( FinanceUnitPtr pFinance ) +{ + // will write the current finance to disk + HWFILE hFileHandle; + INT32 iBytesWritten=0; + FinanceUnitPtr pFinanceList=pFinanceListHead; + + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE, FILE_ACCESS_WRITE|FILE_OPEN_ALWAYS, FALSE); + + // if no file exits, do nothing + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return ( FALSE ); + } + + // go to the end + if( FileSeek( hFileHandle,0,FILE_SEEK_FROM_END ) == FALSE ) + { + // error + FileClose( hFileHandle ); + return( FALSE ); + } + + + // write finance to disk + // now write date and amount, and code + FileWrite( hFileHandle, &(pFinanceList->ubCode), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pFinanceList->ubSecondCode), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pFinanceList->uiDate), sizeof ( UINT32 ), NULL ); + FileWrite( hFileHandle, &(pFinanceList->iAmount), sizeof ( INT32 ), NULL ); + FileWrite( hFileHandle, &(pFinanceList->iBalanceToDate), sizeof ( INT32 ), NULL ); + + // close file + FileClose( hFileHandle ); + + return( TRUE ); +} + +UINT32 ReadInLastElementOfFinanceListAndReturnIdNumber( void ) +{ + // this function will read in the last unit in the finance list, to grab it's id number + + + HWFILE hFileHandle; + INT32 iBytesRead=0; + INT32 iFileSize = 0; + + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return 0; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return 0; + } + + // make sure file is more than balance size + length of 1 record - 1 byte + if ( FileGetSize( hFileHandle ) < sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ) ) + { + FileClose( hFileHandle ); + return 0; + } + + // size is? + iFileSize = FileGetSize( hFileHandle ); + + // done with file, close it + FileClose( hFileHandle ); + + // file size -1 / sizeof record in bytes is id + return ( ( iFileSize - 1 ) / ( sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 )) ); + +} + +void SetLastPageInRecords( void ) +{ + // grabs the size of the file and interprets number of pages it will take up + HWFILE hFileHandle; + INT32 iBytesRead=0; + + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + LaptopSaveInfo.iCurrentBalance = 0; + + return; + } + + // make sure file is more than 0 length + if ( FileGetSize( hFileHandle ) == 0 ) + { + FileClose( hFileHandle ); + guiLastPageInRecordsList = 1; + return; + } + + + // done with file, close it + FileClose( hFileHandle ); + + guiLastPageInRecordsList = ( ReadInLastElementOfFinanceListAndReturnIdNumber( ) - 1 )/ NUM_RECORDS_PER_PAGE; + + return; +} + + +BOOLEAN LoadPreviousPage( void ) +{ + + // clear out old list of records, and load in previous page worth of records + ClearFinanceList( ); + + // load previous page + if( ( iCurrentPage == 1 )||( iCurrentPage == 0 ) ) + { + iCurrentPage = 0; + return ( FALSE ); + } + + // now load in previous page's records, if we can + if ( LoadInRecords( iCurrentPage - 1 ) ) + { + iCurrentPage--; + return ( TRUE ); + } + else + { + LoadInRecords( iCurrentPage ); + return ( FALSE ); + } +} + +BOOLEAN LoadNextPage( void ) +{ + + // clear out old list of records, and load in previous page worth of records + ClearFinanceList( ); + + + + // now load in previous page's records, if we can + if ( LoadInRecords( iCurrentPage + 1 ) ) + { + iCurrentPage++; + return ( TRUE ); + } + else + { + LoadInRecords( iCurrentPage ); + return ( FALSE ); + } + +} + +BOOLEAN LoadInRecords( UINT32 uiPage ) +{ + // loads in records belogning, to page uiPage + // no file, return + BOOLEAN fOkToContinue=TRUE; + INT32 iCount =0; + HWFILE hFileHandle; + UINT8 ubCode, ubSecondCode; + INT32 iBalanceToDate; + UINT32 uiDate; + INT32 iAmount; + INT32 iBytesRead=0; + UINT32 uiByteCount=0; + + // check if bad page + if( uiPage == 0 ) + { + return ( FALSE ); + } + + + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return( FALSE ); + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return( FALSE ); + } + + // make sure file is more than 0 length + if ( FileGetSize( hFileHandle ) == 0 ) + { + FileClose( hFileHandle ); + return( FALSE ); + } + + // is the file long enough? + if( ( FileGetSize( hFileHandle ) - sizeof( INT32 ) - 1) / ( NUM_RECORDS_PER_PAGE * ( sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 )) ) + 1 < uiPage ) + { + // nope + FileClose( hFileHandle ); + return( FALSE ); + } + + FileSeek( hFileHandle, sizeof( INT32 ) + ( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * ( sizeof( INT32 )+ sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32)), FILE_SEEK_FROM_START ); + + uiByteCount = sizeof( INT32 )+( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * ( sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ) ); + // file exists, read in data, continue until end of page + while( ( iCount < NUM_RECORDS_PER_PAGE )&&( fOkToContinue ) &&( uiByteCount < FileGetSize( hFileHandle ) ) ) + { + + // read in data + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + + AssertMsg( iBytesRead, "Failed To Read Data Entry"); + + // add transaction + ProcessAndEnterAFinacialRecord(ubCode, uiDate, iAmount, ubSecondCode, iBalanceToDate); + + // increment byte counter + uiByteCount += sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ); + + // we've overextended our welcome, and bypassed end of file, get out + if( uiByteCount >= FileGetSize( hFileHandle ) ) + { + // not ok to continue + fOkToContinue = FALSE; + } + + iCount++; + } + + // close file + FileClose( hFileHandle ); + + // check to see if we in fact have a list to display + if( pFinanceListHead == NULL ) + { + // got no records, return false + return( FALSE ); + } + + // set up current finance + pCurrentFinance = pFinanceListHead; + + return( TRUE ); +} + +template void InsertCommasForDollarFigure(short *); +template +void InsertCommasForDollarFigure( string1 pString ) +{ + INT16 sCounter =0; + INT16 sZeroCount =0; + INT16 sTempCounter = 0; + INT16 sEndPosition = 0; + + // go to end of dollar figure + while( pString[ sCounter ] != 0 ) + { + sCounter++; + } + + // negative? + if( pString[0] == '-' ) + { + // stop one slot in advance of normal + sEndPosition = 1; + } + + // is there under $1,000? + if( sCounter < 4 ) + { + // can't do anything, return + return; + } + + // at end, start backing up until beginning + while( sCounter > sEndPosition ) + { + + + // enough for a comma? + if( sZeroCount==3 ) + { + // reset count + sZeroCount =0; + // set tempcounter to current counter + sTempCounter = sCounter; + + // run until end + while( pString[ sTempCounter ] != 0 ) + { + sTempCounter++; + } + // now shift everything over ot the right one place until sTempCounter = sCounter + while( sTempCounter >= sCounter ) + { + pString[ sTempCounter+1 ] = pString[ sTempCounter ]; + sTempCounter--; + } + // now insert comma + pString[ sCounter ]=L','; + } + + // increment count of digits + sZeroCount++; + + // decrement counter + sCounter--; + } + + return; + +} + +template void InsertDollarSignInToString(short *); +template +void InsertDollarSignInToString( string1 pString ) +{ + // run to end of string, copy everything in string 2 places right, insert a space at pString[ 1 ] and a L'$' at pString[ 0 ] + + INT32 iCounter =0; + + // run to end of string + while( pString[ iCounter ] != 0 ) + { + iCounter++; + } + + // now copy over + while( iCounter >= 0 ) + { + pString[ iCounter + 1] = pString[ iCounter ]; + iCounter--; + } + + pString[ 0 ] = L'$'; + + return; +} + +INT32 GetPreviousBalanceToDate( void ) +{ + + // will grab balance to date of previous record + // grabs the size of the file and interprets number of pages it will take up + HWFILE hFileHandle; + INT32 iBytesRead=0; + INT32 iBalanceToDate=0; + + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return 0; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return 0; + } + + if ( FileGetSize( hFileHandle ) < sizeof( INT32 ) + sizeof( UINT32 ) + sizeof( UINT8 )+ sizeof(UINT8) + sizeof( INT32 ) ) + { + FileClose( hFileHandle ); + return 0; + } + + FileSeek( hFileHandle, ( sizeof( INT32 ) ) , FILE_SEEK_FROM_END ); + + // get balnce to date + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + + FileClose( hFileHandle ); + + return iBalanceToDate; +} + + +INT32 GetPreviousDaysBalance( void ) +{ + // find out what today is, then go back 2 days, get balance for that day + INT32 iPreviousDaysBalance = 0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; + BOOLEAN fOkToContinue = FALSE; + UINT32 iByteCount = 0; + INT32 iCounter =1; + UINT8 ubCode; + UINT8 ubSecondCode; + UINT32 uiDate; + INT32 iAmount; + INT32 iBalanceToDate; + BOOLEAN fGoneTooFar= FALSE; + INT32 iFileSize = 0; + + // what day is it? + iDateInMinutes = GetWorldTotalMin( ) - ( 60 * 24 ); + + // error checking + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return 0; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return 0; + } + + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+= sizeof( INT32 ); + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) && ( ! fGoneTooFar ) ) + { + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + + // check to see if we are far enough + if( ( uiDate / ( 24 * 60 ) ) == ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) + { + fOkToContinue = TRUE; + } + + if( iDateInMinutes / ( 24 * 60 ) >= 2 ) + { + // there are no entries for the previous day + if( ( uiDate / ( 24 * 60 ) ) < ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) + { + fGoneTooFar = TRUE; + + } + } + else + { + fGoneTooFar = TRUE; + } + iCounter++; + } + + if( fOkToContinue == FALSE ) + { + // reached beginning of file, nothing found, return 0 + // close file + FileClose( hFileHandle ); + return 0; + } + + FileClose( hFileHandle ); + + // reached 3 days ago, or beginning of file + return iBalanceToDate; + +} + + + +INT32 GetTodaysBalance( void ) +{ + // find out what today is, then go back 2 days, get balance for that day + INT32 iPreviousDaysBalance = 0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; + BOOLEAN fOkToContinue = FALSE; + UINT32 iByteCount = 0; + INT32 iCounter = 1; + UINT8 ubCode; + UINT8 ubSecondCode; + UINT32 uiDate; + INT32 iAmount; + INT32 iBalanceToDate; + BOOLEAN fGoneTooFar= FALSE; + + + + // what day is it? + iDateInMinutes = GetWorldTotalMin( ); + + // error checking + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return 0; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return 0; + } + + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+= sizeof( INT32 ); + + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) && ( ! fGoneTooFar ) ) + { + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + + AssertMsg( iBytesRead, "Failed To Read Data Entry"); + // check to see if we are far enough + if( ( uiDate / ( 24 * 60 ) ) == ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) + { + fOkToContinue = TRUE; + } + + iCounter++; + } + + + FileClose( hFileHandle ); + + // not found ? + if( fOkToContinue == FALSE ) + { + iBalanceToDate = 0; + } + + // reached 3 days ago, or beginning of file + return iBalanceToDate; +} + + + +INT32 GetPreviousDaysIncome( void ) +{ + // will return the income from the previous day + // which is todays starting balance - yesterdays starting balance + INT32 iPreviousDaysBalance = 0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; + BOOLEAN fOkToContinue = FALSE; + BOOLEAN fOkToIncrement = FALSE; + UINT32 iByteCount = 0; + INT32 iCounter = 1; + UINT8 ubCode; + UINT8 ubSecondCode; + UINT32 uiDate; + INT32 iAmount; + INT32 iBalanceToDate; + BOOLEAN fGoneTooFar = FALSE; + INT32 iTotalPreviousIncome = 0; + + // what day is it? + iDateInMinutes = GetWorldTotalMin( ); + + // error checking + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return 0; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return 0; + } + + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+= sizeof( INT32 ); + + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) &&( !fGoneTooFar ) ) + { + FileGetPos( hFileHandle ); + + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + + FileGetPos( hFileHandle ); + + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + + AssertMsg( iBytesRead, "Failed To Read Data Entry"); + // check to see if we are far enough + if( ( uiDate / ( 24 * 60 ) )== ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) + { + fOkToContinue = TRUE; + } + + // there are no entries for the previous day + if( ( uiDate / ( 24 * 60 ) ) < ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) + { + fGoneTooFar = TRUE; + + } + + if( ( uiDate / ( 24 * 60 ) ) == ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) + { + // now ok to increment amount + fOkToIncrement = TRUE; + } + + if( ( fOkToIncrement ) && ( ( ubCode == DEPOSIT_FROM_GOLD_MINE ) || ( ubCode == DEPOSIT_FROM_SILVER_MINE) ) ) + { + // increment total + iTotalPreviousIncome += iAmount; + } + + iCounter++; + } + + + // now run back one more day and add up the total of deposits + + // close file + FileClose( hFileHandle ); + + return( iTotalPreviousIncome ); + +} + + +INT32 GetTodaysDaysIncome( void ) +{ + // will return the income from the previous day + // which is todays starting balance - yesterdays starting balance + INT32 iPreviousDaysBalance = 0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; + BOOLEAN fOkToContinue = FALSE; + BOOLEAN fOkToIncrement = FALSE; + UINT32 iByteCount = 0; + INT32 iCounter = 1; + UINT8 ubCode; + UINT8 ubSecondCode; + UINT32 uiDate; + INT32 iAmount; + INT32 iBalanceToDate; + BOOLEAN fGoneTooFar = FALSE; + INT32 iTotalIncome = 0; + + // what day is it? + iDateInMinutes = GetWorldTotalMin( ); + + // error checking + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return 0; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return 0; + } + + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+=sizeof( INT32 ); + + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) &&( !fGoneTooFar ) ) + { + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + + AssertMsg( iBytesRead, "Failed To Read Data Entry"); + // check to see if we are far enough + if( ( uiDate / ( 24 * 60 ) ) == ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) + { + fOkToContinue = TRUE; + } + + if( ( uiDate / ( 24 * 60 ) ) > ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) + { + // now ok to increment amount + fOkToIncrement = TRUE; + } + + if( ( fOkToIncrement ) && ( ( ubCode == DEPOSIT_FROM_GOLD_MINE ) || ( ubCode == DEPOSIT_FROM_SILVER_MINE) ) ) + { + // increment total + iTotalIncome += iAmount; + fOkToIncrement = FALSE; + } + + iCounter++; + } + + // no entries, return nothing - no income for the day + if( fGoneTooFar == TRUE ) + { + FileClose( hFileHandle ); + return 0; + } + + // now run back one more day and add up the total of deposits + + // close file + FileClose( hFileHandle ); + + return( iTotalIncome ); + +} + +void SetFinanceButtonStates( void ) +{ + // this function will look at what page we are viewing, enable and disable buttons as needed + + if( iCurrentPage == 0 ) + { + // first page, disable left buttons + DisableButton( giFinanceButton[PREV_PAGE_BUTTON] ); + DisableButton( giFinanceButton[FIRST_PAGE_BUTTON] ); + } + else + { + // enable buttons + EnableButton( giFinanceButton[PREV_PAGE_BUTTON] ); + EnableButton( giFinanceButton[FIRST_PAGE_BUTTON] ); + } + + if( LoadNextPage( ) ) + { + // decrement page + LoadPreviousPage( ); + + + // enable buttons + EnableButton( giFinanceButton[ NEXT_PAGE_BUTTON ] ); + EnableButton( giFinanceButton[ LAST_PAGE_BUTTON ] ); + + } + else + { + DisableButton( giFinanceButton[ NEXT_PAGE_BUTTON ] ); + DisableButton( giFinanceButton[ LAST_PAGE_BUTTON ] ); + } +} + + +INT32 GetTodaysOtherDeposits( void ) +{ + // grab todays other deposits + + INT32 iPreviousDaysBalance = 0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; + BOOLEAN fOkToContinue = FALSE; + BOOLEAN fOkToIncrement = FALSE; + UINT32 iByteCount = 0; + INT32 iCounter = 1; + UINT8 ubCode; + UINT8 ubSecondCode; + UINT32 uiDate; + INT32 iAmount; + INT32 iBalanceToDate; + BOOLEAN fGoneTooFar = FALSE; + INT32 iTotalIncome = 0; + + // what day is it? + iDateInMinutes = GetWorldTotalMin( ); + + // error checking + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return 0; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return 0; + } + + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+= sizeof( INT32 ); + + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) &&( !fGoneTooFar ) ) + { + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + + AssertMsg( iBytesRead, "Failed To Read Data Entry"); + // check to see if we are far enough + if( ( uiDate / ( 24 * 60 ) ) == ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) + { + fOkToContinue = TRUE; + } + + if( ( uiDate / ( 24 * 60 ) ) > ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) + { + // now ok to increment amount + fOkToIncrement = TRUE; + } + + if( ( fOkToIncrement ) && ( ( ubCode != DEPOSIT_FROM_GOLD_MINE ) && ( ubCode != DEPOSIT_FROM_SILVER_MINE) ) ) + { + if( iAmount > 0 ) + { + // increment total + iTotalIncome += iAmount; + fOkToIncrement = FALSE; + } + } + + iCounter++; + } + + // no entries, return nothing - no income for the day + if( fGoneTooFar == TRUE ) + { + FileClose( hFileHandle ); + return 0; + } + + // now run back one more day and add up the total of deposits + + // close file + FileClose( hFileHandle ); + + return( iTotalIncome ); +} + + +INT32 GetYesterdaysOtherDeposits( void ) +{ + + INT32 iPreviousDaysBalance = 0; + HWFILE hFileHandle; + INT32 iBytesRead=0; + UINT32 iDateInMinutes = 0; + BOOLEAN fOkToContinue = FALSE; + BOOLEAN fOkToIncrement = FALSE; + UINT32 iByteCount = 0; + INT32 iCounter = 1; + UINT8 ubCode; + UINT8 ubSecondCode; + UINT32 uiDate; + INT32 iAmount; + INT32 iBalanceToDate; + BOOLEAN fGoneTooFar = FALSE; + INT32 iTotalPreviousIncome = 0; + + // what day is it? + iDateInMinutes = GetWorldTotalMin( ); + + // error checking + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + return 0; + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + // close file + FileClose( hFileHandle ); + + return 0; + } + + // start at the end, move back until Date / 24 * 60 on the record is = ( iDateInMinutes / ( 24 * 60 ) ) - 2 + iByteCount+= sizeof( INT32 ); + + // loop, make sure we don't pass beginning of file, if so, we have an error, and check for condifition above + while( ( iByteCount < FileGetSize( hFileHandle ) ) && ( ! fOkToContinue ) &&( !fGoneTooFar ) ) + { + FileSeek( hFileHandle, RECORD_SIZE * iCounter , FILE_SEEK_FROM_END ); + + // incrment byte count + iByteCount += RECORD_SIZE; + + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iAmount, sizeof(INT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &iBalanceToDate, sizeof(INT32), (UINT32 *)&iBytesRead ); + + AssertMsg( iBytesRead, "Failed To Read Data Entry"); + // check to see if we are far enough + if( ( uiDate / ( 24 * 60 ) )== ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) + { + fOkToContinue = TRUE; + } + + // there are no entries for the previous day + if( ( uiDate / ( 24 * 60 ) ) < ( iDateInMinutes / ( 24 * 60 ) ) - 2 ) + { + fGoneTooFar = TRUE; + + } + + if( ( uiDate / ( 24 * 60 ) ) == ( iDateInMinutes / ( 24 * 60 ) ) - 1 ) + { + // now ok to increment amount + fOkToIncrement = TRUE; + } + + if( ( fOkToIncrement ) && ( ( ubCode != DEPOSIT_FROM_GOLD_MINE ) && ( ubCode != DEPOSIT_FROM_SILVER_MINE) ) ) + { + if( iAmount > 0 ) + { + // increment total + iTotalPreviousIncome += iAmount; + } + } + + iCounter++; + } + + // close file + FileClose( hFileHandle ); + + return( iTotalPreviousIncome ); +} + + +INT32 GetTodaysDebits( void ) +{ + // return the expenses for today + + // currentbalance - todays balance - Todays income - other deposits + + return( GetCurrentBalance( ) - GetTodaysBalance( ) - GetTodaysDaysIncome( ) - GetTodaysOtherDeposits( ) ); +} + +INT32 GetYesterdaysDebits( void ) +{ + // return the expenses for yesterday + + return( GetTodaysBalance( ) - GetPreviousDaysBalance( ) - GetPreviousDaysIncome( ) - GetYesterdaysOtherDeposits( ) ); +} + + +void LoadCurrentBalance( void ) +{ + // will load the current balance from finances.dat file + HWFILE hFileHandle; + INT32 iBytesRead=0; + + // is the first record in the file + // error checking + // no file, return + if ( ! (FileExists( FINANCES_DATA_FILE ) ) ) + { + LaptopSaveInfo.iCurrentBalance= 0; + return; + } + + // open file + hFileHandle=FileOpen( FINANCES_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + LaptopSaveInfo.iCurrentBalance= 0; + + // close file + FileClose( hFileHandle ); + + return; + } + + FileSeek( hFileHandle, 0 , FILE_SEEK_FROM_START ); + FileRead( hFileHandle, &LaptopSaveInfo.iCurrentBalance, sizeof( INT32 ), (UINT32 *)&iBytesRead ); + + AssertMsg( iBytesRead, "Failed To Read Data Entry"); + // close file + FileClose( hFileHandle ); + + + return; +} + + + + + + diff --git a/Laptop/finances.h b/Laptop/finances.h new file mode 100644 index 00000000..29246b9f --- /dev/null +++ b/Laptop/finances.h @@ -0,0 +1,76 @@ +#ifndef __FINANCES_H +#define __FINANCES_H + +void GameInitFinances(); +void EnterFinances(); +void ExitFinances(); +void HandleFinances(); +void RenderFinances(); + +#define FINANCES_DATA_FILE "TEMP\\finances.dat" + +// the financial structure +struct finance{ + UINT8 ubCode; // the code index in the finance code table + UINT32 uiIdNumber; // unique id number + UINT8 ubSecondCode; // secondary code + UINT32 uiDate; // time in the world in global time + INT32 iAmount; // the amount of the transaction + INT32 iBalanceToDate; + struct finance *Next; // next unit in the list +}; + +enum +{ + ACCRUED_INTEREST, + ANONYMOUS_DEPOSIT, + TRANSACTION_FEE, + HIRED_MERC, + BOBBYR_PURCHASE, + PAY_SPECK_FOR_MERC, + MEDICAL_DEPOSIT, + IMP_PROFILE, + PURCHASED_INSURANCE, + REDUCED_INSURANCE, + EXTENDED_INSURANCE, + CANCELLED_INSURANCE, + INSURANCE_PAYOUT, + EXTENDED_CONTRACT_BY_1_DAY, + EXTENDED_CONTRACT_BY_1_WEEK, + EXTENDED_CONTRACT_BY_2_WEEKS, + DEPOSIT_FROM_GOLD_MINE, + DEPOSIT_FROM_SILVER_MINE, + PURCHASED_FLOWERS, + FULL_MEDICAL_REFUND, + PARTIAL_MEDICAL_REFUND, + NO_MEDICAL_REFUND, + PAYMENT_TO_NPC, + TRANSFER_FUNDS_TO_MERC, + TRANSFER_FUNDS_FROM_MERC, + TRAIN_TOWN_MILITIA, + PURCHASED_ITEM_FROM_DEALER, + MERC_DEPOSITED_MONEY_TO_PLAYER_ACCOUNT, + SOLD_ITEMS +}; + + +typedef struct finance FinanceUnit; +typedef struct finance *FinanceUnitPtr; + +extern FinanceUnitPtr pFinanceListHead; +//extern INT32 iCurrentBalance; +UINT32 AddTransactionToPlayersBook(UINT8 ubCode, UINT8 ubSecondCode, UINT32 uiDate, INT32 iAmount); +template +void InsertDollarSignInToString( string1 pString ); +template +void InsertCommasForDollarFigure( string1 pString ); +INT32 GetTodaysDaysIncome( void ); +INT32 GetProjectedTotalDailyIncome( void ); + +#endif + + + + + + diff --git a/Laptop/florist Cards.cpp b/Laptop/florist Cards.cpp new file mode 100644 index 00000000..f9ce12d3 --- /dev/null +++ b/Laptop/florist Cards.cpp @@ -0,0 +1,226 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "florist.h" + #include "florist Cards.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Encrypted File.h" + #include "Florist Gallery.h" + #include "Text.h" +#endif + + + +#define FLORIST_CARDS_SENTENCE_FONT FONT12ARIAL +#define FLORIST_CARDS_SENTENCE_COLOR FONT_MCOLOR_WHITE + +#define FLORIST_CARD_FIRST_POS_X LAPTOP_SCREEN_UL_X + 7 +#define FLORIST_CARD_FIRST_POS_Y LAPTOP_SCREEN_WEB_UL_Y + 72 +#define FLORIST_CARD_FIRST_OFFSET_X 174 +#define FLORIST_CARD_FIRST_OFFSET_Y 109 + +#define FLORIST_CARD_CARD_WIDTH 135 +#define FLORIST_CARD_CARD_HEIGHT 100 + +#define FLORIST_CARD_TEXT_WIDTH 121 +#define FLORIST_CARD_TEXT_HEIGHT 90 + +#define FLORIST_CARD_TITLE_SENTENCE_X LAPTOP_SCREEN_UL_X +#define FLORIST_CARD_TITLE_SENTENCE_Y LAPTOP_SCREEN_WEB_UL_Y + 53 +#define FLORIST_CARD_TITLE_SENTENCE_WIDTH 613 - 111 + +#define FLORIST_CARD_BACK_BUTTON_X LAPTOP_SCREEN_UL_X + 8 +#define FLORIST_CARD_BACK_BUTTON_Y LAPTOP_SCREEN_WEB_UL_Y + 12 + +//#define FLORIST_CARD_ +//#define FLORIST_CARD_ +//#define FLORIST_CARD_ + +UINT32 guiCardBackground; + +INT8 gbCurrentlySelectedCard; + +//link to the card gallery +MOUSE_REGION gSelectedFloristCardsRegion[9]; +void SelectFloristCardsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + +INT32 guiFlowerCardsButtonImage; +void BtnFlowerCardsBackButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiFlowerCardsBackButton; + + + +void GameInitFloristCards() +{ + +} + +BOOLEAN EnterFloristCards() +{ + UINT16 i, j, usPosX, usPosY; + VOBJECT_DESC VObjectDesc; + UINT8 ubCount; + + InitFloristDefaults(); + + // load the Flower Account Box graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\CardBlank.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCardBackground)); + + ubCount = 0; + usPosY = FLORIST_CARD_FIRST_POS_Y; + for(j=0; j<3; j++) + { + usPosX = FLORIST_CARD_FIRST_POS_X; + for(i=0; i<3; i++) + { + MSYS_DefineRegion( &gSelectedFloristCardsRegion[ubCount], usPosX, usPosY, (UINT16)(usPosX + FLORIST_CARD_CARD_WIDTH), (UINT16)(usPosY + FLORIST_CARD_CARD_HEIGHT), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectFloristCardsRegionCallBack ); + MSYS_AddRegion(&gSelectedFloristCardsRegion[ubCount]); + MSYS_SetRegionUserData( &gSelectedFloristCardsRegion[ubCount], 0, ubCount ); + ubCount++; + usPosX += FLORIST_CARD_FIRST_OFFSET_X; + } + usPosY += FLORIST_CARD_FIRST_OFFSET_Y; + } + + + guiFlowerCardsButtonImage = LoadButtonImage("LAPTOP\\FloristButtons.sti", -1,0,-1,1,-1 ); + + guiFlowerCardsBackButton = CreateIconAndTextButton( guiFlowerCardsButtonImage, sFloristCards[FLORIST_CARDS_BACK], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLORIST_CARD_BACK_BUTTON_X, FLORIST_CARD_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFlowerCardsBackButtonCallback); + SetButtonCursor(guiFlowerCardsBackButton, CURSOR_WWW ); + + + //passing the currently selected card to -1, so it is not used + gbCurrentlySelectedCard = -1; + + RenderFloristCards(); + return(TRUE); +} + +void ExitFloristCards() +{ + UINT8 i; + + RemoveFloristDefaults(); + DeleteVideoObjectFromIndex( guiCardBackground ); + + //card gallery + for(i=0; i<9; i++) + MSYS_RemoveRegion( &gSelectedFloristCardsRegion[i]); + + UnloadButtonImage( guiFlowerCardsButtonImage ); + RemoveButton( guiFlowerCardsBackButton ); +} + +void HandleFloristCards() +{ + +} + +void RenderFloristCards() +{ + UINT8 i,j, ubCount; + UINT16 usPosX, usPosY; + wchar_t sTemp[ 640 ]; + UINT32 uiStartLoc=0; + HVOBJECT hPixHandle; + UINT16 usHeightOffset; + + DisplayFloristDefaults(); + + DrawTextToScreen( sFloristCards[FLORIST_CARDS_CLICK_SELECTION], FLORIST_CARD_TITLE_SENTENCE_X, FLORIST_CARD_TITLE_SENTENCE_Y, FLORIST_CARD_TITLE_SENTENCE_WIDTH, FONT10ARIAL, FLORIST_CARDS_SENTENCE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + GetVideoObject(&hPixHandle, guiCardBackground); + usPosY = FLORIST_CARD_FIRST_POS_Y; + ubCount = 0; + for(j=0; j<3; j++) + { + usPosX = FLORIST_CARD_FIRST_POS_X; + for(i=0; i<3; i++) + { + //The flowe account box + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, usPosX, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); + + //Get and display the card saying + uiStartLoc = FLOR_CARD_TEXT_TITLE_SIZE * ubCount; + LoadEncryptedDataFromFile(FLOR_CARD_TEXT_FILE, sTemp, uiStartLoc, FLOR_CARD_TEXT_TITLE_SIZE); + +// DisplayWrappedString((UINT16)(usPosX+7), (UINT16)(usPosY+15), FLORIST_CARD_TEXT_WIDTH, 2, FLORIST_CARDS_SENTENCE_FONT, FLORIST_CARDS_SENTENCE_COLOR, sTemp, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + usHeightOffset = IanWrappedStringHeight( (UINT16)(usPosX+7), (UINT16)(usPosY), FLORIST_CARD_TEXT_WIDTH, 2, + FLORIST_CARDS_SENTENCE_FONT, FLORIST_CARDS_SENTENCE_COLOR, sTemp, + 0, FALSE, 0); + + usHeightOffset = ( FLORIST_CARD_TEXT_HEIGHT - usHeightOffset ) / 2; + + + IanDisplayWrappedString( (UINT16)(usPosX+7), (UINT16)(usPosY+10+usHeightOffset), FLORIST_CARD_TEXT_WIDTH, 2, + FLORIST_CARDS_SENTENCE_FONT, FLORIST_CARDS_SENTENCE_COLOR, sTemp, + 0, FALSE, 0); + + ubCount++; + usPosX += FLORIST_CARD_FIRST_OFFSET_X; + } + usPosY += FLORIST_CARD_FIRST_OFFSET_Y; + } + + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + +void SelectFloristCardsRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + gbCurrentlySelectedCard = (UINT8) MSYS_GetRegionUserData( pRegion, 0 ); + + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_ORDERFORM; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + + +void BtnFlowerCardsBackButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_ORDERFORM; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} diff --git a/Laptop/florist Cards.h b/Laptop/florist Cards.h new file mode 100644 index 00000000..4a51c2dc --- /dev/null +++ b/Laptop/florist Cards.h @@ -0,0 +1,19 @@ +#ifndef __FLORIST_CARDS_H +#define __FLORIST_CARDS_H + + +#define FLOR_CARD_TEXT_FILE "BINARYDATA\\FlowerCard.edt" +#define FLOR_CARD_TEXT_TITLE_SIZE 5 * 80 * 2 + + + +void GameInitFloristCards(); +BOOLEAN EnterFloristCards(); +void ExitFloristCards(); +void HandleFloristCards(); +void RenderFloristCards(); + + +extern INT8 gbCurrentlySelectedCard; + +#endif \ No newline at end of file diff --git a/Laptop/florist Gallery.cpp b/Laptop/florist Gallery.cpp new file mode 100644 index 00000000..c06b1232 --- /dev/null +++ b/Laptop/florist Gallery.cpp @@ -0,0 +1,421 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "florist.h" + #include "florist Gallery.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "stdio.h" + #include "Encrypted File.h" + #include "Text.h" +#endif + + + + +#define FLOR_GALLERY_TITLE_FONT FONT10ARIAL +#define FLOR_GALLERY_TITLE_COLOR FONT_MCOLOR_WHITE + +#define FLOR_GALLERY_FLOWER_TITLE_FONT FONT14ARIAL +#define FLOR_GALLERY_FLOWER_TITLE_COLOR FONT_MCOLOR_WHITE + +#define FLOR_GALLERY_FLOWER_PRICE_FONT FONT12ARIAL +#define FLOR_GALLERY_FLOWER_PRICE_COLOR FONT_MCOLOR_WHITE + +#define FLOR_GALLERY_FLOWER_DESC_FONT FONT12ARIAL +#define FLOR_GALLERY_FLOWER_DESC_COLOR FONT_MCOLOR_WHITE + +#define FLOR_GALLERY_NUMBER_FLORAL_BUTTONS 3 +#define FLOR_GALLERY_NUMBER_FLORAL_IMAGES 10 + +#define FLOR_GALLERY_FLOWER_DESC_TEXT_FONT FONT12ARIAL +#define FLOR_GALLERY_FLOWER_DESC_TEXT_COLOR FONT_MCOLOR_WHITE + +#define FLOR_GALLERY_BACK_BUTTON_X LAPTOP_SCREEN_UL_X + 8 +#define FLOR_GALLERY_BACK_BUTTON_Y LAPTOP_SCREEN_WEB_UL_Y + 12 + +#define FLOR_GALLERY_NEXT_BUTTON_X LAPTOP_SCREEN_UL_X + 420 +#define FLOR_GALLERY_NEXT_BUTTON_Y FLOR_GALLERY_BACK_BUTTON_Y + +#define FLOR_GALLERY_FLOWER_BUTTON_X LAPTOP_SCREEN_UL_X + 7 +#define FLOR_GALLERY_FLOWER_BUTTON_Y LAPTOP_SCREEN_WEB_UL_Y + 74 + +#define FLOR_GALLERY_FLOWER_BUTTON_OFFSET_Y 112 + +#define FLOR_GALLERY_TITLE_TEXT_X LAPTOP_SCREEN_UL_X + 0 +#define FLOR_GALLERY_TITLE_TEXT_Y LAPTOP_SCREEN_WEB_UL_Y + 48 +#define FLOR_GALLERY_TITLE_TEXT_WIDTH 613 - 611 + +#define FLOR_GALLERY_FLOWER_TITLE_X FLOR_GALLERY_FLOWER_BUTTON_X + 88 + +#define FLOR_GALLERY_DESC_WIDTH 390 + +#define FLOR_GALLERY_FLOWER_TITLE_OFFSET_Y 9 +#define FLOR_GALLERY_FLOWER_PRICE_OFFSET_Y FLOR_GALLERY_FLOWER_TITLE_OFFSET_Y + 17 +#define FLOR_GALLERY_FLOWER_DESC_OFFSET_Y FLOR_GALLERY_FLOWER_PRICE_OFFSET_Y + 15 + + +UINT32 guiFlowerImages[ 3 ]; + +UINT32 guiCurrentlySelectedFlower=0; + +UINT8 gubCurFlowerIndex=0; +UINT8 gubCurNumberOfFlowers=0; +UINT8 gubPrevNumberOfFlowers=0; +BOOLEAN gfRedrawFloristGallery=FALSE; + +BOOLEAN FloristGallerySubPagesVisitedFlag[ 4 ]; + +//Floral buttons +extern INT32 guiGalleryButtonImage; // symbol already defined in florist.cpp (jonathanl) +void BtnGalleryFlowerButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiGalleryButton[ FLOR_GALLERY_NUMBER_FLORAL_BUTTONS ]; + +//Next Previous buttons +INT32 guiFloralGalleryButtonImage; +void BtnFloralGalleryNextButtonCallback(GUI_BUTTON *btn,INT32 reason); +void BtnFloralGalleryBackButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiFloralGalleryButton[2]; + + +BOOLEAN InitFlowerButtons(); +void DeleteFlowerButtons(); +BOOLEAN DisplayFloralDescriptions(); +void ChangingFloristGallerySubPage( UINT8 ubSubPageNumber ); + + +void GameInitFloristGallery() +{ + +} + +void EnterInitFloristGallery() +{ + memset( &FloristGallerySubPagesVisitedFlag, 0, 4); +} + + +BOOLEAN EnterFloristGallery() +{ + InitFloristDefaults(); + + //the next previous buttons + guiFloralGalleryButtonImage = LoadButtonImage("LAPTOP\\FloristButtons.sti", -1,0,-1,1,-1 ); + + guiFloralGalleryButton[0] = CreateIconAndTextButton( guiFloralGalleryButtonImage, sFloristGalleryText[FLORIST_GALLERY_PREV], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLOR_GALLERY_BACK_BUTTON_X, FLOR_GALLERY_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFloralGalleryBackButtonCallback); + SetButtonCursor(guiFloralGalleryButton[0], CURSOR_WWW ); + + guiFloralGalleryButton[1] = CreateIconAndTextButton( guiFloralGalleryButtonImage, sFloristGalleryText[FLORIST_GALLERY_NEXT], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLOR_GALLERY_NEXT_BUTTON_X, FLOR_GALLERY_NEXT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnFloralGalleryNextButtonCallback); + SetButtonCursor(guiFloralGalleryButton[1], CURSOR_WWW ); + + RenderFloristGallery(); + + InitFlowerButtons(); + + return(TRUE); +} + +void ExitFloristGallery() +{ + UINT16 i; + + RemoveFloristDefaults(); + + for(i=0; i<2; i++) + RemoveButton( guiFloralGalleryButton[i] ); + + UnloadButtonImage( guiFloralGalleryButtonImage ); + + DeleteFlowerButtons(); + +} + +void HandleFloristGallery() +{ + if( gfRedrawFloristGallery ) + { + gfRedrawFloristGallery=FALSE; + + // + DeleteFlowerButtons(); + InitFlowerButtons(); + + fPausedReDrawScreenFlag = TRUE; + } + +} + +void RenderFloristGallery() +{ + DisplayFloristDefaults(); + + DrawTextToScreen(sFloristGalleryText[FLORIST_GALLERY_CLICK_TO_ORDER], FLOR_GALLERY_TITLE_TEXT_X, FLOR_GALLERY_TITLE_TEXT_Y, FLOR_GALLERY_TITLE_TEXT_WIDTH, FLOR_GALLERY_TITLE_FONT, FLOR_GALLERY_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen(sFloristGalleryText[FLORIST_GALLERY_ADDIFTIONAL_FEE], FLOR_GALLERY_TITLE_TEXT_X, FLOR_GALLERY_TITLE_TEXT_Y+11, FLOR_GALLERY_TITLE_TEXT_WIDTH, FLOR_GALLERY_TITLE_FONT, FLOR_GALLERY_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + DisplayFloralDescriptions(); + + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + +void BtnFloralGalleryNextButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + + if( (gubCurFlowerIndex + 3 ) <= FLOR_GALLERY_NUMBER_FLORAL_IMAGES ) + gubCurFlowerIndex += 3; + + ChangingFloristGallerySubPage( gubCurFlowerIndex ); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + + gfRedrawFloristGallery = TRUE; + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnFloralGalleryBackButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + + if( gubCurFlowerIndex != 0 ) + { + if( gubCurFlowerIndex >=3 ) + gubCurFlowerIndex -= 3; + else + gubCurFlowerIndex = 0; + + ChangingFloristGallerySubPage( gubCurFlowerIndex ); + } + else + { + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST; + } + + gfRedrawFloristGallery = TRUE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + +void BtnGalleryFlowerButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentlySelectedFlower = (UINT8) MSYS_GetBtnUserData( btn, 0 ); + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_ORDERFORM; + + gfShowBookmarks = FALSE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +BOOLEAN InitFlowerButtons() +{ + UINT16 i,j, count; + UINT16 usPosY; + char sTemp[40]; + VOBJECT_DESC VObjectDesc; + + + if( (FLOR_GALLERY_NUMBER_FLORAL_IMAGES - gubCurFlowerIndex) >= 3 ) + gubCurNumberOfFlowers = 3; + else + gubCurNumberOfFlowers = FLOR_GALLERY_NUMBER_FLORAL_IMAGES - gubCurFlowerIndex; + + gubPrevNumberOfFlowers = gubCurNumberOfFlowers; + + //the 10 pictures of the flowers + count = gubCurFlowerIndex; + for(i=0; i= 3 ) + gubCurNumberOfFlowers = 3; + else + gubCurNumberOfFlowers = FLOR_GALLERY_NUMBER_FLORAL_IMAGES - gubCurFlowerIndex; + + usPosY = FLOR_GALLERY_FLOWER_BUTTON_Y; + for(i=0; iuiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_FLOWER_GALLERY; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnFlowerOrderSendButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //add an entry in the finacial page for the medical deposit + AddTransactionToPlayersBook( PURCHASED_FLOWERS, 0, GetWorldTotalMin(), -(INT32)(guiFlowerPrice) ); + + if ( gubCurrentlySelectedFlowerLocation == 7 ) + { + // sent to meduna! + if ( gfFLoristCheckBox0Down ) + { + HandleFlowersMeanwhileScene( 0 ); + } + else + { + HandleFlowersMeanwhileScene( 1 ); + } + } + + //increment the order number + LaptopSaveInfo.uiFlowerOrderNumber += ( 1 + Random( 2 ) ); + + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST; + InitFloristOrderForm(); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnFlowerOrderClearButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST; + InitFloristOrderForm(); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnFlowerOrderGalleryButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_FLOWER_GALLERY; + + //reset the gallery back to page 0 + gubCurFlowerIndex = 0; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void SelectFlorsitCheckBoxRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + UINT32 uiUserData; + + uiUserData = MSYS_GetRegionUserData( pRegion, 0 ); + + switch( uiUserData ) + { + case 0: + if( gfFLoristCheckBox0Down ) + { + gfFLoristCheckBox0Down = FALSE; + gfFLoristCheckBox1Down = TRUE; + } + else + { + gfFLoristCheckBox0Down = TRUE; + gfFLoristCheckBox1Down = FALSE; + } + break; + case 1: + if( gfFLoristCheckBox1Down ) + { + gfFLoristCheckBox1Down = FALSE; + gfFLoristCheckBox0Down = TRUE; + } + else + { + gfFLoristCheckBox1Down = TRUE; + gfFLoristCheckBox0Down = FALSE; + } + break; + case 2: + if( gfFLoristCheckBox2Down ) + gfFLoristCheckBox2Down = FALSE; + else + gfFLoristCheckBox2Down = TRUE; + break; + case 3: + if( gfFLoristCheckBox3Down ) + gfFLoristCheckBox3Down = FALSE; + else + gfFLoristCheckBox3Down = TRUE; + break; + case 4: + if( gfFLoristCheckBox4Down ) + gfFLoristCheckBox4Down = FALSE; + else + gfFLoristCheckBox4Down = TRUE; + break; + case 5: + if( gfFLoristCheckBox5Down ) + gfFLoristCheckBox5Down = FALSE; + else + gfFLoristCheckBox5Down = TRUE; + break; + } + DisplayFloristCheckBox(); + fPausedReDrawScreenFlag = TRUE; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + +void DisplayFloristCheckBox() +{ + HVOBJECT hPixHandle; + + //check box + GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); + if( gfFLoristCheckBox0Down ) + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_0_X, FLOWER_ORDER_CHECK_BOX_0_Y, VO_BLT_SRCTRANSPARENCY,NULL); + else + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_0_X, FLOWER_ORDER_CHECK_BOX_0_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //first check box + GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); + if( gfFLoristCheckBox1Down ) + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_1_X, FLOWER_ORDER_CHECK_BOX_1_Y, VO_BLT_SRCTRANSPARENCY,NULL); + else + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_1_X, FLOWER_ORDER_CHECK_BOX_1_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //second check box + GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); + if( gfFLoristCheckBox2Down ) + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_2_X, FLOWER_ORDER_CHECK_BOX_2_Y, VO_BLT_SRCTRANSPARENCY,NULL); + else + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_2_X, FLOWER_ORDER_CHECK_BOX_2_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //third check box + GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); + if( gfFLoristCheckBox3Down ) + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_3_X, FLOWER_ORDER_CHECK_BOX_3_Y, VO_BLT_SRCTRANSPARENCY,NULL); + else + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_3_X, FLOWER_ORDER_CHECK_BOX_3_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //Foiurth check box + GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); + if( gfFLoristCheckBox4Down ) + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_4_X, FLOWER_ORDER_CHECK_BOX_4_Y, VO_BLT_SRCTRANSPARENCY,NULL); + else + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_4_X, FLOWER_ORDER_CHECK_BOX_4_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //fifth check box + GetVideoObject(&hPixHandle, guiFlowerOrderCheckBoxButtonImage); + if( gfFLoristCheckBox5Down ) + BltVideoObject(FRAME_BUFFER, hPixHandle, 1, FLOWER_ORDER_CHECK_BOX_5_X, FLOWER_ORDER_CHECK_BOX_5_Y, VO_BLT_SRCTRANSPARENCY,NULL); + else + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, FLOWER_ORDER_CHECK_BOX_5_X, FLOWER_ORDER_CHECK_BOX_5_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + + +void SelectFloristCardGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_CARD_GALLERY; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + +//display the things that change on the screen +void DisplayFlowerDynamicItems() +{ + UINT32 uiStartLoc=0; + UINT16 usPosX; + wchar_t sTemp[ 640 ]; +// wchar_t sText[ 640 ]; + UINT16 usPrice; +/* + //display the card saying + if( gbCurrentlySelectedCard != -1 ) + { + //Get and display the card saying + //Display Flower Desc + + uiStartLoc = FLOR_CARD_TEXT_TITLE_SIZE * + gbCurrentlySelectedCard; + LoadEncryptedDataFromFile( FLOR_CARD_TEXT_FILE, sTemp, uiStartLoc, FLOR_CARD_TEXT_TITLE_SIZE); + + CleanOutControlCodesFromString(sTemp, sText); + + DisplayWrappedString( (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_X+10), (UINT16)(FLOWER_ORDER_SENTIMENT_BOX_Y+7), FLOWER_ORDER_PERSONAL_SENT_TEXT_WIDTH, 2, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } +*/ + //order number + usPosX = StringPixLength( sOrderFormText[FLORIST_ORDER_ORDER_NUMBER], FLOWER_ORDEER_SMALL_FONT) + 5 + FLOWER_ORDER_ORDER_NUM_NAME_X; + swprintf(sTemp, L"%d", LaptopSaveInfo.uiFlowerOrderNumber ); + DrawTextToScreen( sTemp, usPosX, FLOWER_ORDER_ORDER_NUM_NAME_Y, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + guiFlowerPrice = 0; + // the user selected crushed bouquet + if( gfFLoristCheckBox2Down ) + guiFlowerPrice += gubFlowerOrder_AdditioanalServicePrices[0]; + + // the user selected blak roses + if( gfFLoristCheckBox3Down ) + guiFlowerPrice += gubFlowerOrder_AdditioanalServicePrices[1]; + + // the user selected wilted bouquet + if( gfFLoristCheckBox4Down ) + guiFlowerPrice += gubFlowerOrder_AdditioanalServicePrices[2]; + + // the user selected fruit cake + if( gfFLoristCheckBox5Down ) + guiFlowerPrice += gubFlowerOrder_AdditioanalServicePrices[3]; + + //price + usPosX = StringPixLength( sOrderFormText[FLORIST_ORDER_PRICE], FLOWER_ORDEER_SMALL_FONT) + 5 + FLOWER_ORDER_BOUQUET_NAME_X; + uiStartLoc = FLOR_GALLERY_TEXT_TOTAL_SIZE * guiCurrentlySelectedFlower + FLOR_GALLERY_TEXT_TITLE_SIZE; + LoadEncryptedDataFromFile(FLOR_GALLERY_TEXT_FILE, sTemp, uiStartLoc, FLOR_GALLERY_TEXT_PRICE_SIZE); + swscanf( sTemp, L"%hu", &usPrice); + + //if its the next day delivery + if( gfFLoristCheckBox0Down ) + guiFlowerPrice += usPrice + FlowerOrderLocations[ gubCurrentlySelectedFlowerLocation ].ubNextDayDeliveryCost; + //else its the 'when it gets there' delivery + else + guiFlowerPrice += usPrice + FlowerOrderLocations[ gubCurrentlySelectedFlowerLocation ].ubWhenItGetsThereCost; + + swprintf( sTemp, L"$%d.00 %s", guiFlowerPrice, pMessageStrings[ MSG_USDOLLAR_ABBREVIATION ] ); + DrawTextToScreen( sTemp, usPosX, FLOWER_ORDER_BOUQUET_NAME_Y, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); +} + + +void SelectFloristGalleryLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_FLOWER_GALLERY; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + +void SelectFloristDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_CREATE; + } +} + +void SelectFloristDisableDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_DESTROY; + } +} + + +void SelectFlowerDropDownRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + gubCurrentlySelectedFlowerLocation = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); + FlowerOrderDrawSelectedCity( gubCurrentlySelectedFlowerLocation ); + gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_DESTROY; + } +} + +void SelectFlowerDropDownMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + pRegion->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } + else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + pRegion->uiFlags |= BUTTON_CLICKED_ON ; + + gubCurrentlySelectedFlowerLocation = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); + FlowerOrderDrawSelectedCity( gubCurrentlySelectedFlowerLocation ); + + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } +} + + + + +BOOLEAN CreateDestroyFlowerOrderDestDropDown( UINT8 ubDropDownMode ) +{ + static UINT16 usHeight; + static BOOLEAN fMouseRegionsCreated=FALSE; + + switch( ubDropDownMode ) + { + case FLOWER_ORDER_DROP_DOWN_NO_ACTION: + { + + } + break; + + case FLOWER_ORDER_DROP_DOWN_CREATE: + { + UINT8 i; + UINT16 usPosX, usPosY; + UINT16 usTemp; + UINT16 usFontHeight = GetFontHeight( FLOWER_ORDEER_DROP_DOWN_FONT ); + UINT8 ubTextFieldID; + + if( fMouseRegionsCreated ) + { + return(FALSE); + break; + } + +//Get the current text from the text box + ubTextFieldID = (UINT8) GetActiveFieldID(); + + //if its the personel sentiment field + if( ubTextFieldID == 1 ) + { + Get16BitStringFromField( ubTextFieldID, gsSentimentTextField ); + } + else if( ubTextFieldID == 2 ) + { + //else its the name field + Get16BitStringFromField( ubTextFieldID, gsNameTextField ); + } + + SetActiveField(0); + + + + fMouseRegionsCreated = TRUE; + + usPosX = FLOWER_ORDER_DROP_DOWN_CITY_START_X; + usPosY = FLOWER_ORDER_DROP_DOWN_CITY_START_Y; + for( i=0; i< FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS; i++) + { + MSYS_DefineRegion( &gSelectedFlowerDropDownRegion[i], usPosX, (UINT16)(usPosY+4), (UINT16)(usPosX+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH), (UINT16)(usPosY+usFontHeight), MSYS_PRIORITY_HIGH+3, + CURSOR_WWW, SelectFlowerDropDownMovementCallBack, SelectFlowerDropDownRegionCallBack); + MSYS_AddRegion(&gSelectedFlowerDropDownRegion[i]); + MSYS_SetRegionUserData( &gSelectedFlowerDropDownRegion[ i ], 0, i); + + usPosY += usFontHeight + 2; + } + usTemp = FLOWER_ORDER_DROP_DOWN_CITY_START_Y; + usHeight = usPosY - usTemp + 10; + + + gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_DISPLAY; + MSYS_EnableRegion(&gSelectedFloristDisableDropDownRegion); + + + //disable the text entry fields +// DisableAllTextFields(); + Get16BitStringFromField( 1, gsSentimentTextField ); + KillTextInputMode(); + + //disable the clear order and accept order buttons, (their rendering interferes with the drop down graphics) + } + break; + + case FLOWER_ORDER_DROP_DOWN_DESTROY: + { + UINT8 i; + + if( !fMouseRegionsCreated ) + break; + + for( i=0; i< FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS; i++) + MSYS_RemoveRegion( &gSelectedFlowerDropDownRegion[i]); + + //display the name on the title bar + ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_LOCATION_X+3, FLOWER_ORDER_DELIVERY_LOCATION_Y+3, FLOWER_ORDER_DROP_DOWN_LOCATION_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH, FLOWER_ORDER_DELIVERY_LOCATION_Y+FLOWER_ORDER_DELIVERY_LOCATION_HEIGHT-2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + DrawTextToScreen( *(FlowerOrderLocations[ gubCurrentlySelectedFlowerLocation ].psCityLoc), FLOWER_ORDER_DROP_DOWN_CITY_START_X+6, FLOWER_ORDER_DROP_DOWN_CITY_START_Y+3, 0, FLOWER_ORDEER_DROP_DOWN_FONT, FLOWER_ORDEER_DROP_DOWN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + //enable the drop down region + MSYS_DisableRegion(&gSelectedFloristDisableDropDownRegion); + + fPausedReDrawScreenFlag = TRUE; + fMouseRegionsCreated = FALSE; + gubFlowerDestDropDownMode = FLOWER_ORDER_DROP_DOWN_NO_ACTION; + + //enable the text entry fields + InitFlowerOrderTextInputBoxes(); + } + break; + + case FLOWER_ORDER_DROP_DOWN_DISPLAY: + { + UINT8 i; + UINT16 usPosY, usPosX; + UINT16 usFontHeight = GetFontHeight( FLOWER_ORDEER_DROP_DOWN_FONT ); + HVOBJECT hImageHandle; + + //Display the background for the drop down window + ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_LOCATION_X, FLOWER_ORDER_DROP_DOWN_LOCATION_Y, FLOWER_ORDER_DROP_DOWN_LOCATION_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH, FLOWER_ORDER_DROP_DOWN_LOCATION_Y+usHeight, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + + // + // Place the border around the background + // + + GetVideoObject(&hImageHandle, guiDropDownBorder); + + usPosX = usPosY = 0; + //blit top row of images + for(i=10; i< FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-10; i+=10) + { + //TOP ROW + BltVideoObject(FRAME_BUFFER, hImageHandle, 1,i+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usPosY+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //BOTTOM ROW + BltVideoObject(FRAME_BUFFER, hImageHandle, 6,i+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usHeight-10+6+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL); + } + + //blit the left and right row of images + usPosX = 0; + for(i=10; i< usHeight-10; i+=10) + { + BltVideoObject(FRAME_BUFFER, hImageHandle, 3,usPosX+FLOWER_ORDER_DROP_DOWN_LOCATION_X, i+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hImageHandle, 4,usPosX+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-4+FLOWER_ORDER_DROP_DOWN_LOCATION_X, i+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL); + } + + //blt the corner images for the row + //top left + BltVideoObject(FRAME_BUFFER, hImageHandle, 0, 0+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usPosY+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL); + //top right + BltVideoObject(FRAME_BUFFER, hImageHandle, 2, FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-10+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usPosY+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL); + //bottom left + BltVideoObject(FRAME_BUFFER, hImageHandle, 5, 0+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usHeight-10+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL); + //bottom right + BltVideoObject(FRAME_BUFFER, hImageHandle, 7, FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-10+FLOWER_ORDER_DROP_DOWN_LOCATION_X, usHeight-10+FLOWER_ORDER_DROP_DOWN_LOCATION_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + //Display the list of cities + usPosY = FLOWER_ORDER_DROP_DOWN_CITY_START_Y + 3; + for( i=0; i< FLOWER_ORDER_NUMBER_OF_DROP_DOWN_LOCATIONS; i++) + { + DrawTextToScreen( *(FlowerOrderLocations[i].psCityLoc), FLOWER_ORDER_DROP_DOWN_CITY_START_X+6, usPosY, 0, FLOWER_ORDEER_DROP_DOWN_FONT, FLOWER_ORDEER_DROP_DOWN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + usPosY += usFontHeight + 2; + } + + FlowerOrderDrawSelectedCity( gubCurrentlySelectedFlowerLocation ); + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + } + break; + } + return(TRUE); +} + + +void FlowerOrderDrawSelectedCity( UINT8 ubNumber ) +{ + UINT16 usPosY; + UINT16 usFontHeight = GetFontHeight( FLOWER_ORDEER_DROP_DOWN_FONT ); + + usPosY = (usFontHeight + 2) * ubNumber + FLOWER_ORDER_DROP_DOWN_CITY_START_Y; + + //display the name in the list + ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_CITY_START_X, usPosY+2, FLOWER_ORDER_DROP_DOWN_CITY_START_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH-9, usPosY+usFontHeight+4, Get16BPPColor( FROMRGB( 255, 255, 255 ) ) ); + + SetFontShadow(NO_SHADOW); + DrawTextToScreen( *(FlowerOrderLocations[ubNumber].psCityLoc), FLOWER_ORDER_DROP_DOWN_CITY_START_X+6, (UINT16)(usPosY+3), 0, FLOWER_ORDEER_DROP_DOWN_FONT, 2, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + SetFontShadow(DEFAULT_SHADOW); + + FlowerOrderDisplayShippingLocationCity(); + SetFontShadow(DEFAULT_SHADOW); + +} + + +void FlowerOrderDisplayShippingLocationCity() +{ + //display the name on the title bar + ColorFillVideoSurfaceArea( FRAME_BUFFER, FLOWER_ORDER_DROP_DOWN_LOCATION_X+3, FLOWER_ORDER_DELIVERY_LOCATION_Y+3, FLOWER_ORDER_DROP_DOWN_LOCATION_X+FLOWER_ORDER_DROP_DOWN_LOCATION_WIDTH, FLOWER_ORDER_DELIVERY_LOCATION_Y+FLOWER_ORDER_DELIVERY_LOCATION_HEIGHT-2, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + DrawTextToScreen( *(FlowerOrderLocations[ gubCurrentlySelectedFlowerLocation ].psCityLoc), FLOWER_ORDER_DELIVERY_LOCATION_X+5, FLOWER_ORDER_DELIVERY_LOCATION_Y+5, 0, FLOWER_ORDEER_SMALL_FONT, FLOWER_ORDEER_SMALL_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); +} + + +void InitFlowerOrderTextInputBoxes() +{ + UINT32 uiStartLoc=0; + wchar_t sTemp[ 640 ]; + wchar_t sText[ 640 ]; + + + InitTextInputMode(); + SetTextInputFont( (UINT16)FONT12ARIAL ); + Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 255, 255, 255) ) ); + SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) ); + SetTextInputRegularColors( 2, FONT_WHITE ); + SetTextInputHilitedColors( FONT_WHITE, 2, 141 ); + SetCursorColor( Get16BPPColor(FROMRGB(0, 0, 0) ) ); + + AddUserInputField( FlowerOrderUserTextFieldCallBack ); + + if( gbCurrentlySelectedCard != -1 ) + { + //Get and display the card saying + //Display Flower Desc + + uiStartLoc = FLOR_CARD_TEXT_TITLE_SIZE * + gbCurrentlySelectedCard; + LoadEncryptedDataFromFile( FLOR_CARD_TEXT_FILE, sTemp, uiStartLoc, FLOR_CARD_TEXT_TITLE_SIZE); + CleanOutControlCodesFromString(sTemp, sText); + + wcsncpy( gsSentimentTextField, sText, FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS - 1 ); + + gbCurrentlySelectedCard = -1; + + } + + if( wcslen( gsSentimentTextField ) >= FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS - 2 ) + { + gsSentimentTextField[ FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS - 1] = L'\0'; + } + + //personal sentiment box + AddTextInputField( FLOWER_ORDER_PERSONAL_SENT_BOX_X, FLOWER_ORDER_PERSONAL_SENT_BOX_Y, FLOWER_ORDER_PERSONAL_SENT_TEXT_WIDTH, FLOWER_ORDER_PERSONAL_SENT_TEXT_HEIGHT, MSYS_PRIORITY_HIGH+2, gsSentimentTextField, FLOWER_ORDER_PERSONEL_SENTIMENT_NUM_CHARS, INPUTTYPE_ASCII ); + + //Name box + AddTextInputField( FLOWER_ORDER_NAME_TEXT_BOX_X, FLOWER_ORDER_NAME_TEXT_BOX_Y, FLOWER_ORDER_NAME_TEXT_BOX_WIDTH, FLOWER_ORDER_NAME_TEXT_BOX_HEIGHT, MSYS_PRIORITY_HIGH+2, gsNameTextField, FLOWER_ORDER_NAME_FIELD_NUM_CHARS, INPUTTYPE_ASCII ); +} + +void DestroyFlowerOrderTextInputBoxes() +{ + KillTextInputMode(); +} + + +void HandleFloristOrderKeyBoardInput() +{ + InputAtom InputEvent; + + while (DequeueEvent(&InputEvent) == TRUE) + { + if( !HandleTextInput( &InputEvent ) && InputEvent.usEvent == KEY_DOWN ) + { + UINT8 ubTextFieldID; + switch (InputEvent.usParam) + { + case ENTER: + + ubTextFieldID = (UINT8) GetActiveFieldID(); + + //if its the personel sentiment field + if( ubTextFieldID == 1 ) + { + Get16BitStringFromField( ubTextFieldID, gsSentimentTextField ); + } + else if( ubTextFieldID == 2 ) + { + //else its the name field + Get16BitStringFromField( ubTextFieldID, gsNameTextField ); + } + + SetActiveField(0); + break; + + case ESC: + SetActiveField(0); + break; + + default: + HandleKeyBoardShortCutsForLapTop( InputEvent.usEvent, InputEvent.usParam, InputEvent.usKeyState ); + break; + } + } + } +} + + + +void FlowerOrderUserTextFieldCallBack( UINT8 ubID, BOOLEAN fEntering ) +{ + if( fEntering ) + { +// SetActiveField(1); + } +} + + +//Initialize the Florsit Order Page (reset some variables) +void InitFloristOrderForm() +{ + gsSentimentTextField[0] = 0; + + gfFLoristCheckBox0Down = FALSE; // next day delviery + gfFLoristCheckBox1Down = TRUE; // when it gets there delivery + gfFLoristCheckBox2Down = FALSE; + gfFLoristCheckBox3Down = FALSE; + gfFLoristCheckBox4Down = FALSE; + gfFLoristCheckBox5Down = FALSE; + + guiFlowerPrice = 0; + + gubCurrentlySelectedFlowerLocation = 0; + gbCurrentlySelectedCard = -1; + + gsSentimentTextField[0] = 0; + gsNameTextField[0] = 0; + +} diff --git a/Laptop/florist Order Form.h b/Laptop/florist Order Form.h new file mode 100644 index 00000000..92823531 --- /dev/null +++ b/Laptop/florist Order Form.h @@ -0,0 +1,15 @@ +#ifndef __FLORIST_ORDER_FORM_H +#define __FLORIST_ORDER_FORM_H + +void GameInitFloristOrderForm(); +BOOLEAN EnterFloristOrderForm(); +void ExitFloristOrderForm(); +void HandleFloristOrderForm(); +void RenderFloristOrderForm(); + + +void InitFloristOrderForm(); + +void InitFloristOrderFormVariables(); + +#endif \ No newline at end of file diff --git a/Laptop/florist.cpp b/Laptop/florist.cpp new file mode 100644 index 00000000..5355568d --- /dev/null +++ b/Laptop/florist.cpp @@ -0,0 +1,302 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "florist.h" + #include "florist Order Form.h" + #include "florist Gallery.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "florist Cards.h" + #include "Text.h" + #include "Multi Language Graphic Utils.h" +#endif + + +#define FLORIST_SENTENCE_FONT FONT12ARIAL +#define FLORIST_SENTENCE_COLOR FONT_MCOLOR_WHITE + +#define FLORIST_TITLE_FONT FONT14ARIAL +#define FLORIST_TITLE_COLOR FONT_MCOLOR_WHITE + +#define FLORIST_BACKGROUND_WIDTH 125 +#define FLORIST_BACKGROUND_HEIGHT 100 + +#define FLORIST_BIG_TITLE_X LAPTOP_SCREEN_UL_X + 113 +#define FLORIST_BIG_TITLE_Y LAPTOP_SCREEN_WEB_UL_Y + 0 + +#define FLORIST_SMALL_TITLE_X LAPTOP_SCREEN_UL_X + 195 +#define FLORIST_SMALL_TITLE_Y LAPTOP_SCREEN_WEB_UL_Y + 0 +#define FLORIST_SMALL_TITLE_WIDTH 100 +#define FLORIST_SMALL_TITLE_HEIGHT 49 + + +#define FLORIST_FIRST_BULLET_X LAPTOP_SCREEN_UL_X + 5 +#define FLORIST_FIRST_BULLET_Y LAPTOP_SCREEN_WEB_UL_Y + 135 + +#define FLORIST_BULLET_OFFSET_Y 54 + +#define FLORIST_NUMBER_OF_BULLETS 4 + +#define FLORIST_GALLERY_BUTTON_X LAPTOP_SCREEN_UL_X + 210 +#define FLORIST_GALLERY_BUTTON_Y LAPTOP_SCREEN_WEB_UL_Y + 360 + +#define FLORIST_FIRST_SENTENCE_COLUMN_TEXT_X LAPTOP_SCREEN_UL_X + 53 +#define FLORIST_FIRST_SENTENCE_COLUMN_TEXT_WIDTH 136 + +#define FLORIST_SECOND_SENTENCE_COLUMN_TEXT_X LAPTOP_SCREEN_UL_X + 200 +#define FLORIST_SECOND_SENTENCE_COLUMN_TEXT_WIDTH 300 + +#define FLORIST_COMPANY_INFO_TEXT_X LAPTOP_SCREEN_UL_X + 117 +#define FLORIST_COMPANY_INFO_TEXT_WIDTH 290 + +#define FLORIST_COMPANY_INFO_LINE_1_Y LAPTOP_SCREEN_WEB_UL_Y + 79 +#define FLORIST_COMPANY_INFO_LINE_2_Y LAPTOP_SCREEN_WEB_UL_Y + 94 +#define FLORIST_COMPANY_INFO_LINE_3_Y LAPTOP_SCREEN_WEB_UL_Y + 107 +#define FLORIST_COMPANY_INFO_LINE_4_Y LAPTOP_SCREEN_WEB_UL_Y + 119 + +UINT32 guiFloristBackground; +UINT32 guiHandBullet; +UINT32 guiLargeTitleSymbol; +UINT32 guiSmallTitleSymbol; + + +BOOLEAN gfHomePageActive=FALSE; //Specifies whether or not the home page or the sub pages are active + +//Buttons + +//Graphic for button +INT32 guiGalleryButtonImage; +void BtnGalleryButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiGalleryButton; + + +//link to the flower home page by clicking on the flower title +MOUSE_REGION gSelectedFloristTitleHomeLinkRegion; +void SelectFloristTitleHomeLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + +void GameInitFlorist() +{ + +} + +BOOLEAN EnterFlorist() +{ + VOBJECT_DESC VObjectDesc; + + SetBookMark( FLORIST_BOOKMARK ); + + InitFloristDefaults(); + + // load the handbullet graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\HandBullet.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiHandBullet)); + + guiGalleryButtonImage = LoadButtonImage("LAPTOP\\FloristButtons.sti", -1,0,-1,1,-1 ); + + guiGalleryButton = CreateIconAndTextButton( guiGalleryButtonImage, sFloristText[FLORIST_GALLERY], FLORIST_BUTTON_TEXT_FONT, + FLORIST_BUTTON_TEXT_UP_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + FLORIST_BUTTON_TEXT_DOWN_COLOR, FLORIST_BUTTON_TEXT_SHADOW_COLOR, + TEXT_CJUSTIFIED, + FLORIST_GALLERY_BUTTON_X, FLORIST_GALLERY_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnGalleryButtonCallback); + SetButtonCursor(guiGalleryButton, CURSOR_WWW ); + + //reset the currently selected card + gbCurrentlySelectedCard = -1; + + //Initialize the Florsit Order Page (reset some variables) + InitFloristOrderForm(); + + //Initialize the flower index for the gallery page + gubCurFlowerIndex = 0; + + + RenderFlorist(); + fReDrawScreenFlag = TRUE; + + //set some variables for the order form + InitFloristOrderFormVariables(); + + return(TRUE); +} + +void ExitFlorist() +{ + + DeleteVideoObjectFromIndex(guiHandBullet); + + RemoveFloristDefaults(); + + UnloadButtonImage( guiGalleryButtonImage ); + + RemoveButton( guiGalleryButton ); +} + +void HandleFlorist() +{ +} + +void RenderFlorist() +{ + HVOBJECT hPixHandle; + UINT16 i, usPosY; + UINT8 ubTextCounter; + + GetVideoObject(&hPixHandle, guiHandBullet); + + DisplayFloristDefaults(); + + //compnay info + DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_1_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_DROP_ANYWHERE ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_2_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_PHONE_NUMBER ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_3_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_STREET_ADDRESS ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(FLORIST_COMPANY_INFO_TEXT_X, FLORIST_COMPANY_INFO_LINE_4_Y, FLORIST_COMPANY_INFO_TEXT_WIDTH, 2, FLORIST_SENTENCE_FONT, FLORIST_SENTENCE_COLOR, sFloristText[ FLORIST_WWW_ADDRESS ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + + usPosY = FLORIST_FIRST_BULLET_Y; + ubTextCounter = FLORIST_ADVERTISEMENT_1; + for( i=0; iuiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST_FLOWER_GALLERY; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void SelectFloristTitleHomeLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_FLORIST; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + + + + + + diff --git a/Laptop/florist.h b/Laptop/florist.h new file mode 100644 index 00000000..f471a2bf --- /dev/null +++ b/Laptop/florist.h @@ -0,0 +1,32 @@ +#ifndef __FLORIST_H +#define __FLORIST_H + + + +#define FLORIST_BUTTON_TEXT_FONT FONT14ARIAL +#define FLORIST_BUTTON_TEXT_UP_COLOR 2 +#define FLORIST_BUTTON_TEXT_DOWN_COLOR 2 +#define FLORIST_BUTTON_TEXT_SHADOW_COLOR 128 + + + + +void GameInitFlorist(); +BOOLEAN EnterFlorist(); +void ExitFlorist(); +void HandleFlorist(); +void RenderFlorist(); + +void RemoveFloristDefaults(); +void DisplayFloristDefaults(); +BOOLEAN InitFloristDefaults(); + + + +#endif + + + + + + diff --git a/Laptop/funeral.cpp b/Laptop/funeral.cpp new file mode 100644 index 00000000..18307db2 --- /dev/null +++ b/Laptop/funeral.cpp @@ -0,0 +1,355 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "funeral.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Text.h" + #include "Multi Language Graphic Utils.h" +#endif + + +#define FUNERAL_SENTENCE_FONT FONT12ARIAL +#define FUNERAL_SENTENCE_COLOR 2//FONT_MCOLOR_WHITE +#define FUNERAL_SENTENCE_SHADOW_COLOR FONT_MCOLOR_WHITE//FONT_MCOLOR_DKWHITE + +#define FUNERAL_SMALL_FONT FONT10ARIAL + +#define FUNERAL_TITLE_FONT FONT14ARIAL +#define FUNERAL_TITLE_COLOR FONT_MCOLOR_WHITE +#define FUNERAL_TITLE_SHADOW_COLOR FONT_MCOLOR_DKWHITE + +#define FUNERAL_RIP_SHADOW_COLOR FONT_MCOLOR_DKWHITE + + +#define FUNERAL_MCGILICUTTYS_SIGN_X LAPTOP_SCREEN_UL_X + 92 +#define FUNERAL_MCGILICUTTYS_SIGN_Y LAPTOP_SCREEN_WEB_UL_Y + 0 + +#define FUNERAL_MORTUARY_SIGN_X LAPTOP_SCREEN_UL_X + 58 +#define FUNERAL_MORTUARY_SIGN_Y LAPTOP_SCREEN_WEB_UL_Y + 43 + +#define FUNERAL_LEFT_COLUMN_X LAPTOP_SCREEN_UL_X + 0 +#define FUNERAL_LEFT_COLUMN_Y LAPTOP_SCREEN_WEB_UL_Y + 43 + +#define FUNERAL_RIGHT_COLUMN_X LAPTOP_SCREEN_UL_X + 442 +#define FUNERAL_RIGHT_COLUMN_Y LAPTOP_SCREEN_WEB_UL_Y + 43 + +#define FUNERAL_LINK_1_X LAPTOP_SCREEN_UL_X + 37 +#define FUNERAL_LINK_1_Y LAPTOP_SCREEN_WEB_UL_Y + 329 +#define FUNERAL_LINK_1_WIDTH 85 +#define FUNERAL_LINK_1_HEIGHT 60 + +#define FUNERAL_LINK_OFFSET_X 85 +#define FUNERAL_NUMBER_OF_LINKS 5 + +#define FUNERAL_LINK_TEXT_OFFSET_X 4 +#define FUNERAL_LINK_TEXT_OFFSET_Y 17 +#define FUNERAL_LINK_TEXT_WIDTH 76 + + +#define FUNERAL_MARBLE_WIDTH 125 +#define FUNERAL_MARBLE_HEIGHT 100 + +#define FUNERAL_SENTENCE_WIDTH 380 + +#define FUNERAL_SENTENCE_1_X LAPTOP_SCREEN_UL_X + 60 +#define FUNERAL_SENTENCE_1_Y LAPTOP_SCREEN_WEB_UL_Y + 164 + +#define FUNERAL_SENTENCE_2_X FUNERAL_SENTENCE_1_X +#define FUNERAL_SENTENCE_2_Y LAPTOP_SCREEN_WEB_UL_Y + 198 + +#define FUNERAL_SENTENCE_3_X FUNERAL_SENTENCE_1_X +#define FUNERAL_SENTENCE_3_Y LAPTOP_SCREEN_WEB_UL_Y + 227 + +#define FUNERAL_SENTENCE_4_X FUNERAL_SENTENCE_1_X +#define FUNERAL_SENTENCE_4_Y LAPTOP_SCREEN_WEB_UL_Y + 261 + +#define FUNERAL_SENTENCE_5_X FUNERAL_SENTENCE_1_X +#define FUNERAL_SENTENCE_5_Y LAPTOP_SCREEN_WEB_UL_Y + 303 + + +#define FUNERAL_CLOSED_RIP_SIGN_X LAPTOP_SCREEN_UL_X + 72 +#define FUNERAL_CLOSED_RIP_SIGN_Y LAPTOP_SCREEN_WEB_UL_Y + 151 +#define FUNERAL_CLOSED_WIDTH 364 +#define FUNERAL_CLOSED_HEIGHT 204 + +#define FUNERAL_RIP_SENTENCE_WIDTH 260 + +#define FUNERAL_RIP_SENTENCE_1_X FUNERAL_CLOSED_RIP_SIGN_X + 55 +#define FUNERAL_RIP_SENTENCE_1_Y FUNERAL_CLOSED_RIP_SIGN_Y + 98 + +#define FUNERAL_RIP_SENTENCE_2_X FUNERAL_RIP_SENTENCE_1_X +#define FUNERAL_RIP_SENTENCE_2_Y FUNERAL_CLOSED_RIP_SIGN_Y + 162 + + + + + +//Image Identifiers +UINT32 guiClosedSign; +UINT32 guiLeftColumn; +UINT32 guiLinkCarving; +UINT32 guiMarbleBackground; +UINT32 guiMcGillicuttys; +UINT32 guiMortuary; +UINT32 guiRightColumn; + + + +//Clicking on Funeral link +MOUSE_REGION gSelectedFuneralLinkRegion[ FUNERAL_NUMBER_OF_LINKS ]; +void SelectFuneralLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//Clicking on rip sign to make it disappear +MOUSE_REGION gSelectedRipSignRegion; +void SelectRipSignRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + + +void DisplayFuneralRipTombStone(); + + + +void GameInitFuneral() +{ + +} + +BOOLEAN EnterFuneral() +{ + VOBJECT_DESC VObjectDesc; + UINT16 usPosX, i; + + // load the Closed graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_CLOSED ); + CHECKF(AddVideoObject(&VObjectDesc, &guiClosedSign)); + + // load the Left column graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\LeftColumn.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLeftColumn)); + + // load the Link carving graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\LinkCarving.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLinkCarving)); + + // load the Marble graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Marble.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMarbleBackground)); + + // load the McGillicuttys sign graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_MCGILLICUTTYS ); + CHECKF(AddVideoObject(&VObjectDesc, &guiMcGillicuttys)); + + // load the Mortuary graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_MORTUARY ); + CHECKF(AddVideoObject(&VObjectDesc, &guiMortuary)); + + // load the right column graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\RightColumn.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiRightColumn)); + + + usPosX = FUNERAL_LINK_1_X; + for(i=0; i 0 ) + iCurrentHistoryPage = LaptopSaveInfo.iCurrentHistoryPage - 1; + else + iCurrentHistoryPage = 0; + + // load in first page + LoadNextHistoryPage( ); + + + // render hbackground + RenderHistory( ); + + + // set the fact we are in the history viewer + fInHistoryMode=TRUE; + + // build Historys list + //OpenAndReadHistoryFile( ); + + // force redraw of the entire screen + //fReDrawScreenFlag=TRUE; + + // set inital states + SetHistoryButtonStates( ); + + return; +} + +void ExitHistory() +{ + LaptopSaveInfo.iCurrentHistoryPage = iCurrentHistoryPage; + + // not in History system anymore + fInHistoryMode=FALSE; + + + // write out history list to file + //OpenAndWriteHistoryFile( ); + + // delete graphics + RemoveHistory( ); + + // delete buttons + DestroyHistoryButtons( ); + + ClearHistoryList( ); + + + return; +} + +void HandleHistory() +{ + // DEF 2/5/99 Dont need to update EVERY FRAME!!!! + // check and update status of buttons +// SetHistoryButtonStates( ); +} + +void RenderHistory( void ) +{ + //render the background to the display + RenderHistoryBackGround( ); + + // the title bar text + DrawHistoryTitleText( ); + + // the actual lists background + DisplayHistoryListBackground( ); + + // the headers to each column + DisplayHistoryListHeaders( ); + + // render the currentpage of records + DrawAPageofHistoryRecords( ); + + // stuff at top of page, the date range and page numbers + DisplayPageNumberAndDateRange( ); + + // title bar icon + BlitTitleBarIcons( ); + + return; +} + + +BOOLEAN LoadHistory( void ) +{ + VOBJECT_DESC VObjectDesc; + // load History video objects into memory + + // title bar + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTITLE)); + + // top portion of the screen background + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\historywindow.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTOP)); + + + // shaded line + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\historylines.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSHADELINE)); + +/* +Not being used??? DF commented out + // vert line + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\historyvertline.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiVERTLINE)); +*/ + // black divider line - long ( 480 length) + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\divisionline480.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLONGLINE)); + + return (TRUE); +} + +void RemoveHistory( void ) +{ + + // delete history video objects from memory + DeleteVideoObjectFromIndex(guiLONGLINE); + DeleteVideoObjectFromIndex(guiTOP); + DeleteVideoObjectFromIndex(guiTITLE); + DeleteVideoObjectFromIndex(guiSHADELINE); + + return; +} + + +void RenderHistoryBackGround( void ) +{ + // render generic background for history system + HVOBJECT hHandle; + INT32 iCounter=0; + + // get title bar object + GetVideoObject(&hHandle, guiTITLE); + + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y -2 , VO_BLT_SRCTRANSPARENCY,NULL); + + + // get and blt the top part of the screen, video object and blt to screen + GetVideoObject(&hHandle, guiTOP); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X, TOP_Y + 22, VO_BLT_SRCTRANSPARENCY,NULL); + + // display background for history list + DisplayHistoryListBackground( ); + return; +} + +void DrawHistoryTitleText( void ) +{ + // setup the font stuff + SetFont(HISTORY_HEADER_FONT); + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + SetFontShadow(DEFAULT_SHADOW); + + // draw the pages title + mprintf(TITLE_X,TITLE_Y,pHistoryTitle[0]); + + return; +} + +void CreateHistoryButtons( void ) +{ + + // the prev page button + giHistoryButtonImage[PREV_PAGE_BUTTON]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); + giHistoryButton[PREV_PAGE_BUTTON] = QuickCreateButton( giHistoryButtonImage[PREV_PAGE_BUTTON], PREV_BTN_X, BTN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnHistoryDisplayPrevPageCallBack); + + // the next page button + giHistoryButtonImage[NEXT_PAGE_BUTTON]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,6,-1,7,-1 ); + giHistoryButton[NEXT_PAGE_BUTTON] = QuickCreateButton( giHistoryButtonImage[NEXT_PAGE_BUTTON], NEXT_BTN_X, BTN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnHistoryDisplayNextPageCallBack); + + + // set buttons + SetButtonCursor(giHistoryButton[0], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giHistoryButton[1], CURSOR_LAPTOP_SCREEN); + + return; +} + + +void DestroyHistoryButtons( void ) +{ + + // remove History buttons and images from memory + + // next page button + RemoveButton(giHistoryButton[1] ); + UnloadButtonImage(giHistoryButtonImage[1] ); + + // prev page button + RemoveButton(giHistoryButton[0] ); + UnloadButtonImage(giHistoryButtonImage[0] ); + + return; +} + +void BtnHistoryDisplayPrevPageCallBack(GUI_BUTTON *btn,INT32 reason) +{ + // force redraw + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + fReDrawScreenFlag=TRUE; + } + + + // force redraw + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + fReDrawScreenFlag=TRUE; + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // this page is > 0, there are pages before it, decrement + + if(iCurrentHistoryPage > 0) + { + LoadPreviousHistoryPage( ); + //iCurrentHistoryPage--; + DrawAPageofHistoryRecords( ); + } + + // set new state + SetHistoryButtonStates( ); + } + + +} + +void BtnHistoryDisplayNextPageCallBack(GUI_BUTTON *btn,INT32 reason) +{ + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + fReDrawScreenFlag=TRUE; + } + + + // force redraw + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + // increment currentPage + btn->uiFlags&=~(BUTTON_CLICKED_ON); + LoadNextHistoryPage( ); + // set new state + SetHistoryButtonStates( ); + fReDrawScreenFlag=TRUE; + } + + + +} + +BOOLEAN IncrementCurrentPageHistoryDisplay( void ) +{ + // run through list, from pCurrentHistory, to NUM_RECORDS_PER_PAGE +1 HistoryUnits + HistoryUnitPtr pTempHistory=pCurrentHistory; + BOOLEAN fOkToIncrementPage=FALSE; + INT32 iCounter=0; + HWFILE hFileHandle; + UINT32 uiFileSize=0; + UINT32 uiSizeOfRecordsOnEachPage = 0; + + if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) + return( FALSE ); + + // open file + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + return( FALSE ); + } + + // make sure file is more than 0 length + if ( FileGetSize( hFileHandle ) == 0 ) + { + FileClose( hFileHandle ); + return( FALSE ); + } + + uiFileSize = FileGetSize( hFileHandle ) - 1; + uiSizeOfRecordsOnEachPage = ( NUM_RECORDS_PER_PAGE * ( sizeof( UINT8 ) + sizeof( UINT32 ) + 3*sizeof( UINT8 )+ sizeof(INT16) + sizeof( INT16 ) ) ); + + // is the file long enough? +// if( ( FileGetSize( hFileHandle ) - 1 ) / ( NUM_RECORDS_PER_PAGE * ( sizeof( UINT8 ) + sizeof( UINT32 ) + 3*sizeof( UINT8 )+ sizeof(INT16) + sizeof( INT16 ) ) ) + 1 < ( UINT32 )( iCurrentHistoryPage + 1 ) ) + if( uiFileSize / uiSizeOfRecordsOnEachPage + 1 < ( UINT32 )( iCurrentHistoryPage + 1 ) ) + { + // nope + FileClose( hFileHandle ); + return( FALSE ); + } + else + { + iCurrentHistoryPage++; + FileClose( hFileHandle ); + } + + + /* + // haven't reached end of list and not yet at beginning of next page + while( ( pTempHistory )&&( ! fOkToIncrementPage ) ) + { + // found the next page, first record thereof + if(iCounter==NUM_RECORDS_PER_PAGE+1) + { + fOkToIncrementPage=TRUE; + pCurrentHistory=pTempHistory->Next; + } + + //next record + pTempHistory=pTempHistory->Next; + iCounter++; + } +*/ + // if ok to increment, increment + + + return( TRUE ); +} + + +UINT32 ProcessAndEnterAHistoryRecord( UINT8 ubCode, UINT32 uiDate, UINT8 ubSecondCode, INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ , UINT8 ubColor ) +{ + UINT32 uiId=0; + HistoryUnitPtr pHistory=pHistoryListHead; + + // add to History list + if(pHistory) + { + // go to end of list + while(pHistory->Next) + pHistory=pHistory->Next; + + // alloc space + pHistory->Next = (history *) MemAlloc(sizeof(HistoryUnit)); + + // increment id number + uiId = pHistory->uiIdNumber + 1; + + // set up information passed + pHistory = pHistory->Next; + pHistory->Next = NULL; + pHistory->ubCode = ubCode; + pHistory->ubSecondCode = ubSecondCode; + pHistory->uiDate = uiDate; + pHistory->uiIdNumber = uiId; + pHistory->sSectorX = sSectorX; + pHistory->sSectorY = sSectorY; + pHistory->bSectorZ = bSectorZ; + pHistory->ubColor = ubColor; + + } + else + { + // alloc space + pHistory = (HistoryUnitPtr) MemAlloc(sizeof(HistoryUnit)); + + // setup info passed + pHistory->Next = NULL; + pHistory->ubCode = ubCode; + pHistory->ubSecondCode = ubSecondCode; + pHistory->uiDate = uiDate; + pHistory->uiIdNumber = uiId; + pHistoryListHead = pHistory; + pHistory->sSectorX = sSectorX; + pHistory->sSectorY = sSectorY; + pHistory->bSectorZ = bSectorZ; + pHistory->ubColor = ubColor; + + } + + return uiId; +} + + +void OpenAndReadHistoryFile( void ) +{ + // this procedure will open and read in data to the History list + + HWFILE hFileHandle; + UINT8 ubCode, ubSecondCode; + UINT32 uiDate; + INT16 sSectorX, sSectorY; + INT8 bSectorZ = 0; + UINT8 ubColor; + INT32 iBytesRead=0; + UINT32 uiByteCount=0; + + // clear out the old list + ClearHistoryList( ); + + // no file, return + if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) + return; + + // open file + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + return; + } + + // make sure file is more than 0 length + if ( FileGetSize( hFileHandle ) == 0 ) + { + FileClose( hFileHandle ); + return; + } + + // file exists, read in data, continue until file end + while( FileGetSize( hFileHandle ) > uiByteCount) + { + // read in other data + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &sSectorX, sizeof(INT16), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &sSectorY, sizeof(INT16), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &bSectorZ, sizeof(INT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubColor, sizeof( UINT8 ), (UINT32 *)&iBytesRead ); + + #ifdef JA2TESTVERSION + //perform a check on the data to see if it is pooched + PerformCheckOnHistoryRecord( 1, sSectorX, sSectorY, bSectorZ ); + #endif + + // add transaction + ProcessAndEnterAHistoryRecord( ubCode, uiDate, ubSecondCode, sSectorX, sSectorY, bSectorZ, ubColor ); + + // increment byte counter + uiByteCount += SIZE_OF_HISTORY_FILE_RECORD; + } + + // close file + FileClose( hFileHandle ); + + return; +} + +BOOLEAN OpenAndWriteHistoryFile( void ) +{ + // this procedure will open and write out data from the History list + + HWFILE hFileHandle; + INT32 iBytesWritten=0; + HistoryUnitPtr pHistoryList=pHistoryListHead; + + + // open file + hFileHandle=FileOpen( HISTORY_DATA_FILE, FILE_ACCESS_WRITE|FILE_CREATE_ALWAYS, FALSE); + + // if no file exits, do nothing + if(!hFileHandle) + { + return ( FALSE ); + } + // write info, while there are elements left in the list + while(pHistoryList) + { + + #ifdef JA2TESTVERSION + //perform a check on the data to see if it is pooched + PerformCheckOnHistoryRecord( 2, pHistoryList->sSectorX, pHistoryList->sSectorY, pHistoryList->bSectorZ ); + #endif + + // now write date and amount, and code + FileWrite( hFileHandle, &(pHistoryList->ubCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->ubSecondCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->uiDate ), sizeof ( UINT32 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->sSectorX ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->sSectorY ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->bSectorZ ), sizeof ( INT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->ubColor ), sizeof ( UINT8 ), NULL ); + + // next element in list + pHistoryList = pHistoryList->Next; + + } + + // close file + FileClose( hFileHandle ); + // clear out the old list + ClearHistoryList( ); + + return ( TRUE ); +} + + +void ClearHistoryList( void ) +{ + // remove each element from list of transactions + + HistoryUnitPtr pHistoryList=pHistoryListHead; + HistoryUnitPtr pHistoryNode=pHistoryList; + + // while there are elements in the list left, delete them + while( pHistoryList ) + { + // set node to list head + pHistoryNode=pHistoryList; + + // set list head to next node + pHistoryList=pHistoryList->Next; + + // delete current node + MemFree(pHistoryNode); + } + pHistoryListHead=NULL; + + return; +} + +void DisplayHistoryListHeaders( void ) +{ + // this procedure will display the headers to each column in History + UINT16 usX, usY; + + // font stuff + SetFont(HISTORY_TEXT_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // the date header + FindFontCenterCoordinates(RECORD_DATE_X + 5,0,RECORD_DATE_WIDTH,0, pHistoryHeaders[0], HISTORY_TEXT_FONT,&usX, &usY); + mprintf(usX, RECORD_HEADER_Y, pHistoryHeaders[0]); + + // the date header + FindFontCenterCoordinates(RECORD_DATE_X + RECORD_DATE_WIDTH + 5,0,RECORD_LOCATION_WIDTH,0, pHistoryHeaders[ 3 ], HISTORY_TEXT_FONT,&usX, &usY); + mprintf(usX, RECORD_HEADER_Y, pHistoryHeaders[3]); + + // event header + FindFontCenterCoordinates(RECORD_DATE_X + RECORD_DATE_WIDTH + RECORD_LOCATION_WIDTH + 5,0,RECORD_LOCATION_WIDTH,0, pHistoryHeaders[ 3 ], HISTORY_TEXT_FONT,&usX, &usY); + mprintf(usX, RECORD_HEADER_Y, pHistoryHeaders[4]); + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + return; +} + + +void DisplayHistoryListBackground( void ) +{ + // this function will display the History list display background + HVOBJECT hHandle; + INT32 iCounter=0; + + + + // get shaded line object + GetVideoObject(&hHandle, guiSHADELINE); + for(iCounter=0; iCounter <11; iCounter++) + { + // blt title bar to screen + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 15, (TOP_DIVLINE_Y + BOX_HEIGHT * 2 * iCounter), VO_BLT_SRCTRANSPARENCY,NULL); + } + + // the long hortizontal line int he records list display region + GetVideoObject(&hHandle, guiLONGLINE); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 9, (TOP_DIVLINE_Y ), VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject(FRAME_BUFFER, hHandle, 0,TOP_X + 9, (TOP_DIVLINE_Y + BOX_HEIGHT * 2 * 11 ), VO_BLT_SRCTRANSPARENCY,NULL); + + + return; +} + +void DrawHistoryRecordsText( void ) +{ + // draws the text of the records + HistoryUnitPtr pCurHistory=pHistoryListHead; + HistoryUnitPtr pTempHistory=pHistoryListHead; + wchar_t sString[512]; + INT32 iCounter=0; + UINT16 usX, usY; + INT32 iBalance=0; + INT16 sX =0, sY =0; + + // setup the font stuff + SetFont(HISTORY_TEXT_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // error check + if( !pCurHistory) + return; + + + // loop through record list + for(iCounter; iCounter ubColor == 0 ) + { + SetFontForeground(FONT_BLACK); + } + else + { + SetFontForeground(FONT_RED); + } + // get and write the date + swprintf(sString, L"%d", ( pCurHistory->uiDate / ( 24 * 60 ) ) ); + FindFontCenterCoordinates(RECORD_DATE_X + 5, 0, RECORD_DATE_WIDTH,0, sString, HISTORY_TEXT_FONT,&usX, &usY); + mprintf(usX, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, sString); + + // now the actual history text + //FindFontCenterCoordinates(RECORD_DATE_X + RECORD_DATE_WIDTH,0,RECORD_HISTORY_WIDTH,0, pHistoryStrings[pCurHistory->ubCode], HISTORY_TEXT_FONT,&usX, &usY); + ProcessHistoryTransactionString(sString, pCurHistory); +// mprintf(RECORD_DATE_X + RECORD_DATE_WIDTH + 25, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, pHistoryStrings[pCurHistory->ubCode] ); + mprintf(RECORD_DATE_X + RECORD_LOCATION_WIDTH +RECORD_DATE_WIDTH + 15, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, sString ); + + + // no location + if( ( pCurHistory->sSectorX == -1 )||( pCurHistory->sSectorY == -1 ) ) + { + FindFontCenterCoordinates( RECORD_DATE_X + RECORD_DATE_WIDTH, 0,RECORD_LOCATION_WIDTH + 10, 0, pHistoryLocations[0] ,HISTORY_TEXT_FONT, &sX, &sY ); + mprintf(sX, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, pHistoryLocations[0] ); + } + else + { + GetSectorIDString( pCurHistory->sSectorX, pCurHistory->sSectorY, pCurHistory->bSectorZ, sString, TRUE ); + FindFontCenterCoordinates( RECORD_DATE_X + RECORD_DATE_WIDTH, 0, RECORD_LOCATION_WIDTH + 10, 0, sString ,HISTORY_TEXT_FONT, &sX, &sY ); + + ReduceStringLength( sString, RECORD_LOCATION_WIDTH + 10, HISTORY_TEXT_FONT ); + + mprintf(sX, RECORD_Y + ( iCounter * ( BOX_HEIGHT ) ) + 3, sString ); + } + + // restore font color + SetFontForeground(FONT_BLACK); + + // next History + pCurHistory = pCurHistory->Next; + + // last page, no Historys left, return + if( ! pCurHistory ) + { + + // restore shadow + SetFontShadow(DEFAULT_SHADOW); + return; + } + + } + + // restore shadow + SetFontShadow(DEFAULT_SHADOW); + return; +} + + +void DrawAPageofHistoryRecords( void ) +{ + // this procedure will draw a series of history records to the screen + INT32 iCurPage=1; + INT32 iCount=0; + pCurrentHistory=pHistoryListHead; + + // (re-)render background + + // the title bar text + DrawHistoryTitleText( ); + + // the actual lists background + DisplayHistoryListBackground( ); + + // the headers to each column + DisplayHistoryListHeaders( ); + + + // error check + if(iCurrentHistoryPage==-1) + { + iCurrentHistoryPage=0; + } + + + // current page is found, render from here + DrawHistoryRecordsText( ); + + // update page numbers, and date ranges + DisplayPageNumberAndDateRange( ); + + return; +} + +void DisplayPageNumberAndDateRange( void ) +{ + // this function will go through the list of 'histories' starting at current until end or + // MAX_PER_PAGE...it will get the date range and the page number + INT32 iLastPage=0; + INT32 iCounter=0; + UINT32 uiLastDate; + HistoryUnitPtr pTempHistory=pHistoryListHead; + wchar_t sString[50]; + + + + // setup the font stuff + SetFont(HISTORY_TEXT_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + if( !pCurrentHistory ) + { + swprintf( sString, L"%s %d / %d",pHistoryHeaders[1], 1, 1 ); + mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString ); + + swprintf( sString, L"%s %d - %d",pHistoryHeaders[2], 1 , 1 ); + mprintf( HISTORY_DATE_X, HISTORY_DATE_Y, sString ); + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + + return; + } + + uiLastDate=pCurrentHistory->uiDate; + +/* + // find last page + while(pTempHistory) + { + iCounter++; + pTempHistory=pTempHistory->Next; + } + + // set last page + iLastPage=iCounter/NUM_RECORDS_PER_PAGE; +*/ + + iLastPage = GetNumberOfHistoryPages(); + + // set temp to current, to get last date + pTempHistory=pCurrentHistory; + + // reset counter + iCounter=0; + + // run through list until end or num_records, which ever first + while((pTempHistory)&&(iCounter < NUM_RECORDS_PER_PAGE)) + { + uiLastDate=pTempHistory->uiDate; + iCounter++; + + pTempHistory = pTempHistory->Next; + } + + + + // get the last page + + swprintf( sString, L"%s %d / %d",pHistoryHeaders[1], iCurrentHistoryPage , iLastPage +1 ); + mprintf( PAGE_NUMBER_X, PAGE_NUMBER_Y, sString ); + + swprintf( sString, L"%s %d - %d",pHistoryHeaders[2], pCurrentHistory->uiDate / ( 24 * 60 ) , uiLastDate/( 24 * 60 ) ); + mprintf( HISTORY_DATE_X, HISTORY_DATE_Y, sString ); + + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + + return; +} + + +void ProcessHistoryTransactionString(STR16 pString, HistoryUnitPtr pHistory) +{ + CHAR16 sString[ 128 ]; + + switch( pHistory->ubCode) + { + case HISTORY_ENTERED_HISTORY_MODE: + swprintf(pString, pHistoryStrings[ HISTORY_ENTERED_HISTORY_MODE ]); + break; + + case HISTORY_HIRED_MERC_FROM_AIM: + swprintf(pString, pHistoryStrings[ HISTORY_HIRED_MERC_FROM_AIM ], gMercProfiles[pHistory->ubSecondCode].zName ); + break; + + case HISTORY_MERC_KILLED: + if( pHistory->ubSecondCode != NO_PROFILE ) + swprintf(pString, pHistoryStrings[ HISTORY_MERC_KILLED ], gMercProfiles[pHistory->ubSecondCode].zName ); +#ifdef JA2BETAVERSION + else + { + swprintf(pString, pHistoryStrings[ HISTORY_MERC_KILLED ], L"ERROR!!! NO_PROFILE" ); + } +#endif + break; + + case HISTORY_HIRED_MERC_FROM_MERC: + swprintf(pString, pHistoryStrings[ HISTORY_HIRED_MERC_FROM_MERC ], gMercProfiles[pHistory->ubSecondCode].zName ); + break; + + case HISTORY_SETTLED_ACCOUNTS_AT_MERC: + swprintf(pString, pHistoryStrings[ HISTORY_SETTLED_ACCOUNTS_AT_MERC ] ); + break; + case HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO: + swprintf(pString, pHistoryStrings[ HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO ] ); + break; + case( HISTORY_CHARACTER_GENERATED ): + swprintf(pString, pHistoryStrings[ HISTORY_CHARACTER_GENERATED ] ); + break; + case( HISTORY_PURCHASED_INSURANCE ): + swprintf(pString, pHistoryStrings[ HISTORY_PURCHASED_INSURANCE ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + break; + case( HISTORY_CANCELLED_INSURANCE ): + swprintf(pString, pHistoryStrings[ HISTORY_CANCELLED_INSURANCE ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + break; + case( HISTORY_INSURANCE_CLAIM_PAYOUT ): + swprintf(pString, pHistoryStrings[ HISTORY_INSURANCE_CLAIM_PAYOUT ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + break; + + case HISTORY_EXTENDED_CONTRACT_1_DAY: + swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_1_DAY ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + break; + + case HISTORY_EXTENDED_CONTRACT_1_WEEK: + swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_1_WEEK ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + break; + + case HISTORY_EXTENDED_CONTRACT_2_WEEK: + swprintf(pString, pHistoryStrings[ HISTORY_EXTENDED_CONTRACT_2_WEEK ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + break; + + case( HISTORY_MERC_FIRED ): + swprintf(pString, pHistoryStrings[ HISTORY_MERC_FIRED ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + break; + + case( HISTORY_MERC_QUIT ): + swprintf(pString, pHistoryStrings[ HISTORY_MERC_QUIT ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + break; + + case( HISTORY_QUEST_STARTED ): + GetQuestStartedString( pHistory->ubSecondCode, sString ); + swprintf(pString, sString ); + + break; + case( HISTORY_QUEST_FINISHED ): + GetQuestEndedString( pHistory->ubSecondCode, sString ); + swprintf(pString, sString ); + + break; + case( HISTORY_TALKED_TO_MINER ): + swprintf(pString, pHistoryStrings[ HISTORY_TALKED_TO_MINER ], pTownNames[ pHistory->ubSecondCode ] ); + break; + case( HISTORY_LIBERATED_TOWN ): + swprintf(pString, pHistoryStrings[ HISTORY_LIBERATED_TOWN ], pTownNames[ pHistory->ubSecondCode ] ); + break; + case( HISTORY_CHEAT_ENABLED ): + swprintf(pString, pHistoryStrings[ HISTORY_CHEAT_ENABLED ] ); + break; + case HISTORY_TALKED_TO_FATHER_WALKER: + swprintf( pString, pHistoryStrings[ HISTORY_TALKED_TO_FATHER_WALKER ] ); + break; + case HISTORY_MERC_MARRIED_OFF: + swprintf( pString, pHistoryStrings[ HISTORY_MERC_MARRIED_OFF ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + break; + case HISTORY_MERC_CONTRACT_EXPIRED: + swprintf( pString, pHistoryStrings[ HISTORY_MERC_CONTRACT_EXPIRED ], gMercProfiles[pHistory->ubSecondCode].zName ); + break; + case HISTORY_RPC_JOINED_TEAM: + swprintf( pString, pHistoryStrings[ HISTORY_RPC_JOINED_TEAM ], gMercProfiles[pHistory->ubSecondCode].zName ); + break; + case HISTORY_ENRICO_COMPLAINED: + swprintf( pString, pHistoryStrings[ HISTORY_ENRICO_COMPLAINED ] ); + break; + case HISTORY_MINE_RUNNING_OUT: + case HISTORY_MINE_RAN_OUT: + case HISTORY_MINE_SHUTDOWN: + case HISTORY_MINE_REOPENED: + // all the same format + swprintf(pString, pHistoryStrings[ pHistory->ubCode ], pTownNames[ pHistory->ubSecondCode ] ); + break; + case HISTORY_LOST_BOXING: + case HISTORY_WON_BOXING: + case HISTORY_DISQUALIFIED_BOXING: + case HISTORY_NPC_KILLED: + case HISTORY_MERC_KILLED_CHARACTER: + swprintf( pString, pHistoryStrings[ pHistory->ubCode ], gMercProfiles[pHistory->ubSecondCode].zNickname ); + break; + + // ALL SIMPLE HISTORY LOG MSGS, NO PARAMS + case HISTORY_FOUND_MONEY: + case HISTORY_ASSASSIN: + case HISTORY_DISCOVERED_TIXA: + case HISTORY_DISCOVERED_ORTA: + case HISTORY_GOT_ROCKET_RIFLES: + case HISTORY_DEIDRANNA_DEAD_BODIES: + case HISTORY_BOXING_MATCHES: + case HISTORY_SOMETHING_IN_MINES: + case HISTORY_DEVIN: + case HISTORY_MIKE: + case HISTORY_TONY: + case HISTORY_KROTT: + case HISTORY_KYLE: + case HISTORY_MADLAB: + case HISTORY_GABBY: + case HISTORY_KEITH_OUT_OF_BUSINESS: + case HISTORY_HOWARD_CYANIDE: + case HISTORY_KEITH: + case HISTORY_HOWARD: + case HISTORY_PERKO: + case HISTORY_SAM: + case HISTORY_FRANZ: + case HISTORY_ARNOLD: + case HISTORY_FREDO: + case HISTORY_RICHGUY_BALIME: + case HISTORY_JAKE: + case HISTORY_BUM_KEYCARD: + case HISTORY_WALTER: + case HISTORY_DAVE: + case HISTORY_PABLO: + case HISTORY_KINGPIN_MONEY: + //VARIOUS BATTLE CONDITIONS + case HISTORY_LOSTTOWNSECTOR: + case HISTORY_DEFENDEDTOWNSECTOR: + case HISTORY_LOSTBATTLE: + case HISTORY_WONBATTLE: + case HISTORY_FATALAMBUSH: + case HISTORY_WIPEDOUTENEMYAMBUSH: + case HISTORY_UNSUCCESSFULATTACK: + case HISTORY_SUCCESSFULATTACK: + case HISTORY_CREATURESATTACKED: + case HISTORY_KILLEDBYBLOODCATS: + case HISTORY_SLAUGHTEREDBLOODCATS: + case HISTORY_GAVE_CARMEN_HEAD: + case HISTORY_SLAY_MYSTERIOUSLY_LEFT: + swprintf( pString, pHistoryStrings[ pHistory->ubCode ] ); + break; + } +} + + +void DrawHistoryLocation( INT16 sSectorX, INT16 sSectorY ) +{ + // will draw the location of the history event + + + return; +} + + +void SetHistoryButtonStates( void ) +{ + // this function will look at what page we are viewing, enable and disable buttons as needed + + if( iCurrentHistoryPage == 1 ) + { + // first page, disable left buttons + DisableButton( giHistoryButton[PREV_PAGE_BUTTON] ); + + } + else + { + // enable buttons + EnableButton( giHistoryButton[PREV_PAGE_BUTTON] ); + + } + + if( IncrementCurrentPageHistoryDisplay( ) ) + { + // decrement page + iCurrentHistoryPage--; + DrawAPageofHistoryRecords( ); + + // enable buttons + EnableButton( giHistoryButton[ NEXT_PAGE_BUTTON ] ); + + } + else + { + DisableButton( giHistoryButton[ NEXT_PAGE_BUTTON ] ); + } +} + + +BOOLEAN LoadInHistoryRecords( UINT32 uiPage ) +{ + // loads in records belogning, to page uiPage + // no file, return + BOOLEAN fOkToContinue=TRUE; + INT32 iCount =0; + HWFILE hFileHandle; + UINT8 ubCode, ubSecondCode; + INT16 sSectorX, sSectorY; + INT8 bSectorZ; + UINT32 uiDate; + UINT8 ubColor; + INT32 iBytesRead=0; + UINT32 uiByteCount=0; + + // check if bad page + if( uiPage == 0 ) + { + return ( FALSE ); + } + + + if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) + return( FALSE ); + + // open file + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + return( FALSE ); + } + + // make sure file is more than 0 length + if ( FileGetSize( hFileHandle ) == 0 ) + { + FileClose( hFileHandle ); + return( FALSE ); + } + + // is the file long enough? + if( ( FileGetSize( hFileHandle ) - 1 ) / ( NUM_RECORDS_PER_PAGE * SIZE_OF_HISTORY_FILE_RECORD ) + 1 < uiPage ) + { + // nope + FileClose( hFileHandle ); + return( FALSE ); + } + + FileSeek( hFileHandle, ( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * ( SIZE_OF_HISTORY_FILE_RECORD), FILE_SEEK_FROM_START ); + + uiByteCount = ( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * (SIZE_OF_HISTORY_FILE_RECORD ); + // file exists, read in data, continue until end of page + while( ( iCount < NUM_RECORDS_PER_PAGE )&&( fOkToContinue ) ) + { + + // read in other data + FileRead( hFileHandle, &ubCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubSecondCode, sizeof(UINT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &uiDate, sizeof(UINT32), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &sSectorX, sizeof(INT16), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &sSectorY, sizeof(INT16), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &bSectorZ, sizeof(INT8), (UINT32 *)&iBytesRead ); + FileRead( hFileHandle, &ubColor, sizeof(UINT8), (UINT32 *)&iBytesRead ); + + #ifdef JA2TESTVERSION + //perform a check on the data to see if it is pooched + PerformCheckOnHistoryRecord( 3, sSectorX, sSectorY, bSectorZ ); + #endif + + // add transaction + ProcessAndEnterAHistoryRecord(ubCode, uiDate, ubSecondCode, sSectorX, sSectorY, bSectorZ, ubColor); + + // increment byte counter + uiByteCount += SIZE_OF_HISTORY_FILE_RECORD; + + // we've overextended our welcome, and bypassed end of file, get out + if( uiByteCount >= FileGetSize( hFileHandle ) ) + { + // not ok to continue + fOkToContinue = FALSE; + } + + iCount++; + } + + // close file + FileClose( hFileHandle ); + + // check to see if we in fact have a list to display + if( pHistoryListHead == NULL ) + { + // got no records, return false + return( FALSE ); + } + + // set up current finance + pCurrentHistory = pHistoryListHead; + + return( TRUE ); +} + + +BOOLEAN WriteOutHistoryRecords( UINT32 uiPage ) +{ + // loads in records belogning, to page uiPage + // no file, return + BOOLEAN fOkToContinue=TRUE; + INT32 iCount =0; + HWFILE hFileHandle; + HistoryUnitPtr pList; + INT32 iBytesRead=0; + UINT32 uiByteCount=0; + + // check if bad page + if( uiPage == 0 ) + { + return ( FALSE ); + } + + + if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) + return( FALSE ); + + // open file + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_WRITE ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + return( FALSE ); + } + + // make sure file is more than 0 length + if ( FileGetSize( hFileHandle ) == 0 ) + { + FileClose( hFileHandle ); + return( FALSE ); + } + + // is the file long enough? + if( ( FileGetSize( hFileHandle ) - 1 ) / ( NUM_RECORDS_PER_PAGE * SIZE_OF_HISTORY_FILE_RECORD ) + 1 < uiPage ) + { + // nope + FileClose( hFileHandle ); + return( FALSE ); + } + + pList = pHistoryListHead; + + if( pList == NULL ) + { + return( FALSE ); + } + + FileSeek( hFileHandle, sizeof( INT32 ) + ( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * SIZE_OF_HISTORY_FILE_RECORD, FILE_SEEK_FROM_START ); + + uiByteCount = /*sizeof( INT32 )+ */( uiPage - 1 ) * NUM_RECORDS_PER_PAGE * SIZE_OF_HISTORY_FILE_RECORD; + // file exists, read in data, continue until end of page + while( ( iCount < NUM_RECORDS_PER_PAGE )&&( fOkToContinue ) ) + { + + #ifdef JA2TESTVERSION + //perform a check on the data to see if it is pooched + PerformCheckOnHistoryRecord( 4, pList->sSectorX, pList->sSectorY, pList->bSectorZ ); + #endif + + FileWrite( hFileHandle, &(pList->ubCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pList->ubSecondCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pList->uiDate ), sizeof ( UINT32 ), NULL ); + FileWrite( hFileHandle, &(pList->sSectorX ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pList->sSectorY ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pList->bSectorZ ), sizeof ( INT8 ), NULL ); + FileWrite( hFileHandle, &(pList->ubColor ), sizeof ( UINT8 ), NULL ); + + pList = pList->Next; + + // we've overextended our welcome, and bypassed end of file, get out + if( pList == NULL ) + { + // not ok to continue + fOkToContinue = FALSE; + } + + iCount++; + } + + // close file + FileClose( hFileHandle ); + + ClearHistoryList( ); + + return( TRUE ); +} + +BOOLEAN LoadNextHistoryPage( void ) +{ + + // clear out old list of records, and load in previous page worth of records + ClearHistoryList( ); + + + + // now load in previous page's records, if we can + if ( LoadInHistoryRecords( iCurrentHistoryPage + 1 ) ) + { + iCurrentHistoryPage++; + return ( TRUE ); + } + else + { + LoadInHistoryRecords( iCurrentHistoryPage ); + return ( FALSE ); + } + +} + + +BOOLEAN LoadPreviousHistoryPage( void ) +{ + + // clear out old list of records, and load in previous page worth of records + ClearHistoryList( ); + + // load previous page + if( ( iCurrentHistoryPage == 1 ) ) + { + return ( FALSE ); + } + + // now load in previous page's records, if we can + if ( LoadInHistoryRecords( iCurrentHistoryPage - 1 ) ) + { + iCurrentHistoryPage--; + return ( TRUE ); + } + else + { + LoadInHistoryRecords( iCurrentHistoryPage ); + return ( FALSE ); + } +} + + +void SetLastPageInHistoryRecords( void ) +{ + // grabs the size of the file and interprets number of pages it will take up + HWFILE hFileHandle; + INT32 iBytesRead=0; + + // no file, return + if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) + return; + + // open file + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + guiLastPageInHistoryRecordsList = 1; + return; + } + + // make sure file is more than 0 length + if ( FileGetSize( hFileHandle ) == 0 ) + { + FileClose( hFileHandle ); + guiLastPageInHistoryRecordsList = 1; + return; + } + + + // done with file, close it + FileClose( hFileHandle ); + + guiLastPageInHistoryRecordsList = ReadInLastElementOfHistoryListAndReturnIdNumber( ) / NUM_RECORDS_PER_PAGE; + + return; +} + +UINT32 ReadInLastElementOfHistoryListAndReturnIdNumber( void ) +{ + // this function will read in the last unit in the history list, to grab it's id number + + + HWFILE hFileHandle; + INT32 iBytesRead=0; + INT32 iFileSize = 0; + + // no file, return + if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) + return 0; + + // open file + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + return 0; + } + + // make sure file is more than balance size + length of 1 record - 1 byte + if ( FileGetSize( hFileHandle ) < SIZE_OF_HISTORY_FILE_RECORD ) + { + FileClose( hFileHandle ); + return 0; + } + + // size is? + iFileSize = FileGetSize( hFileHandle ); + + // done with file, close it + FileClose( hFileHandle ); + + // file size / sizeof record in bytes is id + return ( ( iFileSize ) / ( SIZE_OF_HISTORY_FILE_RECORD ) ); + +} + + +BOOLEAN AppendHistoryToEndOfFile( HistoryUnitPtr pHistory ) +{ + // will write the current finance to disk + HWFILE hFileHandle; + INT32 iBytesWritten=0; + HistoryUnitPtr pHistoryList=pHistoryListHead; + + + // open file + hFileHandle=FileOpen( HISTORY_DATA_FILE, FILE_ACCESS_WRITE|FILE_OPEN_ALWAYS, FALSE); + + // if no file exits, do nothing + if(!hFileHandle) + { + return ( FALSE ); + } + + // go to the end + if( FileSeek( hFileHandle,0,FILE_SEEK_FROM_END ) == FALSE ) + { + // error + FileClose( hFileHandle ); + return( FALSE ); + } + + #ifdef JA2TESTVERSION + //perform a check on the data to see if it is pooched + PerformCheckOnHistoryRecord( 5, pHistoryList->sSectorX, pHistoryList->sSectorY, pHistoryList->bSectorZ ); + #endif + + + // now write date and amount, and code + FileWrite( hFileHandle, &(pHistoryList->ubCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->ubSecondCode ), sizeof ( UINT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->uiDate ), sizeof ( UINT32 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->sSectorX ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->sSectorY ), sizeof ( INT16 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->bSectorZ ), sizeof ( INT8 ), NULL ); + FileWrite( hFileHandle, &(pHistoryList->ubColor ), sizeof ( UINT8 ), NULL ); + + + // close file + FileClose( hFileHandle ); + + return( TRUE ); +} + +void ResetHistoryFact( UINT8 ubCode, INT16 sSectorX, INT16 sSectorY ) +{ + // run through history list + INT32 iOldHistoryPage = iCurrentHistoryPage; + HistoryUnitPtr pList = pHistoryListHead; + BOOLEAN fFound = FALSE; + + // set current page to before list + iCurrentHistoryPage = 0; + + SetLastPageInHistoryRecords( ); + + OpenAndReadHistoryFile( ); + + pList = pHistoryListHead; + + while( pList ) + { + if( ( pList -> ubSecondCode == ubCode ) && ( pList->ubCode == HISTORY_QUEST_STARTED ) ) + { + // reset color + pList -> ubColor = 0; + fFound = TRUE; + + // save + OpenAndWriteHistoryFile( ); + pList = NULL; + } + + if( fFound != TRUE ) + { + pList = pList->Next; + } + } + + if( fInHistoryMode ) + { + iCurrentHistoryPage--; + + // load in first page + LoadNextHistoryPage( ); + } + + SetHistoryFact( HISTORY_QUEST_FINISHED, ubCode, GetWorldTotalMin(), sSectorX, sSectorY ); + return; +} + + +UINT32 GetTimeQuestWasStarted( UINT8 ubCode ) +{ + // run through history list + INT32 iOldHistoryPage = iCurrentHistoryPage; + HistoryUnitPtr pList = pHistoryListHead; + BOOLEAN fFound = FALSE; + UINT32 uiTime = 0; + + // set current page to before list + iCurrentHistoryPage = 0; + + SetLastPageInHistoryRecords( ); + + OpenAndReadHistoryFile( ); + + pList = pHistoryListHead; + + while( pList ) + { + if( ( pList -> ubSecondCode == ubCode ) && ( pList->ubCode == HISTORY_QUEST_STARTED ) ) + { + uiTime = pList->uiDate; + fFound = TRUE; + + pList = NULL; + } + + if( fFound != TRUE ) + { + pList = pList->Next; + } + } + + if( fInHistoryMode ) + { + iCurrentHistoryPage--; + + // load in first page + LoadNextHistoryPage( ); + } + + return( uiTime ); +} + +void GetQuestStartedString( UINT8 ubQuestValue, STR16 sQuestString ) +{ + // open the file and copy the string + LoadEncryptedDataFromFile( "BINARYDATA\\quests.edt", sQuestString, 160 * ( ubQuestValue * 2 ), 160 ); +} + + +void GetQuestEndedString( UINT8 ubQuestValue, STR16 sQuestString ) +{ + // open the file and copy the string + LoadEncryptedDataFromFile( "BINARYDATA\\quests.edt", sQuestString, 160 * ( ( ubQuestValue * 2 ) + 1), 160 ); +} + + +#ifdef JA2TESTVERSION +void PerformCheckOnHistoryRecord( UINT32 uiErrorCode, INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) +{ + CHAR zString[512]; + + if( sSectorX > 16 || sSectorY > 16 || bSectorZ > 3 || sSectorX < -1 || sSectorY < -1 || bSectorZ < 0 ) + { + sprintf( zString, "History page is pooched, please remember what you were just doing, send your latest save to dave, and tell him this number, Error #%d.", uiErrorCode ); + AssertMsg( 0, zString ); + } +} +#endif + +INT32 GetNumberOfHistoryPages() +{ + HWFILE hFileHandle; + UINT32 uiFileSize=0; + UINT32 uiSizeOfRecordsOnEachPage = 0; + INT32 iNumberOfHistoryPages = 0; + + if ( ! (FileExists( HISTORY_DATA_FILE ) ) ) + return( 0 ); + + // open file + hFileHandle=FileOpen( HISTORY_DATA_FILE,( FILE_OPEN_EXISTING | FILE_ACCESS_READ ), FALSE ); + + // failed to get file, return + if(!hFileHandle) + { + return( 0 ); + } + + // make sure file is more than 0 length + if ( FileGetSize( hFileHandle ) == 0 ) + { + FileClose( hFileHandle ); + return( 0 ); + } + + uiFileSize = FileGetSize( hFileHandle ) - 1; + uiSizeOfRecordsOnEachPage = ( NUM_RECORDS_PER_PAGE * ( sizeof( UINT8 ) + sizeof( UINT32 ) + 3*sizeof( UINT8 )+ sizeof(INT16) + sizeof( INT16 ) ) ); + + iNumberOfHistoryPages = (INT32)( uiFileSize / uiSizeOfRecordsOnEachPage ); + + FileClose( hFileHandle ); + + return( iNumberOfHistoryPages ); +} + + + + + + diff --git a/Laptop/history.h b/Laptop/history.h new file mode 100644 index 00000000..09b64cd5 --- /dev/null +++ b/Laptop/history.h @@ -0,0 +1,129 @@ +#ifndef __HISTORY_H +#define __HISTORY_H + +void GameInitHistory(); +void EnterHistory(); +void ExitHistory(); +void HandleHistory(); +void RenderHistory(); + + +#define HISTORY_DATA_FILE "TEMP\\History.dat" + +// the financial structure +struct history{ + UINT8 ubCode; // the code index in the finance code table + UINT32 uiIdNumber; // unique id number + UINT8 ubSecondCode; // secondary code + UINT32 uiDate; // time in the world in global time + INT16 sSectorX; // sector X this took place in + INT16 sSectorY; // sector Y this took place in + INT8 bSectorZ; + UINT8 ubColor; + struct history *Next; // next unit in the list +}; + + +enum{ + HISTORY_ENTERED_HISTORY_MODE=0, + HISTORY_HIRED_MERC_FROM_AIM, + HISTORY_HIRED_MERC_FROM_MERC, + HISTORY_MERC_KILLED, + HISTORY_SETTLED_ACCOUNTS_AT_MERC, + HISTORY_ACCEPTED_ASSIGNMENT_FROM_ENRICO, + HISTORY_CHARACTER_GENERATED, + HISTORY_PURCHASED_INSURANCE, + HISTORY_CANCELLED_INSURANCE, + HISTORY_INSURANCE_CLAIM_PAYOUT, + HISTORY_EXTENDED_CONTRACT_1_DAY, + HISTORY_EXTENDED_CONTRACT_1_WEEK, + HISTORY_EXTENDED_CONTRACT_2_WEEK, + HISTORY_MERC_FIRED, + HISTORY_MERC_QUIT, + HISTORY_QUEST_STARTED, + HISTORY_QUEST_FINISHED, + HISTORY_TALKED_TO_MINER, + HISTORY_LIBERATED_TOWN, + HISTORY_CHEAT_ENABLED, + HISTORY_TALKED_TO_FATHER_WALKER, + HISTORY_MERC_MARRIED_OFF, + HISTORY_MERC_CONTRACT_EXPIRED, + HISTORY_RPC_JOINED_TEAM, + HISTORY_ENRICO_COMPLAINED, + HISTORY_WONBATTLE, + HISTORY_MINE_RUNNING_OUT, + HISTORY_MINE_RAN_OUT, + HISTORY_MINE_SHUTDOWN, + HISTORY_MINE_REOPENED, + HISTORY_DISCOVERED_TIXA, + HISTORY_DISCOVERED_ORTA, + HISTORY_GOT_ROCKET_RIFLES, + HISTORY_DEIDRANNA_DEAD_BODIES, + HISTORY_BOXING_MATCHES, + HISTORY_SOMETHING_IN_MINES, + HISTORY_DEVIN, + HISTORY_MIKE, + HISTORY_TONY, + HISTORY_KROTT, + HISTORY_KYLE, + HISTORY_MADLAB, + HISTORY_GABBY, + HISTORY_KEITH_OUT_OF_BUSINESS, + HISTORY_HOWARD_CYANIDE, + HISTORY_KEITH, + HISTORY_HOWARD, + HISTORY_PERKO, + HISTORY_SAM, + HISTORY_FRANZ, + HISTORY_ARNOLD, + HISTORY_FREDO, + HISTORY_RICHGUY_BALIME, + HISTORY_JAKE, + HISTORY_BUM_KEYCARD, + HISTORY_WALTER, + HISTORY_DAVE, + HISTORY_PABLO, + HISTORY_KINGPIN_MONEY, + HISTORY_WON_BOXING, + HISTORY_LOST_BOXING, + HISTORY_DISQUALIFIED_BOXING, + HISTORY_FOUND_MONEY, + HISTORY_ASSASSIN, + HISTORY_LOSTTOWNSECTOR, + HISTORY_DEFENDEDTOWNSECTOR, + HISTORY_LOSTBATTLE, + HISTORY_FATALAMBUSH, + HISTORY_WIPEDOUTENEMYAMBUSH, + HISTORY_UNSUCCESSFULATTACK, + HISTORY_SUCCESSFULATTACK, + HISTORY_CREATURESATTACKED, + HISTORY_KILLEDBYBLOODCATS, + HISTORY_SLAUGHTEREDBLOODCATS, + HISTORY_NPC_KILLED, + HISTORY_GAVE_CARMEN_HEAD, + HISTORY_SLAY_MYSTERIOUSLY_LEFT, + HISTORY_MERC_KILLED_CHARACTER, +}; + +typedef struct history HistoryUnit; +typedef struct history *HistoryUnitPtr; + +extern HistoryUnitPtr pHistoryListHead; + +// reset history fact..for quests +void ResetHistoryFact( UINT8 ubCode, INT16 sSectorX, INT16 sSectorY ); + +// set history fact...to allow for a different color for in progress quests +UINT32 SetHistoryFact( UINT8 ubCode, UINT8 ubSecondCode, UINT32 uiDate, INT16 sSectorX, INT16 sSectorY ); + + +UINT32 AddHistoryToPlayersLog(UINT8 ubCode, UINT8 ubSecondCode, UINT32 uiDate, INT16 sSectorX, INT16 sSectorY ); +UINT32 GetTimeQuestWasStarted( UINT8 ubCode ); + +#endif + + + + + + diff --git a/Laptop/insurance Comments.cpp b/Laptop/insurance Comments.cpp new file mode 100644 index 00000000..db0211ea --- /dev/null +++ b/Laptop/insurance Comments.cpp @@ -0,0 +1,218 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "Insurance Text.h" + #include "insurance.h" + #include "insurance Comments.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Text.h" +#endif + + +#define INS_CMNT_TITLE_Y 52 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_CMNT_FIRST_BULLET_X 82 + LAPTOP_SCREEN_UL_X +#define INS_CMNT_FIRST_BULLET_Y 75 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_CMNT_REDLINE_WIDTH 384 + +#define INS_CMNT_COMMENT_OFFSET_Y 20 + +#define INS_CMNT_NEXT_COMMENT_OFFSET_Y 65 + +#define INS_CMNT_COMMENT_TEXT_WIDTH 364 + +#define INS_CMNT_LINK_Y 357 + LAPTOP_SCREEN_WEB_UL_Y +#define INS_CMNT_LINK_WIDTH 90 +#define INS_CMNT_LINK_HEIGHT 35 +#define INS_CMNT_LINK_OFFSET_X 166 + + + +UINT32 guiInsCmntBulletImage; + + +//link to the varios pages +MOUSE_REGION gSelectedInsuranceCommentLinkRegion[3]; +void SelectInsuranceCommentLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + + +BOOLEAN DisplayComment( UINT8 ubCommentorsName, UINT8 ubComment, UINT16 usPosY ); + + + +void GameInitInsuranceComments() +{ + +} + +BOOLEAN EnterInsuranceComments() +{ + VOBJECT_DESC VObjectDesc; + UINT8 i; + UINT16 usPosX; + + InitInsuranceDefaults(); + + // load the Insurance bullet graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\bullet.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsCmntBulletImage)); + + usPosX = INS_CMNT_FIRST_BULLET_X-6; + for( i=0; i<3; i++) + { + MSYS_DefineRegion( &gSelectedInsuranceCommentLinkRegion[i], usPosX, INS_CMNT_LINK_Y-1, (UINT16)(usPosX + INS_CMNT_LINK_WIDTH), INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT+1, MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceCommentLinkRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceCommentLinkRegion[i]); + MSYS_SetRegionUserData( &gSelectedInsuranceCommentLinkRegion[i], 0, i ); + + usPosX += INS_CMNT_LINK_OFFSET_X; + } + + + + + RenderInsuranceComments(); + + return(TRUE); +} + +void ExitInsuranceComments() +{ + UINT8 i; + RemoveInsuranceDefaults(); + DeleteVideoObjectFromIndex( guiInsCmntBulletImage ); + + for(i=0; i<3; i++) + MSYS_RemoveRegion( &gSelectedInsuranceCommentLinkRegion[i]); +} + +void HandleInsuranceComments() +{ + +} + +void RenderInsuranceComments() +{ +// HVOBJECT hPixHandle; + wchar_t sText[800]; + UINT16 usPosX, usPosY; + + SetFontShadow( INS_FONT_SHADOW ); + + DisplayInsuranceDefaults(); + + //Display the title slogan + GetInsuranceText( INS_SNGL_COMMENTSFROM_CLIENTS, sText ); + DrawTextToScreen( sText, LAPTOP_SCREEN_UL_X, INS_CMNT_TITLE_Y, LAPTOP_SCREEN_LR_X-LAPTOP_SCREEN_UL_X, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + + usPosY = INS_CMNT_FIRST_BULLET_Y; + + //Display the commnet from Gus + DisplayComment( INS_SNGL_GUS_TARBALLS, INS_MLTI_GUS_SPEECH, usPosY ); + + usPosY += INS_CMNT_NEXT_COMMENT_OFFSET_Y; + + //Display the commnet from ali hussean + DisplayComment( INS_SNGL_ALI_HUSSEAN, INS_MLTI_ALI_HUSSEAN_SPEECH, usPosY ); + + usPosY += INS_CMNT_NEXT_COMMENT_OFFSET_Y; + + + //Display the commnet from Lance allot + DisplayComment( INS_SNGL_LANCE_ALLOT, INS_MLTI_LANCE_ALLOT_SPEECH, usPosY ); + + usPosY += INS_CMNT_NEXT_COMMENT_OFFSET_Y; + + //Display the commnet from Fred Cousteau + DisplayComment( INS_SNGL_FRED_COUSTEAU, INS_MLTI_FRED_COUSTEAU_SPEECH, usPosY ); + + + //Display the link text + usPosX = INS_CMNT_FIRST_BULLET_X-6; + + //Display the first link text + swprintf( sText, L"%s", pMessageStrings[ MSG_HOMEPAGE ] ); + DisplayWrappedString( usPosX, INS_CMNT_LINK_Y+13, INS_CMNT_LINK_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + //Display the red bar under the link at the bottom + DisplaySmallRedLineWithShadow( usPosX, INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT, (UINT16)(usPosX+INS_CMNT_LINK_WIDTH), INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT); + usPosX += INS_CMNT_LINK_OFFSET_X; + + + //Display the third link text + GetInsuranceText( INS_SNGL_HOW_DOES_INS_WORK, sText ); + DisplayWrappedString( usPosX, INS_CMNT_LINK_Y+6, INS_CMNT_LINK_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + //Display the red bar under the link at the bottom + DisplaySmallRedLineWithShadow( usPosX, INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT, (UINT16)(usPosX+INS_CMNT_LINK_WIDTH), INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT); + usPosX += INS_CMNT_LINK_OFFSET_X; + + //Display the fourth link text + GetInsuranceText( INS_SNGL_TO_ENTER_REVIEW, sText ); + DisplayWrappedString( usPosX, INS_CMNT_LINK_Y-1, INS_CMNT_LINK_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + //Display the red bar under the link at the bottom + DisplaySmallRedLineWithShadow( usPosX, INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT, (UINT16)(usPosX+INS_CMNT_LINK_WIDTH), INS_CMNT_LINK_Y+INS_CMNT_LINK_HEIGHT); + + SetFontShadow(DEFAULT_SHADOW); + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + +void SelectInsuranceCommentLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + UINT32 uiInsuranceLink = MSYS_GetRegionUserData( pRegion, 0 ); + + if( uiInsuranceLink == 0 ) + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE; + else if( uiInsuranceLink == 1 ) + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE_INFO; + else if( uiInsuranceLink == 2 ) + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE_CONTRACT; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + +BOOLEAN DisplayComment( UINT8 ubCommentorsName, UINT8 ubComment, UINT16 usPosY ) +{ + wchar_t sText[800]; + HVOBJECT hPixHandle; + UINT16 sNumPixels=0; + + + //Get and display the insurance bullet + GetVideoObject(&hPixHandle, guiInsCmntBulletImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_CMNT_FIRST_BULLET_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); + + //Display the commenters comment + GetInsuranceText( ubComment, sText ); //+INS_CMNT_COMMENT_OFFSET_Y + sNumPixels = DisplayWrappedString( INS_CMNT_FIRST_BULLET_X+INSURANCE_BULLET_TEXT_OFFSET_X, (UINT16)(usPosY), INS_CMNT_COMMENT_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + //Display the red bar under the link at the bottom + DisplaySmallRedLineWithShadow( INS_CMNT_FIRST_BULLET_X+INSURANCE_BULLET_TEXT_OFFSET_X, (UINT16)(usPosY+sNumPixels), INS_CMNT_FIRST_BULLET_X+INS_CMNT_REDLINE_WIDTH, (UINT16)(usPosY+sNumPixels)); + + sNumPixels += 4; + + //Display the commenters name + GetInsuranceText( ubCommentorsName, sText ); + DrawTextToScreen( sText, INS_CMNT_FIRST_BULLET_X+INSURANCE_BULLET_TEXT_OFFSET_X, (UINT16)(usPosY+sNumPixels), INS_CMNT_REDLINE_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + + return( TRUE ); +} + + diff --git a/Laptop/insurance Comments.h b/Laptop/insurance Comments.h new file mode 100644 index 00000000..b2b32ac7 --- /dev/null +++ b/Laptop/insurance Comments.h @@ -0,0 +1,10 @@ +#ifndef __INSURANCE_COMMENTS_H +#define __INSURANCE_COMMENTS_H + +void GameInitInsuranceComments(); +BOOLEAN EnterInsuranceComments(); +void ExitInsuranceComments(); +void HandleInsuranceComments(); +void RenderInsuranceComments(); + +#endif \ No newline at end of file diff --git a/Laptop/insurance Contract.cpp b/Laptop/insurance Contract.cpp new file mode 100644 index 00000000..d3aa10f8 --- /dev/null +++ b/Laptop/insurance Contract.cpp @@ -0,0 +1,1745 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "insurance.h" + #include "insurance Contract.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Insurance Text.h" + #include "stdio.h" + #include "Soldier Profile.h" + #include "Overhead.h" + #include "Text Input.h" + #include "Soldier Add.h" + #include "Game Clock.h" + #include "finances.h" + #include "History.h" + #include "Game Event Hook.h" + #include "LaptopSave.h" + #include "english.h" + #include "Text.h" + #include "Random.h" + #include "Strategic Status.h" + #include "Assignments.h" +#endif + +#define INS_CTRCT_ORDER_GRID_WIDTH 132 +#define INS_CTRCT_ORDER_GRID_HEIGHT 216 +#define INS_CTRCT_ORDER_GRID_OFFSET_X INS_CTRCT_ORDER_GRID_WIDTH + 2 + + +#define INS_CTRCT_ORDER_GRID1_X 76 + LAPTOP_SCREEN_UL_X +#define INS_CTRCT_ORDER_GRID1_Y 126 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_CTRCT_ORDER_GRID2_X INS_CTRCT_ORDER_GRID1_X + INS_CTRCT_ORDER_GRID_OFFSET_X + +#define INS_CTRCT_ORDER_GRID3_X INS_CTRCT_ORDER_GRID2_X + INS_CTRCT_ORDER_GRID_OFFSET_X + +#define INS_CTRCT_OG_FACE_OFFSET_X 5 +#define INS_CTRCT_OG_FACE_OFFSET_Y 4 + + +#define INS_CTRCT_OG_NICK_NAME_OFFSET_X 57 +#define INS_CTRCT_OG_NICK_NAME_OFFSET_Y 13 + +#define INS_CTRCT_OG_HAS_CONTRACT_OFFSET_X INS_CTRCT_OG_NICK_NAME_OFFSET_X +#define INS_CTRCT_OG_HAS_CONTRACT_OFFSET_Y INS_CTRCT_OG_NICK_NAME_OFFSET_Y + 13 + +#define INS_CTRCT_TITLE_Y (48 + LAPTOP_SCREEN_WEB_UL_Y)//52 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_CTRCT_FIRST_BULLET_TEXT_X 86 + LAPTOP_SCREEN_UL_X +#define INS_CTRCT_FIRST_BULLET_TEXT_Y 65 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_CTRCT_SECOND_BULLET_TEXT_X INS_CTRCT_FIRST_BULLET_TEXT_X +#define INS_CTRCT_SECOND_BULLET_TEXT_Y 93 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_CTRCT_INTSRUCTION_TEXT_WIDTH 375 + +#define INS_CTRCT_RED_BAR_UNDER_INSTRUCTION_TEXT_Y 123 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_CTRCT_EMPLYMNT_CNTRCT_TEXT_OFFSET_X 4 +#define INS_CTRCT_EMPLYMNT_CNTRCT_TEXT_OFFSET_Y 54 + +#define INS_CTRCT_LENGTH_OFFSET_X INS_CTRCT_EMPLYMNT_CNTRCT_TEXT_OFFSET_X +#define INS_CTRCT_LENGTH_OFFSET_Y 71 + +#define INS_CTRCT_DAYS_REMAINING_OFFSET_Y 87 + +#define INS_CTRCT_INSURANCE_CNTRCT_OFFSET_Y 108 + +#define INS_CTRCT_PREMIUM_OWING_OFFSET_Y 160 + + +#define INS_CTRCT_OG_BOX_OFFSET_X 92 +#define INS_CTRCT_OG_BOX_WIDTH 35 + +#define INS_CTRCT_ACCEPT_BTN_X ( 132 / 2 - 43 / 2 ) //6 +#define INS_CTRCT_ACCEPT_BTN_Y 193 + +#define INS_CTRCT_CLEAR_BTN_X 86 + +#define INS_CTRCT_BOTTON_LINK_Y 351 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_CTRCT_BOTTOM_LINK_RED_BAR_X 171 + LAPTOP_SCREEN_UL_X +#define INS_CTRCT_BOTTON_LINK_RED_BAR_Y INS_CTRCT_BOTTON_LINK_Y + 41 + + +#define INS_CTRCT_BOTTOM_LINK_RED_BAR_OFFSET 117 + +#define INS_CTRCT_BOTTOM_LINK_RED_WIDTH 97 + +#define INS_CTRCT_CONTRACT_STATUS_TEXT_WIDTH 74 + +// this is the percentage of daily salary used as a base to calculate daily insurance premiums +#define INSURANCE_PREMIUM_RATE 5 + +#define INS_CTRCT_SKILL_BASE 42 +#define INS_CTRCT_FITNESS_BASE 85 +#define INS_CTRCT_EXP_LEVEL_BASE 3 +#define INS_CTRCT_SURVIVAL_BASE 90 + + +UINT32 guiInsOrderGridImage; +UINT32 guiInsOrderBulletImage; + +INT16 gsForm1InsuranceLengthNumber; +INT16 gsForm2InsuranceLengthNumber; +INT16 gsForm3InsuranceLengthNumber; + +UINT8 gubMercIDForMercInForm1; +UINT8 gubMercIDForMercInForm2; +UINT8 gubMercIDForMercInForm3; + +UINT8 gubNumberofDisplayedInsuranceGrids; + +BOOLEAN gfChangeInsuranceFormButtons = FALSE; + +UINT8 gubInsuranceMercArray[ 20 ]; +INT16 gsCurrentInsuranceMercIndex; +INT16 gsMaxPlayersOnTeam; + + +//link to the varios pages +MOUSE_REGION gSelectedInsuranceContractLinkRegion[2]; +void SelectInsuranceContractRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +INT32 guiInsContractPrevButtonImage; +void BtnInsContractPrevButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiInsContractPrevBackButton; + +INT32 guiInsContractNextButtonImage; +void BtnInsContractNextButtonCallBack(GUI_BUTTON *btn,INT32 reason); +UINT32 guiInsContractNextBackButton; + + +//Graphic for Accept, Clear button for form 1 +INT32 guiInsuranceAcceptClearForm1ButtonImage; +void BtnInsuranceAcceptClearForm1ButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiInsuranceAcceptClearForm1Button; + +//Graphic for Accept, Clear button for form 2 +void BtnInsuranceAcceptClearForm2ButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiInsuranceAcceptClearForm2Button; + +//Graphic for Accept, Clear button for form 3 +void BtnInsuranceAcceptClearForm3ButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiInsuranceAcceptClearForm3Button; + + + + +// +// Function Prototypes +// +BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ); +INT8 GetNumberOfHireMercsStartingFromID( UINT8 ubStartMercID ); +//INT32 CalculateInsuranceCost( SOLDIERTYPE *pSoldier, BOOLEAN fHaveInsurance ); +void InsuranceContractUserTextFieldCallBack( UINT8 ubID, BOOLEAN fEntering ); +INT8 CountInsurableMercs(); +void DisableInsuranceContractNextPreviousbuttons(); +void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate); +void HandleAcceptButton( UINT8 ubSoldierID, UINT8 ubFormID ); +FLOAT DiffFromNormRatio( INT16 sThisValue, INT16 sNormalValue ); +void InsContractNoMercsPopupCallBack( UINT8 bExitValue ); +void BuildInsuranceArray(); +BOOLEAN MercIsInsurable( SOLDIERTYPE *pSoldier ); +//UINT32 GetContractLengthForFormNumber( UINT8 ubFormID ); +void EnableDisableInsuranceContractAcceptButtons(); +UINT32 GetTimeRemainingOnSoldiersContract( SOLDIERTYPE *pSoldier ); +UINT32 GetTimeRemainingOnSoldiersInsuranceContract( SOLDIERTYPE *pSoldier ); +void EnableDisableIndividualInsuranceContractButton( UINT8 ubMercIDForMercInForm1, UINT32 *puiAcceptButton ); +BOOLEAN CanSoldierExtendInsuranceContract( SOLDIERTYPE *pSoldier ); +INT32 CalculateSoldiersInsuranceContractLength( SOLDIERTYPE *pSoldier ); +INT32 CalcStartDayOfInsurance( SOLDIERTYPE *pSoldier ); + +BOOLEAN AreAnyAimMercsOnTeam( ); +//ppp + + + + +void GameInitInsuranceContract() +{ + gsCurrentInsuranceMercIndex = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; +} + + +void EnterLaptopInitInsuranceContract() +{ + wchar_t zTextField[14]; + + swprintf( zTextField, L"%d", 0 ); + SetInputFieldStringWith16BitString( 1, zTextField ); + SetInputFieldStringWith16BitString( 2, zTextField ); + SetInputFieldStringWith16BitString( 3, zTextField ); + +} + + + +BOOLEAN EnterInsuranceContract() +{ + VOBJECT_DESC VObjectDesc; + UINT16 usPosX,i; + + //build the list of mercs that are can be displayed + BuildInsuranceArray(); + + gubNumberofDisplayedInsuranceGrids = GetNumberOfHireMercsStartingFromID( (UINT8) gsCurrentInsuranceMercIndex ); + if( gubNumberofDisplayedInsuranceGrids > 3 ) + gubNumberofDisplayedInsuranceGrids = 3; + + InitInsuranceDefaults(); + + + + // load the Insurance title graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\InsOrderGrid.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsOrderGridImage)); + + // load the Insurance bullet graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\bullet.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsOrderBulletImage)); + + + usPosX = INS_CTRCT_BOTTOM_LINK_RED_BAR_X; + for(i=0; i<2; i++) + { + MSYS_DefineRegion( &gSelectedInsuranceContractLinkRegion[i], usPosX, INS_CTRCT_BOTTON_LINK_RED_BAR_Y-37, (UINT16)(usPosX + INS_CTRCT_BOTTOM_LINK_RED_WIDTH), INS_CTRCT_BOTTON_LINK_RED_BAR_Y+2, MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceContractRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceContractLinkRegion[i]); + MSYS_SetRegionUserData( &gSelectedInsuranceContractLinkRegion[i], 0, i ); + + usPosX += INS_CTRCT_BOTTOM_LINK_RED_BAR_OFFSET; + } + + + //left arrow + guiInsContractPrevButtonImage = LoadButtonImage("LAPTOP\\InsLeftButton.sti", 2,0,-1,1,-1 ); + guiInsContractPrevBackButton = CreateIconAndTextButton( guiInsContractPrevButtonImage, InsContractText[INS_CONTRACT_PREVIOUS], INS_FONT_BIG, + INS_FONT_COLOR, INS_FONT_SHADOW, + INS_FONT_COLOR, INS_FONT_SHADOW, + TEXT_CJUSTIFIED, + INS_INFO_LEFT_ARROW_BUTTON_X, INS_INFO_LEFT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsContractPrevButtonCallback); + SetButtonCursor( guiInsContractPrevBackButton, CURSOR_WWW ); + SpecifyButtonTextOffsets( guiInsContractPrevBackButton, 17, 16, FALSE ); + + + //Right arrow + guiInsContractNextButtonImage = LoadButtonImage("LAPTOP\\InsRightButton.sti", 2,0,-1,1,-1 ); + guiInsContractNextBackButton = CreateIconAndTextButton( guiInsContractNextButtonImage, InsContractText[INS_CONTRACT_NEXT], INS_FONT_BIG, + INS_FONT_COLOR, INS_FONT_SHADOW, + INS_FONT_COLOR, INS_FONT_SHADOW, + TEXT_CJUSTIFIED, + INS_INFO_RIGHT_ARROW_BUTTON_X, INS_INFO_RIGHT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsContractNextButtonCallBack); + SetButtonCursor( guiInsContractNextBackButton, CURSOR_WWW ); + SpecifyButtonTextOffsets( guiInsContractNextBackButton, 18, 16, FALSE ); + + //create the new set of buttons + CreateDestroyInsuranceContractFormButtons( TRUE ); + +// RenderInsuranceContract(); + return(TRUE); +} + +void ExitInsuranceContract() +{ + UINT8 i; + + RemoveInsuranceDefaults(); + + DeleteVideoObjectFromIndex( guiInsOrderGridImage ); + + DeleteVideoObjectFromIndex( guiInsOrderBulletImage ); + + for(i=0; i<2; i++) + MSYS_RemoveRegion( &gSelectedInsuranceContractLinkRegion[i]); + + //the previous button + UnloadButtonImage( guiInsContractPrevButtonImage ); + RemoveButton( guiInsContractPrevBackButton ); + + //the next button + UnloadButtonImage( guiInsContractNextButtonImage ); + RemoveButton( guiInsContractNextBackButton ); + + CreateDestroyInsuranceContractFormButtons( FALSE ); +} + + + +void HandleInsuranceContract() +{ + if( gfChangeInsuranceFormButtons ) + { + //remove the old buttons from the page + CreateDestroyInsuranceContractFormButtons( FALSE ); + + //Get the new number of displayed insurance grids + gubNumberofDisplayedInsuranceGrids = GetNumberOfHireMercsStartingFromID( (UINT8) gsCurrentInsuranceMercIndex ); + if( gubNumberofDisplayedInsuranceGrids > 3 ) + gubNumberofDisplayedInsuranceGrids = 3; + + //create the new set of buttons + CreateDestroyInsuranceContractFormButtons( TRUE ); + + //reset the flag + gfChangeInsuranceFormButtons = FALSE; + + //force a redraw of the screen to erase the old buttons + fPausedReDrawScreenFlag = TRUE; + RenderInsuranceContract(); + + MarkButtonsDirty(); + } + + EnableDisableInsuranceContractAcceptButtons(); +} + + + +void RenderInsuranceContract() +{ + HVOBJECT hPixHandle; + wchar_t sText[800]; + UINT8 ubCount=0; + INT16 sMercID; + INT16 sNextMercID; + UINT16 usPosX; + BOOLEAN fIsThereAnyAimMercs = FALSE; + SOLDIERTYPE *pSoldier = NULL; + + + SetFontShadow( INS_FONT_SHADOW ); + + DisplayInsuranceDefaults(); + + //disable the next or previous button depending on how many more mercs we have to display + DisableInsuranceContractNextPreviousbuttons(); + + usPosX = INS_CTRCT_BOTTOM_LINK_RED_BAR_X; + + //Display the red bar under the link at the bottom. and the text + DisplaySmallRedLineWithShadow( usPosX, INS_CTRCT_BOTTON_LINK_RED_BAR_Y, (UINT16)(usPosX+INS_CTRCT_BOTTOM_LINK_RED_WIDTH), INS_CTRCT_BOTTON_LINK_RED_BAR_Y); + swprintf( sText, L"%s", pMessageStrings[ MSG_HOMEPAGE ] ); + DisplayWrappedString( usPosX, INS_CTRCT_BOTTON_LINK_Y+18, INS_CTRCT_BOTTOM_LINK_RED_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + usPosX += INS_CTRCT_BOTTOM_LINK_RED_BAR_OFFSET; + + //Display the red bar under the link at the bottom. and the text + DisplaySmallRedLineWithShadow( usPosX, INS_CTRCT_BOTTON_LINK_RED_BAR_Y, (UINT16)(usPosX+INS_CTRCT_BOTTOM_LINK_RED_WIDTH), INS_CTRCT_BOTTON_LINK_RED_BAR_Y); + GetInsuranceText( INS_SNGL_HOW_DOES_INS_WORK, sText ); + DisplayWrappedString( usPosX, INS_CTRCT_BOTTON_LINK_Y+12, INS_CTRCT_BOTTOM_LINK_RED_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + + //Display the title slogan + GetInsuranceText( INS_SNGL_ENTERING_REVIEWING_CLAIM, sText ); + DrawTextToScreen( sText, LAPTOP_SCREEN_UL_X, INS_CTRCT_TITLE_Y, LAPTOP_SCREEN_LR_X-LAPTOP_SCREEN_UL_X, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + + //Get and display the insurance bullet + GetVideoObject(&hPixHandle, guiInsOrderBulletImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_CTRCT_FIRST_BULLET_TEXT_X, INS_CTRCT_FIRST_BULLET_TEXT_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //Display the first instruction sentence + GetInsuranceText( INS_MLTI_TO_PURCHASE_INSURANCE, sText ); + DisplayWrappedString( INS_CTRCT_FIRST_BULLET_TEXT_X+INSURANCE_BULLET_TEXT_OFFSET_X, INS_CTRCT_FIRST_BULLET_TEXT_Y, INS_CTRCT_INTSRUCTION_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + + //Get and display the insurance bullet + GetVideoObject(&hPixHandle, guiInsOrderBulletImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_CTRCT_FIRST_BULLET_TEXT_X, INS_CTRCT_SECOND_BULLET_TEXT_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //Display the second instruction sentence + GetInsuranceText( INS_MLTI_ONCE_SATISFIED_CLICK_ACCEPT, sText ); + DisplayWrappedString( INS_CTRCT_FIRST_BULLET_TEXT_X+INSURANCE_BULLET_TEXT_OFFSET_X, INS_CTRCT_SECOND_BULLET_TEXT_Y, INS_CTRCT_INTSRUCTION_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + //Display the red bar under the instruction text + DisplaySmallRedLineWithShadow( INS_CTRCT_FIRST_BULLET_TEXT_X, INS_CTRCT_RED_BAR_UNDER_INSTRUCTION_TEXT_Y, INS_CTRCT_FIRST_BULLET_TEXT_X+INS_CTRCT_INTSRUCTION_TEXT_WIDTH, INS_CTRCT_RED_BAR_UNDER_INSTRUCTION_TEXT_Y); + + + sNextMercID = gsCurrentInsuranceMercIndex; + while( ( ubCount < gubNumberofDisplayedInsuranceGrids ) && ( sNextMercID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID ) ) + { + sMercID = gubInsuranceMercArray[ sNextMercID ]; + + pSoldier = &Menptr[ GetSoldierIDFromMercID( (UINT8) sMercID ) ]; + + if( ( sMercID != -1 ) && MercIsInsurable( pSoldier ) ) + { + DisplayOrderGrid( ubCount, (UINT8)sMercID ); + ubCount++; + } + + sNextMercID++; + } + + //if there are no valid mercs to insure + if( ubCount == 0 ) + { + //if there where AIM mercs ( on short contract ) + if( AreAnyAimMercsOnTeam( ) ) + { + //Display Error Message, all aim mercs are on short contract + GetInsuranceText( INS_MLTI_ALL_AIM_MERCS_ON_SHORT_CONTRACT, sText ); + DoLapTopMessageBox( MSG_BOX_RED_ON_WHITE, sText, LAPTOP_SCREEN, MSG_BOX_FLAG_OK, InsContractNoMercsPopupCallBack); + } + else + { + //Display Error Message, no valid mercs + GetInsuranceText( INS_MLTI_NO_QUALIFIED_MERCS, sText ); + DoLapTopMessageBox( MSG_BOX_RED_ON_WHITE, sText, LAPTOP_SCREEN, MSG_BOX_FLAG_OK, InsContractNoMercsPopupCallBack); + } + } + + + + SetFontShadow(DEFAULT_SHADOW); + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + + + +void BtnInsContractPrevButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + if( gsCurrentInsuranceMercIndex > 2 ) + gsCurrentInsuranceMercIndex -= 3; + + //signal that we want to change the number of forms on the page + gfChangeInsuranceFormButtons = TRUE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + +void BtnInsContractNextButtonCallBack(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + gsCurrentInsuranceMercIndex += 3; + + //signal that we want to change the number of forms on the page + gfChangeInsuranceFormButtons = TRUE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + + +BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) +{ + VOBJECT_DESC VObjectDesc; + HVOBJECT hPixHandle; + UINT16 usPosX, usPosY; + UINT32 uiInsMercFaceImage; + INT32 iCostOfContract=0; + char sTemp[100]; + wchar_t sText[800]; + BOOLEAN fDisplayMercContractStateTextColorInRed = FALSE; + + SOLDIERTYPE *pSoldier; + + + pSoldier = &Menptr[ GetSoldierIDFromMercID( ubMercID ) ]; + + + usPosX=usPosY=0; + + switch( ubGridNumber ) + { + case 0: + usPosX = INS_CTRCT_ORDER_GRID1_X; + gubMercIDForMercInForm1 = ubMercID; + gsForm1InsuranceLengthNumber = (INT16) pSoldier->iTotalLengthOfInsuranceContract; + break; + + case 1: + usPosX = INS_CTRCT_ORDER_GRID2_X; + gubMercIDForMercInForm2 = ubMercID; + gsForm2InsuranceLengthNumber = (INT16) pSoldier->iTotalLengthOfInsuranceContract; + break; + + case 2: + usPosX = INS_CTRCT_ORDER_GRID3_X; + gubMercIDForMercInForm3 = ubMercID; + gsForm3InsuranceLengthNumber = (INT16) pSoldier->iTotalLengthOfInsuranceContract; + break; + + default: + //should never get in here + Assert(0); + break; + } + + //Get and display the insurance order grid #1 + GetVideoObject(&hPixHandle, guiInsOrderGridImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, usPosX, INS_CTRCT_ORDER_GRID1_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + // load the mercs face graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + sprintf(sTemp, "FACES\\%02d.sti", ubMercID); + FilenameForBPP( sTemp, VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiInsMercFaceImage)); + + //Get the merc's face + GetVideoObject(&hPixHandle, uiInsMercFaceImage ); + + //if the merc is dead, shade the face red + if( IsMercDead( ubMercID ) ) + { + //if the merc is dead + //shade the face red, (to signify that he is dead) + hPixHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hPixHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); + + //set the red pallete to the face + SetObjectHandleShade( uiInsMercFaceImage, 0 ); + } + + //Get and display the mercs face + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, usPosX+INS_CTRCT_OG_FACE_OFFSET_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_FACE_OFFSET_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // the face images isn't needed anymore so delete it + DeleteVideoObjectFromIndex( uiInsMercFaceImage ); + + //display the mercs nickname + DrawTextToScreen(gMercProfiles[ ubMercID ].zNickname, (UINT16)(usPosX + INS_CTRCT_OG_NICK_NAME_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y + INS_CTRCT_OG_NICK_NAME_OFFSET_Y, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + //Get the text to display the mercs current insurance contract status + if( IsMercDead( pSoldier->ubProfile ) ) + { + //if the merc has a contract + if( pSoldier->usLifeInsurance ) + { + //Display the contract text + GetInsuranceText( INS_SNGL_DEAD_WITH_CONTRACT, sText ); + } + else + { + //Display the contract text + GetInsuranceText( INS_SNGL_DEAD_NO_CONTRACT, sText ); + } + DisplayWrappedString( (UINT16)(usPosX+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_Y, INS_CTRCT_CONTRACT_STATUS_TEXT_WIDTH, 2, INS_FONT_SMALL, INS_FONT_COLOR_RED, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + else + { + //if the merc has a contract + if( pSoldier->usLifeInsurance ) + { + //if the soldier can extend their insurance + if( CanSoldierExtendInsuranceContract( pSoldier ) ) + { + //Display the contract text + GetInsuranceText( INS_SNGL_PARTIALLY_INSURED, sText ); + fDisplayMercContractStateTextColorInRed = TRUE; + } + else + { + //Display the contract text + GetInsuranceText( INS_SNGL_CONTRACT, sText ); + fDisplayMercContractStateTextColorInRed = FALSE; + } + } + else + { + //Display the contract text + GetInsuranceText( INS_SNGL_NOCONTRACT, sText ); + fDisplayMercContractStateTextColorInRed = TRUE; + } + if( fDisplayMercContractStateTextColorInRed ) + DisplayWrappedString( (UINT16)(usPosX+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_Y, INS_CTRCT_CONTRACT_STATUS_TEXT_WIDTH, 2, INS_FONT_SMALL, INS_FONT_COLOR_RED, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + else + DisplayWrappedString( (UINT16)(usPosX+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_OG_HAS_CONTRACT_OFFSET_Y, INS_CTRCT_CONTRACT_STATUS_TEXT_WIDTH, 2, INS_FONT_SMALL, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + } + + + + //Display the Emplyment contract text + GetInsuranceText( INS_SNGL_EMPLOYMENT_CONTRACT, sText ); + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_EMPLYMNT_CNTRCT_TEXT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_EMPLYMNT_CNTRCT_TEXT_OFFSET_Y, INS_CTRCT_ORDER_GRID_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the merc contract Length text + GetInsuranceText( INS_SNGL_LENGTH, sText ); + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_LENGTH_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_LENGTH_OFFSET_Y, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + //Display the mercs contract length + swprintf( sText, L"%d", pSoldier->iTotalContractLength ); + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_OG_BOX_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_LENGTH_OFFSET_Y, INS_CTRCT_OG_BOX_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + + + //Display the days remaining for the emplyment contract text + GetInsuranceText( INS_SNGL_DAYS_REMAINING, sText ); + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_LENGTH_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_DAYS_REMAINING_OFFSET_Y, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + + //display the amount of time the merc has left on their Regular contract + if( IsMercDead( ubMercID ) ) + swprintf( sText, L"%s", pMessageStrings[ MSG_LOWERCASE_NA ] ); + else + swprintf( sText, L"%d", GetTimeRemainingOnSoldiersContract( pSoldier ) ); + + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_OG_BOX_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_DAYS_REMAINING_OFFSET_Y, INS_CTRCT_OG_BOX_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + + //Display the Insurqance contract + GetInsuranceText( INS_SNGL_INSURANCE_CONTRACT, sText ); + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_EMPLYMNT_CNTRCT_TEXT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_INSURANCE_CNTRCT_OFFSET_Y, INS_CTRCT_ORDER_GRID_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + + GetInsuranceText( INS_SNGL_LENGTH, sText ); + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_LENGTH_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_LENGTH_OFFSET_Y+54, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + //Display the insurance days remaining text + GetInsuranceText( INS_SNGL_DAYS_REMAINING, sText ); + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_LENGTH_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_DAYS_REMAINING_OFFSET_Y+54, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + + + // + //display the amount of time the merc has left on the insurance contract + // + + //if the soldier has insurance, disply the length of time the merc has left + if( IsMercDead( ubMercID ) ) + swprintf( sText, L"%s", pMessageStrings[ MSG_LOWERCASE_NA ] ); + + else if( pSoldier->usLifeInsurance != 0 ) + swprintf( sText, L"%d", GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ) ); + + else + swprintf( sText, L"%d", 0 ); + + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_OG_BOX_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_DAYS_REMAINING_OFFSET_Y+54, INS_CTRCT_OG_BOX_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + + + // + // Calculate the insurance cost + // + + //if the soldier can get insurance, calculate a new cost + if( CanSoldierExtendInsuranceContract( pSoldier ) ) + { + iCostOfContract =CalculateInsuranceContractCost( CalculateSoldiersInsuranceContractLength( pSoldier ), pSoldier->ubProfile ); + } + + else + { + iCostOfContract = 0; + } + + if( iCostOfContract < 0 ) + { + //shouldnt get in here now since we can longer give refunds + Assert( 0 ); + } + else + { + //Display the premium owing text + GetInsuranceText( INS_SNGL_PREMIUM_OWING, sText ); + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_EMPLYMNT_CNTRCT_TEXT_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_PREMIUM_OWING_OFFSET_Y, INS_CTRCT_ORDER_GRID_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //display the amount of refund + swprintf( sText, L"%d", iCostOfContract ); + InsertCommasForDollarFigure( sText ); + InsertDollarSignInToString( sText ); + } + + + if( IsMercDead( ubMercID ) ) + { + swprintf( sText, L"0"); + InsertDollarSignInToString( sText ); + } + //display the amount owing + DrawTextToScreen( sText, (UINT16)(usPosX+32), INS_CTRCT_ORDER_GRID1_Y+179, 72, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + + + + // + // Get the insurance contract length for the merc + // + swprintf( sText, L"%d", CalculateSoldiersInsuranceContractLength( pSoldier ) ); + + + //Display the length of time the player can get for the insurance contract + DrawTextToScreen( sText, (UINT16)(usPosX+INS_CTRCT_OG_BOX_OFFSET_X), INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_LENGTH_OFFSET_Y+52+2, INS_CTRCT_OG_BOX_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + + return( TRUE ); +} + + + +void BtnInsuranceAcceptClearForm1ButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); + UINT8 ubSoldierID = (UINT8) GetSoldierIDFromMercID( gubMercIDForMercInForm1 ); + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //the accept button + if( ubButton == 0 ) + { + //handle the accept button, (global to all accept button + HandleAcceptButton( ubSoldierID, 1 ); + + //specify the length of the insurance contract + Menptr[ ubSoldierID ].iTotalLengthOfInsuranceContract = gsForm1InsuranceLengthNumber; + + //reset the insurance length + gsForm1InsuranceLengthNumber = 0; + } + + //redraw the screen + fPausedReDrawScreenFlag = TRUE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + +void BtnInsuranceAcceptClearForm2ButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); + UINT8 ubSoldierID = (UINT8) GetSoldierIDFromMercID( gubMercIDForMercInForm2 ); + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //the accept button + if( ubButton == 0 ) + { + //handle the accept button, (global to all accept button + HandleAcceptButton( ubSoldierID, 2 ); + + //specify the length of the insurance contract + Menptr[ ubSoldierID ].iTotalLengthOfInsuranceContract = gsForm2InsuranceLengthNumber; + + //reset the insurance length + gsForm2InsuranceLengthNumber = 0; + } + + //redraw the screen + fPausedReDrawScreenFlag = TRUE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + + +void BtnInsuranceAcceptClearForm3ButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); + UINT8 ubSoldierID = (UINT8) GetSoldierIDFromMercID( gubMercIDForMercInForm3 ); + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //the accept button + if( ubButton == 0 ) + { + //handle the accept button, (global to all accept button + HandleAcceptButton( ubSoldierID, 3 ); + + //specify the length of the insurance contract + Menptr[ ubSoldierID ].iTotalLengthOfInsuranceContract = gsForm3InsuranceLengthNumber; + + //reset the insurance length + gsForm3InsuranceLengthNumber = 0; + } + + //redraw the screen + fPausedReDrawScreenFlag = TRUE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + +INT8 GetNumberOfHireMercsStartingFromID( UINT8 ubStartMercID ) +{ + UINT8 i; + UINT8 ubCount=0; + + for( i=0; i= ubStartMercID ) + { + ubCount++; + } + } + + return( ubCount ); +} + + +/* +INT32 CalculateInsuranceCost( SOLDIERTYPE *pSoldier, BOOLEAN fHaveInsurance ) +{ + INT32 iAmount=0; + UINT32 uiInsuranceContractLength = 0; + + uiInsuranceContractLength = CalculateSoldiersInsuranceContractLength( pSoldier ); + + //If the soldier already has life insurance, then the user is changing the length of the contract + if( pSoldier->usLifeInsurance ) + { + //if the user is changing the contract length + if( uiInsuranceContractLength != 0 ) + { + iAmount = CalculateInsuranceContractCost( uiInsuranceContractLength, pSoldier->ubProfile); + } + //else we are just calculating the new figure + else + { + iAmount = 0; + } + } + //else the merc doesn't have life insurance + else + { + iAmount = CalculateInsuranceContractCost( uiInsuranceContractLength, pSoldier->ubProfile); + } + + return( iAmount ); +} +*/ + +void SelectInsuranceContractRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + UINT32 uiInsuranceLink = MSYS_GetRegionUserData( pRegion, 0 ); + + if( uiInsuranceLink == 0 ) + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE; + else if( uiInsuranceLink == 1 ) + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE_INFO; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + +INT8 CountInsurableMercs() +{ + INT16 cnt; + SOLDIERTYPE *pSoldier; + INT16 bLastTeamID; + INT8 bCount=0; + + // Set locator to first merc + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + { + if (MercIsInsurable(pSoldier)) + { + bCount++; + } + } + + return( bCount ); +} + +void DisableInsuranceContractNextPreviousbuttons() +{ + //disable the next button if there is no more mercs to display + if( ( gsCurrentInsuranceMercIndex + gubNumberofDisplayedInsuranceGrids ) < CountInsurableMercs() ) + { + EnableButton( guiInsContractNextBackButton ); + } + else + DisableButton( guiInsContractNextBackButton ); + + //if we are currently displaying the first set of mercs, disable the previous button + if( gsCurrentInsuranceMercIndex < 3 ) + { + DisableButton( guiInsContractPrevBackButton ); + } + else + EnableButton( guiInsContractPrevBackButton ); + +} + +void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate) +{ + static BOOLEAN fButtonsCreated = FALSE; + + if( fCreate && !fButtonsCreated ) + { + //place the 3 accept buttons for the different forms + + //The accept button image + guiInsuranceAcceptClearForm1ButtonImage = LoadButtonImage("LAPTOP\\AcceptClearBox.sti", -1,0,-1,1,-1 ); + + if( gubNumberofDisplayedInsuranceGrids >= 1 ) + { + //the accept button for form 1 + guiInsuranceAcceptClearForm1Button = CreateIconAndTextButton( guiInsuranceAcceptClearForm1ButtonImage, InsContractText[INS_CONTRACT_ACCEPT], INS_FONT_MED, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + TEXT_CJUSTIFIED, + INS_CTRCT_ORDER_GRID1_X+INS_CTRCT_ACCEPT_BTN_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_ACCEPT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsuranceAcceptClearForm1ButtonCallback); + SetButtonCursor( guiInsuranceAcceptClearForm1Button, CURSOR_LAPTOP_SCREEN ); + MSYS_SetBtnUserData( guiInsuranceAcceptClearForm1Button, 0, 0); + } + + + + if( gubNumberofDisplayedInsuranceGrids >= 2 ) + { + //the accept button for form 2 + guiInsuranceAcceptClearForm2Button = CreateIconAndTextButton( guiInsuranceAcceptClearForm1ButtonImage, InsContractText[INS_CONTRACT_ACCEPT], INS_FONT_MED, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + TEXT_CJUSTIFIED, + INS_CTRCT_ORDER_GRID2_X+INS_CTRCT_ACCEPT_BTN_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_ACCEPT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsuranceAcceptClearForm2ButtonCallback); + SetButtonCursor(guiInsuranceAcceptClearForm2Button, CURSOR_LAPTOP_SCREEN ); + MSYS_SetBtnUserData( guiInsuranceAcceptClearForm2Button, 0, 0); + + } + + + + + if( gubNumberofDisplayedInsuranceGrids >= 3 ) + { + //the accept button for form 3 + guiInsuranceAcceptClearForm3Button = CreateIconAndTextButton( guiInsuranceAcceptClearForm1ButtonImage, InsContractText[INS_CONTRACT_ACCEPT], INS_FONT_MED, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + INS_FONT_BTN_COLOR, INS_FONT_BTN_SHADOW_COLOR, + TEXT_CJUSTIFIED, + INS_CTRCT_ORDER_GRID3_X+INS_CTRCT_ACCEPT_BTN_X, INS_CTRCT_ORDER_GRID1_Y+INS_CTRCT_ACCEPT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsuranceAcceptClearForm3ButtonCallback); + SetButtonCursor( guiInsuranceAcceptClearForm3Button, CURSOR_LAPTOP_SCREEN ); + MSYS_SetBtnUserData( guiInsuranceAcceptClearForm3Button, 0, 0); + } + + fButtonsCreated = TRUE; + } + + if( fButtonsCreated && ! fCreate ) + { + //the accept image + UnloadButtonImage( guiInsuranceAcceptClearForm1ButtonImage ); + + if( gubNumberofDisplayedInsuranceGrids >= 1 ) + { + //the accept for the first form + RemoveButton( guiInsuranceAcceptClearForm1Button ); + } + + if( gubNumberofDisplayedInsuranceGrids >= 2 ) + { + //the accept clear for the second form + RemoveButton( guiInsuranceAcceptClearForm2Button ); + } + + if( gubNumberofDisplayedInsuranceGrids >= 3 ) + { + //the accept clear for the third form + RemoveButton( guiInsuranceAcceptClearForm3Button ); + } + + fButtonsCreated = FALSE; + } +} + + + +void HandleAcceptButton( UINT8 ubSoldierID, UINT8 ubFormID ) +{ + INT32 iAmountOfMoneyTransfer = -1; + + //passed in either 1,2,3 should be 0,1,2 + ubFormID--; + + PurchaseOrExtendInsuranceForSoldier( &Menptr[ ubSoldierID ], CalculateSoldiersInsuranceContractLength( &Menptr[ ubSoldierID ] ) ); + + RenderInsuranceContract(); +} + + + + + + + + + +// determines if a merc will run out of their insurance contract +void DailyUpdateOfInsuredMercs() +{ + INT16 cnt; + INT16 bLastTeamID; + SOLDIERTYPE *pSoldier; + + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + { + //if the soldier is in the team array + if( pSoldier->bActive ) + { + //if the merc has life insurance + if( pSoldier->usLifeInsurance ) + { + //if the merc wasn't just hired + if( (INT16)GetWorldDay() != pSoldier->iStartOfInsuranceContract ) + { + //if the contract has run out of time + if( GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ) <= 0 ) + { + //if the soldier isn't dead + if( !IsMercDead( pSoldier->ubProfile ) ) + { + pSoldier->usLifeInsurance = 0; + pSoldier->iTotalLengthOfInsuranceContract = 0; + pSoldier->iStartOfInsuranceContract = 0; + } + } + } + } + } + } +} + + +#define MIN_INSURANCE_RATIO 0.1f +#define MAX_INSURANCE_RATIO 10.0f + + +INT32 CalculateInsuranceContractCost( INT32 iLength, UINT8 ubMercID ) +{ + MERCPROFILESTRUCT * pProfile; + INT16 sTotalSkill=0; + FLOAT flSkillFactor, flFitnessFactor, flExpFactor, flSurvivalFactor; + FLOAT flRiskFactor; + UINT32 uiDailyInsurancePremium; + UINT32 uiTotalInsurancePremium; + SOLDIERTYPE *pSoldier; + + + pSoldier = &Menptr[ GetSoldierIDFromMercID( ubMercID ) ]; + + + // only mercs with at least 2 days to go on their employment contract are insurable + // def: 2/5/99. However if they already have insurance is SHOULD be ok + if( GetTimeRemainingOnSoldiersContract( pSoldier ) < 2 && !( pSoldier->usLifeInsurance != 0 && GetTimeRemainingOnSoldiersContract( pSoldier ) >= 1 ) ) + { + return( 0 ); + } + + //If the merc is currently being held captive, get out + if (pSoldier->bAssignment == ASSIGNMENT_POW) + { + return( 0 ); + } + +/* + replaced with the above check + + if (iLength < 2) + { + return(0); + } + */ + + pProfile = &gMercProfiles[ ubMercID ]; + + // calculate the degree of training + sTotalSkill = (pProfile->bMarksmanship + pProfile->bMedical + pProfile->bMechanical + pProfile->bExplosive + pProfile->bLeadership) / 5; + flSkillFactor = DiffFromNormRatio( sTotalSkill, INS_CTRCT_SKILL_BASE ); + + // calc relative fitness level + flFitnessFactor = DiffFromNormRatio( pProfile->bLife, INS_CTRCT_FITNESS_BASE ); + + // calc relative experience + flExpFactor = DiffFromNormRatio( pProfile->bExpLevel, INS_CTRCT_EXP_LEVEL_BASE ); + + // calc player's survival rate (death rate subtracted from 100) + flSurvivalFactor = DiffFromNormRatio( (INT16) (100 - CalcDeathRate()), INS_CTRCT_SURVIVAL_BASE ); + + // calculate the overall insurability risk factor for this merc by combining all the subfactors + flRiskFactor = flSkillFactor * flFitnessFactor * flExpFactor * flSurvivalFactor; + + // restrict the overall factor to within reasonable limits + if (flRiskFactor < MIN_INSURANCE_RATIO) + { + flRiskFactor = MIN_INSURANCE_RATIO; + } + else + if (flRiskFactor > MAX_INSURANCE_RATIO) + { + flRiskFactor = MAX_INSURANCE_RATIO; + } + + // premium depend on merc's salary, the base insurance rate, and the individual's risk factor at this time + uiDailyInsurancePremium = (UINT32) (((pProfile->sSalary * INSURANCE_PREMIUM_RATE * flRiskFactor) / 100) + 0.5); + // multiply by the insurance contract length + uiTotalInsurancePremium = uiDailyInsurancePremium * iLength; + + return( uiTotalInsurancePremium ); +} + + +// values passed in must be such that exceeding the normal value REDUCES insurance premiums +FLOAT DiffFromNormRatio( INT16 sThisValue, INT16 sNormalValue ) +{ + FLOAT flRatio; + + if (sThisValue > 0) + { + flRatio = (FLOAT) sNormalValue / sThisValue; + + // restrict each ratio to within a reasonable range + if (flRatio < MIN_INSURANCE_RATIO) + { + flRatio = MIN_INSURANCE_RATIO; + } + else + if (flRatio > MAX_INSURANCE_RATIO) + { + flRatio = MAX_INSURANCE_RATIO; + } + } + else + { + // use maximum allowable ratio + flRatio = MAX_INSURANCE_RATIO; + } + + return( flRatio ); +} + + +void InsContractNoMercsPopupCallBack( UINT8 bExitValue ) +{ + // yes, so start over, else stay here and do nothing for now + if( bExitValue == MSG_BOX_RETURN_OK ) + { + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE; + } + + return; +} + +void BuildInsuranceArray() +{ + INT16 cnt; + SOLDIERTYPE *pSoldier; + INT16 bLastTeamID; + + cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + gsMaxPlayersOnTeam = 0; + + // store profile #s of all insurable mercs in an array + for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + { + if( MercIsInsurable(pSoldier) ) + { + gubInsuranceMercArray[ gsMaxPlayersOnTeam ] = pSoldier->ubProfile; + gsMaxPlayersOnTeam++; + } + } +} + + +BOOLEAN AddLifeInsurancePayout( SOLDIERTYPE *pSoldier ) +{ + UINT8 ubPayoutID; + UINT32 uiTimeInMinutes; + MERCPROFILESTRUCT *pProfile; + UINT32 uiCostPerDay; + UINT32 uiDaysToPay; + + + Assert(pSoldier != NULL); + Assert(pSoldier->ubProfile != NO_PROFILE); + + pProfile = &(gMercProfiles[ pSoldier->ubProfile ]); + + //if we need to add more array elements + if( LaptopSaveInfo.ubNumberLifeInsurancePayouts <= LaptopSaveInfo.ubNumberLifeInsurancePayoutUsed ) + { + LaptopSaveInfo.ubNumberLifeInsurancePayouts++; + LaptopSaveInfo.pLifeInsurancePayouts = (LIFE_INSURANCE_PAYOUT *) MemRealloc( LaptopSaveInfo.pLifeInsurancePayouts, sizeof( LIFE_INSURANCE_PAYOUT ) * LaptopSaveInfo.ubNumberLifeInsurancePayouts ); + if( LaptopSaveInfo.pLifeInsurancePayouts == NULL ) + return( FALSE ); + + memset( &LaptopSaveInfo.pLifeInsurancePayouts[ LaptopSaveInfo.ubNumberLifeInsurancePayouts - 1 ], 0, sizeof( LIFE_INSURANCE_PAYOUT ) ); + } + + for( ubPayoutID = 0; ubPayoutID < LaptopSaveInfo.ubNumberLifeInsurancePayouts; ubPayoutID++ ) + { + //get an empty element in the array + if( !LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].fActive ) + break; + } + + LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID = pSoldier->ubID; + LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID = pSoldier->ubProfile; + LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].fActive = TRUE; + + // This uses the merc's latest salaries, ignoring that they may be higher than the salaries paid under the current + // contract if the guy has recently gained a level. We could store his daily salary when he was last contracted, + // and use that, but it still doesn't easily account for the fact that renewing a leveled merc early means that the + // first part of his contract is under his old salary and the second part is under his new one. Therefore, I chose + // to ignore this wrinkle, and let the player awlays get paid out using the higher amount. ARM + + // figure out which of the 3 salary rates the merc has is the cheapest, and use it to calculate the paid amount, to + // avoid getting back more than the merc cost if he was on a 2-week contract! + + // start with the daily salary + uiCostPerDay = pProfile->sSalary; + + // consider weekly salary / day + if ((pProfile->uiWeeklySalary / 7) < uiCostPerDay) + { + uiCostPerDay = (pProfile->uiWeeklySalary / 7); + } + + // consider biweekly salary / day + if ((pProfile->uiBiWeeklySalary / 14) < uiCostPerDay) + { + uiCostPerDay = (pProfile->uiBiWeeklySalary / 14); + } + + // calculate how many full, insured days of work the merc is going to miss + uiDaysToPay = pSoldier->iTotalLengthOfInsuranceContract - ( GetWorldDay() + 1 - pSoldier->iStartOfInsuranceContract ); + + // calculate & store how much is to be paid out + LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice = uiDaysToPay * uiCostPerDay; + + // 4pm next day + uiTimeInMinutes = GetMidnightOfFutureDayInMinutes( 1 ) + 16 * 60; + + // if the death was suspicious, or he's already been investigated twice or more + if (pProfile->ubSuspiciousDeath || (gStrategicStatus.ubInsuranceInvestigationsCnt >= 2)) + { + // fraud suspected, claim will be investigated first + AddStrategicEvent( EVENT_INSURANCE_INVESTIGATION_STARTED, uiTimeInMinutes, ubPayoutID ); + } + else + { + // is ok, make a prompt payment + AddStrategicEvent( EVENT_PAY_LIFE_INSURANCE_FOR_DEAD_MERC, uiTimeInMinutes, ubPayoutID ); + } + + LaptopSaveInfo.ubNumberLifeInsurancePayoutUsed++; + + return( TRUE ); +} + + +void StartInsuranceInvestigation( UINT8 ubPayoutID ) +{ + UINT8 ubDays; + + // send an email telling player an investigation is taking place + if (gStrategicStatus.ubInsuranceInvestigationsCnt == 0) + { + // first offense + AddEmailWithSpecialData( INSUR_SUSPIC, INSUR_SUSPIC_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ); + } + else + { + // subsequent offense + AddEmailWithSpecialData( INSUR_SUSPIC_2, INSUR_SUSPIC_2_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ); + } + + if ( gMercProfiles[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ].ubSuspiciousDeath == VERY_SUSPICIOUS_DEATH ) + { + // the fact that you tried to cheat them gets realized very quickly. :-) + ubDays = 1; + } + else + { + // calculate how many days the investigation will take + ubDays = (UINT8) (2 + gStrategicStatus.ubInsuranceInvestigationsCnt + Random(3)); // 2-4 days, +1 for every previous investigation + } + + // post an event to end the investigation that many days in the future (at 4pm) + AddStrategicEvent( EVENT_INSURANCE_INVESTIGATION_OVER, GetMidnightOfFutureDayInMinutes( ubDays ) + 16 * 60, ubPayoutID ); + + // increment counter of all investigations + gStrategicStatus.ubInsuranceInvestigationsCnt++; +} + + +void EndInsuranceInvestigation( UINT8 ubPayoutID ) +{ + // send an email telling player the investigation is over + if ( gMercProfiles[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ].ubSuspiciousDeath == VERY_SUSPICIOUS_DEATH ) + { + // fraud, no payout! + AddEmailWithSpecialData( INSUR_1HOUR_FRAUD, INSUR_1HOUR_FRAUD_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ); + } + else + { + AddEmailWithSpecialData( INSUR_INVEST_OVER, INSUR_INVEST_OVER_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ); + + // only now make a payment (immediately) + InsuranceContractPayLifeInsuranceForDeadMerc( ubPayoutID ); + } +} + + +//void InsuranceContractPayLifeInsuranceForDeadMerc( LIFE_INSURANCE_PAYOUT *pPayoutStruct ) +void InsuranceContractPayLifeInsuranceForDeadMerc( UINT8 ubPayoutID ) +{ + //if the mercs id number is the same what is in the soldier array + if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID == Menptr[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID ].ubID ) + { + // and if the soldier is still active ( player hasn't removed carcass yet ), reset insurance flag + if( Menptr[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID ].bActive ) + Menptr[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID ].usLifeInsurance = 0; + } + + //add transaction to players account + AddTransactionToPlayersBook( INSURANCE_PAYOUT, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice ); + + //add to the history log the fact that the we paid the insurance claim + AddHistoryToPlayersLog( HISTORY_INSURANCE_CLAIM_PAYOUT, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID, GetWorldTotalMin(), -1, -1 ); + + //if there WASNT an investigation + if( gMercProfiles[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ].ubSuspiciousDeath == 0 ) + { + //Add an email telling the user that he received an insurance payment + AddEmailWithSpecialData( INSUR_PAYMENT, INSUR_PAYMENT_LENGTH, INSURANCE_COMPANY, GetWorldTotalMin(), LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].iPayOutPrice, LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ); + } + + LaptopSaveInfo.ubNumberLifeInsurancePayoutUsed --; + LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].fActive = FALSE; +// MemFree( pPayoutStruct ); +} + + +//Gets called at the very end of the game +void InsuranceContractEndGameShutDown() +{ + //Free up the memory allocated to the insurance payouts + if( LaptopSaveInfo.pLifeInsurancePayouts ) + { + MemFree( LaptopSaveInfo.pLifeInsurancePayouts ); + LaptopSaveInfo.pLifeInsurancePayouts = NULL; + } +} + + +BOOLEAN MercIsInsurable( SOLDIERTYPE *pSoldier ) +{ + // only A.I.M. mercs currently on player's team + if( ( pSoldier->bActive ) && ( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) ) + { + // with more than one day left on their employment contract are eligible for insurance + // the second part is because the insurance doesn't pay for any working day already started at time of death +// if( ( (pSoldier->iEndofContractTime - GetWorldTotalMin()) > 24 * 60) || pSoldier->usLifeInsurance ) + if( CanSoldierExtendInsuranceContract( pSoldier ) || pSoldier->usLifeInsurance ) + { + // who aren't currently being held POW + // POWs are also uninsurable - if already insured, that insurance IS valid but no new contracts or extension allowed + if (pSoldier->bAssignment != ASSIGNMENT_POW) + { + return(TRUE); + } + } + } + + return(FALSE); +} + + +void EnableDisableInsuranceContractAcceptButtons() +{ + //If it is the first grid + if( gubNumberofDisplayedInsuranceGrids >= 1 ) + { + EnableDisableIndividualInsuranceContractButton( gubMercIDForMercInForm1, &guiInsuranceAcceptClearForm1Button ); + } + + //If it is the 2nd grid + if( gubNumberofDisplayedInsuranceGrids >= 2 ) + { + EnableDisableIndividualInsuranceContractButton( gubMercIDForMercInForm2, &guiInsuranceAcceptClearForm2Button ); + } + + //If it is the 3rd grid + if( gubNumberofDisplayedInsuranceGrids >= 3 ) + { + EnableDisableIndividualInsuranceContractButton( gubMercIDForMercInForm3, &guiInsuranceAcceptClearForm3Button ); + } +} + + +void EnableDisableIndividualInsuranceContractButton( UINT8 ubMercIDForMercInForm, UINT32 *puiAcceptButton ) +{ + INT16 sSoldierID = 0; + + sSoldierID = GetSoldierIDFromMercID( ubMercIDForMercInForm ); + if( sSoldierID == - 1) + return; + + // if the soldiers contract can be extended, enable the button + if( CanSoldierExtendInsuranceContract( &Menptr[ sSoldierID ] ) ) + EnableButton( *puiAcceptButton ); + + // else the soldier cant extend their insurance contract, disable the button + else + DisableButton( *puiAcceptButton ); + + //if the merc is dead, disable the button + if( IsMercDead( ubMercIDForMercInForm ) ) + DisableButton( *puiAcceptButton ); +} + + +/* +UINT32 GetContractLengthForFormNumber( UINT8 ubFormID ) +{ + UINT8 ubMercID; + SOLDIERTYPE *pSoldier; + + switch( ubFormID ) + { + case 0: + ubMercID = gubMercIDForMercInForm1; + break; + case 1: + ubMercID = gubMercIDForMercInForm1; + break; + case 2: + ubMercID = gubMercIDForMercInForm1; + break; + + default: + Assert( 0 ); + break; + } + + pSoldier = &Menptr[ GetSoldierIDFromMercID( ubMercID ) ]; + + return( pSoldier->iTotalContractLength ); +} +*/ + +UINT32 GetTimeRemainingOnSoldiersInsuranceContract( SOLDIERTYPE *pSoldier ) +{ + //if the soldier has life insurance + if( pSoldier->usLifeInsurance ) + { + //if the insurance contract hasnt started yet + if( (INT32)GetWorldDay() < pSoldier->iStartOfInsuranceContract ) + return( pSoldier->iTotalLengthOfInsuranceContract ); + else + return( ( pSoldier->iTotalLengthOfInsuranceContract - ( GetWorldDay() - pSoldier->iStartOfInsuranceContract ) ) ); + } + else + return( 0 ); +} + +UINT32 GetTimeRemainingOnSoldiersContract( SOLDIERTYPE *pSoldier ) +{ + INT32 iDayMercLeaves = ( pSoldier->iEndofContractTime / 1440 ) - 1; + + //Since the merc is leaving in the afternoon, we must adjust since the time left would be different if we did the calc + //at 11:59 or 12:01 ( noon ) + if( pSoldier->iEndofContractTime % 1440 ) + iDayMercLeaves++; + + // Subtract todays day number + iDayMercLeaves = iDayMercLeaves - GetWorldDay(); + + if( iDayMercLeaves > pSoldier->iTotalContractLength ) + iDayMercLeaves = pSoldier->iTotalContractLength; + + return( iDayMercLeaves ); +// return( ( pSoldier->iEndofContractTime - (INT32)GetWorldTotalMin( ) ) / 1440 ); +} + + +void PurchaseOrExtendInsuranceForSoldier( SOLDIERTYPE *pSoldier, UINT32 uiInsuranceLength ) +{ + INT32 iAmountOfMoneyTransfer = -1; + + if( pSoldier == NULL ) + AssertMsg( 0, "Soldier pointer is NULL!" ); + + //if the user doesnt have insruance already, + if( !(pSoldier->usLifeInsurance ) ) + { + //specify the start date of the contract + pSoldier->iStartOfInsuranceContract = CalcStartDayOfInsurance( pSoldier ); + pSoldier->uiStartTimeOfInsuranceContract = GetWorldTotalMin(); + } + + //transfer money + iAmountOfMoneyTransfer = CalculateInsuranceContractCost( uiInsuranceLength, pSoldier->ubProfile ); + + //if the user did have insruance already, + if( pSoldier->usLifeInsurance ) + { + //specify the start date of the contract + pSoldier->iStartOfInsuranceContract = CalcStartDayOfInsurance( pSoldier ); + } + + //add transaction to finaces page + //if the player has life insurance + if( pSoldier->usLifeInsurance ) + { + //if the player is extending the contract + if( iAmountOfMoneyTransfer > 0 ) + AddTransactionToPlayersBook( EXTENDED_INSURANCE, pSoldier->ubProfile, GetWorldTotalMin(), -( iAmountOfMoneyTransfer ) ); + else + Assert(0); + } + else + { + //if the player doesnt have enough money, tell him + if( LaptopSaveInfo.iCurrentBalance < iAmountOfMoneyTransfer ) + { + wchar_t sText[800]; + + GetInsuranceText( INS_MLTI_NOT_ENOUGH_FUNDS, sText ); + if( guiCurrentScreen == LAPTOP_SCREEN ) + DoLapTopMessageBox( MSG_BOX_RED_ON_WHITE, sText, LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + else + DoMapMessageBox( MSG_BOX_RED_ON_WHITE, (INT16 *)sText, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL); + } + else + { + //else if the player has enought to cover the bill, let him + + //the player just purchased life insurance + AddTransactionToPlayersBook( PURCHASED_INSURANCE, pSoldier->ubProfile, GetWorldTotalMin(), -( iAmountOfMoneyTransfer ) ); + + //add an entry in the history page for the purchasing of life insurance + AddHistoryToPlayersLog(HISTORY_PURCHASED_INSURANCE, pSoldier->ubProfile, GetWorldTotalMin(), -1, -1 ); + + //Set that we have life insurance + pSoldier->usLifeInsurance = 1; + } + } + + pSoldier->iTotalLengthOfInsuranceContract += uiInsuranceLength; + + //make sure the length doesnt exceed the contract length + if( ( GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ) ) > GetTimeRemainingOnSoldiersContract( pSoldier ) ) + { + pSoldier->iTotalLengthOfInsuranceContract -= GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ) - GetTimeRemainingOnSoldiersContract( pSoldier ); + } +} + +BOOLEAN CanSoldierExtendInsuranceContract( SOLDIERTYPE *pSoldier ) +{ + if( CalculateSoldiersInsuranceContractLength( pSoldier ) != 0 ) + return( TRUE ); + else + return( FALSE ); +} + + +INT32 CalculateSoldiersInsuranceContractLength( SOLDIERTYPE *pSoldier ) +{ + INT32 iInsuranceContractLength=0; + UINT32 uiTimeRemainingOnSoldiersContract = GetTimeRemainingOnSoldiersContract( pSoldier ); + + + //if the merc is dead + if( IsMercDead( pSoldier->ubProfile ) ) + return( 0 ); + + + // only mercs with at least 2 days to go on their employment contract are insurable + // def: 2/5/99. However if they already have insurance is SHOULD be ok + if( uiTimeRemainingOnSoldiersContract < 2 && !( pSoldier->usLifeInsurance != 0 && uiTimeRemainingOnSoldiersContract >= 1 ) ) + { + return( 0 ); + } + + // + //Calculate the insurance contract length + // + + //if the soldier has an insurance contract, dont deduct a day + if( pSoldier->usLifeInsurance || DidGameJustStart() ) + iInsuranceContractLength = uiTimeRemainingOnSoldiersContract - GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ); + + //else deduct a day + else + iInsuranceContractLength = uiTimeRemainingOnSoldiersContract - GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ) - 1; + + //make sure the length doesnt exceed the contract length + if( ( GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ) + iInsuranceContractLength ) > uiTimeRemainingOnSoldiersContract ) + { + iInsuranceContractLength = uiTimeRemainingOnSoldiersContract - GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ); + } + + //Is the mercs insurace contract is less then a day, set it to 0 + if( iInsuranceContractLength < 0 ) + iInsuranceContractLength = 0; + + if( pSoldier->usLifeInsurance && pSoldier->iStartOfInsuranceContract >= (INT32)GetWorldDay() && iInsuranceContractLength < 2 ) + iInsuranceContractLength = 0; + + return( iInsuranceContractLength ); +} + +INT32 CalcStartDayOfInsurance( SOLDIERTYPE *pSoldier ) +{ + UINT32 uiDayToStartInsurance=0; + + //if the soldier was just hired ( in transit ), and the game didnt just start + if( pSoldier->bAssignment == IN_TRANSIT && !DidGameJustStart() ) + { + uiDayToStartInsurance = GetWorldDay( ); + } + else + { + //Get tomorows date ( and convert it to days ) + uiDayToStartInsurance = GetMidnightOfFutureDayInMinutes( 1 ) / 1440; + } + + return( uiDayToStartInsurance ); +} + +BOOLEAN AreAnyAimMercsOnTeam( ) +{ + INT16 sNextMercID = 0; + BOOLEAN fIsThereAnyAimMercs = FALSE; + SOLDIERTYPE *pSoldier = NULL; + + for( sNextMercID = 0; sNextMercID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; sNextMercID++ ) + { + pSoldier = &Menptr[ GetSoldierIDFromMercID( (UINT8) sNextMercID ) ]; + + //check to see if any of the mercs are AIM mercs + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) + { + fIsThereAnyAimMercs = TRUE; + } + } + + return( fIsThereAnyAimMercs ); +} \ No newline at end of file diff --git a/Laptop/insurance Contract.h b/Laptop/insurance Contract.h new file mode 100644 index 00000000..c7dcf460 --- /dev/null +++ b/Laptop/insurance Contract.h @@ -0,0 +1,31 @@ +#ifndef __INSURANCE_CONTRACT_H +#define __INSURANCE_CONTRACT_H + +#include "Soldier Control.h" + + +void GameInitInsuranceContract(); +BOOLEAN EnterInsuranceContract(); +void ExitInsuranceContract(); +void HandleInsuranceContract(); +void RenderInsuranceContract(); + +extern INT16 gsCurrentInsuranceMercIndex; + +// determines if a merc will run out of there insurance contract +void DailyUpdateOfInsuredMercs(); + +//void InsuranceContractPayLifeInsuranceForDeadMerc( LIFE_INSURANCE_PAYOUT *pPayoutStruct ); + +BOOLEAN AddLifeInsurancePayout( SOLDIERTYPE *pSoldier ); +void InsuranceContractPayLifeInsuranceForDeadMerc( UINT8 ubPayoutID ); +void StartInsuranceInvestigation( UINT8 ubPayoutID ); +void EndInsuranceInvestigation( UINT8 ubPayoutID ); + +INT32 CalculateInsuranceContractCost( INT32 iLength, UINT8 ubMercID ); + +void InsuranceContractEndGameShutDown(); + +void PurchaseOrExtendInsuranceForSoldier( SOLDIERTYPE *pSoldier, UINT32 uiInsuranceLength ); + +#endif \ No newline at end of file diff --git a/Laptop/insurance Info.cpp b/Laptop/insurance Info.cpp new file mode 100644 index 00000000..26ee1e4d --- /dev/null +++ b/Laptop/insurance Info.cpp @@ -0,0 +1,574 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "insurance Info.h" + #include "insurance.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Insurance Text.h" + #include "Text.h" +#endif + + +#define INS_INFO_FRAUD_TEXT_COLOR FONT_MCOLOR_RED + + +#define INS_INFO_SUBTITLE_X 86 + LAPTOP_SCREEN_UL_X +#define INS_INFO_SUBTITLE_Y 62 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_INFO_SUBTITLE_LINE_Y INS_INFO_SUBTITLE_Y + 14 +#define INS_INFO_SUBTITLE_LINE_WIDTH 375 + +#define INS_INFO_FIRST_PARAGRAPH_WIDTH INS_INFO_SUBTITLE_LINE_WIDTH +#define INS_INFO_FIRST_PARAGRAPH_X INS_INFO_SUBTITLE_X +#define INS_INFO_FIRST_PARAGRAPH_Y INS_INFO_SUBTITLE_LINE_Y + 9 + +#define INS_INFO_SPACE_BN_PARAGRAPHS 12 + +#define INS_INFO_INFO_TOC_TITLE_X 170 +#define INS_INFO_INFO_TOC_TITLE_Y 54 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_INFO_TOC_SUBTITLE_X INS_INFO_SUBTITLE_X + + +#define INS_INFO_LINK_TO_CONTRACT_X 235 + LAPTOP_SCREEN_UL_X +#define INS_INFO_LINK_TO_CONTRACT_Y 392 + LAPTOP_SCREEN_WEB_UL_Y +#define INS_INFO_LINK_TO_CONTRACT_WIDTH 97//107 + +#define INS_INFO_LINK_START_OFFSET 20//14 +#define INS_INFO_LINK_START_X 262 + INS_INFO_LINK_START_OFFSET +#define INS_INFO_LINK_START_Y 392 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_INFO_LINK_TO_CONTRACT_TEXT_Y 355 + LAPTOP_SCREEN_WEB_UL_Y + + +UINT32 guiBulletImage; + +//The list of Info sub pages +enum +{ + INS_INFO_INFO_TOC, + INS_INFO_SUBMIT_CLAIM, + INS_INFO_PREMIUMS, + INS_INFO_RENEWL, + INS_INFO_CANCELATION, + INS_INFO_LAST_PAGE, +}; +UINT8 gubCurrentInsInfoSubPage = 0; + +BOOLEAN InsuranceInfoSubPagesVisitedFlag[ INS_INFO_LAST_PAGE-1 ]; + + + +INT32 guiInsPrevButtonImage; +void BtnInsPrevButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiInsPrevBackButton; + +INT32 guiInsNextButtonImage; +void BtnInsNextButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiInsNextBackButton; + + +//link to the varios pages +MOUSE_REGION gSelectedInsuranceInfoLinkRegion; +void SelectInsuranceLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +MOUSE_REGION gSelectedInsuranceInfoHomeLinkRegion; +void SelectInsuranceInfoHomeLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + + +void DisplaySubmitClaimPage(); +void DisplayPremiumPage(); +void DisplayRenewingPremiumPage(); +void DisplayCancelationPagePage(); +void DisableArrowButtonsIfOnLastOrFirstPage(); +void ChangingInsuranceInfoSubPage( UINT8 ubSubPageNumber ); +void DisplayInfoTocPage(); + + +void GameInitInsuranceInfo() +{ + +} + +void EnterInitInsuranceInfo() +{ + memset( &InsuranceInfoSubPagesVisitedFlag, 0, INS_INFO_LAST_PAGE-1); + +} + +BOOLEAN EnterInsuranceInfo() +{ + VOBJECT_DESC VObjectDesc; + UINT16 usPosX; + + InitInsuranceDefaults(); + + // load the Insurance bullet graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\bullet.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBulletImage)); + + + //left arrow + guiInsPrevButtonImage = LoadButtonImage("LAPTOP\\InsLeftButton.sti", 2,0,-1,1,-1 ); + guiInsPrevBackButton = CreateIconAndTextButton( guiInsPrevButtonImage, InsInfoText[INS_INFO_PREVIOUS], INS_FONT_BIG, + INS_FONT_COLOR, INS_FONT_SHADOW, + INS_FONT_COLOR, INS_FONT_SHADOW, + TEXT_CJUSTIFIED, + INS_INFO_LEFT_ARROW_BUTTON_X, INS_INFO_LEFT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsPrevButtonCallback); + SetButtonCursor( guiInsPrevBackButton, CURSOR_WWW ); + SpecifyButtonTextOffsets( guiInsPrevBackButton, 17, 16, FALSE ); + + + //Right arrow + guiInsNextButtonImage = LoadButtonImage("LAPTOP\\InsRightButton.sti", 2,0,-1,1,-1 ); + guiInsNextBackButton = CreateIconAndTextButton( guiInsNextButtonImage, InsInfoText[INS_INFO_NEXT], INS_FONT_BIG, + INS_FONT_COLOR, INS_FONT_SHADOW, + INS_FONT_COLOR, INS_FONT_SHADOW, + TEXT_CJUSTIFIED, + INS_INFO_RIGHT_ARROW_BUTTON_X, INS_INFO_RIGHT_ARROW_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnInsNextButtonCallback); + SetButtonCursor( guiInsNextBackButton, CURSOR_WWW ); + SpecifyButtonTextOffsets( guiInsNextBackButton, 18, 16, FALSE ); + + + usPosX = INS_INFO_LINK_START_X; + //link to go to the contract page + //link to go to the home page + MSYS_DefineRegion( &gSelectedInsuranceInfoHomeLinkRegion, usPosX, INS_INFO_LINK_TO_CONTRACT_Y-37, (UINT16)(usPosX + INS_INFO_LINK_TO_CONTRACT_WIDTH), INS_INFO_LINK_TO_CONTRACT_Y+2, MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceInfoHomeLinkRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceInfoHomeLinkRegion); + + usPosX += INS_INFO_LINK_START_OFFSET + INS_INFO_LINK_TO_CONTRACT_WIDTH; + MSYS_DefineRegion( &gSelectedInsuranceInfoLinkRegion, usPosX, INS_INFO_LINK_TO_CONTRACT_Y-37, (UINT16)(usPosX + INS_INFO_LINK_TO_CONTRACT_WIDTH), INS_INFO_LINK_TO_CONTRACT_Y+2, MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceLinkRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceInfoLinkRegion); + + + gubCurrentInsInfoSubPage = INS_INFO_INFO_TOC; + + RenderInsuranceInfo(); + + return(TRUE); +} + +void ExitInsuranceInfo() +{ + RemoveInsuranceDefaults(); + + + UnloadButtonImage( guiInsPrevButtonImage ); + RemoveButton( guiInsPrevBackButton ); + + UnloadButtonImage( guiInsNextButtonImage ); + RemoveButton( guiInsNextBackButton ); + + MSYS_RemoveRegion( &gSelectedInsuranceInfoLinkRegion); + MSYS_RemoveRegion( &gSelectedInsuranceInfoHomeLinkRegion); + + DeleteVideoObjectFromIndex( guiBulletImage ); +} + +void HandleInsuranceInfo() +{ + +} + +void RenderInsuranceInfo() +{ + wchar_t sText[800]; + UINT16 usNewLineOffset = 0; + UINT16 usPosX; + + DisableArrowButtonsIfOnLastOrFirstPage(); + + DisplayInsuranceDefaults(); + + SetFontShadow( INS_FONT_SHADOW ); + + + //Display the red bar under the link at the bottom + DisplaySmallRedLineWithShadow( INS_INFO_SUBTITLE_X, INS_INFO_SUBTITLE_LINE_Y, INS_INFO_SUBTITLE_X+INS_INFO_SUBTITLE_LINE_WIDTH, INS_INFO_SUBTITLE_LINE_Y); + + switch( gubCurrentInsInfoSubPage ) + { + case INS_INFO_INFO_TOC: + DisplayInfoTocPage(); + break; + + case INS_INFO_SUBMIT_CLAIM: + DisplaySubmitClaimPage(); + break; + + case INS_INFO_PREMIUMS: + DisplayPremiumPage(); + break; + + case INS_INFO_RENEWL: + DisplayRenewingPremiumPage(); + break; + + case INS_INFO_CANCELATION: + DisplayCancelationPagePage(); + break; + } + + usPosX = INS_INFO_LINK_START_X; + + //Display the red bar under the link at the bottom. and the text + DisplaySmallRedLineWithShadow( usPosX, INS_INFO_LINK_TO_CONTRACT_Y, (UINT16)(usPosX+INS_INFO_LINK_TO_CONTRACT_WIDTH), INS_INFO_LINK_TO_CONTRACT_Y); + swprintf( sText, L"%s", pMessageStrings[ MSG_HOMEPAGE ] ); + DisplayWrappedString( usPosX, INS_INFO_LINK_TO_CONTRACT_TEXT_Y+14, INS_INFO_LINK_TO_CONTRACT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + usPosX += INS_INFO_LINK_START_OFFSET + INS_INFO_LINK_TO_CONTRACT_WIDTH; + + //Display the red bar under the link at the bottom. and the text + DisplaySmallRedLineWithShadow( usPosX, INS_INFO_LINK_TO_CONTRACT_Y, (UINT16)(usPosX+INS_INFO_LINK_TO_CONTRACT_WIDTH), INS_INFO_LINK_TO_CONTRACT_Y); + GetInsuranceText( INS_SNGL_TO_ENTER_REVIEW, sText ); + DisplayWrappedString( usPosX, INS_INFO_LINK_TO_CONTRACT_TEXT_Y, INS_INFO_LINK_TO_CONTRACT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + + SetFontShadow(DEFAULT_SHADOW); + + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + +void BtnInsPrevButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + if( gubCurrentInsInfoSubPage > 0 ) + gubCurrentInsInfoSubPage --; + + ChangingInsuranceInfoSubPage( gubCurrentInsInfoSubPage ); +// fPausedReDrawScreenFlag = TRUE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnInsNextButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + if( gubCurrentInsInfoSubPage < (INS_INFO_LAST_PAGE -1) ) + gubCurrentInsInfoSubPage ++; + + ChangingInsuranceInfoSubPage( gubCurrentInsInfoSubPage ); + +// fPausedReDrawScreenFlag = TRUE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void SelectInsuranceLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE_CONTRACT; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + +void SelectInsuranceInfoHomeLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + +void DisplaySubmitClaimPage() +{ + wchar_t sText[800]; + UINT16 usNewLineOffset = 0; + UINT16 usPosX; + + usNewLineOffset = INS_INFO_FIRST_PARAGRAPH_Y; + + //Display the title slogan + GetInsuranceText( INS_SNGL_SUBMITTING_CLAIM, sText ); + DrawTextToScreen( sText, INS_INFO_SUBTITLE_X, INS_INFO_SUBTITLE_Y, 0, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + //Display the title slogan + GetInsuranceText( INS_MLTI_U_CAN_REST_ASSURED, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + GetInsuranceText( INS_MLTI_HAD_U_HIRED_AN_INDIVIDUAL, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + //display the BIG FRAUD + GetInsuranceText( INS_SNGL_FRAUD, sText ); + DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, (UINT16)(usNewLineOffset-1), INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_BIG, INS_INFO_FRAUD_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + usPosX = INS_INFO_FIRST_PARAGRAPH_X + StringPixLength( sText, INS_FONT_BIG ) + 2; + GetInsuranceText( INS_MLTI_WE_RESERVE_THE_RIGHT, sText ); + usNewLineOffset += DisplayWrappedString( usPosX, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + GetInsuranceText( INS_MLTI_SHOULD_THERE_BE_GROUNDS, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + GetInsuranceText( INS_MLTI_SHOULD_SUCH_A_SITUATION, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + +} + +void DisplayPremiumPage() +{ + wchar_t sText[800]; + UINT16 usNewLineOffset = 0; + HVOBJECT hPixHandle; + + usNewLineOffset = INS_INFO_FIRST_PARAGRAPH_Y; + + + //Display the title slogan + GetInsuranceText( INS_SNGL_PREMIUMS, sText ); + DrawTextToScreen( sText, INS_INFO_SUBTITLE_X, INS_INFO_SUBTITLE_Y, 0, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + GetInsuranceText( INS_MLTI_EACH_TIME_U_COME_TO_US, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + //Get and display the insurance bullet + GetVideoObject(&hPixHandle, guiBulletImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); + + GetInsuranceText( INS_MLTI_LENGTH_OF_EMPLOYMENT_CONTRACT, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + + //Get and display the insurance bullet + GetVideoObject(&hPixHandle, guiBulletImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); + + GetInsuranceText( INS_MLTI_EMPLOYEES_AGE_AND_HEALTH, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + + //Get and display the insurance bullet + GetVideoObject(&hPixHandle, guiBulletImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); + + GetInsuranceText( INS_MLTI_EMPLOOYEES_TRAINING_AND_EXP, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; +} + + + +void DisplayRenewingPremiumPage() +{ + wchar_t sText[800]; + UINT16 usNewLineOffset = 0; +// HVOBJECT hPixHandle; + + usNewLineOffset = INS_INFO_FIRST_PARAGRAPH_Y; + + //Display the title slogan + GetInsuranceText( INS_SNGL_RENEWL_PREMIUMS, sText ); + DrawTextToScreen( sText, INS_INFO_SUBTITLE_X, INS_INFO_SUBTITLE_Y, 0, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + GetInsuranceText( INS_MLTI_WHEN_IT_COMES_TIME_TO_RENEW, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + GetInsuranceText( INS_MLTI_SHOULD_THE_PROJECT_BE_GOING_WELL, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + //display the LOWER PREMIUM FOR RENWING EARLY + GetInsuranceText( INS_SNGL_LOWER_PREMIUMS_4_RENEWING, sText ); + DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, (UINT16)(usNewLineOffset-1), INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_BIG, INS_INFO_FRAUD_TEXT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS + 2; + +/* + //Get and display the insurance bullet + GetVideoObject(&hPixHandle, guiBulletImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); + + GetInsuranceText( INS_MLTI_IF_U_EXTEND_THE_CONTRACT, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; +*/ +} + + + + +void DisplayCancelationPagePage() +{ + wchar_t sText[800]; + UINT16 usNewLineOffset = 0; + + usNewLineOffset = INS_INFO_FIRST_PARAGRAPH_Y; + + //Display the title slogan + GetInsuranceText( INS_SNGL_POLICY_CANCELATIONS, sText ); + DrawTextToScreen( sText, INS_INFO_SUBTITLE_X, INS_INFO_SUBTITLE_Y, 0, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + GetInsuranceText( INS_MLTI_WE_WILL_ACCEPT_INS_CANCELATION, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + GetInsuranceText( INS_MLTI_1_HOUR_EXCLUSION_A, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + GetInsuranceText( INS_MLTI_1_HOUR_EXCLUSION_B, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; +} + +void DisableArrowButtonsIfOnLastOrFirstPage() +{ + if( gubCurrentInsInfoSubPage == INS_INFO_INFO_TOC) + DisableButton( guiInsPrevBackButton); + else + EnableButton( guiInsPrevBackButton ); + + if( gubCurrentInsInfoSubPage == INS_INFO_LAST_PAGE - 1 ) + DisableButton( guiInsNextBackButton); + else + EnableButton( guiInsNextBackButton ); +} + + + +void ChangingInsuranceInfoSubPage( UINT8 ubSubPageNumber ) +{ + fLoadPendingFlag = TRUE; + + if( InsuranceInfoSubPagesVisitedFlag[ ubSubPageNumber ] == FALSE ) + { + fConnectingToSubPage = TRUE; + fFastLoadFlag = FALSE; + + InsuranceInfoSubPagesVisitedFlag[ ubSubPageNumber ] = TRUE; + } + else + { + fConnectingToSubPage = TRUE; + fFastLoadFlag = TRUE; + } +} + +void DisplayInfoTocPage() +{ + wchar_t sText[800]; + UINT16 usNewLineOffset = 0; + HVOBJECT hPixHandle; + UINT16 usPosY; + + usNewLineOffset = INS_INFO_FIRST_PARAGRAPH_Y; + + //Display the title slogan + GetInsuranceText( INS_SNGL_HOW_DOES_INS_WORK, sText ); + DrawTextToScreen( sText, INS_INFO_INFO_TOC_TITLE_X, INS_INFO_INFO_TOC_TITLE_Y, 439, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the First paragraph + GetInsuranceText( INS_MLTI_HIRING_4_SHORT_TERM_HIGH_RISK_1, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + //Display the 2nd paragraph + GetInsuranceText( INS_MLTI_HIRING_4_SHORT_TERM_HIGH_RISK_2, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + + //Display the sub title + GetInsuranceText( INS_SNGL_WE_CAN_OFFER_U, sText ); + DrawTextToScreen( sText, INS_INFO_TOC_SUBTITLE_X, usNewLineOffset, 640-INS_INFO_INFO_TOC_TITLE_X, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + usPosY = usNewLineOffset + 12; + DisplaySmallRedLineWithShadow( INS_INFO_SUBTITLE_X, usPosY, (UINT16)(INS_INFO_SUBTITLE_X+INS_INFO_SUBTITLE_LINE_WIDTH), usPosY ); + + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + + // + // Premiuns bulleted sentence + // + + //Get and display the insurance bullet + GetVideoObject(&hPixHandle, guiBulletImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); + + GetInsuranceText( INS_MLTI_REASONABLE_AND_FLEXIBLE, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; + + + + // + // Quick and efficient claims + // + + //Get and display the insurance bullet + GetVideoObject(&hPixHandle, guiBulletImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INS_INFO_FIRST_PARAGRAPH_X, usNewLineOffset, VO_BLT_SRCTRANSPARENCY,NULL); + + GetInsuranceText( INS_MLTI_QUICKLY_AND_EFFICIENT, sText ); + usNewLineOffset += DisplayWrappedString( INS_INFO_FIRST_PARAGRAPH_X+INSURANCE_BULLET_TEXT_OFFSET_X, usNewLineOffset, INS_INFO_FIRST_PARAGRAPH_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + usNewLineOffset += INS_INFO_SPACE_BN_PARAGRAPHS; +} + diff --git a/Laptop/insurance Info.h b/Laptop/insurance Info.h new file mode 100644 index 00000000..98c727b5 --- /dev/null +++ b/Laptop/insurance Info.h @@ -0,0 +1,12 @@ +#ifndef __INSURANCE_INFO_H +#define __INSURANCE_INFO_H + +void GameInitInsuranceInfo(); +BOOLEAN EnterInsuranceInfo(); +void ExitInsuranceInfo(); +void HandleInsuranceInfo(); +void RenderInsuranceInfo(); +void EnterInitInsuranceInfo(); + + +#endif \ No newline at end of file diff --git a/Laptop/insurance.cpp b/Laptop/insurance.cpp new file mode 100644 index 00000000..91124717 --- /dev/null +++ b/Laptop/insurance.cpp @@ -0,0 +1,399 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "insurance.h" + #include "insurance Contract.h" + #include "WCheck.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Line.h" + #include "Insurance Text.h" + #include "Encrypted File.h" + #include "Text.h" + #include "Multi Language Graphic Utils.h" +#endif + + +#define INSURANCE_BACKGROUND_WIDTH 125 +#define INSURANCE_BACKGROUND_HEIGHT 100 + +#define INSURANCE_BIG_TITLE_X 95 + LAPTOP_SCREEN_UL_X +#define INSURANCE_BIG_TITLE_Y 4 + LAPTOP_SCREEN_WEB_UL_Y + +#define INSURANCE_RED_BAR_X LAPTOP_SCREEN_UL_X +#define INSURANCE_RED_BAR_Y LAPTOP_SCREEN_WEB_UL_Y + +#define INSURANCE_TOP_RED_BAR_X LAPTOP_SCREEN_UL_X + 66 +#define INSURANCE_TOP_RED_BAR_Y 109 + LAPTOP_SCREEN_WEB_UL_Y +#define INSURANCE_TOP_RED_BAR_Y1 31 + LAPTOP_SCREEN_WEB_UL_Y + +#define INSURANCE_BOTTOM_RED_BAR_Y 345 + LAPTOP_SCREEN_WEB_UL_Y + +#define INSURANCE_BOTTOM_LINK_RED_BAR_X 77 + LAPTOP_SCREEN_UL_X +#define INSURANCE_BOTTOM_LINK_RED_BAR_Y 392 + LAPTOP_SCREEN_WEB_UL_Y +#define INSURANCE_BOTTOM_LINK_RED_BAR_WIDTH 107 +#define INSURANCE_BOTTOM_LINK_RED_BAR_OFFSET 148 +#define INSURANCE_BOTTOM_LINK_RED_BAR_X_2 INSURANCE_BOTTOM_LINK_RED_BAR_X + INSURANCE_BOTTOM_LINK_RED_BAR_OFFSET +#define INSURANCE_BOTTOM_LINK_RED_BAR_X_3 INSURANCE_BOTTOM_LINK_RED_BAR_X_2 + INSURANCE_BOTTOM_LINK_RED_BAR_OFFSET + +#define INSURANCE_LINK_TEXT_WIDTH INSURANCE_BOTTOM_LINK_RED_BAR_WIDTH + +#define INSURANCE_LINK_TEXT_1_X INSURANCE_BOTTOM_LINK_RED_BAR_X +#define INSURANCE_LINK_TEXT_1_Y INSURANCE_BOTTOM_LINK_RED_BAR_Y - 36 + +#define INSURANCE_LINK_TEXT_2_X INSURANCE_LINK_TEXT_1_X + INSURANCE_BOTTOM_LINK_RED_BAR_OFFSET +#define INSURANCE_LINK_TEXT_2_Y INSURANCE_LINK_TEXT_1_Y + +#define INSURANCE_LINK_TEXT_3_X INSURANCE_LINK_TEXT_2_X + INSURANCE_BOTTOM_LINK_RED_BAR_OFFSET +#define INSURANCE_LINK_TEXT_3_Y INSURANCE_LINK_TEXT_1_Y + +#define INSURANCE_SUBTITLE_X INSURANCE_BOTTOM_LINK_RED_BAR_X + 15 +#define INSURANCE_SUBTITLE_Y 150 + LAPTOP_SCREEN_WEB_UL_Y + +#define INSURANCE_BULLET_TEXT_1_Y 188 + LAPTOP_SCREEN_WEB_UL_Y +#define INSURANCE_BULLET_TEXT_2_Y 215 + LAPTOP_SCREEN_WEB_UL_Y +#define INSURANCE_BULLET_TEXT_3_Y 242 + LAPTOP_SCREEN_WEB_UL_Y + +#define INSURANCE_BOTTOM_SLOGAN_X INSURANCE_SUBTITLE_X +#define INSURANCE_BOTTOM_SLOGAN_Y 285 + LAPTOP_SCREEN_WEB_UL_Y +#define INSURANCE_BOTTOM_SLOGAN_WIDTH 370 + +#define INSURANCE_SMALL_TITLE_X 64 + LAPTOP_SCREEN_UL_X +#define INSURANCE_SMALL_TITLE_Y 5 + LAPTOP_SCREEN_WEB_UL_Y + +#define INSURANCE_SMALL_TITLE_WIDTH 434 - 170 +#define INSURANCE_SMALL_TITLE_HEIGHT 40 - 10 + + +UINT32 guiInsuranceBackGround; +UINT32 guiInsuranceTitleImage; +UINT32 guiInsuranceSmallTitleImage; +UINT32 guiInsuranceRedBarImage; +UINT32 guiInsuranceBigRedLineImage; +UINT32 guiInsuranceBulletImage; + + +//link to the varios pages +MOUSE_REGION gSelectedInsuranceLinkRegion[3]; +void SelectInsuranceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +//link to the home page by clicking on the small title +MOUSE_REGION gSelectedInsuranceTitleLinkRegion; +void SelectInsuranceTitleLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + +void GameInitInsurance() +{ + +} + +BOOLEAN EnterInsurance() +{ + VOBJECT_DESC VObjectDesc; + UINT16 usPosX, i; + + SetBookMark( INSURANCE_BOOKMARK ); + + InitInsuranceDefaults(); + + // load the Insurance title graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_INSURANCETITLE ); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsuranceTitleImage)); + + // load the red bar on the side of the page and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Bullet.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsuranceBulletImage)); + + usPosX = INSURANCE_BOTTOM_LINK_RED_BAR_X; + for(i=0; i<3; i++) + { + MSYS_DefineRegion( &gSelectedInsuranceLinkRegion[i], usPosX, INSURANCE_BOTTOM_LINK_RED_BAR_Y-37, (UINT16)(usPosX + INSURANCE_BOTTOM_LINK_RED_BAR_WIDTH), INSURANCE_BOTTOM_LINK_RED_BAR_Y+2, MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceLinkRegion[i]); + MSYS_SetRegionUserData( &gSelectedInsuranceLinkRegion[i], 0, i ); + + usPosX += INSURANCE_BOTTOM_LINK_RED_BAR_OFFSET; + } + + RenderInsurance(); + + // reset the current merc index on the insurance contract page + gsCurrentInsuranceMercIndex = 0; + + return(TRUE); +} + +void ExitInsurance() +{ + UINT8 i; + + RemoveInsuranceDefaults(); + + DeleteVideoObjectFromIndex( guiInsuranceTitleImage ); + DeleteVideoObjectFromIndex( guiInsuranceBulletImage ); + + for(i=0; i<3; i++) + MSYS_RemoveRegion( &gSelectedInsuranceLinkRegion[i]); + +} + +void HandleInsurance() +{ + +} + +void RenderInsurance() +{ + wchar_t sText[800]; + HVOBJECT hPixHandle; + + DisplayInsuranceDefaults(); + + SetFontShadow( INS_FONT_SHADOW ); + + //Get and display the insurance title + GetVideoObject(&hPixHandle, guiInsuranceTitleImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INSURANCE_BIG_TITLE_X, INSURANCE_BIG_TITLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + //Display the title slogan + GetInsuranceText( INS_SNGL_WERE_LISTENING, sText ); + DrawTextToScreen( sText, LAPTOP_SCREEN_UL_X, INSURANCE_TOP_RED_BAR_Y-35, LAPTOP_SCREEN_LR_X-LAPTOP_SCREEN_UL_X, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the subtitle slogan + GetInsuranceText( INS_SNGL_LIFE_INSURANCE_SPECIALISTS, sText ); + DrawTextToScreen( sText, INSURANCE_SUBTITLE_X, INSURANCE_SUBTITLE_Y, 0, INS_FONT_BIG, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + //Display the bulleted text 1 + GetVideoObject(&hPixHandle, guiInsuranceBulletImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INSURANCE_SUBTITLE_X, INSURANCE_BULLET_TEXT_1_Y, VO_BLT_SRCTRANSPARENCY,NULL); + GetInsuranceText( INS_MLTI_EMPLOY_HIGH_RISK, sText ); + DrawTextToScreen( sText, INSURANCE_SUBTITLE_X+INSURANCE_BULLET_TEXT_OFFSET_X, INSURANCE_BULLET_TEXT_1_Y, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + //Display the bulleted text 2 + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INSURANCE_SUBTITLE_X, INSURANCE_BULLET_TEXT_2_Y, VO_BLT_SRCTRANSPARENCY,NULL); + GetInsuranceText( INS_MLTI_HIGH_FATALITY_RATE, sText ); + DrawTextToScreen( sText, INSURANCE_SUBTITLE_X+INSURANCE_BULLET_TEXT_OFFSET_X, INSURANCE_BULLET_TEXT_2_Y, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + //Display the bulleted text 3 + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INSURANCE_SUBTITLE_X, INSURANCE_BULLET_TEXT_3_Y, VO_BLT_SRCTRANSPARENCY,NULL); + GetInsuranceText( INS_MLTI_DRAIN_SALARY, sText ); + DrawTextToScreen( sText, INSURANCE_SUBTITLE_X+INSURANCE_BULLET_TEXT_OFFSET_X, INSURANCE_BULLET_TEXT_3_Y, 0, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + //Display the bottom slogan + GetInsuranceText( INS_MLTI_IF_ANSWERED_YES, sText ); + DrawTextToScreen( sText, INSURANCE_BOTTOM_SLOGAN_X, INSURANCE_BOTTOM_SLOGAN_Y, INSURANCE_BOTTOM_SLOGAN_WIDTH, INS_FONT_MED, INS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + + //Display the red bar under the link at the bottom. and the text + DisplaySmallRedLineWithShadow( INSURANCE_BOTTOM_LINK_RED_BAR_X, INSURANCE_BOTTOM_LINK_RED_BAR_Y, INSURANCE_BOTTOM_LINK_RED_BAR_X+INSURANCE_BOTTOM_LINK_RED_BAR_WIDTH, INSURANCE_BOTTOM_LINK_RED_BAR_Y); + + GetInsuranceText( INS_SNGL_COMMENTSFROM_CLIENTS, sText ); + DisplayWrappedString( INSURANCE_LINK_TEXT_1_X, INSURANCE_LINK_TEXT_1_Y, INSURANCE_LINK_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + + //Display the red bar under the link at the bottom + DisplaySmallRedLineWithShadow( INSURANCE_BOTTOM_LINK_RED_BAR_X_2, INSURANCE_BOTTOM_LINK_RED_BAR_Y, INSURANCE_BOTTOM_LINK_RED_BAR_X_2+INSURANCE_BOTTOM_LINK_RED_BAR_WIDTH, INSURANCE_BOTTOM_LINK_RED_BAR_Y); + + GetInsuranceText( INS_SNGL_HOW_DOES_INS_WORK, sText ); + DisplayWrappedString( INSURANCE_LINK_TEXT_2_X, INSURANCE_LINK_TEXT_2_Y+7, INSURANCE_LINK_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + + //Display the red bar under the link at the bottom + DisplaySmallRedLineWithShadow( INSURANCE_BOTTOM_LINK_RED_BAR_X_3, INSURANCE_BOTTOM_LINK_RED_BAR_Y, INSURANCE_BOTTOM_LINK_RED_BAR_X_3+INSURANCE_BOTTOM_LINK_RED_BAR_WIDTH, INSURANCE_BOTTOM_LINK_RED_BAR_Y); + + GetInsuranceText( INS_SNGL_TO_ENTER_REVIEW, sText ); + DisplayWrappedString( INSURANCE_LINK_TEXT_3_X, INSURANCE_LINK_TEXT_3_Y+7, INSURANCE_LINK_TEXT_WIDTH, 2, INS_FONT_MED, INS_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + + + SetFontShadow(DEFAULT_SHADOW); + + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + +BOOLEAN InitInsuranceDefaults() +{ + VOBJECT_DESC VObjectDesc; + + // load the Flower Account Box graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BackGroundTile.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsuranceBackGround)); + + // load the red bar on the side of the page and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\LeftTile.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsuranceRedBarImage)); + + // load the red bar on the side of the page and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\LargeBar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsuranceBigRedLineImage)); + + //if it is not the first page, display the small title + if( guiCurrentLaptopMode != LAPTOP_MODE_INSURANCE ) + { + // load the small title for the every page other then the first page + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_SMALLTITLE ); + CHECKF(AddVideoObject(&VObjectDesc, &guiInsuranceSmallTitleImage)); + + //create the link to the home page on the small titles + MSYS_DefineRegion( &gSelectedInsuranceTitleLinkRegion, INSURANCE_SMALL_TITLE_X+85, INSURANCE_SMALL_TITLE_Y, (UINT16)(INSURANCE_SMALL_TITLE_X + INSURANCE_SMALL_TITLE_WIDTH), (UINT16)(INSURANCE_SMALL_TITLE_Y+INSURANCE_SMALL_TITLE_HEIGHT), MSYS_PRIORITY_HIGH, + CURSOR_WWW, MSYS_NO_CALLBACK, SelectInsuranceTitleLinkRegionCallBack); + MSYS_AddRegion(&gSelectedInsuranceTitleLinkRegion); + } + + return( TRUE ); +} + +void DisplayInsuranceDefaults() +{ + HVOBJECT hPixHandle; + UINT8 i; + UINT16 usPosY; + + WebPageTileBackground(4, 4, INSURANCE_BACKGROUND_WIDTH, INSURANCE_BACKGROUND_HEIGHT, guiInsuranceBackGround); + + usPosY = INSURANCE_RED_BAR_Y; + + GetVideoObject(&hPixHandle, guiInsuranceRedBarImage ); + for(i=0; i<4; i++) + { + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INSURANCE_RED_BAR_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); + usPosY += INSURANCE_BACKGROUND_HEIGHT; + } + + //display the top red bar + switch( guiCurrentLaptopMode ) + { + case LAPTOP_MODE_INSURANCE: + usPosY = INSURANCE_TOP_RED_BAR_Y; + + //display the top red bar + GetVideoObject(&hPixHandle, guiInsuranceBigRedLineImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INSURANCE_TOP_RED_BAR_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL); + + break; + + case LAPTOP_MODE_INSURANCE_INFO: + case LAPTOP_MODE_INSURANCE_CONTRACT: + usPosY = INSURANCE_TOP_RED_BAR_Y1; + break; + } + + //display the Bottom red bar + GetVideoObject(&hPixHandle, guiInsuranceBigRedLineImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INSURANCE_TOP_RED_BAR_X, INSURANCE_BOTTOM_RED_BAR_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //if it is not the first page, display the small title + if( guiCurrentLaptopMode != LAPTOP_MODE_INSURANCE ) + { + //display the small title bar + GetVideoObject(&hPixHandle, guiInsuranceSmallTitleImage ); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0, INSURANCE_SMALL_TITLE_X, INSURANCE_SMALL_TITLE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + } +} + +void RemoveInsuranceDefaults() +{ + DeleteVideoObjectFromIndex( guiInsuranceBackGround ); + DeleteVideoObjectFromIndex( guiInsuranceRedBarImage ); + DeleteVideoObjectFromIndex( guiInsuranceBigRedLineImage ); + + //if it is not the first page, display the small title + if( guiPreviousLaptopMode != LAPTOP_MODE_INSURANCE ) + { + DeleteVideoObjectFromIndex( guiInsuranceSmallTitleImage ); + MSYS_RemoveRegion( &gSelectedInsuranceTitleLinkRegion ); + } +} + + +void DisplaySmallRedLineWithShadow( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 EndY) +{ + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + + // draw the red line + LineDraw(FALSE, usStartX, usStartY, EndX, EndY, Get16BPPColor( FROMRGB( 255, 0, 0 ) ), pDestBuf); + + // draw the black shadow line + LineDraw(FALSE, usStartX+1, usStartY+1, EndX+1, EndY+1, Get16BPPColor( FROMRGB( 0, 0, 0 ) ), pDestBuf); + + // unlock frame buffer + UnLockVideoSurface( FRAME_BUFFER ); +} + +void GetInsuranceText( UINT8 ubNumber, STR16 pString ) +{ + UINT32 uiStartLoc=0; + + if( ubNumber < INS_MULTI_LINE_BEGINS ) + { + //Get and display the card saying + uiStartLoc = INSURANCE_TEXT_SINGLE_LINE_SIZE * ubNumber; + LoadEncryptedDataFromFile(INSURANCE_TEXT_SINGLE_FILE, pString, uiStartLoc, INSURANCE_TEXT_SINGLE_LINE_SIZE ); + } + else + { + //Get and display the card saying + uiStartLoc = INSURANCE_TEXT_MULTI_LINE_SIZE * ( ubNumber - INS_MULTI_LINE_BEGINS - 1 ); + LoadEncryptedDataFromFile(INSURANCE_TEXT_MULTI_FILE, pString, uiStartLoc, INSURANCE_TEXT_MULTI_LINE_SIZE ); + } +} + + +void SelectInsuranceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + UINT32 uiInsuranceLink = MSYS_GetRegionUserData( pRegion, 0 ); + + if( uiInsuranceLink == 0 ) + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE_COMMENTS; + else if( uiInsuranceLink == 1 ) + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE_INFO; + else if( uiInsuranceLink == 2 ) + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE_CONTRACT; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + +void SelectInsuranceTitleLinkRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + guiCurrentLaptopMode = LAPTOP_MODE_INSURANCE; + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + } +} + + + + + + + diff --git a/Laptop/insurance.h b/Laptop/insurance.h new file mode 100644 index 00000000..35af5e98 --- /dev/null +++ b/Laptop/insurance.h @@ -0,0 +1,46 @@ +#ifndef __INSURANCE_H +#define __INSURANCE_H + + +#define INS_FONT_COLOR 2 +#define INS_FONT_COLOR_RED FONT_MCOLOR_RED +#define INS_FONT_BIG FONT14ARIAL +#define INS_FONT_MED FONT12ARIAL +#define INS_FONT_SMALL FONT10ARIAL + +#define INS_FONT_BTN_COLOR FONT_MCOLOR_WHITE +#define INS_FONT_BTN_SHADOW_COLOR 2 + +#define INS_FONT_SHADOW FONT_MCOLOR_WHITE + +#define INSURANCE_BULLET_TEXT_OFFSET_X 21 + +#define INS_INFO_LEFT_ARROW_BUTTON_X 71 + LAPTOP_SCREEN_UL_X +#define INS_INFO_LEFT_ARROW_BUTTON_Y 354 + LAPTOP_SCREEN_WEB_UL_Y + +#define INS_INFO_RIGHT_ARROW_BUTTON_X 409 + LAPTOP_SCREEN_UL_X +#define INS_INFO_RIGHT_ARROW_BUTTON_Y INS_INFO_LEFT_ARROW_BUTTON_Y + + + +void GameInitInsurance(); +BOOLEAN EnterInsurance(); +void ExitInsurance(); +void HandleInsurance(); +void RenderInsurance(); + +BOOLEAN InitInsuranceDefaults(); +void DisplayInsuranceDefaults(); +void RemoveInsuranceDefaults(); +void DisplaySmallRedLineWithShadow( UINT16 usStartX, UINT16 usStartY, UINT16 EndX, UINT16 EndY); +void GetInsuranceText( UINT8 ubNumber, STR16 pString ); + + + +#endif + + + + + + diff --git a/Laptop/laptop.cpp b/Laptop/laptop.cpp new file mode 100644 index 00000000..5b4d2abe --- /dev/null +++ b/Laptop/laptop.cpp @@ -0,0 +1,6388 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" + #include "HelpScreen.h" + #include "BrokenLink.h" + #include "BobbyRShipments.h" +#else + #include "sgp.h" + #include "Utilities.h" + #include "WCheck.h" + #include "Render Dirty.h" + #include "sysutil.h" + #include "screens.h" + #include "cursors.h" + #include "Event Pump.h" + #include "laptop.h" + #include "aim.h" + #include "AimMembers.h" + #include "AimFacialIndex.h" + #include "AimSort.h" + #include "AimArchives.h" + #include "AimHistory.h" + #include "AimLinks.h" + #include "AimPolicies.h" + #include "mercs.h" + #include "mercs Files.h" + #include "mercs Account.h" + #include "mercs No Account.h" + #include "BobbyR.h" + #include "BobbyRGuns.h" + #include "BobbyRAmmo.h" + #include "BobbyRArmour.h" + #include "BobbyRMisc.h" + #include "BobbyRUsed.h" + #include "BobbyRMailOrder.h" + #include "CharProfile.h" + #include "florist.h" + #include "florist Cards.h" + #include "florist Gallery.h" + #include "florist Order Form.h" + #include "insurance.h" + #include "insurance Contract.h" + #include "insurance Info.h" + #include "insurance Comments.h" + #include "funeral.h" + #include "sirtech.h" + #include "finances.h" + #include "personnel.h" + #include "history.h" + #include "files.h" + #include "email.h" + #include "Interface Control.h" + #include "Game Event Hook.h" + #include "WordWrap.h" + #include "Game init.h" + #include "Game Clock.h" + #include "vobject_blitters.h" + #include "Soldier Control.h" + #include "Soldier Profile.h" + #include "Overhead.h" + #include "environment.h" + #include "LibraryDataBase.h" + #include "music control.h" + #include "SaveLoadGame.h" + #include "LaptopSave.h" + #include "RenderWorld.h" + #include "gameloop.h" + #include "english.h" + #include "random.h" + #include "Merc Hiring.h" + #include "Map Screen Interface.h" + #include "ambient control.h" + #include "Sound Control.h" + #include "text.h" + #include "Message.h" + #include "Map Screen Interface Bottom.h" + #include "Cursor Control.h" + #include "Quests.h" + #include "Multi Language Graphic Utils.h" + #include "BrokenLink.h" + #include "BobbyRShipments.h" +#endif + + + + +// icons text id's +enum{ + MAIL=0, + WWW, + FINANCIAL, + PERSONNEL, + HISTORY, + FILES, + MAX_ICON_COUNT, +}; + +enum{ + +}; +enum{ + NO_REGION=0, + EMAIL_REGION, + WWW_REGION, + FINANCIAL_REGION, + PERSONNEL_REGION, + HISTORY_REGION, + FILES_REGION, +}; + + + + + +struct rgbcolor +{ + UINT8 ubRed; + UINT8 ubGreen; + UINT8 ubBlue; +}; + +typedef struct rgbcolor RGBCOLOR; + +RGBCOLOR GlowColors[]={ + {0,0,0}, + {25,0,0}, + {50,0,0}, + {75,0,0}, + {100,0,0}, + {125,0,0}, + {150,0,0}, + {175,0,0}, + {200,0,0}, + {225,0,0}, + {250,0,0}, +}; + + +// laptop programs +enum{ + LAPTOP_PROGRAM_MAILER, + LAPTOP_PROGRAM_WEB_BROWSER, + LAPTOP_PROGRAM_FILES, + LAPTOP_PROGRAM_PERSONNEL, + LAPTOP_PROGRAM_FINANCES, + LAPTOP_PROGRAM_HISTORY, + +}; + +// laptop program states +enum{ + LAPTOP_PROGRAM_MINIMIZED, + LAPTOP_PROGRAM_OPEN, +}; +#define LAPTOP_ICONS_X iScreenWidthOffset + 33 +#define LAPTOP_ICONS_MAIL_Y iScreenHeightOffset + 30 +#define LAPTOP_ICONS_WWW_Y iScreenHeightOffset + 87 +#define LAPTOP_ICONS_FINANCIAL_Y iScreenHeightOffset + 157 +#define LAPTOP_ICONS_PERSONNEL_Y iScreenHeightOffset + 238 +#define LAPTOP_ICONS_HISTORY_Y iScreenHeightOffset + 305 +#define LAPTOP_ICONS_FILES_Y iScreenHeightOffset + 355 +#define LAPTOP_ICON_TEXT_X iScreenWidthOffset + 24 + +#define LAPTOP_ICON_TEXT_WIDTH 79 +#define LAPTOP_ICON_TEXT_HEIGHT 6 + +#define LAPTOP_ICON_TEXT_MAIL_Y iScreenHeightOffset + 77 +#define LAPTOP_ICON_TEXT_WWW_Y iScreenHeightOffset + 142 +#define LAPTOP_ICON_TEXT_FINANCIAL_Y iScreenHeightOffset + 214 +#define LAPTOP_ICON_TEXT_PERSONNEL_Y iScreenHeightOffset + 296 +#define LAPTOP_ICON_TEXT_HISTORY_Y iScreenHeightOffset + 356 +#define LAPTOP_ICON_TEXT_FILES_Y iScreenHeightOffset + 415 + +#define LAPTOPICONFONT FONT10ARIAL +#define BOOK_FONT FONT10ARIAL +#define DOWNLOAD_FONT FONT12ARIAL +#define ERROR_TITLE_FONT FONT14ARIAL +#define ERROR_FONT FONT12ARIAL + + +#define HISTORY_ICON_OFFSET_X 0 +#define FILES_ICON_OFFSET_X 3 +#define FINANCIAL_ICON_OFFSET_X 0 +#define LAPTOP_ICON_WIDTH 80 +#define MAX_BUTTON_COUNT 1 +#define ON_BUTTON 0 +#define GLOW_DELAY 70 +#define WWW_COUNT 6 +#define ICON_INTERVAL 150 +#define BOOK_X iScreenWidthOffset + 111 +#define BOOK_TOP_Y iScreenHeightOffset + 79 +#define BOOK_HEIGHT 12 +#define DOWN_HEIGHT 19 +#define BOOK_WIDTH 100 +#define SCROLL_MIN -100 +#define SCROLL_DIFFERENCE 10 + +#define LONG_UNIT_TIME 120 +#define UNIT_TIME 40 +#define LOAD_TIME UNIT_TIME * 30 +#define FAST_UNIT_TIME 3 +#define FASTEST_UNIT_TIME 2 +#define ALMOST_FAST_UNIT_TIME 25 +#define ALMOST_FAST_LOAD_TIME ALMOST_FAST_UNIT_TIME * 30 +#define FAST_LOAD_TIME FAST_UNIT_TIME * 30 +#define LONG_LOAD_TIME LONG_UNIT_TIME * 30 +#define FASTEST_LOAD_TIME FASTEST_UNIT_TIME * 30 +#define DOWNLOAD_X iScreenWidthOffset + 300 +#define DOWNLOAD_Y iScreenHeightOffset + 200 +#define LAPTOP_WINDOW_X DOWNLOAD_X + 12 +#define LAPTOP_WINDOW_Y DOWNLOAD_Y + 25 +#define LAPTOP_BAR_Y LAPTOP_WINDOW_Y + 2 +#define LAPTOP_BAR_X LAPTOP_WINDOW_X + 1 +#define UNIT_WIDTH 4 +#define LAPTOP_WINDOW_WIDTH 150 +#define LAPTOP_WINDOW_HEIGHT 50 +#define DOWN_STRING_X DOWNLOAD_X + 47 +#define DOWN_STRING_Y DOWNLOAD_Y + 5 +#define ERROR_X iScreenWidthOffset + 300 +#define ERROR_Y iScreenHeightOffset + 200 +#define ERROR_BTN_X iScreenWidthOffset + 43 +#define ERROR_BTN_Y ERROR_Y + 70 +#define ERROR_TITLE_X ERROR_X + 3 +#define ERROR_TITLE_Y ERROR_Y + 3 +#define ERROR_BTN_TEXT_X iScreenWidthOffset + 20 +#define ERROR_BTN_TEXT_Y iScreenHeightOffset + 9 +#define ERROR_TEXT_X iScreenWidthOffset + 0 +#define ERROR_TEXT_Y iScreenHeightOffset + 15 +#define LAPTOP_TITLE_ICONS_X iScreenWidthOffset + 113 +#define LAPTOP_TITLE_ICONS_Y iScreenHeightOffset + 27 + +// HD flicker times +#define HD_FLICKER_TIME 3000 +#define FLICKER_TIME 50 + + +#define NUMBER_OF_LAPTOP_TITLEBAR_ITERATIONS 18 +#define LAPTOP_TITLE_BAR_WIDTH 500 +#define LAPTOP_TITLE_BAR_HEIGHT 24 + +#define LAPTOP_TITLE_BAR_TOP_LEFT_X iScreenWidthOffset + 111 +#define LAPTOP_TITLE_BAR_TOP_LEFT_Y iScreenHeightOffset + 25 +#define LAPTOP_TITLE_BAR_TOP_RIGHT_X iScreenWidthOffset + 610 +#define LAPTOP_TITLE_BAR_TOP_RIGHT_Y LAPTOP_TITLE_BAR_TOP_LEFT_Y + +#define LAPTOP_TITLE_BAR_ICON_OFFSET_X 5 +#define LAPTOP_TITLE_BAR_ICON_OFFSET_Y 2 +#define LAPTOP_TITLE_BAR_TEXT_OFFSET_X 29 +#define LAPTOP_TITLE_BAR_TEXT_OFFSET_Y 8 + +#define LAPTOP_PROGRAM_ICON_X LAPTOP_TITLE_BAR_TOP_LEFT_X +#define LAPTOP_PROGRAM_ICON_Y LAPTOP_TITLE_BAR_TOP_LEFT_Y +#define LAPTOP_PROGRAM_ICON_WIDTH 20 +#define LAPTOP_PROGRAM_ICON_HEIGHT 20 +#define DISPLAY_TIME_FOR_WEB_BOOKMARK_NOTIFY 2000 + +// the wait time for closing of laptop animation/delay +#define EXIT_LAPTOP_DELAY_TIME 100 + +UINT32 guiTitleBarSurface; +BOOLEAN gfTitleBarSurfaceAlreadyActive=FALSE; +extern BOOLEAN fFirstTimeInGameScreen; + +#define LAPTOP__NEW_FILE_ICON_X iScreenWidthOffset + 83 +#define LAPTOP__NEW_FILE_ICON_Y iScreenHeightOffset + 412 + +#define LAPTOP__NEW_EMAIL_ICON_X iScreenWidthOffset + 67 +#define LAPTOP__NEW_EMAIL_ICON_Y LAPTOP__NEW_FILE_ICON_Y + + +// Mode values +UINT32 guiCurrentLaptopMode; +UINT32 guiPreviousLaptopMode; +UINT32 guiCurrentWWWMode = LAPTOP_MODE_NONE; +INT32 giCurrentSubPage; +UINT32 guiCurrentLapTopCursor; +UINT32 guiPreviousLapTopCursor; +UINT32 guiCurrentSidePanel; // the current navagation panel on the leftside of the laptop screen +UINT32 guiPreviousSidePanel; + +extern UINT32 guiVObjectSize; +extern UINT32 guiVSurfaceSize; + + +INT32 iHighLightBookLine=-1; +BOOLEAN fFastLoadFlag = FALSE; +BOOLEAN gfSideBarFlag; +BOOLEAN gfEnterLapTop=TRUE; +BOOLEAN gfShowBookmarks=FALSE; + +// in progress of loading a page? +BOOLEAN fLoadPendingFlag=FALSE; +BOOLEAN fErrorFlag; + +// mark buttons dirty? +BOOLEAN fMarkButtonsDirtyFlag = TRUE; + +// redraw afer rendering buttons? +BOOLEAN fReDrawPostButtonRender = FALSE; + +// intermediate refresh flag +BOOLEAN fIntermediateReDrawFlag = FALSE; + +// in laptop right now? +BOOLEAN fCurrentlyInLaptop = FALSE; + +// exit due to a message box pop up?..don't really leave LAPTOP +BOOLEAN fExitDueToMessageBox = FALSE; + +// have we visited IMP yety? +BOOLEAN fNotVistedImpYet = TRUE; + +// exit laptop during a load? +BOOLEAN fExitDuringLoad = FALSE; + +// done loading? +BOOLEAN fDoneLoadPending = FALSE; + +// re connecting to a web page? +BOOLEAN fReConnectingFlag = FALSE; + +// going a subpage of a web page?..faster access time +BOOLEAN fConnectingToSubPage = FALSE; + +// is this our first time in laptop? +BOOLEAN fFirstTimeInLaptop = TRUE; + +// redraw the book mark info panel .. for blitting on top of animations +BOOLEAN fReDrawBookMarkInfo = FALSE; + +// show the 2 second info about bookmarks being accessed by clicking on web +BOOLEAN fShowBookmarkInfo = FALSE; + +// show start button for ATM panel? +extern BOOLEAN fShowAtmPanelStartButton; + + +//TEMP! Disables the loadpending delay when switching b/n www pages +BOOLEAN gfTemporaryDisablingOfLoadPendingFlag=FALSE; + + +//GLOBAL FOR WHICH SCREEN TO EXIT TO FOR LAPTOP +UINT32 guiExitScreen = MAP_SCREEN; + +MOUSE_REGION gLaptopRegion; +// Laptop screen graphic handle +UINT32 guiLAPTOP; +BOOLEAN fNewWWWDisplay=TRUE; + +static BOOLEAN fNewWWW=TRUE; + +//Used to store the site to go to after the 'rain delay' message +extern UINT32 guiRainLoop; + + +INT32 giRainDelayInternetSite=-1; + +// have we visitied this site already? +//BOOLEAN fVisitedBookmarkAlready[20]; + + +// the laptop icons +UINT32 guiFILESICON; +UINT32 guiFINANCIALICON; +UINT32 guiHISTORYICON; +UINT32 guiMAILICON; +UINT32 guiPERSICON; +UINT32 guiWWWICON; +UINT32 guiBOOKTOP; +UINT32 guiBOOKHIGH; +UINT32 guiBOOKMID; +UINT32 guiBOOKBOT; +UINT32 guiBOOKMARK; +UINT32 guiGRAPHWINDOW; +UINT32 guiGRAPHBAR; +UINT32 guiLaptopBACKGROUND; +UINT32 guiDOWNLOADTOP; +UINT32 guiDOWNLOADMID; +UINT32 guiDOWNLOADBOT; +UINT32 guiTITLEBARLAPTOP; +UINT32 guiLIGHTS; +UINT32 guiTITLEBARICONS; +UINT32 guiDESKTOP; + +// email notification +UINT32 guiUNREAD; +UINT32 guiNEWMAIL; + +//laptop button +UINT32 guiLAPTOPBUTTON; +// the sidepanel handle +UINT32 guiLAPTOPSIDEPANEL; + +//BOOLEAN gfNewGameLaptop = TRUE; + +// enter new laptop mode due to sliding bars +BOOLEAN fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + + +// laptop pop up messages index value +INT32 iLaptopMessageBox = -1; + +// whether or not we are initing the slide in title bar +BOOLEAN fInitTitle = TRUE; + +// tab handled +BOOLEAN fTabHandled = FALSE; + +// are we maxing or mining? +BOOLEAN fForward = TRUE; + +// BUTTON IMAGES +INT32 giLapTopButton[MAX_BUTTON_COUNT]; +INT32 giLapTopButtonImage[MAX_BUTTON_COUNT]; +INT32 giErrorButton[1]; +INT32 giErrorButtonImage[1]; + +INT32 gLaptopButton[ 7 ]; +INT32 gLaptopButtonImage[ 7 ]; + +// minimize button +INT32 gLaptopMinButton[ 1 ]; +INT32 gLaptopMinButtonImage[ 1 ]; + + + +INT32 gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY + 1 ]; + +// process of mazimizing +BOOLEAN fMaximizingProgram = FALSE; + +// program we are maximizing +INT8 bProgramBeingMaximized = -1; + +// are we minimizing +BOOLEAN fMinizingProgram = FALSE; + + +// process openned queue +INT32 gLaptopProgramQueueList[ 6 ]; + + + +// state of createion of minimize button +BOOLEAN fCreateMinimizeButton = FALSE; + +BOOLEAN fExitingLaptopFlag = FALSE; + +// HD and power lights on +BOOLEAN fPowerLightOn = TRUE; +BOOLEAN fHardDriveLightOn = FALSE; + +// HD flicker +BOOLEAN fFlickerHD = FALSE; + +// the screens limiting rect +SGPRect LaptopScreenRect={ LAPTOP_UL_X,LAPTOP_UL_Y - 5,LAPTOP_SCREEN_LR_X + 2,LAPTOP_SCREEN_LR_Y + 5 + 19}; + + +// the sub pages vistsed or not status within the web browser +BOOLEAN gfWWWaitSubSitesVisitedFlags[LAPTOP_MODE_SIRTECH - LAPTOP_MODE_WWW ]; + +//INT32 iBookMarkList[MAX_BOOKMARKS]; + +// mouse regions +MOUSE_REGION gEmailRegion; +MOUSE_REGION gWWWRegion; +MOUSE_REGION gFinancialRegion; +MOUSE_REGION gPersonnelRegion; +MOUSE_REGION gHistoryRegion; +MOUSE_REGION gFilesRegion; +MOUSE_REGION gLapTopScreenRegion; +MOUSE_REGION gBookmarkMouseRegions[MAX_BOOKMARKS]; +MOUSE_REGION pScreenMask; +MOUSE_REGION gLapTopProgramMinIcon; +MOUSE_REGION gNewMailIconRegion; +MOUSE_REGION gNewFileIconRegion; + +// highlighted mouse region +INT32 giHighLightRegion=NO_REGION; + + +// highlighted regions +INT32 giCurrentRegion=NO_REGION; +INT32 giOldRegion=NO_REGION; + + +//used for global variables that need to be saved +LaptopSaveInfoStruct LaptopSaveInfo; + + +// function calls +UINT32 RenderLaptopPanel(); +void RenderLapTopImage(); +void GetLaptopKeyboardInput(); +UINT32 ExitLaptopMode(UINT32 uiMode); + +UINT32 DrawLapTopText(); +void BtnOnCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 CreateLaptopButtons(); +void DeleteLapTopButtons(); +BOOLEAN DeleteLapTopMouseRegions(); +BOOLEAN CreateLapTopMouseRegions(); +BOOLEAN fReDrawScreenFlag=FALSE; +BOOLEAN fPausedReDrawScreenFlag=FALSE; //used in the handler functions to redraw the screen, after the current frame +void HandleLapTopScreenMouseUi(); +void DrawHighLightRegionBox(); +void HandleLapTopCursorUpDate(); +void PrintBalance( void ); + + +// callbacks +void FinancialRegionButtonCallback(GUI_BUTTON *btn,INT32 reason); +void PersonnelRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ); +void WWWRegionButtonCallback(GUI_BUTTON *btn,INT32 reason); +void EmailRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ); +void FilesRegionButtonCallback(GUI_BUTTON *btn,INT32 reason); +void HistoryRegionButtonCallback(GUI_BUTTON *btn,INT32 reason); +void LaptopProgramIconMinimizeCallback( MOUSE_REGION * pRegion, INT32 iReason ); + + + +void WWWRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ); +void EmailRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ); +void RestoreOldRegion(INT32 iOldRegion); +void HighLightRegion(INT32 iCurrentRegion); +void FinancialRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ); +void HistoryRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ); +void FilesRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ); +void PersonnelRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ); +void ScreenRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ); + + +// minimize callback +void LaptopMinimizeProgramButtonCallback(GUI_BUTTON *btn,INT32 reason); + + +void NewFileIconCallback( MOUSE_REGION * pRegion, INT32 iReason ); + + +void DisplayBookMarks(); +void InitBookMarkList(); +BOOLEAN LoadBookmark(); +void DeleteBookmark(); +void ScrollDisplayText(INT32 iY); +void BookmarkCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void CreateBookMarkMouseRegions(); +void BookmarkMvtCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void DeleteBookmarkRegions(); +void DeleteLoadPending( void ); +BOOLEAN LoadLoadPending( void ); +BOOLEAN DisplayLoadPending( void ); +void DisplayErrorBox( void ); +void CreateDestroyErrorButton( void ); +void DrawTextOnErrorButton(); +BOOLEAN LeaveLapTopScreen( ); +void HandleAnimatedButtons( void ); +void AnimateButton( UINT32 uiIconID, UINT16 usX, UINT16 usY ); +void CreateDestoryBookMarkRegions( void ); +void EnterLaptopInitLaptopPages(); +void CheckMarkButtonsDirtyFlag( void ); +void PostButtonRendering( void ); +void ShouldNewMailBeDisplayed( void ); +void DisplayPlayersBalanceToDate( void ); +void CheckIfNewWWWW( void ); +void HandleLapTopESCKey( void ); +BOOLEAN InitTitleBarMaximizeGraphics( UINT32 uiBackgroundGraphic, STR16 pTitle, UINT32 uiIconGraphic, UINT16 usIconGraphicIndex ); +void RemoveTitleBarMaximizeGraphics(); +BOOLEAN DisplayTitleBarMaximizeGraphic(BOOLEAN fForward, BOOLEAN fInit, UINT16 usTopLeftX, UINT16 usTopLeftY, UINT16 usTopRightX ); +void HandleSlidingTitleBar( void ); +void ShowLights( void ); +void FlickerHDLight( void ); +BOOLEAN ExitLaptopDone( void ); +void CreateDestroyMinimizeButtonForCurrentMode( void ); +void CreateMinimizeButtonForCurrentMode( void ); +void DestroyMinimizeButtonForCurrentMode( void ); +void InitLaptopOpenQueue( void ); +void UpdateListToReflectNewProgramOpened( INT32 iOpenedProgram ); +INT32 FindLastProgramStillOpen( void ); +void SetCurrentToLastProgramOpened( void ); +BOOLEAN HandleExit( void ); +void DeleteDesktopBackground( void ); +BOOLEAN LoadDesktopBackground( void ); +BOOLEAN DrawDeskTopBackground( void ); +void PrintDate( void ); +void DisplayTaskBarIcons(); +void PrintNumberOnTeam( void ); +void HandleDefaultWebpageForLaptop( void ); +void CreateMinimizeRegionsForLaptopProgramIcons( void ); +void DestroyMinimizeRegionsForLaptopProgramIcons( void ); +void CreateDestroyMouseRegionForNewMailIcon( void ); +void NewEmailIconCallback( MOUSE_REGION * pRegion, INT32 iReason ); +void HandleWWWSubSites( void ); +void UpdateStatusOfDisplayingBookMarks( void ); +void InitalizeSubSitesList( void ); +void SetSubSiteAsVisted( void ); +void HandleAltTabKeyInLaptop( void ); +void HandleShiftAltTabKeyInLaptop( void ); + +// display bookmark notify +void DisplayWebBookMarkNotify( void ); + +// handle timer for bookmark notify +void HandleWebBookMarkNotifyTimer( void ); + +void CreateBookMarkHelpText( MOUSE_REGION *pRegion, UINT32 uiBookMarkID ); + +void CreateFileAndNewEmailIconFastHelpText( UINT32 uiHelpTextID, BOOLEAN fClearHelpText ); +void CreateLaptopButtonHelpText( INT32 iButtonIndex, UINT32 uiButtonHelpTextID ); +//ppp + +//Used to determine delay if its raining +BOOLEAN IsItRaining(); +INT32 WWaitDelayIncreasedIfRaining( INT32 iLoadTime ); +void InternetRainDelayMessageBoxCallBack( UINT8 bExitValue ); + +extern void ClearHistoryList( void ); + + +//TEMP CHEAT +#ifdef JA2TESTVERSION +extern void CheatToGetAll5Merc(); +#endif +#if defined ( JA2TESTVERSION ) +extern void DemoHiringOfMercs( ); +#endif + + + +void SetLaptopExitScreen( UINT32 uiExitScreen ) +{ + guiExitScreen = uiExitScreen; +} + +void SetLaptopNewGameFlag( ) +{ + LaptopSaveInfo.gfNewGameLaptop = TRUE; +} + + +void HandleLapTopCursorUpDate() +{ + if(guiPreviousLapTopCursor==guiCurrentLapTopCursor) + return; + switch(guiCurrentLapTopCursor) + { + case LAPTOP_PANEL_CURSOR: + MSYS_SetCurrentCursor(CURSOR_NORMAL); + break; + case LAPTOP_SCREEN_CURSOR: + MSYS_SetCurrentCursor(CURSOR_LAPTOP_SCREEN); + break; + case LAPTOP_WWW_CURSOR: + MSYS_SetCurrentCursor(CURSOR_WWW); + break; + } + guiPreviousLapTopCursor=guiCurrentLapTopCursor; + +} +void +GetLaptopKeyboardInput() +{ + InputAtom InputEvent; + POINT MousePos; + + GetCursorPos(&MousePos); + + fTabHandled = FALSE; + + while (DequeueEvent(&InputEvent) == TRUE) + { + // HOOK INTO MOUSE HOOKS + switch(InputEvent.usEvent) + { + case LEFT_BUTTON_DOWN: + MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_UP: + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_DOWN: + MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + } + + HandleKeyBoardShortCutsForLapTop( InputEvent.usEvent, InputEvent.usParam, InputEvent.usKeyState ); + + } +} + +//This is called only once at game initialization. +UINT32 LaptopScreenInit() +{ + //Memset the whole structure, to make sure of no 'JUNK' + memset( &LaptopSaveInfo, 0, sizeof( LaptopSaveInfoStruct ) ); + + LaptopSaveInfo.gfNewGameLaptop = TRUE; + + InitializeNumDaysMercArrive(); + + //reset the id of the last hired merc + LaptopSaveInfo.sLastHiredMerc.iIdOfMerc = -1; + + //reset the flag that enables the 'just hired merc' popup + LaptopSaveInfo.sLastHiredMerc.fHaveDisplayedPopUpInLaptop = FALSE; + + //Initialize all vars + guiCurrentLaptopMode = LAPTOP_MODE_EMAIL; + guiPreviousLaptopMode = LAPTOP_MODE_NONE; + guiCurrentWWWMode = LAPTOP_MODE_NONE; + guiCurrentSidePanel = FIRST_SIDE_PANEL; + guiPreviousSidePanel = FIRST_SIDE_PANEL; + + + gfSideBarFlag=FALSE; + gfShowBookmarks=FALSE; + InitBookMarkList(); + GameInitAIM(); + GameInitAIMMembers(); + GameInitAimFacialIndex(); + GameInitAimSort(); + GameInitAimArchives(); + GameInitAimPolicies(); + GameInitAimLinks(); + GameInitAimHistory(); + GameInitMercs(); + GameInitBobbyR(); + GameInitBobbyRAmmo(); + GameInitBobbyRArmour(); + GameInitBobbyRGuns(); + GameInitBobbyRMailOrder(); + GameInitBobbyRMisc(); + GameInitBobbyRUsed(); + GameInitEmail(); + GameInitCharProfile(); + GameInitFlorist(); + GameInitInsurance(); + GameInitInsuranceContract(); + GameInitFuneral(); + GameInitSirTech(); + GameInitFiles(); + GameInitPersonnel(); + + // init program states + memset( &gLaptopProgramStates, LAPTOP_PROGRAM_MINIMIZED, sizeof( gLaptopProgramStates ) ); + + gfAtLeastOneMercWasHired = FALSE; + + //No longer inits the laptop screens, now InitLaptopAndLaptopScreens() does + + return( 1 ); +} + + +BOOLEAN InitLaptopAndLaptopScreens() +{ + + GameInitFinances(); + GameInitHistory(); + + //Reset the flag so we can create a new IMP character + LaptopSaveInfo.fIMPCompletedFlag = FALSE; + + //Reset the flag so that BOBBYR's isnt available at the begining of the game + LaptopSaveInfo.fBobbyRSiteCanBeAccessed = FALSE; + + return( TRUE ); +} + + +UINT32 +DrawLapTopIcons() +{ + + return (TRUE); +} + +UINT32 +DrawLapTopText() +{ + + // show balance + DisplayPlayersBalanceToDate( ); + + + return (TRUE); +} + +//This is only called once at game shutdown. +UINT32 LaptopScreenShutdown() +{ + InsuranceContractEndGameShutDown(); + BobbyRayMailOrderEndGameShutDown(); + ShutDownEmailList(); + + ClearHistoryList( ); + + return TRUE; +} + +INT32 EnterLaptop() +{ + //Create, load, initialize data -- just entered the laptop. + + VOBJECT_DESC VObjectDesc; + INT32 iCounter=0; + + static BOOLEAN fEnteredFromGameStartup = TRUE; + // we are re entering due to message box, leave NOW! + if( fExitDueToMessageBox == TRUE ) + { + + return ( TRUE ); + } + + //if the radar map mouse region is still active, disable it. + if( gRadarRegion.uiFlags & MSYS_REGION_ENABLED ) + { + MSYS_DisableRegion( &gRadarRegion ); +/* + #ifdef JA2BETAVERSION + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, L"Mapscreen's radar region is still active, please tell Dave how you entered Laptop.", LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL ); + #endif +*/ + } + + gfDontStartTransitionFromLaptop = FALSE; + + //Since we are coming in from MapScreen, uncheck the flag + guiTacticalInterfaceFlags &= ~INTERFACE_MAPSCREEN; + + // ATE: Disable messages.... + DisableScrollMessages( ); + + // Stop any person from saying anything + StopAnyCurrentlyTalkingSpeech( ); + + // Don't play music.... + SetMusicMode( MUSIC_LAPTOP ); + + // Stop ambients... + StopAmbients( ); + + //if its raining, start the rain showers + if( IsItRaining() ) + { + //Enable the rain delay warning + giRainDelayInternetSite = -1; + + //lower the volume + guiRainLoop = PlayJA2Ambient( RAIN_1, LOWVOLUME, 0 ); + } + + + //open the laptop library +// OpenLibrary( LIBRARY_LAPTOP ); + + //pause the game because we dont want time to advance in the laptop + PauseGame(); + + // set the fact we are currently in laptop, for rendering purposes + fCurrentlyInLaptop = TRUE; + + + + // clear guiSAVEBUFFER + //ColorFillVideoSurfaceArea(guiSAVEBUFFER, 0, 0, 640, 480, Get16BPPColor(FROMRGB(0, 0, 0)) ); + // disable characters panel buttons + + // reset redraw flag and redraw new mail + fReDrawScreenFlag = FALSE; + fReDrawNewMailFlag = TRUE; + + // setup basic cursors + guiCurrentLapTopCursor=LAPTOP_PANEL_CURSOR; + guiPreviousLapTopCursor=LAPTOP_NO_CURSOR; + + // sub page + giCurrentSubPage = 0; + giCurrentRegion=EMAIL_REGION; + + // load the laptop graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\laptop3.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLAPTOP)); + + // background for panel + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\taskbar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLaptopBACKGROUND)); + + + // background for panel + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTITLEBARLAPTOP)); + + // lights for power and HD + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\lights.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiLIGHTS)); + + // icons for title bars + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\ICONS.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTITLEBARICONS)); + + // load, blt and delete graphics + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP( "LAPTOP\\NewMailWarning.sti", VObjectDesc.ImageFile ); + CHECKF( AddVideoObject( &VObjectDesc, &guiEmailWarning ) ); + // load background + LoadDesktopBackground( ); + + + guiCurrentLaptopMode = LAPTOP_MODE_NONE; + //MSYS_SetCurrentCursor(CURSOR_NORMAL); + + guiCurrentLaptopMode = LAPTOP_MODE_NONE; + guiPreviousLaptopMode = LAPTOP_MODE_NONE; + guiCurrentWWWMode = LAPTOP_MODE_NONE; + guiCurrentSidePanel = FIRST_SIDE_PANEL; + guiPreviousSidePanel = FIRST_SIDE_PANEL; + gfSideBarFlag=FALSE; + CreateLapTopMouseRegions(); + RenderLapTopImage(); + HighLightRegion(giCurrentRegion); + //AddEmailMessage(L"Entered LapTop",L"Entered", 0, 0); + //for(iCounter=0; iCounter <10; iCounter++) + //{ + //AddEmail(3,5,0,0); + //} + // the laptop mouse region + + + // reset bookmarks flags + fFirstTimeInLaptop = TRUE; + + // reset all bookmark visits + memset( &LaptopSaveInfo.fVisitedBookmarkAlready, 0, sizeof( LaptopSaveInfo.fVisitedBookmarkAlready ) ); + + // init program states + memset( &gLaptopProgramStates, LAPTOP_PROGRAM_MINIMIZED, sizeof( gLaptopProgramStates ) ); + + // turn the power on + fPowerLightOn = TRUE; + + // we are not exiting laptop right now, we just got here + fExitingLaptopFlag = FALSE; + + // reset program we are maximizing + bProgramBeingMaximized = -1; + + // reset fact we are maximizing/ mining + fMaximizingProgram = FALSE; + fMinizingProgram = FALSE; + + + // initialize open queue + InitLaptopOpenQueue( ); + + + gfShowBookmarks=FALSE; + LoadBookmark( ); + SetBookMark(AIM_BOOKMARK); + LoadLoadPending( ); + + DrawDeskTopBackground( ); + + // create region for new mail icon + CreateDestroyMouseRegionForNewMailIcon( ); + + //DEF: Added to Init things in various laptop pages + EnterLaptopInitLaptopPages(); + InitalizeSubSitesList( ); + + fShowAtmPanelStartButton = TRUE; + + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + + return( TRUE ); +} + +void ExitLaptop() +{ + + // exit is called due to message box, leave + if( fExitDueToMessageBox ) + { + fExitDueToMessageBox = FALSE; + return; + } + + if ( DidGameJustStart() ) + { + SetMusicMode( MUSIC_LAPTOP ); + } + else + { + // Restore to old stuff... + SetMusicMode( MUSIC_RESTORE); + } + + // Start ambients... + BuildDayAmbientSounds( ); + + //if its raining, start the rain showers + if( IsItRaining() ) + { + //Raise the volume to where it was + guiRainLoop = PlayJA2Ambient( RAIN_1, MIDVOLUME, 0 ); + } + + // release cursor + FreeMouseCursor( ); + + // set the fact we are currently not in laptop, for rendering purposes + fCurrentlyInLaptop = FALSE; + + + //Deallocate, save data -- leaving laptop. + SetRenderFlags( RENDER_FLAG_FULL ); + + if( fExitDuringLoad == FALSE ) + { + ExitLaptopMode(guiCurrentLaptopMode); + } + + fExitDuringLoad = FALSE; + fLoadPendingFlag = FALSE; + + + DeleteVideoObjectFromIndex(guiLAPTOP); + DeleteVideoObjectFromIndex(guiLaptopBACKGROUND); + DeleteVideoObjectFromIndex( guiTITLEBARLAPTOP ); + DeleteVideoObjectFromIndex( guiLIGHTS ); + DeleteVideoObjectFromIndex( guiTITLEBARICONS ); + DeleteVideoObjectFromIndex( guiEmailWarning ); + + // destroy region for new mail icon + CreateDestroyMouseRegionForNewMailIcon( ); + + // get rid of desktop + DeleteDesktopBackground( ); + + if(fErrorFlag) + { + fErrorFlag=FALSE; + CreateDestroyErrorButton(); + } + if(fDeleteMailFlag) + { + fDeleteMailFlag=FALSE; + CreateDestroyDeleteNoticeMailButton(); + } + if(fNewMailFlag) + { + fNewMailFlag=FALSE; + CreateDestroyNewMailButton(); + } + + + // get rid of minize button + CreateDestroyMinimizeButtonForCurrentMode( ); + + + + //MSYS_SetCurrentCursor(CURSOR_NORMAL); + gfEnterLapTop=TRUE; + DeleteLapTopButtons(); + DeleteLapTopMouseRegions(); + // restore tactical buttons + //CreateCurrentTacticalPanelButtons(); + gfShowBookmarks=FALSE; + CreateDestoryBookMarkRegions( ); + + fNewWWW=TRUE; + RemoveBookmark(-2); + DeleteBookmark( ); + //DeleteBookmarkRegions(); + DeleteLoadPending( ); + fReDrawNewMailFlag = FALSE; + + //Since we are going to MapScreen, check the flag + guiTacticalInterfaceFlags |= INTERFACE_MAPSCREEN; + + //close the laptop library +// CloseLibrary( LIBRARY_LAPTOP ); + //pause the game because we dont want time to advance in the laptop + UnPauseGame(); + +} + +void +RenderLapTopImage() +{ + HVOBJECT hLapTopHandle; + + + if( ( fMaximizingProgram == TRUE ) ||( fMinizingProgram == TRUE) ) + { + return; + } + + GetVideoObject(&hLapTopHandle, guiLAPTOP); + BltVideoObject(FRAME_BUFFER, hLapTopHandle, 0,LAPTOP_X, LAPTOP_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + GetVideoObject(&hLapTopHandle, guiLaptopBACKGROUND); + BltVideoObject(FRAME_BUFFER, hLapTopHandle, 1,iScreenWidthOffset + 25, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); + + + MarkButtonsDirty( ); + +} +void RenderLaptop() +{ + UINT32 uiTempMode = 0; + + if( ( fMaximizingProgram == TRUE ) ||( fMinizingProgram == TRUE) ) + { + gfShowBookmarks = FALSE; + return; + } + + if(fLoadPendingFlag) + { + uiTempMode = guiCurrentLaptopMode; + guiCurrentLaptopMode = guiPreviousLaptopMode; + } + + switch( guiCurrentLaptopMode ) + { + case( LAPTOP_MODE_NONE ): + DrawDeskTopBackground( ); + break; + case LAPTOP_MODE_AIM: + RenderAIM(); + break; + case LAPTOP_MODE_AIM_MEMBERS: + RenderAIMMembers(); + break; + case LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX: + RenderAimFacialIndex(); + break; + case LAPTOP_MODE_AIM_MEMBERS_SORTED_FILES: + RenderAimSort(); + break; + case LAPTOP_MODE_AIM_MEMBERS_ARCHIVES: + RenderAimArchives(); + break; + case LAPTOP_MODE_AIM_POLICIES: + RenderAimPolicies(); + break; + case LAPTOP_MODE_AIM_LINKS: + RenderAimLinks(); + break; + case LAPTOP_MODE_AIM_HISTORY: + RenderAimHistory(); + break; + case LAPTOP_MODE_MERC: + RenderMercs(); + break; + case LAPTOP_MODE_MERC_FILES: + RenderMercsFiles(); + break; + case LAPTOP_MODE_MERC_ACCOUNT: + RenderMercsAccount(); + break; + case LAPTOP_MODE_MERC_NO_ACCOUNT: + RenderMercsNoAccount(); + break; + + case LAPTOP_MODE_BOBBY_R: + RenderBobbyR(); + break; + + case LAPTOP_MODE_BOBBY_R_GUNS: + RenderBobbyRGuns(); + break; + case LAPTOP_MODE_BOBBY_R_AMMO: + RenderBobbyRAmmo(); + break; + case LAPTOP_MODE_BOBBY_R_ARMOR: + RenderBobbyRArmour(); + break; + case LAPTOP_MODE_BOBBY_R_MISC: + RenderBobbyRMisc(); + break; + case LAPTOP_MODE_BOBBY_R_USED: + RenderBobbyRUsed(); + break; + case LAPTOP_MODE_BOBBY_R_MAILORDER: + RenderBobbyRMailOrder(); + break; + case LAPTOP_MODE_CHAR_PROFILE: + RenderCharProfile(); + break; + case LAPTOP_MODE_FLORIST: + RenderFlorist(); + break; + case LAPTOP_MODE_FLORIST_FLOWER_GALLERY: + RenderFloristGallery(); + break; + case LAPTOP_MODE_FLORIST_ORDERFORM: + RenderFloristOrderForm(); + break; + case LAPTOP_MODE_FLORIST_CARD_GALLERY: + RenderFloristCards(); + break; + + case LAPTOP_MODE_INSURANCE: + RenderInsurance(); + break; + + case LAPTOP_MODE_INSURANCE_INFO: + RenderInsuranceInfo(); + break; + + case LAPTOP_MODE_INSURANCE_CONTRACT: + RenderInsuranceContract(); + break; + + case LAPTOP_MODE_INSURANCE_COMMENTS: + RenderInsuranceComments(); + break; + + case LAPTOP_MODE_FUNERAL: + RenderFuneral(); + break; + case LAPTOP_MODE_SIRTECH: + RenderSirTech(); + break; + case LAPTOP_MODE_FINANCES: + RenderFinances(); + break; + case LAPTOP_MODE_PERSONNEL: + RenderPersonnel(); + break; + case LAPTOP_MODE_HISTORY: + RenderHistory(); + break; + case LAPTOP_MODE_FILES: + RenderFiles(); + break; + case LAPTOP_MODE_EMAIL: + RenderEmail(); + break; + case( LAPTOP_MODE_WWW ): + DrawDeskTopBackground( ); + RenderWWWProgramTitleBar( ); + break; + case( LAPTOP_MODE_BROKEN_LINK ): + RenderBrokenLink(); + break; + + case LAPTOP_MODE_BOBBYR_SHIPMENTS: + RenderBobbyRShipments(); + break; + + + } + + + + if( guiCurrentLaptopMode >= LAPTOP_MODE_WWW ) + { + // render program bar for www program + RenderWWWProgramTitleBar( ); + } + + + + if(fLoadPendingFlag) + { + guiCurrentLaptopMode = uiTempMode; + return; + } + + DisplayProgramBoundingBox( FALSE ); + + // mark the buttons dirty at this point + MarkButtonsDirty( ); +} + +void EnterNewLaptopMode() +{ + static BOOLEAN fOldLoadFlag=FALSE; + + + if( fExitingLaptopFlag ) + { + return; + } + // cause flicker, as we are going to a new program/WEB page + fFlickerHD = TRUE; + + // handle maximizing of programs + switch( guiCurrentLaptopMode ) + { + case ( LAPTOP_MODE_EMAIL ): + if( gLaptopProgramStates[ LAPTOP_PROGRAM_MAILER ] == LAPTOP_PROGRAM_MINIMIZED ) + { + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 0 ], guiTITLEBARICONS, 0 ); + ExitLaptopMode(guiPreviousLaptopMode); + + } + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_MAILER; + gLaptopProgramStates[ LAPTOP_PROGRAM_MAILER ] = LAPTOP_PROGRAM_OPEN; + + return; + } + break; + case ( LAPTOP_MODE_FILES ): + if( gLaptopProgramStates[ LAPTOP_PROGRAM_FILES ] == LAPTOP_PROGRAM_MINIMIZED ) + { + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 1 ], guiTITLEBARICONS, 2 ); + ExitLaptopMode(guiPreviousLaptopMode); + + } + + // minized, maximized + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_FILES; + gLaptopProgramStates[ LAPTOP_PROGRAM_FILES ] = LAPTOP_PROGRAM_OPEN; + return; + } + break; + case ( LAPTOP_MODE_PERSONNEL ): + if( gLaptopProgramStates[ LAPTOP_PROGRAM_PERSONNEL ] == LAPTOP_PROGRAM_MINIMIZED ) + { + + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 2 ], guiTITLEBARICONS, 3 ); + ExitLaptopMode(guiPreviousLaptopMode); + + } + + // minized, maximized + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_PERSONNEL; + gLaptopProgramStates[ LAPTOP_PROGRAM_PERSONNEL ] = LAPTOP_PROGRAM_OPEN; + return; + } + break; + case ( LAPTOP_MODE_FINANCES ): + if( gLaptopProgramStates[ LAPTOP_PROGRAM_FINANCES ] == LAPTOP_PROGRAM_MINIMIZED ) + { + + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 3 ], guiTITLEBARICONS, 5 ); + ExitLaptopMode(guiPreviousLaptopMode); + + + } + + // minized, maximized + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_FINANCES; + gLaptopProgramStates[ LAPTOP_PROGRAM_FINANCES ] = LAPTOP_PROGRAM_OPEN; + return; + } + break; + case ( LAPTOP_MODE_HISTORY ): + if( gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY ] == LAPTOP_PROGRAM_MINIMIZED ) + { + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopTitles[ 4 ], guiTITLEBARICONS, 4 ); + ExitLaptopMode(guiPreviousLaptopMode); + + + } + // minized, maximized + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_HISTORY; + gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY ] = LAPTOP_PROGRAM_OPEN; + return; + } + break; + case( LAPTOP_MODE_NONE ): + // do nothing + break; + default: + if( gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] == LAPTOP_PROGRAM_MINIMIZED ) + { + // minized, maximized + if( fMaximizingProgram == FALSE ) + { + fInitTitle = TRUE; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pWebTitle[ 0 ], guiTITLEBARICONS, 1 ); + ExitLaptopMode(guiPreviousLaptopMode); + } + // minized, maximized + fMaximizingProgram = TRUE; + bProgramBeingMaximized = LAPTOP_PROGRAM_WEB_BROWSER; + gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] = LAPTOP_PROGRAM_OPEN; + return; + } + break; + + } + + if( ( fMaximizingProgram == TRUE ) ||( fMinizingProgram == TRUE) ) + { + return; + } + + if((fOldLoadFlag)&&(!fLoadPendingFlag)) + { + fOldLoadFlag=FALSE; + } + else if((fLoadPendingFlag)&&(!fOldLoadFlag)) + { + ExitLaptopMode(guiPreviousLaptopMode); + fOldLoadFlag=TRUE; + return; + } + else if((fOldLoadFlag)&&(fLoadPendingFlag)) + { + return; + } + else + { + // do not exit previous mode if coming from sliding bar handler + if( ( fEnteredNewLapTopDueToHandleSlidingBars == FALSE ) ) + { + ExitLaptopMode(guiPreviousLaptopMode); + } + } + + + + if((guiCurrentWWWMode==LAPTOP_MODE_NONE)&&(guiCurrentLaptopMode >=LAPTOP_MODE_WWW)) + { + RenderLapTopImage(); + giCurrentRegion=WWW_REGION; + RestoreOldRegion(giOldRegion); + guiCurrentLaptopMode =LAPTOP_MODE_WWW; + HighLightRegion(giCurrentRegion); + } + else + { + if( guiCurrentLaptopMode > LAPTOP_MODE_WWW) + { + if(guiPreviousLaptopMode < LAPTOP_MODE_WWW ) + guiCurrentLaptopMode = guiCurrentWWWMode; + else + { + guiCurrentWWWMode = guiCurrentLaptopMode; + giCurrentSubPage =0; + } + } + } + + if( guiCurrentLaptopMode >= LAPTOP_MODE_WWW ) + { + RenderWWWProgramTitleBar( ); + } + + + + if( ( guiCurrentLaptopMode >= LAPTOP_MODE_WWW ) &&( guiPreviousLaptopMode >= LAPTOP_MODE_WWW ) ) + { + gfShowBookmarks = FALSE; + } + + + + //Initialize the new mode. + switch( guiCurrentLaptopMode ) + { + + case LAPTOP_MODE_AIM: + EnterAIM(); + break; + case LAPTOP_MODE_AIM_MEMBERS: + EnterAIMMembers(); + break; + case LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX: + EnterAimFacialIndex(); + break; + case LAPTOP_MODE_AIM_MEMBERS_SORTED_FILES: + EnterAimSort(); + break; + + case LAPTOP_MODE_AIM_MEMBERS_ARCHIVES: + EnterAimArchives(); + break; + case LAPTOP_MODE_AIM_POLICIES: + EnterAimPolicies(); + break; + case LAPTOP_MODE_AIM_LINKS: + EnterAimLinks(); + break; + case LAPTOP_MODE_AIM_HISTORY: + EnterAimHistory(); + break; + + case LAPTOP_MODE_MERC: + EnterMercs(); + break; + case LAPTOP_MODE_MERC_FILES: + EnterMercsFiles(); + break; + case LAPTOP_MODE_MERC_ACCOUNT: + EnterMercsAccount(); + break; + case LAPTOP_MODE_MERC_NO_ACCOUNT: + EnterMercsNoAccount(); + break; + + case LAPTOP_MODE_BOBBY_R: + EnterBobbyR(); + break; + case LAPTOP_MODE_BOBBY_R_GUNS: + EnterBobbyRGuns(); + break; + case LAPTOP_MODE_BOBBY_R_AMMO: + EnterBobbyRAmmo(); + break; + case LAPTOP_MODE_BOBBY_R_ARMOR: + EnterBobbyRArmour(); + break; + case LAPTOP_MODE_BOBBY_R_MISC: + EnterBobbyRMisc(); + break; + case LAPTOP_MODE_BOBBY_R_USED: + EnterBobbyRUsed(); + break; + case LAPTOP_MODE_BOBBY_R_MAILORDER: + EnterBobbyRMailOrder(); + break; + case LAPTOP_MODE_CHAR_PROFILE: + EnterCharProfile(); + break; + + case LAPTOP_MODE_FLORIST: + EnterFlorist(); + break; + case LAPTOP_MODE_FLORIST_FLOWER_GALLERY: + EnterFloristGallery(); + break; + case LAPTOP_MODE_FLORIST_ORDERFORM: + EnterFloristOrderForm(); + break; + case LAPTOP_MODE_FLORIST_CARD_GALLERY: + EnterFloristCards(); + break; + + case LAPTOP_MODE_INSURANCE: + EnterInsurance(); + break; + case LAPTOP_MODE_INSURANCE_INFO: + EnterInsuranceInfo(); + break; + case LAPTOP_MODE_INSURANCE_CONTRACT: + EnterInsuranceContract(); + break; + case LAPTOP_MODE_INSURANCE_COMMENTS: + EnterInsuranceComments(); + break; + + case LAPTOP_MODE_FUNERAL: + EnterFuneral(); + break; + case LAPTOP_MODE_SIRTECH: + EnterSirTech(); + break; + case LAPTOP_MODE_FINANCES: + EnterFinances(); + break; + case LAPTOP_MODE_PERSONNEL: + EnterPersonnel(); + break; + case LAPTOP_MODE_HISTORY: + EnterHistory(); + break; + case LAPTOP_MODE_FILES: + EnterFiles(); + break; + case LAPTOP_MODE_EMAIL: + EnterEmail(); + break; + case LAPTOP_MODE_BROKEN_LINK: + EnterBrokenLink(); + break; + case LAPTOP_MODE_BOBBYR_SHIPMENTS: + EnterBobbyRShipments(); + break; + + } + + // first time using webbrowser in this laptop session + if( ( fFirstTimeInLaptop == TRUE ) && ( guiCurrentLaptopMode >=LAPTOP_MODE_WWW ) ) + { + // show bookmarks + gfShowBookmarks = TRUE; + + // reset flag + fFirstTimeInLaptop = FALSE; + } + + if( ( !fLoadPendingFlag) ) + { + CreateDestroyMinimizeButtonForCurrentMode( ); + guiPreviousLaptopMode = guiCurrentLaptopMode; + SetSubSiteAsVisted( ); + } + + DisplayProgramBoundingBox( TRUE ); + + + // check to see if we need to go to there default web page of not + //HandleDefaultWebpageForLaptop( ); +} + +void HandleLapTopHandles() +{ + if(fLoadPendingFlag) + return; + + if( ( fMaximizingProgram == TRUE ) || ( fMinizingProgram == TRUE ) ) + { + return; + } + + + switch( guiCurrentLaptopMode ) + { + + case LAPTOP_MODE_AIM: + + HandleAIM(); + break; + case LAPTOP_MODE_AIM_MEMBERS: + HandleAIMMembers(); + break; + case LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX: + HandleAimFacialIndex(); + break; + case LAPTOP_MODE_AIM_MEMBERS_SORTED_FILES: + HandleAimSort(); + break; + case LAPTOP_MODE_AIM_MEMBERS_ARCHIVES: + HandleAimArchives(); + break; + case LAPTOP_MODE_AIM_POLICIES: + HandleAimPolicies(); + break; + case LAPTOP_MODE_AIM_LINKS: + HandleAimLinks(); + break; + case LAPTOP_MODE_AIM_HISTORY: + HandleAimHistory(); + break; + + case LAPTOP_MODE_MERC: + HandleMercs(); + break; + case LAPTOP_MODE_MERC_FILES: + HandleMercsFiles(); + break; + case LAPTOP_MODE_MERC_ACCOUNT: + HandleMercsAccount(); + break; + case LAPTOP_MODE_MERC_NO_ACCOUNT: + HandleMercsNoAccount(); + break; + + + case LAPTOP_MODE_BOBBY_R: + HandleBobbyR(); + break; + case LAPTOP_MODE_BOBBY_R_GUNS: + HandleBobbyRGuns(); + break; + case LAPTOP_MODE_BOBBY_R_AMMO: + HandleBobbyRAmmo(); + break; + case LAPTOP_MODE_BOBBY_R_ARMOR: + HandleBobbyRArmour(); + break; + case LAPTOP_MODE_BOBBY_R_MISC: + HandleBobbyRMisc(); + break; + case LAPTOP_MODE_BOBBY_R_USED: + HandleBobbyRUsed(); + break; + case LAPTOP_MODE_BOBBY_R_MAILORDER: + HandleBobbyRMailOrder(); + break; + + + case LAPTOP_MODE_CHAR_PROFILE: + HandleCharProfile(); + break; + case LAPTOP_MODE_FLORIST: + HandleFlorist(); + break; + case LAPTOP_MODE_FLORIST_FLOWER_GALLERY: + HandleFloristGallery(); + break; + case LAPTOP_MODE_FLORIST_ORDERFORM: + HandleFloristOrderForm(); + break; + case LAPTOP_MODE_FLORIST_CARD_GALLERY: + HandleFloristCards(); + break; + + case LAPTOP_MODE_INSURANCE: + HandleInsurance(); + break; + + case LAPTOP_MODE_INSURANCE_INFO: + HandleInsuranceInfo(); + break; + + case LAPTOP_MODE_INSURANCE_CONTRACT: + HandleInsuranceContract(); + break; + case LAPTOP_MODE_INSURANCE_COMMENTS: + HandleInsuranceComments(); + break; + + case LAPTOP_MODE_FUNERAL: + HandleFuneral(); + break; + case LAPTOP_MODE_SIRTECH: + HandleSirTech(); + break; + case LAPTOP_MODE_FINANCES: + HandleFinances(); + break; + case LAPTOP_MODE_PERSONNEL: + HandlePersonnel(); + break; + case LAPTOP_MODE_HISTORY: + HandleHistory(); + break; + case LAPTOP_MODE_FILES: + HandleFiles(); + break; + case LAPTOP_MODE_EMAIL: + HandleEmail(); + break; + + case LAPTOP_MODE_BROKEN_LINK: + HandleBrokenLink(); + break; + + case LAPTOP_MODE_BOBBYR_SHIPMENTS: + HandleBobbyRShipments(); + break; + } + +} + +extern BOOLEAN gfPrintFrameBuffer; + +UINT32 LaptopScreenHandle() +{ + //User just changed modes. This is determined by the button callbacks + //created in LaptopScreenInit() + + // Set mouse region values + LaptopScreenRect.iLeft = LAPTOP_UL_X; + LaptopScreenRect.iTop = LAPTOP_UL_Y - 5; + LaptopScreenRect.iRight = LAPTOP_SCREEN_LR_X + 2; + LaptopScreenRect.iBottom = LAPTOP_SCREEN_LR_Y + 5 + 19; + + // just entered + if(gfEnterLapTop) + { + EnterLaptop(); + CreateLaptopButtons(); + gfEnterLapTop=FALSE; + } + + if( gfStartMapScreenToLaptopTransition ) + { //Everything is set up to start the transition animation. + SGPRect SrcRect1, SrcRect2, DstRect; + INT32 iPercentage, iScalePercentage, iFactor; + UINT32 uiStartTime, uiTimeRange, uiCurrTime; + INT32 iX, iY, iWidth, iHeight; + + INT32 iRealPercentage; + + SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); + //Step 1: Build the laptop image into the save buffer. + gfStartMapScreenToLaptopTransition = FALSE; + RestoreBackgroundRects(); + RenderLapTopImage(); + HighLightRegion(giCurrentRegion); + RenderLaptop(); + RenderButtons(); + PrintDate( ); + PrintBalance( ); + PrintNumberOnTeam( ); + ShowLights(); + + //Step 2: The mapscreen image is in the EXTRABUFFER, and laptop is in the SAVEBUFFER + // Start transitioning the screen. + DstRect.iLeft = iScreenWidthOffset; //0 + DstRect.iTop = iScreenHeightOffset; //0 + DstRect.iRight = iScreenWidthOffset + 640; //640 + DstRect.iBottom = iScreenHeightOffset + 480; //480 + uiTimeRange = 1000; + iPercentage = iRealPercentage = 0; + uiStartTime = GetJA2Clock(); + + BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, iScreenWidthOffset, iScreenHeightOffset, + 640, 480 ); + BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, 640, 480 ); + + PlayJA2SampleFromFile( "SOUNDS\\Laptop power up (8-11).wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + while( iRealPercentage < 100 ) + { + uiCurrTime = GetJA2Clock(); + iPercentage = (uiCurrTime-uiStartTime) * 100 / uiTimeRange; + iPercentage = min( iPercentage, 100 ); + + iRealPercentage = iPercentage; + + //Factor the percentage so that it is modified by a gravity falling acceleration effect. + iFactor = (iPercentage - 50) * 2; + if( iPercentage < 50 ) + iPercentage = (UINT32)(iPercentage + iPercentage * iFactor * 0.01 + 0.5); + else + iPercentage = (UINT32)(iPercentage + (100-iPercentage) * iFactor * 0.01 + 0.5); + + //Mapscreen source rect + SrcRect1.iLeft = iScreenWidthOffset + 464 * iPercentage / 100; + SrcRect1.iRight = iScreenWidthOffset + 640 - 163 * iPercentage / 100; + SrcRect1.iTop = iScreenHeightOffset + 417 * iPercentage / 100; + SrcRect1.iBottom = iScreenHeightOffset + 480 - 55 * iPercentage / 100; + //Laptop source rect + if( iPercentage < 99 ) + iScalePercentage = 10000 / (100-iPercentage); + else + iScalePercentage = 5333; + iWidth = 12 * iScalePercentage / 100; + iHeight = 9 * iScalePercentage / 100; + + iX = iScreenWidthOffset + 472 - (472-320) * iScalePercentage / 5333; + iY = iScreenHeightOffset + 424 - (424-240) * iScalePercentage / 5333; + + SrcRect2.iLeft = iX - iWidth / 2; + SrcRect2.iRight = SrcRect2.iLeft + iWidth; + SrcRect2.iTop = iY - iHeight / 2; + SrcRect2.iBottom = SrcRect2.iTop + iHeight; + + BltStretchVideoSurface( FRAME_BUFFER, guiSAVEBUFFER, 0, iScreenWidthOffset, iScreenHeightOffset, &DstRect, &SrcRect2 ); + + InvalidateScreen(); + RefreshScreen( NULL ); + } + fReDrawScreenFlag = TRUE; + } + + + //DO NOT MOVE THIS FUNCTION CALL!!! + + //This determines if the help screen should be active + if( ShouldTheHelpScreenComeUp( HELP_SCREEN_LAPTOP, FALSE ) ) + { + // handle the help screen + HelpScreenHandler(); + return( LAPTOP_SCREEN ); + } + + RestoreBackgroundRects(); + + // lock cursor to screen + RestrictMouseCursor( &LaptopScreenRect ); + + + + // handle animated cursors + HandleAnimatedCursors( ); + // Deque all game events + DequeAllGameEvents( TRUE ); + + // handle sub sites..like BR Guns, BR Ammo, Armour, Misc...for WW Wait..since they are not true sub pages + // and are not individual sites + HandleWWWSubSites( ); + UpdateStatusOfDisplayingBookMarks( ); + + // check if we need to reset new WWW mode + CheckIfNewWWWW( ); + + if( guiCurrentLaptopMode != guiPreviousLaptopMode ) + { + if( guiCurrentLaptopMode <=LAPTOP_MODE_WWW ) + { + fLoadPendingFlag=FALSE; + } + + if( ( fMaximizingProgram == FALSE ) && ( fMinizingProgram == FALSE ) ) + { + if( guiCurrentLaptopMode <= LAPTOP_MODE_WWW ) + { + EnterNewLaptopMode(); + if( ( fMaximizingProgram == FALSE ) && ( fMinizingProgram == FALSE ) ) + { + guiPreviousLaptopMode = guiCurrentLaptopMode; + } + } + else + { + if(!fLoadPendingFlag) + { + EnterNewLaptopMode(); + guiPreviousLaptopMode = guiCurrentLaptopMode; + } + } + } + } + if( fPausedReDrawScreenFlag ) + { + fReDrawScreenFlag = TRUE; + fPausedReDrawScreenFlag = FALSE; + } + + if( fReDrawScreenFlag ) + { + RenderLapTopImage(); + HighLightRegion(giCurrentRegion); + RenderLaptop(); + + } + + + // are we about to leave laptop + if( fExitingLaptopFlag ) + { + if( fLoadPendingFlag == TRUE ) + { + fLoadPendingFlag = FALSE; + fExitDuringLoad = TRUE; + } + LeaveLapTopScreen( ); + } + + if( fExitingLaptopFlag == FALSE ) + { + // handle handles for laptop input stream + HandleLapTopHandles(); + } + + // get keyboard input, handle it + GetLaptopKeyboardInput(); + + + + + + // check to see if new mail box needs to be displayed + DisplayNewMailBox( ); + CreateDestroyNewMailButton( ); + + // create various mouse regions that are global to laptop system + CreateDestoryBookMarkRegions( ); + CreateDestroyErrorButton( ); + + // check to see if error box needs to be displayed + DisplayErrorBox(); + + // check to see if buttons marked dirty + CheckMarkButtonsDirtyFlag( ); + + // check to see if new mail box needs to be displayed + ShouldNewMailBeDisplayed(); + + // check to see if new mail box needs to be displayed + ReDrawNewMailBox( ); + + + // look for unread email + LookForUnread(); + //Handle keyboard shortcuts... + + // mouse regions + //HandleLapTopScreenMouseUi(); + //RenderButtons(); + //RenderButtonsFastHelp( ); + + + + if( ( fLoadPendingFlag == FALSE )||( fNewMailFlag ) ) + { + // render buttons marked dirty + RenderButtons( ); + + // render fast help 'quick created' buttons +// RenderFastHelp( ); +// RenderButtonsFastHelp( ); + } + + // show text on top of buttons + if( ( fMaximizingProgram == FALSE ) && ( fMinizingProgram == FALSE ) ) + { + DrawButtonText(); + } + + + // check to see if bookmarks need to be displayed + if(gfShowBookmarks) + { + if( fExitingLaptopFlag ) + gfShowBookmarks = FALSE; + else + DisplayBookMarks(); + } + + // check to see if laod pending flag is set + DisplayLoadPending( ); + + // check if we are showing message? + DisplayWebBookMarkNotify( ); + + if( ( fIntermediateReDrawFlag )||( fReDrawPostButtonRender ) ) + { + // rendering AFTER buttons and button text + if( ( fMaximizingProgram == FALSE ) && ( fMinizingProgram == FALSE ) ) + { + PostButtonRendering( ); + } + } + //PrintBalance( ); + + PrintDate( ); + + PrintBalance( ); + + PrintNumberOnTeam( ); + DisplayTaskBarIcons(); + + // handle if we are maximizing a program from a minimized state or vice versa + HandleSlidingTitleBar( ); + + + // flicker HD light as nessacary + FlickerHDLight( ); + + // display power and HD lights + ShowLights( ); + + + // render frame rate + DisplayFrameRate( ); + + // invalidate screen if redrawn + if( fReDrawScreenFlag == TRUE ) + { + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + fReDrawScreenFlag = FALSE; + } + + ExecuteVideoOverlays(); + + SaveBackgroundRects( ); +// RenderButtonsFastHelp(); + RenderFastHelp( ); + + // ex SAVEBUFFER queue + ExecuteBaseDirtyRectQueue(); + ResetInterface(); + EndFrameBufferRender( ); + return (LAPTOP_SCREEN); +} + + + + + + +UINT32 RenderLaptopPanel() +{ + + return 0; +} + + +UINT32 ExitLaptopMode(UINT32 uiMode) +{ + //Deallocate the previous mode that you were in. + + switch( uiMode ) + { + case LAPTOP_MODE_AIM: + ExitAIM(); + break; + case LAPTOP_MODE_AIM_MEMBERS: + ExitAIMMembers(); + break; + case LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX: + ExitAimFacialIndex(); + break; + case LAPTOP_MODE_AIM_MEMBERS_SORTED_FILES: + ExitAimSort(); + break; + case LAPTOP_MODE_AIM_MEMBERS_ARCHIVES: + ExitAimArchives(); + break; + case LAPTOP_MODE_AIM_POLICIES: + ExitAimPolicies(); + break; + case LAPTOP_MODE_AIM_LINKS: + ExitAimLinks(); + break; + case LAPTOP_MODE_AIM_HISTORY: + ExitAimHistory(); + break; + + case LAPTOP_MODE_MERC: + ExitMercs(); + break; + case LAPTOP_MODE_MERC_FILES: + ExitMercsFiles(); + break; + case LAPTOP_MODE_MERC_ACCOUNT: + ExitMercsAccount(); + break; + case LAPTOP_MODE_MERC_NO_ACCOUNT: + ExitMercsNoAccount(); + break; + + + case LAPTOP_MODE_BOBBY_R: + ExitBobbyR(); + break; + case LAPTOP_MODE_BOBBY_R_GUNS: + ExitBobbyRGuns(); + break; + case LAPTOP_MODE_BOBBY_R_AMMO: + ExitBobbyRAmmo(); + break; + case LAPTOP_MODE_BOBBY_R_ARMOR: + ExitBobbyRArmour(); + break; + case LAPTOP_MODE_BOBBY_R_MISC: + ExitBobbyRMisc(); + break; + case LAPTOP_MODE_BOBBY_R_USED: + ExitBobbyRUsed(); + break; + case LAPTOP_MODE_BOBBY_R_MAILORDER: + ExitBobbyRMailOrder(); + break; + + + case LAPTOP_MODE_CHAR_PROFILE: + ExitCharProfile(); + break; + case LAPTOP_MODE_FLORIST: + ExitFlorist(); + break; + case LAPTOP_MODE_FLORIST_FLOWER_GALLERY: + ExitFloristGallery(); + break; + case LAPTOP_MODE_FLORIST_ORDERFORM: + ExitFloristOrderForm(); + break; + case LAPTOP_MODE_FLORIST_CARD_GALLERY: + ExitFloristCards(); + break; + + case LAPTOP_MODE_INSURANCE: + ExitInsurance(); + break; + + case LAPTOP_MODE_INSURANCE_INFO: + ExitInsuranceInfo(); + break; + + case LAPTOP_MODE_INSURANCE_CONTRACT: + ExitInsuranceContract(); + break; + case LAPTOP_MODE_INSURANCE_COMMENTS: + ExitInsuranceComments(); + break; + + case LAPTOP_MODE_FUNERAL: + ExitFuneral(); + break; + case LAPTOP_MODE_SIRTECH: + ExitSirTech(); + break; + case LAPTOP_MODE_FINANCES: + ExitFinances(); + break; + case LAPTOP_MODE_PERSONNEL: + ExitPersonnel(); + break; + case LAPTOP_MODE_HISTORY: + ExitHistory(); + break; + case LAPTOP_MODE_FILES: + ExitFiles(); + break; + case LAPTOP_MODE_EMAIL: + ExitEmail(); + break; + case LAPTOP_MODE_BROKEN_LINK: + ExitBrokenLink(); + break; + + case LAPTOP_MODE_BOBBYR_SHIPMENTS: + ExitBobbyRShipments(); + break; + } + + if( ( uiMode != LAPTOP_MODE_NONE )&&( uiMode < LAPTOP_MODE_WWW ) ) + { + CreateDestroyMinimizeButtonForCurrentMode( ); + } + return(TRUE); +} + + +UINT32 +CreateLaptopButtons() +{ + memset( giLapTopButton, -1, sizeof( giLapTopButton ) ); + + // the program buttons + + + gLaptopButtonImage[0]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,0,-1,8,-1 ); + gLaptopButton[0] = QuickCreateButton( gLaptopButtonImage[0], iScreenWidthOffset + 29, + iScreenHeightOffset + 66, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)EmailRegionButtonCallback); + CreateLaptopButtonHelpText( gLaptopButton[0], LAPTOP_BN_HLP_TXT_VIEW_EMAIL ); + + SpecifyButtonText( gLaptopButton[0], pLaptopIcons[ 0 ] ); + SpecifyButtonFont( gLaptopButton[0], FONT10ARIAL ); + SpecifyButtonTextOffsets( gLaptopButton[0], 30, 11, TRUE ); + SpecifyButtonDownTextColors( gLaptopButton[0], 2, 0 ); + SpecifyButtonUpTextColors( gLaptopButton[0], 2, 0 ); + + gLaptopButtonImage[1]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,1,-1,9,-1 ); + gLaptopButton[1] = QuickCreateButton( gLaptopButtonImage[1], iScreenWidthOffset + 29, + iScreenHeightOffset + 98, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)WWWRegionButtonCallback); + CreateLaptopButtonHelpText( gLaptopButton[1], LAPTOP_BN_HLP_TXT_BROWSE_VARIOUS_WEB_SITES ); + + SpecifyButtonText( gLaptopButton[1], pLaptopIcons[1 ] ); + SpecifyButtonFont( gLaptopButton[1], FONT10ARIAL ); + SpecifyButtonTextOffsets( gLaptopButton[1], 30, 11, TRUE ); + SpecifyButtonUpTextColors( gLaptopButton[1], 2, 0 ); + SpecifyButtonDownTextColors( gLaptopButton[1], 2, 0 ); + + gLaptopButtonImage[2]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,2,-1,10,-1 ); + gLaptopButton[2] = QuickCreateButton( gLaptopButtonImage[2], iScreenWidthOffset + 29, + iScreenHeightOffset + 130, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)FilesRegionButtonCallback); + CreateLaptopButtonHelpText( gLaptopButton[2], LAPTOP_BN_HLP_TXT_VIEW_FILES_AND_EMAIL_ATTACHMENTS ); + + SpecifyButtonText( gLaptopButton[2], pLaptopIcons[ 5 ] ); + SpecifyButtonFont( gLaptopButton[2], FONT10ARIAL ); + SpecifyButtonTextOffsets( gLaptopButton[2], 30, 11, TRUE ); + SpecifyButtonUpTextColors( gLaptopButton[2], 2, 0 ); + SpecifyButtonDownTextColors( gLaptopButton[2], 2, 0 ); + + + gLaptopButtonImage[3]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,3,-1,11,-1 ); + gLaptopButton[3] = QuickCreateButton( gLaptopButtonImage[3], iScreenWidthOffset + 29, + iScreenHeightOffset + 194, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)PersonnelRegionButtonCallback); + CreateLaptopButtonHelpText( gLaptopButton[3], LAPTOP_BN_HLP_TXT_VIEW_TEAM_INFO ); + + SpecifyButtonText( gLaptopButton[3], pLaptopIcons[ 3] ); + SpecifyButtonFont( gLaptopButton[3], FONT10ARIAL ); + SpecifyButtonTextOffsets( gLaptopButton[3], 30, 11, TRUE ); + SpecifyButtonUpTextColors( gLaptopButton[3], 2, 0 ); + SpecifyButtonDownTextColors( gLaptopButton[3], 2, 0 ); + + + gLaptopButtonImage[4]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,4,-1,12,-1 ); + gLaptopButton[4] = QuickCreateButton( gLaptopButtonImage[4], iScreenWidthOffset + 29, + iScreenHeightOffset + 162, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)HistoryRegionButtonCallback); + CreateLaptopButtonHelpText( gLaptopButton[4], LAPTOP_BN_HLP_TXT_READ_LOG_OF_EVENTS ); + + SpecifyButtonText( gLaptopButton[4], pLaptopIcons[ 4 ] ); + SpecifyButtonFont( gLaptopButton[4], FONT10ARIAL ); + SpecifyButtonTextOffsets( gLaptopButton[4], 30, 11, TRUE ); + SpecifyButtonUpTextColors( gLaptopButton[4], 2, 0 ); + SpecifyButtonDownTextColors( gLaptopButton[4], 2, 0 ); + + + gLaptopButtonImage[5]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,5,-1,13,-1 ); + gLaptopButton[5] = QuickCreateButton( gLaptopButtonImage[5], iScreenWidthOffset + 29, + iScreenHeightOffset + 241, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)FinancialRegionButtonCallback); + CreateLaptopButtonHelpText( gLaptopButton[5], LAPTOP_BN_HLP_TXT_VIEW_FINANCIAL_SUMMARY_AND_HISTORY ); + + SpecifyButtonText( gLaptopButton[5], pLaptopIcons[ 2 ] ); + SpecifyButtonFont( gLaptopButton[5], FONT10ARIAL ); + SpecifyButtonTextOffsets( gLaptopButton[5], 30, 11, TRUE ); + SpecifyButtonUpTextColors( gLaptopButton[5], 2, 0 ); + SpecifyButtonDownTextColors( gLaptopButton[5], 2, 0 ); + + + gLaptopButtonImage[6]= LoadButtonImage( "LAPTOP\\buttonsforlaptop.sti" ,-1,6,-1,14,-1 ); + gLaptopButton[6] = QuickCreateButton( gLaptopButtonImage[6], iScreenWidthOffset + 29, + iScreenHeightOffset + 378, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnOnCallback); + CreateLaptopButtonHelpText( gLaptopButton[6], LAPTOP_BN_HLP_TXT_CLOSE_LAPTOP ); + + SpecifyButtonText( gLaptopButton[6], pLaptopIcons[ 6 ] ); + SpecifyButtonFont( gLaptopButton[6], FONT10ARIAL ); + SpecifyButtonTextOffsets( gLaptopButton[6], 25, 11, TRUE ); + SpecifyButtonUpTextColors( gLaptopButton[6], 2, 0 ); + SpecifyButtonDownTextColors( gLaptopButton[6], 2, 0 ); + + + // define the cursor + SetButtonCursor(gLaptopButton[0], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(gLaptopButton[1], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(gLaptopButton[2], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(gLaptopButton[3], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(gLaptopButton[4], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(gLaptopButton[5], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(gLaptopButton[6], CURSOR_LAPTOP_SCREEN); + + + + return (TRUE); +} + +void +DeleteLapTopButtons() +{ + UINT32 cnt; + + for( cnt = 0; cnt < 7; cnt++ ) + { + RemoveButton( gLaptopButton[ cnt ] ); + UnloadButtonImage( gLaptopButtonImage[ cnt ] ); + } +} + + +void +BtnOnCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + if ( HandleExit( ) ) + { +// btn->uiFlags&=~(BUTTON_CLICKED_ON); + fExitingLaptopFlag = TRUE; + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + } + } + btn->uiFlags&=~(BUTTON_CLICKED_ON); + } + +} + +BOOLEAN LeaveLapTopScreen( void ) +{ + + if( ExitLaptopDone( ) ) + { + SetLaptopExitScreen( MAP_SCREEN ); + + if( gfAtLeastOneMercWasHired == TRUE ) + { + if( LaptopSaveInfo.gfNewGameLaptop ) + { + LaptopSaveInfo.gfNewGameLaptop = FALSE; + fExitingLaptopFlag = TRUE; + InitNewGame( FALSE ); + gfDontStartTransitionFromLaptop = TRUE; + return( TRUE ); + } + } + else + { + gfDontStartTransitionFromLaptop = TRUE; + } + + SetPendingNewScreen(guiExitScreen); + + if( !gfDontStartTransitionFromLaptop ) + { + SGPRect SrcRect1, SrcRect2, DstRect; + INT32 iPercentage, iScalePercentage, iFactor; + UINT32 uiStartTime, uiTimeRange, uiCurrTime; + INT32 iX, iY, iWidth, iHeight; + INT32 iRealPercentage; + + gfDontStartTransitionFromLaptop = TRUE; + SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); + //Step 1: Build the laptop image into the save buffer. + RestoreBackgroundRects(); + RenderLapTopImage(); + HighLightRegion(giCurrentRegion); + RenderLaptop(); + RenderButtons(); + PrintDate( ); + PrintBalance( ); + PrintNumberOnTeam( ); + ShowLights(); + + //Step 2: The mapscreen image is in the EXTRABUFFER, and laptop is in the SAVEBUFFER + // Start transitioning the screen. + DstRect.iLeft = iScreenWidthOffset + 0; // 0 + DstRect.iTop = iScreenHeightOffset + 0; // 0 + DstRect.iRight = iScreenWidthOffset + 640; // 640 + DstRect.iBottom = iScreenHeightOffset + 480; // 480 + uiTimeRange = 1000; + iPercentage = iRealPercentage = 100; + uiStartTime = GetJA2Clock(); + + BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, iScreenWidthOffset, iScreenHeightOffset, + 640, 480 ); + + PlayJA2SampleFromFile( "SOUNDS\\Laptop power down (8-11).wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); + while( iRealPercentage > 0 ) + { + BlitBufferToBuffer( guiEXTRABUFFER, FRAME_BUFFER, iScreenWidthOffset, iScreenHeightOffset, 640, 480 ); + + uiCurrTime = GetJA2Clock(); + iPercentage = (uiCurrTime-uiStartTime) * 100 / uiTimeRange; + iPercentage = min( iPercentage, 100 ); + iPercentage = 100 - iPercentage; + + iRealPercentage = iPercentage; + + //Factor the percentage so that it is modified by a gravity falling acceleration effect. + iFactor = (iPercentage - 50) * 2; + if( iPercentage < 50 ) + iPercentage = (UINT32)(iPercentage + iPercentage * iFactor * 0.01 + 0.5); + else + iPercentage = (UINT32)(iPercentage + (100-iPercentage) * iFactor * 0.01 + 0.5); + + //Mapscreen source rect + SrcRect1.iLeft = iScreenWidthOffset + 464 * iPercentage / 100; + SrcRect1.iRight = iScreenWidthOffset + 640 - 163 * iPercentage / 100; + SrcRect1.iTop = iScreenHeightOffset + 417 * iPercentage / 100; + SrcRect1.iBottom = iScreenHeightOffset + 480 - 55 * iPercentage / 100; + //Laptop source rect + if( iPercentage < 99 ) + iScalePercentage = 10000 / (100-iPercentage); + else + iScalePercentage = 5333; + iWidth = 12 * iScalePercentage / 100; + iHeight = 9 * iScalePercentage / 100; + iX = iScreenWidthOffset + 472 - (472-320) * iScalePercentage / 5333; + iY = iScreenHeightOffset + 424 - (424-240) * iScalePercentage / 5333; + + SrcRect2.iLeft = iX - iWidth / 2; + SrcRect2.iRight = SrcRect2.iLeft + iWidth; + SrcRect2.iTop = iY - iHeight / 2; + SrcRect2.iBottom = SrcRect2.iTop + iHeight; + + BltStretchVideoSurface( FRAME_BUFFER, guiSAVEBUFFER, 0, iScreenWidthOffset, iScreenHeightOffset, &DstRect, &SrcRect2 ); + + InvalidateScreen(); + //gfPrintFrameBuffer = TRUE; + RefreshScreen( NULL ); + } + } + } + return( TRUE ); + +} + + +BOOLEAN HandleExit( void ) +{ +// static BOOLEAN fSentImpWarningAlready = FALSE; + + + // remind player about IMP + if ( LaptopSaveInfo.gfNewGameLaptop != 0 ) + { + if ( !AnyMercsHired( ) ) + { + //AddEmail(0,1, GAME_HELP, GetWorldTotalMin( ) ); + //fExitingLaptopFlag = FALSE; + //return( FALSE ); + } + } + + // new game, send email + if ( LaptopSaveInfo.gfNewGameLaptop != 0 ) + { + // Set an event to send this email ( day 2 8:00-12:00 ) + if( ( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) && ( LaptopSaveInfo.fSentImpWarningAlready == FALSE ) ) + { + AddFutureDayStrategicEvent( EVENT_HAVENT_MADE_IMP_CHARACTER_EMAIL, (8 + Random(4) ) * 60, 0, 1 ); + +/* + Moved to an event that gets triggered the next day: HaventMadeImpMercEmailCallBack() + + LaptopSaveInfo.fSentImpWarningAlready = TRUE; + AddEmail(IMP_EMAIL_AGAIN,IMP_EMAIL_AGAIN_LENGTH,1, GetWorldTotalMin( ) ); +*/ + fExitingLaptopFlag = TRUE; + + return( FALSE ); + } + } + + + return ( TRUE ); + +} + +void HaventMadeImpMercEmailCallBack() +{ + //if the player STILL hasnt made an imp merc yet + if( ( LaptopSaveInfo.fIMPCompletedFlag == FALSE ) && ( LaptopSaveInfo.fSentImpWarningAlready == FALSE ) ) + { + LaptopSaveInfo.fSentImpWarningAlready = TRUE; + AddEmail(IMP_EMAIL_AGAIN,IMP_EMAIL_AGAIN_LENGTH,1, GetWorldTotalMin( ) ); + } +} + + +BOOLEAN +CreateLapTopMouseRegions() +{ + // define regions + + + // the entire laptop display region + MSYS_DefineRegion( &gLapTopScreenRegion, ( UINT16 )( LaptopScreenRect.iLeft ),( UINT16 )( LaptopScreenRect.iTop ),( UINT16 ) ( LaptopScreenRect.iRight ),( UINT16 )( LaptopScreenRect.iBottom ), MSYS_PRIORITY_NORMAL+1, + CURSOR_LAPTOP_SCREEN, ScreenRegionMvtCallback, LapTopScreenCallBack ); + + + //MSYS_AddRegion(&gLapTopScreenRegion); + return (TRUE); +} + +BOOLEAN +DeleteLapTopMouseRegions() +{ + + MSYS_RemoveRegion( &gLapTopScreenRegion); + + return (TRUE); +} + +void FinancialRegionButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + + btn->uiFlags&=~(BUTTON_CLICKED_ON); + if(giCurrentRegion!=FINANCIAL_REGION) + giOldRegion=giCurrentRegion; + giCurrentRegion=FINANCIAL_REGION; + if(gfShowBookmarks) + { + gfShowBookmarks=FALSE; + fReDrawScreenFlag=TRUE; + } + guiCurrentLaptopMode=LAPTOP_MODE_FINANCES; + + UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_FINANCES ); + + } + } +} + + + +void PersonnelRegionButtonCallback( GUI_BUTTON *btn,INT32 reason) +{ + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + + if(giCurrentRegion!=PERSONNEL_REGION) + giOldRegion=giCurrentRegion; + giCurrentRegion=PERSONNEL_REGION; + guiCurrentLaptopMode=LAPTOP_MODE_PERSONNEL; + if(gfShowBookmarks) + { + gfShowBookmarks=FALSE; + fReDrawScreenFlag=TRUE; + } + RestoreOldRegion(giOldRegion); + HighLightRegion(giCurrentRegion); + gfShowBookmarks=FALSE; + + UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_PERSONNEL ); + + } + } + +} + + +void EmailRegionButtonCallback( GUI_BUTTON *btn,INT32 reason ) +{ + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // set old region + if(giCurrentRegion!=EMAIL_REGION) + giOldRegion=giCurrentRegion; + + // stop showing WWW bookmarks + if(gfShowBookmarks) + { + gfShowBookmarks=FALSE; + } + + // set current highlight region + giCurrentRegion=EMAIL_REGION; + + // restore old region + RestoreOldRegion(giOldRegion); + + // set up current mode + guiCurrentLaptopMode =LAPTOP_MODE_EMAIL; + + UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_MAILER ); + + // highlight current region + HighLightRegion(giCurrentRegion); + + //redraw screen + fReDrawScreenFlag=TRUE; + } + } +} + + + +void WWWRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_RBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + if(giCurrentRegion!=WWW_REGION) + giOldRegion=giCurrentRegion; + if(!fNewWWW) + fNewWWWDisplay=FALSE; + + // reset show bookmarks + if( guiCurrentLaptopMode < LAPTOP_MODE_WWW ) + { + gfShowBookmarks = FALSE; + fShowBookmarkInfo = TRUE; + } + else + { + gfShowBookmarks = !gfShowBookmarks; + } + + + if((gfShowBookmarks)&&(!fNewWWW)) + { + + fReDrawScreenFlag=TRUE; + fNewWWWDisplay=FALSE; + } + else if( fNewWWW ) + { + + // no longer a new WWW mode + fNewWWW=FALSE; + + // new WWW to display + fNewWWWDisplay=TRUE; + + // make sure program is maximized + if( gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] == LAPTOP_PROGRAM_OPEN ) + { + // re render laptop region + RenderLapTopImage(); + + // re render background + DrawDeskTopBackground( ); + + } + } + giCurrentRegion=WWW_REGION; + RestoreOldRegion(giOldRegion); + if(guiCurrentWWWMode!=LAPTOP_MODE_NONE) + guiCurrentLaptopMode = guiCurrentWWWMode; + else + guiCurrentLaptopMode=LAPTOP_MODE_WWW; + UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_WEB_BROWSER ); + HighLightRegion(giCurrentRegion); + fReDrawScreenFlag=TRUE; + } + } + else if (reason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // nothing yet + + + if(giCurrentRegion!=WWW_REGION) + giOldRegion=giCurrentRegion; + + giCurrentRegion=WWW_REGION; + + RestoreOldRegion(giOldRegion); + + if(guiCurrentWWWMode!=LAPTOP_MODE_NONE) + guiCurrentLaptopMode = guiCurrentWWWMode; + else + guiCurrentLaptopMode=LAPTOP_MODE_WWW; + + HighLightRegion(giCurrentRegion); + + fReDrawScreenFlag=TRUE; + } + } + +} + + +void HistoryRegionButtonCallback(GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // if not in history, update to the fact + if(giCurrentRegion!=HISTORY_REGION) + giOldRegion=giCurrentRegion; + if(gfShowBookmarks) + { + // stop showing WWW bookmarks + gfShowBookmarks=FALSE; + } + + // current region is history + giCurrentRegion=HISTORY_REGION; + + // restore old region area + RestoreOldRegion(giOldRegion); + + // set mode to history + guiCurrentLaptopMode=LAPTOP_MODE_HISTORY; + + // hightlight current icon + HighLightRegion(giCurrentRegion); + + UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_HISTORY ); + + gfShowBookmarks=FALSE; + + //redraw screen + fReDrawScreenFlag=TRUE; + + } + } + +} +void FilesRegionButtonCallback( GUI_BUTTON *btn,INT32 reason ) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // reset old region + if(giCurrentRegion!=FILES_REGION) + giOldRegion=giCurrentRegion; + + // stop showing WWW bookmarks + if(gfShowBookmarks) + { + gfShowBookmarks=FALSE; + fReDrawScreenFlag=TRUE; + } + + // set new region + giCurrentRegion=FILES_REGION; + + // restore old highlight region + RestoreOldRegion(giOldRegion); + + // highlight new region + HighLightRegion(giCurrentRegion); + + guiCurrentLaptopMode=LAPTOP_MODE_FILES; + + UpdateListToReflectNewProgramOpened( LAPTOP_PROGRAM_FILES ); + + //redraw screen + fReDrawScreenFlag=TRUE; + } + } + +} + + +void HandleLapTopScreenMouseUi() +{ + if ( gEmailRegion.uiFlags & MSYS_MOUSE_IN_AREA ) + { + giHighLightRegion=EMAIL_REGION; + } + else if ( gPersonnelRegion.uiFlags & MSYS_MOUSE_IN_AREA ) + { + giHighLightRegion=PERSONNEL_REGION; + } + else if ( gFinancialRegion.uiFlags & MSYS_MOUSE_IN_AREA ) + { + giHighLightRegion=FINANCIAL_REGION; + } + else if ( gWWWRegion.uiFlags & MSYS_MOUSE_IN_AREA ) + { + giHighLightRegion=WWW_REGION; + } + else if ( gFilesRegion.uiFlags & MSYS_MOUSE_IN_AREA ) + { + giHighLightRegion=FILES_REGION; + } + else if ( gHistoryRegion.uiFlags & MSYS_MOUSE_IN_AREA ) + { + giHighLightRegion=HISTORY_REGION; + } + else + giHighLightRegion=NO_REGION; + DrawHighLightRegionBox(); +} + +void +DrawHighLightRegionBox() +{ + + return; +} + +void +RestoreOldRegion(INT32 iOldRegion) +{ + + return; +} + +void HighLightRegion(INT32 iCurrentRegion) +{ + + return; +} + +void HandleAnimatedButtons() +{ + + return; + + +} +void AnimateButton( UINT32 uiIconID, UINT16 usX, UINT16 usY ) +{ + return; +} + +void WWWRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) +{ + static INT32 iBaseTime=0; + static INT32 iFrame=0; + INT32 iDifference=0; + HVOBJECT hLapTopIconHandle; + if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + iBaseTime=0; + iFrame=0; + GetVideoObject(&hLapTopIconHandle, guiWWWICON); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_WWW_Y, VO_BLT_SRCTRANSPARENCY,NULL); + DrawLapTopText(); + HighLightRegion(giCurrentRegion); + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + } +} + + +void EmailRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) +{ + static INT32 iBaseTime=0; + static INT32 iFrame=0; + INT32 iDifference=0; + HVOBJECT hLapTopIconHandle; + if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + iBaseTime=0; + iFrame=0; + DrawLapTopText(); + GetVideoObject(&hLapTopIconHandle, guiMAILICON); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_MAIL_Y, VO_BLT_SRCTRANSPARENCY,NULL); + if(fUnReadMailFlag) + { + GetVideoObject(&hLapTopIconHandle, guiUNREAD); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,LAPTOP_ICONS_X+CHECK_X, LAPTOP_ICONS_MAIL_Y+CHECK_Y, VO_BLT_SRCTRANSPARENCY,NULL); + } + DrawLapTopText(); + HighLightRegion(giCurrentRegion); + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + } +} + + +void FinancialRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) +{ + static INT32 iBaseTime=0; + static INT32 iFrame=0; + INT32 iDifference=0; + HVOBJECT hLapTopIconHandle; + if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + iBaseTime=0; + iFrame=0; + GetVideoObject(&hLapTopIconHandle, guiFINANCIALICON); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X-4, LAPTOP_ICONS_FINANCIAL_Y, VO_BLT_SRCTRANSPARENCY,NULL); + DrawLapTopText(); + HighLightRegion(giCurrentRegion); + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + } +} + +void HistoryRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) +{ + static INT32 iBaseTime=0; + static INT32 iFrame=0; + INT32 iDifference=0; + HVOBJECT hLapTopIconHandle; + if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + iBaseTime=0; + iFrame=0; + + GetVideoObject(&hLapTopIconHandle, guiHISTORYICON); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_HISTORY_Y, VO_BLT_SRCTRANSPARENCY,NULL); + DrawLapTopText(); + HighLightRegion(giCurrentRegion); + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + } +} + + + +void FilesRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) +{ + static INT32 iBaseTime=0; + static INT32 iFrame=0; + INT32 iDifference=0; + HVOBJECT hLapTopIconHandle; + if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + iBaseTime=0; + iFrame=0; + GetVideoObject(&hLapTopIconHandle, guiFILESICON); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_FILES_Y+7, VO_BLT_SRCTRANSPARENCY,NULL); + DrawLapTopText(); + HighLightRegion(giCurrentRegion); + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + } +} + +void PersonnelRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) +{ + static INT32 iBaseTime=0; + static INT32 iFrame=0; + INT32 iDifference=0; + HVOBJECT hLapTopIconHandle; + if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + iBaseTime=0; + iFrame=0; + + GetVideoObject(&hLapTopIconHandle, guiPERSICON); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, (UINT16)iFrame,LAPTOP_ICONS_X, LAPTOP_ICONS_PERSONNEL_Y, VO_BLT_SRCTRANSPARENCY,NULL); + DrawLapTopText(); + HighLightRegion(giCurrentRegion); + InvalidateRegion(0,0,SCREEN_WIDTH, SCREEN_HEIGHT); + } +} + + + +void +CheckIfMouseLeaveScreen() +{ + POINT MousePos; + GetCursorPos(&MousePos); + if((MousePos.x >LAPTOP_SCREEN_LR_X )||(MousePos.xLAPTOP_SCREEN_LR_Y)) + { + guiCurrentLapTopCursor=LAPTOP_PANEL_CURSOR; + } + +} +void ScreenRegionMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + return; + } + /*if (iReason == MSYS_CALLBACK_REASON_MOVE) + { + guiCurrentLapTopCursor=LAPTOP_SCREEN_CURSOR; + } + if (iReason == MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + CheckIfMouseLeaveScreen(); + } + */ +} + +void ReDrawHighLight() +{ + HighLightRegion(giCurrentRegion); + return; +} + + +void DrawButtonText() +{ + + if(fErrorFlag) + DrawTextOnErrorButton(); + switch(guiCurrentLaptopMode) + { + case LAPTOP_MODE_EMAIL: + DisplayEmailHeaders( ); + break; + } + return; +} + +void InitBookMarkList() +{ + // sets bookmark list to -1 + memset( LaptopSaveInfo.iBookMarkList, -1, sizeof( LaptopSaveInfo.iBookMarkList ) ); + return; +} + +void SetBookMark(INT32 iBookId) +{ + // find first empty spot, set to iBookId + INT32 iCounter=0; + if(iBookId!=-2) + { + while(LaptopSaveInfo.iBookMarkList[iCounter]!=-1) + { + // move trhough list until empty + if( LaptopSaveInfo.iBookMarkList[iCounter]==iBookId) + { + // found it, return + return; + } + iCounter++; + } + LaptopSaveInfo.iBookMarkList[iCounter]=iBookId; + } + return; +} + + +BOOLEAN RemoveBookMark( INT32 iBookId ) +{ + INT32 iCounter=0; + + //Loop through the bookmarks to get to the desired bookmark + while( LaptopSaveInfo.iBookMarkList[iCounter] != iBookId ) + { + iCounter++; + } + + //Did we find the right one? + if( LaptopSaveInfo.iBookMarkList[iCounter] == iBookId ) + { + //Reset it + LaptopSaveInfo.iBookMarkList[iCounter] = -1; + + //return true signifing that we found it + return( TRUE ); + } + + //nope, we didnt find it. + return( FALSE ); +} + + + +BOOLEAN LoadBookmark() +{ + VOBJECT_DESC VObjectDesc; + + + // grab download bars too + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\downloadtop.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiDOWNLOADTOP)); + + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\downloadmid.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiDOWNLOADMID)); + + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\downloadbot.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiDOWNLOADBOT)); + + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\bookmarktop.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBOOKTOP)); + + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\bookmarkmiddle.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBOOKMID)); + + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\webpages.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBOOKMARK)); + + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\hilite.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBOOKHIGH)); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\Bookmarkbottom.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBOOKBOT)); + + + return( TRUE ); +} + + + +void DisplayBookMarks( void ) +{ + // will look at bookmarklist and set accordingly + INT32 iCounter=1; + // load images + HVOBJECT hLapTopIconHandle; + // laptop icons + INT16 sX, sY; + + + // check if we are maximizing or minimizing.. if so, do not display + if( ( fMaximizingProgram == TRUE ) || ( fMinizingProgram == TRUE ) ) + { + return; + } + + + // font stuff + SetFont(BOOK_FONT); + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // set buffer + SetFontDestBuffer(FRAME_BUFFER ,BOOK_X, BOOK_TOP_Y,BOOK_X+BOOK_WIDTH-10,SCREEN_HEIGHT, FALSE); + + + // blt in book mark background + while( LaptopSaveInfo.iBookMarkList[iCounter-1]!=-1) + { + + if(iHighLightBookLine==iCounter-1) + { + GetVideoObject(&hLapTopIconHandle, guiBOOKHIGH); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); + } + else + { + GetVideoObject(&hLapTopIconHandle, guiBOOKMARK); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); + } + + if( iHighLightBookLine==iCounter-1 ) + { + // blit in text + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + } + else + { + // blit in text + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + } + + FindFontCenterCoordinates(BOOK_X + 3, (UINT16)(BOOK_TOP_Y+2+(iCounter*( BOOK_HEIGHT + 6 ) ) + 6),BOOK_WIDTH - 3,BOOK_HEIGHT+6, pBookMarkStrings[ LaptopSaveInfo.iBookMarkList[iCounter-1] ] , BOOK_FONT, &sX, &sY ); + + mprintf(sX, sY,pBookMarkStrings[ LaptopSaveInfo.iBookMarkList[iCounter-1] ] ); + iCounter++; + } + + // blit one more + + + if(iHighLightBookLine==iCounter-1) + { + GetVideoObject(&hLapTopIconHandle, guiBOOKHIGH); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); + } + else + { + GetVideoObject(&hLapTopIconHandle, guiBOOKMARK); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, BOOK_TOP_Y+ ( iCounter*( BOOK_HEIGHT + 6 ) )+ 6, VO_BLT_SRCTRANSPARENCY,NULL); + } + + if( iHighLightBookLine==iCounter-1 ) + { + // blit in text + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + } + else + { + // blit in text + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + } + FindFontCenterCoordinates(BOOK_X + 3, (UINT16)(BOOK_TOP_Y+2+(iCounter*( BOOK_HEIGHT + 6 ) ) + 6),BOOK_WIDTH - 3,BOOK_HEIGHT+6,pBookMarkStrings[ CANCEL_STRING ] , BOOK_FONT, &sX, &sY ); + mprintf(sX, sY,pBookMarkStrings[CANCEL_STRING] ); + iCounter++; + + SetFontDestBuffer(FRAME_BUFFER,0,0,SCREEN_WIDTH, SCREEN_HEIGHT, FALSE); + + //GetVideoObject(&hLapTopIconHandle, guiBOOKBOT); + //BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,BOOK_X, 6+BOOK_TOP_Y+(iCounter)*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + + /*if(fNewWWWDisplay) + ScrollDisplayText(BOOK_TOP_Y+2+((iCounter)*BOOK_HEIGHT)+6); + else + */ InvalidateRegion(BOOK_X,BOOK_TOP_Y+((iCounter)*BOOK_HEIGHT)+12, BOOK_X+BOOK_WIDTH, BOOK_TOP_Y+((iCounter+1)*BOOK_HEIGHT)+16); + SetFontShadow(DEFAULT_SHADOW); + + + InvalidateRegion(BOOK_X, BOOK_TOP_Y, BOOK_X+BOOK_WIDTH, BOOK_TOP_Y+(iCounter + 6 )*BOOK_HEIGHT+16); + return; +} + +void RemoveBookmark(INT32 iBookId) +{ + INT32 iCounter=0; + if(iBookId==-2) + return; + while( LaptopSaveInfo.iBookMarkList[iCounter]!=-1) + { + if( LaptopSaveInfo.iBookMarkList[iCounter]==iBookId) + { + // found, move everyone back + for(iCounter=iCounter+1; iCounter SCROLL_DIFFERENCE) + { + + // reset postion, if scrolled too far + if(sCurX = iLoadTime) + { + // done loading, redraw screen + fLoadPendingFlag = FALSE; + fFastLoadFlag = FALSE; + iTotalTime=0; + iBaseTime=0; + fDoneLoadPending = TRUE; + fConnectingToSubPage = FALSE; + fPausedReDrawScreenFlag = TRUE; + + return(TRUE); + } + + + iDifference=GetJA2Clock()-iBaseTime; + + + + // difference has been long enough or we are redrawing the screen + if( (iDifference) > iUnitTime) + { + // LONG ENOUGH TIME PASSED + iCounter=0; + iBaseTime=GetJA2Clock(); + iTotalTime+=iDifference; + iTempTime=iTotalTime; + + } + + // new mail, don't redraw + if( fNewMailFlag == TRUE ) + { + return( FALSE ); + } + + RenderButtons( ); + +// RenderFastHelp( ); +// RenderButtonsFastHelp( ); + + + // display top middle and bottom of box + GetVideoObject(&hLapTopIconHandle, guiDOWNLOADTOP); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiDOWNLOADMID); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y+DOWN_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiDOWNLOADBOT); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y+2*DOWN_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 1,DOWNLOAD_X + 4, DOWNLOAD_Y + 1, VO_BLT_SRCTRANSPARENCY,NULL); + + + // font stuff + SetFont(DOWNLOAD_FONT); + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // reload or download? + if( fFastLoadFlag == TRUE ) + { + FindFontCenterCoordinates( iScreenWidthOffset + 328, + iScreenHeightOffset, 118, 0, pDownloadString[1], DOWNLOAD_FONT, &sXPosition, &sYPosition ); + + // display download string + mprintf( sXPosition, DOWN_STRING_Y,pDownloadString[1]); + } + else + { + FindFontCenterCoordinates( iScreenWidthOffset + 328, + iScreenHeightOffset, /*iScreenWidthOffset + */118, 0, pDownloadString[ 0 ], DOWNLOAD_FONT, &sXPosition, &sYPosition ); + + // display download string + mprintf( sXPosition, DOWN_STRING_Y,pDownloadString[0]); + } + + // get and blt the window video object + GetVideoObject(&hLapTopIconHandle, guiGRAPHWINDOW); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,LAPTOP_WINDOW_X, LAPTOP_WINDOW_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // check to see if we are only updating screen, but not passed a new element in the load pending display + + + iTempTime = iTotalTime; + // decide how many time units are to be displayed, based on amount of time passed + while(iTempTime >0) + { + GetVideoObject(&hLapTopIconHandle, guiGRAPHBAR); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,LAPTOP_BAR_X+(UNIT_WIDTH*iCounter), LAPTOP_BAR_Y, VO_BLT_SRCTRANSPARENCY,NULL); + iTempTime-=iUnitTime; + iCounter++; + + // have we gone too far? + if( iCounter > 30 ) + { + iTempTime = 0; + } + } + + InvalidateRegion(DOWNLOAD_X, DOWNLOAD_Y, DOWNLOAD_X + 150, DOWNLOAD_Y + 100); + + // re draw screen and new mail warning box + SetFontShadow(DEFAULT_SHADOW); + + MarkButtonsDirty( ); + + DisableMercSiteButton(); + + return (FALSE); +} + +void DeleteLoadPending( void ) +{ + // this funtion will delete the load pending graphics + // reuse bookmark + DeleteVideoObjectFromIndex(guiGRAPHBAR); + DeleteVideoObjectFromIndex(guiGRAPHWINDOW); + return; +} + +void BtnErrorCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fErrorFlag=FALSE; + + } + } +} +void CreateDestroyErrorButton( void ) +{ + static BOOLEAN fOldErrorFlag=FALSE; + if((fErrorFlag)&&(!fOldErrorFlag)) + { + // create inventory button + fOldErrorFlag=TRUE; + + // load image and create error confirm button + giErrorButtonImage[0]=LoadButtonImage( "LAPTOP\\errorbutton.sti" ,-1,0,-1,1,-1 ); + giErrorButton[0]= QuickCreateButton( giErrorButtonImage[0], ERROR_X+ERROR_BTN_X, ERROR_BTN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnErrorCallback); + + // define the cursor + SetButtonCursor(giErrorButton[0], CURSOR_LAPTOP_SCREEN); + + // define the screen mask + MSYS_DefineRegion(&pScreenMask,0, 0,SCREEN_WIDTH, SCREEN_HEIGHT, + MSYS_PRIORITY_HIGHEST-3,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, LapTopScreenCallBack); + + // add region + MSYS_AddRegion(&pScreenMask); + } + else if((!fErrorFlag)&&(fOldErrorFlag)) + { + // done dsiplaying, get rid of button and screen mask + fOldErrorFlag=FALSE; + + RemoveButton( giErrorButton[0] ); + UnloadButtonImage( giErrorButtonImage[0] ); + + MSYS_RemoveRegion(&pScreenMask); + + // re draw screen + fReDrawScreenFlag=TRUE; + + } + return; +} + + +void DisplayErrorBox( void ) +{ + // this function will display the error graphic + HVOBJECT hLapTopIconHandle; + if(!fErrorFlag) + return; + + // get and blt top portion + GetVideoObject(&hLapTopIconHandle, guiBOOKTOP); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // middle * 5 + GetVideoObject(&hLapTopIconHandle, guiBOOKMID); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + + GetVideoObject(&hLapTopIconHandle, guiBOOKMID); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+2*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + + GetVideoObject(&hLapTopIconHandle, guiBOOKMID); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+3*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + + GetVideoObject(&hLapTopIconHandle, guiBOOKMID); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+4*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + + GetVideoObject(&hLapTopIconHandle, guiBOOKMID); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+5*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + + // the bottom + GetVideoObject(&hLapTopIconHandle, guiBOOKBOT); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,ERROR_X, ERROR_Y+6*BOOK_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + + // font stuff + SetFont(ERROR_TITLE_FONT); + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // print title + mprintf(ERROR_TITLE_X, ERROR_TITLE_Y, pErrorStrings[0]); + SetFontForeground(FONT_BLACK); + SetFont(ERROR_FONT); + + // display error string + DisplayWrappedString(ERROR_X+ERROR_TEXT_X,(UINT16)(ERROR_Y+ERROR_TEXT_Y+DisplayWrappedString(ERROR_X+ERROR_TEXT_X, ERROR_Y+ERROR_TEXT_Y, BOOK_WIDTH, 2,ERROR_FONT,FONT_BLACK, pErrorStrings[1],FONT_BLACK,FALSE,CENTER_JUSTIFIED)), BOOK_WIDTH, 2,ERROR_FONT,FONT_BLACK, pErrorStrings[2],FONT_BLACK,FALSE,CENTER_JUSTIFIED); + + SetFontShadow(DEFAULT_SHADOW); + + return; +} + + +void DrawTextOnErrorButton() +{ + // draws text on error button + SetFont(ERROR_TITLE_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + mprintf(ERROR_X+ERROR_BTN_X+ERROR_BTN_TEXT_X, ERROR_BTN_Y+ERROR_BTN_TEXT_Y, pErrorStrings[3]); + SetFontShadow(DEFAULT_SHADOW); + + InvalidateRegion(ERROR_X, ERROR_Y, ERROR_X+BOOK_WIDTH, ERROR_Y+6*BOOK_HEIGHT); + return; +} + +// This function is called every time the laptop is FIRST initialized, ie whenever the laptop is loaded. It calls +// various init function in the laptop pages that need to be inited when the laptop is just loaded. +void EnterLaptopInitLaptopPages() +{ + EnterInitAimMembers(); + EnterInitAimArchives(); + EnterInitAimPolicies(); + EnterInitAimHistory(); + EnterInitFloristGallery(); + EnterInitInsuranceInfo(); + EnterInitBobbyRayOrder(); + EnterInitMercSite(); + + + // init sub pages for WW Wait + InitIMPSubPageList( ); +} + + +void CheckMarkButtonsDirtyFlag( void ) +{ + // this function checks the fMarkButtonsDirtyFlag, if true, mark buttons dirty + if( fMarkButtonsDirtyFlag ) + { + // flag set, mark buttons and reset + MarkButtonsDirty( ); + fMarkButtonsDirtyFlag = FALSE; + } + + return; +} + + +void PostButtonRendering( void ) +{ + // this function is in place to allow for post button rendering + + switch( guiCurrentLaptopMode ) + { + case LAPTOP_MODE_AIM: +// RenderCharProfilePostButton( ); + break; + + case LAPTOP_MODE_AIM_MEMBERS: + RenderAIMMembersTopLevel(); + break; + + } + return; +} + +void ShouldNewMailBeDisplayed() +{ + + BOOLEAN fReDraw=FALSE; + switch( guiCurrentLaptopMode ) + { + case LAPTOP_MODE_AIM_MEMBERS: + fReDraw = DisableNewMailMessage(); + break; + } +/* + if(fReDraw) + { + RenderLapTopImage(); + HighLightRegion(giCurrentRegion); + RenderLaptop(); + } + */ +} + + +void DisplayPlayersBalanceToDate( void ) +{ + // print players balance to date + CHAR16 sString[ 100 ]; + INT16 sX, sY; + + // initialize string + memset( sString, 0, sizeof( sString ) ); + + // font stuff + SetFont( FONT10ARIAL); + SetFontForeground( 142 ); + SetFontShadow(NO_SHADOW); + + // parse straigth number + swprintf( sString, L"%d", LaptopSaveInfo.iCurrentBalance ); + + // put in commas, then dollar sign + InsertCommasForDollarFigure( sString ); + InsertDollarSignInToString( sString ); + + // get center + FindFontCenterCoordinates( (INT16)LAPTOP_ICON_TEXT_X, iScreenHeightOffset, (INT16)(LAPTOP_ICON_TEXT_WIDTH) ,(INT16)(LAPTOP_ICON_TEXT_HEIGHT), sString, LAPTOPICONFONT, &sX, &sY ); + +// gprintfdirty( sX , LAPTOP_ICON_TEXT_FINANCIAL_Y + 10, sString ); + // printf it! + if( ButtonList[ gLaptopButton[ 5 ] ]->uiFlags & BUTTON_CLICKED_ON ) + { + mprintf( sX + 5, LAPTOP_ICON_TEXT_FINANCIAL_Y + 10 + 5, sString); + } + else + { + mprintf( sX, LAPTOP_ICON_TEXT_FINANCIAL_Y + 10, sString); + } + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + + return; +} + + +void CheckIfNewWWWW( void ) +{ + // if no www mode, set new www flag..until new www mode that is not 0 + + if( guiCurrentWWWMode == LAPTOP_MODE_NONE ) + { + fNewWWW = TRUE; + } + else + { + fNewWWW = FALSE; + } + + return; +} + + +void HandleLapTopESCKey( void ) +{ + + // will handle esc key events, since handling depends on state of laptop + + + if( fNewMailFlag ) + { + // get rid of new mail warning box + fNewMailFlag=FALSE; + CreateDestroyNewMailButton(); + + // force redraw + fReDrawScreenFlag = TRUE; + RenderLaptop( ); + } + else if(fDeleteMailFlag) + { + // get rid of delete mail box + fDeleteMailFlag=FALSE; + CreateDestroyDeleteNoticeMailButton(); + + // force redraw + fReDrawScreenFlag = TRUE; + RenderLaptop( ); + } + else if( fErrorFlag ) + { + // get rid of error warning box + fErrorFlag=FALSE; + CreateDestroyErrorButton(); + + // force redraw + fReDrawScreenFlag = TRUE; + RenderLaptop( ); + } + + else if( gfShowBookmarks ) + { + // get rid of bookmarks + gfShowBookmarks = FALSE; + + // force redraw + fReDrawScreenFlag = TRUE; + RenderLapTopImage( ); + RenderLaptop( ); + } + else + { + // leave + fExitingLaptopFlag = TRUE; + HandleExit( ); + } + + + + return; +} + + +void HandleRightButtonUpEvent( void ) +{ + + // will handle the right button up event + if( fNewMailFlag ) + { + // get rid of new mail warning box + fNewMailFlag=FALSE; + CreateDestroyNewMailButton(); + + // force redraw + fReDrawScreenFlag = TRUE; + RenderLaptop( ); + } + else if(fDeleteMailFlag) + { + // get rid of delete mail box + fDeleteMailFlag=FALSE; + CreateDestroyDeleteNoticeMailButton(); + + // force redraw + fReDrawScreenFlag = TRUE; + RenderLaptop( ); + } + else if( fErrorFlag ) + { + // get rid of error warning box + fErrorFlag=FALSE; + CreateDestroyErrorButton(); + + // force redraw + fReDrawScreenFlag = TRUE; + RenderLaptop( ); + } + + else if( gfShowBookmarks ) + { + // get rid of bookmarks + gfShowBookmarks = FALSE; + + // force redraw + fReDrawScreenFlag = TRUE; + RenderLapTopImage( ); + RenderLaptop( ); + } + else if( fDisplayMessageFlag ) + { + fDisplayMessageFlag = FALSE; + + // force redraw + fReDrawScreenFlag = TRUE; + RenderLapTopImage( ); + RenderLaptop( ); + + } + else if( fShowBookmarkInfo ) + { + fShowBookmarkInfo = FALSE; + } + +} + + +void HandleLeftButtonUpEvent( void ) +{ + + // will handle the left button up event + + if( gfShowBookmarks ) + { + // get rid of bookmarks + gfShowBookmarks = FALSE; + + // force redraw + fReDrawScreenFlag = TRUE; + RenderLapTopImage( ); + RenderLaptop( ); + } + else if( fShowBookmarkInfo ) + { + fShowBookmarkInfo = FALSE; + } +} + +void LapTopScreenCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + + return; + } + + if( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + HandleLeftButtonUpEvent( ); + return; + } + if(iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { + HandleRightButtonUpEvent( ); + return; + } + + return; +} + +template BOOLEAN DoLapTopMessageBox(UINT8, unsigned short *, UINT32, UINT8, MSGBOX_CALLBACK); +template BOOLEAN DoLapTopMessageBox(UINT8, unsigned short const *, UINT32, UINT8, MSGBOX_CALLBACK); +template +BOOLEAN DoLapTopMessageBox( UINT8 ubStyle, string2 zString, UINT32 uiExitScreen, UINT8 ubFlags, MSGBOX_CALLBACK ReturnCallback ) +{ + SGPRect pCenteringRect= {LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_LR_Y }; + + + // reset exit mode + fExitDueToMessageBox = TRUE; + + + + // do message box and return + iLaptopMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( ubFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &pCenteringRect ); + + + + // send back return state + return( ( iLaptopMessageBox != -1 ) ); +} + + +BOOLEAN DoLapTopSystemMessageBoxWithRect( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ) +{ + // reset exit mode + fExitDueToMessageBox = TRUE; + + // do message box and return + iLaptopMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); + + // send back return state + return( ( iLaptopMessageBox != -1 ) ); +} + +BOOLEAN DoLapTopSystemMessageBox( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) +{ + SGPRect CenteringRect= {iScreenWidthOffset, iScreenHeightOffset, + iScreenWidthOffset + 640, INV_INTERFACE_START_Y }; + + + // reset exit mode + fExitDueToMessageBox = TRUE; + + // do message box and return + iLaptopMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); + + // send back return state + return( ( iLaptopMessageBox != -1 ) ); +} + + + +//places a tileable pattern down +BOOLEAN WebPageTileBackground(UINT8 ubNumX, UINT8 ubNumY, UINT16 usWidth, UINT16 usHeight, UINT32 uiBackgroundIdentifier) +{ + HVOBJECT hBackGroundHandle; + UINT16 x,y, uiPosX, uiPosY; + + // Blt the Wood background + GetVideoObject(&hBackGroundHandle, uiBackgroundIdentifier); + + uiPosY = LAPTOP_SCREEN_WEB_UL_Y; + for(y=0; y 1 ) + { + sWidth = (UINT16)(LastRect.iRight - LastRect.iLeft); + sHeight = (UINT16)(LastRect.iBottom - LastRect.iTop); + BlitBufferToBuffer(guiSAVEBUFFER, guiRENDERBUFFER, (UINT16)LastRect.iLeft, (UINT16)LastRect.iTop, sWidth, sHeight); + } + + //Save rectangle + if( ubCount > 0 ) + { + sWidth = (UINT16)(DestRect.iRight - DestRect.iLeft); + sHeight = (UINT16)(DestRect.iBottom - DestRect.iTop); + BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, (UINT16)DestRect.iLeft, (UINT16)DestRect.iTop, sWidth, sHeight); + } + } + else + { + //Restore the old rect + if( ubCount < NUMBER_OF_LAPTOP_TITLEBAR_ITERATIONS - 1 ) + { + sWidth = (UINT16)(LastRect.iRight - LastRect.iLeft); + sHeight = (UINT16)(LastRect.iBottom - LastRect.iTop); + BlitBufferToBuffer(guiSAVEBUFFER, guiRENDERBUFFER, (UINT16)LastRect.iLeft, (UINT16)LastRect.iTop, sWidth, sHeight); + } + + //Save rectangle + if( ubCount < NUMBER_OF_LAPTOP_TITLEBAR_ITERATIONS ) + { + sWidth = (UINT16)(DestRect.iRight - DestRect.iLeft); + sHeight = (UINT16)(DestRect.iBottom - DestRect.iTop); + BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, (UINT16)DestRect.iLeft, (UINT16)DestRect.iTop, sWidth, sHeight); + } + } + + + BltStretchVideoSurface(FRAME_BUFFER, guiTitleBarSurface, 0, 0, VO_BLT_SRCTRANSPARENCY, &SrcRect, &DestRect ); + + InvalidateRegion(DestRect.iLeft,DestRect.iTop, DestRect.iRight, DestRect.iBottom); + InvalidateRegion(LastRect.iLeft,LastRect.iTop, LastRect.iRight, LastRect.iBottom); + + LastRect = DestRect; + + if( fForward ) + { + if( ubCount == NUMBER_OF_LAPTOP_TITLEBAR_ITERATIONS) + { + gfTitleBarSurfaceAlreadyActive=FALSE; + return(TRUE); + } + else + { + ubCount++; + return(FALSE); + } + } + else + { + if( ubCount == 0) + { + gfTitleBarSurfaceAlreadyActive=FALSE; + return(TRUE); + } + else + { + ubCount--; + return(FALSE); + } + } + + return(TRUE); +} + +void RemoveTitleBarMaximizeGraphics() +{ + DeleteVideoSurfaceFromIndex( guiTitleBarSurface ); +} + + +void HandleSlidingTitleBar( void ) +{ + if( ( fMaximizingProgram == FALSE ) && ( fMinizingProgram == FALSE ) ) + { + return; + } + + if( fExitingLaptopFlag ) + { + return; + } + + if( fMaximizingProgram ) + { + switch( bProgramBeingMaximized ) + { + case( LAPTOP_PROGRAM_MAILER ): + + fMaximizingProgram = !DisplayTitleBarMaximizeGraphic( TRUE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 66, iScreenWidthOffset + 49 ); + + //fMaximizingProgram = !DisplayTitleBarMaximizeGraphic( TRUE, fInitTitle, 29, 66, 29 + 20 ); + + if( fMaximizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + fEnteredNewLapTopDueToHandleSlidingBars = TRUE; + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + + case( LAPTOP_PROGRAM_FILES ): + fMaximizingProgram = !DisplayTitleBarMaximizeGraphic( TRUE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 120, iScreenWidthOffset + 29 + 20 ); + if( fMaximizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + fEnteredNewLapTopDueToHandleSlidingBars = TRUE; + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + case( LAPTOP_PROGRAM_FINANCES ): + fMaximizingProgram = !DisplayTitleBarMaximizeGraphic( TRUE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 226, iScreenWidthOffset + 29 + 20 ); + if( fMaximizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + fEnteredNewLapTopDueToHandleSlidingBars = TRUE; + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + case( LAPTOP_PROGRAM_PERSONNEL ): + fMaximizingProgram = !DisplayTitleBarMaximizeGraphic( TRUE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 194, iScreenWidthOffset + 29 + 20 ); + if( fMaximizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + fEnteredNewLapTopDueToHandleSlidingBars = TRUE; + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + case( LAPTOP_PROGRAM_HISTORY ): + fMaximizingProgram = !DisplayTitleBarMaximizeGraphic( TRUE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 162, iScreenWidthOffset + 29 + 20 ); + if( fMaximizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + fEnteredNewLapTopDueToHandleSlidingBars = TRUE; + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + case( LAPTOP_PROGRAM_WEB_BROWSER ): + fMaximizingProgram = !DisplayTitleBarMaximizeGraphic( TRUE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 99, iScreenWidthOffset + 29 + 20 ); + if( fMaximizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + fEnteredNewLapTopDueToHandleSlidingBars = TRUE; + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + } + + MarkButtonsDirty( ); + } + else + { + // minimizing + switch( bProgramBeingMaximized ) + { + case( LAPTOP_PROGRAM_MAILER ): + fMinizingProgram = !DisplayTitleBarMaximizeGraphic( FALSE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 66, iScreenWidthOffset + 29 + 20 ); + if( fMinizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + case( LAPTOP_PROGRAM_FILES ): + fMinizingProgram = !DisplayTitleBarMaximizeGraphic( FALSE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 130, iScreenWidthOffset + 29 + 20 ); + if( fMinizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + case( LAPTOP_PROGRAM_FINANCES ): + fMinizingProgram = !DisplayTitleBarMaximizeGraphic( FALSE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 226, iScreenWidthOffset + 29 + 20 ); + if( fMinizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + case( LAPTOP_PROGRAM_PERSONNEL ): + fMinizingProgram = !DisplayTitleBarMaximizeGraphic( FALSE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 194, iScreenWidthOffset + 29 + 20 ); + if( fMinizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + case( LAPTOP_PROGRAM_HISTORY ): + fMinizingProgram = !DisplayTitleBarMaximizeGraphic( FALSE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 162 , iScreenWidthOffset + 29 + 20 ); + if( fMinizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + case( LAPTOP_PROGRAM_WEB_BROWSER ): + fMinizingProgram = !DisplayTitleBarMaximizeGraphic( FALSE, fInitTitle, iScreenWidthOffset + 29, + iScreenHeightOffset + 99 , iScreenWidthOffset + 29 + 20 ); + if( fMinizingProgram == FALSE ) + { + RemoveTitleBarMaximizeGraphics(); + EnterNewLaptopMode(); + fEnteredNewLapTopDueToHandleSlidingBars = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + break; + } + } + + + // reset init + fInitTitle = FALSE; +} + + +void ShowLights( void ) +{ + // will show lights depending on state + HVOBJECT hHandle; + + if( fPowerLightOn == TRUE ) + { + GetVideoObject( &hHandle, guiLIGHTS); + BltVideoObject(FRAME_BUFFER, hHandle, 0,iScreenWidthOffset + 44, iScreenHeightOffset + 466, VO_BLT_SRCTRANSPARENCY,NULL); + } + else + { + GetVideoObject( &hHandle, guiLIGHTS); + BltVideoObject(FRAME_BUFFER, hHandle, 1,iScreenWidthOffset + 44, iScreenHeightOffset + 466, VO_BLT_SRCTRANSPARENCY,NULL); + } + + if( fHardDriveLightOn == TRUE ) + { + GetVideoObject( &hHandle, guiLIGHTS); + BltVideoObject(FRAME_BUFFER, hHandle, 0, iScreenWidthOffset + 88, iScreenHeightOffset + 466, VO_BLT_SRCTRANSPARENCY,NULL); + } + else + { + GetVideoObject( &hHandle, guiLIGHTS); + BltVideoObject(FRAME_BUFFER, hHandle, 1, iScreenWidthOffset + 88, iScreenHeightOffset + 466, VO_BLT_SRCTRANSPARENCY,NULL); + } + + +} + + +void FlickerHDLight( void ) +{ + static INT32 iBaseTime = 0; + static INT32 iTotalDifference = 0; + INT32 iDifference = 0; + + if( fLoadPendingFlag == TRUE ) + { + fFlickerHD = TRUE; + } + + if( fFlickerHD == FALSE ) + { + return; + } + + + if( iBaseTime == 0 ) + { + iBaseTime = GetJA2Clock( ); + } + + iDifference = GetJA2Clock( ) - iBaseTime; + + if( ( iTotalDifference > HD_FLICKER_TIME ) && ( fLoadPendingFlag == FALSE ) ) + { + iBaseTime = GetJA2Clock( ); + fHardDriveLightOn = FALSE; + iBaseTime = 0; + iTotalDifference = 0; + fFlickerHD = FALSE; + InvalidateRegion(iScreenWidthOffset + 88, iScreenHeightOffset + 466, + iScreenWidthOffset + 102, iScreenHeightOffset + 477 ); + return; + } + + if( iDifference > FLICKER_TIME ) + { + iTotalDifference += iDifference; + + if( fLoadPendingFlag == TRUE ) + { + iTotalDifference = 0; + } + + if( ( Random( 2 ) ) == 0 ) + { + fHardDriveLightOn = TRUE; + } + else + { + fHardDriveLightOn = FALSE; + } + InvalidateRegion(iScreenWidthOffset + 88, iScreenHeightOffset + 466, + iScreenWidthOffset + 102, iScreenHeightOffset + 477 ); + } + + return; +} + + +BOOLEAN ExitLaptopDone( void ) +{ + // check if this is the first time, to reset counter + + static BOOLEAN fOldLeaveLaptopState = FALSE; + static INT32 iBaseTime = 0; + INT32 iDifference = 0; + + if( fOldLeaveLaptopState == FALSE ) + { + fOldLeaveLaptopState = TRUE; + iBaseTime = GetJA2Clock( ); + } + + fPowerLightOn = FALSE; + + + InvalidateRegion(iScreenWidthOffset + 44, iScreenHeightOffset + 466, + iScreenWidthOffset + 58, iScreenHeightOffset + 477 ); + // get the current difference + iDifference = GetJA2Clock( ) - iBaseTime; + + + // did we wait long enough? + if( iDifference > EXIT_LAPTOP_DELAY_TIME ) + { + iBaseTime = 0; + fOldLeaveLaptopState = FALSE; + return TRUE; + } + else + { + return FALSE; + } + +} + + +void CreateDestroyMinimizeButtonForCurrentMode( void ) +{ + // will create the minimize button + + static BOOLEAN fAlreadyCreated = FALSE; + // check to see if created, if so, do nothing + + + // check current mode + if( ( guiCurrentLaptopMode == LAPTOP_MODE_NONE )&&( guiPreviousLaptopMode != LAPTOP_MODE_NONE ) ) + { + fCreateMinimizeButton = FALSE; + } + else if( ( guiCurrentLaptopMode != LAPTOP_MODE_NONE ) ) + { + fCreateMinimizeButton = TRUE; + } + else if( ( guiPreviousLaptopMode != LAPTOP_MODE_NONE ) ) + { + fCreateMinimizeButton = FALSE; + } + + // leaving laptop, get rid of the button + if( fExitingLaptopFlag == TRUE ) + { + fCreateMinimizeButton = FALSE; + } + + + if( ( fAlreadyCreated == FALSE ) && ( fCreateMinimizeButton == TRUE ) ) + { + // not created, create + fAlreadyCreated = TRUE; + CreateMinimizeButtonForCurrentMode( ); + CreateMinimizeRegionsForLaptopProgramIcons( ); + } + else if( ( fAlreadyCreated == TRUE ) && ( fCreateMinimizeButton == FALSE ) ) + { + // created and must be destroyed + fAlreadyCreated = FALSE; + DestroyMinimizeButtonForCurrentMode( ); + DestroyMinimizeRegionsForLaptopProgramIcons( ); + + } + else + { + // do nothing + } + + return; +} + + +void CreateMinimizeButtonForCurrentMode( void ) +{ + // create minimize button + gLaptopMinButtonImage[0]= LoadButtonImage( "LAPTOP\\x.sti" ,-1,0,-1,1,-1 ); + gLaptopMinButton[0] = QuickCreateButton( gLaptopMinButtonImage[0], iScreenWidthOffset + 590, iScreenHeightOffset + 30, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)LaptopMinimizeProgramButtonCallback); + + SetButtonCursor(gLaptopMinButton[0], CURSOR_LAPTOP_SCREEN); + return; +} + +void DestroyMinimizeButtonForCurrentMode( void ) +{ + // destroy minimize button + RemoveButton( gLaptopMinButton[ 0 ] ); + UnloadButtonImage( gLaptopMinButtonImage[ 0 ] ); + +} + + +void LaptopMinimizeProgramButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + switch( guiCurrentLaptopMode ) + { + case( LAPTOP_MODE_EMAIL ): + gLaptopProgramStates[ LAPTOP_PROGRAM_MAILER ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[ 0 ], guiTITLEBARICONS, 0 ); + SetCurrentToLastProgramOpened( ); + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + case( LAPTOP_MODE_FILES ): + gLaptopProgramStates[ LAPTOP_PROGRAM_FILES ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[5], guiTITLEBARICONS, 2 ); + SetCurrentToLastProgramOpened( ); + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + case( LAPTOP_MODE_FINANCES ): + gLaptopProgramStates[ LAPTOP_PROGRAM_FINANCES ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[ 2 ], guiTITLEBARICONS, 5 ); + SetCurrentToLastProgramOpened( ); + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + case( LAPTOP_MODE_HISTORY ): + gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[4], guiTITLEBARICONS, 4 ); + SetCurrentToLastProgramOpened( ); + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + case( LAPTOP_MODE_PERSONNEL ): + gLaptopProgramStates[ LAPTOP_PROGRAM_PERSONNEL ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[3], guiTITLEBARICONS, 3 ); + SetCurrentToLastProgramOpened( ); + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + case( LAPTOP_MODE_NONE ): + // nothing + break; + default: + gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[ 7 ], guiTITLEBARICONS, 1 ); + SetCurrentToLastProgramOpened( ); + gfShowBookmarks = FALSE; + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + } + } + } +} + +INT32 FindLastProgramStillOpen( void ) +{ + INT32 iLowestValue = 6; + INT32 iLowestValueProgram = 6; + INT32 iCounter =0; + + // returns ID of last program open and not minimized + for( iCounter = 0; iCounter < 6; iCounter++ ) + { + if( gLaptopProgramStates[ iCounter ] != LAPTOP_PROGRAM_MINIMIZED ) + { + if( gLaptopProgramQueueList[ iCounter ] < iLowestValue ) + { + iLowestValue = gLaptopProgramQueueList[ iCounter ]; + iLowestValueProgram = iCounter; + } + } + } + + return ( iLowestValueProgram ); +} + +void UpdateListToReflectNewProgramOpened( INT32 iOpenedProgram ) +{ + INT32 iCounter = 0; + + // will update queue of opened programs to show thier states + // set iOpenedProgram to 1, and update others + + // increment everyone + for( iCounter = 0; iCounter < 6; iCounter++ ) + { + gLaptopProgramQueueList[ iCounter ]++; + } + + gLaptopProgramQueueList[ iOpenedProgram ] = 1; + + return; +} + + +void InitLaptopOpenQueue( void ) +{ + + INT32 iCounter = 0; + + // set evereyone to 1 + for( iCounter = 0; iCounter < 6; iCounter++ ) + { + gLaptopProgramQueueList[ iCounter ] = 1; + } + + return; +} + +void SetCurrentToLastProgramOpened( void ) +{ + guiCurrentLaptopMode = LAPTOP_MODE_NONE; + + switch( FindLastProgramStillOpen( ) ) + { + case(LAPTOP_PROGRAM_HISTORY ): + guiCurrentLaptopMode = LAPTOP_MODE_HISTORY; + break; + case( LAPTOP_PROGRAM_MAILER ): + guiCurrentLaptopMode = LAPTOP_MODE_EMAIL; + break; + case( LAPTOP_PROGRAM_PERSONNEL ): + guiCurrentLaptopMode = LAPTOP_MODE_PERSONNEL; + break; + case( LAPTOP_PROGRAM_FINANCES ): + guiCurrentLaptopMode = LAPTOP_MODE_FINANCES; + break; + case( LAPTOP_PROGRAM_FILES ): + guiCurrentLaptopMode = LAPTOP_MODE_FILES; + break; + case( LAPTOP_PROGRAM_WEB_BROWSER ): + // last www mode + if( guiCurrentWWWMode != 0 ) + { + guiCurrentLaptopMode = guiCurrentWWWMode; + } + else + { + guiCurrentLaptopMode = LAPTOP_MODE_WWW; + } + //gfShowBookmarks = TRUE; + fShowBookmarkInfo = TRUE; + break; + } + + + +} + + +void BlitTitleBarIcons( void ) +{ + + HVOBJECT hHandle; + // will blit the icons for the title bar of the program we are in + switch( guiCurrentLaptopMode ) + { + case( LAPTOP_MODE_HISTORY ): + GetVideoObject(&hHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hHandle, 4,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + break; + case( LAPTOP_MODE_EMAIL ): + GetVideoObject(&hHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hHandle, 0,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + break; + case( LAPTOP_MODE_PERSONNEL ): + GetVideoObject(&hHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hHandle, 3,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + break; + case( LAPTOP_MODE_FINANCES ): + GetVideoObject(&hHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hHandle, 5,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + break; + case( LAPTOP_MODE_FILES ): + GetVideoObject(&hHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hHandle, 2,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + break; + case( LAPTOP_MODE_NONE ): + // do nothing + break; + default: + // www pages + GetVideoObject(&hHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hHandle, 1,LAPTOP_TITLE_ICONS_X, LAPTOP_TITLE_ICONS_Y, VO_BLT_SRCTRANSPARENCY,NULL); + break; + + } +} + + +BOOLEAN DrawDeskTopBackground( void ) +{ + HVSURFACE hSrcVSurface; + UINT32 uiDestPitchBYTES; + UINT32 uiSrcPitchBYTES; + UINT16 *pDestBuf; + UINT8 *pSrcBuf; + SGPRect clip; + + // set clipping region + // WANNE (if i change this values to SCREEN_WIDTH, ... than an exception is thrown in the vobject_blitters.cpp) + // -> no changes to clip structure + clip.iLeft = 0; + clip.iRight = 506; + clip.iTop = 0; + clip.iBottom = 427; + + + // get surfaces + pDestBuf = (UINT16*)LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES); + CHECKF( GetVideoSurface( &hSrcVSurface, guiDESKTOP) ); + pSrcBuf = LockVideoSurface( guiDESKTOP, &uiSrcPitchBYTES); + + + // blit .pcx for the background onto desktop + Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf,uiSrcPitchBYTES, LAPTOP_SCREEN_UL_X - 2, LAPTOP_SCREEN_UL_Y - 3, &clip); + + + // release surfaces + UnLockVideoSurface( guiDESKTOP ); + UnLockVideoSurface( FRAME_BUFFER ); + + return ( TRUE ); +} + + +BOOLEAN LoadDesktopBackground( void ) +{ + // load desktop background + VSURFACE_DESC vs_desc; + + vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; + GetMLGFilename( vs_desc.ImageFile, MLG_DESKTOP ); + CHECKF(AddVideoSurface(&vs_desc, &guiDESKTOP)); + + + return( TRUE ); +} + +void DeleteDesktopBackground( void ) +{ + // delete desktop + + DeleteVideoSurfaceFromIndex(guiDESKTOP); + return; +} + + +void PrintBalance( void ) +{ + CHAR16 pString[ 32 ]; +// UINT16 usX, usY; + + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); + SetFontShadow( NO_SHADOW ); + + swprintf(pString, L"%d", LaptopSaveInfo.iCurrentBalance); + InsertCommasForDollarFigure( pString ); + InsertDollarSignInToString( pString ); + + if( ButtonList[ gLaptopButton[ 5 ] ]->uiFlags & BUTTON_CLICKED_ON ) + { + mprintf(iScreenWidthOffset + 48, iScreenHeightOffset + 273,pString); + } + else + { + mprintf(iScreenWidthOffset + 47, iScreenHeightOffset + 272,pString); + } + + + SetFontShadow( DEFAULT_SHADOW ); +} + + +void PrintNumberOnTeam( void ) +{ + CHAR16 pString[ 32 ]; + SOLDIERTYPE *pSoldier, *pTeamSoldier; + INT32 cnt=0; + INT32 iCounter=0; + UINT16 usPosX, usPosY, usFontHeight, usStrLength; + + + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); + SetFontShadow( NO_SHADOW ); + + // grab number on team + pSoldier = MercPtrs[0]; + + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pTeamSoldier++) + { + pTeamSoldier = MercPtrs[ cnt ]; + + if( ( pTeamSoldier->bActive)&&( !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) ) + { + iCounter++; + } + } + + + swprintf( pString, L"%s %d",pPersonnelString[ 0 ], iCounter ); + + usFontHeight = GetFontHeight( FONT10ARIAL ); + usStrLength = StringPixLength( pString, FONT10ARIAL ); + + if( ButtonList[ gLaptopButton[ 3 ] ]->uiFlags & BUTTON_CLICKED_ON ) + { + usPosX = iScreenWidthOffset + 48; + usPosY = iScreenHeightOffset + 225; + } + else + { + usPosX = iScreenWidthOffset + 47; + usPosY = iScreenHeightOffset + 224; + } + + mprintf( usPosX, usPosY, pString); + + SetFontShadow( DEFAULT_SHADOW ); +} + +void PrintDate( void ) +{ + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_BLACK ); + SetFontBackground( FONT_BLACK ); + + SetFontShadow( NO_SHADOW ); + + mprintf( iScreenWidthOffset + 30 + (70 - StringPixLength( WORLDTIMESTR, FONT10ARIAL ))/2, iScreenHeightOffset + 433, WORLDTIMESTR ); + + SetFontShadow( DEFAULT_SHADOW ); + + return; +} + + +void DisplayTaskBarIcons() +{ + HVOBJECT hPixHandle; + + GetVideoObject(&hPixHandle, guiTITLEBARICONS); + + if( fNewFilesInFileViewer ) + { + //display the files icon, if there is any + BltVideoObject(FRAME_BUFFER, hPixHandle, 7,LAPTOP__NEW_FILE_ICON_X, LAPTOP__NEW_FILE_ICON_Y, VO_BLT_SRCTRANSPARENCY,NULL); + } + + //display the email icon, if there is email + if( fUnReadMailFlag ) + { + BltVideoObject(FRAME_BUFFER, hPixHandle, 6, LAPTOP__NEW_EMAIL_ICON_X, LAPTOP__NEW_EMAIL_ICON_Y, VO_BLT_SRCTRANSPARENCY,NULL); + } +} + + +void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 usKeyState ) +{ + + // will handle keyboard shortcuts for the laptop ... to be added to later + + if( ( fExitingLaptopFlag == TRUE )||( fTabHandled ) ) + { + return; + } + + if ( (usEvent == KEY_DOWN ) && (usParam == ESC ) ) + { + // esc hit, check to see if boomark list is shown, if so, get rid of it, otherwise, leave + HandleLapTopESCKey( ); + } + else if( (usEvent == KEY_DOWN ) && ( usParam == TAB ) ) + { + if(usKeyState & CTRL_DOWN ) + { + HandleShiftAltTabKeyInLaptop( ); + } + else + { + HandleAltTabKeyInLaptop( ); + } + + fTabHandled = TRUE; + } + +#ifdef JA2TESTVERSION + + else if ((usEvent == KEY_DOWN )&& ( usParam == 'm' ) ) + { + if( ( usKeyState & ALT_DOWN ) ) + { + CheatToGetAll5Merc(); + } + } +#endif + + else if( (usEvent == KEY_DOWN )&& ( usParam == 'b' ) ) + { + if( CHEATER_CHEAT_LEVEL( ) ) + { + if( ( usKeyState & ALT_DOWN ) ) + LaptopSaveInfo.fBobbyRSiteCanBeAccessed = TRUE; + else if( usKeyState & CTRL_DOWN ) + { + guiCurrentLaptopMode = LAPTOP_MODE_BROKEN_LINK; + } + } + } + + else if ((usEvent == KEY_DOWN )&& ( usParam == 'x' ) ) + { + if( ( usKeyState & ALT_DOWN ) ) + { + HandleShortCutExitState( ); + } + //LeaveLapTopScreen( ); + } +#ifdef JA2TESTVERSION + else if ((usEvent == KEY_DOWN )&& ( usParam == 'q' )) + { + //if we dont currently have mercs on the team, hire some + if( NumberOfMercsOnPlayerTeam() == 0 ) + { + UINT8 ubRand = (UINT8) Random( 2 ) + 2; + TempHiringOfMercs( ubRand, FALSE ); + // QuickStartGame( ); + } + MarkButtonsDirty( ); + fExitingLaptopFlag = TRUE; + } + else if ((usEvent == KEY_DOWN )&& ( usParam == 's' )) + { + if( ( usKeyState & ALT_DOWN ) ) + { + SetBookMark( AIM_BOOKMARK ); + SetBookMark( BOBBYR_BOOKMARK ); + SetBookMark( IMP_BOOKMARK ); + SetBookMark( MERC_BOOKMARK ); + SetBookMark( FUNERAL_BOOKMARK ); + SetBookMark( FLORIST_BOOKMARK ); + SetBookMark( INSURANCE_BOOKMARK ); + } + } + + //help screen stuff + else +#endif + if( (usEvent == KEY_DOWN ) && ( ( usParam == 'h' ) || ( usParam == 'H' ) ) ) + { + ShouldTheHelpScreenComeUp( HELP_SCREEN_LAPTOP, TRUE ); + } + + +#if defined ( JA2TESTVERSION ) + else if ((usEvent == KEY_DOWN )&& ( usParam == 'w' )) + { + DemoHiringOfMercs( ); + } +#endif + +#ifdef JA2BETAVERSION + //adding all emails + else if ((usEvent == KEY_DOWN )&& ( usParam == 'e' )) + { + if( CHEATER_CHEAT_LEVEL( ) ) + { + if( ( usKeyState & ALT_DOWN ) ) + { + AddAllEmails(); + } + } + } +#endif + + //adding money + else if ((usEvent == KEY_DOWN )&& ( usParam == '=' )) + { + if( CHEATER_CHEAT_LEVEL( ) ) + { + AddTransactionToPlayersBook( ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), 100000 ); + MarkButtonsDirty( ); + } + } + + //subtracting money + else if( (usEvent == KEY_DOWN ) && ( usParam == '-' ) ) + { + if( CHEATER_CHEAT_LEVEL( ) ) + { + AddTransactionToPlayersBook( ANONYMOUS_DEPOSIT, 0, GetWorldTotalMin(), -10000 ); + MarkButtonsDirty( ); + } + } + + +#ifdef JA2TESTVERSION + else if ((usEvent == KEY_DOWN )&& ( usParam == 'd' )) + { + if( gfTemporaryDisablingOfLoadPendingFlag ) + gfTemporaryDisablingOfLoadPendingFlag = FALSE; + else + gfTemporaryDisablingOfLoadPendingFlag = TRUE; + } + else if ((usEvent == KEY_DOWN ) && ( usParam == '+' )) + { + if( usKeyState & ALT_DOWN ) + { + gStrategicStatus.ubHighestProgress += 10; + if (gStrategicStatus.ubHighestProgress > 100) + gStrategicStatus.ubHighestProgress = 100; + + InitAllArmsDealers(); + InitBobbyRayInventory(); + } + } + else if ((usEvent == KEY_DOWN ) && ( usParam == '-' )) + { + if( usKeyState & ALT_DOWN ) + { + if (gStrategicStatus.ubHighestProgress >= 10) + gStrategicStatus.ubHighestProgress -= 10; + else + gStrategicStatus.ubHighestProgress = 0; + + InitAllArmsDealers(); + InitBobbyRayInventory(); + } + } + else if ((usEvent == KEY_DOWN ) && ( usParam == '*' )) + { + if( usKeyState & ALT_DOWN ) + { + DeleteAllStrategicEventsOfType( EVENT_EVALUATE_QUEEN_SITUATION ); + AdvanceToNextDay(); + } + } + else if( usEvent == KEY_DOWN && usParam == 'v' && usKeyState & CTRL_DOWN ) + { + #ifdef SGP_VIDEO_DEBUGGING + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VObjects: %d", guiVObjectSize ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"VSurfaces: %d", guiVSurfaceSize ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"SGPVideoDump.txt updated..." ); + PerformVideoInfoDumpIntoFile( "SGPVideoDump.txt", TRUE ); + #endif + } + else + { + if ((usEvent == KEY_DOWN )&& ( usParam == '1' )) + { + TempHiringOfMercs( 1, FALSE ); + } + + if ((usEvent == KEY_DOWN )&& ( usParam == '2' )) + { + TempHiringOfMercs( 2, FALSE ); + } + + if ((usEvent == KEY_DOWN )&& ( usParam == '3' )) + { + TempHiringOfMercs( 3, FALSE ); + } + + if ((usEvent == KEY_DOWN )&& ( usParam == '4' )) + { + TempHiringOfMercs( 4, FALSE ); + } + + if ((usEvent == KEY_DOWN )&& ( usParam == '5' )) + { + TempHiringOfMercs( 5, FALSE ); + } + + if ((usEvent == KEY_DOWN )&& ( usParam == '6' )) + { + TempHiringOfMercs( 6, FALSE ); + } + + if ((usEvent == KEY_DOWN )&& ( usParam == '7' )) + { + TempHiringOfMercs( 7, FALSE ); + } + + if ((usEvent == KEY_DOWN )&& ( usParam == '8' )) + { + TempHiringOfMercs( 8, FALSE); + } + + if ((usEvent == KEY_DOWN )&& ( usParam == '9' )) + { + TempHiringOfMercs( 9, FALSE ); + } + + if ((usEvent == KEY_DOWN )&& ( usParam == '0' )) + { + TempHiringOfMercs( 10, FALSE ); + } + } +#endif + + return; +} + + +BOOLEAN RenderWWWProgramTitleBar( void ) +{ + // will render the title bar for the www program + UINT32 uiTITLEFORWWW; + HVOBJECT hHandle; + VOBJECT_DESC VObjectDesc; + INT32 iIndex = 0; + CHAR16 sString[256]; + + // title bar - load + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiTITLEFORWWW)); + + // blit title + GetVideoObject(&hHandle, uiTITLEFORWWW); + BltVideoObject( FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y - 2, VO_BLT_SRCTRANSPARENCY,NULL ); + + + // now delete + DeleteVideoObjectFromIndex( uiTITLEFORWWW ); + + // now slapdown text + SetFont( FONT14ARIAL ); + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + + // display title + + // no page loaded yet, do not handle yet + + + if( guiCurrentLaptopMode == LAPTOP_MODE_WWW ) + { + mprintf(iScreenWidthOffset + 140 , iScreenHeightOffset + 33 ,pWebTitle[0]); + } + + else + { + iIndex = guiCurrentLaptopMode - LAPTOP_MODE_WWW-1; + + swprintf( sString, L"%s - %s", pWebTitle[0], pWebPagesTitles[ iIndex ] ); + mprintf(iScreenWidthOffset + 140 ,iScreenHeightOffset + 33 ,sString); + } + + + + + BlitTitleBarIcons( ); + + DisplayProgramBoundingBox( FALSE ); + + //InvalidateRegion( 0, 0, 640, 480 ); + return( TRUE ); +} + + +void HandleDefaultWebpageForLaptop( void ) +{ + + // go to first page in bookmark list + if( guiCurrentLaptopMode == LAPTOP_MODE_WWW ) + { + // if valid entry go there + if( LaptopSaveInfo.iBookMarkList[ 0 ] != -1 ) + { + GoToWebPage( LaptopSaveInfo.iBookMarkList[ 0 ] ); + } + } + + return; +} + + +void CreateMinimizeRegionsForLaptopProgramIcons( void ) +{ + // will create the minizing region to lie over the icon for this particular laptop program + + MSYS_DefineRegion( &gLapTopProgramMinIcon,LAPTOP_PROGRAM_ICON_X, LAPTOP_PROGRAM_ICON_Y ,LAPTOP_PROGRAM_ICON_X + LAPTOP_PROGRAM_ICON_WIDTH ,LAPTOP_PROGRAM_ICON_Y + LAPTOP_PROGRAM_ICON_HEIGHT, MSYS_PRIORITY_NORMAL+1, + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, LaptopProgramIconMinimizeCallback ); + + return; +} + + +void DestroyMinimizeRegionsForLaptopProgramIcons( void ) +{ + // will destroy the minizmize regions to be placed over the laptop icons that will be + // displayed on the top of the laptop program bar + + MSYS_RemoveRegion( &gLapTopProgramMinIcon); + + return; +} + + +void LaptopProgramIconMinimizeCallback( MOUSE_REGION * pRegion, INT32 iReason ) +{ + // callback handler for the minize region that is attatched to the laptop program icon + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + switch( guiCurrentLaptopMode ) + { + case( LAPTOP_MODE_EMAIL ): + gLaptopProgramStates[ LAPTOP_PROGRAM_MAILER ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[0], guiTITLEBARICONS, 0 ); + SetCurrentToLastProgramOpened( ); + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + case( LAPTOP_MODE_FILES ): + gLaptopProgramStates[ LAPTOP_PROGRAM_FILES ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[5], guiTITLEBARICONS, 2 ); + SetCurrentToLastProgramOpened( ); + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + case( LAPTOP_MODE_FINANCES ): + gLaptopProgramStates[ LAPTOP_PROGRAM_FINANCES ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[2], guiTITLEBARICONS, 5 ); + SetCurrentToLastProgramOpened( ); + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + case( LAPTOP_MODE_HISTORY ): + gLaptopProgramStates[ LAPTOP_PROGRAM_HISTORY ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[4], guiTITLEBARICONS, 4 ); + SetCurrentToLastProgramOpened( ); + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + case( LAPTOP_MODE_PERSONNEL ): + gLaptopProgramStates[ LAPTOP_PROGRAM_PERSONNEL ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pLaptopIcons[3], guiTITLEBARICONS, 3 ); + SetCurrentToLastProgramOpened( ); + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + case( LAPTOP_MODE_NONE ): + // nothing + break; + default: + gLaptopProgramStates[ LAPTOP_PROGRAM_WEB_BROWSER ] = LAPTOP_PROGRAM_MINIMIZED; + InitTitleBarMaximizeGraphics(guiTITLEBARLAPTOP, pWebTitle[ 0 ], guiTITLEBARICONS, 1 ); + SetCurrentToLastProgramOpened( ); + gfShowBookmarks = FALSE; + fShowBookmarkInfo = FALSE; + fMinizingProgram = TRUE; + fInitTitle = TRUE; + break; + } + } + return; +} + + +void DisplayProgramBoundingBox( BOOLEAN fMarkButtons ) +{ + // the border fot eh program + HVOBJECT hHandle; + + GetVideoObject(&hHandle, guiLaptopBACKGROUND); + BltVideoObject(FRAME_BUFFER, hHandle, 1, iScreenWidthOffset + 25, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); + +// no laptop mode, no border around the program + if( guiCurrentLaptopMode != LAPTOP_MODE_NONE ) + { + GetVideoObject(&hHandle, guiLaptopBACKGROUND); + BltVideoObject(FRAME_BUFFER, hHandle, 0, iScreenWidthOffset + 108, iScreenHeightOffset + 23, VO_BLT_SRCTRANSPARENCY,NULL); + } + + if( fMarkButtons || fLoadPendingFlag ) + { + MarkButtonsDirty( ); + RenderButtons( ); + } + + + PrintDate( ); + + PrintBalance( ); + + PrintNumberOnTeam( ); + + // new files or email? + DisplayTaskBarIcons( ); + + return; +} + + +void CreateDestroyMouseRegionForNewMailIcon( void ) +{ + static BOOLEAN fCreated = FALSE; + + //. will toggle creation/destruction of the mouse regions used by the new mail icon + + if( fCreated == FALSE ) + { + fCreated = TRUE; + MSYS_DefineRegion(&gNewMailIconRegion, LAPTOP__NEW_EMAIL_ICON_X, LAPTOP__NEW_EMAIL_ICON_Y + 5, LAPTOP__NEW_EMAIL_ICON_X+16, LAPTOP__NEW_EMAIL_ICON_Y + 16, + MSYS_PRIORITY_HIGHEST - 3 , CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, NewEmailIconCallback); + CreateFileAndNewEmailIconFastHelpText( LAPTOP_BN_HLP_TXT_YOU_HAVE_NEW_MAIL, (BOOLEAN)(fUnReadMailFlag == 0 ) ); + + MSYS_DefineRegion(&gNewFileIconRegion, LAPTOP__NEW_FILE_ICON_X, LAPTOP__NEW_FILE_ICON_Y + 5, LAPTOP__NEW_FILE_ICON_X + 16, LAPTOP__NEW_FILE_ICON_Y + 16, + MSYS_PRIORITY_HIGHEST - 3 , CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, NewFileIconCallback); + CreateFileAndNewEmailIconFastHelpText( LAPTOP_BN_HLP_TXT_YOU_HAVE_NEW_FILE, (BOOLEAN)( fNewFilesInFileViewer == 0 ) ); + } + else + { + fCreated = FALSE; + MSYS_RemoveRegion( &gNewMailIconRegion ); + MSYS_RemoveRegion( &gNewFileIconRegion ); + } +} + + +void NewEmailIconCallback( MOUSE_REGION * pRegion, INT32 iReason ) +{ + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( fUnReadMailFlag ) + { + fOpenMostRecentUnReadFlag = TRUE; + guiCurrentLaptopMode = LAPTOP_MODE_EMAIL; + } + } + +} + + +void NewFileIconCallback( MOUSE_REGION * pRegion, INT32 iReason ) +{ + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if( fNewFilesInFileViewer ) + { + fEnteredFileViewerFromNewFileIcon = TRUE; + guiCurrentLaptopMode = LAPTOP_MODE_FILES; + } + } + +} + +void HandleWWWSubSites( void ) +{ + // check to see if WW Wait is needed for a sub site within the Web Browser + + if( (guiCurrentLaptopMode == guiPreviousLaptopMode )||( guiCurrentLaptopMode < LAPTOP_MODE_WWW) ||( fLoadPendingFlag == TRUE ) ||( fDoneLoadPending == TRUE ) || ( guiPreviousLaptopMode < LAPTOP_MODE_WWW ) ) + { + // no go, leave + return; + } + + fLoadPendingFlag = TRUE; + fConnectingToSubPage = TRUE; + + // fast or slow load? + if( gfWWWaitSubSitesVisitedFlags[ guiCurrentLaptopMode - ( LAPTOP_MODE_WWW + 1 ) ] == TRUE ) + { + fFastLoadFlag = TRUE; + } + + // set fact we were here + gfWWWaitSubSitesVisitedFlags[ guiCurrentLaptopMode - ( LAPTOP_MODE_WWW + 1 ) ] = TRUE; + + //Dont show the dlownload screen when switching between these pages + if( ( guiCurrentLaptopMode == LAPTOP_MODE_AIM_MEMBERS ) && ( guiPreviousLaptopMode == LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX ) || + ( guiCurrentLaptopMode == LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX ) && ( guiPreviousLaptopMode == LAPTOP_MODE_AIM_MEMBERS ) ) + { + fFastLoadFlag = FALSE; + fLoadPendingFlag = FALSE; + + // set fact we were here + gfWWWaitSubSitesVisitedFlags[ LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX - ( LAPTOP_MODE_WWW + 1 ) ] = TRUE; + gfWWWaitSubSitesVisitedFlags[ LAPTOP_MODE_AIM_MEMBERS - ( LAPTOP_MODE_WWW + 1 ) ] = TRUE; + } + + return; +} + + +void UpdateStatusOfDisplayingBookMarks( void ) +{ + // this function will disable showing of bookmarks if in process of download or if we miniming web browser + if( ( fLoadPendingFlag == TRUE ) || ( guiCurrentLaptopMode < LAPTOP_MODE_WWW ) ) + { + gfShowBookmarks = FALSE; + } + + return; +} + + +void InitalizeSubSitesList( void ) +{ + INT32 iCounter = 0; + + // init all subsites list to not visited + for( iCounter = LAPTOP_MODE_WWW + 1 ; iCounter <= LAPTOP_MODE_SIRTECH; iCounter++ ) + { + gfWWWaitSubSitesVisitedFlags[ iCounter - ( LAPTOP_MODE_WWW + 1 ) ] = FALSE; + } + return; +} + + +void SetSubSiteAsVisted( void ) +{ + // sets a www sub site as visited + if( guiCurrentLaptopMode <= LAPTOP_MODE_WWW ) + { + // not at a web page yet + } + else + { + gfWWWaitSubSitesVisitedFlags[ guiCurrentLaptopMode - ( LAPTOP_MODE_WWW + 1 ) ] = TRUE; + } + +} + + +void HandleShiftAltTabKeyInLaptop( void ) +{ + // will handle the alt tab keying in laptop + + // move to next program + if( fMaximizingProgram == TRUE ) + { + return; + } + + switch( guiCurrentLaptopMode ) + { + case( LAPTOP_MODE_FINANCES ): + guiCurrentLaptopMode = LAPTOP_MODE_PERSONNEL; + break; + case( LAPTOP_MODE_PERSONNEL ): + guiCurrentLaptopMode = LAPTOP_MODE_HISTORY; + break; + case( LAPTOP_MODE_HISTORY ): + guiCurrentLaptopMode = LAPTOP_MODE_FILES; + break; + case( LAPTOP_MODE_EMAIL ): + guiCurrentLaptopMode = LAPTOP_MODE_FINANCES; + break; + case( LAPTOP_MODE_FILES ): + guiCurrentLaptopMode = LAPTOP_MODE_WWW; + break; + case( LAPTOP_MODE_NONE ): + guiCurrentLaptopMode = LAPTOP_MODE_FINANCES; + break; + case( LAPTOP_MODE_WWW ): + guiCurrentLaptopMode = LAPTOP_MODE_EMAIL; + break; + default: + guiCurrentLaptopMode = LAPTOP_MODE_EMAIL; + break; + } + + fPausedReDrawScreenFlag = TRUE; +} + + +void HandleAltTabKeyInLaptop( void ) +{ + // will handle the alt tab keying in laptop + + // move to next program + // move to next program + if( fMaximizingProgram == TRUE ) + { + return; + } + + switch( guiCurrentLaptopMode ) + { + case( LAPTOP_MODE_FINANCES ): + guiCurrentLaptopMode = LAPTOP_MODE_EMAIL; + break; + case( LAPTOP_MODE_PERSONNEL ): + guiCurrentLaptopMode = LAPTOP_MODE_FINANCES; + break; + + case( LAPTOP_MODE_HISTORY ): + guiCurrentLaptopMode = LAPTOP_MODE_PERSONNEL; + break; + case( LAPTOP_MODE_EMAIL ): + guiCurrentLaptopMode = LAPTOP_MODE_WWW; + break; + case( LAPTOP_MODE_FILES ): + guiCurrentLaptopMode = LAPTOP_MODE_HISTORY; + break; + case( LAPTOP_MODE_NONE ): + guiCurrentLaptopMode = LAPTOP_MODE_EMAIL; + break; + default: + guiCurrentLaptopMode = LAPTOP_MODE_FILES; + break; + } + + fPausedReDrawScreenFlag = TRUE; +} + + + +// display the 2 second book mark instruction +void DisplayWebBookMarkNotify( void ) +{ + static BOOLEAN fOldShow = FALSE; + HVOBJECT hLapTopIconHandle; + + + // handle the timer for this thing + HandleWebBookMarkNotifyTimer( ); + + // are we about to start showing box? or did we just stop? + if( ( ( fOldShow == FALSE )||( fReDrawBookMarkInfo ) ) && ( fShowBookmarkInfo == TRUE ) ) + { + fOldShow = TRUE; + fReDrawBookMarkInfo = FALSE; + + // show background objects + GetVideoObject(&hLapTopIconHandle, guiDOWNLOADTOP); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiDOWNLOADMID); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y+DOWN_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiDOWNLOADBOT); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 0,DOWNLOAD_X, DOWNLOAD_Y+2*DOWN_HEIGHT, VO_BLT_SRCTRANSPARENCY,NULL); + GetVideoObject(&hLapTopIconHandle, guiTITLEBARICONS); + BltVideoObject(FRAME_BUFFER, hLapTopIconHandle, 1,DOWNLOAD_X + 4, DOWNLOAD_Y + 1, VO_BLT_SRCTRANSPARENCY,NULL); + + // font stuff + SetFont(DOWNLOAD_FONT); + SetFontForeground(FONT_WHITE); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // display download string + mprintf( DOWN_STRING_X, DOWN_STRING_Y, pShowBookmarkString[ 0 ]); + + SetFont(BOOK_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // now draw the message + DisplayWrappedString(( INT16 )( DOWN_STRING_X - 42 ),(UINT16)(DOWN_STRING_Y + 20), BOOK_WIDTH + 45, 2,BOOK_FONT,FONT_BLACK, pShowBookmarkString[ 1 ],FONT_BLACK,FALSE,CENTER_JUSTIFIED); + + // invalidate region + InvalidateRegion(DOWNLOAD_X, DOWNLOAD_Y, DOWNLOAD_X + 150, DOWNLOAD_Y + 100); + + } + else if( ( fOldShow == TRUE ) && ( fShowBookmarkInfo == FALSE ) ) + { + //MSYS_RemoveRegion( &gLapTopScreenRegion ); + fOldShow = FALSE; + fPausedReDrawScreenFlag = TRUE; + } + + SetFontShadow(DEFAULT_SHADOW); + + return; +} + +void HandleWebBookMarkNotifyTimer( void ) +{ + static INT32 iBaseTime = 0; + INT32 iDifference = 0; + static BOOLEAN fOldShowBookMarkInfo = FALSE; + + + // check if maxing or mining? + if( ( fMaximizingProgram == TRUE ) || ( fMinizingProgram == TRUE ) ) + { + fOldShowBookMarkInfo |= fShowBookmarkInfo; + fShowBookmarkInfo = FALSE; + return; + } + + // if we were going to show this pop up, but were delayed, then do so now + fShowBookmarkInfo |= fOldShowBookMarkInfo; + + // reset old flag + fOldShowBookMarkInfo = FALSE; + + // if current mode is too low, then reset + if( guiCurrentLaptopMode < LAPTOP_MODE_WWW ) + { + fShowBookmarkInfo = FALSE; + } + + // if showing bookmarks, don't show help + if( gfShowBookmarks == TRUE ) + { + fShowBookmarkInfo = FALSE; + } + + // check if flag false, is so, leave + if( fShowBookmarkInfo == FALSE ) + { + iBaseTime = 0; + return; + } + + + // check if this is the first time in here + if( iBaseTime == 0 ) + { + iBaseTime = GetJA2Clock( ); + return; + } + + iDifference = GetJA2Clock( ) - iBaseTime; + + fReDrawBookMarkInfo = TRUE; + + if( iDifference > DISPLAY_TIME_FOR_WEB_BOOKMARK_NOTIFY ) + { + // waited long enough, stop showing + iBaseTime = 0; + fShowBookmarkInfo = FALSE; + } + + return; +} + + +void ClearOutTempLaptopFiles( void ) +{ + // clear out all temp files from laptop + + // file file + if ( (FileExists( "files.dat" ) == TRUE ) ) + { + FileClearAttributes( "files.dat" ); + FileDelete( "files.dat" ); + } + + // finances + if ( (FileExists( "finances.dat" ) == TRUE ) ) + { + FileClearAttributes( "finances.dat" ); + FileDelete( "finances.dat" ); + } + + // email + if ( (FileExists( "email.dat" ) == TRUE ) ) + { + FileClearAttributes( "email.dat" ); + FileDelete( "email.dat" ); + } + + // history + if ( (FileExists( "history.dat" ) == TRUE ) ) + { + FileClearAttributes( "history.dat" ); + FileDelete( "history.dat" ); + } + +} + + +BOOLEAN SaveLaptopInfoToSavedGame( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten=0; + UINT32 uiSize; + + + // Save The laptop information + FileWrite( hFile, &LaptopSaveInfo, sizeof( LaptopSaveInfoStruct ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( LaptopSaveInfoStruct ) ) + { + return(FALSE); + } + + //If there is anything in the Bobby Ray Orders on Delivery + if( LaptopSaveInfo.usNumberOfBobbyRayOrderUsed ) + { + //Allocate memory for the information + uiSize = sizeof( BobbyRayOrderStruct ) * LaptopSaveInfo.usNumberOfBobbyRayOrderItems; + + // Load The laptop information + FileWrite( hFile, LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray, uiSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSize) + { + return(FALSE); + } + } + + + //If there is any Insurance Payouts in progress + if( LaptopSaveInfo.ubNumberLifeInsurancePayoutUsed ) + { + //Allocate memory for the information + uiSize = sizeof( LIFE_INSURANCE_PAYOUT ) * LaptopSaveInfo.ubNumberLifeInsurancePayouts; + + // Load The laptop information + FileWrite( hFile, LaptopSaveInfo.pLifeInsurancePayouts, uiSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSize ) + { + return(FALSE); + } + } + + return( TRUE ); +} + + + + +BOOLEAN LoadLaptopInfoFromSavedGame( HWFILE hFile ) +{ + UINT32 uiNumBytesRead=0; + UINT32 uiSize; + + + //if there is memory allocated for the BobbyR orders + if( LaptopSaveInfo.usNumberOfBobbyRayOrderItems ) + { + //Free the memory + if( LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray ) + MemFree( LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray ); + LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray = NULL; + } + + //if there is memory allocated for life insurance payouts + if( LaptopSaveInfo.ubNumberLifeInsurancePayouts ) + { + if( !LaptopSaveInfo.pLifeInsurancePayouts ) + Assert( 0 ); //Should never happen + + //Free the memory + MemFree( LaptopSaveInfo.pLifeInsurancePayouts ); + LaptopSaveInfo.pLifeInsurancePayouts = NULL; + } + + // Load The laptop information + FileRead( hFile, &LaptopSaveInfo, sizeof( LaptopSaveInfoStruct ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( LaptopSaveInfoStruct ) ) + { + return(FALSE); + } + + //If there is anything in the Bobby Ray Orders on Delivery + if( LaptopSaveInfo.usNumberOfBobbyRayOrderUsed ) + { + //Allocate memory for the information + uiSize = sizeof( BobbyRayOrderStruct ) * LaptopSaveInfo.usNumberOfBobbyRayOrderItems; + + LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray = (BobbyRayOrderStruct *) MemAlloc( uiSize ); + Assert( LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray ); + + // Load The laptop information + FileRead( hFile, LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray, uiSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiSize ) + { + return(FALSE); + } + } + else + { + LaptopSaveInfo.usNumberOfBobbyRayOrderItems = 0; + LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray = NULL; + } + + + //If there is any Insurance Payouts in progress + if( LaptopSaveInfo.ubNumberLifeInsurancePayoutUsed ) + { + //Allocate memory for the information + uiSize = sizeof( LIFE_INSURANCE_PAYOUT ) * LaptopSaveInfo.ubNumberLifeInsurancePayouts; + + LaptopSaveInfo.pLifeInsurancePayouts = (LIFE_INSURANCE_PAYOUT *) MemAlloc( uiSize ); + Assert( LaptopSaveInfo.pLifeInsurancePayouts ); + + // Load The laptop information + FileRead( hFile, LaptopSaveInfo.pLifeInsurancePayouts, uiSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiSize ) + { + return(FALSE); + } + } + else + { + LaptopSaveInfo.ubNumberLifeInsurancePayouts = 0; + LaptopSaveInfo.pLifeInsurancePayouts = NULL; + } + + + return( TRUE ); +} + +void LaptopSaveVariablesInit() +{ +} + + +INT32 WWaitDelayIncreasedIfRaining( INT32 iUnitTime ) +{ + INT32 iRetVal = 0; + + if( guiEnvWeather & WEATHER_FORECAST_THUNDERSHOWERS ) + { + iRetVal = (INT32)( iUnitTime * (FLOAT) 0.80 ); + } + else if( guiEnvWeather & WEATHER_FORECAST_SHOWERS ) + { + iRetVal = (INT32)( iUnitTime * (FLOAT) 0.6 ); + } + + return( iRetVal ); +} + + +BOOLEAN IsItRaining() +{ + if( guiEnvWeather & WEATHER_FORECAST_SHOWERS || guiEnvWeather & WEATHER_FORECAST_THUNDERSHOWERS ) + return( TRUE ); + else + return( FALSE ); +} + + +void InternetRainDelayMessageBoxCallBack( UINT8 bExitValue ) +{ + GoToWebPage( giRainDelayInternetSite ); + + //Set to -2 so we dont due the message for this occurence of laptop + giRainDelayInternetSite = -2; +} + + +void CreateBookMarkHelpText( MOUSE_REGION *pRegion, UINT32 uiBookMarkID ) +{ + SetRegionFastHelpText( pRegion, gzLaptopHelpText[ BOOKMARK_TEXT_ASSOCIATION_OF_INTERNATION_MERCENARIES + uiBookMarkID ] ); +} + +void CreateFileAndNewEmailIconFastHelpText( UINT32 uiHelpTextID, BOOLEAN fClearHelpText ) +{ + MOUSE_REGION *pRegion; + + switch( uiHelpTextID ) + { + case LAPTOP_BN_HLP_TXT_YOU_HAVE_NEW_MAIL: + pRegion = &gNewMailIconRegion; + break; + + case LAPTOP_BN_HLP_TXT_YOU_HAVE_NEW_FILE: + pRegion = &gNewFileIconRegion; + break; + + default: + Assert(0); + return; + } + + if( fClearHelpText ) + SetRegionFastHelpText( pRegion, L"" ); + else + SetRegionFastHelpText( pRegion, gzLaptopHelpText[ uiHelpTextID ] ); + + //fUnReadMailFlag + //fNewFilesInFileViewer +} + + +void CreateLaptopButtonHelpText( INT32 iButtonIndex, UINT32 uiButtonHelpTextID ) +{ + SetButtonFastHelpText( iButtonIndex, gzLaptopHelpText[ uiButtonHelpTextID ] ); +} + + + + + + + + diff --git a/Laptop/laptop.h b/Laptop/laptop.h new file mode 100644 index 00000000..8c530862 --- /dev/null +++ b/Laptop/laptop.h @@ -0,0 +1,197 @@ +#ifndef __LAPTOP_H +#define __LAPTOP_H + +#include "types.h" +#include "sgp.h" +#include "Font Control.h" +#include "messageboxscreen.h" + + + + + +INT32 EnterLaptop(); +void ExitLaptop(); +void RenderLaptop(); +UINT32 ExitLaptopMode(UINT32 uiMode); +void EnterNewLaptopMode(); +UINT32 DrawLapTopIcons(); +UINT32 DrawLapTopText(); +void ReDrawHighLight(); +void DrawButtonText(); +void InitBookMarkList(); +void SetBookMark(INT32 iBookId); +void RemoveBookmark(INT32 iBookId); +BOOLEAN LeaveLapTopScreen( ); +void SetLaptopExitScreen( UINT32 uiExitScreen ); +void SetLaptopNewGameFlag( ); +UINT32 DrawLapTopIcons( ); +void LapTopScreenCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void HandleRightButtonUpEvent( void ); + +template +BOOLEAN DoLapTopMessageBox( UINT8 ubStyle, string2 zString, UINT32 uiExitScreen, UINT8 ubFlags, MSGBOX_CALLBACK ReturnCallback ); +void GoToWebPage(INT32 iPageId); +BOOLEAN WebPageTileBackground(UINT8 ubNumX, UINT8 ubNumY, UINT16 usWidth, UINT16 usHeight, UINT32 uiBackGround); +void BlitTitleBarIcons( void ); +void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 usKeyState ); +BOOLEAN RenderWWWProgramTitleBar( void ); +void DisplayProgramBoundingBox( BOOLEAN fMarkButtons ); +BOOLEAN DoLapTopSystemMessageBox( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); +BOOLEAN RemoveBookMark( INT32 iBookId ); +void CreateFileAndNewEmailIconFastHelpText( UINT32 uiHelpTextID, BOOLEAN fClearHelpText ); +BOOLEAN InitLaptopAndLaptopScreens(); + +// clear out all tempf iles from laptop +void ClearOutTempLaptopFiles( void ); + +void HaventMadeImpMercEmailCallBack(); + +extern UINT32 guiCurrentLaptopMode; +extern UINT32 guiPreviousLaptopMode; +extern INT32 giCurrentSubPage; +extern UINT32 guiCurrentLapTopCursor; +extern UINT32 guiPreviousLapTopCursor; +extern BOOLEAN fMarkButtonsDirtyFlag; +extern BOOLEAN fNotVistedImpYet; +extern BOOLEAN fReDrawScreenFlag; +extern BOOLEAN fPausedReDrawScreenFlag; +extern BOOLEAN fIntermediateReDrawFlag; +extern BOOLEAN fLoadPendingFlag; +extern BOOLEAN fEscKeyHandled; +extern BOOLEAN fReDrawPostButtonRender; +extern BOOLEAN fCurrentlyInLaptop; +//extern BOOLEAN gfNewGameLaptop; +extern UINT32 guiLaptopBACKGROUND; +extern UINT32 guiTITLEBARICONS; +extern BOOLEAN fDoneLoadPending; +extern BOOLEAN fReConnectingFlag; +extern BOOLEAN fConnectingToSubPage; +extern BOOLEAN fFastLoadFlag; +extern BOOLEAN gfShowBookmarks; +extern BOOLEAN fShowBookmarkInfo; +extern BOOLEAN fReDrawBookMarkInfo; + + +enum +{ + LAPTOP_MODE_NONE=0, + LAPTOP_MODE_FINANCES, + LAPTOP_MODE_PERSONNEL, + LAPTOP_MODE_HISTORY, + LAPTOP_MODE_FILES, + LAPTOP_MODE_FILES_ENRICO, + LAPTOP_MODE_FILES_PLANS, + LAPTOP_MODE_EMAIL, + LAPTOP_MODE_EMAIL_NEW, + LAPTOP_MODE_EMAIL_VIEW, + LAPTOP_MODE_WWW, + LAPTOP_MODE_AIM, + LAPTOP_MODE_AIM_MEMBERS, + LAPTOP_MODE_AIM_MEMBERS_FACIAL_INDEX, + LAPTOP_MODE_AIM_MEMBERS_SORTED_FILES, + LAPTOP_MODE_AIM_MEMBERS_SORTED_FILES_VIDEO, + LAPTOP_MODE_AIM_MEMBERS_ARCHIVES, + LAPTOP_MODE_AIM_POLICIES, + LAPTOP_MODE_AIM_HISTORY, + LAPTOP_MODE_AIM_LINKS, + LAPTOP_MODE_MERC, + LAPTOP_MODE_MERC_ACCOUNT, + LAPTOP_MODE_MERC_NO_ACCOUNT, + LAPTOP_MODE_MERC_FILES, + LAPTOP_MODE_BOBBY_R, + LAPTOP_MODE_BOBBY_R_GUNS, + LAPTOP_MODE_BOBBY_R_AMMO, + LAPTOP_MODE_BOBBY_R_ARMOR, + LAPTOP_MODE_BOBBY_R_MISC, + LAPTOP_MODE_BOBBY_R_USED, + LAPTOP_MODE_BOBBY_R_MAILORDER, + LAPTOP_MODE_CHAR_PROFILE, + LAPTOP_MODE_CHAR_PROFILE_QUESTIONAIRE, + LAPTOP_MODE_FLORIST, + LAPTOP_MODE_FLORIST_FLOWER_GALLERY, + LAPTOP_MODE_FLORIST_ORDERFORM, + LAPTOP_MODE_FLORIST_CARD_GALLERY, + LAPTOP_MODE_INSURANCE, + LAPTOP_MODE_INSURANCE_INFO, + LAPTOP_MODE_INSURANCE_CONTRACT, + LAPTOP_MODE_INSURANCE_COMMENTS, + LAPTOP_MODE_FUNERAL, + LAPTOP_MODE_SIRTECH, + LAPTOP_MODE_BROKEN_LINK, + LAPTOP_MODE_BOBBYR_SHIPMENTS, +}; + +// bookamrks for WWW bookmark list + + +enum{ + FIRST_SIDE_PANEL=1, + SECOND_SIDE_PANEL, +}; +enum{ + LAPTOP_NO_CURSOR=0, + LAPTOP_PANEL_CURSOR, + LAPTOP_SCREEN_CURSOR, + LAPTOP_WWW_CURSOR, +}; + +//#define LAPTOP_SIDE_PANEL_X 0 +//#define LAPTOP_SIDE_PANEL_Y 0 +//#define LAPTOP_SIDE_PANEL_WIDTH 640 +//#define LAPTOP_SIDE_PANEL_HEIGHT 480 +#define LAPTOP_X iScreenWidthOffset +#define LAPTOP_Y iScreenHeightOffset + + +#define LAPTOP_SCREEN_UL_X iScreenWidthOffset + 111 +#define LAPTOP_SCREEN_UL_Y iScreenHeightOffset + 27 + + +#define LAPTOP_SCREEN_LR_X iScreenWidthOffset + 613 +#define LAPTOP_SCREEN_LR_Y iScreenHeightOffset + 427 +#define LAPTOP_UL_X iScreenWidthOffset + 24 +#define LAPTOP_UL_Y iScreenHeightOffset + 27 + +#define LAPTOP_SCREEN_WIDTH LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X +#define LAPTOP_SCREEN_HEIGHT LAPTOP_SCREEN_LR_Y - LAPTOP_SCREEN_UL_Y + +// new positions for web browser +#define LAPTOP_SCREEN_WEB_UL_Y LAPTOP_SCREEN_UL_Y + 19 +#define LAPTOP_SCREEN_WEB_LR_Y LAPTOP_SCREEN_WEB_UL_Y + LAPTOP_SCREEN_HEIGHT +#define LAPTOP_SCREEN_WEB_DELTA_Y 19 //LAPTOP_SCREEN_WEB_UL_Y - LAPTOP_SCREEN_UL_Y + +// the laptop on/off button +#define ON_X iScreenWidthOffset + 113 +#define ON_Y iScreenHeightOffset + 445 + + +// the bookmark values, move cancel down as bookmarks added + +enum{ + AIM_BOOKMARK=0, + BOBBYR_BOOKMARK, + IMP_BOOKMARK, + MERC_BOOKMARK, + FUNERAL_BOOKMARK, + FLORIST_BOOKMARK, + INSURANCE_BOOKMARK, + CANCEL_STRING, +}; + + +extern UINT32 guiLaptopBACKGROUND; + + +#define DEAD_MERC_COLOR_RED 255 +#define DEAD_MERC_COLOR_GREEN 55 +#define DEAD_MERC_COLOR_BLUE 55 + + +#endif + + + + + + diff --git a/Laptop/mercs Account.cpp b/Laptop/mercs Account.cpp new file mode 100644 index 00000000..aace4ad1 --- /dev/null +++ b/Laptop/mercs Account.cpp @@ -0,0 +1,533 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "mercs Account.h" + #include "mercs.h" + #include "Utilities.h" + #include "WCheck.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Soldier Profile.h" + #include "finances.h" + #include "Game Clock.h" + #include "Soldier Add.h" + #include "Overhead.h" + #include "History.h" + #include "Email.h" + #include "LaptopSave.h" + #include "Text.h" + #include "Speck Quotes.h" +#endif + + + + +#define MERC_ACCOUNT_TEXT_FONT FONT14ARIAL +#define MERC_ACCOUNT_TEXT_COLOR FONT_MCOLOR_WHITE + +#define MERC_ACCOUNT_DYNAMIC_TEXT_FONT FONT12ARIAL +#define MERC_ACCOUNT_DYNAMIC_TEXT_COLOR FONT_MCOLOR_WHITE +#define MERC_ACCOUNT_DEAD_TEXT_COLOR FONT_MCOLOR_RED + +#define MERC_AC_ORDER_GRID_X LAPTOP_SCREEN_UL_X + 23 +#define MERC_AC_ORDER_GRID_Y LAPTOP_SCREEN_WEB_UL_Y + 59 + +#define MERC_AC_ACCOUNT_NUMBER_X LAPTOP_SCREEN_UL_X + 23 +#define MERC_AC_ACCOUNT_NUMBER_Y LAPTOP_SCREEN_WEB_UL_Y + 13 + +#define MERC_AC_AUTHORIZE_BUTTON_X iScreenWidthOffset + 128 +#define MERC_AC_AUTHORIZE_BUTTON_Y iScreenHeightOffset + 380 + +#define MERC_AC_CANCEL_BUTTON_X iScreenWidthOffset + 490 +#define MERC_AC_CANCEL_BUTTON_Y MERC_AC_AUTHORIZE_BUTTON_Y + +#define MERC_AC_ACCOUNT_NUMBER_TEXT_X MERC_AC_ACCOUNT_NUMBER_X + 5 +#define MERC_AC_ACCOUNT_NUMBER_TEXT_Y MERC_AC_ACCOUNT_NUMBER_Y + 12 + +#define MERC_AC_MERC_TITLE_Y MERC_AC_ORDER_GRID_Y + 14 +#define MERC_AC_TOTAL_COST_Y MERC_AC_ORDER_GRID_Y + 242 + +#define MERC_AC_FIRST_COLUMN_X MERC_AC_ORDER_GRID_X + 2 +#define MERC_AC_SECOND_COLUMN_X MERC_AC_ORDER_GRID_X + 222 +#define MERC_AC_THIRD_COLUMN_X MERC_AC_ORDER_GRID_X + 292 +#define MERC_AC_FOURTH_COLUMN_X MERC_AC_ORDER_GRID_X + 382 + +#define MERC_AC_FIRST_COLUMN_WIDTH 218 +#define MERC_AC_SECOND_COLUMN_WIDTH 68 +#define MERC_AC_THIRD_COLUMN_WIDTH 88 +#define MERC_AC_FOURTH_COLUMN_WIDTH 76 + +#define MERC_AC_FIRST_ROW_Y MERC_AC_ORDER_GRID_Y + 42 +#define MERC_AC_ROW_SIZE 16 + + + +UINT32 guiMercOrderGrid; +UINT32 guiAccountNumberGrid; + + +INT32 giMercTotalContractCharge; + +BOOLEAN gfMercPlayerDoesntHaveEnoughMoney_DisplayWarning = FALSE; + +// The Authorize button +void BtnMercAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiMercAuthorizeBoxButton; +INT32 guiMercAuthorizeButtonImage; + + +// The Back button +void BtnMercBackButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiMercBackBoxButton; + + + + +void DisplayHiredMercs(); +void SettleMercAccounts(); +void MercAuthorizePaymentMessageBoxCallBack( UINT8 bExitValue ); + + + +void GameInitMercsAccount() +{ + +} + +BOOLEAN EnterMercsAccount() +{ + VOBJECT_DESC VObjectDesc; + + InitMercBackGround(); + + // load the Arrow graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_ORDERGRID ); + CHECKF(AddVideoObject(&VObjectDesc, &guiMercOrderGrid)); + + // load the Arrow graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\AccountNumber.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiAccountNumberGrid)); + + + guiMercAuthorizeButtonImage = LoadButtonImage("LAPTOP\\BigButtons.sti", -1,0,-1,1,-1 ); + + guiMercAuthorizeBoxButton = CreateIconAndTextButton( guiMercAuthorizeButtonImage, MercAccountText[MERC_ACCOUNT_AUTHORIZE], + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_AC_AUTHORIZE_BUTTON_X, MERC_AC_AUTHORIZE_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnMercAuthorizeButtonCallback); + SetButtonCursor(guiMercAuthorizeBoxButton, CURSOR_LAPTOP_SCREEN); + SpecifyDisabledButtonStyle( guiMercAuthorizeBoxButton, DISABLED_STYLE_SHADED); + + guiMercBackBoxButton = CreateIconAndTextButton( guiMercAuthorizeButtonImage, MercAccountText[MERC_ACCOUNT_HOME], + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_AC_CANCEL_BUTTON_X, MERC_AC_CANCEL_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnMercBackButtonCallback); + SetButtonCursor(guiMercBackBoxButton, CURSOR_LAPTOP_SCREEN); + SpecifyDisabledButtonStyle( guiMercBackBoxButton, DISABLED_STYLE_SHADED); + + +// RenderMercsAccount(); + + //if true, will display a msgbox telling user that they dont have enough funds + gfMercPlayerDoesntHaveEnoughMoney_DisplayWarning = FALSE; + + return( TRUE ); +} + +void ExitMercsAccount() +{ + DeleteVideoObjectFromIndex(guiMercOrderGrid); + DeleteVideoObjectFromIndex(guiAccountNumberGrid); + + UnloadButtonImage( guiMercAuthorizeButtonImage ); + RemoveButton( guiMercAuthorizeBoxButton ); + RemoveButton( guiMercBackBoxButton ); + + RemoveMercBackGround(); +} + +void HandleMercsAccount() +{ + //if true, will display a msgbox telling user that they dont have enough funds + if( gfMercPlayerDoesntHaveEnoughMoney_DisplayWarning ) + { + gfMercPlayerDoesntHaveEnoughMoney_DisplayWarning = FALSE; + + DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, L"Transfer failed. No funds available.", LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL ); + } +} + +void RenderMercsAccount() +{ + wchar_t sText[100]; + HVOBJECT hPixHandle; + + DrawMecBackGround(); + + // Account Number Grid + GetVideoObject(&hPixHandle, guiMercOrderGrid); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,MERC_AC_ORDER_GRID_X, MERC_AC_ORDER_GRID_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // Merc Order Grid + GetVideoObject(&hPixHandle, guiAccountNumberGrid); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,MERC_AC_ACCOUNT_NUMBER_X, MERC_AC_ACCOUNT_NUMBER_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //Display Players account number + swprintf(sText, L"%s %05d", MercAccountText[MERC_ACCOUNT_ACCOUNT], LaptopSaveInfo.guiPlayersMercAccountNumber); + DrawTextToScreen( sText, MERC_AC_ACCOUNT_NUMBER_TEXT_X, MERC_AC_ACCOUNT_NUMBER_TEXT_Y, 0, MERC_ACCOUNT_TEXT_FONT, MERC_ACCOUNT_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + //Display the order grid titles + DrawTextToScreen( MercAccountText[MERC_ACCOUNT_MERC], MERC_AC_FIRST_COLUMN_X, MERC_AC_MERC_TITLE_Y, MERC_AC_FIRST_COLUMN_WIDTH, MERC_ACCOUNT_TEXT_FONT, MERC_ACCOUNT_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DrawTextToScreen( MercAccountText[MERC_ACCOUNT_DAYS], MERC_AC_SECOND_COLUMN_X, MERC_AC_MERC_TITLE_Y, MERC_AC_SECOND_COLUMN_WIDTH, MERC_ACCOUNT_TEXT_FONT, MERC_ACCOUNT_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DrawTextToScreen( MercAccountText[MERC_ACCOUNT_RATE], MERC_AC_THIRD_COLUMN_X, MERC_AC_MERC_TITLE_Y, MERC_AC_THIRD_COLUMN_WIDTH, MERC_ACCOUNT_TEXT_FONT, MERC_ACCOUNT_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DrawTextToScreen( MercAccountText[MERC_ACCOUNT_CHARGE], MERC_AC_FOURTH_COLUMN_X, MERC_AC_MERC_TITLE_Y, MERC_AC_FOURTH_COLUMN_WIDTH, MERC_ACCOUNT_TEXT_FONT, MERC_ACCOUNT_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + DrawTextToScreen( MercAccountText[MERC_ACCOUNT_TOTAL], MERC_AC_THIRD_COLUMN_X, MERC_AC_TOTAL_COST_Y, MERC_AC_THIRD_COLUMN_WIDTH, MERC_ACCOUNT_TEXT_FONT, MERC_ACCOUNT_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + DisplayHiredMercs(); + + // giMercTotalContractCharge gets set with the price in DisplayHiredMercs(), so if there is currently no charge, disable the button + if( giMercTotalContractCharge == 0 ) + { + DisableButton( guiMercAuthorizeBoxButton ); + } + + + + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + +void BtnMercAuthorizeButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + CHAR16 wzAuthorizeString[512]; + CHAR16 wzDollarAmount[128]; + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + swprintf( wzDollarAmount, L"%d", giMercTotalContractCharge ); + + InsertCommasForDollarFigure( wzDollarAmount ); + InsertDollarSignInToString( wzDollarAmount ); + + //create the string to show to the user + swprintf( wzAuthorizeString, MercAccountText[MERC_ACCOUNT_AUTHORIZE_CONFIRMATION], wzDollarAmount ); + + DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, wzAuthorizeString, LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercAuthorizePaymentMessageBoxCallBack ); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnMercBackButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_MERC; + gubArrivedFromMercSubSite = MERC_CAME_FROM_ACCOUNTS_PAGE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void DisplayHiredMercs() +{ + UINT16 usPosY; + UINT32 uiContractCharge; + wchar_t sTemp[20]; + UINT8 i, usMercID; + UINT8 ubFontColor; + + giMercTotalContractCharge = 0; + + usPosY = MERC_AC_FIRST_ROW_Y + 3; + // WANNE + for(i=0; i<=14; i++) + { + //if it larry Roach burn advance. ( cause larry is in twice, a sober larry and a stoned larry ) + if( i == MERC_LARRY_ROACHBURN ) + continue; + + usMercID = GetMercIDFromMERCArray( i ); + + //is the merc on the team, or is owed money + if( IsMercOnTeam( (UINT8)usMercID ) || gMercProfiles[ usMercID ].iMercMercContractLength != 0 ) + { + //if the merc is dead, make the color red, else white + if( IsMercDead( usMercID ) ) + ubFontColor = MERC_ACCOUNT_DEAD_TEXT_COLOR; + else + ubFontColor = MERC_ACCOUNT_DYNAMIC_TEXT_COLOR; + + uiContractCharge = 0; + + //Display Mercs Name + DrawTextToScreen( gMercProfiles[ usMercID ].zName, MERC_AC_FIRST_COLUMN_X+5, usPosY, MERC_AC_FIRST_COLUMN_WIDTH, MERC_ACCOUNT_DYNAMIC_TEXT_FONT, ubFontColor, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + //Display The # of days the merc has worked since last paid + + swprintf(sTemp, L"%d", gMercProfiles[ usMercID ].iMercMercContractLength ); + DrawTextToScreen(sTemp, MERC_AC_SECOND_COLUMN_X, usPosY, MERC_AC_SECOND_COLUMN_WIDTH, MERC_ACCOUNT_DYNAMIC_TEXT_FONT, ubFontColor, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Display the mercs rate + swprintf(sTemp, L"$%6d",gMercProfiles[ usMercID ].sSalary ); + DrawTextToScreen(sTemp, MERC_AC_THIRD_COLUMN_X, usPosY, MERC_AC_THIRD_COLUMN_WIDTH, MERC_ACCOUNT_DYNAMIC_TEXT_FONT, ubFontColor, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + //Display the total charge + uiContractCharge = gMercProfiles[ usMercID ].sSalary * gMercProfiles[ usMercID ].iMercMercContractLength; + swprintf(sTemp, L"$%6d", uiContractCharge ); + DrawTextToScreen(sTemp, MERC_AC_FOURTH_COLUMN_X, usPosY, MERC_AC_FOURTH_COLUMN_WIDTH, MERC_ACCOUNT_DYNAMIC_TEXT_FONT, ubFontColor, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + giMercTotalContractCharge += uiContractCharge; + usPosY += MERC_AC_ROW_SIZE; + } + } + + swprintf(sTemp, L"$%6d", giMercTotalContractCharge ); + DrawTextToScreen(sTemp, MERC_AC_FOURTH_COLUMN_X, MERC_AC_TOTAL_COST_Y, MERC_AC_FOURTH_COLUMN_WIDTH, MERC_ACCOUNT_DYNAMIC_TEXT_FONT, MERC_ACCOUNT_DYNAMIC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); +} + + + +void SettleMercAccounts() +{ +// SOLDIERTYPE *pSoldier; + INT16 i; + UINT8 ubMercID; + INT32 iPartialPayment=0; + INT32 iContractCharge=0; + + + //loop through all the MERC mercs the player has on the team + for(i=0; i= iPartialPayment + iContractCharge ) + { + //Increment the counter that keeps track of the of the number of days the player has paid for merc services + LaptopSaveInfo.guiNumberOfMercPaymentsInDays += gMercProfiles[ ubMercID ].iMercMercContractLength; + + //Then reset the merc contract counter + gMercProfiles[ ubMercID ].iMercMercContractLength = 0; + + //Add this mercs contract charge to the total + iPartialPayment += iContractCharge; + + gMercProfiles[ ubMercID ].uiTotalCostToDate += iContractCharge; + } + } + } + + if( iPartialPayment == 0 ) + { + //if true, will display a msgbox telling user that they dont have enough funds + gfMercPlayerDoesntHaveEnoughMoney_DisplayWarning = TRUE; + return; + } + + // add the transaction to the finance page + AddTransactionToPlayersBook( PAY_SPECK_FOR_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -iPartialPayment ); + AddHistoryToPlayersLog( HISTORY_SETTLED_ACCOUNTS_AT_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -1, -1 ); + + //Increment the amount of money paid to speck + LaptopSaveInfo.uiTotalMoneyPaidToSpeck += iPartialPayment; + + //If the player only made a partial payment + if( iPartialPayment != giMercTotalContractCharge ) + gusMercVideoSpeckSpeech = SPECK_QUOTE_PLAYER_MAKES_PARTIAL_PAYMENT; + else + { + gusMercVideoSpeckSpeech = SPECK_QUOTE_PLAYER_MAKES_FULL_PAYMENT; + + //if the merc's account was in suspense, re-enable it + // CJC Dec 1 2002: an invalid account become valid again. + //if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_INVALID ) + LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_VALID; + + + // Since the player has paid, make sure speck wont complain about the lack of payment + LaptopSaveInfo.uiSpeckQuoteFlags &= ~SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT; + } + + //Go to the merc homepage to say the quote + guiCurrentLaptopMode = LAPTOP_MODE_MERC; + gubArrivedFromMercSubSite = MERC_CAME_FROM_ACCOUNTS_PAGE; + + +/* + + //if the player doesnt have enough money to fully pay for the all the mercs contract + if( LaptopSaveInfo.iCurrentBalance < giMercTotalContractCharge ) + { + INT32 iPartialPayment=0; + INT32 iContractCharge=0; + SOLDIERTYPE *pSoldier; + + //try to make a partial payment by looping through all the mercs and settling them 1 at a time + for(i=0; iiTotalContractLength; + + //if the player can afford to pay this merc + if( LaptopSaveInfo.iCurrentBalance > iContractCharge ) + { + sSoldierID = GetSoldierIDFromMercID( ubMercID ); + pSoldier = MercPtrs[ sSoldierID ]; + + LaptopSaveInfo.guiNumberOfMercPaymentsInDays += pSoldier->iTotalContractLength; + + pSoldier->iTotalContractLength = 0; + + iPartialPayment += iContractCharge; + } + } + } + + if( iPartialPayment != 0 ) + { + // add the transaction to the finance page + AddTransactionToPlayersBook( PAY_SPECK_FOR_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -iPartialPayment ); + AddHistoryToPlayersLog( HISTORY_SETTLED_ACCOUNTS_AT_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -1, -1 ); + } + + +// DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercAccountText[MERC_ACCOUNT_NOT_ENOUGH_MONEY], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + //return to the main page and have speck say quote + guiCurrentLaptopMode = LAPTOP_MODE_MERC; + gubArrivedFromMercSubSite = MERC_CAME_FROM_ACCOUNTS_PAGE; + + gusMercVideoSpeckSpeech = SPECK_QUOTE_PLAYER_MAKES_PARTIAL_PAYMENT; + + return; + } + + // add the transaction to the finance page + AddTransactionToPlayersBook( PAY_SPECK_FOR_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -giMercTotalContractCharge); + AddHistoryToPlayersLog( HISTORY_SETTLED_ACCOUNTS_AT_MERC, GetMercIDFromMERCArray( gubCurMercIndex ), GetWorldTotalMin(), -1, -1 ); + + //reset all the mercs time + for(i=0; iiTotalContractLength; + + pSoldier->iTotalContractLength = 0; + } + } + + //if the merc's account was in suspense, re-enable it + if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_INVALID ) + LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_VALID; + + + //Go to the merc homepage to say the quote + guiCurrentLaptopMode = LAPTOP_MODE_MERC; + gubArrivedFromMercSubSite = MERC_CAME_FROM_ACCOUNTS_PAGE; + gusMercVideoSpeckSpeech = SPECK_QUOTE_PLAYER_MAKES_FULL_PAYMENT; +*/ +} + + +void MercAuthorizePaymentMessageBoxCallBack( UINT8 bExitValue ) +{ + // yes, clear the form + if( bExitValue == MSG_BOX_RETURN_YES ) + { + //if the player owes Speck money, then settle the accounts + if( giMercTotalContractCharge ) + SettleMercAccounts(); + } +} + + +UINT32 CalculateHowMuchPlayerOwesSpeck() +{ + UINT8 i=0; + UINT32 uiContractCharge=0; + UINT16 usMercID; + + + for(i=0; i<10; i++) + { + //if it larry Roach burn advance. ( cause larry is in twice, a sober larry and a stoned larry ) + if( i == MERC_LARRY_ROACHBURN ) + continue; + + usMercID = GetMercIDFromMERCArray( i ); + //if( IsMercOnTeam( (UINT8)usMercID ) ) + { + //Calc salary for the # of days the merc has worked since last paid + uiContractCharge += gMercProfiles[ usMercID ].sSalary * gMercProfiles[ usMercID ].iMercMercContractLength; + } + } + + return( uiContractCharge ); +} \ No newline at end of file diff --git a/Laptop/mercs Account.h b/Laptop/mercs Account.h new file mode 100644 index 00000000..33af5c78 --- /dev/null +++ b/Laptop/mercs Account.h @@ -0,0 +1,12 @@ +#ifndef __MERCS_ACCOUNT_H +#define __MERCS_ACCOUNT_H + +void GameInitMercsAccount(); +BOOLEAN EnterMercsAccount(); +void ExitMercsAccount(); +void HandleMercsAccount(); +void RenderMercsAccount(); + +UINT32 CalculateHowMuchPlayerOwesSpeck(); + +#endif \ No newline at end of file diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp new file mode 100644 index 00000000..88554e65 --- /dev/null +++ b/Laptop/mercs Files.cpp @@ -0,0 +1,706 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "mercs Files.h" + #include "mercs.h" + #include "Utilities.h" + #include "WCheck.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Soldier Profile.h" + #include "stdio.h" + #include "Encrypted File.h" + #include "AimMembers.h" + #include "Game Clock.h" + #include "Soldier Add.h" + #include "OverHead.h" + #include "Game Clock.h" + #include "message.h" + #include "Font.h" + #include "LaptopSave.h" + #include "Text.h" + #include "Speck Quotes.h" +#endif + +#include "Cheats.h" + + + +#define MERCBIOFILE "BINARYDATA\\MercBios.edt" + +#define MERC_BIO_FONT FONT14ARIAL//FONT12ARIAL +#define MERC_BIO_COLOR FONT_MCOLOR_WHITE + +#define MERC_TITLE_FONT FONT14ARIAL +#define MERC_TITLE_COLOR 146 + +#define MERC_NAME_FONT FONT14ARIAL +#define MERC_NAME_COLOR FONT_MCOLOR_WHITE + +#define MERC_STATS_FONT FONT12ARIAL +#define MERC_STATIC_STATS_COLOR 146 +#define MERC_DYNAMIC_STATS_COLOR FONT_MCOLOR_WHITE + + +#define MERC_FILES_PORTRAIT_BOX_X LAPTOP_SCREEN_UL_X + 16 +#define MERC_FILES_PORTRAIT_BOX_Y LAPTOP_SCREEN_WEB_UL_Y + 17 + +#define MERC_FACE_X MERC_FILES_PORTRAIT_BOX_X + 2 +#define MERC_FACE_Y MERC_FILES_PORTRAIT_BOX_Y + 2 +#define MERC_FACE_WIDTH 106 +#define MERC_FACE_HEIGHT 122 + +#define MERC_FILES_STATS_BOX_X LAPTOP_SCREEN_UL_X + 164 +#define MERC_FILES_STATS_BOX_Y MERC_FILES_PORTRAIT_BOX_Y + + +#define MERC_FILES_BIO_BOX_X MERC_FILES_PORTRAIT_BOX_X +#define MERC_FILES_BIO_BOX_Y LAPTOP_SCREEN_WEB_UL_Y + 155 + +#define MERC_FILES_PREV_BUTTON_X iScreenWidthOffset + 128 +#define MERC_FILES_PREV_BUTTON_Y iScreenHeightOffset + 380 + +#define MERC_FILES_NEXT_BUTTON_X iScreenWidthOffset + 490 +#define MERC_FILES_NEXT_BUTTON_Y MERC_FILES_PREV_BUTTON_Y + +#define MERC_FILES_HIRE_BUTTON_X iScreenWidthOffset + 260 +#define MERC_FILES_HIRE_BUTTON_Y MERC_FILES_PREV_BUTTON_Y + +#define MERC_FILES_BACK_BUTTON_X iScreenWidthOffset + 380 +#define MERC_FILES_BACK_BUTTON_Y MERC_FILES_PREV_BUTTON_Y + +#define MERC_NAME_X MERC_FILES_STATS_BOX_X + 50 +#define MERC_NAME_Y MERC_FILES_STATS_BOX_Y + 10 + +#define MERC_BIO_TEXT_X MERC_FILES_BIO_BOX_X + 5 +#define MERC_BIO_TEXT_Y MERC_FILES_BIO_BOX_Y + 10 + +#define MERC_ADD_BIO_TITLE_X MERC_BIO_TEXT_X +#define MERC_ADD_BIO_TITLE_Y MERC_BIO_TEXT_Y + 100 + +#define MERC_ADD_BIO_TEXT_X MERC_BIO_TEXT_X +#define MERC_ADD_BIO_TEXT_Y MERC_ADD_BIO_TITLE_Y + 20 + +#define MERC_BIO_WIDTH 460 - 10 + +#define MERC_BIO_INFO_TEXT_SIZE 5 * 80 * 2 +#define MERC_BIO_ADD_INFO_TEXT_SIZE 2 * 80 * 2 +#define MERC_BIO_SIZE 7 * 80 * 2 + +#define MERC_STATS_FIRST_COL_X MERC_NAME_X +#define MERC_STATS_FIRST_NUM_COL_X MERC_STATS_FIRST_COL_X + 90 +#define MERC_STATS_SECOND_COL_X MERC_FILES_STATS_BOX_X + 170 +#define MERC_STATS_SECOND_NUM_COL_X MERC_STATS_SECOND_COL_X + 115 +#define MERC_SPACE_BN_LINES 15 + +#define MERC_HEALTH_Y MERC_FILES_STATS_BOX_Y + 30 + +#define MERC_PORTRAIT_TEXT_OFFSET_Y 110 + + +UINT32 guiPortraitBox; +UINT32 guiStatsBox; +UINT32 guiBioBox; +UINT32 guiMercFace; + +// +// Buttons +// + +// The Prev button +void BtnMercPrevButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiPrevButton; +INT32 guiButtonImage; + +// The Next button +void BtnMercNextButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiNextButton; + +// The Hire button +void BtnMercHireButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiHireButton; + +// The Back button +void BtnMercFilesBackButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiMercBackButton; + + +//**************************** +// +// Function Prototypes +// +//**************************** + +BOOLEAN DisplayMercFace( UINT8 ubMercID); +void LoadAndDisplayMercBio( UINT8 ubMercID ); +void DisplayMercsStats( UINT8 ubMercID ); +BOOLEAN MercFilesHireMerc(UINT8 ubMercID); +void EnableDisableMercFilesNextPreviousButton( ); + + + + + +void GameInitMercsFiles() +{ + +} + +BOOLEAN EnterMercsFiles() +{ + VOBJECT_DESC VObjectDesc; + + InitMercBackGround(); + + // load the stats box graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_STATSBOX ); + CHECKF(AddVideoObject(&VObjectDesc, &guiStatsBox)); + + // load the Portrait box graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\PortraitBox.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiPortraitBox)); + + // load the bio box graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\BioBox.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiBioBox)); + + + // Prev Box button + guiButtonImage = LoadButtonImage("LAPTOP\\BigButtons.sti", -1,0,-1,1,-1 ); + + guiPrevButton = CreateIconAndTextButton( guiButtonImage, MercInfo[MERC_FILES_PREVIOUS], + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_FILES_PREV_BUTTON_X, MERC_FILES_PREV_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnMercPrevButtonCallback); + + SetButtonCursor(guiPrevButton, CURSOR_LAPTOP_SCREEN); + SpecifyDisabledButtonStyle( guiPrevButton, DISABLED_STYLE_SHADED); + + //Next Button + guiNextButton = CreateIconAndTextButton( guiButtonImage, MercInfo[MERC_FILES_NEXT], + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_FILES_NEXT_BUTTON_X, MERC_FILES_NEXT_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnMercNextButtonCallback); + + SetButtonCursor(guiNextButton, CURSOR_LAPTOP_SCREEN); + SpecifyDisabledButtonStyle( guiNextButton, DISABLED_STYLE_SHADED); + + //Hire button + guiHireButton = CreateIconAndTextButton( guiButtonImage, MercInfo[MERC_FILES_HIRE], + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_FILES_HIRE_BUTTON_X, MERC_FILES_HIRE_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnMercHireButtonCallback); + SetButtonCursor(guiHireButton, CURSOR_LAPTOP_SCREEN); + SpecifyDisabledButtonStyle( guiHireButton, DISABLED_STYLE_SHADED); + + //Back button + guiMercBackButton = CreateIconAndTextButton( guiButtonImage, MercInfo[MERC_FILES_HOME], + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_FILES_BACK_BUTTON_X, MERC_FILES_BACK_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnMercFilesBackButtonCallback); + SetButtonCursor(guiMercBackButton, CURSOR_LAPTOP_SCREEN); + SpecifyDisabledButtonStyle( guiMercBackButton, DISABLED_STYLE_SHADED); + +// RenderMercsFiles(); + return( TRUE ); +} + +void ExitMercsFiles() +{ + DeleteVideoObjectFromIndex(guiPortraitBox); + DeleteVideoObjectFromIndex(guiStatsBox); + DeleteVideoObjectFromIndex(guiBioBox); + + UnloadButtonImage( guiButtonImage ); + RemoveButton( guiPrevButton ); + RemoveButton( guiNextButton ); + RemoveButton( guiHireButton ); + RemoveButton( guiMercBackButton ); + + RemoveMercBackGround(); +} + +void HandleMercsFiles() +{ + +} + +void RenderMercsFiles() +{ + HVOBJECT hPixHandle; + + DrawMecBackGround(); + + // Portrait Box + GetVideoObject(&hPixHandle, guiPortraitBox); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,MERC_FILES_PORTRAIT_BOX_X, MERC_FILES_PORTRAIT_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // Stats Box + GetVideoObject(&hPixHandle, guiStatsBox); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,MERC_FILES_STATS_BOX_X, MERC_FILES_STATS_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + // bio box + GetVideoObject(&hPixHandle, guiBioBox); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,MERC_FILES_BIO_BOX_X+1, MERC_FILES_BIO_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //Display the mercs face + DisplayMercFace( GetMercIDFromMERCArray( gubCurMercIndex ) ); + + //Display Mercs Name + DrawTextToScreen(gMercProfiles[ GetMercIDFromMERCArray( gubCurMercIndex ) ].zName, MERC_NAME_X, MERC_NAME_Y, 0, MERC_NAME_FONT, MERC_NAME_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + //Load and display the mercs bio + UINT8 mercID = GetMercIDFromMERCArray( gubCurMercIndex ); + if ( mercID < GASTON ) + mercID -= BIFF; + else + mercID -= 154; + + LoadAndDisplayMercBio( mercID ); + + //Display the mercs statistic + DisplayMercsStats( GetMercIDFromMERCArray( gubCurMercIndex ) ); + + //check to see if the merc is dead if so disable the contact button + if( IsMercDead( GetMercIDFromMERCArray( gubCurMercIndex ) ) ) + DisableButton( guiHireButton ); + else if( ( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_VALID ) && ( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_SUSPENDED ) && ( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_VALID_FIRST_WARNING ) ) + { + //if the players account is suspended, disable the button + DisableButton( guiHireButton ); + } + else + EnableButton( guiHireButton ); + + //Enable or disable the buttons + EnableDisableMercFilesNextPreviousButton( ); + + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + + + +void BtnMercPrevButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + if( gubCurMercIndex > 0 ) + gubCurMercIndex--; + + //Since there are 2 larry roachburns + if( gubCurMercIndex == MERC_LARRY_ROACHBURN) + gubCurMercIndex--; + + fReDrawScreenFlag = TRUE; + + //Enable or disable the buttons + EnableDisableMercFilesNextPreviousButton( ); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnMercNextButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + + if( gubCurMercIndex <= LaptopSaveInfo.gubLastMercIndex-1 ) + gubCurMercIndex++; + + //Since there are 2 larry roachburns + if( gubCurMercIndex == MERC_LARRY_ROACHBURN) + gubCurMercIndex++; + + fReDrawScreenFlag = TRUE; + + //Enable or disable the buttons + EnableDisableMercFilesNextPreviousButton( ); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnMercHireButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //if the players accont is suspended, go back to the main screen and have Speck inform the players + if( LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_SUSPENDED ) + { + guiCurrentLaptopMode = LAPTOP_MODE_MERC; + gusMercVideoSpeckSpeech = SPECK_QUOTE_ALTERNATE_OPENING_5_PLAYER_OWES_SPECK_ACCOUNT_SUSPENDED; + gubArrivedFromMercSubSite = MERC_CAME_FROM_HIRE_PAGE; + + } + + //else try to hire the merc + else if( MercFilesHireMerc( GetMercIDFromMERCArray( gubCurMercIndex ) ) ) + { + guiCurrentLaptopMode = LAPTOP_MODE_MERC; + gubArrivedFromMercSubSite = MERC_CAME_FROM_HIRE_PAGE; + + //start the merc talking +// HandlePlayerHiringMerc( GetMercIDFromMERCArray( gubCurMercIndex ) ); + + //We just hired a merc + gfJustHiredAMercMerc = TRUE; + + //Display a popup msg box telling the user when and where the merc will arrive + DisplayPopUpBoxExplainingMercArrivalLocationAndTime( /*GetMercIDFromMERCArray( gubCurMercIndex )*/ ); // doesn't take parameters (jonathanl) + } + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +BOOLEAN DisplayMercFace( UINT8 ubMercID) +{ + HVOBJECT hFaceHandle; + HVOBJECT hPortraitHandle; + STR sFaceLoc = "FACES\\BIGFACES\\"; + char sTemp[100]; + MERCPROFILESTRUCT *pMerc; + VOBJECT_DESC VObjectDesc; + SOLDIERTYPE *pSoldier=NULL; + + // Portrait Frame + GetVideoObject(&hPortraitHandle, guiPortraitBox); + BltVideoObject(FRAME_BUFFER, hPortraitHandle, 0,MERC_FILES_PORTRAIT_BOX_X, MERC_FILES_PORTRAIT_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + pMerc = &gMercProfiles[ ubMercID ]; + + //See if the merc is currently hired + pSoldier = FindSoldierByProfileID( ubMercID, TRUE ); + + // load the Face graphic and add it + sprintf(sTemp, "%s%02d.sti", sFaceLoc, ubMercID); + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP(sTemp, VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMercFace)); + + //Blt face to screen + GetVideoObject(&hFaceHandle, guiMercFace); + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,MERC_FACE_X, MERC_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //if the merc is dead, shadow the face red and put text over top saying the merc is dead + if( IsMercDead( ubMercID ) ) + { + //shade the face red, (to signif that he is dead) + hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); + + //get the face object + GetVideoObject(&hFaceHandle, guiMercFace); + + //set the red pallete to the face + SetObjectHandleShade( guiMercFace, 0 ); + + //Blt face to screen + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,MERC_FACE_X, MERC_FACE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + DisplayWrappedString(MERC_FACE_X, MERC_FACE_Y+MERC_PORTRAIT_TEXT_OFFSET_Y, MERC_FACE_WIDTH, 2, FONT14ARIAL, 145, MercInfo[MERC_FILES_MERC_IS_DEAD], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + } + + else if( ubMercID == FLO && gubFact[ FACT_PC_MARRYING_DARYL_IS_FLO ] ) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, MERC_FACE_X, MERC_FACE_Y, MERC_FACE_X + MERC_FACE_WIDTH, MERC_FACE_Y + MERC_FACE_HEIGHT); + DisplayWrappedString( MERC_FACE_X, MERC_FACE_Y+MERC_PORTRAIT_TEXT_OFFSET_Y, MERC_FACE_WIDTH, 2, FONT14ARIAL, 145, pPersonnelDepartedStateStrings[3], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + + //else if the merc is currently a POW or, the merc was fired as a pow + else if( pMerc->bMercStatus == MERC_FIRED_AS_A_POW || ( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) ) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, MERC_FACE_X, MERC_FACE_Y, MERC_FACE_X + MERC_FACE_WIDTH, MERC_FACE_Y + MERC_FACE_HEIGHT); + DisplayWrappedString(MERC_FACE_X, MERC_FACE_Y+MERC_PORTRAIT_TEXT_OFFSET_Y, MERC_FACE_WIDTH, 2, FONT14ARIAL, 145, pPOWStrings[0], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + } + + //if the merc is hired already, say it + else if( !IsMercHireable( ubMercID ) && pMerc->bMercStatus == MERC_HIRED_BUT_NOT_ARRIVED_YET || pMerc->bMercStatus > 0 ) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, MERC_FACE_X, MERC_FACE_Y, MERC_FACE_X + MERC_FACE_WIDTH, MERC_FACE_Y + MERC_FACE_HEIGHT); + DisplayWrappedString(MERC_FACE_X, MERC_FACE_Y+MERC_PORTRAIT_TEXT_OFFSET_Y, MERC_FACE_WIDTH, 2, FONT14ARIAL, 145, MercInfo[MERC_FILES_ALREADY_HIRED], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + } + + //if the merc is away on another assignemnt, say the merc is unavailable + else if( !IsMercHireable( ubMercID ) ) + { + ShadowVideoSurfaceRect( FRAME_BUFFER, MERC_FACE_X, MERC_FACE_Y, MERC_FACE_X + MERC_FACE_WIDTH, MERC_FACE_Y + MERC_FACE_HEIGHT); + DisplayWrappedString(MERC_FACE_X, MERC_FACE_Y+MERC_PORTRAIT_TEXT_OFFSET_Y, MERC_FACE_WIDTH, 2, FONT14ARIAL, 145, MercInfo[MERC_FILES_MERC_UNAVAILABLE], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + } + + DeleteVideoObjectFromIndex(guiMercFace); + + return( TRUE ); +} + + +void LoadAndDisplayMercBio( UINT8 ubMercID ) +{ + wchar_t sText[400]; + UINT32 uiStartLoc = 0; + + //load and display the merc bio + uiStartLoc = MERC_BIO_SIZE * ubMercID; + LoadEncryptedDataFromFile(MERCBIOFILE, sText, uiStartLoc, MERC_BIO_INFO_TEXT_SIZE); + DisplayWrappedString(MERC_BIO_TEXT_X, MERC_BIO_TEXT_Y, MERC_BIO_WIDTH, 2, MERC_BIO_FONT, MERC_BIO_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + //load and display the merc's additioanl info (if any) + uiStartLoc = MERC_BIO_SIZE * ubMercID + MERC_BIO_INFO_TEXT_SIZE; + LoadEncryptedDataFromFile(MERCBIOFILE, sText, uiStartLoc, MERC_BIO_ADD_INFO_TEXT_SIZE); + if( sText[0] != 0 ) + { + DrawTextToScreen( MercInfo[ MERC_FILES_ADDITIONAL_INFO ], MERC_ADD_BIO_TITLE_X, MERC_ADD_BIO_TITLE_Y, 0, MERC_TITLE_FONT, MERC_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DisplayWrappedString( MERC_ADD_BIO_TEXT_X, MERC_ADD_BIO_TEXT_Y, MERC_BIO_WIDTH, 2, MERC_BIO_FONT, MERC_BIO_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + } +} + + +void DisplayMercsStats( UINT8 ubMercID ) +{ + UINT16 usPosY, usPosX; + wchar_t sString[128]; + + usPosY = MERC_HEALTH_Y; + + //Health + DrawTextToScreen(MercInfo[MERC_FILES_HEALTH], MERC_STATS_FIRST_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bLife, 3, MERC_STATS_FIRST_NUM_COL_X, MERC_HEALTH_Y, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + usPosY += MERC_SPACE_BN_LINES; + + //Agility + DrawTextToScreen(MercInfo[MERC_FILES_AGILITY], MERC_STATS_FIRST_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bAgility, 3, MERC_STATS_FIRST_NUM_COL_X, usPosY, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + usPosY += MERC_SPACE_BN_LINES; + + //Dexterity + DrawTextToScreen(MercInfo[MERC_FILES_DEXTERITY], MERC_STATS_FIRST_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bDexterity, 3, MERC_STATS_FIRST_NUM_COL_X, usPosY, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + usPosY += MERC_SPACE_BN_LINES; + + //Strenght + DrawTextToScreen(MercInfo[MERC_FILES_STRENGTH], MERC_STATS_FIRST_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bStrength, 3, MERC_STATS_FIRST_NUM_COL_X, usPosY, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + usPosY += MERC_SPACE_BN_LINES; + + //Leadership + DrawTextToScreen(MercInfo[MERC_FILES_LEADERSHIP], MERC_STATS_FIRST_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bLeadership, 3, MERC_STATS_FIRST_NUM_COL_X, usPosY, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + usPosY += MERC_SPACE_BN_LINES; + + //Wisdom + DrawTextToScreen(MercInfo[MERC_FILES_WISDOM], MERC_STATS_FIRST_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bWisdom, 3, MERC_STATS_FIRST_NUM_COL_X, usPosY, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + + usPosY = MERC_HEALTH_Y; + + //Experience Level + DrawTextToScreen(MercInfo[MERC_FILES_EXPLEVEL], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bExpLevel, 3, MERC_STATS_SECOND_NUM_COL_X, usPosY, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + usPosY += MERC_SPACE_BN_LINES; + + //Marksmanship + DrawTextToScreen(MercInfo[MERC_FILES_MARKSMANSHIP], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bMarksmanship, 3, MERC_STATS_SECOND_NUM_COL_X, usPosY, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + usPosY += MERC_SPACE_BN_LINES; + + //Mechanical + DrawTextToScreen(MercInfo[MERC_FILES_MECHANICAL], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bMechanical, 3, MERC_STATS_SECOND_NUM_COL_X, usPosY, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + usPosY += MERC_SPACE_BN_LINES; + + //Explosive + DrawTextToScreen(MercInfo[MERC_FILES_EXPLOSIVE], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bExplosive, 3, MERC_STATS_SECOND_NUM_COL_X, usPosY, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + usPosY += MERC_SPACE_BN_LINES; + + //Medical + DrawTextToScreen(MercInfo[MERC_FILES_MEDICAL], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bMedical, 3, MERC_STATS_SECOND_NUM_COL_X, usPosY, MERC_STATS_FONT, MERC_DYNAMIC_STATS_COLOR); + usPosY += MERC_SPACE_BN_LINES; + + //Daily Salary + DrawTextToScreen( MercInfo[MERC_FILES_SALARY], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_NAME_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + + usPosX = MERC_STATS_SECOND_COL_X + StringPixLength(MercInfo[MERC_FILES_SALARY], MERC_NAME_FONT) + 1; + swprintf(sString, L"%d %s", gMercProfiles[ ubMercID ].sSalary, MercInfo[MERC_FILES_PER_DAY]); + DrawTextToScreen( sString, usPosX, usPosY, 95, MERC_NAME_FONT, MERC_DYNAMIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); +} + + + +BOOLEAN MercFilesHireMerc(UINT8 ubMercID) +{ + MERC_HIRE_STRUCT HireMercStruct; + INT8 bReturnCode; + + memset(&HireMercStruct, 0, sizeof(MERC_HIRE_STRUCT)); + + //if the ALT key is down + if( gfKeyState[ ALT ] && CHEATER_CHEAT_LEVEL( ) ) + { + //set the merc to be hireable + gMercProfiles[ ubMercID ].bMercStatus = MERC_OK; + gMercProfiles[ ubMercID ].uiDayBecomesAvailable = 0; + } + + //if the merc is away, dont hire + if( !IsMercHireable( ubMercID ) ) + { + if( gMercProfiles[ ubMercID ].bMercStatus != MERC_IS_DEAD ) + { + guiCurrentLaptopMode = LAPTOP_MODE_MERC; + gusMercVideoSpeckSpeech = SPECK_QUOTE_PLAYER_TRIES_TO_HIRE_ALREADY_HIRED_MERC; + gubArrivedFromMercSubSite = MERC_CAME_FROM_HIRE_PAGE; + } + + return(FALSE); + } + + HireMercStruct.ubProfileID = ubMercID; + +// +// HireMercStruct.fCopyProfileItemsOver = gfBuyEquipment; +// + HireMercStruct.fCopyProfileItemsOver = TRUE; + + HireMercStruct.iTotalContractLength = 1; + + //Specify where the merc is to appear + HireMercStruct.sSectorX = gsMercArriveSectorX;//13; + HireMercStruct.sSectorY = gsMercArriveSectorY; + HireMercStruct.fUseLandingZoneForArrival = TRUE; + + HireMercStruct.uiTimeTillMercArrives = GetMercArrivalTimeOfDay( );// + ubMercID + + + //Set the time and ID of the last hired merc will arrive +// LaptopSaveInfo.sLastHiredMerc.iIdOfMerc = HireMercStruct.ubProfileID; +// LaptopSaveInfo.sLastHiredMerc.uiArrivalTime = HireMercStruct.uiTimeTillMercArrives; + + + bReturnCode = HireMerc( &HireMercStruct ); + //already have 20 mercs on the team + if( bReturnCode == MERC_HIRE_OVER_20_MERCS_HIRED ) + { + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, MercInfo[ MERC_FILES_HIRE_TO_MANY_PEOPLE_WARNING ], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL); + return(FALSE); + } + else if( bReturnCode == MERC_HIRE_FAILED ) + { + //function failed + return(FALSE); + } + else + { + //if we succesfully hired the merc + return(TRUE); + } +} + + + +void BtnMercFilesBackButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_MERC; + gubArrivedFromMercSubSite = MERC_CAME_FROM_HIRE_PAGE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void EnableDisableMercFilesNextPreviousButton( ) +{ + if( gubCurMercIndex <= LaptopSaveInfo.gubLastMercIndex-1 ) + EnableButton( guiNextButton ); + else + DisableButton( guiNextButton ); + + if( gubCurMercIndex > 0 ) + EnableButton( guiPrevButton ); + else + DisableButton( guiPrevButton ); +} \ No newline at end of file diff --git a/Laptop/mercs Files.h b/Laptop/mercs Files.h new file mode 100644 index 00000000..02142305 --- /dev/null +++ b/Laptop/mercs Files.h @@ -0,0 +1,10 @@ +#ifndef __MERCS_FILES_H +#define __MERCS_FILES_H + +void GameInitMercsFiles(); +BOOLEAN EnterMercsFiles(); +void ExitMercsFiles(); +void HandleMercsFiles(); +void RenderMercsFiles(); + +#endif \ No newline at end of file diff --git a/Laptop/mercs No Account.cpp b/Laptop/mercs No Account.cpp new file mode 100644 index 00000000..3befeb70 --- /dev/null +++ b/Laptop/mercs No Account.cpp @@ -0,0 +1,194 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "mercs No Account.h" + #include "mercs.h" + #include "Utilities.h" + #include "WCheck.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "LaptopSave.h" + #include "Random.h" + #include "Text.h" + #include "Speck Quotes.h" +#endif + + + + +#define MERC_NA_TEXT_FONT FONT12ARIAL +#define MERC_NA_TEXT_COLOR FONT_MCOLOR_WHITE + + +#define MERC_NO_ACCOUNT_IMAGE_X LAPTOP_SCREEN_UL_X + 23 +#define MERC_NO_ACCOUNT_IMAGE_Y LAPTOP_SCREEN_UL_Y + 52 + +#define MERC_OPEN_BUTTON_X iScreenWidthOffset + 130 +#define MERC_OPEN_BUTTON_Y iScreenHeightOffset + 380 + +#define MERC_CANCEL_BUTTON_X iScreenWidthOffset + 490 +#define MERC_CANCEL_BUTTON_Y MERC_OPEN_BUTTON_Y + +#define MERC_NA_SENTENCE_X MERC_NO_ACCOUNT_IMAGE_X + 10 +#define MERC_NA_SENTENCE_Y MERC_NO_ACCOUNT_IMAGE_Y + 75 +#define MERC_NA_SENTENCE_WIDTH 460 - 20 + +UINT32 guiNoAccountImage; + + + +// The Open Account Box button +void BtnOpenAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiOpenAccountBoxButton; +INT32 guiOpenAccountBoxButtonImage; + +// The Cancel Account Box button +void BtnCancelBoxButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiCancelBoxButton; + + + +void GameInitMercsNoAccount() +{ + +} + +BOOLEAN EnterMercsNoAccount() +{ + VOBJECT_DESC VObjectDesc; + + InitMercBackGround(); + + // load the Account box graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\NoAccountBox.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiNoAccountImage)); + + + // Open Accouint button + guiOpenAccountBoxButtonImage = LoadButtonImage("LAPTOP\\BigButtons.sti", -1,0,-1,1,-1 ); + + guiOpenAccountBoxButton = CreateIconAndTextButton( guiOpenAccountBoxButtonImage, MercNoAccountText[MERC_NO_ACC_OPEN_ACCOUNT], + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_OPEN_BUTTON_X, MERC_OPEN_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnOpenAccountBoxButtonCallback); + SetButtonCursor(guiOpenAccountBoxButton, CURSOR_LAPTOP_SCREEN); + SpecifyDisabledButtonStyle( guiOpenAccountBoxButton, DISABLED_STYLE_SHADED); + + + guiCancelBoxButton = CreateIconAndTextButton( guiOpenAccountBoxButtonImage, MercNoAccountText[MERC_NO_ACC_CANCEL], + FONT12ARIAL, + MERC_BUTTON_UP_COLOR, DEFAULT_SHADOW, + MERC_BUTTON_DOWN_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + MERC_CANCEL_BUTTON_X, MERC_CANCEL_BUTTON_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnCancelBoxButtonCallback); + SetButtonCursor(guiCancelBoxButton, CURSOR_LAPTOP_SCREEN); + SpecifyDisabledButtonStyle( guiCancelBoxButton, DISABLED_STYLE_SHADED); + + RenderMercsNoAccount(); + + return(TRUE); +} + +void ExitMercsNoAccount() +{ + DeleteVideoObjectFromIndex(guiNoAccountImage); + + UnloadButtonImage( guiOpenAccountBoxButtonImage ); + RemoveButton( guiOpenAccountBoxButton ); + RemoveButton( guiCancelBoxButton ); + + RemoveMercBackGround(); +} + +void HandleMercsNoAccount() +{ + +} + +void RenderMercsNoAccount() +{ + HVOBJECT hPixHandle; + + DrawMecBackGround(); + + // Title + GetVideoObject(&hPixHandle, guiNoAccountImage); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,MERC_NO_ACCOUNT_IMAGE_X, MERC_NO_ACCOUNT_IMAGE_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + //Display the sentence + DisplayWrappedString(MERC_NA_SENTENCE_X, MERC_NA_SENTENCE_Y, MERC_NA_SENTENCE_WIDTH, 2, MERC_NA_TEXT_FONT, MERC_NA_TEXT_COLOR, MercNoAccountText[MERC_NO_ACC_NO_ACCOUNT_OPEN_ONE], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + +void BtnOpenAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //open an account + LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_VALID; + + //Get an account number + LaptopSaveInfo.guiPlayersMercAccountNumber = Random( 99999 ); + + gusMercVideoSpeckSpeech = SPECK_QUOTE_THANK_PLAYER_FOR_OPENING_ACCOUNT; + + guiCurrentLaptopMode = LAPTOP_MODE_MERC; + gubArrivedFromMercSubSite = MERC_CAME_FROM_ACCOUNTS_PAGE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnCancelBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_MERC; + gubArrivedFromMercSubSite = MERC_CAME_FROM_ACCOUNTS_PAGE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + diff --git a/Laptop/mercs No Account.h b/Laptop/mercs No Account.h new file mode 100644 index 00000000..5872d69c --- /dev/null +++ b/Laptop/mercs No Account.h @@ -0,0 +1,10 @@ +#ifndef __MERCS_NO_ACCOUNT_H +#define __MERCS_NO_ACCOUNT_H + +void GameInitMercsNoAccount(); +BOOLEAN EnterMercsNoAccount(); +void ExitMercsNoAccount(); +void HandleMercsNoAccount(); +void RenderMercsNoAccount(); + +#endif \ No newline at end of file diff --git a/Laptop/mercs.cpp b/Laptop/mercs.cpp new file mode 100644 index 00000000..d35fa8a5 --- /dev/null +++ b/Laptop/mercs.cpp @@ -0,0 +1,2678 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" + #include "GameSettings.h" +#else + #include "laptop.h" + #include "mercs.h" + #include "Utilities.h" + #include "WCheck.h" + #include "WordWrap.h" + #include "Cursors.h" + #include "Overhead.h" + #include "Soldier Add.h" + #include "Email.h" + #include "Game Clock.h" + #include "Faces.h" + #include "dialogue control.h" + #include "MercTextBox.h" + #include "Merc Hiring.h" + #include "Random.h" + #include "LaptopSave.h" + #include "GameSettings.h" + #include "Text.h" + #include "Speck Quotes.h" + #include "mercs Account.h" + #include "Soldier Profile.h" +#endif + +#define MERC_TEXT_FONT FONT12ARIAL +#define MERC_TEXT_COLOR FONT_MCOLOR_WHITE + +#define MERC_VIDEO_TITLE_FONT FONT10ARIAL +#define MERC_VIDEO_TITLE_COLOR FONT_MCOLOR_LTYELLOW + +#define MERC_BACKGROUND_WIDTH 125 +#define MERC_BACKGROUND_HEIGHT 100 + +#define MERC_TITLE_X LAPTOP_SCREEN_UL_X + 135 +#define MERC_TITLE_Y LAPTOP_SCREEN_WEB_UL_Y + 20 + +#define MERC_PORTRAIT_X LAPTOP_SCREEN_UL_X + 198 +#define MERC_PORTRAIT_Y LAPTOP_SCREEN_WEB_UL_Y + 96 +#define MERC_PORTRAIT_TEXT_X MERC_PORTRAIT_X +#define MERC_PORTRAIT_TEXT_Y MERC_PORTRAIT_Y + 109 +#define MERC_PORTRAIT_TEXT_WIDTH 115 + +#define MERC_ACCOUNT_BOX_X LAPTOP_SCREEN_UL_X + 138 +#define MERC_ACCOUNT_BOX_Y LAPTOP_SCREEN_WEB_UL_Y + 251 + +#define MERC_ACCOUNT_BOX_TEXT_X MERC_ACCOUNT_BOX_X +#define MERC_ACCOUNT_BOX_TEXT_Y MERC_ACCOUNT_BOX_Y + 20 +#define MERC_ACCOUNT_BOX_TEXT_WIDTH 110 + +#define MERC_ACCOUNT_ARROW_X MERC_ACCOUNT_BOX_X + 125 +#define MERC_ACCOUNT_ARROW_Y MERC_ACCOUNT_BOX_Y + 18 + +#define MERC_ACCOUNT_BUTTON_X MERC_ACCOUNT_BOX_X + 133 +#define MERC_ACCOUNT_BUTTON_Y MERC_ACCOUNT_BOX_Y + 8 + +#define MERC_FILE_BOX_X MERC_ACCOUNT_BOX_X +#define MERC_FILE_BOX_Y LAPTOP_SCREEN_WEB_UL_Y + 321 + +#define MERC_FILE_BOX_TEXT_X MERC_FILE_BOX_X +#define MERC_FILE_BOX_TEXT_Y MERC_FILE_BOX_Y + 20 +#define MERC_FILE_BOX_TEXT_WIDTH MERC_ACCOUNT_BOX_TEXT_WIDTH + +#define MERC_FILE_ARROW_X MERC_FILE_BOX_X + 125 +#define MERC_FILE_ARROW_Y MERC_FILE_BOX_Y + 18 + +#define MERC_FILE_BUTTON_X MERC_ACCOUNT_BUTTON_X +#define MERC_FILE_BUTTON_Y MERC_FILE_BOX_Y + 8 + + + +// Video Conference Defines +#define MERC_VIDEO_BACKGROUND_X MERC_PORTRAIT_X +#define MERC_VIDEO_BACKGROUND_Y MERC_PORTRAIT_Y +#define MERC_VIDEO_BACKGROUND_WIDTH 116 +#define MERC_VIDEO_BACKGROUND_HEIGHT 108 + +#define MERC_VIDEO_FACE_X MERC_VIDEO_BACKGROUND_X + 10 +#define MERC_VIDEO_FACE_Y MERC_VIDEO_BACKGROUND_Y + 17 +#define MERC_VIDEO_FACE_WIDTH 96 +#define MERC_VIDEO_FACE_HEIGHT 86 +#define MERC_X_TO_CLOSE_VIDEO_X MERC_VIDEO_BACKGROUND_X + 104 +#define MERC_X_TO_CLOSE_VIDEO_Y MERC_VIDEO_BACKGROUND_Y + 3 +#define MERC_X_VIDEO_TITLE_X MERC_VIDEO_BACKGROUND_X + 5 +#define MERC_X_VIDEO_TITLE_Y MERC_VIDEO_BACKGROUND_Y + 3 + +#define MERC_INTRO_TIME 1000 +#define MERC_EXIT_TIME 500 +#define MERC_VIDEO_MERC_ID_FOR_SPECKS 159//255 + +#define MERC_TEXT_BOX_POS_Y iScreenHeightOffset + 255 + +#define SPECK_IDLE_CHAT_DELAY 10000 + +#define MERC_NUMBER_OF_RANDOM_QUOTES 19//14 + + +#define MERC_FIRST_MERC BIFF +#define MERC_LAST_MERC BUBBA + + +//number of payment days ( # of merc days paid ) to get next set of mercs +#define MERC_NUM_DAYS_TILL_FIRST_MERC_AVAILABLE 10 +#define MERC_NUM_DAYS_TILL_SECOND_MERC_AVAILABLE 16 +#define MERC_NUM_DAYS_TILL_THIRD_MERC_AVAILABLE 24 +#define MERC_NUM_DAYS_TILL_FOURTH_MERC_AVAILABLE 30 + +#define MERC__AMOUNT_OF_MONEY_FOR_BUBBA 6000 +#define MERC__DAY_WHEN_BUBBA_CAN_BECOME_AVAILABLE 10 + + +enum +{ + MERC_ARRIVES_BUBBA, + MERC_ARRIVES_LARRY, + MERC_ARRIVES_NUMB, + MERC_ARRIVES_TEX, + MERC_ARRIVES_BIGGENS, + MERC_ARRIVES_COUGAR, + MERC_ARRIVES_GASTON, + MERC_ARRIVES_STOGIE, + + NUM_MERC_ARRIVALS, +}; + +typedef struct +{ + UINT16 usMoneyPaid; + UINT16 usDay; + UINT8 ubMercArrayID; + +} CONTITION_FOR_MERC_AVAILABLE; + +CONTITION_FOR_MERC_AVAILABLE gConditionsForMercAvailability[ NUM_MERC_ARRIVALS ] = +{ + 5000, 8, 6, //BUBBA + 10000, 15, 7, //Larry + 15000, 20, 9, //Numb + 16000, 21, 10, //Tex + 18000, 23, 11, //Biggens + 20000, 25, 12, //Cougar + 25000, 30, 13, //Gaston + 26000, 31, 14, //Stogie + +}; + + +enum +{ + MERC_DISTORTION_NO_DISTORTION, + MERC_DISTORTION_PIXELATE_UP, + MERC_DISTORTION_PIXELATE_DOWN, + MERC_DISRTORTION_DISTORT_IMAGE, +}; + + +enum +{ + MERC_SITE_NEVER_VISITED, + MERC_SITE_FIRST_VISIT, + MERC_SITE_SECOND_VISIT, + MERC_SITE_THIRD_OR_MORE_VISITS, +}; + + +// Image Indetifiers + +UINT32 guiAccountBox; +UINT32 guiArrow; +UINT32 guiFilesBox; +UINT32 guiMercSymbol; +UINT32 guiSpecPortrait; +UINT32 guiMercBackGround; +UINT32 guiMercVideoFaceBackground; +UINT32 guiMercVideoPopupBackground; + +UINT8 gubMercArray[ NUMBER_OF_MERCS ]; +UINT8 gubCurMercIndex; + +INT32 iMercPopUpBox = -1; + +UINT16 gusPositionOfSpecksDialogBox_X; +wchar_t gsSpeckDialogueTextPopUp[ 900 ]; +UINT16 gusSpeckDialogueX; +UINT16 gusSpeckDialogueActualWidth; + +BOOLEAN gfInMercSite=FALSE; //this flag is set when inide of the merc site + +//Merc Video Conferencing Mode +enum +{ + MERC_VIDEO_NO_VIDEO_MODE, + MERC_VIDEO_INIT_VIDEO_MODE, + MERC_VIDEO_VIDEO_MODE, + MERC_VIDEO_EXIT_VIDEO_MODE, +}; + +UINT8 gubCurrentMercVideoMode; +BOOLEAN gfMercVideoIsBeingDisplayed; +INT32 giVideoSpeckFaceIndex; +UINT16 gusMercVideoSpeckSpeech; + +BOOLEAN gfDisplaySpeckTextBox=FALSE; + +BOOLEAN gfJustEnteredMercSite=FALSE; +UINT8 gubArrivedFromMercSubSite=MERC_CAME_FROM_OTHER_PAGE; //the merc is arriving from one of the merc sub pages +BOOLEAN gfDoneIntroSpeech=TRUE; + +BOOLEAN gfMercSiteScreenIsReDrawn=FALSE; + +BOOLEAN gfJustHiredAMercMerc=FALSE; + +BOOLEAN gfRedrawMercSite=FALSE; + +BOOLEAN gfFirstTimeIntoMERCSiteSinceEnteringLaptop=FALSE; + +//used for the random quotes to try to balance the ones that are said +typedef struct +{ + UINT8 ubQuoteID; + UINT32 uiNumberOfTimesQuoteSaid; + +} NUMBER_TIMES_QUOTE_SAID; +NUMBER_TIMES_QUOTE_SAID gNumberOfTimesQuoteSaid[ MERC_NUMBER_OF_RANDOM_QUOTES ] = +{ + + { SPECK_QUOTE_RANDOM_CHIT_CHAT_1, 0 }, + { SPECK_QUOTE_RANDOM_CHIT_CHAT_2, 0 }, + + { SPECK_QUOTE_ADVERTISE_GASTON, 0 }, + { SPECK_QUOTE_ADVERTISE_STOGIE, 0 }, + + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_BIFF, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_HAYWIRE, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_GASKET, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_RAZOR, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_FLO, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_GUMPY, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_LARRY, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_COUGER, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_NUMB, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_BUBBA, 0 }, + + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_1, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_2, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_3, 0 }, + { SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_AIM_SLANDER_4, 0 }, +}; + + +// +// Buttons +// + +// The Account Box button +void BtnAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiAccountBoxButton; +INT32 guiAccountBoxButtonImage; + +//File Box +UINT32 guiFileBoxButton; +void BtnFileBoxButtonCallback(GUI_BUTTON *btn,INT32 reason); + +// The 'X' to close the video conf window button +void BtnXToCloseMercVideoButtonCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiXToCloseMercVideoButton; +INT32 guiXToCloseMercVideoButtonImage; + + +//Mouse region for the subtitles region when the merc is talking +MOUSE_REGION gMercSiteSubTitleMouseRegion; +void MercSiteSubTitleRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + + + + +//******************************* +// +// Function Prototypes +// +//******************************* + +BOOLEAN StartSpeckTalking(UINT16 usQuoteNum); +void InitMercVideoFace(); +BOOLEAN HandleSpeckTalking( BOOLEAN fReset ); +//BOOLEAN PixelateVideoMercImage(); +BOOLEAN PixelateVideoMercImage( BOOLEAN fUp, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight); +BOOLEAN InitDestroyXToCloseVideoWindow( BOOLEAN fCreate ); +BOOLEAN DisplayMercVideoIntro( UINT16 usTimeTillFinish ); +void HandleCurrentMercDistortion(); +void HandleTalkingSpeck(); +//BOOLEAN DistortVideoMercImage(); +BOOLEAN DistortVideoMercImage( UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight ); +BOOLEAN IsAnyMercMercsHired( ); +BOOLEAN IsAnyMercMercsDead(); +UINT8 CountNumberOfMercMercsHired(); +UINT8 CountNumberOfMercMercsWhoAreDead(); +BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ); +void RemoveSpeckPopupTextBox(); +BOOLEAN ShouldSpeckStartTalkingDueToActionOnSubPage(); +BOOLEAN ShouldSpeckSayAQuote(); +void HandleSpeckIdleConversation( BOOLEAN fReset ); +INT16 GetRandomQuoteThatHasBeenSaidTheLeast( ); +void StopSpeckFromTalking( ); +BOOLEAN HasLarryRelapsed(); +void IncreaseMercRandomQuoteValue( UINT8 ubQuoteID, UINT8 ubValue ); +BOOLEAN ShouldTheMercSiteServerGoDown(); +void DrawMercVideoBackGround(); +BOOLEAN CanMercQuoteBeSaid( UINT32 uiQuoteID ); +UINT8 NumberOfMercMercsDead(); +void MakeBiffAwayForCoupleOfDays(); +BOOLEAN AreAnyOfTheNewMercsAvailable(); +void ShouldAnyNewMercMercBecomeAvailable(); +BOOLEAN CanMercBeAvailableYet( UINT8 ubMercToCheck ); +UINT32 CalcMercDaysServed(); +//ppp + + + +void GameInitMercs() +{ +// for(i=0; iuiFlags |= BUTTON_FORCE_UNDIRTY; + + RenderMercPopUpBoxFromIndex( iMercPopUpBox, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, FRAME_BUFFER); + } + + MarkButtonsDirty( ); + RenderWWWProgramTitleBar( ); + + //if the page is redrawn, and we are in video conferencing, redraw the VC backgrund graphic + gfMercSiteScreenIsReDrawn = TRUE; + + ButtonList[ guiAccountBoxButton ]->uiFlags &= ~BUTTON_FORCE_UNDIRTY; + + InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); +} + + +BOOLEAN InitMercBackGround() +{ + VOBJECT_DESC VObjectDesc; + + // load the Merc background graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\MERCBackGround.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiMercBackGround)); + + return(TRUE); +} + + +BOOLEAN DrawMecBackGround() +{ + WebPageTileBackground(4, 4, MERC_BACKGROUND_WIDTH, MERC_BACKGROUND_HEIGHT, guiMercBackGround); + return(TRUE); +} + + +BOOLEAN RemoveMercBackGround() +{ + DeleteVideoObjectFromIndex(guiMercBackGround); + + return(TRUE); +} + + + + +void BtnAccountBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + if( LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_NO_ACCOUNT ) + guiCurrentLaptopMode = LAPTOP_MODE_MERC_NO_ACCOUNT; + else + guiCurrentLaptopMode = LAPTOP_MODE_MERC_ACCOUNT; + + if( iMercPopUpBox != -1 ) + { + ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + + RenderMercPopUpBoxFromIndex( iMercPopUpBox, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, FRAME_BUFFER); + } + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnFileBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + guiCurrentLaptopMode = LAPTOP_MODE_MERC_FILES; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void DailyUpdateOfMercSite( UINT16 usDate) +{ + SOLDIERTYPE *pSoldier; + INT16 sSoldierID, i; + UINT8 ubMercID; + INT32 iNumDays; + BOOLEAN fAlreadySentEmailToPlayerThisTurn = FALSE; + + //if its the first day, leave + if( usDate == 1 ) + return; + + iNumDays = 0; + + //loop through all of the hired mercs from M.E.R.C. + for(i=0; iubProfile ) ) + { + gMercProfiles[ pSoldier->ubProfile ].iMercMercContractLength += 1; +// pSoldier->iTotalContractLength++; + } + + //Get the longest time + if( gMercProfiles[ pSoldier->ubProfile ].iMercMercContractLength > iNumDays ) + iNumDays = gMercProfiles[ pSoldier->ubProfile ].iMercMercContractLength; + } + } + + //if the players hasnt paid for a while, get email him to tell him to pay + //iTotalContractLength + if( iNumDays > MERC_NUM_DAYS_TILL_ACCOUNT_INVALID ) + { + if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_INVALID ) + { + LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_INVALID; + AddEmail( MERC_INVALID, MERC_INVALID_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + } + } + else if( iNumDays > MERC_NUM_DAYS_TILL_ACCOUNT_SUSPENDED ) + { + if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_SUSPENDED ) + { + LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_SUSPENDED; + AddEmail( MERC_WARNING, MERC_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + + // Have speck complain next time player come to site + LaptopSaveInfo.uiSpeckQuoteFlags |= SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT; + } + } + else if( iNumDays > MERC_NUM_DAYS_TILL_FIRST_WARNING) + { + if( LaptopSaveInfo.gubPlayersMercAccountStatus != MERC_ACCOUNT_VALID_FIRST_WARNING ) + { + LaptopSaveInfo.gubPlayersMercAccountStatus = MERC_ACCOUNT_VALID_FIRST_WARNING; + AddEmail( MERC_FIRST_WARNING, MERC_FIRST_WARNING_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + + // Have speck complain next time player come to site + LaptopSaveInfo.uiSpeckQuoteFlags |= SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT; + } + } + + + //Check and act if any new Merc Mercs should become available + ShouldAnyNewMercMercBecomeAvailable(); + +/* + //If we should advacne the number of days that the good mercs arrive +// if( LaptopSaveInfo.guiNumberOfMercPaymentsInDays > 4 ) + { + UINT8 ubNumDays; + +// ubNumDays = (UINT8) LaptopSaveInfo.guiNumberOfMercPaymentsInDays / 4; + ubNumDays = (UINT8) LaptopSaveInfo.guiNumberOfMercPaymentsInDays; + +// LaptopSaveInfo.guiNumberOfMercPaymentsInDays = LaptopSaveInfo.guiNumberOfMercPaymentsInDays % 4; + LaptopSaveInfo.guiNumberOfMercPaymentsInDays = 0; + + //for the first merc + //if the merc is not already here + if( LaptopSaveInfo.gbNumDaysTillFirstMercArrives != -1 ) + { + //We advance the day the merc arrives on + if( LaptopSaveInfo.gbNumDaysTillFirstMercArrives > ubNumDays ) + { + LaptopSaveInfo.gbNumDaysTillFirstMercArrives -= ubNumDays; + } + else + { + //its time to add the new mercs + LaptopSaveInfo.gubLastMercIndex = NUMBER_MERCS_AFTER_FIRST_MERC_ARRIVES; + + //Set the fact that there are new mercs available + LaptopSaveInfo.fNewMercsAvailableAtMercSite = TRUE; + + //if we havent already sent an email this turn + if( !fAlreadySentEmailToPlayerThisTurn ) + { + AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + fAlreadySentEmailToPlayerThisTurn = TRUE; + } + LaptopSaveInfo.gbNumDaysTillFirstMercArrives = -1; + } + } + + + //for the Second merc + //if the merc is not already here + if( LaptopSaveInfo.gbNumDaysTillSecondMercArrives != -1 ) + { + //We advance the day the merc arrives on + if( LaptopSaveInfo.gbNumDaysTillSecondMercArrives > ubNumDays ) + { + LaptopSaveInfo.gbNumDaysTillSecondMercArrives -= ubNumDays; + } + else + { + //its time to add the new mercs + LaptopSaveInfo.gubLastMercIndex = NUMBER_MERCS_AFTER_SECOND_MERC_ARRIVES; + + //Set the fact that there are new mercs available + LaptopSaveInfo.fNewMercsAvailableAtMercSite = TRUE; + + //if we havent already sent an email this turn + if( !fAlreadySentEmailToPlayerThisTurn ) + { + AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + fAlreadySentEmailToPlayerThisTurn = TRUE; + } + LaptopSaveInfo.gbNumDaysTillSecondMercArrives = -1; + } + } + + //for the Third merc + //if the merc is not already here + if( LaptopSaveInfo.gbNumDaysTillThirdMercArrives != -1 ) + { + //We advance the day the merc arrives on + if( LaptopSaveInfo.gbNumDaysTillThirdMercArrives > ubNumDays ) + { + LaptopSaveInfo.gbNumDaysTillThirdMercArrives -= ubNumDays; + } + else + { + //its time to add the new mercs + LaptopSaveInfo.gubLastMercIndex = NUMBER_MERCS_AFTER_THIRD_MERC_ARRIVES; + + //Set the fact that there are new mercs available + LaptopSaveInfo.fNewMercsAvailableAtMercSite = TRUE; + + //if we havent already sent an email this turn + if( !fAlreadySentEmailToPlayerThisTurn ) + { + AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + fAlreadySentEmailToPlayerThisTurn = TRUE; + } + LaptopSaveInfo.gbNumDaysTillThirdMercArrives = -1; + } + } + + //for the Fourth merc + //if the merc is not already here + if( LaptopSaveInfo.gbNumDaysTillFourthMercArrives != -1 ) + { + //We advance the day the merc arrives on + if( LaptopSaveInfo.gbNumDaysTillFourthMercArrives > ubNumDays ) + { + LaptopSaveInfo.gbNumDaysTillFourthMercArrives -= ubNumDays; + } + else + { + //its time to add the new mercs + LaptopSaveInfo.gubLastMercIndex = NUMBER_MERCS_AFTER_FOURTH_MERC_ARRIVES; + + //Set the fact that there are new mercs available + LaptopSaveInfo.fNewMercsAvailableAtMercSite = TRUE; + + //if we havent already sent an email this turn + if( !fAlreadySentEmailToPlayerThisTurn ) + { + AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + fAlreadySentEmailToPlayerThisTurn = TRUE; + } + LaptopSaveInfo.gbNumDaysTillFourthMercArrives = -1; + } + } + } +*/ + + // If the merc site has never gone down, the number of MERC payment days is above 'X', + // and the players account status is ok ( cant have the merc site going down when the player owes him money, player may lose account that way ) + if( ShouldTheMercSiteServerGoDown() ) + { + UINT32 uiTimeInMinutes=0; + + + //Set the fact the site has gone down + LaptopSaveInfo.fMercSiteHasGoneDownYet = TRUE; + +//No lnger removing the bookmark, leave it up, and the user will go to the broken link page + //Remove the book mark +// RemoveBookMark( MERC_BOOKMARK ); + + //Get the site up the next day at 6:00 pm + uiTimeInMinutes = GetMidnightOfFutureDayInMinutes( 1 ) + 18 * 60; + + //Add an event that will get the site back up and running + AddStrategicEvent( EVENT_MERC_SITE_BACK_ONLINE, uiTimeInMinutes, 0 ); + } +} + + +//Gets the actual merc id from the array +UINT8 GetMercIDFromMERCArray(UINT8 ubMercID) +{ + //if it is one of the regular MERCS + if( ubMercID <= 6 ) + { + return( gubMercArray[ ubMercID ] ); + } + + //if it is Larry, determine if it Stoned larry or straight larry + else if( ( ubMercID == 7 ) || ( ubMercID == 8 ) ) + { + if ( HasLarryRelapsed() ) + { + return( gubMercArray[ 8 ] ); + } + else + { + return( gubMercArray[ 7 ] ); + } + } + + //if it is one of the newer mercs + else if( ubMercID <= LAST_MERC_ID ) + { + return( gubMercArray[ ubMercID ] ); + } + + //else its an error + else + { + Assert(0); + return( TRUE ); + } +} + + +/* +BOOLEAN InitDeleteMercVideoConferenceMode() +{ + static BOOLEAN fVideoConfModeCreated = FALSE; + + if( !fVideoConfModeCreated && gubCurrentMercVideoMode == MERC_VIDEO_INIT_VIDEO_MODE ) + { +// InitMercVideoFace(); + } + + if( fVideoConfModeCreated && gubCurrentMercVideoMode == MERC_VIDEO_EXIT_VIDEO_MODE ) + { + //If merc is talking, stop him from talking + ShutupaYoFace( giVideoSpeckFaceIndex ); + + //Delete the face + DeleteFace( giVideoSpeckFaceIndex ); + + gfMercVideoIsBeingDisplayed = FALSE; + } + + + return(TRUE); +} +*/ + +void InitMercVideoFace() +{ + //Alocates space, and loads the sti for SPECK +// giVideoSpeckFaceIndex = InternalInitFace( NO_PROFILE, NOBODY, 0, MERC_VIDEO_MERC_ID_FOR_SPECKS, 3000, 2000 ); + giVideoSpeckFaceIndex = InitFace( MERC_VIDEO_MERC_ID_FOR_SPECKS, NOBODY, 0 ); + + // Sets up the eyes blinking and the mouth moving +// InternalSetAutoFaceActive( guiMercVideoFaceBackground, FACE_AUTO_RESTORE_BUFFER , giVideoSpeckFaceIndex, 0, 0, 8, 9, 7, 25 ); + SetAutoFaceActive( guiMercVideoFaceBackground, FACE_AUTO_RESTORE_BUFFER , giVideoSpeckFaceIndex, 0, 0); + + + //Renders the face to the background + RenderAutoFace( giVideoSpeckFaceIndex ); + + //enables the global flag indicating the the video is being displayed + gfMercVideoIsBeingDisplayed = TRUE; + +} + + +BOOLEAN StartSpeckTalking(UINT16 usQuoteNum) +{ + if( usQuoteNum == MERC_VIDEO_SPECK_SPEECH_NOT_TALKING || usQuoteNum == MERC_VIDEO_SPECK_HAS_TO_TALK_BUT_QUOTE_NOT_CHOSEN_YET ) + return( FALSE ); + + //Reset the time for when speck starts to do the random quotes + HandleSpeckIdleConversation( TRUE ); + + //Start Speck talking + if(!CharacterDialogue( MERC_VIDEO_MERC_ID_FOR_SPECKS, usQuoteNum, giVideoSpeckFaceIndex, DIALOGUE_SPECK_CONTACT_PAGE_UI, FALSE, FALSE ) ) + { + Assert(0); + return(FALSE); + } + + gusMercVideoSpeckSpeech = MERC_VIDEO_SPECK_SPEECH_NOT_TALKING; + + return(TRUE); +} + +// Performs the frame by frame update +BOOLEAN HandleSpeckTalking( BOOLEAN fReset ) +{ + static BOOLEAN fWasTheMercTalking=FALSE; + BOOLEAN fIsTheMercTalking; + SGPRect SrcRect; + SGPRect DestRect; + + if( fReset ) + { + fWasTheMercTalking = FALSE; + return( TRUE ); + } + + SrcRect.iLeft = 0; + SrcRect.iTop = 0; + SrcRect.iRight = 48; + SrcRect.iBottom = 43; + + DestRect.iLeft = MERC_VIDEO_FACE_X; + DestRect.iTop = MERC_VIDEO_FACE_Y; + DestRect.iRight = DestRect.iLeft + MERC_VIDEO_FACE_WIDTH; + DestRect.iBottom = DestRect.iTop + MERC_VIDEO_FACE_HEIGHT; + + HandleDialogue(); + HandleAutoFaces( ); + HandleTalkingAutoFaces( ); + + //Blt the face surface to the video background surface + if( !BltStretchVideoSurface(FRAME_BUFFER, guiMercVideoFaceBackground, 0, 0, VO_BLT_SRCTRANSPARENCY, &SrcRect, &DestRect ) ) + return(FALSE); + + //HandleCurrentMercDistortion(); + + InvalidateRegion(MERC_VIDEO_BACKGROUND_X, MERC_VIDEO_BACKGROUND_Y, (MERC_VIDEO_BACKGROUND_X + MERC_VIDEO_BACKGROUND_WIDTH), (MERC_VIDEO_BACKGROUND_Y + MERC_VIDEO_BACKGROUND_HEIGHT) ); + + //find out if the merc just stopped talking + fIsTheMercTalking = gFacesData[ giVideoSpeckFaceIndex ].fTalking; + + //if the merc just stopped talking + if(fWasTheMercTalking && !fIsTheMercTalking) + { + fWasTheMercTalking = FALSE; + + if( DialogueQueueIsEmpty( ) ) + { + RemoveSpeckPopupTextBox(); + + gfDisplaySpeckTextBox = FALSE; + + gusMercVideoSpeckSpeech = MERC_VIDEO_SPECK_SPEECH_NOT_TALKING; + + //Reset the time for when speck starts to do the random quotes + HandleSpeckIdleConversation( TRUE ); + } + else + fIsTheMercTalking = TRUE; + } + + fWasTheMercTalking = fIsTheMercTalking; + + return(fIsTheMercTalking); +} + + +void HandleCurrentMercDistortion() +{ + static UINT8 ubCurrentMercDistortionMode = MERC_DISTORTION_NO_DISTORTION; + BOOLEAN fReturnStatus; + + //if there is no current distortion mode, randomly choose one + if( ubCurrentMercDistortionMode == MERC_DISTORTION_NO_DISTORTION ) + { + UINT8 ubRandom; + + ubRandom = (UINT8)Random(200); + + if( ubRandom < 40 ) + { + ubRandom = (UINT8)Random(100); + if( ubRandom < 10 ) + ubCurrentMercDistortionMode = MERC_DISRTORTION_DISTORT_IMAGE; + else if( ubRandom < 30 ) + ubCurrentMercDistortionMode = MERC_DISTORTION_PIXELATE_UP; + } + } + + // Perform whichever video distortion mode is current + switch( ubCurrentMercDistortionMode ) + { + case MERC_DISTORTION_NO_DISTORTION: + break; + + case MERC_DISTORTION_PIXELATE_UP: +// fReturnStatus = PixelateVideoMercImage( TRUE ); + fReturnStatus = PixelateVideoMercImage( TRUE, MERC_VIDEO_FACE_X, MERC_VIDEO_FACE_Y, MERC_VIDEO_FACE_WIDTH, MERC_VIDEO_FACE_HEIGHT ); + if( fReturnStatus ) + ubCurrentMercDistortionMode = MERC_DISTORTION_PIXELATE_DOWN; + break; + + case MERC_DISTORTION_PIXELATE_DOWN: +// fReturnStatus = PixelateVideoMercImage( FALSE ); + fReturnStatus = PixelateVideoMercImage( FALSE, MERC_VIDEO_FACE_X, MERC_VIDEO_FACE_Y, MERC_VIDEO_FACE_WIDTH, MERC_VIDEO_FACE_HEIGHT ); + if( fReturnStatus ) + ubCurrentMercDistortionMode = MERC_DISTORTION_NO_DISTORTION; + break; + + case MERC_DISRTORTION_DISTORT_IMAGE: +// fReturnStatus = DistortVideoMercImage(); + fReturnStatus = DistortVideoMercImage( MERC_VIDEO_FACE_X, MERC_VIDEO_FACE_Y, MERC_VIDEO_FACE_WIDTH, MERC_VIDEO_FACE_HEIGHT ); + + if( fReturnStatus ) + ubCurrentMercDistortionMode = MERC_DISTORTION_NO_DISTORTION; + break; + } +} + + +BOOLEAN PixelateVideoMercImage( BOOLEAN fUp, UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT16 usHeight) +{ + static UINT32 uiLastTime; + UINT32 uiCurTime = GetJA2Clock(); + UINT16 *pBuffer=NULL, DestColor; + UINT32 uiPitch; + UINT16 i, j; + static UINT8 ubPixelationAmount=255; + BOOLEAN fReturnStatus=FALSE; + i=0; + + pBuffer = (UINT16*)LockVideoSurface( FRAME_BUFFER, &uiPitch ); + Assert( pBuffer ); + + if( ubPixelationAmount == 255 ) + { + if( fUp ) + ubPixelationAmount = 1; + else + ubPixelationAmount = 4; + uiLastTime = GetJA2Clock(); + } + + //is it time to change the animation + if( ( uiCurTime - uiLastTime ) > 100 ) + { + //if we are starting to pixelate the image + if( fUp ) + { + //the varying degrees of pixelation + if( ubPixelationAmount <= 4 ) + { + ubPixelationAmount++; + fReturnStatus = FALSE; + } + else + { + ubPixelationAmount = 255; + fReturnStatus = TRUE; + } + } + //else we are pixelating down + else + { + if( ubPixelationAmount > 1 ) + { + ubPixelationAmount--; + fReturnStatus = FALSE; + } + else + { + ubPixelationAmount = 255; + fReturnStatus = TRUE; + } + } + uiLastTime = GetJA2Clock(); + } + else + i=i; + + uiPitch /= 2; + i=j=0; + DestColor = pBuffer[ (j*uiPitch) + i ]; + + for(j=usPosY; j= usPosY+usHeight ) + { + usDistortionValue = 0; + uiReturnValue = TRUE; + } + else + { + usDistortionValue++; + + uiReturnValue = FALSE; + + + if( usDistortionValue + 10 >= usHeight ) + usEndOnLine = usHeight-1; + else + usEndOnLine = usDistortionValue + 10; + + + for(j=usPosY+usDistortionValue; j> 8); + blue = (UINT8)(uiColor >> 16); + + DestColor = Get16BPPColor(FROMRGB( 255-red, 250-green, 250-blue) ); + + pBuffer[ (j*uiPitch) + i ] = DestColor; + } + } + } + UnLockVideoSurface( FRAME_BUFFER ); + + return(uiReturnValue); +} + + + + +BOOLEAN InitDestroyXToCloseVideoWindow( BOOLEAN fCreate ) +{ + static BOOLEAN fButtonCreated=FALSE; + + //if we are asked to create the buttons and the button isnt already created + if( fCreate && !fButtonCreated ) + { + guiXToCloseMercVideoButtonImage = LoadButtonImage("LAPTOP\\CloseButton.sti", -1,0,-1,1,-1 ); + + guiXToCloseMercVideoButton = QuickCreateButton( guiXToCloseMercVideoButtonImage, MERC_X_TO_CLOSE_VIDEO_X, MERC_X_TO_CLOSE_VIDEO_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnXToCloseMercVideoButtonCallback); + SetButtonCursor(guiXToCloseMercVideoButton, CURSOR_LAPTOP_SCREEN); + + fButtonCreated = TRUE; + } + + //if we are asked to destroy the buttons and the buttons are created + if( !fCreate && fButtonCreated ) + { + UnloadButtonImage( guiXToCloseMercVideoButtonImage ); + RemoveButton( guiXToCloseMercVideoButton ); + fButtonCreated = FALSE; + } + + return(TRUE); +} + + +void BtnXToCloseMercVideoButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //Stop speck from talking +// ShutupaYoFace( giVideoSpeckFaceIndex ); + StopSpeckFromTalking( ); + + //make sure we are done the intro speech + gfDoneIntroSpeech = TRUE; + + //remove the video conf mode + gubCurrentMercVideoMode = MERC_VIDEO_EXIT_VIDEO_MODE; + + gusMercVideoSpeckSpeech = MERC_VIDEO_SPECK_SPEECH_NOT_TALKING; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +BOOLEAN DisplayMercVideoIntro( UINT16 usTimeTillFinish ) +{ + UINT32 uiCurTime = GetJA2Clock(); + static UINT32 uiLastTime=0; + + //init variable + if( uiLastTime == 0 ) + uiLastTime = uiCurTime; + + + ColorFillVideoSurfaceArea( FRAME_BUFFER, MERC_VIDEO_FACE_X, MERC_VIDEO_FACE_Y, MERC_VIDEO_FACE_X+MERC_VIDEO_FACE_WIDTH, MERC_VIDEO_FACE_Y+MERC_VIDEO_FACE_HEIGHT, Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); + + //if the intro is done + if( (uiCurTime - uiLastTime) > usTimeTillFinish ) + { + uiLastTime = 0; + return(TRUE); + } + else + return(FALSE); +} + + +void HandleTalkingSpeck() +{ + BOOLEAN fIsSpeckTalking = TRUE; + + switch( gubCurrentMercVideoMode ) + { + //Init the video conferencing + case MERC_VIDEO_INIT_VIDEO_MODE: + //perform some opening animation. When its done start Speck talking + + //if the intro is finished + if( DisplayMercVideoIntro( MERC_INTRO_TIME ) ) + { + //NULL out the string + gsSpeckDialogueTextPopUp[0] = '\0'; + + //Start speck talking + if( gusMercVideoSpeckSpeech != MERC_VIDEO_SPECK_SPEECH_NOT_TALKING || gusMercVideoSpeckSpeech != MERC_VIDEO_SPECK_HAS_TO_TALK_BUT_QUOTE_NOT_CHOSEN_YET ) + StartSpeckTalking( gusMercVideoSpeckSpeech ); + + gusMercVideoSpeckSpeech = MERC_VIDEO_SPECK_SPEECH_NOT_TALKING; + gubCurrentMercVideoMode = MERC_VIDEO_VIDEO_MODE; + } + break; + + //Display his talking and blinking face + case MERC_VIDEO_VIDEO_MODE: + + //Make sure the accounts button does not overwrite the dialog text +// ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + //def: + + if( gfJustEnteredMercSite && gubArrivedFromMercSubSite != MERC_CAME_FROM_OTHER_PAGE || gfFirstTimeIntoMERCSiteSinceEnteringLaptop ) + { + gfFirstTimeIntoMERCSiteSinceEnteringLaptop = FALSE; + GetSpeckConditionalOpening( FALSE ); + gfJustEnteredMercSite = FALSE; + } + else + { + fIsSpeckTalking = HandleSpeckTalking( FALSE ); + + if( !fIsSpeckTalking ) + fIsSpeckTalking = GetSpeckConditionalOpening( FALSE ); + + //if speck didnt start talking, see if he just hired someone + if( !fIsSpeckTalking ) + { + fIsSpeckTalking = ShouldSpeckStartTalkingDueToActionOnSubPage(); + } + } + + if( !fIsSpeckTalking ) + gubCurrentMercVideoMode = MERC_VIDEO_EXIT_VIDEO_MODE; + + if( gfDisplaySpeckTextBox && gGameSettings.fOptions[ TOPTION_SUBTITLES ] ) + { + if( !gfInMercSite ) + { + StopSpeckFromTalking( ); + return; + } + + + if( gsSpeckDialogueTextPopUp[0] != L'\0' ) + { +// DrawButton( guiAccountBoxButton ); +// ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + + if( iMercPopUpBox != -1 ) + { + DrawButton( guiAccountBoxButton ); + ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + + RenderMercPopUpBoxFromIndex( iMercPopUpBox, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, FRAME_BUFFER); + } + } + } + + break; + + // shut down the video conferencing + case MERC_VIDEO_EXIT_VIDEO_MODE: + + //if the exit animation is finished, exit the video conf window + if( DisplayMercVideoIntro( MERC_EXIT_TIME ) ) + { + StopSpeckFromTalking( ); + + //Delete the face + DeleteFace( giVideoSpeckFaceIndex ); + InitDestroyXToCloseVideoWindow( FALSE ); + + gfRedrawMercSite = TRUE; + gfMercVideoIsBeingDisplayed = FALSE; + + //Remove the merc popup + RemoveSpeckPopupTextBox(); + + //maybe display ending animation + gubCurrentMercVideoMode = MERC_VIDEO_NO_VIDEO_MODE; + } + else + { + //else we are done the exit animation. The area is not being invalidated anymore + InvalidateRegion( MERC_VIDEO_FACE_X, MERC_VIDEO_FACE_Y, MERC_VIDEO_FACE_X+MERC_VIDEO_FACE_WIDTH, MERC_VIDEO_FACE_Y+MERC_VIDEO_FACE_HEIGHT ); + } + break; + } +} + +void DisplayTextForSpeckVideoPopUp(INT16 * pString) +{ + UINT16 usActualHeight; + INT32 iOldMercPopUpBoxId = iMercPopUpBox; + + //If the user has selected no subtitles + if( !gGameSettings.fOptions[ TOPTION_SUBTITLES ] ) + return; + +// wcscpy(gsSpeckDialogueTextPopUp, pString); + //add the "" around the speech. +#ifdef TAIWANESE + swprintf( gsSpeckDialogueTextPopUp, L"%s", pString ); +#else + swprintf( gsSpeckDialogueTextPopUp, L"\"%s\"", pString ); +#endif + + gfDisplaySpeckTextBox = TRUE; + + //Set this so the popup box doesnt render in RenderMercs() + iMercPopUpBox = -1; + + //Render the screen to get rid of any old text popup boxes + RenderMercs(); + + iMercPopUpBox = iOldMercPopUpBoxId; + + if( gfMercVideoIsBeingDisplayed && gfMercSiteScreenIsReDrawn ) + { + DrawMercVideoBackGround(); + } + + //Create the popup box + SET_USE_WINFONTS( TRUE ); + SET_WINFONT( giSubTitleWinFont ); + iMercPopUpBox = PrepareMercPopupBox( iMercPopUpBox, BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, gsSpeckDialogueTextPopUp, 300, 0, 0, 0, &gusSpeckDialogueActualWidth, &usActualHeight); + SET_USE_WINFONTS( FALSE ); + + gusSpeckDialogueX = iScreenWidthOffset + 111 + ((640 - 111) / 2 - (gusSpeckDialogueActualWidth / 2)); + + //Render the pop box + RenderMercPopUpBoxFromIndex( iMercPopUpBox, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, FRAME_BUFFER); + + //check to make sure the region is not already initialized + if( !( gMercSiteSubTitleMouseRegion.uiFlags & MSYS_REGION_EXISTS ) ) + { + MSYS_DefineRegion( &gMercSiteSubTitleMouseRegion, gusSpeckDialogueX, MERC_TEXT_BOX_POS_Y, (INT16)(gusSpeckDialogueX + gusSpeckDialogueActualWidth), (INT16)(MERC_TEXT_BOX_POS_Y + usActualHeight), MSYS_PRIORITY_HIGH, + CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, MercSiteSubTitleRegionCallBack ); + MSYS_AddRegion( &gMercSiteSubTitleMouseRegion ); + } +} + + + +void CheatToGetAll5Merc() +{ + LaptopSaveInfo.guiNumberOfMercPaymentsInDays += 20; + +/* + LaptopSaveInfo.gbNumDaysTillFirstMercArrives = 1; + LaptopSaveInfo.gbNumDaysTillSecondMercArrives = 1; + LaptopSaveInfo.gbNumDaysTillThirdMercArrives = 1; + LaptopSaveInfo.gbNumDaysTillFourthMercArrives = 1; +*/ + LaptopSaveInfo.gubLastMercIndex = NUMBER_MERCS_AFTER_FOURTH_MERC_ARRIVES; +} + + +BOOLEAN GetSpeckConditionalOpening( BOOLEAN fJustEnteredScreen ) +{ + static UINT16 usQuoteToSay=MERC_VIDEO_SPECK_SPEECH_NOT_TALKING; + UINT8 ubRandom=0; + UINT8 ubCnt; + BOOLEAN fCanSayLackOfPaymentQuote = TRUE; + BOOLEAN fCanUseIdleTag = FALSE; + + //If we just entered the screen, reset some variables + if( fJustEnteredScreen ) + { + gfDoneIntroSpeech = FALSE; + usQuoteToSay = 0; + return( FALSE ); + } + + //if we are done the intro speech, or arrived from a sub page, get out of the function + if( gfDoneIntroSpeech || gubArrivedFromMercSubSite != MERC_CAME_FROM_OTHER_PAGE ) + { + return( FALSE ); + } + + gfDoneIntroSpeech = TRUE; + + //set the opening quote based on if the player has been here before + if( LaptopSaveInfo.ubPlayerBeenToMercSiteStatus == MERC_SITE_FIRST_VISIT && usQuoteToSay <= 8 ) //!= 0 ) + { + StartSpeckTalking( usQuoteToSay ); + usQuoteToSay++; + if( usQuoteToSay <= 8 ) + gfDoneIntroSpeech = FALSE; + } + + //if its the players second visit + else if( LaptopSaveInfo.ubPlayerBeenToMercSiteStatus == MERC_SITE_SECOND_VISIT ) + { + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_1_TOUGH_START ); + fCanUseIdleTag = TRUE; + } + + // We have been here at least 2 times before, Check which quote we should use + else + { + //if the player has not hired any MERC mercs before + // CJC Dec 1 2002: fixing this, so near-bankrupt msg will play + if( !IsAnyMercMercsHired( ) && CalcMercDaysServed() == 0) + { + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_2_BUSINESS_BAD ); + } + + //else if it is the first visit since the server went down + else if( LaptopSaveInfo.fFirstVisitSinceServerWentDown == TRUE ) + { + LaptopSaveInfo.fFirstVisitSinceServerWentDown = 2; + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_9_FIRST_VISIT_SINCE_SERVER_WENT_DOWN ); + fCanUseIdleTag = TRUE; + } +/* + //else if new mercs are available + else if( LaptopSaveInfo.fNewMercsAvailableAtMercSite ) + { + LaptopSaveInfo.fNewMercsAvailableAtMercSite = FALSE; + + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_11_NEW_MERCS_AVAILABLE ); + } +*/ + //else if lots of MERC mercs are DEAD, and speck can say the quote ( dont want him to continously say it ) + else if( CountNumberOfMercMercsWhoAreDead() >= 2 && LaptopSaveInfo.ubSpeckCanSayPlayersLostQuote ) + { + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_12_PLAYERS_LOST_MERCS ); + + //Set it so speck Wont say the quote again till someone else dies + LaptopSaveInfo.ubSpeckCanSayPlayersLostQuote = 0; + } + + //else if player owes lots of money + else if( LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_SUSPENDED ) + { + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_5_PLAYER_OWES_SPECK_ACCOUNT_SUSPENDED ); + + fCanSayLackOfPaymentQuote = FALSE; + } + + //else if the player owes speck a large sum of money, have speck say so + else if( CalculateHowMuchPlayerOwesSpeck() > 5000 ) + { + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_6_PLAYER_OWES_SPECK_ALMOST_BANKRUPT_1 ); + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_6_PLAYER_OWES_SPECK_ALMOST_BANKRUPT_2 ); + + fCanSayLackOfPaymentQuote = FALSE; + } + + else + { + UINT8 ubNumMercsDead = NumberOfMercMercsDead(); + UINT8 ubRandom = ( UINT8 ) Random( 100 ); + + //if business is good +// if( ubRandom < 40 && ubNumMercsDead < 2 && CountNumberOfMercMercsHired() > 1 ) + if( ubRandom < 40 && AreAnyOfTheNewMercsAvailable() && CountNumberOfMercMercsHired() > 1 ) + { + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_3_BUSINESS_GOOD ); + fCanUseIdleTag = TRUE; + } + + //or if still trying to recruit ( the last recruit hasnt arrived and the player has paid for some of his mercs ) +// else if( ubRandom < 80 && LaptopSaveInfo.gbNumDaysTillFourthMercArrives != -1 && LaptopSaveInfo.gbNumDaysTillFirstMercArrives < MERC_NUM_DAYS_TILL_FIRST_MERC_AVAILABLE ) + else if( ubRandom < 80 && gConditionsForMercAvailability[ LaptopSaveInfo.ubLastMercAvailableId ].usMoneyPaid <= LaptopSaveInfo.uiTotalMoneyPaidToSpeck && CanMercBeAvailableYet( LaptopSaveInfo.ubLastMercAvailableId ) ) + { + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_4_TRYING_TO_RECRUIT ); + fCanUseIdleTag = TRUE; + } + + //else use the generic opening + else + { + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_10_GENERIC_OPENING ); + fCanUseIdleTag = TRUE; + + //if the merc hasnt said the line before + if( !LaptopSaveInfo.fSaidGenericOpeningInMercSite ) + { + LaptopSaveInfo.fSaidGenericOpeningInMercSite = TRUE; + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_10_TAG_FOR_20 ); + } + } + } + + if( fCanUseIdleTag ) + { + UINT8 ubRandom = Random( 100 ); + + if( ubRandom < 50 ) + { + ubRandom = Random( 4 ); + + switch( ubRandom ) + { + case 0: + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_1 ); + break; + case 1: + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_2 ); + break; + case 2: + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_3 ); + break; + case 3: + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_TAG_ON_AFTER_OTHER_TAGS_4 ); + break; + default: + Assert( 0 ); + } + } + } + } + + + //If Speck has sent an email to the player, and the player still hasnt paid, has speck complain about it. + // CJC Dec 1 2002 ACTUALLY HOOKED IN THAT CHECK + if (fCanSayLackOfPaymentQuote) + { + if( LaptopSaveInfo.uiSpeckQuoteFlags & SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT ) + { + LaptopSaveInfo.uiSpeckQuoteFlags &= ~SPECK_QUOTE__SENT_EMAIL_ABOUT_LACK_OF_PAYMENT; + + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_TAG_PLAYER_OWES_MONEY ); + } + } + + //if new mercs are available + if( LaptopSaveInfo.fNewMercsAvailableAtMercSite ) + { + LaptopSaveInfo.fNewMercsAvailableAtMercSite = FALSE; + + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_11_NEW_MERCS_AVAILABLE ); + } + + //if any mercs are dead + if( IsAnyMercMercsDead() ) + { + UINT8 ubMercID; + //if no merc has died before + if( !LaptopSaveInfo.fHasAMercDiedAtMercSite ) + { + LaptopSaveInfo.fHasAMercDiedAtMercSite = TRUE; + StartSpeckTalking( SPECK_QUOTE_ALTERNATE_OPENING_TAG_FIRST_MERC_DIES ); + } + + //loop through all the mercs and see if any are dead and the quote is not said + for( ubCnt=0; ubCnt= 2000 ) + { + //determine which quote to say based on the merc that was hired + switch( ubHiredMercID ) + { + //Biff is hired + case BIFF: + //if Larry is available, advertise for larry + if( IsMercMercAvailable( LARRY_NORMAL ) || IsMercMercAvailable( LARRY_DRUNK ) ) + StartSpeckTalking( SPECK_QUOTE_PLAYERS_HIRES_BIFF_SPECK_PLUGS_LARRY ); + + //if flo is available, advertise for flo + if( IsMercMercAvailable( FLO ) ) + StartSpeckTalking( SPECK_QUOTE_PLAYERS_HIRES_BIFF_SPECK_PLUGS_FLO ); + break; + + //haywire is hired + case HAYWIRE: + //if razor is available, advertise for razor + if( IsMercMercAvailable( RAZOR ) ) + StartSpeckTalking( SPECK_QUOTE_PLAYERS_HIRES_HAYWIRE_SPECK_PLUGS_RAZOR ); + break; + + //razor is hired + case RAZOR: + //if haywire is available, advertise for haywire + if( IsMercMercAvailable( HAYWIRE ) ) + StartSpeckTalking( SPECK_QUOTE_PLAYERS_HIRES_RAZOR_SPECK_PLUGS_HAYWIRE ); + break; + + + //flo is hired + case FLO: + //if biff is available, advertise for biff + if( IsMercMercAvailable( BIFF ) ) + StartSpeckTalking( SPECK_QUOTE_PLAYERS_HIRES_FLO_SPECK_PLUGS_BIFF ); + break; + + + //larry is hired + case LARRY_NORMAL: + case LARRY_DRUNK: + //if biff is available, advertise for biff + if( IsMercMercAvailable( BIFF ) ) + StartSpeckTalking( SPECK_QUOTE_PLAYERS_HIRES_LARRY_SPECK_PLUGS_BIFF ); + break; + + //Gaston is hired + case GASTON: + //if biff is available, advertise for biff + if( IsMercMercAvailable( FLO ) ) + StartSpeckTalking( SPECK_QUOTE_PLAYER_HIRES_GASTON ); + break; + + //Stogie is hired + case STOGIE: + //if biff is available, advertise for biff + if( IsMercMercAvailable( BIFF ) ) + StartSpeckTalking( SPECK_QUOTE_PLAYER_HIRES_STOGIE ); + break; + + } + } + + gubArrivedFromMercSubSite = MERC_CAME_FROM_HIRE_PAGE; +} + + +BOOLEAN IsMercMercAvailable( UINT8 ubMercID ) +{ + UINT8 cnt; + + //loop through the array of mercs + for( cnt=0; cnt 50 ) + StartSpeckTalking( SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_1 ); + else + StartSpeckTalking( SPECK_QUOTE_GENERIC_THANKS_FOR_HIRING_MERCS_2 ); + + gfJustHiredAMercMerc = FALSE; +// gfDoneIntroSpeech = TRUE; + + return( TRUE ); + } + + + + return( FALSE ); +} + + + +BOOLEAN ShouldSpeckSayAQuote() +{ + //if we are entering from anywhere except a sub page, and we should say the opening quote + if( gfJustEnteredMercSite && gubArrivedFromMercSubSite == MERC_CAME_FROM_OTHER_PAGE ) + { + //if the merc has something to say + if( gusMercVideoSpeckSpeech != MERC_VIDEO_SPECK_SPEECH_NOT_TALKING ) + return( FALSE ); + } + + + //if the player just hired a merc + if( gfJustHiredAMercMerc ) + { + gusMercVideoSpeckSpeech = MERC_VIDEO_SPECK_HAS_TO_TALK_BUT_QUOTE_NOT_CHOSEN_YET; + return( TRUE ); + +/* + //if the merc has something to say + if( gusMercVideoSpeckSpeech != MERC_VIDEO_SPECK_SPEECH_NOT_TALKING ) + return( TRUE ); + else + { + gusMercVideoSpeckSpeech = MERC_VIDEO_SPECK_HAS_TO_TALK_BUT_QUOTE_NOT_CHOSEN_YET; + return( TRUE ); + } +*/ + } + + //If it is the first time into the merc site + if( gfFirstTimeIntoMERCSiteSinceEnteringLaptop ) + { +// gfFirstTimeIntoMERCSiteSinceEnteringLaptop = FALSE; + gusMercVideoSpeckSpeech = MERC_VIDEO_SPECK_HAS_TO_TALK_BUT_QUOTE_NOT_CHOSEN_YET; + return( TRUE ); + } + +/* + //if we are entering from anywhere except a sub page + if( gubArrivedFromMercSubSite == MERC_CAME_FROM_OTHER_PAGE ) + { + GetSpeckConditionalOpening( FALSE ); + return( TRUE ); + } +*/ + return( FALSE ); +} + +void HandleSpeckIdleConversation( BOOLEAN fReset ) +{ + static UINT32 uiLastTime=0; + UINT32 uiCurTime = GetJA2Clock(); + INT16 sLeastSaidQuote; + + //if we should reset the variables + if( fReset ) + { + uiLastTime = GetJA2Clock(); + return; + } + + + + if( ( uiCurTime - uiLastTime ) > SPECK_IDLE_CHAT_DELAY ) + { + + //if Speck is not talking + if( !gfMercVideoIsBeingDisplayed ) + { + sLeastSaidQuote = GetRandomQuoteThatHasBeenSaidTheLeast( ); + + if( sLeastSaidQuote != -1 ) + gusMercVideoSpeckSpeech = (UINT8)sLeastSaidQuote; + + //Say the aim slander quotes the least + if( sLeastSaidQuote >= 47 && sLeastSaidQuote <= 57 ) + { + IncreaseMercRandomQuoteValue( (UINT8)sLeastSaidQuote, 1 ); + } + else if( sLeastSaidQuote != -1 ) + IncreaseMercRandomQuoteValue( (UINT8)sLeastSaidQuote, 3 ); + } + + uiLastTime = GetJA2Clock(); + } +} + + + +INT16 GetRandomQuoteThatHasBeenSaidTheLeast( ) +{ + UINT8 cnt; + INT16 sSmallestNumber=255; + + for( cnt=0; cnt 255 ) + gNumberOfTimesQuoteSaid[ cnt ].uiNumberOfTimesQuoteSaid = 255; + else + gNumberOfTimesQuoteSaid[ cnt ].uiNumberOfTimesQuoteSaid += ubValue; + break; + } + } +} + + +void StopSpeckFromTalking( ) +{ + if( giVideoSpeckFaceIndex == -1 ) + return; + + //Stop speck from talking + ShutupaYoFace( giVideoSpeckFaceIndex ); + + RemoveSpeckPopupTextBox(); + + gusMercVideoSpeckSpeech = MERC_VIDEO_SPECK_SPEECH_NOT_TALKING; +} + +BOOLEAN HasLarryRelapsed() +{ + return( CheckFact( FACT_LARRY_CHANGED, 0 ) ); +} + + +//Gets Called on each enter into laptop. +void EnterInitMercSite() +{ + gfFirstTimeIntoMERCSiteSinceEnteringLaptop = TRUE; + gubCurMercIndex = 0; +} + + + +BOOLEAN ShouldTheMercSiteServerGoDown() +{ + UINT32 uiDay = GetWorldDay(); + + // If the merc site has never gone down, the first new merc has shown ( which shows the player is using the site ), + // and the players account status is ok ( cant have the merc site going down when the player owes him money, player may lose account that way ) +// if( !LaptopSaveInfo.fMercSiteHasGoneDownYet && LaptopSaveInfo.gbNumDaysTillThirdMercArrives <= 6 && LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_VALID ) + if( !LaptopSaveInfo.fMercSiteHasGoneDownYet && LaptopSaveInfo.ubLastMercAvailableId >= 1 && LaptopSaveInfo.gubPlayersMercAccountStatus == MERC_ACCOUNT_VALID ) + { + if( Random( 100 ) < ( uiDay * 2 + 10 ) ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } + } + + return( FALSE ); +} + + +void GetMercSiteBackOnline() +{ + //Add an email telling the user the site is back up + AddEmail( MERC_NEW_SITE_ADDRESS, MERC_NEW_SITE_ADDRESS_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin() ); + + //Set a flag indicating that the server just went up ( so speck can make a comment when the player next visits the site ) + LaptopSaveInfo.fFirstVisitSinceServerWentDown = TRUE; +} + +void DrawMercVideoBackGround() +{ + HVOBJECT hPixHandle; + + GetVideoObject(&hPixHandle, guiMercVideoPopupBackground); + BltVideoObject(FRAME_BUFFER, hPixHandle, 0,MERC_VIDEO_BACKGROUND_X, MERC_VIDEO_BACKGROUND_Y, VO_BLT_SRCTRANSPARENCY, NULL); + + //put the title on the window + DrawTextToScreen(MercHomePageText[MERC_SPECK_COM], MERC_X_VIDEO_TITLE_X, MERC_X_VIDEO_TITLE_Y, 0, MERC_VIDEO_TITLE_FONT, MERC_VIDEO_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + InvalidateRegion(MERC_VIDEO_BACKGROUND_X, MERC_VIDEO_BACKGROUND_Y, (MERC_VIDEO_BACKGROUND_X + MERC_VIDEO_BACKGROUND_WIDTH), (MERC_VIDEO_BACKGROUND_Y + MERC_VIDEO_BACKGROUND_HEIGHT) ); +} + +void DisableMercSiteButton() +{ + if( iMercPopUpBox != -1 ) + { + ButtonList[ guiAccountBoxButton ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + } +} + +BOOLEAN CanMercQuoteBeSaid( UINT32 uiQuoteID ) +{ + BOOLEAN fRetVal = TRUE; + + //switch onb the quote being said, if hes plugging a merc that has already been hired, dont say it + switch( uiQuoteID ) + { + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_BIFF: + if( !IsMercMercAvailable( BIFF ) ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_HAYWIRE: + if( !IsMercMercAvailable( HAYWIRE ) ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_GASKET: + if( !IsMercMercAvailable( GASKET ) ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_RAZOR: + if( !IsMercMercAvailable( RAZOR ) ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_FLO: + if( !IsMercMercAvailable( FLO ) ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_GUMPY: + if( !IsMercMercAvailable( GUMPY ) ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_LARRY: + if( !IsMercMercAvailable( LARRY_NORMAL ) || IsMercMercAvailable( LARRY_DRUNK ) ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_COUGER: + if( !IsMercMercAvailable( COUGAR ) ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_NUMB: + if( !IsMercMercAvailable( NUMB ) ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_PLAYER_NOT_DOING_ANYTHING_SPECK_SELLS_BUBBA: + if( !IsMercMercAvailable( BUBBA ) ) + fRetVal = FALSE; + break; + case SPECK_QUOTE_ADVERTISE_GASTON: + if( !IsMercMercAvailable( GASTON ) ) + fRetVal = FALSE; + break; + + case SPECK_QUOTE_ADVERTISE_STOGIE: + if( !IsMercMercAvailable( STOGIE ) ) + fRetVal = FALSE; + break; + } + + + return( fRetVal ); +} + + +void InitializeNumDaysMercArrive() +{ +/* + LaptopSaveInfo.gbNumDaysTillFirstMercArrives = MERC_NUM_DAYS_TILL_FIRST_MERC_AVAILABLE; + LaptopSaveInfo.gbNumDaysTillSecondMercArrives = MERC_NUM_DAYS_TILL_SECOND_MERC_AVAILABLE; + LaptopSaveInfo.gbNumDaysTillThirdMercArrives = MERC_NUM_DAYS_TILL_THIRD_MERC_AVAILABLE; + LaptopSaveInfo.gbNumDaysTillFourthMercArrives = MERC_NUM_DAYS_TILL_FOURTH_MERC_AVAILABLE; +*/ +} + + +void MakeBiffAwayForCoupleOfDays() +{ + gMercProfiles[ BIFF ].uiDayBecomesAvailable = Random( 2 ) + 2; +} + + +BOOLEAN AreAnyOfTheNewMercsAvailable() +{ + UINT8 i; + UINT8 ubMercID; + + + if( LaptopSaveInfo.fNewMercsAvailableAtMercSite ) + return( FALSE ); + + for(i=(LARRY_NORMAL-BIFF); i<=LaptopSaveInfo.gubLastMercIndex; i++) + { + ubMercID = GetMercIDFromMERCArray( i ); + + if( IsMercMercAvailable( ubMercID ) ) + return( TRUE ); + } + + return( FALSE ); +} + +void ShouldAnyNewMercMercBecomeAvailable() +{ + BOOLEAN fNewMercAreAvailable = FALSE; + + //Kaiden: Added this if test to make sure that the "New Mercs Available" + // e-mail doesn't show up and no unneccessary checks are made when you + // have the ALL_MERCS_AT_MERC set to TRUE in the INI file. + if(!gGameExternalOptions.fAllMercsAvailable) + { + //for bubba + // if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == GUMPY ) + { + if( CanMercBeAvailableYet( MERC_ARRIVES_BUBBA ) ) + { + fNewMercAreAvailable = TRUE; + } + } + + //for Larry + // if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == LARRY_NORMAL || + // GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == LARRY_DRUNK ) + { + if( CanMercBeAvailableYet( MERC_ARRIVES_LARRY ) ) + { + fNewMercAreAvailable = TRUE; + } + } + + //for Numb + // if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == NUMB ) + { + if( CanMercBeAvailableYet( MERC_ARRIVES_NUMB ) ) + { + fNewMercAreAvailable = TRUE; + } + } + + if( CanMercBeAvailableYet( MERC_ARRIVES_TEX ) ) + { + fNewMercAreAvailable = TRUE; + } + + if( CanMercBeAvailableYet( MERC_ARRIVES_BIGGENS ) ) + { + fNewMercAreAvailable = TRUE; + } + + //for COUGAR + // if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == COUGAR ) + { + if( CanMercBeAvailableYet( MERC_ARRIVES_COUGAR ) ) + { + fNewMercAreAvailable = TRUE; + } + } + + if( CanMercBeAvailableYet( MERC_ARRIVES_GASTON ) ) + { + fNewMercAreAvailable = TRUE; + } + + if( CanMercBeAvailableYet( MERC_ARRIVES_STOGIE ) ) + { + fNewMercAreAvailable = TRUE; + } + + //if there is a new merc available + if( fNewMercAreAvailable ) + { + //Set up an event to add the merc in x days + AddStrategicEvent( EVENT_MERC_SITE_NEW_MERC_AVAILABLE, GetMidnightOfFutureDayInMinutes( 1 ) + 420 + Random( 3 * 60 ), 0 ); + } + } +} + +BOOLEAN CanMercBeAvailableYet( UINT8 ubMercToCheck ) +{ + //if the merc is already available + if( gConditionsForMercAvailability[ ubMercToCheck ].ubMercArrayID <= LaptopSaveInfo.gubLastMercIndex ) + return( FALSE ); + + //if the merc is already hired + if( !IsMercHireable( GetMercIDFromMERCArray( gConditionsForMercAvailability[ ubMercToCheck ].ubMercArrayID ) ) ) + return( FALSE ); + + //if player has paid enough money for the merc to be available, and the it is after the current day + if( gConditionsForMercAvailability[ ubMercToCheck ].usMoneyPaid <= LaptopSaveInfo.uiTotalMoneyPaidToSpeck && + gConditionsForMercAvailability[ ubMercToCheck ].usDay <= GetWorldDay() ) + { + return( TRUE ); + } + + return( FALSE ); +} + +void NewMercsAvailableAtMercSiteCallBack( ) +{ + BOOLEAN fSendEmail=FALSE; +// if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == BUBBA ) + { + if( CanMercBeAvailableYet( MERC_ARRIVES_BUBBA ) ) + { + LaptopSaveInfo.gubLastMercIndex++; + LaptopSaveInfo.ubLastMercAvailableId = MERC_ARRIVES_BUBBA; + fSendEmail = TRUE; + } + } + + //for Larry +// if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == LARRY_NORMAL || +// GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == LARRY_DRUNK ) + { + if( CanMercBeAvailableYet( MERC_ARRIVES_LARRY ) ) + { + LaptopSaveInfo.gubLastMercIndex++; + LaptopSaveInfo.ubLastMercAvailableId = MERC_ARRIVES_LARRY; + fSendEmail = TRUE; + } + } + + //for Numb +// if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == NUMB ) + { + if( CanMercBeAvailableYet( MERC_ARRIVES_NUMB ) ) + { + LaptopSaveInfo.gubLastMercIndex = 9; + LaptopSaveInfo.ubLastMercAvailableId = MERC_ARRIVES_NUMB; + fSendEmail = TRUE; + } + } + + if( CanMercBeAvailableYet( MERC_ARRIVES_TEX ) ) + { + LaptopSaveInfo.gubLastMercIndex++; + LaptopSaveInfo.ubLastMercAvailableId = MERC_ARRIVES_TEX; + fSendEmail = TRUE; + } + + if( CanMercBeAvailableYet( MERC_ARRIVES_BIGGENS ) ) + { + LaptopSaveInfo.gubLastMercIndex++; + LaptopSaveInfo.ubLastMercAvailableId = MERC_ARRIVES_BIGGENS; + fSendEmail = TRUE; + } + +//for COUGAR +// if( GetMercIDFromMERCArray( LaptopSaveInfo.gubLastMercIndex ) == COUGAR ) + { + if( CanMercBeAvailableYet( MERC_ARRIVES_COUGAR ) ) + { + LaptopSaveInfo.gubLastMercIndex++; + LaptopSaveInfo.ubLastMercAvailableId = MERC_ARRIVES_COUGAR; + fSendEmail = TRUE; + } + } + + if( CanMercBeAvailableYet( MERC_ARRIVES_GASTON ) ) + { + LaptopSaveInfo.gubLastMercIndex++; + LaptopSaveInfo.ubLastMercAvailableId = MERC_ARRIVES_GASTON; + fSendEmail = TRUE; + } + + if( CanMercBeAvailableYet( MERC_ARRIVES_STOGIE ) ) + { + LaptopSaveInfo.gubLastMercIndex++; + LaptopSaveInfo.ubLastMercAvailableId = MERC_ARRIVES_STOGIE; + fSendEmail = TRUE; + } + + if( fSendEmail ) + AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin()); + + //new mercs are available + LaptopSaveInfo.fNewMercsAvailableAtMercSite = TRUE; +} + +//used for older saves +void CalcAproximateAmountPaidToSpeck() +{ + UINT8 i, ubMercID; + + //loop through all the mercs and tally up the amount speck should have been paid + for(i=0; i 0 ) + { + iCurrentPersonSelectedId = GetIdOfFirstDisplayedMerc( ); + } + + fCreatePersonnelPortraitMouseRegions = TRUE; + + CreateDestroyMouseRegionsForPersonnelPortraits( ); + // set states of en- dis able buttons + //SetPersonnelButtonStates( ); + + fCreateRegionsForPastCurrentToggle = TRUE; + + CreateDestroyCurrentDepartedMouseRegions( ); + + // create buttons for screen + CreatePersonnelButtons( ); + + // set states of en- dis able buttons + SetPersonnelButtonStates( ); + + return; +} + +void ExitPersonnel( void ) +{ + + + if( fCurrentTeamMode == FALSE ) + { + fCurrentTeamMode = TRUE; + CreateDestroyButtonsForDepartedTeamList( ); + fCurrentTeamMode = FALSE; + } + + // get rid of atm panel buttons + fShowAtmPanelStartButton = FALSE; + fShowAtmPanel = FALSE; + fATMFlags = 0; + CreateDestroyStartATMButton( ); + CreateDestroyATMButton( ); + +// fShowInventory = FALSE; + gubPersonnelInfoState = PRSNL_STATS; + + CreateDestroyPersonnelInventoryScrollButtons( ); + + // get rid of graphics + RemovePersonnelGraphics( ); + + DeletePersonnelScreenBackgroundGraphics( ); + + CreateDestroyButtonsForPersonnelDepartures( ); + + // delete buttons + DeletePersonnelButtons( ); + + fCreatePersonnelPortraitMouseRegions = FALSE; + + // delete mouse regions + CreateDestroyMouseRegionsForPersonnelPortraits( ); + + fCreateRegionsForPastCurrentToggle = FALSE; + + CreateDestroyCurrentDepartedMouseRegions( ); + + + + return; +} + +void HandlePersonnel( void ) +{ + //RenderButtonsFastHelp( ); + CreateDestroyButtonsForPersonnelDepartures( ); + + // create / destroy buttons for scrolling departed list + CreateDestroyButtonsForDepartedTeamList( ); + + // enable / disable departures buttons + EnableDisableDeparturesButtons( ); + + // create destroy inv buttons as needed + CreateDestroyPersonnelInventoryScrollButtons( ); + + // enable disable buttons as needed + EnableDisableInventoryScrollButtons( ); + + HandlePersonnelKeyboard( ); + + // handle timed modes for ATM + HandleTimedAtmModes( ); + + return; +} + +BOOLEAN LoadPersonnelGraphics( void ) +{ + // load graphics needed for personnel screen + VOBJECT_DESC VObjectDesc; + + // load graphics + + // title bar + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\programtitlebar.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiTITLE)); + + // the background grpahics + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\personnelwindow.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSCREEN)); + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\personnel_inventory.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiPersonnelInventory)); + + return(TRUE); +} + +void RemovePersonnelGraphics( void ) +{ + // delete graphics needed for personnel screen + + DeleteVideoObjectFromIndex(guiSCREEN); + DeleteVideoObjectFromIndex(guiTITLE); + DeleteVideoObjectFromIndex(guiPersonnelInventory); + + + return; +} + +void RenderPersonnel( void ) +{ + HVOBJECT hHandle; + INT32 iCounter=0; + // re-renders personnel screen + // render main background + + // blit title + GetVideoObject(&hHandle, guiTITLE); + BltVideoObject( FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y - 2, VO_BLT_SRCTRANSPARENCY,NULL ); + + // blit screen + GetVideoObject(&hHandle, guiSCREEN); + BltVideoObject( FRAME_BUFFER, hHandle, 0,LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_UL_Y + 22, VO_BLT_SRCTRANSPARENCY,NULL ); + + // render pictures of mercs on scnree + //RenderPersonnelPictures( ); + + // display header for screen + //DisplayHeader( ); + + // what page are we on?..display it + //DrawPageNumber( ); + + // display border + //GetVideoObject(&hHandle, guiLaptopBACKGROUND); + //BltVideoObject(FRAME_BUFFER, hHandle, 0,108, 23, VO_BLT_SRCTRANSPARENCY,NULL); + + + // invalidte the region we blitted to + //InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_LR_Y); + + // render personnel screen background + RenderPersonnelScreenBackground( ); + + + + + // show team + DisplayPicturesOfCurrentTeam( ); + + DisplayPastMercsPortraits( ); + + // show selected merc + DisplayFaceOfDisplayedMerc( ); + + // show current team size + DisplayNumberOnCurrentTeam( ); + + + // show departed team size + DisplayNumberDeparted( ); + + // list stats row headers for team stats list + DisplayPersonnelTeamStats( ); + + // showinventory of selected guy if applicable + DisplayInventoryForSelectedChar( ); + + // the average stats for the current team + DisplayAverageStatValuesForCurrentTeam( ); + + // lowest stat values + DisplayLowestStatValuesForCurrentTeam( ); + + + // past team + DisplayStateOfPastTeamMembers( ); + + + + // title bar + BlitTitleBarIcons( ); + + // show text on titlebar + DisplayPersonnelTextOnTitleBar( ); + + // the highest stats + DisplayHighestStatValuesForCurrentTeam( ); + + // render the atm panel + RenderAtmPanel( ); + + DisplayAmountOnCurrentMerc( ); + + // en-dis-able start button + UpDateStateOfStartButton( ); + + return; +} + + +BOOLEAN RenderPersonnelPictures( void ) +{ + // will render portraits of personnel onscreen + // find person with iStartPersonId, unless it is -1, then find first bActive Merc on Staff + SOLDIERTYPE *pTeamSoldier, *pSoldier; + BOOLEAN fFound=FALSE; + INT32 iCounter=0; + INT32 iSlot=0; + INT32 cnt=0; + INT32 iCurrentId = 0; + + + pSoldier = MercPtrs[ cnt ]; + pTeamSoldier = pSoldier; + + + if(iStartPersonId==-1) + { + cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pSoldier++ ) + { + if ( pSoldier->bLife >= OKLIFE && pSoldier->bActive ) + { + fFound = TRUE; + iStartPersonId=cnt; + break; + } + } + if(!fFound) + return (FALSE); + } + else + { + iCurrentId=iStartPersonId; + fFound=TRUE; + cnt=iCurrentId; + } + + + + while(fFound) + { + // the soldier's ID is found + // render Face + fFound=FALSE; + RenderPersonnelFace(iCurrentId, iSlot, FALSE, FALSE, FALSE ); + // draw stats + RenderPersonnelStats(iCurrentId, iSlot); + DisplayCharName( iCurrentId, iSlot); + //find next guy + pSoldier=MercPtrs[iCurrentId]; + cnt++; + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) + { + if ( pTeamSoldier->bLife >= OKLIFE && pTeamSoldier->bActive ) + { + if( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + { + return( FALSE ); + } + + fFound = TRUE; + iSlot++; + break; + } + } + if(iSlot>=MAX_SLOTS) + fFound=FALSE; + iCurrentId=cnt; + } + + return(TRUE); +} + +void RenderPersonnelStats( INT32 iId, INT32 iSlot ) +{ + + INT32 iCounter=0; + // will render the stats of person iId in slot iSlot + SetFont(PERS_FONT); + SetFontForeground(PERS_TEXT_FONT_COLOR); + SetFontBackground(FONT_BLACK); + + //for(iCounter=0; iCounter ubProfile )&&( 57 > MercPtrs[iId] -> ubProfile ) ) + { + sprintf( sTemp, "%s%03d.sti", FACES_DIR, gMercProfiles[ MercPtrs[iId] -> ubProfile ].ubFaceIndex ); + } + else + { + sprintf(sTemp, "%s%02d.sti", FACES_DIR, Menptr[ iId ].ubProfile); + } + } + else + { + //if this is not a valid merc + if( !fDead && !fFired && !fOther ) + { + return( TRUE ); + } + + if( ( 50 < iId )&&( 57 > iId ) ) + { + sprintf( sTemp, "%s%03d.sti", FACES_DIR, gMercProfiles[ iId ].ubFaceIndex ); + } + else + { + sprintf(sTemp, "%s%02d.sti", FACES_DIR, iId ); + } + } + + if( fCurrentTeamMode == TRUE ) + { + if( MercPtrs[iId]->uiStatusFlags & SOLDIER_VEHICLE ) + { + return( TRUE ); + } + } + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP(sTemp, VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiFACE)); + + //Blt face to screen to + GetVideoObject(&hFaceHandle, guiFACE); + + if( fCurrentTeamMode == TRUE ) + { + if( MercPtrs[iId]->bLife <= 0 ) + { + hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); + + //set the red pallete to the face + SetObjectHandleShade( guiFACE, 0 ); + } + } + else + { + if( fDead == TRUE ) + { + hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); + + //set the red pallete to the face + SetObjectHandleShade( guiFACE, 0 ); + } + } + + + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH), IMAGE_BOX_Y, VO_BLT_SRCTRANSPARENCY,NULL); + + + //if the merc is dead, display it + if( !fCurrentTeamMode ) + { + INT32 iHeightOfText; + + iHeightOfText = DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[ iId ].zName, 0, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ); + + //if the string will rap + if( ( iHeightOfText - 2 ) > GetFontHeight( PERS_FONT ) ) + { + //raise where we display it, and rap it + DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y - GetFontHeight( PERS_FONT )), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[ iId ].zName, 0, FALSE, CENTER_JUSTIFIED); + } + else + { + DrawTextToScreen( gMercProfiles[ iId ].zName, IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, PERS_FONT, PERS_FONT_COLOR, 0, FALSE, CENTER_JUSTIFIED ); + } +// DrawTextToScreen(gMercProfiles[ iId ].zName, ( INT16 ) ( IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH) ), ( INT16 ) ( IMAGE_BOX_Y + 107 ), IMAGE_BOX_WITH_NO_BORDERS, PERS_FONT, PERS_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + +/* +removed cause we already show this under the picture, instead display the mercs FULL name ( above ) + if( fCurrentTeamMode == TRUE ) + { + if( Menptr[ iId ].bLife <= 0 ) + { + //if the merc is dead, display it + DrawTextToScreen(pDepartedMercPortraitStrings[0], ( INT16 ) ( IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH) ), ( INT16 ) ( IMAGE_BOX_Y + 107 ), IMAGE_BOX_WITH_NO_BORDERS, FONT14ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + } + else + { + if( fDead ) + { + //if the merc is dead, display it + DrawTextToScreen(pDepartedMercPortraitStrings[0], ( INT16 ) ( IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH) ), ( INT16 ) ( IMAGE_BOX_Y + 107 ), IMAGE_BOX_WITH_NO_BORDERS, FONT14ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); +// DrawTextToScreen( AimPopUpText[ AIM_MEMBER_DEAD ], ( INT16 ) ( IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH) ), ( INT16 ) ( IMAGE_BOX_Y + 107 ), IMAGE_BOX_WITH_NO_BORDERS, FONT14ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + else if( fFired ) + { + //if the merc is dead, display it + DrawTextToScreen(pDepartedMercPortraitStrings[1], ( INT16 ) ( IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH) ), ( INT16 ) ( IMAGE_BOX_Y + 107 ), IMAGE_BOX_WITH_NO_BORDERS, FONT14ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + else if( fOther ) + { + //if the merc is dead, display it + DrawTextToScreen(pDepartedMercPortraitStrings[2], ( INT16 ) ( IMAGE_BOX_X+(iSlot*IMAGE_BOX_WIDTH) ), ( INT16 ) ( IMAGE_BOX_Y + 107 ), IMAGE_BOX_WITH_NO_BORDERS, FONT14ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + } + +*/ + + DeleteVideoObjectFromIndex(guiFACE); + + + return (TRUE); +} + + +BOOLEAN NextPersonnelFace( void ) +{ + + if( iCurrentPersonSelectedId == -1 ) + { + return ( TRUE ); + } + + if( fCurrentTeamMode == TRUE ) + { + // wrap around? + if( iCurrentPersonSelectedId == GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) - 1 ) + { + iCurrentPersonSelectedId = 0; + return( FALSE ); //def added 3/14/99 to enable disable buttons properly + } + else + { + iCurrentPersonSelectedId++; + } + } + else + { + if ( ( ( iCurPortraitId + 1) == ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) - giCurrentUpperLeftPortraitNumber ) ) + { + // about to go off the end + giCurrentUpperLeftPortraitNumber = 0; + iCurPortraitId = 0; + + } + else if( iCurPortraitId == 19 ) + { + giCurrentUpperLeftPortraitNumber += 20; + iCurPortraitId = 0; + } + else + { + iCurPortraitId++; + } + // get of this merc in this slot + + iCurrentPersonSelectedId = iCurPortraitId; + fReDrawScreenFlag = TRUE; + } + + return ( TRUE ); +} + +BOOLEAN PrevPersonnelFace( void ) +{ + + if( iCurrentPersonSelectedId == -1 ) + { + return ( TRUE ); + } + + if( fCurrentTeamMode == TRUE ) + { + // wrap around? + if( iCurrentPersonSelectedId == 0 ) + { + iCurrentPersonSelectedId = GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) - 1; + + if( iCurrentPersonSelectedId == 0 ) + { + return( FALSE ); //def added 3/14/99 to enable disable buttons properly + } + } + else + { + iCurrentPersonSelectedId--; + } + } + else + { + if ( ( iCurPortraitId == 0 ) && ( giCurrentUpperLeftPortraitNumber == 0 ) ) + { + // about to go off the end + giCurrentUpperLeftPortraitNumber = ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) - ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) % 20; + iCurPortraitId = ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) % 20 ; + iCurPortraitId--; + + } + else if( iCurPortraitId == 0 ) + { + giCurrentUpperLeftPortraitNumber -= 20; + iCurPortraitId = 19; + } + else + { + iCurPortraitId--; + } + // get of this merc in this slot + + iCurrentPersonSelectedId = iCurPortraitId; + fReDrawScreenFlag = TRUE; + } + + return ( TRUE ); +} + + +void CreatePersonnelButtons( void ) +{ + + // left button + giPersonnelButtonImage[0]= LoadButtonImage( "LAPTOP\\personnelbuttons.sti" ,-1,0,-1,1,-1 ); + giPersonnelButton[0] = QuickCreateButton( giPersonnelButtonImage[0], PREV_MERC_FACE_X, MERC_FACE_SCROLL_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)LeftButtonCallBack); + + // right button + giPersonnelButtonImage[1]= LoadButtonImage( "LAPTOP\\personnelbuttons.sti" ,-1,2,-1,3,-1 ); + giPersonnelButton[1] = QuickCreateButton( giPersonnelButtonImage[1], NEXT_MERC_FACE_X, MERC_FACE_SCROLL_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)RightButtonCallBack); + + + + /* + // left button + giPersonnelButtonImage[0]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,0,-1,1,-1 ); + giPersonnelButton[0] = QuickCreateButton( giPersonnelButtonImage[0], LEFT_BUTTON_X, BUTTON_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)LeftButtonCallBack); + + // right button + giPersonnelButtonImage[1]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,6,-1,7,-1 ); + giPersonnelButton[1] = QuickCreateButton( giPersonnelButtonImage[1], RIGHT_BUTTON_X, BUTTON_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)RightButtonCallBack); + + // left FF button + giPersonnelButtonImage[2]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,3,-1,4,-1 ); + giPersonnelButton[2] = QuickCreateButton( giPersonnelButtonImage[2], LEFT_BUTTON_X, BUTTON_Y + 22, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)LeftFFButtonCallBack); + + // right ff button + giPersonnelButtonImage[3]= LoadButtonImage( "LAPTOP\\arrows.sti" ,-1,9,-1,10,-1 ); + giPersonnelButton[3] = QuickCreateButton( giPersonnelButtonImage[3], RIGHT_BUTTON_X, BUTTON_Y + 22, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)RightFFButtonCallBack); + */ + // set up cursors + SetButtonCursor(giPersonnelButton[0], CURSOR_LAPTOP_SCREEN); + SetButtonCursor(giPersonnelButton[1], CURSOR_LAPTOP_SCREEN); + //SetButtonCursor(giPersonnelButton[2], CURSOR_LAPTOP_SCREEN); + //SetButtonCursor(giPersonnelButton[3], CURSOR_LAPTOP_SCREEN); + + + return; +} + +void DeletePersonnelButtons( void ) +{ + + RemoveButton(giPersonnelButton[0] ); + UnloadButtonImage(giPersonnelButtonImage[0] ); + RemoveButton(giPersonnelButton[1] ); + UnloadButtonImage( giPersonnelButtonImage[1] ); + /*RemoveButton(giPersonnelButton[2] ); + UnloadButtonImage( giPersonnelButtonImage[2] ); + RemoveButton(giPersonnelButton[3] ); + UnloadButtonImage( giPersonnelButtonImage[3] ); + */ + return; +} + + +void LeftButtonCallBack(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + fReDrawScreenFlag=TRUE; + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + PrevPersonnelFace( ); + uiCurrentInventoryIndex = 0; + guiSliderPosition = 0; + + } + } +} + +void LeftFFButtonCallBack(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + fReDrawScreenFlag=TRUE; + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + PrevPersonnelFace( ); + PrevPersonnelFace( ); + PrevPersonnelFace( ); + PrevPersonnelFace( ); + + // set states + SetPersonnelButtonStates( ); + } + } +} + +void RightButtonCallBack(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + fReDrawScreenFlag=TRUE; + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + NextPersonnelFace( ); + uiCurrentInventoryIndex = 0; + guiSliderPosition = 0; + + + } + } +} + +void RightFFButtonCallBack(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + fReDrawScreenFlag=TRUE; + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + NextPersonnelFace( ); + NextPersonnelFace( ); + NextPersonnelFace( ); + NextPersonnelFace( ); + + // set states + SetPersonnelButtonStates( ); + } + } +} + +void DisplayHeader( void ) +{ + SetFont(PERS_HEADER_FONT); + SetFontForeground(PERS_FONT_COLOR); + SetFontBackground( 0 ); + + mprintf(pPersonnelScreenPoints[18].x,pPersonnelScreenPoints[18].y,pPersonnelTitle[0]); + + return; +} + + +void DisplayCharName( INT32 iId, INT32 iSlot ) +{ + // get merc's nickName, assignment, and sector location info + INT16 sX, sY; + SOLDIERTYPE *pSoldier; + CHAR16 sString[ 64 ]; + CHAR16 sTownName[ 256 ]; + INT8 bTownId = -1; + INT32 iHeightOfText; + + sTownName[0] = L'\0'; + + pSoldier=MercPtrs[iId]; + + SetFont(CHAR_NAME_FONT); + SetFontForeground(PERS_TEXT_FONT_COLOR); + SetFontBackground(FONT_BLACK); + + if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + { + return; + } + + if( Menptr[iId].bAssignment == ASSIGNMENT_POW ) + { + } + else if( Menptr[iId].bAssignment == IN_TRANSIT ) + { + } + else + { + // name of town, if any + bTownId = GetTownIdForSector( Menptr[iId].sSectorX, Menptr[iId].sSectorY ); + + if( bTownId != BLANK_SECTOR ) + { + swprintf( sTownName, L"%s", pTownNames[ bTownId ] ); + } + } + + + + if( sTownName[0] != L'\0' ) + { + //nick name - town name + swprintf( sString, L"%s - %s", gMercProfiles[Menptr[iId].ubProfile].zNickname, sTownName ); + } + else + { + //nick name + swprintf( sString, L"%s", gMercProfiles[Menptr[iId].ubProfile].zNickname ); + } + + + // nick name - assignment + FindFontCenterCoordinates(IMAGE_BOX_X-5,0,IMAGE_BOX_WIDTH + 90 , 0,sString,CHAR_NAME_FONT, &sX, &sY ); + + // check to see if we are going to go off the left edge + if( sX < pPersonnelScreenPoints[ 0 ].x ) + { + sX = ( INT16 )pPersonnelScreenPoints[ 0 ].x; + } + + //Display the mercs name + mprintf(sX+iSlot*IMAGE_BOX_WIDTH, CHAR_NAME_Y, sString ); + + swprintf( sString, L"%s", pPersonnelAssignmentStrings[Menptr[iId].bAssignment]); + + // nick name - assignment + FindFontCenterCoordinates(IMAGE_BOX_X-5,0,IMAGE_BOX_WIDTH + 90 , 0,sString,CHAR_NAME_FONT, &sX, &sY ); + + // check to see if we are going to go off the left edge + if( sX < pPersonnelScreenPoints[ 0 ].x ) + { + sX = ( INT16 )pPersonnelScreenPoints[ 0 ].x; + } + + mprintf(sX+iSlot*IMAGE_BOX_WIDTH, CHAR_LOC_Y, sString ); + + + // + // Display the mercs FULL name over top of their portrait + // + + //first get height of text to be displayed + iHeightOfText = DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[Menptr[iId].ubProfile].zName, 0, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ); + + //if the string will rap + if( ( iHeightOfText - 2 ) > GetFontHeight( PERS_FONT ) ) + { + //raise where we display it, and rap it + DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y - GetFontHeight( PERS_FONT )), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[Menptr[iId].ubProfile].zName, 0, FALSE, CENTER_JUSTIFIED); + } + else + { + DrawTextToScreen( gMercProfiles[Menptr[iId].ubProfile].zName, IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, PERS_FONT, PERS_FONT_COLOR, 0, FALSE, CENTER_JUSTIFIED ); + } + +/* +Moved so the name of the town will be in the same line as the name + + + if( Menptr[iId].bAssignment == ASSIGNMENT_POW ) + { +// FindFontCenterCoordinates(IMAGE_BOX_X-5,0,IMAGE_BOX_WIDTH, 0,pPOWStrings[ 1 ],CHAR_NAME_FONT, &sX, &sY ); +// mprintf(sX+iSlot*IMAGE_BOX_WIDTH, CHAR_NAME_Y+20,pPOWStrings[ 1 ] ); + } + else if( Menptr[iId].bAssignment == IN_TRANSIT ) + { + return; + } + else + { + // name of town, if any + bTownId = GetTownIdForSector( Menptr[iId].sSectorX, Menptr[iId].sSectorY ); + + if( bTownId != BLANK_SECTOR ) + { + FindFontCenterCoordinates( IMAGE_BOX_X - 5, 0, IMAGE_BOX_WIDTH, 0, pTownNames[ bTownId ], CHAR_NAME_FONT, &sX, &sY ); + mprintf( sX + ( iSlot * IMAGE_BOX_WIDTH ), CHAR_NAME_Y + 20, pTownNames[ bTownId ]); + } + } +*/ + + return; +} + + +void DisplayCharStats(INT32 iId, INT32 iSlot) +{ + INT32 iCounter=0; + wchar_t sString[50]; +// wchar_t sStringA[ 50 ]; + INT16 sX, sY; + UINT32 uiHits = 0; + SOLDIERTYPE *pSoldier = &Menptr[iId]; + BOOLEAN fAmIaRobot = AM_A_ROBOT( pSoldier ); + + + if( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) + { + return; + } + + // display the stats for a char + for(iCounter=0;iCounter 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bLifeDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + } + + //else + //{ + swprintf(sString, L"%d/%d",Menptr[iId].bLife,Menptr[iId].bLifeMax); + //} + } + else + { + swprintf( sString, pPOWStrings[ 1 ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_HEALTH]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 1: + // agility + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bAgilityDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bAgilityDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].bAgility); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 2: + // dexterity + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bDexterityDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bDexterityDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].bDexterity); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 3: + // strength + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bStrengthDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bStrengthDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].bStrength ); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 4: + // leadership + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bLeadershipDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bLeadershipDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].bLeadership ); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 5: + // wisdom + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bWisdomDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bWisdomDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].bWisdom ); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 6: + // exper + if( !fAmIaRobot ) + { + + if( gMercProfiles[Menptr[iId].ubProfile].bExpLevelDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bExpLevelDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].bExpLevel ); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 7: + //mrkmanship + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bMarksmanshipDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bMarksmanshipDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].bMarksmanship); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 8: + // mech + if( !fAmIaRobot ) + { + + if( gMercProfiles[Menptr[iId].ubProfile].bMechanicDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bMechanicDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].bMechanical); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 9: + // exp + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bExplosivesDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bExplosivesDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20+TEXT_DELTA_OFFSET ),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].bExplosive); + //} + + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + case 10: + // med + if( !fAmIaRobot ) + { + if( gMercProfiles[Menptr[iId].ubProfile].bMedicalDelta > 0 ) + { + swprintf(sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bMedicalDelta); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); } + //else + //{ + swprintf(sString, L"%d",Menptr[iId].bMedical); + //} + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + + + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[iCounter]); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + + case 14: + // kills + mprintf((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[21].y,pPersonnelScreenStrings[PRSNL_TXT_KILLS]); + swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].usKills); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[21].y,sString); + break; + case 15: + // assists + mprintf((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[22].y,pPersonnelScreenStrings[PRSNL_TXT_ASSISTS]); + swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].usAssists); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[22].y,sString); + break; + case 16: + // shots/hits + mprintf((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[23].y,pPersonnelScreenStrings[PRSNL_TXT_HIT_PERCENTAGE]); + uiHits = ( UINT32 )gMercProfiles[Menptr[iId].ubProfile].usShotsHit; + uiHits *= 100; + + // check we have shot at least once + if( gMercProfiles[Menptr[iId].ubProfile].usShotsFired > 0 ) + { + uiHits /= ( UINT32 )gMercProfiles[Menptr[iId].ubProfile].usShotsFired; + } + else + { + // no, set hit % to 0 + uiHits = 0; + } + + + swprintf(sString, L"%d %%%%",uiHits); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + sX += StringPixLength( L"%", PERS_FONT ); + mprintf(sX,pPersonnelScreenPoints[23].y,sString); + break; + case 17: + // battles + mprintf((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[24].y,pPersonnelScreenStrings[PRSNL_TXT_BATTLES]); + swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].usBattlesFought); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[24].y,sString); + break; + case 18: + // wounds + mprintf((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[25].y,pPersonnelScreenStrings[PRSNL_TXT_TIMES_WOUNDED]); + swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].usTimesWounded); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[25].y,sString); + break; + + // The Mercs Skills + case 19: + { + INT32 iWidth; + INT32 iMinimumX; + INT8 bScreenLocIndex = 19; //if you change the '19', change it below in the if statement + + //Display the 'Skills' text + mprintf( (INT16)( pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[bScreenLocIndex].y,pPersonnelScreenStrings[ PRSNL_TXT_SKILLS ] ); + + //KM: April 16, 1999 + //Added support for the German version, which has potential string overrun problems. For example, the text "Skills:" can + //overlap "NightOps (Expert)" because the German strings are much longer. In these cases, I ensure that the right + //justification of the traits don't overlap. If it would, I move it over to the right. + iWidth = StringPixLength( pPersonnelScreenStrings[ PRSNL_TXT_SKILLS ], PERS_FONT ); + iMinimumX = iWidth + pPersonnelScreenPoints[bScreenLocIndex].x + iSlot * TEXT_BOX_WIDTH + 2; + + if( !fAmIaRobot ) + { + INT8 bSkill1 = gMercProfiles[ Menptr[iId].ubProfile ].bSkillTrait; + INT8 bSkill2 = gMercProfiles[ Menptr[iId].ubProfile ].bSkillTrait2; + + //if the 2 skills are the same, add the '(expert)' at the end + if( bSkill1 == bSkill2 && bSkill1 != NO_SKILLTRAIT ) + { + swprintf( sString, L"%s %s", gzMercSkillText[bSkill1], gzMercSkillText[NUM_SKILLTRAITS] ); + + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + + //KM: April 16, 1999 + //Perform the potential overrun check + if( sX <= iMinimumX ) + { + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH-20 +TEXT_DELTA_OFFSET),0,30,0,sString, PERS_FONT, &sX, &sY); + sX = (INT16)max( sX, iMinimumX ); + } + + mprintf(sX,pPersonnelScreenPoints[bScreenLocIndex].y,sString); + } + else + { + //Display the first skill + if( bSkill1 != NO_SKILLTRAIT ) + { + swprintf( sString, L"%s", gzMercSkillText[bSkill1] ); + + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + + //KM: April 16, 1999 + //Perform the potential overrun check + sX = (INT16)max( sX, iMinimumX ); + + mprintf(sX,pPersonnelScreenPoints[bScreenLocIndex].y,sString); + + bScreenLocIndex++; + } + + //Display the second skill + if( bSkill2 != NO_SKILLTRAIT ) + { + swprintf( sString, L"%s", gzMercSkillText[bSkill2] ); + + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + + //KM: April 16, 1999 + //Perform the potential overrun check + sX = (INT16)max( sX, iMinimumX ); + + mprintf(sX,pPersonnelScreenPoints[bScreenLocIndex].y,sString); + + bScreenLocIndex++; + } + + //if no skill was displayed + if( bScreenLocIndex == 19 ) + { + swprintf( sString, L"%s", pPersonnelScreenStrings[ PRSNL_TXT_NOSKILLS ] ); + + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[bScreenLocIndex].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[bScreenLocIndex].y,sString); + } + } + } + else + { + swprintf( sString, L"%s", gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + } + } + break; +/* + case 19: + // total contract time served + mprintf((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[24].y,pPersonnelScreenStrings[18]); + if( gMercProfiles[Menptr[iId].ubProfile].usTotalDaysServed > 0 ) + { + swprintf(sString, L"%d %s",gMercProfiles[Menptr[iId].ubProfile].usTotalDaysServed - 1, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); + } + else + { + swprintf(sString, L"%d %s",gMercProfiles[Menptr[iId].ubProfile].usTotalDaysServed, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); + } + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[24].y,sString); + break; +*/ + } + } + return; +} + + +INT32 GetLastMercId( void ) +{ + // rolls through list of mercs and returns how many on team + SOLDIERTYPE *pSoldier, *pTeamSoldier; + INT32 cnt=0; + INT32 iCounter=0; + pSoldier = MercPtrs[0]; + + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) + { + if( ( pTeamSoldier->bActive ) && ( pTeamSoldier->bLife > 0 ) ) + iCounter++; + } + return iCounter; +} + + +void DrawPageNumber( void ) +{ + // draws the page number + + wchar_t sString[10]; + INT16 sX, sY; + INT32 iPageNumber, iLastPage; + + return; + + // get last page number, and current page too + iLastPage=GetLastMercId()/MAX_SLOTS; + iPageNumber=iStartPersonId/MAX_SLOTS; + iPageNumber++; + if(iLastPage==0) + iLastPage++; + + // get current and last pages + swprintf(sString, L"%d/%d", iPageNumber, iLastPage); + + // set up font + SetFont(PERS_FONT); + SetFontForeground(FONT_BLACK); + SetFontBackground(FONT_BLACK); + SetFontShadow(NO_SHADOW); + + // center + FindFontCenterCoordinates(PAGE_X, PAGE_Y,PAGE_BOX_WIDTH, PAGE_BOX_HEIGHT, sString, PERS_FONT, &sX, &sY); + + // print page number + mprintf(sX, sY, sString); + + // reset shadow + SetFontShadow(DEFAULT_SHADOW); + + return; +} + + +void SetPersonnelButtonStates( void ) +{ + // this function will look at what page we are viewing, enable and disable buttons as needed + + if( ! PrevPersonnelFace( ) ) + { + // first page, disable left buttons + +// DisableButton( giPersonnelButton[ 2 ] ); + DisableButton( giPersonnelButton[ 0 ] ); + } + else + { + // enable buttons + NextPersonnelFace( ); + + // enable buttons +// EnableButton( giPersonnelButton[ 2 ] ); + EnableButton( giPersonnelButton[ 0 ] ); + } + + if( ! NextPersonnelFace( ) ) + { + +// DisableButton( giPersonnelButton[ 3 ] ); + DisableButton( giPersonnelButton[ 1 ] ); + } + else + { + // decrement page + PrevPersonnelFace( ); + // enable buttons +// EnableButton( giPersonnelButton[ 3 ] ); + EnableButton( giPersonnelButton[ 1 ] ); + } + + return; +} + + +void RenderPersonnelScreenBackground( void ) +{ + + HVOBJECT hHandle; + + // this fucntion will render the background for the personnel screen + if( fCurrentTeamMode == TRUE ) + { + // blit title + GetVideoObject(&hHandle, guiCURRENTTEAM); + + } + else + { + // blit title + GetVideoObject(&hHandle, guiDEPARTEDTEAM); + } + + BltVideoObject( FRAME_BUFFER, hHandle, 0,DEPARTED_X, DEPARTED_Y, VO_BLT_SRCTRANSPARENCY,NULL ); + + return; +} + + +BOOLEAN LoadPersonnelScreenBackgroundGraphics( void ) +{ + // will load the graphics for the personeel screen background + VOBJECT_DESC VObjectDesc; + + // departed bar + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\departed.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiDEPARTEDTEAM)); + + // current bar + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\CurrentTeam.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiCURRENTTEAM)); + + + return ( TRUE ); +} + +void DeletePersonnelScreenBackgroundGraphics( void ) +{ + // delete background V/O's + + DeleteVideoObjectFromIndex( guiCURRENTTEAM ); + DeleteVideoObjectFromIndex( guiDEPARTEDTEAM ); + +} + +void CreateDestroyButtonsForPersonnelDepartures( void ) +{ + static BOOLEAN fCreated = FALSE; + + // create/ destroy personnel departures buttons as needed + + // create button?..if not created + if( ( fCreatePeronnelDepartureButton == TRUE)&&( fCreated == FALSE ) ) + { + fCreated = TRUE; + } + else if( ( fCreatePeronnelDepartureButton == FALSE ) && ( fCreated == TRUE ) ) + { + fCreated = FALSE; + } + + + return; +} + + +INT32 GetNumberOfMercsOnPlayersTeam( void ) +{ + + SOLDIERTYPE *pTeamSoldier, *pSoldier; + INT32 cnt=0; + INT32 iCounter = 0; + + + + + // grab number on team + pSoldier = MercPtrs[0]; + + // no soldiers + + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pTeamSoldier++) + { + if( ( pTeamSoldier->bActive) && !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && ( pTeamSoldier->bLife > 0 ) ) + iCounter++; + } + + return ( iCounter ); +} + + +INT32 GetNumberOfMercsDeadOrAliveOnPlayersTeam( void ) +{ + + SOLDIERTYPE *pTeamSoldier, *pSoldier; + INT32 cnt=0; + INT32 iCounter = 0; + + + + + // grab number on team + pSoldier = MercPtrs[0]; + + // no soldiers + + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pTeamSoldier++) + { + if( ( pTeamSoldier->bActive) && !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) ) + iCounter++; + } + + return ( iCounter ); +} + +void CreateDestroyMouseRegionsForPersonnelPortraits( void ) +{ + // creates/ destroys mouse regions for portraits + + static BOOLEAN fCreated = FALSE; + INT16 sCounter = 0; + + if( ( fCreated == FALSE )&&( fCreatePersonnelPortraitMouseRegions == TRUE ) ) + { + // create regions + for( sCounter = 0; sCounter < PERSONNEL_PORTRAIT_NUMBER; sCounter++ ) + { + MSYS_DefineRegion(&gPortraitMouseRegions[ sCounter ], ( INT16 ) ( SMALL_PORTRAIT_START_X + ( sCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( sCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT ) , ( INT16 ) ( ( SMALL_PORTRAIT_START_X ) + ( ( sCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ) + SMALL_PORTRAIT_WIDTH ) , ( INT16 )( SMALL_PORTRAIT_START_Y + ( sCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT + SMALL_PORTRAIT_HEIGHT ), + MSYS_PRIORITY_HIGHEST,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, PersonnelPortraitCallback); + MSYS_SetRegionUserData( &gPortraitMouseRegions[ sCounter ] ,0 , sCounter ); + MSYS_AddRegion( &gPortraitMouseRegions[ sCounter ] ); + } + + fCreated = TRUE; + + } + else if( ( fCreated == TRUE ) && ( fCreatePersonnelPortraitMouseRegions == FALSE ) ) + { + // destroy regions + for( sCounter = 0; sCounter < PERSONNEL_PORTRAIT_NUMBER; sCounter++ ) + { + MSYS_RemoveRegion( &gPortraitMouseRegions[ sCounter ] ); + } + + fCreated = FALSE; + } + return; +} + + +BOOLEAN DisplayPicturesOfCurrentTeam( void ) +{ + INT32 iCounter = 0; + INT32 iTotalOnTeam = 0; + char sTemp[100]; + HVOBJECT hFaceHandle; + VOBJECT_DESC VObjectDesc; + SOLDIERTYPE *pSoldier; + INT32 iId = 0; + INT32 iCnt = 0; + + // will display the 20 small portraits of the current team + + // get number of mercs on team + iTotalOnTeam = GetNumberOfMercsDeadOrAliveOnPlayersTeam( ); + + + if( ( iTotalOnTeam == 0)||( fCurrentTeamMode == FALSE ) ) + { + // nobody on team, leave + return ( TRUE ); + } + + pSoldier = MercPtrs[ iCounter ]; + + // start id + iId= gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; + + for( iCounter = 0; iCounter < iTotalOnTeam; iCnt++ ) + { + + if( ( MercPtrs[iId + iCnt ] -> bActive == TRUE ) ) + { + // found the next actual guy + if( ( 50 < MercPtrs[iId + iCnt ] -> ubProfile )&&( 57 > MercPtrs[iId + iCnt ] -> ubProfile ) ) + { + sprintf( sTemp, "%s%03d.sti", SMALL_FACES_DIR, gMercProfiles[ MercPtrs[ iId + iCnt ] -> ubProfile ].ubFaceIndex ); + } + else + { + if( Menptr[ iId + iCnt ].ubProfile < 100 ) + { + sprintf(sTemp, "%s%02d.sti", SMALL_FACES_DIR, Menptr[ iId + iCnt ].ubProfile); + } + else + { + sprintf(sTemp, "%s%03d.sti", SMALL_FACES_DIR, Menptr[ iId + iCnt ].ubProfile); + } + } + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP(sTemp, VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiFACE)); + + //Blt face to screen to + GetVideoObject(&hFaceHandle, guiFACE); + + if( Menptr[ iId + iCnt ].bLife <= 0 ) + { + hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); + + //set the red pallete to the face + SetObjectHandleShade( guiFACE, 0 ); + } + + + + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT ), VO_BLT_SRCTRANSPARENCY,NULL); + + if( Menptr[ iId + iCnt ].bLife <= 0 ) + { + //if the merc is dead, display it + DrawTextToScreen(AimPopUpText[AIM_MEMBER_DEAD], ( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT + SMALL_PORT_HEIGHT / 2 ), SMALL_PORTRAIT_WIDTH_NO_BORDERS, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + + DeleteVideoObjectFromIndex(guiFACE); + iCounter++; + } + } + + return ( TRUE ); +} + + + +void PersonnelPortraitCallback( MOUSE_REGION * pRegion, INT32 iReason ) +{ + INT32 iPortraitId = 0; + INT32 iOldPortraitId; + + iPortraitId = MSYS_GetRegionUserData(pRegion, 0); + iOldPortraitId = iCurrentPersonSelectedId; + + // callback handler for the minize region that is attatched to the laptop program icon + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + // get id of portrait + + if( fCurrentTeamMode == TRUE ) + { + // valid portrait, set up id + if( iPortraitId >= GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) ) + { + // not a valid id, leave + return; + } + + iCurrentPersonSelectedId = iPortraitId; + fReDrawScreenFlag = TRUE; + } + else + { + if( iPortraitId >= GetNumberOfPastMercsOnPlayersTeam( ) ) + { + return; + } + iCurrentPersonSelectedId = iPortraitId; + fReDrawScreenFlag = TRUE; + iCurPortraitId = iPortraitId; + } + + //if the selected merc is valid, and they are a POW, change to the inventory display + if( iCurrentPersonSelectedId != -1 && Menptr[ GetIdOfThisSlot( iCurrentPersonSelectedId ) ].bAssignment == ASSIGNMENT_POW && gubPersonnelInfoState == PERSONNEL_INV_BTN ) + { + gubPersonnelInfoState = PERSONNEL_STAT_BTN; + } + + if( iOldPortraitId != iPortraitId ) + { + uiCurrentInventoryIndex = 0; + guiSliderPosition = 0; + } + } + + if( iReason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + if( fCurrentTeamMode == TRUE ) + { + // valid portrait, set up id + if( iPortraitId >= GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) ) + { + // not a valid id, leave + return; + } + + //if the user is rigt clicking on the same face + if( iCurrentPersonSelectedId == iPortraitId ) + { + //increment the info page when the user right clicks + if( gubPersonnelInfoState < PERSONNEL_NUM_BTN-1 ) + gubPersonnelInfoState++; + else + gubPersonnelInfoState = PERSONNEL_STAT_BTN; + } + + iCurrentPersonSelectedId = iPortraitId; + fReDrawScreenFlag = TRUE; + + uiCurrentInventoryIndex = 0; + guiSliderPosition = 0; + + //if the selected merc is valid, and they are a POW, change to the inventory display + if( iCurrentPersonSelectedId != -1 && Menptr[ GetIdOfThisSlot( iCurrentPersonSelectedId ) ].bAssignment == ASSIGNMENT_POW && gubPersonnelInfoState == PERSONNEL_INV_BTN) + { + gubPersonnelInfoState = PERSONNEL_STAT_BTN; + } + } + } +} + + +void DisplayFaceOfDisplayedMerc( ) +{ + // valid person?, display + + if( iCurrentPersonSelectedId != -1 ) + { + // highlight it + DisplayHighLightBox( ); + + // if showing inventory, leave + + if( fCurrentTeamMode == TRUE ) + { + RenderPersonnelFace( GetIdOfThisSlot( iCurrentPersonSelectedId ), 0, FALSE, FALSE, FALSE ); + DisplayCharName( GetIdOfThisSlot( iCurrentPersonSelectedId ), 0 ); + +// if( fShowInventory == TRUE ) + if( gubPersonnelInfoState == PRSNL_INV ) + { + return; + } + + RenderPersonnelStats( GetIdOfThisSlot( iCurrentPersonSelectedId ), 0 ); + + } + else + { + RenderPersonnelFace( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ), 0, IsPastMercDead( iCurrentPersonSelectedId ), IsPastMercFired( iCurrentPersonSelectedId ), IsPastMercOther( iCurrentPersonSelectedId ) ); + DisplayDepartedCharName( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ), 0, GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ) ) ); + +// if( fShowInventory == TRUE ) + if( gubPersonnelInfoState == PRSNL_INV ) + { + return; + } + + DisplayDepartedCharStats( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ), 0, GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ) ) ); + + } + + + } + + return; +} + +void DisplayInventoryForSelectedChar( void ) +{ + + // display the inventory for this merc +// if( fShowInventory == FALSE ) + if( gubPersonnelInfoState != PRSNL_INV ) + { + return; + } + + CreateDestroyPersonnelInventoryScrollButtons( ); + + if( fCurrentTeamMode == TRUE ) + { + RenderInventoryForCharacter( GetIdOfThisSlot( iCurrentPersonSelectedId ), 0 ); + } + else + { + RenderInventoryForCharacter( GetIdOfPastMercInSlot( iCurrentPersonSelectedId ), 0 ); + } + + return; +} + +void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ) +{ + UINT8 ubCounter = 0; + SOLDIERTYPE *pSoldier; + INT16 sIndex; + HVOBJECT hHandle; + ETRLEObject *pTrav; + INVTYPE *pItem; + INT16 PosX, PosY, sCenX, sCenY; + UINT32 usHeight, usWidth; + UINT8 ubItemCount = 0; + UINT8 ubUpToCount = 0; + INT16 sX, sY; + CHAR16 sString[ 128 ]; + INT32 cnt = 0; + INT32 iTotalAmmo = 0; + + GetVideoObject(&hHandle, guiPersonnelInventory); + BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( iScreenWidthOffset + 397 ), ( INT16 ) ( iScreenHeightOffset + 200 ), VO_BLT_SRCTRANSPARENCY,NULL); + + if( fCurrentTeamMode == FALSE ) + { + return; + } + + // render the bar for the character + RenderSliderBarForPersonnelInventory( ); + + pSoldier = &Menptr[ iId ]; + + //if this is a robot, dont display any inventory + if( AM_A_ROBOT( pSoldier ) ) + { + return; + } + + for( ubCounter = 0; ubCounter < NUM_INV_SLOTS; ubCounter++ ) + { + PosX = iScreenWidthOffset + 397 + 3; + PosY = iScreenHeightOffset + 200 + 8 +( ubItemCount * ( 29 ) ); + + //if the character is a robot, only display the inv for the hand pos + if( pSoldier->ubProfile == ROBOT && ubCounter != HANDPOS ) + { + continue; + } + + if( pSoldier->inv[ ubCounter ].ubNumberOfObjects ) + { + if( uiCurrentInventoryIndex > ubUpToCount ) + { + ubUpToCount++; + } + else + { + sIndex = ( pSoldier->inv[ ubCounter ].usItem ); + pItem = &Item[ sIndex ]; + + GetVideoObject( &hHandle, GetInterfaceGraphicForItem( pItem ) ); + pTrav = &(hHandle->pETRLEObject[ pItem->ubGraphicNum ] ); + + usHeight = (UINT32)pTrav->usHeight; + usWidth = (UINT32)pTrav->usWidth; + + sCenX = PosX + ( abs( 57 - usWidth ) / 2 ) - pTrav->sOffsetX; + sCenY = PosY + ( abs( 22 - usHeight ) / 2 ) - pTrav->sOffsetY; + + // shadow + //BltVideoObjectOutlineShadowFromIndex( FRAME_BUFFER, GetInterfaceGraphicForItem( pItem ), pItem->ubGraphicNum, sCenX-2, sCenY+2); + + //blt the item + BltVideoObjectOutlineFromIndex( FRAME_BUFFER, GetInterfaceGraphicForItem( pItem ), pItem->ubGraphicNum, sCenX, sCenY, 0, FALSE ); + + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + SetFontDestBuffer( FRAME_BUFFER, 0,0,SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); + + // grab item name + LoadItemInfo(sIndex, sString, NULL ); + + // shorten if needed + if( StringPixLength( sString, FONT10ARIAL) > ( 171 - 75 ) ) + { + ReduceStringLength( sString, ( 171 - 75 ), FONT10ARIAL ); + } + + // print name + mprintf( PosX + 65, PosY + 3, sString ); + + // condition + if ( Item[pSoldier->inv[ ubCounter ].usItem ].usItemClass & IC_AMMO ) + { + // Ammo + iTotalAmmo = 0; + if( pSoldier->inv[ ubCounter ].ubNumberOfObjects > 1 ) + { + for( cnt = 0; cnt < pSoldier->inv[ ubCounter ].ubNumberOfObjects; cnt++ ) + { + // get total ammo + iTotalAmmo+= pSoldier->inv[ ubCounter ].ubShotsLeft[cnt]; + } + } + else + { + iTotalAmmo= pSoldier->inv[ ubCounter ].ubShotsLeft[ 0 ]; + } + + swprintf( sString, L"%d/%d", iTotalAmmo, ( pSoldier->inv[ ubCounter ].ubNumberOfObjects * Magazine[ Item[pSoldier->inv[ ubCounter ].usItem ].ubClassIndex ].ubMagSize ) ); + FindFontRightCoordinates( ( INT16 )( PosX + 65 ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 171 - 75 ), + ( INT16 )( GetFontHeight( FONT10ARIAL ) ), sString, FONT10ARIAL, &sX, &sY ); + } + else + { + swprintf( sString, L"%2d%%%%", pSoldier->inv[ ubCounter ].bStatus[0] ); + FindFontRightCoordinates( ( INT16 )( PosX + 65 ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 171 - 75 ), + ( INT16 )( GetFontHeight( FONT10ARIAL ) ), sString, FONT10ARIAL, &sX, &sY ); + + sX += StringPixLength( L"%", FONT10ARIAL ); + } + + + + mprintf( sX, sY, sString ); + + if ( Item[pSoldier->inv[ ubCounter ].usItem ].usItemClass & IC_GUN ) + { + swprintf( sString, L"%s", AmmoCaliber[ Weapon[ Item[ pSoldier->inv[ ubCounter ].usItem ].ubClassIndex ].ubCalibre ]); + + // shorten if needed + if( StringPixLength( sString, FONT10ARIAL) > ( 171 - 75 ) ) + { + ReduceStringLength( sString, ( 171 - 75 ), FONT10ARIAL ); + } + + // print name + mprintf( PosX + 65, PosY + 15 , sString ); + + + } + + // if more than 1? + if( pSoldier->inv[ ubCounter ].ubNumberOfObjects > 1 ) + { + swprintf( sString, L"x%d", pSoldier->inv[ ubCounter ].ubNumberOfObjects ); + FindFontRightCoordinates( ( INT16 )( PosX ), ( INT16 ) ( PosY + 15 ), ( INT16 ) ( 58 ), + ( INT16 )( GetFontHeight( FONT10ARIAL ) ), sString, FONT10ARIAL, &sX, &sY ); + mprintf( sX, sY, sString ); + } + + // display info about it + + ubItemCount++; + } + } + + if( ubItemCount == NUMBER_OF_INVENTORY_PERSONNEL ) + { + ubCounter = NUM_INV_SLOTS; + } + } + + + + return; +} + + +void InventoryUpButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT32 iValue = 0; + SOLDIERTYPE *pSoldier = MercPtrs[ 0 ]; + INT32 cnt = 0; + INT32 iId = 0; + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & (BUTTON_CLICKED_ON) ) + { + btn->uiFlags &= ~(BUTTON_CLICKED_ON); + + if( uiCurrentInventoryIndex == 0 ) + { + return; + } + + // up one element + uiCurrentInventoryIndex--; + fReDrawScreenFlag = TRUE; + + FindPositionOfPersInvSlider( ); + } + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if( uiCurrentInventoryIndex == 0 ) + { + return; + } + + // up one element + uiCurrentInventoryIndex--; + fReDrawScreenFlag = TRUE; + FindPositionOfPersInvSlider( ); + } +} + + +void InventoryDownButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT32 iValue = 0; + SOLDIERTYPE *pSoldier = MercPtrs[ 0 ]; + INT32 cnt = 0; + INT32 iId = 0; + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) + { + if( ( INT32 )uiCurrentInventoryIndex >= ( INT32 )( GetNumberOfInventoryItemsOnCurrentMerc( ) - NUMBER_OF_INVENTORY_PERSONNEL ) ) + { + return; + } + + // up one element + uiCurrentInventoryIndex++; + fReDrawScreenFlag = TRUE; + FindPositionOfPersInvSlider( ); + + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & (BUTTON_CLICKED_ON) ) + { + btn->uiFlags &= ~(BUTTON_CLICKED_ON); + + if( ( INT32 )uiCurrentInventoryIndex >= ( INT32 )( GetNumberOfInventoryItemsOnCurrentMerc( ) - NUMBER_OF_INVENTORY_PERSONNEL ) ) + { + return; + } + + // up one element + uiCurrentInventoryIndex++; + fReDrawScreenFlag = TRUE; + + FindPositionOfPersInvSlider( ); + + } + } + +} + + +// decide which buttons can and can't be accessed based on what the current item is +void EnableDisableInventoryScrollButtons( void ) +{ +// if( fShowInventory == FALSE ) + if( gubPersonnelInfoState != PRSNL_INV ) + { + return; + } + + if( uiCurrentInventoryIndex == 0 ) + { + ButtonList[ giPersonnelInventoryButtons[ 0 ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); + DisableButton( giPersonnelInventoryButtons[ 0 ] ); + } + else + { + EnableButton( giPersonnelInventoryButtons[ 0 ] ); + } + + + if( ( INT32 )uiCurrentInventoryIndex >= ( INT32 )( GetNumberOfInventoryItemsOnCurrentMerc( ) - NUMBER_OF_INVENTORY_PERSONNEL ) ) + { + ButtonList[ giPersonnelInventoryButtons[ 1 ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); + DisableButton( giPersonnelInventoryButtons[ 1 ] ); + } + else + { + EnableButton( giPersonnelInventoryButtons[ 1 ] ); + } + + + return; +} + +INT32 GetNumberOfInventoryItemsOnCurrentMerc( void ) +{ + INT32 iId = 0; + UINT8 ubCounter = 0; + UINT8 ubCount = 0; + SOLDIERTYPE *pSoldier; + + // in current team mode?..nope...move on + if( fCurrentTeamMode == FALSE ) + { + return( 0 ); + } + + iId = GetIdOfThisSlot( iCurrentPersonSelectedId ); + + pSoldier = &Menptr[ iId ]; + + for( ubCounter = 0; ubCounter < NUM_INV_SLOTS; ubCounter++ ) + { + if( ( pSoldier->inv[ ubCounter ].ubNumberOfObjects ) && ( pSoldier->inv[ ubCounter ].usItem) ) + { + ubCount++; + } + } + + return( ubCount ); +} + +void CreateDestroyPersonnelInventoryScrollButtons( void ) +{ + static BOOLEAN fCreated = FALSE; + +// if( ( fShowInventory == TRUE ) && ( fCreated == FALSE ) ) + if( ( gubPersonnelInfoState == PRSNL_INV ) && ( fCreated == FALSE ) ) + { + // create buttons + giPersonnelInventoryButtonsImages[ 0 ]= LoadButtonImage( "LAPTOP\\personnel_inventory.sti" ,-1,1,-1,2,-1 ); + giPersonnelInventoryButtons[ 0 ] = QuickCreateButton( giPersonnelInventoryButtonsImages[0], iScreenWidthOffset + 176 + 397, iScreenHeightOffset + 2 + 200, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)InventoryUpButtonCallback); + + giPersonnelInventoryButtonsImages[ 1 ]= LoadButtonImage( "LAPTOP\\personnel_inventory.sti" ,-1,3,-1,4,-1 ); + giPersonnelInventoryButtons[ 1 ] = QuickCreateButton( giPersonnelInventoryButtonsImages[1], iScreenWidthOffset + 397 + 176, iScreenHeightOffset + 200 + 223, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)InventoryDownButtonCallback); + + // set up cursors for these buttons + SetButtonCursor( giPersonnelInventoryButtons[ 0 ], CURSOR_LAPTOP_SCREEN); + SetButtonCursor( giPersonnelInventoryButtons[ 1 ], CURSOR_LAPTOP_SCREEN); + + MSYS_DefineRegion( &gMouseScrollPersonnelINV, X_OF_PERSONNEL_SCROLL_REGION, Y_OF_PERSONNEL_SCROLL_REGION, X_OF_PERSONNEL_SCROLL_REGION + X_SIZE_OF_PERSONNEL_SCROLL_REGION, Y_OF_PERSONNEL_SCROLL_REGION + Y_SIZE_OF_PERSONNEL_SCROLL_REGION, + MSYS_PRIORITY_HIGHEST - 3, CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, HandleSliderBarClickCallback ); + + fCreated = TRUE; + } +// else if( ( fCreated == TRUE ) && ( fShowInventory == FALSE ) ) + else if( ( fCreated == TRUE ) && ( gubPersonnelInfoState != PERSONNEL_INV_BTN ) ) + { + // destroy buttons + RemoveButton(giPersonnelInventoryButtons[0] ); + UnloadButtonImage(giPersonnelInventoryButtonsImages[0] ); + RemoveButton(giPersonnelInventoryButtons[1] ); + UnloadButtonImage(giPersonnelInventoryButtonsImages[1] ); + + MSYS_RemoveRegion( &gMouseScrollPersonnelINV ); + + fCreated = FALSE; + } +} + +void DisplayNumberOnCurrentTeam( void ) +{ + // display number on team + CHAR16 sString[ 32 ]; + INT16 sX = 0, sY = 0; + + + // font stuff + SetFont( FONT10ARIAL ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( PERS_TEXT_FONT_COLOR ); + + if( fCurrentTeamMode == TRUE ) + { + swprintf( sString, L"%s ( %d )", pPersonelTeamStrings[ 0 ], GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) ); + sX = PERS_CURR_TEAM_X; + } + else + { + swprintf( sString, L"%s", pPersonelTeamStrings[ 0 ] ); + + FindFontCenterCoordinates( PERS_CURR_TEAM_X, 0, 65, 0,sString, FONT10ARIAL, &sX, &sY ); + + } + + mprintf( sX, PERS_CURR_TEAM_Y, sString ); + + // now the cost of the current team, if applicable + DisplayCostOfCurrentTeam( ); + + return; +} + +void DisplayNumberDeparted( void ) +{ + // display number departed from team + CHAR16 sString[ 32 ]; + INT16 sX = 0, sY = 0; + + + // font stuff + SetFont( FONT10ARIAL ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( PERS_TEXT_FONT_COLOR ); + + if( fCurrentTeamMode == FALSE ) + { + swprintf( sString, L"%s ( %d )", pPersonelTeamStrings[ 1 ], GetNumberOfPastMercsOnPlayersTeam( ) ); + sX = PERS_CURR_TEAM_X; + } + else + { + swprintf( sString, L"%s", pPersonelTeamStrings[ 1 ] ); + + FindFontCenterCoordinates( PERS_CURR_TEAM_X, 0, 65, 0,sString, FONT10ARIAL, &sX, &sY ); + } + + mprintf( sX, PERS_DEPART_TEAM_Y, sString ); + + + return; +} + + +INT32 GetTotalDailyCostOfCurrentTeam( void ) +{ + // will return the total daily cost of the current team + + SOLDIERTYPE *pSoldier; + INT32 cnt=0; + INT32 iCounter = 0; + INT32 iCostOfTeam = 0; + + + // first grunt + pSoldier = MercPtrs[0]; + + // not active?..return cost of zero + + // run through active soldiers + for ( pSoldier = MercPtrs[ 0 ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++ ) + { + pSoldier = MercPtrs[cnt]; + + if( ( pSoldier->bActive) && ( pSoldier->bLife > 0 ) ) + { + + // valid soldier, get cost + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + // daily rate + if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + // 2 week contract + iCostOfTeam += gMercProfiles[pSoldier->ubProfile].uiBiWeeklySalary / 14; + } + else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + { + // 1 week contract + iCostOfTeam += gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary / 7 ; + } + else + { + + iCostOfTeam += gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + } + else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { + // MERC Merc + iCostOfTeam += gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + else + { + // no cost + iCostOfTeam += 0; + } + } + } + return iCostOfTeam; +} + +INT32 GetLowestDailyCostOfCurrentTeam( void ) +{ + // will return the lowest daily cost of the current team + + SOLDIERTYPE *pSoldier; + INT32 cnt=0; + INT32 iCounter = 0; + INT32 iLowest = 999999; +// INT32 iId =0; + INT32 iCost = 0; + + // first grunt + pSoldier = MercPtrs[0]; + + // not active?..return cost of zero + + // run through active soldiers + for ( pSoldier = MercPtrs[ 0 ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++ ) + { + pSoldier = MercPtrs[cnt]; + + if( ( pSoldier->bActive ) && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && ( pSoldier->bLife > 0 ) ) + { + // valid soldier, get cost + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + // daily rate + if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + // 2 week contract + iCost = gMercProfiles[ pSoldier->ubProfile ].uiBiWeeklySalary / 14; + } + else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + { + // 1 week contract + iCost = gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary / 7 ; + } + else + { + + iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + } + else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { + // MERC Merc + iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + else + { + // no cost + iCost = 0; + } + + if( iCost <= iLowest ) + { + iLowest = iCost; + } + } + + } + + // if no mercs, send 0 + if( iLowest == 999999 ) + { + iLowest = 0; + } + + + return iLowest; +} + + +INT32 GetHighestDailyCostOfCurrentTeam( void ) +{ + // will return the lowest daily cost of the current team + + SOLDIERTYPE *pSoldier; + INT32 cnt=0; + INT32 iCounter = 0; + INT32 iHighest = 0; +// INT32 iId =0; + INT32 iCost = 0; + + // first grunt + pSoldier = MercPtrs[0]; + + // not active?..return cost of zero + + // run through active soldiers + for ( pSoldier = MercPtrs[0]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++) + { + pSoldier = MercPtrs[cnt]; + + if( ( pSoldier->bActive) && !( pSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && ( pSoldier->bLife > 0 ) ) + { + + // valid soldier, get cost + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + // daily rate + if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + // 2 week contract + iCost = gMercProfiles[ pSoldier->ubProfile ].uiBiWeeklySalary / 14; + } + else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + { + // 1 week contract + iCost = gMercProfiles[ pSoldier->ubProfile ].uiWeeklySalary / 7 ; + } + else + { + + iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + } + else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { + // MERC Merc + iCost = gMercProfiles[ pSoldier->ubProfile ].sSalary; + } + else + { + // no cost + iCost = 0; + } + + + if( iCost >= iHighest ) + { + iHighest = iCost; + } + } + + } + return iHighest; +} + + + +void DisplayCostOfCurrentTeam( void ) +{ + // display number on team + CHAR16 sString[ 32 ]; + INT16 sX, sY; + + + // font stuff + SetFont( FONT10ARIAL ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( PERS_TEXT_FONT_COLOR ); + + if( fCurrentTeamMode == TRUE ) + { + + // daily cost + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_COST_Y, pPersonelTeamStrings[ 2 ] ); + + swprintf( sString, L"%d", GetTotalDailyCostOfCurrentTeam( ) ); + InsertCommasForDollarFigure( sString ); + InsertDollarSignInToString( sString ); + + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_CURR_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + + mprintf( sX ,PERS_CURR_TEAM_COST_Y, sString ); + + // highest cost + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_HIGHEST_Y, pPersonelTeamStrings[ 3 ] ); + + swprintf( sString, L"%d", GetHighestDailyCostOfCurrentTeam( ) ); + InsertCommasForDollarFigure( sString ); + InsertDollarSignInToString( sString ); + + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_CURR_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + + mprintf( sX ,PERS_CURR_TEAM_HIGHEST_Y, sString ); + + // the lowest cost + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_LOWEST_Y, pPersonelTeamStrings[ 4 ] ); + + swprintf( sString, L"%d", GetLowestDailyCostOfCurrentTeam( ) ); + InsertCommasForDollarFigure( sString ); + InsertDollarSignInToString( sString ); + + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_CURR_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + + mprintf( sX ,PERS_CURR_TEAM_LOWEST_Y, sString ); + + + } + else + { + // do nothing + return; + } +} + +INT32 GetIdOfDepartedMercWithHighestStat( INT32 iStat ) +{ + // will return the id value of the merc on the players team with highest in this stat + // -1 means error + INT32 iId = -1; + INT32 iValue =0; + MERCPROFILESTRUCT *pTeamSoldier; + INT32 cnt=0; + INT32 iCounter =0; + INT8 bCurrentList = 0; + INT16 *bCurrentListValue = LaptopSaveInfo.ubDeadCharactersList; + BOOLEAN fNotDone = TRUE; + SOLDIERTYPE *pSoldier; + UINT32 uiLoopCounter; + + + // run through active soldiers +// while( fNotDone ) + for( uiLoopCounter=0; fNotDone ; uiLoopCounter++ ) + { +/* + // check if we are in fact not done + if( ( bCurrentList == 2 ) && ( *bCurrentListValue == -1 ) ) + { + fNotDone = FALSE; + continue; + } +*/ + //if we are at the end of + if( uiLoopCounter == 255 && bCurrentList == 2 ) + { + fNotDone = FALSE; + continue; + } + + // check if we need to move to the next list +// if( *bCurrentListValue == -1 ) + if( uiLoopCounter == 255 ) + { + if( bCurrentList == 0 ) + { + bCurrentList = 1; + bCurrentListValue = LaptopSaveInfo.ubLeftCharactersList; + } + else if( bCurrentList == 1 ) + { + bCurrentList = 2; + bCurrentListValue = LaptopSaveInfo.ubOtherCharactersList; + } + + //reset the loop counter + uiLoopCounter = 0; + } + + // get the id of the grunt + cnt = *bCurrentListValue; + + // do we need to reset the count? + if( cnt == -1 ) + { + bCurrentListValue++; + continue; + } + + pTeamSoldier = &( gMercProfiles[ cnt ] ); + + switch( iStat ) + { + case 0: + // health + + //if the soldier is a pow, dont use the health cause it aint known + pSoldier = FindSoldierByProfileID( (UINT8)cnt, FALSE ); + if( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) + { + continue; + } + + if( pTeamSoldier -> bLife >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bLife; + } + break; + case 1: + // agility + if( pTeamSoldier -> bAgility >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bAgility; + } + break; + case 2: + // dexterity + if( pTeamSoldier -> bDexterity >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bDexterity; + } + break; + case 3: + // strength + if( pTeamSoldier -> bStrength >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bStrength; + } + break; + case 4: + // leadership + if( pTeamSoldier -> bLeadership >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bLeadership; + } + break; + case 5: + // wisdom + if( pTeamSoldier -> bWisdom >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bWisdom; + } + break; + case 6: + // exper + if( pTeamSoldier -> bExpLevel >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bExpLevel; + } + + break; + case 7: + //mrkmanship + if( pTeamSoldier -> bMarksmanship >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMarksmanship; + } + + break; + case 8: + // mech + if( pTeamSoldier -> bMechanical >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMechanical; + } + break; + case 9: + // exp + if(pTeamSoldier -> bExplosive >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bExplosive; + } + break; + case 10: + // med + if( pTeamSoldier -> bMedical >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMedical; + } + break; + } + + bCurrentListValue++; + } + + + return( iId ); +} + + +INT32 GetIdOfDepartedMercWithLowestStat( INT32 iStat ) +{ + // will return the id value of the merc on the players team with highest in this stat + // -1 means error + INT32 iId = -1; + INT32 iValue =9999999; + MERCPROFILESTRUCT *pTeamSoldier; + INT32 cnt=0; + INT32 iCounter =0; + INT8 bCurrentList = 0; + INT16 *bCurrentListValue = LaptopSaveInfo.ubDeadCharactersList; + BOOLEAN fNotDone = TRUE; + SOLDIERTYPE *pSoldier; + UINT32 uiLoopCounter; + + // run through active soldiers +// while( fNotDone ) + for( uiLoopCounter=0; fNotDone ; uiLoopCounter++ ) + { +/* + // check if we are in fact not done + if( ( bCurrentList == 2 ) && ( *bCurrentListValue == -1 ) ) + { + fNotDone = FALSE; + continue; + } +*/ + //if we are at the end of + if( uiLoopCounter == 255 && bCurrentList == 2 ) + { + fNotDone = FALSE; + continue; + } + + // check if we need to move to the next list +// if( *bCurrentListValue == -1 ) + if( uiLoopCounter == 255 ) + { + if( bCurrentList == 0 ) + { + bCurrentList = 1; + bCurrentListValue = LaptopSaveInfo.ubLeftCharactersList; + } + else if( bCurrentList == 1 ) + { + bCurrentList = 2; + bCurrentListValue = LaptopSaveInfo.ubOtherCharactersList; + } + + //reset the loop counter + uiLoopCounter = 0; + } + + // get the id of the grunt + cnt = *bCurrentListValue; + + // do we need to reset the count? + if( cnt == -1 ) + { + bCurrentListValue++; + continue; + } + + pTeamSoldier = &( gMercProfiles[ cnt ] ); + + + switch( iStat ) + { + case 0: + // health + + pSoldier = FindSoldierByProfileID( (UINT8)cnt, FALSE ); + if( pSoldier && pSoldier->bAssignment == ASSIGNMENT_POW ) + { + continue; + } + + if( pTeamSoldier -> bLife < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bLife; + } + break; + case 1: + // agility + if( pTeamSoldier -> bAgility < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bAgility; + } + break; + case 2: + // dexterity + if( pTeamSoldier -> bDexterity < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bDexterity; + } + break; + case 3: + // strength + if( pTeamSoldier -> bStrength < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bStrength; + } + break; + case 4: + // leadership + if( pTeamSoldier -> bLeadership < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bLeadership; + } + break; + case 5: + // wisdom + if( pTeamSoldier -> bWisdom < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bWisdom; + } + break; + case 6: + // exper + if( pTeamSoldier -> bExpLevel < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bExpLevel; + } + + break; + case 7: + //mrkmanship + if( pTeamSoldier -> bMarksmanship < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMarksmanship; + } + + break; + case 8: + // mech + if( pTeamSoldier -> bMechanical < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMechanical; + } + break; + case 9: + // exp + if(pTeamSoldier -> bExplosive < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bExplosive; + } + break; + case 10: + // med + if( pTeamSoldier -> bMedical < iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMedical; + } + break; + } + + bCurrentListValue++; + } + + + return( iId ); +} + + +INT32 GetIdOfMercWithHighestStat( INT32 iStat ) +{ + // will return the id value of the merc on the players team with highest in this stat + // -1 means error + INT32 iId = -1; + INT32 iValue =0; + SOLDIERTYPE *pTeamSoldier, *pSoldier; + INT32 cnt=0; + + // first grunt + pSoldier = MercPtrs[0]; + + + // run through active soldiers + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) + { + if( ( pTeamSoldier->bActive) && !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && ( pTeamSoldier->bLife > 0 ) && !AM_A_ROBOT( pTeamSoldier ) ) + { + switch( iStat ) + { + case 0: + // health + if( pTeamSoldier->bAssignment == ASSIGNMENT_POW ) + { + continue; + } + + if( pTeamSoldier -> bLifeMax >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bLifeMax; + } + break; + case 1: + // agility + if( pTeamSoldier -> bAgility >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bAgility; + } + break; + case 2: + // dexterity + if( pTeamSoldier -> bDexterity >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bDexterity; + } + break; + case 3: + // strength + if( pTeamSoldier -> bStrength >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bStrength; + } + break; + case 4: + // leadership + if( pTeamSoldier -> bLeadership >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bLeadership; + } + break; + case 5: + // wisdom + if( pTeamSoldier -> bWisdom >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bWisdom; + } + break; + case 6: + // exper + if( pTeamSoldier -> bExpLevel >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bExpLevel; + } + + break; + case 7: + //mrkmanship + if( pTeamSoldier -> bMarksmanship >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMarksmanship; + } + + break; + case 8: + // mech + if( pTeamSoldier -> bMechanical >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMechanical; + } + break; + case 9: + // exp + if(pTeamSoldier -> bExplosive >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bExplosive; + } + break; + case 10: + // med + if( pTeamSoldier -> bMedical >= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMedical; + } + break; + } + } + } + + + return( iId ); +} + +INT32 GetIdOfMercWithLowestStat( INT32 iStat ) +{ + // will return the id value of the merc on the players team with highest in this stat + // -1 means error + INT32 iId = -1; + INT32 iValue =999999; + SOLDIERTYPE *pTeamSoldier, *pSoldier; + INT32 cnt=0; + + // first grunt + pSoldier = MercPtrs[0]; + + + // run through active soldiers + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) + { + if(( pTeamSoldier->bActive) && !( pTeamSoldier->uiStatusFlags & SOLDIER_VEHICLE ) && ( pTeamSoldier->bLife > 0 ) && !AM_A_ROBOT( pTeamSoldier ) ) + { + + switch( iStat ) + { + case 0: + // health + + if( pTeamSoldier->bAssignment == ASSIGNMENT_POW ) + { + continue; + } + + if( pTeamSoldier -> bLifeMax <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bLifeMax; + } + break; + case 1: + // agility + if( pTeamSoldier -> bAgility <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bAgility; + } + break; + case 2: + // dexterity + if( pTeamSoldier -> bDexterity <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bDexterity; + } + break; + case 3: + // strength + if( pTeamSoldier -> bStrength <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bStrength; + } + break; + case 4: + // leadership + if( pTeamSoldier -> bLeadership <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bLeadership; + } + break; + case 5: + // wisdom + if( pTeamSoldier -> bWisdom <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bWisdom; + } + break; + case 6: + // exper + if( pTeamSoldier -> bExpLevel <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bExpLevel; + } + + break; + case 7: + //mrkmanship + if( pTeamSoldier -> bMarksmanship <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMarksmanship; + } + + break; + case 8: + // mech + if( pTeamSoldier -> bMechanical <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMechanical; + } + break; + case 9: + // exp + if( pTeamSoldier -> bExplosive <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bExplosive; + } + break; + case 10: + // med + if( pTeamSoldier -> bMedical <= iValue ) + { + iId = cnt; + iValue = pTeamSoldier -> bMedical; + } + break; + } + } + } + + + return( iId ); +} + + +INT32 GetAvgStatOfCurrentTeamStat( INT32 iStat ) +{ + // will return the id value of the merc on the players team with highest in this stat + // -1 means error + SOLDIERTYPE *pTeamSoldier, *pSoldier; + INT32 cnt=0; + INT32 iTotalStatValue = 0; + INT8 bNumberOfPows = 0; + UINT8 ubNumberOfMercsInCalculation = 0; + + + // first grunt + pSoldier = MercPtrs[0]; + + // run through active soldiers + for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) + { + if(( pTeamSoldier->bActive)&&( pTeamSoldier->bLife > 0 ) && !AM_A_ROBOT( pTeamSoldier ) ) + { + switch( iStat ) + { + case 0: + // health + + //if this is a pow, dont count his stats + if( pTeamSoldier->bAssignment == ASSIGNMENT_POW ) + { + bNumberOfPows++; + continue; + } + + iTotalStatValue += pTeamSoldier -> bLifeMax; + + break; + case 1: + // agility + iTotalStatValue +=pTeamSoldier -> bAgility; + + break; + case 2: + // dexterity + iTotalStatValue += pTeamSoldier -> bDexterity; + + break; + case 3: + // strength + iTotalStatValue += pTeamSoldier -> bStrength; + + break; + case 4: + // leadership + iTotalStatValue += pTeamSoldier -> bLeadership; + + break; + case 5: + // wisdom + + iTotalStatValue += pTeamSoldier -> bWisdom; + break; + case 6: + // exper + + iTotalStatValue += pTeamSoldier -> bExpLevel; + + break; + case 7: + //mrkmanship + + iTotalStatValue += pTeamSoldier -> bMarksmanship; + + break; + case 8: + // mech + + iTotalStatValue += pTeamSoldier -> bMechanical; + break; + case 9: + // exp + + iTotalStatValue += pTeamSoldier ->bExplosive; + break; + case 10: + // med + + iTotalStatValue += pTeamSoldier -> bMedical; + break; + } + + ubNumberOfMercsInCalculation++; + } + } + + + //if the stat is health, and there are only pow's + if( GetNumberOfMercsOnPlayersTeam( ) != 0 && GetNumberOfMercsOnPlayersTeam( ) == bNumberOfPows && iStat == 0 ) + { + return( - 1 ); + } + else if( ( ubNumberOfMercsInCalculation - bNumberOfPows ) > 0 ) + { + return( iTotalStatValue / ( ubNumberOfMercsInCalculation - bNumberOfPows ) ); + } + else + { + return( 0 ); + } +} + + +INT32 GetAvgStatOfPastTeamStat( INT32 iStat ) +{ + // will return the id value of the merc on the players team with highest in this stat + // -1 means error + INT32 cnt=0; + INT32 iTotalStatValue = 0; + INT32 iId = -1; + MERCPROFILESTRUCT *pTeamSoldier; + INT32 iCounter =0; + INT8 bCurrentList = 0; + INT16 *bCurrentListValue = LaptopSaveInfo.ubDeadCharactersList; + BOOLEAN fNotDone = TRUE; + UINT32 uiLoopCounter; + + // run through active soldiers + + //while( fNotDone ) + for( uiLoopCounter=0; fNotDone ; uiLoopCounter++ ) + { +/* + // check if we are in fact not done + if( ( bCurrentList == 2 ) && ( *bCurrentListValue == -1 ) ) + { + fNotDone = FALSE; + continue; + } +*/ + + //if we are at the end of + if( uiLoopCounter == 255 && bCurrentList == 2 ) + { + fNotDone = FALSE; + continue; + } + + // check if we need to move to the next list +// if( *bCurrentListValue == -1 ) + if( uiLoopCounter == 255 ) + { + if( bCurrentList == 0 ) + { + bCurrentList = 1; + bCurrentListValue = LaptopSaveInfo.ubLeftCharactersList; + } + else if( bCurrentList == 1 ) + { + bCurrentList = 2; + bCurrentListValue = LaptopSaveInfo.ubOtherCharactersList; + } + + //reset the loop counter + uiLoopCounter = 0; + } + + // get the id of the grunt + cnt = *bCurrentListValue; + + // do we need to reset the count? + if( cnt == -1 ) + { + bCurrentListValue++; + continue; + } + + pTeamSoldier = &( gMercProfiles[ cnt ] ); + + switch( iStat ) + { + case 0: + // health + + iTotalStatValue += pTeamSoldier -> bLife; + + break; + case 1: + // agility + + iTotalStatValue += pTeamSoldier -> bAgility; + + break; + case 2: + // dexterity + + iTotalStatValue += pTeamSoldier -> bDexterity; + + break; + case 3: + // strength + + iTotalStatValue += pTeamSoldier -> bStrength; + + break; + case 4: + // leadership + + iTotalStatValue += pTeamSoldier -> bLeadership; + + break; + case 5: + // wisdom + + iTotalStatValue += pTeamSoldier -> bWisdom; + + break; + case 6: + // exper + + iTotalStatValue += pTeamSoldier -> bExpLevel; + + + break; + case 7: + //mrkmanship + + iId = cnt; + iTotalStatValue += pTeamSoldier -> bMarksmanship; + + + break; + case 8: + // mech + + iTotalStatValue += pTeamSoldier -> bMechanical; + + break; + case 9: + // exp + + iTotalStatValue += pTeamSoldier -> bExplosive; + + break; + case 10: + // med + + iTotalStatValue += pTeamSoldier -> bMedical; + break; + } + + bCurrentListValue++; + } + + if( GetNumberOfPastMercsOnPlayersTeam( ) > 0 ) + { + return( iTotalStatValue / GetNumberOfPastMercsOnPlayersTeam( ) ); + } + else + { + return( 0 ); + } +} + +void DisplayAverageStatValuesForCurrentTeam( void ) +{ + // will display the average values for stats for the current team + INT16 sX, sY; + INT32 iCounter = 0; + CHAR16 sString[ 32 ]; + + // set up font + SetFont( FONT10ARIAL ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( PERS_TEXT_FONT_COLOR ); + + // display header + + // center + FindFontCenterCoordinates( PERS_STAT_AVG_X, 0 ,PERS_STAT_AVG_WIDTH, 0 , pPersonnelCurrentTeamStatsStrings[ 1 ], FONT10ARIAL , &sX, &sY ); + + mprintf( sX, PERS_STAT_AVG_Y, pPersonnelCurrentTeamStatsStrings[ 1 ] ); + + // nobody on team leave + if( ( GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == TRUE ) ) + { + return; + } + + // check if in past team and nobody on past team + if( ( GetNumberOfPastMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == FALSE ) ) + { + return; + } + + + for( iCounter = 0; iCounter < 11; iCounter++ ) + { + + // even or odd?..color black or yellow? + if( iCounter % 2 == 0 ) + { + SetFontForeground( PERS_TEXT_FONT_ALTERNATE_COLOR ); + } + else + { + SetFontForeground( PERS_TEXT_FONT_COLOR ); + } + + if( fCurrentTeamMode == TRUE ) + { + INT32 iValue = GetAvgStatOfCurrentTeamStat( iCounter ); + + //if there are no values + if( iValue == -1 ) + swprintf( sString, L"%s", pPOWStrings[ 1 ] ); + else + swprintf( sString, L"%d", iValue ); + + } + else + { + swprintf( sString, L"%d", GetAvgStatOfPastTeamStat( iCounter ) ); + } + // center + FindFontCenterCoordinates( PERS_STAT_AVG_X, 0 ,PERS_STAT_AVG_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); + + mprintf( sX, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); + } + + return; +} + +void DisplayLowestStatValuesForCurrentTeam( void ) +{ + // will display the average values for stats for the current team + INT16 sX, sY; + INT32 iCounter = 0; + CHAR16 sString[ 32 ]; + INT32 iStat = 0; + INT32 iDepartedId=0; + INT32 iId = 0; + + // set up font + SetFont( FONT10ARIAL ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( PERS_TEXT_FONT_COLOR ); + + // display header + + // center + FindFontCenterCoordinates( PERS_STAT_LOWEST_X, 0 ,PERS_STAT_LOWEST_WIDTH, 0 , pPersonnelCurrentTeamStatsStrings[ 0 ], FONT10ARIAL , &sX, &sY ); + + mprintf( sX, PERS_STAT_AVG_Y, pPersonnelCurrentTeamStatsStrings[ 0 ] ); + + // nobody on team leave + if( ( GetNumberOfMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == TRUE) ) + { + return; + } + + if( ( GetNumberOfPastMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == FALSE ) ) + { + return; + } + + for( iCounter = 0; iCounter < 11; iCounter++ ) + { + if( fCurrentTeamMode == TRUE ) + { + iId = GetIdOfMercWithLowestStat( iCounter ); +// if( iId == -1 ) +// continue; + } + else + { + iDepartedId = GetIdOfDepartedMercWithLowestStat( iCounter ); + if( iDepartedId == -1 ) + continue; + } + + // even or odd?..color black or yellow? + if( iCounter % 2 == 0 ) + { + SetFontForeground( PERS_TEXT_FONT_ALTERNATE_COLOR ); + } + else + { + SetFontForeground( PERS_TEXT_FONT_COLOR ); + } + + if( fCurrentTeamMode == TRUE ) + { + // get name + if( iId == -1 ) + swprintf( sString, L"%s", pPOWStrings[1] ); + else + swprintf( sString, L"%s", MercPtrs[ iId ] -> name ); + } + else + { + // get name + swprintf( sString, L"%s", gMercProfiles[ iDepartedId ].zNickname ); + } + // print name + mprintf( PERS_STAT_LOWEST_X, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); + + switch( iCounter ) + { + case 0: + // health + if( fCurrentTeamMode == TRUE ) + { + if( iId == -1 ) + iStat = -1; + else + iStat = MercPtrs[ iId ] -> bLifeMax; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bLife; + } + break; + case 1: + // agility + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bAgility; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bAgility; + } + + break; + case 2: + // dexterity + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bDexterity; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bDexterity; + } + + break; + case 3: + // strength + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bStrength; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bStrength; + } + + break; + case 4: + // leadership + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bLeadership; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bLeadership; + } + break; + case 5: + // wisdom + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bWisdom; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bWisdom; + } + break; + case 6: + // exper + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bExpLevel; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bExpLevel; + } + break; + case 7: + //mrkmanship + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bMarksmanship; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bMarksmanship; + } + break; + case 8: + // mech + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bMechanical; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bMechanical; + } + break; + case 9: + // exp + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bExplosive; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bExplosive; + } + break; + case 10: + // med + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bMedical; + } + else + { + iStat = gMercProfiles[ iDepartedId ] . bMedical; + } + break; + } + + if( iStat == -1 ) + swprintf( sString, L"%s", pPOWStrings[1] ); + else + swprintf( sString, L"%d", iStat ); + + // right justify + FindFontRightCoordinates( PERS_STAT_LOWEST_X, 0 ,PERS_STAT_LOWEST_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); + + mprintf( sX, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); + } + + return; +} + + +void DisplayHighestStatValuesForCurrentTeam( void ) +{ + // will display the average values for stats for the current team + INT16 sX, sY; + INT32 iCounter = 0; + CHAR16 sString[ 32 ]; + INT32 iStat = 0; + INT32 iId=0; + + // set up font + SetFont( FONT10ARIAL ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( PERS_TEXT_FONT_COLOR ); + + // display header + + // center + FindFontCenterCoordinates( PERS_STAT_HIGHEST_X, 0 ,PERS_STAT_LOWEST_WIDTH, 0 , pPersonnelCurrentTeamStatsStrings[ 2 ], FONT10ARIAL , &sX, &sY ); + + mprintf( sX, PERS_STAT_AVG_Y, pPersonnelCurrentTeamStatsStrings[ 2 ] ); + + // nobody on team leave + if( ( GetNumberOfMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == TRUE) ) + { + return; + } + + if( ( GetNumberOfPastMercsOnPlayersTeam( ) == 0 ) && ( fCurrentTeamMode == FALSE ) ) + { + return; + } + + for( iCounter = 0; iCounter < 11; iCounter++ ) + { + if( fCurrentTeamMode == TRUE ) + iId = GetIdOfMercWithHighestStat( iCounter ); + else + iId = GetIdOfDepartedMercWithHighestStat( iCounter ); + +// if( iId == -1 ) +// continue; + + // even or odd?..color black or yellow? + if( iCounter % 2 == 0 ) + { + SetFontForeground( PERS_TEXT_FONT_ALTERNATE_COLOR ); + } + else + { + SetFontForeground( PERS_TEXT_FONT_COLOR ); + } + + + if( fCurrentTeamMode == TRUE ) + { + // get name + if( iId == -1 ) + swprintf( sString, L"%s", pPOWStrings[1] ); + else + swprintf( sString, L"%s", MercPtrs[ iId ] -> name ); + } + else + { + // get name + swprintf( sString, L"%s", gMercProfiles[ iId ].zNickname ); + } + // print name + mprintf( PERS_STAT_HIGHEST_X, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); + + switch( iCounter ) + { + case 0: + // health + if( fCurrentTeamMode == TRUE ) + { + if( iId == -1 ) + iStat = -1; + else + iStat = MercPtrs[ iId ] -> bLifeMax; + } + else + { + iStat = gMercProfiles[ iId ] . bLife; + } + break; + case 1: + // agility + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bAgility; + } + else + { + iStat = gMercProfiles[ iId ] . bAgility; + } + + break; + case 2: + // dexterity + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bDexterity; + } + else + { + iStat = gMercProfiles[ iId ] . bDexterity; + } + + break; + case 3: + // strength + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bStrength; + } + else + { + iStat = gMercProfiles[ iId ] . bStrength; + } + + break; + case 4: + // leadership + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bLeadership; + } + else + { + iStat = gMercProfiles[ iId ] . bLeadership; + } + break; + case 5: + // wisdom + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bWisdom; + } + else + { + iStat = gMercProfiles[ iId ] . bWisdom; + } + break; + case 6: + // exper + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bExpLevel; + } + else + { + iStat = gMercProfiles[ iId ] . bExpLevel; + } + break; + case 7: + //mrkmanship + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bMarksmanship; + } + else + { + iStat = gMercProfiles[ iId ] . bMarksmanship; + } + break; + case 8: + // mech + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bMechanical; + } + else + { + iStat = gMercProfiles[ iId ] . bMechanical; + } + break; + case 9: + // exp + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bExplosive; + } + else + { + iStat = gMercProfiles[ iId ] . bExplosive; + } + break; + case 10: + // med + if( fCurrentTeamMode == TRUE ) + { + iStat = MercPtrs[ iId ] -> bMedical; + } + else + { + iStat = gMercProfiles[ iId ] . bMedical; + } + break; + } + + if( iStat == -1 ) + swprintf( sString, L"%s", pPOWStrings[1] ); + else + swprintf( sString, L"%d", iStat ); + + // right justify + FindFontRightCoordinates( PERS_STAT_HIGHEST_X, 0 ,PERS_STAT_LOWEST_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); + + mprintf( sX, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); + } + + return; +} + + + +void DisplayPersonnelTeamStats( void ) +{ + // displays the stat title for each row in the team stat list + INT32 iCounter =0; + + + // set up font + SetFont( FONT10ARIAL ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( FONT_WHITE ); + + + // display titles for each row + for( iCounter = 0; iCounter < 11; iCounter++ ) + { + // even or odd?..color black or yellow? + if( iCounter % 2 == 0 ) + { + SetFontForeground( PERS_TEXT_FONT_ALTERNATE_COLOR ); + } + else + { + SetFontForeground( PERS_TEXT_FONT_COLOR ); + } + + mprintf( PERS_STAT_LIST_X, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), pPersonnelTeamStatsStrings[ iCounter ] ); + } + + + return; +} + + +INT32 GetNumberOfPastMercsOnPlayersTeam( void ) +{ + INT32 iPastNumberOfMercs = 0; + INT32 iCounter = 0; + // will run through the alist of past mercs on the players team and return thier number + + // dead + iPastNumberOfMercs += GetNumberOfDeadOnPastTeam( ); + + // left + iPastNumberOfMercs += GetNumberOfLeftOnPastTeam( ); + + // other + iPastNumberOfMercs += GetNumberOfOtherOnPastTeam( ); + + + return iPastNumberOfMercs; +} + + +void InitPastCharactersList( void ) +{ + // inits the past characters list + memset( &LaptopSaveInfo.ubDeadCharactersList, -1, sizeof( LaptopSaveInfo.ubDeadCharactersList ) ); + memset( &LaptopSaveInfo.ubLeftCharactersList, -1, sizeof( LaptopSaveInfo.ubLeftCharactersList ) ); + memset( &LaptopSaveInfo.ubOtherCharactersList, -1, sizeof( LaptopSaveInfo.ubOtherCharactersList ) ); + + return; +} + + +INT32 GetNumberOfDeadOnPastTeam( void ) +{ + + INT32 iNumberDead = 0; + INT32 iCounter = 0; + +// for( iCounter = 0; ( ( iCounter < 256) && ( LaptopSaveInfo.ubDeadCharactersList[ iCounter ] != -1 ) ) ; iCounter ++ ) + for( iCounter = 0; iCounter < 256 ; iCounter ++ ) + { + if( LaptopSaveInfo.ubDeadCharactersList[ iCounter ] != -1 ) + iNumberDead++; + } + + + return( iNumberDead ); + +} + + +INT32 GetNumberOfLeftOnPastTeam( void ) +{ + + INT32 iNumberLeft = 0; + INT32 iCounter = 0; + + for( iCounter = 0; iCounter < 256 ; iCounter ++ ) + { + if( LaptopSaveInfo.ubLeftCharactersList[ iCounter ] != -1 ) + iNumberLeft++; + } + + + return( iNumberLeft ); + +} + + +INT32 GetNumberOfOtherOnPastTeam( void ) +{ + + INT32 iNumberOther = 0; + INT32 iCounter = 0; + + for( iCounter = 0; iCounter < 256 ; iCounter ++ ) + { + if( LaptopSaveInfo.ubOtherCharactersList[ iCounter ] != -1 ) + iNumberOther++; + } + + + return( iNumberOther ); + +} + + +void DisplayStateOfPastTeamMembers( void ) +{ + INT16 sX, sY; + CHAR16 sString[ 32 ]; + + + // font stuff + SetFont( FONT10ARIAL ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( PERS_TEXT_FONT_COLOR ); + + + // diplsya numbers fired, dead and othered + if( fCurrentTeamMode == FALSE ) + { + + // dead + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_COST_Y, pPersonelTeamStrings[ 5 ] ); + swprintf( sString, L"%d", GetNumberOfDeadOnPastTeam( ) ); + + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_DEPART_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + + mprintf( sX ,PERS_CURR_TEAM_COST_Y, sString ); + + // fired + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_HIGHEST_Y, pPersonelTeamStrings[ 6 ] ); + swprintf( sString, L"%d", GetNumberOfLeftOnPastTeam( ) ); + + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_DEPART_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + + mprintf( sX ,PERS_CURR_TEAM_HIGHEST_Y, sString ); + + // other + mprintf( PERS_CURR_TEAM_COST_X, PERS_CURR_TEAM_LOWEST_Y, pPersonelTeamStrings[ 7 ] ); + swprintf( sString, L"%d", GetNumberOfOtherOnPastTeam( ) ); + + FindFontRightCoordinates((INT16)(PERS_CURR_TEAM_COST_X),0,PERS_DEPART_TEAM_WIDTH,0,sString, PERS_FONT, &sX, &sY); + + mprintf( sX ,PERS_CURR_TEAM_LOWEST_Y, sString ); + } + else + { + // do nothing + } + return; +} + + + +void CreateDestroyCurrentDepartedMouseRegions( void ) +{ + + static BOOLEAN fCreated = FALSE; + + // will arbitrate the creation/deletion of mouse regions for current/past team toggles + + + if( ( fCreateRegionsForPastCurrentToggle == TRUE ) && ( fCreated == FALSE ) ) + { + // not created, create + MSYS_DefineRegion(&gTogglePastCurrentTeam[ 0 ], PERS_TOGGLE_CUR_DEPART_X, PERS_TOGGLE_CUR_Y, PERS_TOGGLE_CUR_DEPART_X + PERS_TOGGLE_CUR_DEPART_WIDTH, PERS_TOGGLE_CUR_Y + PERS_TOGGLE_CUR_DEPART_HEIGHT, + MSYS_PRIORITY_HIGHEST - 3 ,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, PersonnelCurrentTeamCallback); + + MSYS_AddRegion( &gTogglePastCurrentTeam[ 0 ] ); + + MSYS_DefineRegion(&gTogglePastCurrentTeam[ 1 ], PERS_TOGGLE_CUR_DEPART_X, PERS_TOGGLE_DEPART_Y , PERS_TOGGLE_CUR_DEPART_X + PERS_TOGGLE_CUR_DEPART_WIDTH, PERS_TOGGLE_DEPART_Y + PERS_TOGGLE_CUR_DEPART_HEIGHT, + MSYS_PRIORITY_HIGHEST - 3,CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, PersonnelDepartedTeamCallback); + + MSYS_AddRegion( &gTogglePastCurrentTeam[ 1 ] ); + + fCreated = TRUE; + + } + else if( ( fCreateRegionsForPastCurrentToggle == FALSE ) && ( fCreated == TRUE ) ) + { + // created, get rid of + + MSYS_RemoveRegion( &gTogglePastCurrentTeam[ 0 ] ); + MSYS_RemoveRegion( &gTogglePastCurrentTeam[ 1 ] ); + fCreated = FALSE; + } + + return; +} + + + +void PersonnelCurrentTeamCallback( MOUSE_REGION * pRegion, INT32 iReason ) +{ + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + fCurrentTeamMode = TRUE; + + if( fCurrentTeamMode == TRUE ) + { + iCurrentPersonSelectedId = -1; + + // how many people do we have?..if you have someone set default to 0 + if( GetNumberOfMercsDeadOrAliveOnPlayersTeam() > 0 ) + { + // get id of first merc in list + + iCurrentPersonSelectedId = GetIdOfFirstDisplayedMerc( ); + } + } + + fCurrentTeamMode = TRUE; + fReDrawScreenFlag = TRUE; + } + +} + + +void PersonnelDepartedTeamCallback( MOUSE_REGION * pRegion, INT32 iReason ) +{ + if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + + fCurrentTeamMode = FALSE; + + if( fCurrentTeamMode == FALSE ) + { + iCurrentPersonSelectedId = -1; + + // how many departed people? + if( GetNumberOfPastMercsOnPlayersTeam( ) > 0 ) + { + iCurrentPersonSelectedId = 0; + } + + //Switch the panel on the right to be the stat panel + gubPersonnelInfoState = PERSONNEL_STAT_BTN; + } + + fReDrawScreenFlag = TRUE; + } + +} + + + +void CreateDestroyButtonsForDepartedTeamList( void ) +{ + // creates/ destroys the buttons for cdeparted team list + static BOOLEAN fCreated = FALSE; + + if( ( fCurrentTeamMode == FALSE ) && ( fCreated == FALSE ) ) + { + // not created. create + giPersonnelButtonImage[ 4 ]= LoadButtonImage( "LAPTOP\\departuresbuttons.sti" ,-1,0,-1,2,-1 ); + giPersonnelButton[ 4 ] = QuickCreateButton( giPersonnelButtonImage[4], PERS_DEPARTED_UP_X, PERS_DEPARTED_UP_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)DepartedUpCallBack); + + // right button + giPersonnelButtonImage[ 5 ]= LoadButtonImage( "LAPTOP\\departuresbuttons.sti" ,-1,1,-1,3,-1 ); + giPersonnelButton[ 5 ] = QuickCreateButton( giPersonnelButtonImage[5], PERS_DEPARTED_UP_X, PERS_DEPARTED_DOWN_Y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)DepartedDownCallBack); + + // set up cursors for these buttons + SetButtonCursor( giPersonnelButton[ 4 ], CURSOR_LAPTOP_SCREEN); + SetButtonCursor( giPersonnelButton[ 5 ], CURSOR_LAPTOP_SCREEN); + + + fCreated = TRUE; + } + else if( ( fCurrentTeamMode == TRUE ) && ( fCreated == TRUE ) ) + { + // created. destroy + RemoveButton(giPersonnelButton[4] ); + UnloadButtonImage(giPersonnelButtonImage[4] ); + RemoveButton(giPersonnelButton[5] ); + UnloadButtonImage(giPersonnelButtonImage[5] ); + fCreated = FALSE; + fReDrawScreenFlag = TRUE; + } +} + + +void DepartedUpCallBack(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + if( giCurrentUpperLeftPortraitNumber - 20 >= 0 ) + { + giCurrentUpperLeftPortraitNumber-=20; + fReDrawScreenFlag = TRUE; + } + } + } +} + + +void DepartedDownCallBack(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + if( ( giCurrentUpperLeftPortraitNumber + 20 ) < ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) ) + { + giCurrentUpperLeftPortraitNumber+=20; + fReDrawScreenFlag = TRUE; + } + } + } +} + +void DisplayPastMercsPortraits( void ) +{ + // display past mercs portraits, starting at giCurrentUpperLeftPortraitNumber and going up 20 mercs + // start at dead mercs, then fired, then other + + INT32 iCounter = 0; + INT32 iCounterA = 0; + INT32 iStartArray = 0; // 0 = dead list, 1 = fired list, 2 = other list + BOOLEAN fFound = FALSE; + + // not time to display + if( fCurrentTeamMode == TRUE ) + { + return; + } + + // go through dead list +// for( iCounterA = 0; ( ( LaptopSaveInfo.ubDeadCharactersList[ iCounterA ] != -1 ) && ( iCounter < giCurrentUpperLeftPortraitNumber ) ); iCounter++, iCounterA++ ); + for( iCounterA = 0; ( iCounter < giCurrentUpperLeftPortraitNumber ); iCounterA++ ) + { + if( LaptopSaveInfo.ubDeadCharactersList[ iCounterA ] != -1 ) + iCounter++; + } + + if( iCounter < giCurrentUpperLeftPortraitNumber) + { + // now the fired list +// for( iCounterA = 0; ( ( LaptopSaveInfo.ubLeftCharactersList[ iCounterA ] != -1 ) && ( iCounter < giCurrentUpperLeftPortraitNumber ) ); iCounter++, iCounterA++ ); + for( iCounterA = 0; ( ( iCounter < giCurrentUpperLeftPortraitNumber ) ); iCounterA++ ) + { + if( LaptopSaveInfo.ubLeftCharactersList[ iCounterA ] != -1 ) + { + iCounter++; + } + } + + if( iCounter < 20 ) + { + iStartArray = 0; + } + else + { + iStartArray = 1; + } + } + else + { + iStartArray = 0; + } + + if( ( iCounter < giCurrentUpperLeftPortraitNumber ) && ( iStartArray != 0 ) ) + { + // now the fired list +// for( iCounterA = 0; ( ( LaptopSaveInfo.ubOtherCharactersList[ iCounterA ] != -1 ) && ( iCounter < giCurrentUpperLeftPortraitNumber ) ); iCounter++, iCounterA++ ); + for( iCounterA = 0; ( iCounter < giCurrentUpperLeftPortraitNumber ); iCounterA++ ) + { + if( LaptopSaveInfo.ubOtherCharactersList[ iCounterA ] != -1 ) + iCounter++; + } + + if( iCounter < 20 ) + { + iStartArray = 1; + } + else + { + iStartArray = 2; + } + } + else if( iStartArray != 0 ) + { + iStartArray = 1; + } + + //; we now have the array to start in, the position + + iCounter = 0; + + if( iStartArray == 0 ) + { + // run through list and display +// for( iCounterA ; ( ( iCounter < 20 ) && ( LaptopSaveInfo.ubDeadCharactersList[ iCounterA ] != -1 ) ); iCounter++, iCounterA++ ) + for( iCounterA ; iCounter < 20 && iCounterA < 256; iCounterA++ ) + { + // show dead pictures + if( LaptopSaveInfo.ubDeadCharactersList[ iCounterA ] != -1 ) + { + DisplayPortraitOfPastMerc( LaptopSaveInfo.ubDeadCharactersList[ iCounterA ], iCounter, TRUE, FALSE, FALSE ); + iCounter++; + } + } + + // reset counter A for the next array, if applicable + iCounterA = 0; + } + if( iStartArray <= 1 ) + { +// for( iCounterA ; ( ( iCounter < 20 ) && ( LaptopSaveInfo.ubLeftCharactersList[ iCounterA ] != -1 ) ); iCounter++, iCounterA++ ) + for( iCounterA ; ( iCounter < 20 && iCounterA < 256 ); iCounterA++ ) + { + // show fired pics + if( LaptopSaveInfo.ubLeftCharactersList[ iCounterA ] != -1 ) + { + DisplayPortraitOfPastMerc( LaptopSaveInfo.ubLeftCharactersList[ iCounterA ], iCounter, FALSE, TRUE, FALSE ); + iCounter++; + } + } + // reset counter A for the next array, if applicable + iCounterA = 0; + } + + if( iStartArray <= 2 ) + { +// for( iCounterA ; ( ( iCounter < 20 ) && ( LaptopSaveInfo.ubOtherCharactersList[ iCounterA ] != -1 ) ) ; iCounter++, iCounterA++ ) + for( iCounterA ; ( iCounter < 20 && iCounterA < 256 ); iCounterA++ ) + { + // show other pics + if( LaptopSaveInfo.ubOtherCharactersList[ iCounterA ] != -1 ) + { + DisplayPortraitOfPastMerc( LaptopSaveInfo.ubOtherCharactersList[ iCounterA ], iCounter, FALSE, FALSE, TRUE ); + iCounter++; + } + } + // reset counter A for the next array, if applicable + iCounterA = 0; + } + + + + return; +} + + +INT32 GetIdOfPastMercInSlot( INT32 iSlot ) +{ + + INT32 iCounter =-1; + INT32 iCounterA =0; + // returns ID of Merc in this slot + + // not time to display + if( fCurrentTeamMode == TRUE ) + { + return -1; + } + + if( iSlot > ( ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) - giCurrentUpperLeftPortraitNumber ) ) + { + // invalid slot + return iCurrentPersonSelectedId; + } + // go through dead list + for( iCounterA = 0; ( ( iCounter ) < iSlot + giCurrentUpperLeftPortraitNumber); iCounterA++ ) + { + if( LaptopSaveInfo.ubDeadCharactersList[ iCounterA ] != -1 ) + iCounter++; + } + + if( iSlot + giCurrentUpperLeftPortraitNumber == iCounter) + { + return ( LaptopSaveInfo.ubDeadCharactersList[ iCounterA - 1] ); + } + + // now the fired list + iCounterA =0; + for( iCounterA = 0; ( ( ( iCounter )< iSlot + giCurrentUpperLeftPortraitNumber) ); iCounterA++ ) + { + if( LaptopSaveInfo.ubLeftCharactersList[ iCounterA ] != -1 ) + iCounter++; + } + + if( iSlot + giCurrentUpperLeftPortraitNumber == iCounter) + { + return ( LaptopSaveInfo.ubLeftCharactersList[ iCounterA - 1 ] ); + } + + + // now the fired list + iCounterA =0; + for( iCounterA = 0; ( ( ( iCounter ) < ( iSlot + giCurrentUpperLeftPortraitNumber ) ) ); iCounterA++ ) + { + if( LaptopSaveInfo.ubOtherCharactersList[ iCounterA ] != -1 ) + iCounter++; + } + + return( LaptopSaveInfo.ubOtherCharactersList[ iCounterA - 1] ); + +} + + + + + +BOOLEAN DisplayPortraitOfPastMerc( INT32 iId , INT32 iCounter, BOOLEAN fDead, BOOLEAN fFired, BOOLEAN fOther ) +{ + + + char sTemp[100]; + HVOBJECT hFaceHandle; + VOBJECT_DESC VObjectDesc; + + + + if( ( 50 < iId )&&( 57 > iId ) ) + { + sprintf( sTemp, "%s%03d.sti", SMALL_FACES_DIR, gMercProfiles[ iId ].ubFaceIndex ); + } + else + { + if( iId < 100 ) + { + sprintf(sTemp, "%s%02d.sti", SMALL_FACES_DIR, iId ); + } + else + { + sprintf(sTemp, "%s%03d.sti", SMALL_FACES_DIR, iId ); + } + } + + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP(sTemp, VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiFACE)); + + + //Blt face to screen to + GetVideoObject(&hFaceHandle, guiFACE); + + if( fDead ) + { + hFaceHandle->pShades[ 0 ] = Create16BPPPaletteShaded( hFaceHandle->pPaletteEntry, DEAD_MERC_COLOR_RED, DEAD_MERC_COLOR_GREEN, DEAD_MERC_COLOR_BLUE, TRUE ); + + //set the red pallete to the face + SetObjectHandleShade( guiFACE, 0 ); + } + + BltVideoObject(FRAME_BUFFER, hFaceHandle, 0,( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT ), VO_BLT_SRCTRANSPARENCY,NULL); + + +/* + text on the Small portrait + if( fDead ) + { + //if the merc is dead, display it +// DrawTextToScreen(pDepartedMercPortraitStrings[0], ( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT + SMALL_PORT_HEIGHT / 2 ), SMALL_PORTRAIT_WIDTH_NO_BORDERS, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( AimPopUpText[ AIM_MEMBER_DEAD ], ( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT + SMALL_PORT_HEIGHT / 2 ), SMALL_PORTRAIT_WIDTH_NO_BORDERS, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + else if( fFired ) + { + DrawTextToScreen(pDepartedMercPortraitStrings[1], ( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT + SMALL_PORT_HEIGHT / 2 ), SMALL_PORTRAIT_WIDTH_NO_BORDERS, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + else if( fOther ) + { + DrawTextToScreen(pDepartedMercPortraitStrings[2], ( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCounter % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCounter / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT + SMALL_PORT_HEIGHT / 2 ), SMALL_PORTRAIT_WIDTH_NO_BORDERS, FONT10ARIAL, 145, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } +*/ + + DeleteVideoObjectFromIndex(guiFACE); + + return ( TRUE ); +} + + + + +void DisplayDepartedCharStats(INT32 iId, INT32 iSlot, INT32 iState) +{ + INT32 iCounter=0; + wchar_t sString[50]; + INT16 sX, sY; + UINT32 uiHits = 0; + + // font stuff + SetFont( FONT10ARIAL ); + SetFontBackground( FONT_BLACK ); + SetFontForeground( PERS_TEXT_FONT_COLOR ); + + // display the stats for a char + for(iCounter=0;iCounter 0 ) + { + uiHits /= ( UINT32 )gMercProfiles[iId].usShotsFired; + } + else + { + // no, set hit % to 0 + uiHits = 0; + } + + swprintf(sString, L"%d %%%%",uiHits); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + sX += StringPixLength( L"%", PERS_FONT ); + mprintf(sX,pPersonnelScreenPoints[23].y,sString); + break; + case 17: + // battles + mprintf((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[24].y,pPersonnelScreenStrings[PRSNL_TXT_BATTLES]); + swprintf(sString, L"%d",gMercProfiles[iId].usBattlesFought); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[24].y,sString); + break; + case 18: + // wounds + mprintf((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[25].y,pPersonnelScreenStrings[PRSNL_TXT_TIMES_WOUNDED]); + swprintf(sString, L"%d",gMercProfiles[iId].usTimesWounded); + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[25].y,sString); + break; + } + } + + return; +} + + +void EnableDisableDeparturesButtons( void ) +{ + + // will enable or disable departures buttons based on upperleft picutre index value + if( ( fCurrentTeamMode == TRUE )||( fNewMailFlag == TRUE ) ) + { + return; + } + + // disable both buttons + DisableButton( giPersonnelButton[ 4 ] ); + DisableButton( giPersonnelButton[ 5 ] ); + + + if( giCurrentUpperLeftPortraitNumber != 0 ) + { + // enable up button + EnableButton( giPersonnelButton[ 4 ] ); + } + if( ( GetNumberOfDeadOnPastTeam( ) + GetNumberOfLeftOnPastTeam( ) + GetNumberOfOtherOnPastTeam( ) ) - giCurrentUpperLeftPortraitNumber >= 20 ) + { + // enable down button + EnableButton( giPersonnelButton[ 5 ] ); + } + + + return; +} + + +void DisplayDepartedCharName( INT32 iId, INT32 iSlot, INT32 iState ) +{ + // get merc's nickName, assignment, and sector location info + INT16 sX, sY; + CHAR16 sString[ 32 ]; + + SetFont(CHAR_NAME_FONT); + SetFontForeground(PERS_TEXT_FONT_COLOR); + SetFontBackground(FONT_BLACK); + + if( ( iState == -1 )||( iId == -1 ) ) + { + return; + } + + swprintf( sString, L"%s", gMercProfiles[ iId ].zNickname ); + + // nick name - assignment + FindFontCenterCoordinates(IMAGE_BOX_X-5,0,IMAGE_BOX_WIDTH + 90 , 0,sString,CHAR_NAME_FONT, &sX, &sY ); + + // cehck to se eif we are going to go off the left edge + if( sX < pPersonnelScreenPoints[ 0 ].x ) + { + sX = ( INT16 )pPersonnelScreenPoints[ 0 ].x; + } + + mprintf( sX + iSlot * IMAGE_BOX_WIDTH, CHAR_NAME_Y, sString ); + + + // state + if( gMercProfiles[ iId ].ubMiscFlags2 & PROFILE_MISC_FLAG2_MARRIED_TO_HICKS ) + { + //displaye 'married' + swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_MARRIED ] ); + } + else if( iState == DEPARTED_DEAD ) + { + swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_DEAD ] ); + } + + //if the merc is an AIM merc + else if( iId < BIFF ) + { + //if dismissed + if( iState == DEPARTED_FIRED ) + swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_FIRED ] ); + else + swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_CONTRACT_EXPIRED ] ); + } + + //else if its a MERC merc + else if( iId >= BIFF && iId <= BUBBA ) + { + if( iState == DEPARTED_FIRED ) + swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_FIRED ] ); + else + swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_QUIT ] ); + } + //must be a RPC + else + { + if( iState == DEPARTED_FIRED ) + swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_FIRED ] ); + else + swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ DEPARTED_QUIT ] ); + } + +// swprintf( sString, L"%s", pPersonnelDepartedStateStrings[ iState ] ); + + // nick name - assignment + FindFontCenterCoordinates(IMAGE_BOX_X-5,0,IMAGE_BOX_WIDTH + 90 , 0,sString,CHAR_NAME_FONT, &sX, &sY ); + + // cehck to se eif we are going to go off the left edge + if( sX < pPersonnelScreenPoints[ 0 ].x ) + { + sX = ( INT16 )pPersonnelScreenPoints[ 0 ].x; + } + + mprintf( sX + iSlot * IMAGE_BOX_WIDTH, CHAR_NAME_Y + 10 , sString ); + + + + return; +} + + +INT32 GetTheStateOfDepartedMerc( INT32 iId ) +{ + + INT32 iCounter =0; + // will runt hrough each list until merc is found, if not a -1 is returned + + for( iCounter = 0; iCounter < 256; iCounter++ ) + { + if ( LaptopSaveInfo.ubDeadCharactersList[ iCounter ] == iId ) + { + return( DEPARTED_DEAD ); + } + } + + for( iCounter = 0; iCounter < 256; iCounter++ ) + { + if ( LaptopSaveInfo.ubLeftCharactersList[ iCounter ] == iId ) + { + return( DEPARTED_FIRED ); + } + } + + for( iCounter = 0; iCounter < 256; iCounter++ ) + { + if ( LaptopSaveInfo.ubOtherCharactersList[ iCounter ] == iId ) + { + return( DEPARTED_OTHER ); + } + } + + return( -1 ); +} + + +void DisplayPersonnelTextOnTitleBar( void ) +{ + // draw email screen title text + + // font stuff + SetFont( FONT14ARIAL ); + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + + // printf the title + mprintf( PERS_TITLE_X, PERS_TITLE_Y, pPersTitleText[0] ); + + // reset the shadow + +} + +BOOLEAN DisplayHighLightBox( void ) +{ + // will display highlight box around selected merc + VOBJECT_DESC VObjectDesc; + UINT32 uiBox = 0; + HVOBJECT hHandle; + + // load graphics + + // is the current selected face valid? + if( iCurrentPersonSelectedId == -1 ) + { + // no, leave + return ( FALSE ); + } + + // bounding + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\PicBorde.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiBox)); + + // blit it + GetVideoObject(&hHandle, uiBox); + BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( SMALL_PORTRAIT_START_X+ ( iCurrentPersonSelectedId % PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_WIDTH - 2 ), ( INT16 ) ( SMALL_PORTRAIT_START_Y + ( iCurrentPersonSelectedId / PERSONNEL_PORTRAIT_NUMBER_WIDTH ) * SMALL_PORT_HEIGHT - 3 ), VO_BLT_SRCTRANSPARENCY,NULL); + + + // deleteit + DeleteVideoObjectFromIndex( uiBox ); + + + return ( TRUE ); +} + +// add to dead list +void AddCharacterToDeadList( SOLDIERTYPE *pSoldier ) +{ + INT32 iCounter = 0; + + + for( iCounter = 0; iCounter < 256; iCounter++ ) + { + if( LaptopSaveInfo.ubDeadCharactersList[ iCounter ] == -1 ) + { + // valid slot, merc not found yet, inset here + LaptopSaveInfo.ubDeadCharactersList[ iCounter ] = pSoldier->ubProfile; + + // leave + return; + } + + // are they already in the list? + if( LaptopSaveInfo.ubDeadCharactersList[ iCounter ] == pSoldier->ubProfile ) + { + + return; + } + } +} + + +void AddCharacterToFiredList( SOLDIERTYPE *pSoldier ) +{ + INT32 iCounter = 0; + + + for( iCounter = 0; iCounter < 256; iCounter++ ) + { + if( LaptopSaveInfo.ubLeftCharactersList[ iCounter ] == -1 ) + { + // valid slot, merc not found yet, inset here + LaptopSaveInfo.ubLeftCharactersList[ iCounter ] = pSoldier->ubProfile; + + // leave + return; + } + + // are they already in the list? + if( LaptopSaveInfo.ubLeftCharactersList[ iCounter ] == pSoldier->ubProfile ) + { + + return; + } + } +} + + +void AddCharacterToOtherList( SOLDIERTYPE *pSoldier ) +{ + INT32 iCounter = 0; + + + for( iCounter = 0; iCounter < 256; iCounter++ ) + { + if( LaptopSaveInfo.ubOtherCharactersList[ iCounter ] == -1 ) + { + // valid slot, merc not found yet, inset here + LaptopSaveInfo.ubOtherCharactersList[ iCounter ] = pSoldier->ubProfile; + + // leave + return; + } + + // are they already in the list? + if( LaptopSaveInfo.ubOtherCharactersList[ iCounter ] == pSoldier->ubProfile ) + { + + return; + } + } +} + + +// If you have hired a merc before, then the they left for whatever reason, and now you are hiring them again, +// we must get rid of them from the departed section in the personnel screen. ( wouldnt make sense for them +//to be on your team list, and departed list ) +BOOLEAN RemoveNewlyHiredMercFromPersonnelDepartedList( UINT8 ubProfile ) +{ + INT32 iCounter = 0; + + for( iCounter = 0; iCounter < 256; iCounter++ ) + { + // are they already in the Dead list? + if( LaptopSaveInfo.ubDeadCharactersList[ iCounter ] == ubProfile ) + { + //Reset the fact that they were once hired + LaptopSaveInfo.ubDeadCharactersList[ iCounter ] = -1; + return( TRUE ); + } + + // are they already in the other list? + if( LaptopSaveInfo.ubLeftCharactersList[ iCounter ] == ubProfile ) + { + //Reset the fact that they were once hired + LaptopSaveInfo.ubLeftCharactersList[ iCounter ] = -1; + return( TRUE ); + } + + // are they already in the list? + if( LaptopSaveInfo.ubOtherCharactersList[ iCounter ] == ubProfile ) + { + //Reset the fact that they were once hired + LaptopSaveInfo.ubOtherCharactersList[ iCounter ] = -1; + return( TRUE ); + } + } + + return( FALSE ); +} + +// grab the id of the first merc being displayed +INT32 GetIdOfFirstDisplayedMerc( ) +{ + SOLDIERTYPE *pSoldier; + INT32 cnt = 0, iCounter = 0; + + // set current soldier + pSoldier = MercPtrs[ cnt ]; + + if( fCurrentTeamMode == TRUE ) + { + // run through list of soldiers on players current team + //cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pSoldier++ ) + { + if( ( pSoldier->bActive )&&( pSoldier->bLife > 0 ) ) + { + return( 0 ); + } + } + return( -1 ); + } + else + { + // run through list of soldier on players old team...the slot id will be translated + return 0; + } +} + +INT32 GetIdOfThisSlot( INT32 iSlot ) +{ + SOLDIERTYPE *pSoldier; + INT32 cnt = 0; + INT32 iCounter = 0; + + // set current soldier + pSoldier = MercPtrs[ cnt ]; + + if( fCurrentTeamMode == TRUE ) + { + // run through list of soldiers on players current team + cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; + for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pSoldier++ ) + { + if( ( pSoldier->bActive ) ) + { + + + // same character as slot, return this value + if( iCounter == iSlot ) + { + return( cnt ); + } + + // found another soldier + iCounter++; + } + } + } + else + { + // run through list of soldier on players old team...the slot id will be translated + return iSlot; + } + + + return( 0 ); +} + + +BOOLEAN RenderAtmPanel( void ) +{ + + VOBJECT_DESC VObjectDesc; + UINT32 uiBox = 0; + HVOBJECT hHandle; + + + // render the ATM panel + if( fShowAtmPanel ) + { + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\AtmButtons.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiBox)); + + // blit it + GetVideoObject(&hHandle, uiBox); + BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( ATM_UL_X ), ( INT16 ) ( ATM_UL_Y ), VO_BLT_SRCTRANSPARENCY,NULL); + + DeleteVideoObjectFromIndex( uiBox ); + + // show amount + DisplayATMAmount( ); + RenderRectangleForPersonnelTransactionAmount( ); + + // create destroy + CreateDestroyStartATMButton( ); + CreateDestroyATMButton( ); + + // display strings for ATM + DisplayATMStrings( ); + + // handle states + HandleStateOfATMButtons( ); + + //DisplayAmountOnCurrentMerc( ); + + } + else + { + // just show basic panel + // bounding + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("LAPTOP\\AtmButtons.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &uiBox)); + + GetVideoObject(&hHandle, uiBox); + BltVideoObject(FRAME_BUFFER, hHandle, 0,( INT16 ) ( ATM_UL_X ), ( INT16 ) ( ATM_UL_Y ), VO_BLT_SRCTRANSPARENCY,NULL); + + // blit it + GetVideoObject(&hHandle, uiBox); + BltVideoObject(FRAME_BUFFER, hHandle, 1,( INT16 ) ( ATM_UL_X + 1 ), ( INT16 ) ( ATM_UL_Y + 18), VO_BLT_SRCTRANSPARENCY,NULL); + + + DeleteVideoObjectFromIndex( uiBox ); + + // display strings for ATM + DisplayATMStrings( ); + + //DisplayAmountOnCurrentMerc( ); + + // create destroy + CreateDestroyStartATMButton( ); + CreateDestroyATMButton( ); + } + return( TRUE ); +} + + +void CreateDestroyStartATMButton( void ) +{ + static BOOLEAN fCreated = FALSE; + // create/destroy atm start button as needed + + + if( ( fCreated == FALSE ) && ( fShowAtmPanelStartButton == TRUE ) ) + { + // not created, must create + + /* + // the ATM start button + giPersonnelATMStartButtonImage[ 0 ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); + giPersonnelATMStartButton[ 0 ] = QuickCreateButton( giPersonnelATMStartButtonImage[ 0 ] , 519,87, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ATMStartButtonCallback ); + + // set text and what not + SpecifyButtonText( giPersonnelATMStartButton[ 0 ] ,gsAtmStartButtonText[ 0 ] ); + SpecifyButtonUpTextColors( giPersonnelATMStartButton[ 0 ], FONT_BLACK, FONT_BLACK ); + SpecifyButtonFont( giPersonnelATMStartButton[ 0 ], PERS_FONT ); + SetButtonCursor(giPersonnelATMStartButton[ 0 ], CURSOR_LAPTOP_SCREEN); +*/ + // the stats button + giPersonnelATMStartButtonImage[ PERSONNEL_STAT_BTN ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); + giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] = QuickCreateButton( giPersonnelATMStartButtonImage[ PERSONNEL_STAT_BTN ] , iScreenWidthOffset + 519, iScreenHeightOffset + 80, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + MSYS_NO_CALLBACK, (GUI_CALLBACK)PersonnelStatStartButtonCallback ); + + // set text and what not + SpecifyButtonText( giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ,gsAtmStartButtonText[ 1 ] ); + SpecifyButtonUpTextColors( giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ], FONT_BLACK, FONT_BLACK ); + SpecifyButtonFont( giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ], PERS_FONT ); + SetButtonCursor(giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ], CURSOR_LAPTOP_SCREEN); + + // the Employment selection button + giPersonnelATMStartButtonImage[ PERSONNEL_EMPLOYMENT_BTN ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); + giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] = QuickCreateButton( giPersonnelATMStartButtonImage[ PERSONNEL_EMPLOYMENT_BTN ] , iScreenWidthOffset + 519, iScreenHeightOffset + 110, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + MSYS_NO_CALLBACK, (GUI_CALLBACK)EmployementInfoButtonCallback ); + + // set text and what not + SpecifyButtonText( giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ,gsAtmStartButtonText[ 3 ] ); + SpecifyButtonUpTextColors( giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ], FONT_BLACK, FONT_BLACK ); + SpecifyButtonFont( giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ], PERS_FONT ); + SetButtonCursor(giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ], CURSOR_LAPTOP_SCREEN); + + // the inventory selection button + giPersonnelATMStartButtonImage[ PERSONNEL_INV_BTN ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,2,-1,3,-1 ); + giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] = QuickCreateButton( giPersonnelATMStartButtonImage[ PERSONNEL_INV_BTN ] , iScreenWidthOffset + 519, iScreenHeightOffset + 140, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + MSYS_NO_CALLBACK, (GUI_CALLBACK)PersonnelINVStartButtonCallback ); + + // set text and what not + SpecifyButtonText( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ,gsAtmStartButtonText[ 2 ] ); + SpecifyButtonUpTextColors( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ], FONT_BLACK, FONT_BLACK ); + SpecifyButtonFont( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ], PERS_FONT ); + SetButtonCursor(giPersonnelATMStartButton[ PERSONNEL_INV_BTN ], CURSOR_LAPTOP_SCREEN); + + + fCreated = TRUE; + } + else if( ( fCreated == TRUE ) && ( fShowAtmPanelStartButton == FALSE ) ) + { + // stop showing + /* + RemoveButton( giPersonnelATMStartButton[ 0 ] ); + UnloadButtonImage( giPersonnelATMStartButtonImage[ 0 ] ); + */ + RemoveButton( giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ); + UnloadButtonImage( giPersonnelATMStartButtonImage[ PERSONNEL_STAT_BTN ] ); + RemoveButton( giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ); + UnloadButtonImage( giPersonnelATMStartButtonImage[ PERSONNEL_EMPLOYMENT_BTN ] ); + RemoveButton( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ); + UnloadButtonImage( giPersonnelATMStartButtonImage[ PERSONNEL_INV_BTN ] ); + + fCreated = FALSE; + } +} + +void FindPositionOfPersInvSlider( void ) +{ + INT32 iValue = 0; + INT32 iNumberOfItems = 0; + INT16 sSizeOfEachSubRegion = 0; + INT16 sYPositionOnBar = 0; + INT16 iCurrentItemValue = 0; + + // find out how many there are + iValue = ( INT32 )( GetNumberOfInventoryItemsOnCurrentMerc( ) ); + + // otherwise there are more than one item + iNumberOfItems = iValue - NUMBER_OF_INVENTORY_PERSONNEL; + + if( iValue <= 0 ) + { + iValue = 1; + } + + // get the subregion sizes + sSizeOfEachSubRegion = ( INT16 )( ( INT32 )( Y_SIZE_OF_PERSONNEL_SCROLL_REGION - SIZE_OF_PERSONNEL_CURSOR ) / ( INT32 )( iNumberOfItems ) ); + + // get slider position + guiSliderPosition = uiCurrentInventoryIndex * sSizeOfEachSubRegion; + +} + + +void HandleSliderBarClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) +{ + INT32 iValue = 0; + INT32 iNumberOfItems = 0; + POINT MousePos; + INT16 sSizeOfEachSubRegion = 0; + INT16 sYPositionOnBar = 0; + INT16 iCurrentItemValue = 0; + + if( ( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) || ( iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) ) + { + // find out how many there are + iValue = ( INT32 )( GetNumberOfInventoryItemsOnCurrentMerc( ) ); + + // make sure there are more than one page + if( ( INT32 )uiCurrentInventoryIndex >= iValue - NUMBER_OF_INVENTORY_PERSONNEL + 1 ) + { + return; + } + + // otherwise there are more than one item + iNumberOfItems = iValue - NUMBER_OF_INVENTORY_PERSONNEL; + + // number of items is 0 + if( iNumberOfItems == 0 ) + { + return; + } + + // find the x,y on the slider bar + GetCursorPos(&MousePos); + + // get the subregion sizes + sSizeOfEachSubRegion = ( INT16 )( ( INT32 )( Y_SIZE_OF_PERSONNEL_SCROLL_REGION - SIZE_OF_PERSONNEL_CURSOR ) / ( INT32 )( iNumberOfItems ) ); + + // get the cursor placement + sYPositionOnBar = (INT16) MousePos.y - Y_OF_PERSONNEL_SCROLL_REGION; + + if( sSizeOfEachSubRegion == 0 ) + { + return; + } + + // get the actual item position + iCurrentItemValue = sYPositionOnBar / sSizeOfEachSubRegion; + + if( uiCurrentInventoryIndex != iCurrentItemValue ) + { + // get slider position + guiSliderPosition = iCurrentItemValue * sSizeOfEachSubRegion; + + // set current inventory value + uiCurrentInventoryIndex = ( UINT8 )iCurrentItemValue; + + // force update + fReDrawScreenFlag = TRUE; + } + } + +} + + + +void RenderSliderBarForPersonnelInventory( void ) +{ + HVOBJECT hHandle; + + // render slider bar for personnel + GetVideoObject(&hHandle, guiPersonnelInventory ); + BltVideoObject( FRAME_BUFFER, hHandle, 5,( INT16 ) ( X_OF_PERSONNEL_SCROLL_REGION ), ( INT16 ) ( guiSliderPosition + Y_OF_PERSONNEL_SCROLL_REGION), VO_BLT_SRCTRANSPARENCY,NULL); + +} + +void CreateDestroyATMButton( void ) +{ + /* + static BOOLEAN fCreated = FALSE; + CHAR16 sString[ 32 ]; + + + + // create/destroy atm start button as needed + INT32 iCounter = 0; + + if( ( fCreated == FALSE ) && ( fShowAtmPanel == TRUE ) ) + { + + for( iCounter = 0; iCounter < 10; iCounter++ ) + { + if( iCounter != 9 ) + { + iNumberPadButtonsImages[ iCounter ]=LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,4,-1,6,-1 ); + swprintf( sString, L"%d", iCounter+1 ); + } + else + { + iNumberPadButtonsImages[ iCounter ]=LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,7,-1,9,-1 ); + swprintf( sString, L"%d", iCounter - 9 ); + } + + iNumberPadButtons[ iCounter ] = QuickCreateButton( iNumberPadButtonsImages[ iCounter ], ( INT16 )( ATM_BUTTONS_START_X + ( ATM_BUTTON_WIDTH * ( INT16 )( iCounter % 3 )) ), ( INT16 )( ATM_BUTTONS_START_Y + ( INT16 )( ATM_BUTTON_HEIGHT * ( iCounter / 3 ))) , + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ATMNumberButtonCallback ); + + if( iCounter != 9) + { + MSYS_SetBtnUserData(iNumberPadButtons[iCounter],0,iCounter + 1 ); + } + else + { + MSYS_SetBtnUserData(iNumberPadButtons[iCounter],0, 0 ); + } + SetButtonCursor(iNumberPadButtons[iCounter], CURSOR_LAPTOP_SCREEN); + SpecifyButtonFont( iNumberPadButtons[iCounter], PERS_FONT ); + SpecifyButtonText( iNumberPadButtons[iCounter], sString ); + SpecifyButtonUpTextColors( iNumberPadButtons[iCounter], FONT_BLACK, FONT_BLACK ); + + } + + + // now slap down done, cancel, dep, withdraw + for( iCounter = OK_ATM; iCounter < NUMBER_ATM_BUTTONS ;iCounter++ ) + { + if( iCounter == OK_ATM ) + { + giPersonnelATMSideButtonImage[ iCounter ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,7,-1,9,-1 ); + } + else + { + giPersonnelATMSideButtonImage[ iCounter ]= LoadButtonImage( "LAPTOP\\AtmButtons.sti" ,-1,10,-1,12,-1 ); + } + + if( ( iCounter != DEPOSIT_ATM ) && ( iCounter != WIDTHDRAWL_ATM ) ) + { + giPersonnelATMSideButton[ iCounter ] = QuickCreateButton( giPersonnelATMSideButtonImage[ iCounter ], ( INT16 )( pAtmSideButtonPts[ iCounter ].x ), ( INT16 )( pAtmSideButtonPts[ iCounter ].y ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ATMOtherButtonCallback ); + } + else + { + giPersonnelATMSideButton[ iCounter ] = QuickCreateButton( giPersonnelATMSideButtonImage[ iCounter ], ( INT16 )( pAtmSideButtonPts[ iCounter ].x ), ( INT16 )( pAtmSideButtonPts[ iCounter ].y ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 1, + BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)ATMOther2ButtonCallback ); + } + MSYS_SetBtnUserData(giPersonnelATMSideButton[iCounter],0,iCounter ); + SpecifyButtonFont( giPersonnelATMSideButton[iCounter], PERS_FONT ); + SetButtonCursor(giPersonnelATMSideButton[iCounter], CURSOR_LAPTOP_SCREEN); + SpecifyButtonUpTextColors( giPersonnelATMSideButton[iCounter], FONT_BLACK, FONT_BLACK ); + SpecifyButtonText( giPersonnelATMSideButton[iCounter], gsAtmSideButtonText[ iCounter ] ); + } + + + //SetButtonCursor(giPersonnelATMStartButton, CURSOR_LAPTOP_SCREEN); + fCreated = TRUE; + } + else if( ( fCreated == TRUE ) && ( fShowAtmPanel == FALSE ) ) + { + // stop showing + //RemoveButton( giPersonnelATMButton ); + //UnloadButtonImage( giPersonnelATMButtonImage ); + + for( iCounter = 0; iCounter < 10; iCounter++ ) + { + UnloadButtonImage( iNumberPadButtonsImages[ iCounter ] ); + RemoveButton( iNumberPadButtons[ iCounter ] ); + } + + for( iCounter = OK_ATM; iCounter < NUMBER_ATM_BUTTONS ;iCounter++ ) + { + RemoveButton( giPersonnelATMSideButton[ iCounter ] ); + UnloadButtonImage( giPersonnelATMSideButtonImage[ iCounter ] ); + } + + fCreated = FALSE; + } + + */ +} + + +void ATMStartButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + fReDrawScreenFlag=TRUE; + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + fShowAtmPanel = TRUE; + fShowAtmPanelStartButton = FALSE; + fATMFlags = 0; + + } + } +} + +void PersonnelINVStartButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + fReDrawScreenFlag=TRUE; + btn->uiFlags |= (BUTTON_CLICKED_ON); + ButtonList[giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + ButtonList[giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); +// fShowInventory = TRUE; + gubPersonnelInfoState = PRSNL_INV; + } +} + +void PersonnelStatStartButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + fReDrawScreenFlag=TRUE; + btn->uiFlags |= BUTTON_CLICKED_ON; + ButtonList[giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + ButtonList[giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); +// fShowInventory = FALSE; + gubPersonnelInfoState = PRSNL_STATS; + } +} + + +void EmployementInfoButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + fReDrawScreenFlag=TRUE; + btn->uiFlags |= BUTTON_CLICKED_ON; + ButtonList[giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + ButtonList[giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ]->uiFlags &= ~(BUTTON_CLICKED_ON); + gubPersonnelInfoState = PRSNL_EMPLOYMENT; + } +} + + +void ATMOther2ButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT32 iValue = 0; + SOLDIERTYPE *pSoldier = MercPtrs[ 0 ]; + INT32 cnt = 0; + INT32 iId = 0; + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + + iValue = MSYS_GetBtnUserData( btn, 0 ); + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + fReDrawScreenFlag=TRUE; + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + + switch( iValue ) + { + case( DEPOSIT_ATM ): + fATMFlags = 2; + fReDrawScreenFlag=TRUE; + ButtonList[ giPersonnelATMSideButton[ WIDTHDRAWL_ATM ] ]->uiFlags&=~(BUTTON_CLICKED_ON); + break; + case( WIDTHDRAWL_ATM ): + fATMFlags = 3; + fReDrawScreenFlag=TRUE; + ButtonList[ giPersonnelATMSideButton[ DEPOSIT_ATM ] ]->uiFlags&=~(BUTTON_CLICKED_ON); + break; + } + } + +} + +void ATMOtherButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT32 iValue = 0; + SOLDIERTYPE *pSoldier = MercPtrs[ 0 ]; + INT32 cnt = 0; + INT32 iId = 0; + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + + iValue = MSYS_GetBtnUserData( btn, 0 ); + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + fReDrawScreenFlag=TRUE; + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + + if( iCurrentPersonSelectedId != -1 ) + { + if( fCurrentTeamMode == TRUE ) + { + iId = GetIdOfThisSlot( iCurrentPersonSelectedId ); + cnt = 0; + + // set soldier + pSoldier = MercPtrs[ iId ]; + + + switch( iValue ) + { + case( OK_ATM ): + if( fATMFlags == 0 ) + { + fATMFlags = 1; + fReDrawScreenFlag=TRUE; + fOneFrameDelayInPersonnel = TRUE; + } + else if( fATMFlags == 2 ) + { + // deposit from merc to account + if( GetFundsOnMerc( pSoldier ) >= wcstol( sTransferString, NULL, 10 ) ) + { + if( ( wcstol( sTransferString, NULL, 10 ) % 10 ) != 0 ) + { + fOldATMFlags = fATMFlags; + fATMFlags = 5; + + iValue = ( wcstol( sTransferString, NULL, 10 ) - ( wcstol( sTransferString, NULL, 10 ) % 10 ) ); + swprintf( sTransferString, L"%d", iValue ); + fReDrawScreenFlag=TRUE; + } + else + { + // transfer + TransferFundsFromMercToBank( pSoldier, wcstol( sTransferString, NULL, 10 ) ); + sTransferString[ 0 ] = 0; + fReDrawScreenFlag=TRUE; + } + } + else + { + fOldATMFlags = fATMFlags; + fATMFlags = 4; + iValue = GetFundsOnMerc( pSoldier ); + swprintf( sTransferString, L"%d", iValue ); + fReDrawScreenFlag=TRUE; + } + } + else if( fATMFlags == 3 ) + { + // deposit from merc to account + if( LaptopSaveInfo.iCurrentBalance >= wcstol( sTransferString, NULL, 10 ) ) + { + if( ( wcstol( sTransferString, NULL, 10 ) % 10 ) != 0 ) + { + fOldATMFlags = fATMFlags; + fATMFlags = 5; + + iValue = ( wcstol( sTransferString, NULL, 10 ) - ( wcstol( sTransferString, NULL, 10 ) % 10 ) ); + swprintf( sTransferString, L"%d", iValue ); + fReDrawScreenFlag=TRUE; + } + else + { + // transfer + TransferFundsFromBankToMerc( pSoldier, wcstol( sTransferString, NULL, 10 ) ); + sTransferString[ 0 ] = 0; + fReDrawScreenFlag=TRUE; + } + } + else + { + fOldATMFlags = fATMFlags; + fATMFlags = 4; + iValue = LaptopSaveInfo.iCurrentBalance; + swprintf( sTransferString, L"%d", iValue ); + fReDrawScreenFlag=TRUE; + } + } + else if( fATMFlags == 4 ) + { + fATMFlags = fOldATMFlags; + fReDrawScreenFlag=TRUE; + } + break; + case( DEPOSIT_ATM ): + fATMFlags = 2; + fReDrawScreenFlag=TRUE; + + break; + case( WIDTHDRAWL_ATM ): + fATMFlags = 3; + fReDrawScreenFlag=TRUE; + break; + case( CANCEL_ATM ): + if( sTransferString[ 0 ] != 0 ) + { + sTransferString[ 0 ] = 0; + } + else if( fATMFlags != 0 ) + { + fATMFlags = 0; + ButtonList[ giPersonnelATMSideButton[ WIDTHDRAWL_ATM ] ]->uiFlags&=~(BUTTON_CLICKED_ON); + ButtonList[ giPersonnelATMSideButton[ DEPOSIT_ATM ] ]->uiFlags&=~(BUTTON_CLICKED_ON); + } + else + { + fShowAtmPanel = FALSE; + fShowAtmPanelStartButton = TRUE; + + } + fReDrawScreenFlag=TRUE; + break; + case( CLEAR_ATM ): + sTransferString[ 0 ] = 0; + fReDrawScreenFlag=TRUE; + break; + } + } + } + } + } +} + +void ATMNumberButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + + INT32 iValue = 0; + INT32 iCounter = 0; + CHAR16 sZero[ 2 ] = L"0"; + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + iValue = MSYS_GetBtnUserData( btn, 0 ); + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if(!(btn->uiFlags & BUTTON_CLICKED_ON)) + { + fReDrawScreenFlag=TRUE; + } + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if(btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + // find position in value string, append character at end + for( iCounter = 0; iCounter < ( INT32 )wcslen( sTransferString ) ; iCounter++ ); + sTransferString[ iCounter ] = ( sZero[ 0 ] + ( UINT16 )iValue ); + sTransferString[ iCounter + 1 ] = 0; + fReDrawScreenFlag=TRUE; + + // gone too far + if( StringPixLength( sTransferString, ATM_FONT ) >= ATM_DISPLAY_WIDTH - 10 ) + { + sTransferString[ iCounter ] = 0; + } + } + } +} + +void DisplayATMAmount( void ) +{ + + INT16 sX = 0, sY = 0; + CHAR16 sTempString[ 32 ]; + CHAR16 sZero[ 2 ] = L"0"; + INT32 iCounter = 0; + + if( fShowAtmPanel == FALSE ) + { + return; + } + + wcscpy( sTempString, sTransferString ); + + if( ( sTempString[ 0 ] == 48 ) && ( sTempString[ 1 ] != 0 ) ) + { + // strip the zero from the beginning + for(iCounter = 1; iCounter < ( INT32 )wcslen( sTempString ); iCounter++ ) + { + sTempString[ iCounter - 1 ] = sTempString[ iCounter ]; + } + } + + // insert commas and dollar sign + InsertCommasForDollarFigure( sTempString ); + InsertDollarSignInToString( sTempString ); + + // set font + SetFont( ATM_FONT ); + + // set back and foreground + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + + + // right justify + FindFontRightCoordinates( ATM_DISPLAY_X, ATM_DISPLAY_Y + 37, ATM_DISPLAY_WIDTH, ATM_DISPLAY_HEIGHT, sTempString, ATM_FONT, &sX, &sY ); + + // print string + mprintf( sX, sY, sTempString ); + + return; +} + + +void HandleStateOfATMButtons( void ) +{ + INT32 iCounter = 0; + + // disable buttons based on state + if( ( fATMFlags == 0 ) ) + { + for( iCounter = 0; iCounter < 10 ; iCounter++ ) + { + DisableButton( iNumberPadButtons[ iCounter ] ); + } + + for( iCounter = 0; iCounter < NUMBER_ATM_BUTTONS; iCounter++ ) + { + if( ( iCounter != DEPOSIT_ATM) && ( iCounter != WIDTHDRAWL_ATM ) && ( iCounter != CANCEL_ATM ) ) + { + DisableButton( giPersonnelATMSideButton[ iCounter ] ); + } + } + } + else + { + for( iCounter = 0; iCounter < 10; iCounter++ ) + { + EnableButton( iNumberPadButtons[ iCounter ] ); + } + + for( iCounter = 0; iCounter < NUMBER_ATM_BUTTONS; iCounter++ ) + { + EnableButton( giPersonnelATMSideButton[ iCounter ] ); + } + } +} + + +INT32 GetFundsOnMerc( SOLDIERTYPE *pSoldier ) +{ + INT32 iCurrentAmount = 0; + INT32 iCurrentPocket = 0; + // run through mercs pockets, if any money in them, add to total + + // error check + if( pSoldier == NULL ) + { + return 0; + } + + // run through grunts pockets and count all the spare change + for( iCurrentPocket = 0; iCurrentPocket < NUM_INV_SLOTS; iCurrentPocket++ ) + { + if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY ) + { + iCurrentAmount += pSoldier->inv[ iCurrentPocket ].uiMoneyAmount; + } + } + + return iCurrentAmount; +} + + +BOOLEAN TransferFundsFromMercToBank( SOLDIERTYPE *pSoldier, INT32 iCurrentBalance ) +{ + INT32 iCurrentPocket = 0; + INT32 iAmountLeftToTake = iCurrentBalance; + OBJECTTYPE ObjectToRemove; + + + // move this amount of money from the grunt to the bank + // error check + if( pSoldier == NULL ) + { + return FALSE; + } + + // run through grunts pockets and count all the spare change + for( iCurrentPocket = 0; iCurrentPocket < NUM_INV_SLOTS; iCurrentPocket++ ) + { + if ( Item[ pSoldier->inv[ iCurrentPocket ] .usItem ].usItemClass == IC_MONEY ) + { + + // is there more left to go, or does this pocket finish it off? + if( pSoldier->inv[ iCurrentPocket ].uiMoneyAmount > ( UINT32 )iAmountLeftToTake ) + { + pSoldier->inv[ iCurrentPocket ].uiMoneyAmount -= iAmountLeftToTake; + iAmountLeftToTake = 0; + } + else + { + iAmountLeftToTake -= pSoldier->inv[ iCurrentPocket ].uiMoneyAmount; + pSoldier->inv[ iCurrentPocket ].uiMoneyAmount = 0; + + //Remove the item out off the merc + RemoveObjectFromSlot( pSoldier, (INT8)iCurrentPocket, &ObjectToRemove ); + } + } + } + + if( iAmountLeftToTake != 0 ) + { + // something wrong + AddTransactionToPlayersBook ( TRANSFER_FUNDS_FROM_MERC, pSoldier->ubProfile, GetWorldTotalMin() , ( iCurrentBalance - iAmountLeftToTake ) ); + return ( FALSE ); + } + else + { + // everything ok + AddTransactionToPlayersBook ( TRANSFER_FUNDS_FROM_MERC, pSoldier->ubProfile, GetWorldTotalMin() , ( iCurrentBalance ) ); + return ( TRUE ); + } +} + + +BOOLEAN TransferFundsFromBankToMerc( SOLDIERTYPE *pSoldier, INT32 iCurrentBalance ) +{ + OBJECTTYPE pMoneyObject; + + // move this amount of money from the grunt to the bank + // error check + if( pSoldier == NULL ) + { + return FALSE; + } + + // make sure we are giving them some money + if( iCurrentBalance <= 0 ) + { + return ( FALSE ); + } + + // current balance + if( iCurrentBalance > LaptopSaveInfo.iCurrentBalance ) + { + iCurrentBalance = LaptopSaveInfo.iCurrentBalance; + } + + + // set up object + memset( &( pMoneyObject ), 0, sizeof( OBJECTTYPE ) ); + + // set up money object + pMoneyObject.usItem = MONEY; + pMoneyObject.ubNumberOfObjects = 1; + pMoneyObject.bMoneyStatus = 100; + pMoneyObject. bStatus[0] = 100; + pMoneyObject.uiMoneyAmount = iCurrentBalance; + + + // now auto place money object + if( AutoPlaceObject( pSoldier, &( pMoneyObject ), TRUE ) == TRUE ) + { + // now place transaction + AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, pSoldier->ubProfile, GetWorldTotalMin() , -( iCurrentBalance ) ); + } + else + { + // error, notify player that merc doesn't have the spce for this much cash + } + + return( TRUE ); +} + +void DisplayATMStrings( void ) +{ + // display strings for ATM + switch( fATMFlags ) + { + case( 0 ): + if( fShowAtmPanelStartButton == FALSE ) + { + DisplayWrappedString(iScreenWidthOffset + 509, ( INT16 )( iScreenHeightOffset + 80 ), 81, 2, ATM_FONT, FONT_WHITE, sATMText[ 3 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + break; + case( 2 ): + if( sTransferString[ 0 ] != 0 ) + { + DisplayWrappedString(iScreenWidthOffset + 509, iScreenHeightOffset + 80, 81, 2, ATM_FONT, FONT_WHITE, sATMText[ 0 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + else + { + DisplayWrappedString(iScreenWidthOffset + 509, iScreenHeightOffset + 80, 81, 2, ATM_FONT, FONT_WHITE, sATMText[ 2 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + break; + case( 3 ): + if( sTransferString[ 0 ] != 0 ) + { + DisplayWrappedString(iScreenWidthOffset + 509, iScreenHeightOffset + 80, 81, 2, ATM_FONT, FONT_WHITE, sATMText[ 0 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + //DisplayWrappedString(509, ( INT16 )( 80 + GetFontHeight( ATM_FONT ) ), 81, 2, ATM_FONT, FONT_WHITE, sATMText[ 1 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + else + { + DisplayWrappedString(iScreenWidthOffset + 509, iScreenHeightOffset + 80, 81, 2, ATM_FONT, FONT_WHITE, sATMText[ 2 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + } + break; + case( 4 ): + // not enough money + DisplayWrappedString(iScreenWidthOffset + 509, iScreenHeightOffset + 80, 81, 2, ATM_FONT, FONT_WHITE, sATMText[ 4 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + break; + case( 5 ): + // not enough money + DisplayWrappedString(iScreenWidthOffset + 509, iScreenHeightOffset + 73, 81, 2, ATM_FONT, FONT_WHITE, sATMText[ 5 ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + break; + + } +} + +void UpDateStateOfStartButton( void ) +{ + INT32 iId = 0; + + // start button being shown? + if( fShowAtmPanelStartButton == FALSE ) + { + return; + } + +// if( fShowInventory == TRUE ) + if( gubPersonnelInfoState == PRSNL_INV ) + { + ButtonList[ giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ]->uiFlags |= BUTTON_CLICKED_ON; + ButtonList[ giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); + ButtonList[ giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); + } + else if( gubPersonnelInfoState == PRSNL_STATS ) + { + ButtonList[ giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ]->uiFlags |= BUTTON_CLICKED_ON; + ButtonList[ giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); + } + else + { + ButtonList[ giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + ButtonList[ giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ]->uiFlags &= ~( BUTTON_CLICKED_ON ); + ButtonList[ giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ]->uiFlags |= BUTTON_CLICKED_ON; + } + + // if in current mercs and the currently selected guy is valid, enable button, else disable it + if( fCurrentTeamMode == TRUE ) + { + // is the current guy valid + if( GetNumberOfMercsDeadOrAliveOnPlayersTeam( ) > 0 ) + { + //EnableButton( giPersonnelATMStartButton[ 0 ] ); + EnableButton( giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ); + EnableButton( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ); + EnableButton( giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ); + + iId = GetIdOfThisSlot( iCurrentPersonSelectedId ); + + if( iId != -1 ) + { + if( Menptr[ iId ].bAssignment == ASSIGNMENT_POW ) + { + //DisableButton( giPersonnelATMStartButton[ 0 ] ); + DisableButton( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ); + +// if( fShowInventory == TRUE ) + if( gubPersonnelInfoState == PRSNL_INV ) + { +// fShowInventory = FALSE; + gubPersonnelInfoState = PRSNL_STATS; + + fPausedReDrawScreenFlag = TRUE; + } + + if( fATMFlags ) + { + fATMFlags = 0; + fPausedReDrawScreenFlag = TRUE; + } + } + } + + + } + else + { + // not valid, disable + //DisableButton( giPersonnelATMStartButton[ 0 ] ); + DisableButton( giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ); + DisableButton( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ); + DisableButton( giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ); + } + + + } + else + { + // disable button + //DisableButton( giPersonnelATMStartButton[ 0 ] ); + EnableButton( giPersonnelATMStartButton[ PERSONNEL_STAT_BTN ] ); + DisableButton( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ); + DisableButton( giPersonnelATMStartButton[ PERSONNEL_EMPLOYMENT_BTN ] ); + } +} + +void DisplayAmountOnCurrentMerc( void ) +{ + // will display the amount that the merc is carrying on him or herself + INT32 iId; + SOLDIERTYPE *pSoldier = NULL; + INT32 iFunds; + CHAR16 sString[ 64 ]; + INT16 sX, sY; + + iId = GetIdOfThisSlot( iCurrentPersonSelectedId ); + + if( iId == -1 ) + { + pSoldier = NULL; + } + else + { + // set soldier + pSoldier = MercPtrs[ iId ]; + } + + iFunds = GetFundsOnMerc( pSoldier ); + + swprintf( sString, L"%d", iFunds ); + + // insert commas and dollar sign + InsertCommasForDollarFigure( sString ); + InsertDollarSignInToString( sString ); + + // set font + SetFont( ATM_FONT ); + + // set back and foreground + SetFontForeground( FONT_WHITE ); + SetFontBackground( FONT_BLACK ); + + // right justify + FindFontRightCoordinates( ATM_DISPLAY_X, ATM_DISPLAY_Y, ATM_DISPLAY_WIDTH, ATM_DISPLAY_HEIGHT, sString, ATM_FONT, &sX, &sY ); + + // print string + mprintf( sX, sY, sString ); + + return; +} + +void HandlePersonnelKeyboard( void ) +{ + INT32 iCounter = 0; + INT32 iValue = 0; + CHAR16 sZero[ 2 ] = L"0"; + + InputAtom InputEvent; + POINT MousePos; + + GetCursorPos(&MousePos); + + while (DequeueEvent(&InputEvent) == TRUE) + { + if ( (InputEvent.usEvent == KEY_DOWN ) && (InputEvent.usParam >= '0' ) && ( InputEvent.usParam <= '9') ) + { + if( ( fShowAtmPanel ) && ( fATMFlags != 0 ) ) + { + iValue = ( INT32 )( InputEvent.usParam - '0' ); + + for( iCounter = 0; iCounter < ( INT32 )wcslen( sTransferString ) ; iCounter++ ); + sTransferString[ iCounter ] = ( sZero[ 0 ] + ( UINT16 )iValue ); + sTransferString[ iCounter + 1 ] = 0; + fPausedReDrawScreenFlag=TRUE; + + // gone too far + if( StringPixLength( sTransferString, ATM_FONT ) >= ATM_DISPLAY_WIDTH - 10 ) + { + sTransferString[ iCounter ] = 0; + } + } + } + + HandleKeyBoardShortCutsForLapTop( InputEvent.usEvent, InputEvent.usParam, InputEvent.usKeyState ); + } +} + +void RenderRectangleForPersonnelTransactionAmount( void ) +{ + INT32 iLength = 0; + INT32 iHeight = GetFontHeight( ATM_FONT ); + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + CHAR16 sTempString[ 32 ]; + CHAR16 sZero[ 2 ] = L"0"; + INT32 iCounter = 0; + + + wcscpy( sTempString, sTransferString ); + + if( ( sTempString[ 0 ] == 48 ) && ( sTempString[ 1 ] != 0 ) ) + { + // strip the zero from the beginning + for(iCounter = 1; iCounter < ( INT32 )wcslen( sTempString ); iCounter++ ) + { + sTempString[ iCounter - 1 ] = sTempString[ iCounter ]; + } + } + + // insert commas and dollar sign + InsertCommasForDollarFigure( sTempString ); + InsertDollarSignInToString( sTempString ); + + // string not worth worrying about? + if( wcslen( sTempString ) < 2 ) + { + return; + } + + // grab total length + iLength = StringPixLength( sTempString, ATM_FONT ); + + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES ); + RectangleDraw( TRUE, ( ATM_DISPLAY_X + ATM_DISPLAY_WIDTH ) - iLength - 2, ATM_DISPLAY_Y + 35, ATM_DISPLAY_X + ATM_DISPLAY_WIDTH + 1, ATM_DISPLAY_Y + iHeight + 36, Get16BPPColor( FROMRGB( 255, 255, 255 ) ), pDestBuf ); + UnLockVideoSurface( FRAME_BUFFER ); + +} + +void HandleTimedAtmModes( void ) +{ + static BOOLEAN fOldAtmMode = 0; + static UINT32 uiBaseTime = 0; + + if( fShowAtmPanel == FALSE ) + { + return; + } + + // update based on modes + if( fATMFlags != fOldAtmMode ) + { + uiBaseTime = GetJA2Clock(); + fOldAtmMode = fATMFlags; + fPausedReDrawScreenFlag = TRUE; + } + + + if( ( GetJA2Clock() - uiBaseTime ) > DELAY_PER_MODE_CHANGE_IN_ATM ) + { + switch( fATMFlags ) + { + case( 4 ): + case( 5 ): + // insufficient funds ended + fATMFlags = fOldATMFlags; + fPausedReDrawScreenFlag = TRUE; + break; + } + } +} + +BOOLEAN IsPastMercDead( INT32 iId ) +{ + if( GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iId ) ) == DEPARTED_DEAD ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } + +} + + +BOOLEAN IsPastMercFired( INT32 iId ) +{ + if( GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iId ) ) == DEPARTED_FIRED ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + +BOOLEAN IsPastMercOther( INT32 iId ) +{ + if( GetTheStateOfDepartedMerc( GetIdOfPastMercInSlot( iId ) ) == DEPARTED_OTHER ) + { + return( TRUE ); + } + else + { + return( FALSE ); + } +} + + + +void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) +{ + INT32 iCounter=0; + wchar_t sString[50]; + wchar_t sStringA[ 50 ]; + INT16 sX, sY; + UINT32 uiHits = 0; + + + if( Menptr[iId].uiStatusFlags & SOLDIER_VEHICLE ) + { + return; + } + + // display the stats for a char + for(iCounter=0;iCounter (INT32)( Menptr[iId].iTotalContractLength * uiMinutesInDay ) ) + { + iTimeLeftOnContract = ( Menptr[iId].iTotalContractLength * uiMinutesInDay ); + } + } + // if there is going to be a both days and hours left on the contract + if( iTimeLeftOnContract / uiMinutesInDay ) + { + swprintf(sString, L"%d%s %d%s / %d%s",( iTimeLeftOnContract / uiMinutesInDay ), gpStrategicString[ STR_PB_DAYS_ABBREVIATION ], (iTimeLeftOnContract % uiMinutesInDay)/60, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ], Menptr[iId].iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); + } + + //else there is under a day left + else + { + //DEF: removed 2/7/99 + swprintf(sString, L"%d%s / %d%s", (iTimeLeftOnContract % uiMinutesInDay)/60, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ], Menptr[iId].iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); + } + + } + else if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { +// swprintf(sString, L"%d%s / %d%s",Menptr[iId].iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ], ( GetWorldTotalMin( ) -Menptr[iId].iStartContractTime ) / ( 24 * 60 ), gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); + + wcscpy( sString, gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); + } + else + { + wcscpy( sString, gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); + } + + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + } + break; + +// case 11: +// case 19: + case 1: + + // total contract time served + mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_TOTAL_SERVICE]); + + //./DEF 2/4/99: total service days used to be calced as 'days -1' + + swprintf(sString, L"%d %s",gMercProfiles[Menptr[iId].ubProfile].usTotalDaysServed, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); + + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + break; + +// case 13: + case 3: + // cost (PRSNL_TXT_TOTAL_COST) + +/* + if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + UINT32 uiDailyCost = 0; + + if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + // 2 week contract + uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].uiBiWeeklySalary / 14; + } + else if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + { + // 1 week contract + uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].uiWeeklySalary / 7; + } + else + { + uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].sSalary; + } + +// swprintf( sString, L"%d",uiDailyCost * Menptr[ iId ].iTotalContractLength ); + swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); + } + else if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { +// swprintf( sString, L"%d",gMercProfiles[ Menptr[ iId ].ubProfile ].sSalary * gMercProfiles[ Menptr[ iId ].ubProfile ].iMercMercContractLength ); + swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); + } + else + { + //Display a $0 amount +// swprintf( sString, L"0" ); + + swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); + } +*/ + swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); + + // insert commas and dollar sign + InsertCommasForDollarFigure( sString ); + InsertDollarSignInToString( sString ); + +/* +DEF:3/19/99: + if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC ) + { + swprintf( sStringA, L"%s", pPersonnelScreenStrings[ PRSNL_TXT_UNPAID_AMOUNT ] ); + } + else +*/ + { + swprintf( sStringA, L"%s", pPersonnelScreenStrings[ PRSNL_TXT_TOTAL_COST ] ); + } + + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x +(iSlot*TEXT_BOX_WIDTH) ),pPersonnelScreenPoints[ iCounter ].y,sStringA); + + // print contract cost + mprintf( ( INT16 ) ( sX ) , pPersonnelScreenPoints[iCounter].y,sString); + + if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + // daily rate + if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + { + // 2 week contract + swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].uiBiWeeklySalary / 14 ); + InsertCommasForDollarFigure( sStringA ); + InsertDollarSignInToString( sStringA ); + swprintf( sString, L"%s", sStringA ); + } + else if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + { + // 1 week contract + swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].uiWeeklySalary / 7 ); + InsertCommasForDollarFigure( sStringA ); + InsertDollarSignInToString( sStringA ); + swprintf( sString, L"%s", sStringA ); + } + else + { + + swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); + InsertCommasForDollarFigure( sStringA ); + InsertDollarSignInToString( sStringA ); + swprintf( sString, L"%s", sStringA ); + } + } + else if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { +//DEF: 99/2/7 +// swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary * Menptr[ iId ].iTotalContractLength); + swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); + InsertCommasForDollarFigure( sStringA ); + InsertDollarSignInToString( sStringA ); + swprintf( sString, L"%s", sStringA ); + } + + else + { + //Display a $0 amount +// swprintf( sString, L"0" ); +// InsertDollarSignInToString( sString ); + swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); + InsertCommasForDollarFigure( sStringA ); + InsertDollarSignInToString( sStringA ); + swprintf( sString, L"%s", sStringA ); + } + + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + +// iCounter++; + iCounter++; + + // now print daily rate + mprintf( ( INT16 )( sX ),pPersonnelScreenPoints[ iCounter+1 ].y,sString); + mprintf( (INT16)(pPersonnelScreenPoints[iCounter+1].x +(iSlot*TEXT_BOX_WIDTH) ),pPersonnelScreenPoints[ iCounter +1].y, pPersonnelScreenStrings[PRSNL_TXT_DAILY_COST]); + + break; + + case 5: + // medical deposit + + //if its a merc merc, display the salary oweing + if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC ) + { + mprintf((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter-1].y,pPersonnelScreenStrings[PRSNL_TXT_UNPAID_AMOUNT]); + + swprintf( sString, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary * gMercProfiles[Menptr[ iId ].ubProfile ].iMercMercContractLength ); + InsertCommasForDollarFigure( sString ); + InsertDollarSignInToString( sString ); + + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter-1].y,sString); + } + else + { + mprintf((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter-1].y,pPersonnelScreenStrings[PRSNL_TXT_MED_DEPOSIT]); + + swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].sMedicalDepositAmount); + + // insert commas and dollar sign + InsertCommasForDollarFigure( sString ); + InsertDollarSignInToString( sString ); + + FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + mprintf(sX,pPersonnelScreenPoints[iCounter-1].y,sString); + } + + + break; + + } + } +} + +// AIM merc: Returns the amount of time left on mercs contract +// MERC merc: Returns the amount of time the merc has worked +// IMP merc: Returns the amount of time the merc has worked +// else: returns -1 +INT32 CalcTimeLeftOnMercContract( SOLDIERTYPE *pSoldier ) +{ + INT32 iTimeLeftOnContract = -1; + + if(pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + { + iTimeLeftOnContract = pSoldier->iEndofContractTime-GetWorldTotalMin(); + + if( iTimeLeftOnContract < 0 ) + iTimeLeftOnContract = 0; + } + else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) + { + iTimeLeftOnContract = gMercProfiles[ pSoldier->ubProfile ].iMercMercContractLength; + } + + else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__PLAYER_CHARACTER ) + { + iTimeLeftOnContract = pSoldier->iTotalContractLength; + } + + else + { + iTimeLeftOnContract = -1; + } + + return( iTimeLeftOnContract ); +} + + + + + + + diff --git a/Laptop/personnel.h b/Laptop/personnel.h new file mode 100644 index 00000000..2ae61512 --- /dev/null +++ b/Laptop/personnel.h @@ -0,0 +1,45 @@ +#ifndef __PERSONNEL_H +#define __PERSONNEL_H + + +#include "Types.h" +#include "Soldier Control.h" + + +// delay for change in ATM mode +#define DELAY_PER_MODE_CHANGE_IN_ATM 2000 + + +void GameInitPersonnel(); +void EnterPersonnel(); +void ExitPersonnel(); +void HandlePersonnel(); +void RenderPersonnel(); + + +// add character to: + +// leaving for odd reasons +void AddCharacterToOtherList( SOLDIERTYPE *pSoldier ); + +// killed and removed +void AddCharacterToDeadList( SOLDIERTYPE *pSoldier ); + +// simply fired...but alive +void AddCharacterToFiredList( SOLDIERTYPE *pSoldier ); + +// get the total amt of money on this guy +INT32 GetFundsOnMerc( SOLDIERTYPE *pSoldier ); + +BOOLEAN TransferFundsFromMercToBank( SOLDIERTYPE *pSoldier, INT32 iCurrentBalance ); +BOOLEAN TransferFundsFromBankToMerc( SOLDIERTYPE *pSoldier, INT32 iCurrentBalance ); + +BOOLEAN RemoveNewlyHiredMercFromPersonnelDepartedList( UINT8 ubProfile ); + +#endif + + + + + + diff --git a/Laptop/sirtech.cpp b/Laptop/sirtech.cpp new file mode 100644 index 00000000..38bc8c73 --- /dev/null +++ b/Laptop/sirtech.cpp @@ -0,0 +1,37 @@ +#ifdef PRECOMPILEDHEADERS + #include "Laptop All.h" +#else + #include "laptop.h" + #include "SirTech.h" +#endif + +void GameInitSirTech() +{ + +} + +void EnterSirTech() +{ + +} + +void ExitSirTech() +{ + +} + +void HandleSirTech() +{ + +} + +void RenderSirTech() +{ + +} + + + + + + diff --git a/Laptop/sirtech.h b/Laptop/sirtech.h new file mode 100644 index 00000000..5cea2213 --- /dev/null +++ b/Laptop/sirtech.h @@ -0,0 +1,16 @@ +#ifndef __SIRTECH_H +#define __SIRTECH_H + +void GameInitSirTech(); +void EnterSirTech(); +void ExitSirTech(); +void HandleSirTech(); +void RenderSirTech(); + +#endif + + + + + + diff --git a/Loading Screen.cpp b/Loading Screen.cpp new file mode 100644 index 00000000..c287bf85 --- /dev/null +++ b/Loading Screen.cpp @@ -0,0 +1,964 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" + #include "Loading Screen.h" +#else + //??? +#endif + +extern HVSURFACE ghFrameBuffer; + + + +UINT8 gubLastLoadingScreenID = LOADINGSCREEN_NOTHING; +BOOLEAN bShowSmallImage = FALSE; + + +//returns the UINT8 ID for the specified sector. +UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) +{ + SECTORINFO *pSector; + UINT8 ubSectorID; + BOOLEAN fNight = FALSE; + + ubSectorID = SECTOR( sSectorX, sSectorY ); + if( NightTime() ) //before 5AM or after 9PM + { + fNight = TRUE; + } + switch( bSectorZ ) + { + case 0: + switch( ubSectorID ) + { + case SEC_A2: + case SEC_B2: + if( fNight ) + return LOADINGSCREEN_NIGHTCHITZENA; + return LOADINGSCREEN_DAYCHITZENA; + case SEC_A9: + if( !DidGameJustStart() ) + { + if( fNight ) + return LOADINGSCREEN_NIGHTOMERTA; + return LOADINGSCREEN_DAYOMERTA; + } + return LOADINGSCREEN_HELI; + case SEC_A10: + if( fNight ) + return LOADINGSCREEN_NIGHTOMERTA; + return LOADINGSCREEN_DAYOMERTA; + case SEC_P3: + if( fNight ) + return LOADINGSCREEN_NIGHTPALACE; + return LOADINGSCREEN_DAYPALACE; + case SEC_H13: + case SEC_H14: //military installations + case SEC_I13: + case SEC_N7: + if( fNight ) + return LOADINGSCREEN_NIGHTMILITARY; + return LOADINGSCREEN_DAYMILITARY; + case SEC_K4: + if( fNight ) + return LOADINGSCREEN_NIGHTLAB; + return LOADINGSCREEN_DAYLAB; + case SEC_J9: + if( fNight ) + return LOADINGSCREEN_NIGHTPRISON; + return LOADINGSCREEN_DAYPRISON; + case SEC_D2: + case SEC_D15: + case SEC_I8: + case SEC_N4: + if( fNight ) + return LOADINGSCREEN_NIGHTSAM; + return LOADINGSCREEN_DAYSAM; + case SEC_F8: + if( fNight ) + return LOADINGSCREEN_NIGHTHOSPITAL; + return LOADINGSCREEN_DAYHOSPITAL; + case SEC_B13: + case SEC_N3: + if( fNight ) + return LOADINGSCREEN_NIGHTAIRPORT; + return LOADINGSCREEN_DAYAIRPORT; + case SEC_L11: + case SEC_L12: + if( fNight ) + return LOADINGSCREEN_NIGHTBALIME; + return LOADINGSCREEN_DAYBALIME; + case SEC_H3: + case SEC_H8: + case SEC_D4: + if( fNight ) + return LOADINGSCREEN_NIGHTMINE; + return LOADINGSCREEN_DAYMINE; + } + pSector = &SectorInfo[ ubSectorID ]; + switch( pSector->ubTraversability[ 4 ] ) + { + case TOWN: + if( fNight ) + { + if( Random( 2 ) ) + { + return LOADINGSCREEN_NIGHTTOWN2; + } + return LOADINGSCREEN_NIGHTTOWN1; + } + if( Random( 2 ) ) + { + return LOADINGSCREEN_DAYTOWN2; + } + return LOADINGSCREEN_DAYTOWN1; + case SAND: + case SAND_ROAD: + if( fNight ) + { + return LOADINGSCREEN_NIGHTDESERT; + } + return LOADINGSCREEN_DAYDESERT; + case FARMLAND: + case FARMLAND_ROAD: + case ROAD: + if( fNight ) + { + return LOADINGSCREEN_NIGHTGENERIC; + } + return LOADINGSCREEN_DAYGENERIC; + case PLAINS: + case SPARSE: + case HILLS: + case PLAINS_ROAD: + case SPARSE_ROAD: + case HILLS_ROAD: + if( fNight ) + { + return LOADINGSCREEN_NIGHTWILD; + } + return LOADINGSCREEN_DAYWILD; + case DENSE: + case SWAMP: + case SWAMP_ROAD: + case DENSE_ROAD: + if( fNight ) + { + return LOADINGSCREEN_NIGHTFOREST; + } + return LOADINGSCREEN_DAYFOREST; + case TROPICS: + case TROPICS_ROAD: + case WATER: + case NS_RIVER: + case EW_RIVER: + case COASTAL: + case COASTAL_ROAD: + if( fNight ) + { + return LOADINGSCREEN_NIGHTTROPICAL; + } + return LOADINGSCREEN_DAYTROPICAL; + default: + Assert( 0 ); + if( fNight ) + { + return LOADINGSCREEN_NIGHTGENERIC; + } + return LOADINGSCREEN_DAYGENERIC; + } + break; + case 1: + switch( ubSectorID ) + { + case SEC_A10: //Miguel's basement + case SEC_I13: //Alma prison dungeon + case SEC_J9: //Tixa prison dungeon + case SEC_K4: //Orta weapons plant + case SEC_O3: //Meduna + case SEC_P3: //Meduna + return LOADINGSCREEN_BASEMENT; + default: //rest are mines + return LOADINGSCREEN_MINE; + } + break; + case 2: + case 3: + //all level 2 and 3 maps are caves! + return LOADINGSCREEN_CAVE; + default: + // shouldn't ever happen + Assert( FALSE ); + + if( fNight ) + { + return LOADINGSCREEN_NIGHTGENERIC; + } + return LOADINGSCREEN_DAYGENERIC; + } +} + +extern BOOLEAN gfSchedulesHosed; + +//sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER, +//and refreshing the screen with it. +void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) +{ + VSURFACE_DESC vs_desc; + HVSURFACE hVSurface; + UINT32 uiLoadScreen; + STRING512 smallImage; + + bShowSmallImage = FALSE; + + vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; + + switch( ubLoadScreenID ) + { + case LOADINGSCREEN_NOTHING: + strcpy(smallImage, "LOADSCREENS\\LS_Heli.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli_1024x768.sti"); + } + break; + case LOADINGSCREEN_DAYGENERIC: + strcpy(smallImage, "LOADSCREENS\\LS_DayGeneric.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayGeneric.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayGeneric_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayGeneric_1024x768.sti"); + } + break; + case LOADINGSCREEN_DAYTOWN1: + strcpy(smallImage, "LOADSCREENS\\LS_DayTown1.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTown1.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTown1_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTown1_1024x768.sti"); + } + break; + case LOADINGSCREEN_DAYTOWN2: + strcpy(smallImage, "LOADSCREENS\\LS_DayTown2.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTown2.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTown2_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTown2_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYWILD: + strcpy(smallImage, "LOADSCREENS\\LS_DayWild.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayWild.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayWild_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayWild_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYTROPICAL: + strcpy(smallImage, "LOADSCREENS\\LS_DayTropical.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTropical.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTropical_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTropical_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYFOREST: + strcpy(smallImage, "LOADSCREENS\\LS_DayForest.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayForest.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayForest_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayForest_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYDESERT: + strcpy(smallImage, "LOADSCREENS\\LS_DayDesert.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayDesert.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayDesert_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayDesert_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYPALACE: + strcpy(smallImage, "LOADSCREENS\\LS_DayPalace.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPalace.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPalace_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPalace_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTGENERIC: + strcpy(smallImage, "LOADSCREENS\\LS_NightGeneric.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightGeneric.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightGeneric_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightGeneric_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTWILD: + strcpy(smallImage, "LOADSCREENS\\LS_NightWild.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightWild.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightWild_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightWild_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTTOWN1: + strcpy(smallImage, "LOADSCREENS\\LS_NightTown1.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown1.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown1_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown1_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTTOWN2: + strcpy(smallImage, "LOADSCREENS\\LS_NightTown2.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown2.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown2_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown2_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTFOREST: + strcpy(smallImage, "LOADSCREENS\\LS_NightForest.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightForest.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightForest_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightForest_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTTROPICAL: + strcpy(smallImage, "LOADSCREENS\\LS_NightTropical.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTropical.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTropical_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTropical_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTDESERT: + strcpy(smallImage, "LOADSCREENS\\LS_NightDesert.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightDesert.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightDesert_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightDesert_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTPALACE: + strcpy(smallImage, "LOADSCREENS\\LS_NightPalace.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPalace.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPalace_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPalace_1024x768.sti"); + } + + break; + case LOADINGSCREEN_HELI: + strcpy(smallImage, "LOADSCREENS\\LS_Heli.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli_1024x768.sti"); + } + + break; + case LOADINGSCREEN_BASEMENT: + strcpy(smallImage, "LOADSCREENS\\LS_Basement.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Basement.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Basement_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Basement_1024x768.sti"); + } + + break; + case LOADINGSCREEN_MINE: + strcpy(smallImage, "LOADSCREENS\\LS_Mine.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Mine.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Mine_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Mine_1024x768.sti"); + } + + break; + case LOADINGSCREEN_CAVE: + strcpy(smallImage, "LOADSCREENS\\LS_Cave.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Cave.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Cave_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Cave_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYPINE: + strcpy(smallImage, "LOADSCREENS\\LS_DayPine.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPine.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPine_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPine_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTPINE: + strcpy(smallImage, "LOADSCREENS\\LS_NightPine.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPine.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPine_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPine_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYMILITARY: + strcpy(smallImage, "LOADSCREENS\\LS_DayMilitary.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMilitary.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMilitary_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMilitary_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTMILITARY: + strcpy(smallImage, "LOADSCREENS\\LS_NightMilitary.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMilitary.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMilitary_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMilitary_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYSAM: + strcpy(smallImage, "LOADSCREENS\\LS_DaySAM.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DaySAM.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DaySAM_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DaySAM_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTSAM: + strcpy(smallImage, "LOADSCREENS\\LS_NightSAM.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightSAM.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightSAM_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightSAM_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYPRISON: + strcpy(smallImage, "LOADSCREENS\\LS_DayPrison.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPrison.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPrison_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPrison_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTPRISON: + strcpy(smallImage, "LOADSCREENS\\LS_NightPrison.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPrison.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPrison_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPrison_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYHOSPITAL: + strcpy(smallImage, "LOADSCREENS\\LS_DayHospital.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayHospital.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayHospital_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayHospital_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTHOSPITAL: + strcpy(smallImage, "LOADSCREENS\\LS_NightHospital.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightHospital.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightHospital_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightHospital_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYAIRPORT: + strcpy(smallImage, "LOADSCREENS\\LS_DayAirport.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayAirport.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayAirport_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayAirport_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTAIRPORT: + strcpy(smallImage, "LOADSCREENS\\LS_NightAirport.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightAirport.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightAirport_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightAirport_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYLAB: + strcpy(smallImage, "LOADSCREENS\\LS_DayLab.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayLab.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayLab_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayLab_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTLAB: + strcpy(smallImage, "LOADSCREENS\\LS_NightLab.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightLab.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightLab_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightLab_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYOMERTA: + strcpy(smallImage, "LOADSCREENS\\LS_DayOmerta.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayOmerta.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayOmerta_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayOmerta_1024x768.sti"); + } + break; + case LOADINGSCREEN_NIGHTOMERTA: + strcpy(smallImage, "LOADSCREENS\\LS_NightOmerta.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightOmerta.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightOmerta_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightOmerta_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYCHITZENA: + strcpy(smallImage, "LOADSCREENS\\LS_DayChitzena.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayChitzena.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayChitzena_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayChitzena_1024x768.sti"); + } + + break; + case LOADINGSCREEN_NIGHTCHITZENA: + strcpy(smallImage, "LOADSCREENS\\LS_NightChitzena.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightChitzena.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightChitzena_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightChitzena_1024x768.sti"); + } + + break; + case LOADINGSCREEN_DAYMINE: + strcpy(smallImage, "LOADSCREENS\\LS_DayMine.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMine.sti" ); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMine_800x600.sti" ); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMine_1024x768.sti" ); + } + + break; + case LOADINGSCREEN_NIGHTMINE: + strcpy(smallImage, "LOADSCREENS\\LS_NightMine.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMine.sti" ); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMine_800x600.sti" ); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMine_1024x768.sti" ); + } + + break; + case LOADINGSCREEN_DAYBALIME: + strcpy(smallImage, "LOADSCREENS\\LS_DayBalime.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayBalime.sti" ); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayBalime_800x600.sti" ); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayBalime_1024x768.sti" ); + } + + break; + case LOADINGSCREEN_NIGHTBALIME: + strcpy(smallImage, "LOADSCREENS\\LS_NightBalime.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightBalime.sti" ); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightBalime_800x600.sti" ); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightBalime_1024x768.sti" ); + } + + break; + default: + strcpy(smallImage, "LOADSCREENS\\LS_Heli.sti"); + if (iResolution == 0) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli.sti"); + } + else if (iResolution == 1) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli_800x600.sti"); + } + else if (iResolution == 2) + { + strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli_1024x768.sti"); + } + break; + } + + // Sti loadscreen (big image) is not available + if ( AddVideoSurface( &vs_desc, &uiLoadScreen ) == FALSE && iResolution > 0) + { + bShowSmallImage = TRUE; + strcpy(vs_desc.ImageFile, smallImage); + } + + if( gfSchedulesHosed ) + { + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + SetFontShadow( FONT_NEARBLACK ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); + mprintf( 5, 5, L"Error loading save, attempting to patch save to version 1.02...", vs_desc.ImageFile ); + } + else if( AddVideoSurface( &vs_desc, &uiLoadScreen ) ) + { //Blit the background image + GetVideoSurface( &hVSurface, uiLoadScreen ); + + // Special case -> show the small image centered + if (iResolution > 0 && bShowSmallImage == TRUE) + { + BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL ); + } + else + { + BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); + } + + DeleteVideoSurfaceFromIndex( uiLoadScreen ); + } + else + { //Failed to load the file, so use a black screen and print out message. + SetFont( FONT10ARIAL ); + SetFontForeground( FONT_YELLOW ); + SetFontShadow( FONT_NEARBLACK ); + ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); + mprintf( 5, 5, L"%S loadscreen data file not found...", vs_desc.ImageFile ); + } + + gubLastLoadingScreenID = ubLoadScreenID; + InvalidateScreen( ); + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + RefreshScreen( NULL ); +} + diff --git a/Loading Screen.h b/Loading Screen.h new file mode 100644 index 00000000..0bdb6738 --- /dev/null +++ b/Loading Screen.h @@ -0,0 +1,65 @@ +#ifndef __LOADING_SCREEN_H +#define __LOADING_SCREEN_H + + + +enum +{ + LOADINGSCREEN_NOTHING, + LOADINGSCREEN_DAYGENERIC, + LOADINGSCREEN_DAYTOWN1, + LOADINGSCREEN_DAYTOWN2, + LOADINGSCREEN_DAYWILD, + LOADINGSCREEN_DAYTROPICAL, + LOADINGSCREEN_DAYFOREST, + LOADINGSCREEN_DAYDESERT, + LOADINGSCREEN_DAYPALACE, + LOADINGSCREEN_NIGHTGENERIC, + LOADINGSCREEN_NIGHTWILD, + LOADINGSCREEN_NIGHTTOWN1, + LOADINGSCREEN_NIGHTTOWN2, + LOADINGSCREEN_NIGHTFOREST, + LOADINGSCREEN_NIGHTTROPICAL, + LOADINGSCREEN_NIGHTDESERT, + LOADINGSCREEN_NIGHTPALACE, + LOADINGSCREEN_HELI, + LOADINGSCREEN_BASEMENT, + LOADINGSCREEN_MINE, + LOADINGSCREEN_CAVE, + LOADINGSCREEN_DAYPINE, + LOADINGSCREEN_NIGHTPINE, + LOADINGSCREEN_DAYMILITARY, + LOADINGSCREEN_NIGHTMILITARY, + LOADINGSCREEN_DAYSAM, + LOADINGSCREEN_NIGHTSAM, + LOADINGSCREEN_DAYPRISON, + LOADINGSCREEN_NIGHTPRISON, + LOADINGSCREEN_DAYHOSPITAL, + LOADINGSCREEN_NIGHTHOSPITAL, + LOADINGSCREEN_DAYAIRPORT, + LOADINGSCREEN_NIGHTAIRPORT, + LOADINGSCREEN_DAYLAB, + LOADINGSCREEN_NIGHTLAB, + LOADINGSCREEN_DAYOMERTA, + LOADINGSCREEN_NIGHTOMERTA, + LOADINGSCREEN_DAYCHITZENA, + LOADINGSCREEN_NIGHTCHITZENA, + LOADINGSCREEN_DAYMINE, + LOADINGSCREEN_NIGHTMINE, + LOADINGSCREEN_DAYBALIME, + LOADINGSCREEN_NIGHTBALIME, +}; + + + +//For use by the game loader, before it can possibly know the situation. +extern UINT8 gubLastLoadingScreenID; + +//returns the UINT8 ID for the specified sector. +UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ); + +//sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER, +//and refreshing the screen with it. +void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ); + +#endif \ No newline at end of file diff --git a/MainMenuScreen.cpp b/MainMenuScreen.cpp new file mode 100644 index 00000000..6f01bd26 --- /dev/null +++ b/MainMenuScreen.cpp @@ -0,0 +1,705 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" + #include "Encrypted File.h" +#else + #include "sgp.h" + #include "screenids.h" + #include "Timer Control.h" + #include "sys globals.h" + #include "fade screen.h" + #include "sysutil.h" + #include "vobject_blitters.h" + #include "MercTextBox.h" + #include "wcheck.h" + #include "cursors.h" + #include "font control.h" + #include "mainmenuscreen.h" + #include "cursor control.h" + #include "render dirty.h" + #include "music control.h" + #include "GameSettings.h" + #include "GameScreen.h" + #include "SaveLoadScreen.h" + #include "SaveLoadGame.h" + #include "Options Screen.h" + #include "English.h" + #include "Gameloop.h" + #include "Game Init.h" + #include "Utilities.h" + #include "WordWrap.h" + #include "Font Control.h" + #include "text.h" + #include "Multi Language Graphic Utils.h" + #include "Encrypted File.h" +#endif + +#define MAINMENU_TEXT_FILE "LoadScreens\\MainMenu.edt" +#define MAINMENU_RECORD_SIZE 80 * 2 + +//#define TESTFOREIGNFONTS + +// MENU ITEMS +enum +{ +// TITLE, + NEW_GAME, + LOAD_GAME, + PREFERENCES, + CREDITS, + QUIT, + NUM_MENU_ITEMS +}; + +#define MAINMENU_Y iScreenHeightOffset + 277 +#define MAINMENU_Y_SPACE 37 + + +INT32 iMenuImages[ NUM_MENU_ITEMS ]; +INT32 iMenuButtons[ NUM_MENU_ITEMS ]; + +UINT16 gusMainMenuButtonWidths[ NUM_MENU_ITEMS ]; + +UINT32 guiMainMenuBackGroundImage; +UINT32 guiJa2LogoImage; + +MOUSE_REGION gBackRegion; +INT8 gbHandledMainMenu = 0; +BOOLEAN fInitialRender = FALSE; +//BOOLEAN gfDoHelpScreen = 0; + +BOOLEAN gfMainMenuScreenEntry = FALSE; +BOOLEAN gfMainMenuScreenExit = FALSE; + +UINT32 guiMainMenuExitScreen = MAINMENU_SCREEN; + + +extern BOOLEAN gfLoadGameUponEntry; + + +void ExitMainMenu( ); +void MenuButtonCallback(GUI_BUTTON *btn, INT32 reason); +void HandleMainMenuInput(); +void HandleMainMenuScreen(); +void DisplayAssignmentText(); +void ClearMainMenu(); +void HandleHelpScreenInput(); +void SelectMainMenuBackGroundRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void SetMainMenuExitScreen( UINT32 uiNewScreen ); +void CreateDestroyBackGroundMouseMask( BOOLEAN fCreate ); +BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ); +void RenderMainMenu(); +void RestoreButtonBackGrounds(); + + + + +UINT32 MainMenuScreenInit( ) +{ + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Version Label: %S", zVersionLabel )); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Version #: %s", czVersionNumber )); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Tracking #: %S", zTrackingNumber )); + + return( TRUE ); +} + + + +UINT32 MainMenuScreenHandle( ) +{ + UINT32 cnt; + UINT32 uiTime; + + if( guiSplashStartTime + 4000 > GetJA2Clock() ) + { + SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); + SetMusicMode( MUSIC_NONE ); + return MAINMENU_SCREEN; //The splash screen hasn't been up long enough yet. + } + if( guiSplashFrameFade ) + { //Fade the splash screen. + uiTime = GetJA2Clock(); + if( guiSplashFrameFade > 2 ) + ShadowVideoSurfaceRectUsingLowPercentTable( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + else if( guiSplashFrameFade > 1 ) + ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); + else + { + uiTime = GetJA2Clock(); + //while( GetJA2Clock() < uiTime + 375 ); + SetMusicMode( MUSIC_MAIN_MENU ); + } + + //while( uiTime + 100 > GetJA2Clock() ); + + guiSplashFrameFade--; + + InvalidateScreen(); + EndFrameBufferRender(); + + SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); + + return MAINMENU_SCREEN; + } + + SetCurrentCursorFromDatabase( CURSOR_NORMAL ); + + if( gfMainMenuScreenEntry ) + { + InitMainMenu( ); + gfMainMenuScreenEntry = FALSE; + gfMainMenuScreenExit = FALSE; + guiMainMenuExitScreen = MAINMENU_SCREEN; + SetMusicMode( MUSIC_MAIN_MENU ); + } + + + if ( fInitialRender ) + { + ClearMainMenu(); + RenderMainMenu(); + + fInitialRender = FALSE; + } + + RestoreButtonBackGrounds(); + + // Render buttons + for ( cnt = 0; cnt < NUM_MENU_ITEMS; cnt++ ) + { + MarkAButtonDirty( iMenuButtons[ cnt ] ); + } + + RenderButtons( ); + + EndFrameBufferRender( ); + + +// if ( gfDoHelpScreen ) +// HandleHelpScreenInput(); +// else + HandleMainMenuInput(); + + HandleMainMenuScreen(); + + if( gfMainMenuScreenExit ) + { + ExitMainMenu( ); + gfMainMenuScreenExit = FALSE; + gfMainMenuScreenEntry = TRUE; + } + + if( guiMainMenuExitScreen != MAINMENU_SCREEN ) + gfMainMenuScreenEntry = TRUE; + + return( guiMainMenuExitScreen ); +} + + +UINT32 MainMenuScreenShutdown( ) +{ + return( FALSE ); +} + + + + +void HandleMainMenuScreen() +{ + if ( gbHandledMainMenu != 0 ) + { + // Exit according to handled value! + switch( gbHandledMainMenu ) + { + case QUIT: + gfMainMenuScreenExit = TRUE; + gfProgramIsRunning = FALSE; + break; + + case NEW_GAME: + +// gfDoHelpScreen = 1; +// gfMainMenuScreenExit = TRUE; +// if( !gfDoHelpScreen ) +// SetMainMenuExitScreen( INIT_SCREEN ); + break; + + case LOAD_GAME: + // Select the game which is to be restored + guiPreviousOptionScreen = guiCurrentScreen; + guiMainMenuExitScreen = SAVE_LOAD_SCREEN; + gbHandledMainMenu = 0; + gfSaveGame = FALSE; + gfMainMenuScreenExit = TRUE; + + break; + + case PREFERENCES: + guiPreviousOptionScreen = guiCurrentScreen; + guiMainMenuExitScreen = OPTIONS_SCREEN; + gbHandledMainMenu = 0; + gfMainMenuScreenExit = TRUE; + break; + + case CREDITS: + guiMainMenuExitScreen = CREDIT_SCREEN; + gbHandledMainMenu = 0; + gfMainMenuScreenExit = TRUE; + break; + } + } +} + + + +BOOLEAN InitMainMenu( ) +{ + VOBJECT_DESC VObjectDesc; + +// gfDoHelpScreen = 0; + + //Check to see whatr saved game files exist + InitSaveGameArray(); + + //Create the background mouse mask + CreateDestroyBackGroundMouseMask( TRUE ); + + CreateDestroyMainMenuButtons( TRUE ); + + // load background graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + + if (iResolution == 0) + { + FilenameForBPP("LOADSCREENS\\MainMenuBackGround.sti", VObjectDesc.ImageFile); + } + else if (iResolution == 1) + { + FilenameForBPP("LOADSCREENS\\MainMenuBackGround_800x600.sti", VObjectDesc.ImageFile); + } + else if (iResolution == 2) + { + FilenameForBPP("LOADSCREENS\\MainMenuBackGround_1024x768.sti", VObjectDesc.ImageFile); + } + + CHECKF(AddVideoObject(&VObjectDesc, &guiMainMenuBackGroundImage )); + + // load ja2 logo graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; +// FilenameForBPP("INTERFACE\\Ja2_2.sti", VObjectDesc.ImageFile); + FilenameForBPP("LOADSCREENS\\Ja2Logo.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiJa2LogoImage )); + +/* + // Gray out some buttons based on status of game! + if( gGameSettings.bLastSavedGameSlot < 0 || gGameSettings.bLastSavedGameSlot >= NUM_SAVE_GAMES ) + { + DisableButton( iMenuButtons[ LOAD_GAME ] ); + } + //The ini file said we have a saved game, but there is no saved game + else if( gbSaveGameArray[ gGameSettings.bLastSavedGameSlot ] == FALSE ) + DisableButton( iMenuButtons[ LOAD_GAME ] ); +*/ + + //if there are no saved games, disable the button + if( !IsThereAnySavedGameFiles() ) + DisableButton( iMenuButtons[ LOAD_GAME ] ); + + +// DisableButton( iMenuButtons[ CREDITS ] ); +// DisableButton( iMenuButtons[ TITLE ] ); + + gbHandledMainMenu = 0; + fInitialRender = TRUE; + + SetPendingNewScreen( MAINMENU_SCREEN); + guiMainMenuExitScreen = MAINMENU_SCREEN; + + InitGameOptions(); + + DequeueAllKeyBoardEvents(); + + return( TRUE ); +} + + +void ExitMainMenu( ) +{ +// UINT32 uiDestPitchBYTES; +// UINT8 *pDestBuf; + +// if( !gfDoHelpScreen ) + { + CreateDestroyBackGroundMouseMask( FALSE ); + } + + + CreateDestroyMainMenuButtons( FALSE ); + + DeleteVideoObjectFromIndex( guiMainMenuBackGroundImage ); + DeleteVideoObjectFromIndex( guiJa2LogoImage ); + + gMsgBox.uiExitScreen = MAINMENU_SCREEN; +/* + // CLEAR THE FRAME BUFFER + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES ); + UnLockVideoSurface( FRAME_BUFFER ); + InvalidateScreen( ); +*/ +} + + +void MenuButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + INT8 bID; + + bID = (UINT8)btn->UserData[0]; + + if (!(btn->uiFlags & BUTTON_ENABLED)) + return; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + // handle menu + gbHandledMainMenu = bID; + RenderMainMenu(); + + if( gbHandledMainMenu == NEW_GAME ) + { + SetMainMenuExitScreen( GAME_INIT_OPTIONS_SCREEN ); + } + else if( gbHandledMainMenu == LOAD_GAME ) + { + if( gfKeyState[ ALT ] ) + gfLoadGameUponEntry = TRUE; + } + + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + } + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + RenderMainMenu(); + btn->uiFlags |= BUTTON_CLICKED_ON; + } +} + +void MenuButtonMoveCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { +// btn->uiFlags &= (~BUTTON_CLICKED_ON ); + RenderMainMenu(); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_GAIN_MOUSE) + { +// btn->uiFlags &= (~BUTTON_CLICKED_ON ); + RenderMainMenu(); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + +void HandleMainMenuInput() +{ + InputAtom InputEvent; + + // Check for esc + while (DequeueEvent(&InputEvent) == TRUE) + { + if( InputEvent.usEvent == KEY_UP ) + { + switch( InputEvent.usParam ) + { +/* + case ESC: + gbHandledMainMenu = QUIT; + break; +*/ + +#ifdef JA2TESTVERSION + case 'q': + gbHandledMainMenu = NEW_GAME; + gfMainMenuScreenExit = TRUE; + SetMainMenuExitScreen( INIT_SCREEN ); + +// gfDoHelpScreen = 1; + break; + + case 'i': + SetPendingNewScreen( INTRO_SCREEN ); + gfMainMenuScreenExit = TRUE; + break; +#endif + + case 'c': + gbHandledMainMenu = LOAD_GAME; + + if( gfKeyState[ ALT ] ) + gfLoadGameUponEntry = TRUE; + + break; + + case 'o': + gbHandledMainMenu = PREFERENCES; + break; + + case 's': + gbHandledMainMenu = CREDITS; + break; + } + } + } +} + +void HandleHelpScreenInput() +{ + InputAtom InputEvent; + + // Check for key + while (DequeueEvent(&InputEvent) == TRUE) + { + switch( InputEvent.usEvent ) + { + case KEY_UP: + SetMainMenuExitScreen( INIT_SCREEN ); + break; + } + } +} + + +void ClearMainMenu() +{ + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + + // CLEAR THE FRAME BUFFER + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES ); + UnLockVideoSurface( FRAME_BUFFER ); + InvalidateScreen( ); +} + + +void SelectMainMenuBackGroundRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { +// if( gfDoHelpScreen ) +// { +// SetMainMenuExitScreen( INIT_SCREEN ); +// gfDoHelpScreen = FALSE; +// } + } + else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + { +/* + if( gfDoHelpScreen ) + { + SetMainMenuExitScreen( INIT_SCREEN ); + gfDoHelpScreen = FALSE; + } +*/ + } +} + +void SetMainMenuExitScreen( UINT32 uiNewScreen ) +{ + guiMainMenuExitScreen = uiNewScreen; + + //REmove the background region + CreateDestroyBackGroundMouseMask( FALSE ); + + gfMainMenuScreenExit = TRUE; +} + + +void CreateDestroyBackGroundMouseMask( BOOLEAN fCreate ) +{ + static fRegionCreated = FALSE; + + if( fCreate ) + { + if( fRegionCreated ) + return; + + // Make a mouse region + MSYS_DefineRegion( &(gBackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, + CURSOR_NORMAL, MSYS_NO_CALLBACK, SelectMainMenuBackGroundRegionCallBack ); + // Add region + MSYS_AddRegion(&(gBackRegion) ); + + fRegionCreated = TRUE; + } + else + { + if( !fRegionCreated ) + return; + + MSYS_RemoveRegion( &gBackRegion ); + fRegionCreated = FALSE; + } +} + + +BOOLEAN CreateDestroyMainMenuButtons( BOOLEAN fCreate ) +{ + static BOOLEAN fButtonsCreated = FALSE; + INT32 cnt; + SGPFILENAME filename; + INT16 sSlot; + INT32 iStartLoc=0; +#ifndef _DEBUG + CHAR16 zText[512]; +#endif + + + if( fCreate ) + { + if( fButtonsCreated ) + return( TRUE ); + + //reset the variable that allows the user to ALT click on the continue save btn to load the save instantly + gfLoadGameUponEntry = FALSE; + + // Load button images + GetMLGFilename( filename, MLG_TITLETEXT ); + + iMenuImages[ NEW_GAME ] = LoadButtonImage( filename, 0,0, 1, 2 ,-1 ); + sSlot = 0; + iMenuImages[ LOAD_GAME ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,6,3,4,5,-1 ); + iMenuImages[ PREFERENCES ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,7,7,8,9,-1 ); + iMenuImages[ CREDITS ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,13,10,11,12,-1 ); + iMenuImages[ QUIT ] = UseLoadedButtonImage( iMenuImages[ NEW_GAME ] ,14,14,15,16,-1 ); + + for ( cnt = 0; cnt < NUM_MENU_ITEMS; cnt++ ) + { + switch( cnt ) + { + case NEW_GAME: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], sSlot ); break; + case LOAD_GAME: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 3 ); break; + case PREFERENCES: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 7 ); break; + case CREDITS: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 10 ); break; + case QUIT: gusMainMenuButtonWidths[cnt] = GetWidthOfButtonPic( (UINT16)iMenuImages[cnt], 15 ); break; + } +#ifdef TESTFOREIGNFONTS + iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)((SCREEN_WIDTH / 2) - gusMainMenuButtonWidths[cnt]/2), (INT16)( 0 + ( cnt * 18 ) ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, MenuButtonCallback ); +#else + /*iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)(420 - gusMainMenuButtonWidths[cnt]/2), (INT16)( MAINMENU_Y + ( cnt * MAINMENU_Y_SPACE ) ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, MenuButtonCallback );*/ + + iMenuButtons[ cnt ] = QuickCreateButton( iMenuImages[ cnt ], (INT16)((SCREEN_WIDTH / 2) - gusMainMenuButtonWidths[cnt]/2), (INT16)( MAINMENU_Y + ( cnt * MAINMENU_Y_SPACE ) ), + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, MenuButtonCallback ); +#endif + if ( iMenuButtons[ cnt ] == -1 ) + { + return( FALSE ); + } + ButtonList[ iMenuButtons[ cnt ] ]->UserData[0] = cnt; + + #ifndef _DEBUG + //load up some info from the 'mainmenu.edt' file. This makes sure the file is present. The file is + // 'marked' with a code that identifies the testers + iStartLoc = MAINMENU_RECORD_SIZE * cnt; + if( !LoadEncryptedDataFromFile(MAINMENU_TEXT_FILE, zText, iStartLoc, MAINMENU_RECORD_SIZE ) ) + { + //the file was not able to be loaded properly + SOLDIERTYPE *pSoldier = NULL; + + if( pSoldier->bActive != TRUE ) + { + //something is very wrong + pSoldier->bActive = pSoldier->bLife; + } + } + #endif + + } + + + fButtonsCreated = TRUE; + } + else + { + if( !fButtonsCreated ) + return( TRUE ); + + // Delete images/buttons + for ( cnt = 0; cnt < NUM_MENU_ITEMS; cnt++ ) + { + RemoveButton( iMenuButtons[ cnt ] ); + UnloadButtonImage( iMenuImages[ cnt ] ); + } + fButtonsCreated = FALSE; + } + + return( TRUE ); +} + + +void RenderMainMenu() +{ + HVOBJECT hPixHandle; + + //Get and display the background image + GetVideoObject(&hPixHandle, guiMainMenuBackGroundImage ); + BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, 0, 0, VO_BLT_SRCTRANSPARENCY,NULL); + + GetVideoObject(&hPixHandle, guiJa2LogoImage ); + BltVideoObject( FRAME_BUFFER, hPixHandle, 0, iScreenWidthOffset + 188, iScreenHeightOffset + 10, VO_BLT_SRCTRANSPARENCY,NULL); + BltVideoObject( guiSAVEBUFFER, hPixHandle, 0, iScreenWidthOffset + 188, iScreenHeightOffset + 10, VO_BLT_SRCTRANSPARENCY,NULL); + + +#ifdef TESTFOREIGNFONTS + DrawTextToScreen( L"LARGEFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 105, 640, LARGEFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"SMALLFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 125, 640, SMALLFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"TINYFONT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 145, 640, TINYFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT12POINT1: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 165, 640, FONT12POINT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"COMPFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 185, 640, COMPFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"SMALLCOMPFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 205, 640, SMALLCOMPFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT10ROMAN: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 225, 640, FONT10ROMAN, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT12ROMAN: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 245, 640, FONT12ROMAN, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT14SANSERIF: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 255, 640, FONT14SANSERIF, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"MILITARYFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 265, 640, MILITARYFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT10ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 285, 640, FONT10ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT14ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 305, 640, FONT14ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT12ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 325, 640, FONT12ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT10ARIALBOLD: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 345, 640, FONT10ARIALBOLD, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"BLOCKFONT: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 365, 640, BLOCKFONT, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"BLOCKFONT2: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 385, 640, BLOCKFONT2, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT12ARIALFIXEDWIDTH: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 405, 640, FONT12ARIALFIXEDWIDTH, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT16ARIAL: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 425, 640, FONT16ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"BLOCKFONTNARROW: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 445, 640, BLOCKFONTNARROW, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + DrawTextToScreen( L"FONT14HUMANIST: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 465, 640, FONT14HUMANIST, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); +#else + DrawTextToScreen( gzCopyrightText[ 0 ], 0, SCREEN_HEIGHT - 20, SCREEN_WIDTH, FONT10ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); +#endif + + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); +} + +void RestoreButtonBackGrounds() +{ + UINT8 cnt; + +// RestoreExternBackgroundRect( (UINT16)(320 - gusMainMenuButtonWidths[TITLE]/2), MAINMENU_TITLE_Y, gusMainMenuButtonWidths[TITLE], 23 ); + +#ifndef TESTFOREIGNFONTS + for ( cnt = 0; cnt < NUM_MENU_ITEMS; cnt++ ) + { + RestoreExternBackgroundRect( (UINT16)((SCREEN_WIDTH / 2) - gusMainMenuButtonWidths[cnt]/2), (INT16)( MAINMENU_Y + ( cnt * MAINMENU_Y_SPACE )-1), (UINT16)(gusMainMenuButtonWidths[cnt]+1), 23 ); + } +#endif +} + + diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..beadb428 --- /dev/null +++ b/Makefile @@ -0,0 +1,72 @@ +# Makefile - JA2.dsw + +.PHONY: all +all: \ + Editor \ + Laptop \ + "Standard Gaming Platform" \ + Strategic \ + Tactical \ + TacticalAI \ + TileEngine \ + Utils \ + ja2 + +.PHONY: Editor +Editor: + $(MAKE) -C Editor -f Editor.mak + +.PHONY: Laptop +Laptop: + $(MAKE) -C Laptop -f Laptop.mak + +.PHONY: "Standard Gaming Platform" +"Standard Gaming Platform": + +.PHONY: Strategic +Strategic: + $(MAKE) -C Strategic -f Strategic.mak + +.PHONY: Tactical +Tactical: + $(MAKE) -C Tactical -f Tactical.mak + +.PHONY: TacticalAI +TacticalAI: + $(MAKE) -C TacticalAI -f TacticalAI.mak + +.PHONY: TileEngine +TileEngine: + $(MAKE) -C TileEngine -f TileEngine.mak + +.PHONY: Utils +Utils: + $(MAKE) -C Utils -f Utils.mak + +.PHONY: ja2 +ja2: + $(MAKE) -f JA2.mak + +.PHONY: clean +clean: + $(MAKE) -C Editor -f Editor.mak clean + $(MAKE) -C Laptop -f Laptop.mak clean + + $(MAKE) -C Strategic -f Strategic.mak clean + $(MAKE) -C Tactical -f Tactical.mak clean + $(MAKE) -C TacticalAI -f TacticalAI.mak clean + $(MAKE) -C TileEngine -f TileEngine.mak clean + $(MAKE) -C Utils -f Utils.mak clean + $(MAKE) -f JA2.mak clean + +.PHONY: depends +depends: + $(MAKE) -C Editor -f Editor.mak depends + $(MAKE) -C Laptop -f Laptop.mak depends + + $(MAKE) -C Strategic -f Strategic.mak depends + $(MAKE) -C Tactical -f Tactical.mak depends + $(MAKE) -C TacticalAI -f TacticalAI.mak depends + $(MAKE) -C TileEngine -f TileEngine.mak depends + $(MAKE) -C Utils -f Utils.mak depends + $(MAKE) -f JA2.mak depends diff --git a/MessageBoxScreen.cpp b/MessageBoxScreen.cpp new file mode 100644 index 00000000..3024302b --- /dev/null +++ b/MessageBoxScreen.cpp @@ -0,0 +1,1277 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" +#else + #include "sgp.h" + #include "screenids.h" + #include "Timer Control.h" + #include "sys globals.h" + #include "fade screen.h" + #include "sysutil.h" + #include "vobject_blitters.h" + #include "MercTextBox.h" + #include "wcheck.h" + #include "cursors.h" + #include "messageboxscreen.h" + #include "font control.h" + #include "Game Clock.h" + #include "Map Screen Interface.h" + #include "renderworld.h" + #include "gameloop.h" + #include "english.h" + #include "GameSettings.h" + #include "Interface Control.h" + #include "cursor control.h" + #include "laptop.h" + #include "text.h" +#endif + +#define MSGBOX_DEFAULT_WIDTH 300 + +#define MSGBOX_BUTTON_WIDTH 61 +#define MSGBOX_BUTTON_HEIGHT 20 +#define MSGBOX_BUTTON_X_SEP 15 + +#define MSGBOX_SMALL_BUTTON_WIDTH 31 +#define MSGBOX_SMALL_BUTTON_X_SEP 8 + +typedef void (*MSGBOX_CALLBACK)( UINT8 bExitValue ); + +// old mouse x and y positions +SGPPoint pOldMousePosition; +SGPRect MessageBoxRestrictedCursorRegion; + +// if the cursor was locked to a region +BOOLEAN fCursorLockedToArea = FALSE; +BOOLEAN gfInMsgBox = FALSE; + +//extern BOOLEAN fMapExitDueToMessageBox; +extern BOOLEAN fInMapMode; +extern BOOLEAN gfOverheadMapDirty; + + +void OKMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ); +void YESMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ); +void ContractMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ); +void LieMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ); +void NOMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ); +void NumberedMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ); +void MsgBoxClickCallback( MOUSE_REGION * pRegion, INT32 iReason ); +UINT32 ExitMsgBox( INT8 ubExitCode ); +UINT16 GetMSgBoxButtonWidth( INT32 iButtonImage ); + +SGPRect gOldCursorLimitRectangle; + + +MESSAGE_BOX_STRUCT gMsgBox; +BOOLEAN gfNewMessageBox = FALSE; +BOOLEAN gfStartedFromGameScreen = FALSE; +BOOLEAN gfStartedFromMapScreen = FALSE; +BOOLEAN fRestoreBackgroundForMessageBox = FALSE; +BOOLEAN gfDontOverRideSaveBuffer = TRUE; //this variable can be unset if ur in a non gamescreen and DONT want the msg box to use the save buffer +extern void HandleTacticalUILoseCursorFromOtherScreen( ); +extern STR16 pUpdatePanelButtons[]; + +CHAR16 gzUserDefinedButton1[ 128 ]; +CHAR16 gzUserDefinedButton2[ 128 ]; + +template INT32 DoMessageBox(UINT8, unsigned short *, UINT32, UINT16, MSGBOX_CALLBACK, SGPRect *); +template INT32 DoMessageBox(UINT8, unsigned short const*, UINT32, UINT16, MSGBOX_CALLBACK, SGPRect *); +template +INT32 DoMessageBox( UINT8 ubStyle, string2 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ) +{ + VSURFACE_DESC vs_desc; + UINT16 usTextBoxWidth; + UINT16 usTextBoxHeight; + SGPRect aRect; + UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; + UINT8 *pDestBuf, *pSrcBuf; + INT16 sButtonX, sButtonY, sBlankSpace; + UINT8 ubMercBoxBackground = BASIC_MERC_POPUP_BACKGROUND, ubMercBoxBorder = BASIC_MERC_POPUP_BORDER; + UINT8 ubFontColor, ubFontShadowColor; + UINT16 usCursor; + INT32 iId = -1; + + GetMousePos( &pOldMousePosition ); + + //this variable can be unset if ur in a non gamescreen and DONT want the msg box to use the save buffer + gfDontOverRideSaveBuffer = TRUE; + + SetCurrentCursorFromDatabase( CURSOR_NORMAL ); + + if( gMsgBox.BackRegion.uiFlags & MSYS_REGION_EXISTS ) + { + return( 0 ); + } + + // Based on style.... + switch( ubStyle ) + { + //default + case MSG_BOX_BASIC_STYLE: + + ubMercBoxBackground = DIALOG_MERC_POPUP_BACKGROUND; + ubMercBoxBorder = DIALOG_MERC_POPUP_BORDER; + + // Add button images + gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\popupbuttons.sti", -1,0,-1,1,-1 ); + ubFontColor = FONT_MCOLOR_WHITE; + ubFontShadowColor = DEFAULT_SHADOW; + usCursor = CURSOR_NORMAL; + + break; + + case MSG_BOX_RED_ON_WHITE: + ubMercBoxBackground = WHITE_MERC_POPUP_BACKGROUND; + ubMercBoxBorder = RED_MERC_POPUP_BORDER; + + // Add button images + gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\msgboxRedButtons.sti", -1,0,-1,1,-1 ); + + ubFontColor = 2; + ubFontShadowColor = NO_SHADOW; + usCursor = CURSOR_LAPTOP_SCREEN; + break; + + case MSG_BOX_BLUE_ON_GREY: + ubMercBoxBackground = GREY_MERC_POPUP_BACKGROUND; + ubMercBoxBorder = BLUE_MERC_POPUP_BORDER; + + // Add button images + gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\msgboxGreyButtons.sti", -1,0,-1,1,-1 ); + + ubFontColor = 2; + ubFontShadowColor = FONT_MCOLOR_WHITE; + usCursor = CURSOR_LAPTOP_SCREEN; + break; + case MSG_BOX_IMP_STYLE: + ubMercBoxBackground = IMP_POPUP_BACKGROUND; + ubMercBoxBorder = DIALOG_MERC_POPUP_BORDER; + + // Add button images + gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\msgboxGreyButtons.sti", -1,0,-1,1,-1 ); + + ubFontColor = 2; + ubFontShadowColor = FONT_MCOLOR_WHITE; + usCursor = CURSOR_LAPTOP_SCREEN; + break; + case MSG_BOX_BASIC_SMALL_BUTTONS: + + ubMercBoxBackground = DIALOG_MERC_POPUP_BACKGROUND; + ubMercBoxBorder = DIALOG_MERC_POPUP_BORDER; + + // Add button images + gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\popupbuttons.sti", -1,2,-1,3,-1 ); + ubFontColor = FONT_MCOLOR_WHITE; + ubFontShadowColor = DEFAULT_SHADOW; + usCursor = CURSOR_NORMAL; + + break; + + case MSG_BOX_LAPTOP_DEFAULT: + ubMercBoxBackground = LAPTOP_POPUP_BACKGROUND; + ubMercBoxBorder = LAPTOP_POP_BORDER; + + // Add button images + gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\popupbuttons.sti", -1,0,-1,1,-1 ); + ubFontColor = FONT_MCOLOR_WHITE; + ubFontShadowColor = DEFAULT_SHADOW; + usCursor = CURSOR_LAPTOP_SCREEN; + break; + + default: + ubMercBoxBackground = BASIC_MERC_POPUP_BACKGROUND; + ubMercBoxBorder = BASIC_MERC_POPUP_BORDER; + + // Add button images + gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\msgboxbuttons.sti", -1,0,-1,1,-1 ); + ubFontColor = FONT_MCOLOR_WHITE; + ubFontShadowColor = DEFAULT_SHADOW; + usCursor = CURSOR_NORMAL; + break; + } + + + if ( usFlags & MSG_BOX_FLAG_USE_CENTERING_RECT && pCenteringRect != NULL ) + { + aRect.iTop = pCenteringRect->iTop; + aRect.iLeft = pCenteringRect->iLeft; + aRect.iBottom = pCenteringRect->iBottom; + aRect.iRight = pCenteringRect->iRight; + } + else + { + // Use default! + aRect.iTop = 0; + aRect.iLeft = 0; + aRect.iBottom = SCREEN_HEIGHT; + aRect.iRight = SCREEN_WIDTH; + } + + // Set some values! + gMsgBox.usFlags = usFlags; + gMsgBox.uiExitScreen = uiExitScreen; + gMsgBox.ExitCallback = ReturnCallback; + gMsgBox.fRenderBox = TRUE; + gMsgBox.bHandled = 0; + + // Init message box + gMsgBox.iBoxId = PrepareMercPopupBox( iId, ubMercBoxBackground, ubMercBoxBorder, (STR16)zString, MSGBOX_DEFAULT_WIDTH, 40, 10, 30, &usTextBoxWidth, &usTextBoxHeight ); + + if( gMsgBox.iBoxId == -1 ) + { + #ifdef JA2BETAVERSION + AssertMsg( 0, "Failed in DoMessageBox(). Probable reason is because the string was too large to fit in max message box size." ); + #endif + return 0; + } + + // Save height,width + gMsgBox.usWidth = usTextBoxWidth; + gMsgBox.usHeight = usTextBoxHeight; + + // Determine position ( centered in rect ) + gMsgBox.sX = (INT16)( ( ( ( aRect.iRight - aRect.iLeft ) - usTextBoxWidth ) / 2 ) + aRect.iLeft ); + gMsgBox.sY = (INT16)( ( ( ( aRect.iBottom - aRect.iTop ) - usTextBoxHeight ) / 2 ) + aRect.iTop ); + + if ( guiCurrentScreen == GAME_SCREEN ) + { + gfStartedFromGameScreen = TRUE; + } + + if ( (fInMapMode == TRUE ) ) + { +// fMapExitDueToMessageBox = TRUE; + gfStartedFromMapScreen = TRUE; + fMapPanelDirty = TRUE; + } + + + // Set pending screen + SetPendingNewScreen( MSG_BOX_SCREEN); + + // Init save buffer + vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; + vs_desc.usWidth = usTextBoxWidth; + vs_desc.usHeight = usTextBoxHeight; + vs_desc.ubBitDepth = 16; + + if( AddVideoSurface( &vs_desc, &gMsgBox.uiSaveBuffer) == FALSE ) + { + return( - 1 ); + } + + //Save what we have under here... + pDestBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiDestPitchBYTES); + pSrcBuf = LockVideoSurface( FRAME_BUFFER, &uiSrcPitchBYTES); + + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0 , 0, + gMsgBox.sX , gMsgBox.sY, + usTextBoxWidth, usTextBoxHeight ); + + UnLockVideoSurface( gMsgBox.uiSaveBuffer ); + UnLockVideoSurface( FRAME_BUFFER ); + + // Create top-level mouse region + MSYS_DefineRegion( &(gMsgBox.BackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST, + usCursor, MSYS_NO_CALLBACK, MsgBoxClickCallback ); + + if( gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] == FALSE ) + { + if( usFlags & MSG_BOX_FLAG_OK ) + { + SimulateMouseMovement( ( gMsgBox.sX + ( usTextBoxWidth / 2 ) + 27 ), ( gMsgBox.sY + ( usTextBoxHeight - 10 ) ) ); + } + else + { + SimulateMouseMovement( gMsgBox.sX + usTextBoxWidth / 2 , gMsgBox.sY + usTextBoxHeight - 4 ); + } + } + + // Add region + MSYS_AddRegion(&(gMsgBox.BackRegion) ); + + // findout if cursor locked, if so, store old params and store, restore when done + if( IsCursorRestricted() ) + { + fCursorLockedToArea = TRUE; + GetRestrictedClipCursor( &MessageBoxRestrictedCursorRegion ); + FreeMouseCursor( ); + } + + // Create four numbered buttons + if ( usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) + { + // This is exclusive of any other buttons... no ok, no cancel, no nothing + + sBlankSpace = usTextBoxWidth - MSGBOX_SMALL_BUTTON_WIDTH * 4 - MSGBOX_SMALL_BUTTON_X_SEP * 3; + sButtonX = sBlankSpace / 2; + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiButton[0] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"1", FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); + MSYS_SetBtnUserData( gMsgBox.uiButton[0], 0, 1); + SetButtonCursor(gMsgBox.uiButton[0], usCursor); + + sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP; + gMsgBox.uiButton[1] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"2", FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); + MSYS_SetBtnUserData( gMsgBox.uiButton[1], 0, 2); + SetButtonCursor(gMsgBox.uiButton[1], usCursor); + + sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP; + gMsgBox.uiButton[2] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"3", FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); + MSYS_SetBtnUserData( gMsgBox.uiButton[2], 0, 3); + SetButtonCursor(gMsgBox.uiButton[2], usCursor); + + sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP; + gMsgBox.uiButton[3] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"4", FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback ); + MSYS_SetBtnUserData( gMsgBox.uiButton[3], 0, 4); + SetButtonCursor(gMsgBox.uiButton[3], usCursor); + ForceButtonUnDirty( gMsgBox.uiButton[3] ); + ForceButtonUnDirty( gMsgBox.uiButton[2] ); + ForceButtonUnDirty( gMsgBox.uiButton[1] ); + ForceButtonUnDirty( gMsgBox.uiButton[0] ); + + } + else + { + + // Create text button + if ( usFlags & MSG_BOX_FLAG_OK ) + { + + +// sButtonX = ( usTextBoxWidth - MSGBOX_BUTTON_WIDTH ) / 2; + sButtonX = ( usTextBoxWidth - GetMSgBoxButtonWidth( gMsgBox.iButtonImages ) ) / 2; + + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiOKButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiOKButton ); + } + + + + // Create text button + if ( usFlags & MSG_BOX_FLAG_CANCEL ) + { + sButtonX = ( usTextBoxWidth - GetMSgBoxButtonWidth( gMsgBox.iButtonImages ) ) / 2; + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_CANCEL ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiOKButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiOKButton ); + + } + + if ( usFlags & MSG_BOX_FLAG_YESNO ) + { + sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2; + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiYESButton, usCursor); + + ForceButtonUnDirty( gMsgBox.uiYESButton ); + + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiNOButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiNOButton ); + + } + + if ( usFlags & MSG_BOX_FLAG_CONTINUESTOP ) + { + sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2; + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pUpdatePanelButtons[ 0 ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiYESButton, usCursor); + + ForceButtonUnDirty( gMsgBox.uiYESButton ); + + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pUpdatePanelButtons[ 1 ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiNOButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiNOButton ); + + } + + if ( usFlags & MSG_BOX_FLAG_OKCONTRACT ) + { + sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2; + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiYESButton, usCursor); + + ForceButtonUnDirty( gMsgBox.uiYESButton ); + + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiNOButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiNOButton ); + + } + + if ( usFlags & MSG_BOX_FLAG_YESNOCONTRACT ) + { + sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3; + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiYESButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiYESButton ); + + + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiNOButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiNOButton ); + + gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiOKButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiOKButton ); + + } + + + if ( usFlags & MSG_BOX_FLAG_GENERICCONTRACT ) + { + sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3; + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton1, FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiYESButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiYESButton ); + + + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton2, FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiNOButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiNOButton ); + + gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiOKButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiOKButton ); + + } + + if ( usFlags & MSG_BOX_FLAG_GENERIC ) + { + sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2; + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton1, FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiYESButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiYESButton ); + + + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton2, FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiNOButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiNOButton ); + } + + if ( usFlags & MSG_BOX_FLAG_YESNOLIE ) + { + sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3; + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiYESButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiYESButton ); + + + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiNOButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiNOButton ); + + gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_LIE ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)LieMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiOKButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiOKButton ); + + } + + if ( usFlags & MSG_BOX_FLAG_OKSKIP ) + { + sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2; + sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10; + + gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiYESButton, usCursor); + + ForceButtonUnDirty( gMsgBox.uiYESButton ); + + gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_SKIP ], FONT12ARIAL, + ubFontColor, ubFontShadowColor, + ubFontColor, ubFontShadowColor, + TEXT_CJUSTIFIED, + (INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST, + DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback ); + SetButtonCursor(gMsgBox.uiNOButton, usCursor); + ForceButtonUnDirty( gMsgBox.uiNOButton ); + } + + } + + InterruptTime(); + PauseGame(); + LockPauseState( 1 ); + // Pause timers as well.... + PauseTime( TRUE ); + + // Save mouse restriction region... + GetRestrictedClipCursor( &gOldCursorLimitRectangle ); + FreeMouseCursor( ); + + gfNewMessageBox = TRUE; + + gfInMsgBox = TRUE; + + return( iId ); +} + + +void MsgBoxClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) +{ + ///if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) + //{ + // gMsgBox.bHandled = MSG_BOX_RETURN_NO; + //} + // +} + +void OKMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) +{ + static BOOLEAN fLButtonDown = FALSE; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + fLButtonDown = TRUE; + } + else if( ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) && fLButtonDown ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + // OK, exit + gMsgBox.bHandled = MSG_BOX_RETURN_OK; + } + else if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + fLButtonDown = FALSE; + } + + +} + +void YESMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) +{ + static BOOLEAN fLButtonDown = FALSE; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + fLButtonDown = TRUE; + } + else if( ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) && fLButtonDown ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + // OK, exit + gMsgBox.bHandled = MSG_BOX_RETURN_YES; + } + else if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + fLButtonDown = FALSE; + } +} + +void NOMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) +{ + static BOOLEAN fLButtonDown = FALSE; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + fLButtonDown = TRUE; + } + else if( ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) && fLButtonDown ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + // OK, exit + gMsgBox.bHandled = MSG_BOX_RETURN_NO; + } + else if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + fLButtonDown = FALSE; + } +} + + +void ContractMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) +{ + static BOOLEAN fLButtonDown = FALSE; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + fLButtonDown = TRUE; + } + else if( ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) && fLButtonDown ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + // OK, exit + gMsgBox.bHandled = MSG_BOX_RETURN_CONTRACT; + } + else if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + fLButtonDown = FALSE; + } +} + +void LieMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) +{ + static BOOLEAN fLButtonDown = FALSE; + + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + fLButtonDown = TRUE; + } + else if( ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) && fLButtonDown ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + // OK, exit + gMsgBox.bHandled = MSG_BOX_RETURN_LIE; + } + else if ( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + fLButtonDown = FALSE; + } +} + + +void NumberedMsgBoxCallback(GUI_BUTTON *btn, INT32 reason ) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + // OK, exit + gMsgBox.bHandled = (INT8) MSYS_GetBtnUserData( btn, 0); + } + +} + +UINT32 ExitMsgBox( INT8 ubExitCode ) +{ + UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; + UINT8 *pDestBuf, *pSrcBuf; + SGPPoint pPosition; + + // Delete popup! + RemoveMercPopupBoxFromIndex( gMsgBox.iBoxId ); + gMsgBox.iBoxId = -1; + + //Delete buttons! + if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) + { + RemoveButton( gMsgBox.uiButton[0] ); + RemoveButton( gMsgBox.uiButton[1] ); + RemoveButton( gMsgBox.uiButton[2] ); + RemoveButton( gMsgBox.uiButton[3] ); + } + else + { + if ( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) + { + RemoveButton( gMsgBox.uiOKButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) + { + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKCONTRACT ) + { + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOCONTRACT ) + { + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); + RemoveButton( gMsgBox.uiOKButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERICCONTRACT ) + { + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); + RemoveButton( gMsgBox.uiOKButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERIC ) + { + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOLIE ) + { + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); + RemoveButton( gMsgBox.uiOKButton ); + } + + if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) + { + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKSKIP ) + { + RemoveButton( gMsgBox.uiYESButton ); + RemoveButton( gMsgBox.uiNOButton ); + } + + } + + // Delete button images + UnloadButtonImage( gMsgBox.iButtonImages ); + + // Unpause game.... + UnLockPauseState(); + UnPauseGame(); + // UnPause timers as well.... + PauseTime( FALSE ); + + // Restore mouse restriction region... + RestrictMouseCursor( &gOldCursorLimitRectangle ); + + + gfInMsgBox = FALSE; + + // Call done callback! + if ( gMsgBox.ExitCallback != NULL ) + { + (*(gMsgBox.ExitCallback))( ubExitCode ); + } + + + //if ur in a non gamescreen and DONT want the msg box to use the save buffer, unset gfDontOverRideSaveBuffer in ur callback + if( ( ( gMsgBox.uiExitScreen != GAME_SCREEN ) || ( fRestoreBackgroundForMessageBox == TRUE ) ) && gfDontOverRideSaveBuffer ) + { + // restore what we have under here... + pSrcBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiSrcPitchBYTES); + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES); + + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + gMsgBox.sX , gMsgBox.sY, + 0, 0, + gMsgBox.usWidth, gMsgBox.usHeight ); + + UnLockVideoSurface( gMsgBox.uiSaveBuffer ); + UnLockVideoSurface( FRAME_BUFFER ); + + InvalidateRegion( gMsgBox.sX, gMsgBox.sY, (INT16)( gMsgBox.sX + gMsgBox.usWidth ), (INT16)( gMsgBox.sY + gMsgBox.usHeight ) ); + } + + fRestoreBackgroundForMessageBox = FALSE; + gfDontOverRideSaveBuffer = TRUE; + + if( fCursorLockedToArea == TRUE ) + { + GetMousePos( &pPosition ); + + if( ( pPosition.iX > MessageBoxRestrictedCursorRegion.iRight ) || ( pPosition.iX > MessageBoxRestrictedCursorRegion.iLeft ) && ( pPosition.iY < MessageBoxRestrictedCursorRegion.iTop ) && ( pPosition.iY > MessageBoxRestrictedCursorRegion.iBottom ) ) + { + SimulateMouseMovement( pOldMousePosition.iX , pOldMousePosition.iY ); + } + + fCursorLockedToArea = FALSE; + RestrictMouseCursor( &MessageBoxRestrictedCursorRegion ); + } + + // Remove region + MSYS_RemoveRegion(&(gMsgBox.BackRegion) ); + + // Remove save buffer! + DeleteVideoSurfaceFromIndex( gMsgBox.uiSaveBuffer ); + + + switch( gMsgBox.uiExitScreen ) + { + case GAME_SCREEN: + + if ( InOverheadMap( ) ) + { + gfOverheadMapDirty = TRUE; + } + else + { + SetRenderFlags( RENDER_FLAG_FULL ); + } + break; + case MAP_SCREEN: + fMapPanelDirty = TRUE; + break; + } + + if ( gfFadeInitialized ) + { + SetPendingNewScreen(FADE_SCREEN); + return( FADE_SCREEN ); + } + + return( gMsgBox.uiExitScreen ); +} + +UINT32 MessageBoxScreenInit( ) +{ + return( TRUE ); +} + + +UINT32 MessageBoxScreenHandle( ) +{ + InputAtom InputEvent; + + if ( gfNewMessageBox ) + { + // If in game screen.... + if ( ( gfStartedFromGameScreen )||( gfStartedFromMapScreen ) ) + { + //UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; + //UINT8 *pDestBuf, *pSrcBuf; + + if( gfStartedFromGameScreen ) + { + HandleTacticalUILoseCursorFromOtherScreen( ); + } + else + { + HandleMAPUILoseCursorFromOtherScreen( ); + } + + gfStartedFromGameScreen = FALSE; + gfStartedFromMapScreen = FALSE; +/* + // Save what we have under here... + pDestBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiDestPitchBYTES); + pSrcBuf = LockVideoSurface( FRAME_BUFFER, &uiSrcPitchBYTES); + + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0 , 0, + gMsgBox.sX , gMsgBox.sY, + gMsgBox.usWidth, gMsgBox.usHeight ); + + UnLockVideoSurface( gMsgBox.uiSaveBuffer ); + UnLockVideoSurface( FRAME_BUFFER ); +*/ + } + + gfNewMessageBox = FALSE; + + return( MSG_BOX_SCREEN ); + } + + + + UnmarkButtonsDirty( ); + + // Render the box! + if ( gMsgBox.fRenderBox ) + { + if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) + { + MarkAButtonDirty( gMsgBox.uiButton[0] ); + MarkAButtonDirty( gMsgBox.uiButton[1] ); + MarkAButtonDirty( gMsgBox.uiButton[2] ); + MarkAButtonDirty( gMsgBox.uiButton[3] ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) + { + MarkAButtonDirty( gMsgBox.uiOKButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_CANCEL ) + { + MarkAButtonDirty( gMsgBox.uiOKButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) + { + MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiNOButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKCONTRACT ) + { + MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiNOButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOCONTRACT ) + { + MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiNOButton ); + MarkAButtonDirty( gMsgBox.uiOKButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERICCONTRACT ) + { + MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiNOButton ); + MarkAButtonDirty( gMsgBox.uiOKButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_GENERIC ) + { + MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiNOButton ); + } + + if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) + { + // Exit messagebox + MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiNOButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNOLIE ) + { + MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiNOButton ); + MarkAButtonDirty( gMsgBox.uiOKButton ); + } + + if ( gMsgBox.usFlags & MSG_BOX_FLAG_OKSKIP ) + { + MarkAButtonDirty( gMsgBox.uiYESButton ); + MarkAButtonDirty( gMsgBox.uiNOButton ); + } + + + RenderMercPopUpBoxFromIndex( gMsgBox.iBoxId, gMsgBox.sX, gMsgBox.sY, FRAME_BUFFER ); + //gMsgBox.fRenderBox = FALSE; + // ATE: Render each frame... + } + + // Render buttons + RenderButtons( ); + + EndFrameBufferRender( ); + + // carter, need key shortcuts for clearing up message boxes + // Check for esc + while (DequeueEvent(&InputEvent) == TRUE) + { + if( InputEvent.usEvent == KEY_UP ) + { + if( ( InputEvent.usParam == ESC ) || ( InputEvent.usParam == 'n') ) + { + if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) + { + // Exit messagebox + gMsgBox.bHandled = MSG_BOX_RETURN_NO; + } + } + + if( InputEvent.usParam == ENTER ) + { + if ( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) + { + // Exit messagebox + gMsgBox.bHandled = MSG_BOX_RETURN_YES; + } + else if( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) + { + // Exit messagebox + gMsgBox.bHandled = MSG_BOX_RETURN_OK; + } + else if( gMsgBox.usFlags & MSG_BOX_FLAG_CONTINUESTOP ) + { + // Exit messagebox + gMsgBox.bHandled = MSG_BOX_RETURN_OK; + } + } + if( InputEvent.usParam == 'o' ) + { + if( gMsgBox.usFlags & MSG_BOX_FLAG_OK ) + { + // Exit messagebox + gMsgBox.bHandled = MSG_BOX_RETURN_OK; + } + } + if( InputEvent.usParam == 'y' ) + { + if( gMsgBox.usFlags & MSG_BOX_FLAG_YESNO ) + { + // Exit messagebox + gMsgBox.bHandled = MSG_BOX_RETURN_YES; + } + } + if( InputEvent.usParam == '1' ) + { + if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) + { + // Exit messagebox + gMsgBox.bHandled = 1; + } + } + if( InputEvent.usParam == '2' ) + { + if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) + { + // Exit messagebox + gMsgBox.bHandled = 1; + } + } + if( InputEvent.usParam == '3' ) + { + if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) + { + // Exit messagebox + gMsgBox.bHandled = 1; + } + } + if( InputEvent.usParam == '4' ) + { + if ( gMsgBox.usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS ) + { + // Exit messagebox + gMsgBox.bHandled = 1; + } + } + + } + } + + if ( gMsgBox.bHandled ) + { + SetRenderFlags( RENDER_FLAG_FULL ); + return( ExitMsgBox( gMsgBox.bHandled ) ); + } + + return( MSG_BOX_SCREEN ); +} + +UINT32 MessageBoxScreenShutdown( ) +{ + return( FALSE ); +} + + +// a basic box that don't care what screen we came from +template void DoScreenIndependantMessageBox(unsigned short *, UINT16, MSGBOX_CALLBACK); +template void DoScreenIndependantMessageBox(unsigned short const *, UINT16, MSGBOX_CALLBACK); +template +void DoScreenIndependantMessageBox( string1 zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) +{ + SGPRect CenteringRect= {0, 0, SCREEN_WIDTH, INV_INTERFACE_START_Y }; + DoScreenIndependantMessageBoxWithRect( (INT16 *) zString, usFlags, ReturnCallback, &CenteringRect ); +} + +// a basic box that don't care what screen we came from +void DoUpperScreenIndependantMessageBox( INT16 *zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) +{ + SGPRect CenteringRect= {0, 0, SCREEN_WIDTH, INV_INTERFACE_START_Y / 2 }; + DoScreenIndependantMessageBoxWithRect( zString, usFlags, ReturnCallback, &CenteringRect ); +} + +// a basic box that don't care what screen we came from +void DoLowerScreenIndependantMessageBox( UINT16 * zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) +{ + SGPRect CenteringRect= {0, INV_INTERFACE_START_Y / 2, SCREEN_WIDTH, INV_INTERFACE_START_Y }; + DoScreenIndependantMessageBoxWithRect( (INT16 *)zString, usFlags, ReturnCallback, &CenteringRect ); +} + + +void DoScreenIndependantMessageBoxWithRect( INT16 *zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ) +{ + + /// which screen are we in? + + // Map Screen (excluding AI Viewer) +#ifdef JA2BETAVERSION + if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) && ( guiCurrentScreen != AIVIEWER_SCREEN ) ) +#else + if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) +#endif + { + + // auto resolve is a special case + if( guiCurrentScreen == AUTORESOLVE_SCREEN ) + { + DoMessageBox( MSG_BOX_BASIC_STYLE, zString, AUTORESOLVE_SCREEN, usFlags, ReturnCallback, pCenteringRect ); + } + else + { + // set up for mapscreen + DoMapMessageBoxWithRect( MSG_BOX_BASIC_STYLE, zString, MAP_SCREEN, usFlags, ReturnCallback, pCenteringRect ); + } + } + + //Laptop + else if( guiCurrentScreen == LAPTOP_SCREEN ) + { + // set up for laptop + DoLapTopSystemMessageBoxWithRect( MSG_BOX_LAPTOP_DEFAULT, zString, LAPTOP_SCREEN, usFlags, ReturnCallback, pCenteringRect ); + } + + //Save Load Screen + else if( guiCurrentScreen == SAVE_LOAD_SCREEN ) + { + DoSaveLoadMessageBoxWithRect( MSG_BOX_BASIC_STYLE, zString, SAVE_LOAD_SCREEN, usFlags, ReturnCallback, pCenteringRect ); + } + + //Options Screen + else if( guiCurrentScreen == OPTIONS_SCREEN ) + { + DoOptionsMessageBoxWithRect( MSG_BOX_BASIC_STYLE, zString, OPTIONS_SCREEN, usFlags, ReturnCallback, pCenteringRect ); + } + + // Tactical + else if( guiCurrentScreen == GAME_SCREEN ) + { + DoMessageBox( MSG_BOX_BASIC_STYLE, zString, guiCurrentScreen, usFlags, ReturnCallback, pCenteringRect ); + } +} + +UINT16 GetMSgBoxButtonWidth( INT32 iButtonImage ) +{ + return( GetWidthOfButtonPic( (UINT16)iButtonImage, ButtonPictures[iButtonImage].OnNormal ) ); +} diff --git a/MessageBoxScreen.h b/MessageBoxScreen.h new file mode 100644 index 00000000..9b71a937 --- /dev/null +++ b/MessageBoxScreen.h @@ -0,0 +1,108 @@ +#ifndef _MSGBOX_H +#define _MSGBOX_H + +// Message box flags +#define MSG_BOX_FLAG_USE_CENTERING_RECT 0x0001 // Pass in a rect to center in +#define MSG_BOX_FLAG_OK 0x0002 // Displays OK button +#define MSG_BOX_FLAG_YESNO 0x0004 // Displays YES NO buttons +#define MSG_BOX_FLAG_CANCEL 0x0008 // Displays YES NO buttons +#define MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS 0x0010 // Displays four numbered buttons, 1-4 +#define MSG_BOX_FLAG_YESNOCONTRACT 0x0020 // yes no and contract buttons +#define MSG_BOX_FLAG_OKCONTRACT 0x0040 // ok and contract buttons +#define MSG_BOX_FLAG_YESNOLIE 0x0080 // ok and contract buttons +#define MSG_BOX_FLAG_CONTINUESTOP 0x0100 // continue stop box +#define MSG_BOX_FLAG_OKSKIP 0x0200 // Displays ok or skip (meanwhile) buttons +#define MSG_BOX_FLAG_GENERICCONTRACT 0x0400 // displays contract buttoin + 2 user-defined text buttons +#define MSG_BOX_FLAG_GENERIC 0x0800 // 2 user-defined text buttons + +// message box return codes +#define MSG_BOX_RETURN_OK 1 // ENTER or on OK button +#define MSG_BOX_RETURN_YES 2 // ENTER or YES button +#define MSG_BOX_RETURN_NO 3 // ESC, Right Click or NO button +#define MSG_BOX_RETURN_CONTRACT 4 // contract button +#define MSG_BOX_RETURN_LIE 5 // LIE BUTTON + +// message box style flags +enum +{ + MSG_BOX_BASIC_STYLE = 0, // We'll have other styles, like in laptop, etc + // Graphics are all that are required here... + MSG_BOX_RED_ON_WHITE, + MSG_BOX_BLUE_ON_GREY, + MSG_BOX_BASIC_SMALL_BUTTONS, + MSG_BOX_IMP_STYLE, + MSG_BOX_LAPTOP_DEFAULT, +}; + + +typedef void (*MSGBOX_CALLBACK)( UINT8 bExitValue ); + + + +typedef struct +{ + UINT16 usFlags; + UINT32 uiExitScreen; + MSGBOX_CALLBACK ExitCallback; + INT16 sX; + INT16 sY; + UINT32 uiSaveBuffer; + MOUSE_REGION BackRegion; + UINT16 usWidth; + UINT16 usHeight; + INT32 iButtonImages; + union + { + struct + { + UINT32 uiOKButton; + UINT32 uiYESButton; + UINT32 uiNOButton; + UINT32 uiUnusedButton; + }; + struct + { + UINT32 uiButton[4]; + }; + }; + BOOLEAN fRenderBox; + INT8 bHandled; + INT32 iBoxId; + +} MESSAGE_BOX_STRUCT; + + + + +extern MESSAGE_BOX_STRUCT gMsgBox; +extern BOOLEAN fRestoreBackgroundForMessageBox; + +//this variable can be unset if ur in a non gamescreen and DONT want the msg box to use the save buffer +extern BOOLEAN gfDontOverRideSaveBuffer; + +//////////////////////////////// +// ubStyle: Determines the look of graphics including buttons +// zString: 16-bit string +// uiExitScreen The screen to exit to +// ubFlags Some flags for button style +// ReturnCallback Callback for return. Can be NULL. Returns any above return value +// pCenteringRect Rect to send if MSG_BOX_FLAG_USE_CENTERING_RECT set. Can be NULL +//////////////////////////////// + +template +INT32 DoMessageBox( UINT8 ubStyle, string2 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ); +template +void DoScreenIndependantMessageBox( string1 zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); +void DoUpperScreenIndependantMessageBox( INT16 *zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); + +void DoLowerScreenIndependantMessageBox( UINT16 * zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); +void DoScreenIndependantMessageBoxWithRect( INT16 *zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ); + +//wrappers for other screens +BOOLEAN DoLapTopSystemMessageBoxWithRect( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ); +INT32 DoMapMessageBoxWithRect( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ); +BOOLEAN DoOptionsMessageBoxWithRect( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ); +BOOLEAN DoSaveLoadMessageBoxWithRect( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ); + + +#endif \ No newline at end of file diff --git a/Options Screen.cpp b/Options Screen.cpp new file mode 100644 index 00000000..3c2085b3 --- /dev/null +++ b/Options Screen.cpp @@ -0,0 +1,1417 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" +#else + #include "Types.h" + #include "Options Screen.h" + #include "Video.h" + #include "Font Control.h" + #include "Game Clock.h" + #include "Render Dirty.h" + #include "Text Input.h" + #include "WordWrap.h" + #include "SaveLoadScreen.h" + #include "Render Dirty.h" + #include "WordWrap.h" + #include "WCheck.h" + #include "Utilities.h" + #include "Slider.h" + #include "Debug.h" + #include "Music Control.h" + #include "Sound Control.h" + #include "soundman.h" + #include "Ambient Control.h" + #include "Worlddat.h" + #include "Worlddef.h" + #include "GameSettings.h" + #include "Game Init.h" + #include "English.h" + #include "Overhead.h" + #include "Gap.h" + #include "Cursors.h" + #include "SysUtil.h" + #include "Exit Grids.h" + #include "Text.h" + #include "Interface Control.h" + #include "Message.h" + #include "Language Defines.h" + #include "Multi Language Graphic Utils.h" +#endif + +#include "WorldMan.h" + +///////////////////////////////// +// +// Defines +// +///////////////////////////////// + +#define OPT_MAIN_FONT FONT10ARIAL +#define OPT_SLIDER_FONT FONT12ARIAL + +#define OPT_MAIN_COLOR OPT_BUTTON_ON_COLOR +#define OPT_HIGHLIGHT_COLOR FONT_MCOLOR_WHITE + +#define OPTIONS_SCREEN_WIDTH 440 +#define OPTIONS_SCREEN_HEIGHT 400 + +#define OPTIONS__TOP_LEFT_X iScreenWidthOffset + 100 +#define OPTIONS__TOP_LEFT_Y iScreenHeightOffset + 40 +#define OPTIONS__BOTTOM_RIGHT_X OPTIONS__TOP_LEFT_X + OPTIONS_SCREEN_WIDTH +#define OPTIONS__BOTTOM_RIGHT_Y OPTIONS__TOP_LEFT_Y + OPTIONS_SCREEN_HEIGHT + +#define OPT_SAVE_BTN_X iScreenWidthOffset + 51 +#define OPT_SAVE_BTN_Y iScreenHeightOffset + 438 + +#define OPT_LOAD_BTN_X iScreenWidthOffset + 190 +#define OPT_LOAD_BTN_Y OPT_SAVE_BTN_Y + +#define OPT_QUIT_BTN_X (SCREEN_WIDTH - 640)/ 2 + 329 +#define OPT_QUIT_BTN_Y OPT_SAVE_BTN_Y + +#define OPT_DONE_BTN_X iScreenWidthOffset + 469 +#define OPT_DONE_BTN_Y OPT_SAVE_BTN_Y + +#define OPT_GAP_BETWEEN_TOGGLE_BOXES 18 + +//Text +#define OPT_TOGGLE_BOX_FIRST_COL_TEXT_X OPT_TOGGLE_BOX_FIRST_COLUMN_X + OPT_SPACE_BETWEEN_TEXT_AND_TOGGLE_BOX +#define OPT_TOGGLE_BOX_FIRST_COL_TEXT_Y OPT_TOGGLE_BOX_FIRST_COLUMN_START_Y + +#define OPT_TOGGLE_BOX_SECOND_TEXT_X OPT_TOGGLE_BOX_SECOND_COLUMN_X + OPT_SPACE_BETWEEN_TEXT_AND_TOGGLE_BOX +#define OPT_TOGGLE_BOX_SECOND_TEXT_Y OPT_TOGGLE_BOX_SECOND_COLUMN_START_Y + +//toggle boxes +#define OPT_SPACE_BETWEEN_TEXT_AND_TOGGLE_BOX 30 +#define OPT_TOGGLE_TEXT_OFFSET_Y 2 + +#define OPT_TOGGLE_BOX_FIRST_COLUMN_X iScreenWidthOffset + 260 +#define OPT_TOGGLE_BOX_FIRST_COLUMN_START_Y iScreenHeightOffset + 82 + +#define OPT_TOGGLE_BOX_SECOND_COLUMN_X iScreenWidthOffset + 435 +#define OPT_TOGGLE_BOX_SECOND_COLUMN_START_Y OPT_TOGGLE_BOX_FIRST_COLUMN_START_Y + +#define OPT_TOGGLE_BOX_TEXT_WIDTH OPT_TOGGLE_BOX_SECOND_COLUMN_X - OPT_TOGGLE_BOX_FIRST_COLUMN_X - 20 + +// Slider bar defines +#define OPT_GAP_BETWEEN_SLIDER_BARS 60 +#define OPT_SLIDER_BAR_SIZE 258 + +#define OPT_SLIDER_TEXT_WIDTH 45 + +#define OPT_SOUND_FX_TEXT_X iScreenWidthOffset + 38 +#define OPT_SOUND_FX_TEXT_Y iScreenHeightOffset + 87 + +#define OPT_SPEECH_TEXT_X iScreenWidthOffset + 85 +#define OPT_SPEECH_TEXT_Y OPT_SOUND_FX_TEXT_Y + +#define OPT_MUSIC_TEXT_X iScreenWidthOffset + 137 +#define OPT_MUSIC_TEXT_Y OPT_SOUND_FX_TEXT_Y + +#define OPT_TEXT_TO_SLIDER_OFFSET_Y 25 + +#define OPT_SOUND_EFFECTS_SLIDER_X iScreenWidthOffset + 56 +#define OPT_SOUND_EFFECTS_SLIDER_Y iScreenHeightOffset + 126 + +#define OPT_SPEECH_SLIDER_X iScreenWidthOffset + 107 +#define OPT_SPEECH_SLIDER_Y OPT_SOUND_EFFECTS_SLIDER_Y + +#define OPT_MUSIC_SLIDER_X iScreenWidthOffset + 158 +#define OPT_MUSIC_SLIDER_Y OPT_SOUND_EFFECTS_SLIDER_Y + +#define OPT_MUSIC_SLIDER_PLAY_SOUND_DELAY 75 + +#define OPT_FIRST_COLUMN_TOGGLE_CUT_OFF 18 + + +///////////////////////////////// +// +// Global Variables +// +///////////////////////////////// + + +UINT32 guiOptionBackGroundImage; +UINT32 guiOptionsAddOnImages; + +UINT32 guiSoundEffectsSliderID; +UINT32 guiSpeechSliderID; +UINT32 guiMusicSliderID; + +BOOLEAN gfOptionsScreenEntry = TRUE; +BOOLEAN gfOptionsScreenExit = FALSE; +BOOLEAN gfRedrawOptionsScreen = TRUE; + +CHAR8 gzSavedGameName[ 128 ]; +BOOLEAN gfEnteredFromMapScreen=FALSE; + +UINT32 guiOptionsScreen = OPTIONS_SCREEN; +UINT32 guiPreviousOptionScreen = OPTIONS_SCREEN; + +BOOLEAN gfExitOptionsDueToMessageBox=FALSE; +BOOLEAN gfExitOptionsAfterMessageBox = FALSE; + + +UINT32 guiSoundFxSliderMoving = 0xffffffff; +UINT32 guiSpeechSliderMoving = 0xffffffff; + +INT32 giOptionsMessageBox = -1; // Options pop up messages index value + +INT8 gbHighLightedOptionText = -1; + +BOOLEAN gfHideBloodAndGoreOption=FALSE; //If a germany build we are to hide the blood and gore option +UINT8 gubFirstColOfOptions=OPT_FIRST_COLUMN_TOGGLE_CUT_OFF; + + +BOOLEAN gfSettingOfTreeTopStatusOnEnterOfOptionScreen; +BOOLEAN gfSettingOfItemGlowStatusOnEnterOfOptionScreen; +BOOLEAN gfSettingOfDontAnimateSmoke; + +// Goto save game Button +void BtnOptGotoSaveGameCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiOptGotoSaveGameBtn; +INT32 giOptionsButtonImages; + +// Goto load game button +void BtnOptGotoLoadGameCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiOptGotoLoadGameBtn; +INT32 giGotoLoadBtnImage; + +// QuitButton +void BtnOptQuitCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiQuitButton; +INT32 giQuitBtnImage; + +// Done Button +void BtnDoneCallback(GUI_BUTTON *btn,INT32 reason); +extern UINT32 guiDoneButton; // symbol already declared globally in AimArchives.cpp (jonathanl) +INT32 giDoneBtnImage; + + +//checkbox to toggle tracking mode on or off +UINT32 guiOptionsToggles[ NUM_GAME_OPTIONS ]; +void BtnOptionsTogglesCallback(GUI_BUTTON *btn,INT32 reason); + + +//Mouse regions for the name of the option +MOUSE_REGION gSelectedOptionTextRegion[ NUM_GAME_OPTIONS ]; +void SelectedOptionTextRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectedOptionTextRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ); + + +//Mouse regions for the area around the toggle boxs +MOUSE_REGION gSelectedToggleBoxAreaRegion; +void SelectedToggleBoxAreaRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ); + + +///////////////////////////////// +// +// Function ProtoTypes +// +///////////////////////////////// + + +BOOLEAN EnterOptionsScreen(); +void RenderOptionsScreen(); +void ExitOptionsScreen(); +void HandleOptionsScreen(); +void GetOptionsScreenUserInput(); +void SetOptionsExitScreen( UINT32 uiExitScreen ); + + +void SoundFXSliderChangeCallBack( INT32 iNewValue ); +void SpeechSliderChangeCallBack( INT32 iNewValue ); +void MusicSliderChangeCallBack( INT32 iNewValue ); +//BOOLEAN DoOptionsMessageBox( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT8 ubFlags, MSGBOX_CALLBACK ReturnCallback ); +void ConfirmQuitToMainMenuMessageBoxCallBack( UINT8 bExitValue ); +void HandleSliderBarMovementSounds(); +void HandleOptionToggle( UINT8 ubButton, BOOLEAN fState, BOOLEAN fDown, BOOLEAN fPlaySound ); +void HandleHighLightedText( BOOLEAN fHighLight ); + + + +extern BOOLEAN CheckIfGameCdromIsInCDromDrive(); +extern void ToggleItemGlow( BOOLEAN fOn ); + + +//ppp + +///////////////////////////////// +// +// Code +// +///////////////////////////////// + +UINT32 OptionsScreenInit() +{ + + //Set so next time we come in, we can set up + gfOptionsScreenEntry = TRUE; + + + return( TRUE ); +} + +UINT32 OptionsScreenHandle() +{ + StartFrameBufferRender(); + + if( gfOptionsScreenEntry ) + { + PauseGame(); + EnterOptionsScreen(); + gfOptionsScreenEntry = FALSE; + gfOptionsScreenExit = FALSE; + gfRedrawOptionsScreen = TRUE; + RenderOptionsScreen(); + + //Blit the background to the save buffer + BlitBufferToBuffer( guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + } + + RestoreBackgroundRects(); + + GetOptionsScreenUserInput(); + + HandleOptionsScreen(); + + if( gfRedrawOptionsScreen ) + { + RenderOptionsScreen(); + RenderButtons(); + + gfRedrawOptionsScreen = FALSE; + } + + //Render the active slider bars + RenderAllSliderBars(); + + // render buttons marked dirty + MarkButtonsDirty( ); + RenderButtons( ); + + // ATE: Put here to save RECTS before any fast help being drawn... + SaveBackgroundRects( ); + RenderButtonsFastHelp(); + + + ExecuteBaseDirtyRectQueue(); + EndFrameBufferRender(); + + + if( gfOptionsScreenExit ) + { + ExitOptionsScreen(); + gfOptionsScreenExit = FALSE; + gfOptionsScreenEntry = TRUE; + + UnPauseGame(); + } + + return( guiOptionsScreen ); +} + + + +UINT32 OptionsScreenShutdown() +{ + return( TRUE ); +} + + + + + + + +BOOLEAN EnterOptionsScreen() +{ + VOBJECT_DESC VObjectDesc; + UINT16 usPosY; + UINT8 cnt; + UINT16 usTextWidth, usTextHeight; + + // WANNE + //ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); + + //Default this to off + gfHideBloodAndGoreOption=FALSE; + +#ifndef BLOOD_N_GORE_ENABLED + //This will hide blood and gore option + gfHideBloodAndGoreOption = TRUE; + +/* +Uncomment this to enable the check for files to activate the blood and gore option for the german build + if( !FileExists( "Germany.dat" ) && FileExists( "Lecken.dat" ) ) + { + gfHideBloodAndGoreOption = FALSE; + } + else +*/ + { + gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] = FALSE; + } +#endif + + + //if we are coming from mapscreen + if( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) + { + guiTacticalInterfaceFlags &= ~INTERFACE_MAPSCREEN; + gfEnteredFromMapScreen = TRUE; + } + + + // Stop ambients... + StopAmbients( ); + + guiOptionsScreen = OPTIONS_SCREEN; + + //Init the slider bar; + InitSlider(); + + if( gfExitOptionsDueToMessageBox ) + { + gfRedrawOptionsScreen = TRUE; + gfExitOptionsDueToMessageBox = FALSE; + return( TRUE ); + } + + gfExitOptionsDueToMessageBox = FALSE; + + // load the options screen background graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\OptionScreenBase.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiOptionBackGroundImage)); + + // load button, title graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_OPTIONHEADER ); + CHECKF(AddVideoObject(&VObjectDesc, &guiOptionsAddOnImages)); + + //Save game button + giOptionsButtonImages = LoadButtonImage("INTERFACE\\OptionScreenAddons.sti", -1,2,-1,3,-1 ); + guiOptGotoSaveGameBtn = CreateIconAndTextButton( giOptionsButtonImages, zOptionsText[OPT_SAVE_GAME], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + OPT_SAVE_BTN_X, OPT_SAVE_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnOptGotoSaveGameCallback); + SpecifyDisabledButtonStyle( guiOptGotoSaveGameBtn, DISABLED_STYLE_HATCHED ); + if( guiPreviousOptionScreen == MAINMENU_SCREEN || !CanGameBeSaved() ) + { + DisableButton( guiOptGotoSaveGameBtn ); + } + + //Load game button + giGotoLoadBtnImage = UseLoadedButtonImage( giOptionsButtonImages, -1,2,-1,3,-1 ); + guiOptGotoLoadGameBtn = CreateIconAndTextButton( giGotoLoadBtnImage, zOptionsText[OPT_LOAD_GAME], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + OPT_LOAD_BTN_X, OPT_LOAD_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnOptGotoLoadGameCallback); +// SpecifyDisabledButtonStyle( guiBobbyRAcceptOrder, DISABLED_STYLE_SHADED ); + + + //Quit to main menu button + giQuitBtnImage = UseLoadedButtonImage( giOptionsButtonImages, -1,2,-1,3,-1 ); + guiQuitButton = CreateIconAndTextButton( giQuitBtnImage, zOptionsText[OPT_MAIN_MENU], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + OPT_QUIT_BTN_X, OPT_QUIT_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnOptQuitCallback); + SpecifyDisabledButtonStyle( guiQuitButton, DISABLED_STYLE_HATCHED ); +// DisableButton( guiQuitButton ); + + //Done button + giDoneBtnImage = UseLoadedButtonImage( giOptionsButtonImages, -1,2,-1,3,-1 ); + guiDoneButton = CreateIconAndTextButton( giDoneBtnImage, zOptionsText[OPT_DONE], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + OPT_DONE_BTN_X, OPT_DONE_BTN_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnDoneCallback); +// SpecifyDisabledButtonStyle( guiBobbyRAcceptOrder, DISABLED_STYLE_SHADED ); + + + + // + // Toggle Boxes + // + usTextHeight = GetFontHeight( OPT_MAIN_FONT ); + + //Create the first column of check boxes + usPosY = OPT_TOGGLE_BOX_FIRST_COLUMN_START_Y; + gubFirstColOfOptions = OPT_FIRST_COLUMN_TOGGLE_CUT_OFF; + for( cnt=0; cnt OPT_TOGGLE_BOX_TEXT_WIDTH ) + { + //Get how many lines will be used to display the string, without displaying the string + UINT8 ubNumLines = DisplayWrappedString( 0, 0, OPT_TOGGLE_BOX_TEXT_WIDTH, 2, OPT_MAIN_FONT, OPT_HIGHLIGHT_COLOR, zOptionsToggleText[ cnt ], FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED | DONT_DISPLAY_TEXT ) / GetFontHeight( OPT_MAIN_FONT ); + + usTextWidth = OPT_TOGGLE_BOX_TEXT_WIDTH; + + //Create mouse regions for the option toggle text + MSYS_DefineRegion( &gSelectedOptionTextRegion[cnt], OPT_TOGGLE_BOX_FIRST_COLUMN_X+13, usPosY, (UINT16)(OPT_TOGGLE_BOX_FIRST_COL_TEXT_X+usTextWidth), (UINT16)(usPosY+usTextHeight*ubNumLines), MSYS_PRIORITY_HIGH, + CURSOR_NORMAL, SelectedOptionTextRegionMovementCallBack, SelectedOptionTextRegionCallBack ); + MSYS_AddRegion( &gSelectedOptionTextRegion[cnt]); + MSYS_SetRegionUserData( &gSelectedOptionTextRegion[ cnt ], 0, cnt); + } + else + { + //Create mouse regions for the option toggle text + MSYS_DefineRegion( &gSelectedOptionTextRegion[cnt], OPT_TOGGLE_BOX_FIRST_COLUMN_X+13, usPosY, (UINT16)(OPT_TOGGLE_BOX_FIRST_COL_TEXT_X+usTextWidth), (UINT16)(usPosY+usTextHeight), MSYS_PRIORITY_HIGH, + CURSOR_NORMAL, SelectedOptionTextRegionMovementCallBack, SelectedOptionTextRegionCallBack ); + MSYS_AddRegion( &gSelectedOptionTextRegion[cnt]); + MSYS_SetRegionUserData( &gSelectedOptionTextRegion[ cnt ], 0, cnt); + } + + + SetRegionFastHelpText( &gSelectedOptionTextRegion[ cnt ], zOptionsScreenHelpText[cnt] ); + SetButtonFastHelpText( guiOptionsToggles[ cnt ], zOptionsScreenHelpText[cnt] ); + + usPosY += OPT_GAP_BETWEEN_TOGGLE_BOXES; + } + + + //Create the 2nd column of check boxes + usPosY = OPT_TOGGLE_BOX_FIRST_COLUMN_START_Y; + for( cnt=gubFirstColOfOptions; cnt OPT_TOGGLE_BOX_TEXT_WIDTH ) + { + //Get how many lines will be used to display the string, without displaying the string + UINT8 ubNumLines = DisplayWrappedString( 0, 0, OPT_TOGGLE_BOX_TEXT_WIDTH, 2, OPT_MAIN_FONT, OPT_HIGHLIGHT_COLOR, zOptionsToggleText[ cnt ], FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED | DONT_DISPLAY_TEXT ) / GetFontHeight( OPT_MAIN_FONT ); + + usTextWidth = OPT_TOGGLE_BOX_TEXT_WIDTH; + + MSYS_DefineRegion( &gSelectedOptionTextRegion[cnt], OPT_TOGGLE_BOX_SECOND_COLUMN_X+13, usPosY, (UINT16)(OPT_TOGGLE_BOX_SECOND_TEXT_X+usTextWidth), (UINT16)(usPosY+usTextHeight*ubNumLines), MSYS_PRIORITY_HIGH, + CURSOR_NORMAL, SelectedOptionTextRegionMovementCallBack, SelectedOptionTextRegionCallBack ); + MSYS_AddRegion( &gSelectedOptionTextRegion[cnt]); + MSYS_SetRegionUserData( &gSelectedOptionTextRegion[ cnt ], 0, cnt ); + } + else + { + MSYS_DefineRegion( &gSelectedOptionTextRegion[cnt], OPT_TOGGLE_BOX_SECOND_COLUMN_X+13, usPosY, (UINT16)(OPT_TOGGLE_BOX_SECOND_TEXT_X+usTextWidth), (UINT16)(usPosY+usTextHeight), MSYS_PRIORITY_HIGH, + CURSOR_NORMAL, SelectedOptionTextRegionMovementCallBack, SelectedOptionTextRegionCallBack ); + MSYS_AddRegion( &gSelectedOptionTextRegion[cnt]); + MSYS_SetRegionUserData( &gSelectedOptionTextRegion[ cnt ], 0, cnt ); + } + + + SetRegionFastHelpText( &gSelectedOptionTextRegion[ cnt ], zOptionsScreenHelpText[cnt] ); + SetButtonFastHelpText( guiOptionsToggles[ cnt ], zOptionsScreenHelpText[cnt] ); + + usPosY += OPT_GAP_BETWEEN_TOGGLE_BOXES; + } + + //Create a mouse region so when the user leaves a togglebox text region we can detect it then unselect the region + MSYS_DefineRegion( &gSelectedToggleBoxAreaRegion, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_NORMAL, + CURSOR_NORMAL, SelectedToggleBoxAreaRegionMovementCallBack, MSYS_NO_CALLBACK ); + MSYS_AddRegion( &gSelectedToggleBoxAreaRegion ); + + + //Render the scene before adding the slider boxes + RenderOptionsScreen(); + + //Add a slider bar for the Sound Effects + guiSoundEffectsSliderID = AddSlider( SLIDER_VERTICAL_STEEL, CURSOR_NORMAL, OPT_SOUND_EFFECTS_SLIDER_X, OPT_SOUND_EFFECTS_SLIDER_Y, OPT_SLIDER_BAR_SIZE, 127, MSYS_PRIORITY_HIGH, SoundFXSliderChangeCallBack, 0 ); + AssertMsg( guiSoundEffectsSliderID, "Failed to AddSlider" ); + SetSliderValue( guiSoundEffectsSliderID, GetSoundEffectsVolume() ); + + //Add a slider bar for the Speech + guiSpeechSliderID = AddSlider( SLIDER_VERTICAL_STEEL, CURSOR_NORMAL, OPT_SPEECH_SLIDER_X, OPT_SPEECH_SLIDER_Y, OPT_SLIDER_BAR_SIZE, 127, MSYS_PRIORITY_HIGH, SpeechSliderChangeCallBack, 0 ); + AssertMsg( guiSpeechSliderID, "Failed to AddSlider" ); + SetSliderValue( guiSpeechSliderID, GetSpeechVolume() ); + + //Add a slider bar for the Music + guiMusicSliderID = AddSlider( SLIDER_VERTICAL_STEEL, CURSOR_NORMAL, OPT_MUSIC_SLIDER_X, OPT_MUSIC_SLIDER_Y, OPT_SLIDER_BAR_SIZE, 127, MSYS_PRIORITY_HIGH, MusicSliderChangeCallBack, 0 ); + AssertMsg( guiMusicSliderID, "Failed to AddSlider" ); + SetSliderValue( guiMusicSliderID, MusicGetVolume() ); + + + + //Remove the mouse region over the clock + RemoveMouseRegionForPauseOfClock( ); + + //Draw the screen + gfRedrawOptionsScreen = TRUE; + + //Set the option screen toggle boxes + SetOptionsScreenToggleBoxes(); + + DisableScrollMessages(); + + //reset + gbHighLightedOptionText = -1; + + //get the status of the tree top option + gfSettingOfTreeTopStatusOnEnterOfOptionScreen = gGameSettings.fOptions[ TOPTION_TOGGLE_TREE_TOPS ]; + + //Get the status of the item glow option + gfSettingOfItemGlowStatusOnEnterOfOptionScreen = gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ]; + + gfSettingOfDontAnimateSmoke = gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ]; + return( TRUE ); +} + + +void ExitOptionsScreen() +{ + UINT8 cnt; + + if( gfExitOptionsDueToMessageBox ) + { + gfOptionsScreenExit = FALSE; + + if( !gfExitOptionsAfterMessageBox ) + return; + gfExitOptionsAfterMessageBox = FALSE; + gfExitOptionsDueToMessageBox = FALSE; + } + + //Get the current status of the toggle boxes + GetOptionsScreenToggleBoxes(); + //The save the current settings to disk + SaveGameSettings(); + + //Create the clock mouse region + CreateMouseRegionForPauseOfClock( CLOCK_REGION_START_X, CLOCK_REGION_START_Y ); + + if( guiOptionsScreen == GAME_SCREEN ) + EnterTacticalScreen( ); + + RemoveButton( guiOptGotoSaveGameBtn ); + RemoveButton( guiOptGotoLoadGameBtn ); + RemoveButton( guiQuitButton ); + RemoveButton( guiDoneButton ); + + UnloadButtonImage( giOptionsButtonImages ); + UnloadButtonImage( giGotoLoadBtnImage ); + UnloadButtonImage( giQuitBtnImage ); + UnloadButtonImage( giDoneBtnImage ); + + DeleteVideoObjectFromIndex( guiOptionBackGroundImage ); + DeleteVideoObjectFromIndex( guiOptionsAddOnImages ); + + + //Remove the toggle buttons + for( cnt=0; cnt OPT_TOGGLE_BOX_TEXT_WIDTH ) + DisplayWrappedString( OPT_TOGGLE_BOX_FIRST_COL_TEXT_X, usPosY, OPT_TOGGLE_BOX_TEXT_WIDTH, 2, OPT_MAIN_FONT, OPT_MAIN_COLOR, zOptionsToggleText[ cnt ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + else + DrawTextToScreen( zOptionsToggleText[ cnt ], OPT_TOGGLE_BOX_FIRST_COL_TEXT_X, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + usPosY += OPT_GAP_BETWEEN_TOGGLE_BOXES; + } + + + usPosY = OPT_TOGGLE_BOX_SECOND_COLUMN_START_Y + OPT_TOGGLE_TEXT_OFFSET_Y; + //Display the 2nd column of toggles + for( cnt=gubFirstColOfOptions; cnt OPT_TOGGLE_BOX_TEXT_WIDTH ) + DisplayWrappedString( OPT_TOGGLE_BOX_SECOND_TEXT_X, usPosY, OPT_TOGGLE_BOX_TEXT_WIDTH, 2, OPT_MAIN_FONT, OPT_MAIN_COLOR, zOptionsToggleText[ cnt ], FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + else + DrawTextToScreen( zOptionsToggleText[ cnt ], OPT_TOGGLE_BOX_SECOND_TEXT_X, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + usPosY += OPT_GAP_BETWEEN_TOGGLE_BOXES; + } + + + + + // + // Text for the Slider Bars + // + + //Display the Sound Fx text + DisplayWrappedString( OPT_SOUND_FX_TEXT_X, OPT_SOUND_FX_TEXT_Y, OPT_SLIDER_TEXT_WIDTH, 2, OPT_SLIDER_FONT, OPT_MAIN_COLOR, zOptionsText[ OPT_SOUND_FX ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the Speech text + DisplayWrappedString( OPT_SPEECH_TEXT_X, OPT_SPEECH_TEXT_Y, OPT_SLIDER_TEXT_WIDTH, 2, OPT_SLIDER_FONT, OPT_MAIN_COLOR, zOptionsText[ OPT_SPEECH ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + //Display the Music text + DisplayWrappedString( OPT_MUSIC_TEXT_X, OPT_MUSIC_TEXT_Y, OPT_SLIDER_TEXT_WIDTH, 2, OPT_SLIDER_FONT, OPT_MAIN_COLOR, zOptionsText[ OPT_MUSIC ], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); + + // WANNE + InvalidateRegion( OPTIONS__TOP_LEFT_X, OPTIONS__TOP_LEFT_Y, OPTIONS__BOTTOM_RIGHT_X, OPTIONS__BOTTOM_RIGHT_Y); +} + + + + + + + + + +void GetOptionsScreenUserInput() +{ + InputAtom Event; + POINT MousePos; + + GetCursorPos(&MousePos); + + while( DequeueEvent( &Event ) ) + { + // HOOK INTO MOUSE HOOKS + switch( Event.usEvent) + { + case LEFT_BUTTON_DOWN: + MouseSystemHook(LEFT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_UP: + MouseSystemHook(LEFT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y ,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_DOWN: + MouseSystemHook(RIGHT_BUTTON_DOWN, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_UP: + MouseSystemHook(RIGHT_BUTTON_UP, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case RIGHT_BUTTON_REPEAT: + MouseSystemHook(RIGHT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + case LEFT_BUTTON_REPEAT: + MouseSystemHook(LEFT_BUTTON_REPEAT, (INT16)MousePos.x, (INT16)MousePos.y,_LeftButtonDown, _RightButtonDown); + break; + } + + if( !HandleTextInput( &Event ) && Event.usEvent == KEY_DOWN ) + { + switch( Event.usParam ) + { + case ESC: + SetOptionsExitScreen( guiPreviousOptionScreen ); + break; + + //Enter the save game screen + case 's': + case 'S': + //if the save game button isnt disabled + if( ButtonList[ guiOptGotoSaveGameBtn ]->uiFlags & BUTTON_ENABLED ) + { + SetOptionsExitScreen( SAVE_LOAD_SCREEN ); + gfSaveGame = TRUE; + } + break; + + //Enter the Load game screen + case 'l': + case 'L': + SetOptionsExitScreen( SAVE_LOAD_SCREEN ); + gfSaveGame = FALSE; + break; + + +#ifdef JA2TESTVERSION + + case 'r': + gfRedrawOptionsScreen = TRUE; + break; + + case 'i': + InvalidateRegion( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + break; + + //Test keys + + case 'y': + { + static UINT32 uiTest2 = NO_SAMPLE; + if( !SoundIsPlaying( uiTest2 ) ) + uiTest2 = PlayJA2SampleFromFile( "Sounds\\RAID Dive.wav", RATE_11025, HIGHVOLUME, 1 , MIDDLEPAN ); + } + break; + case 't': + { +/* + { + CHAR8 zCdromRootDrive[512]; + HWFILE hFile; + + if( !GetCdromLocationFromIniFile( zCdromRootDrive ) ) + return; + + //Check if a file exists on the cdrom + sprintf( zCdromRootDrive, "%sData\\NPC_Speech.slf", zCdromRootDrive ); + + // if( FileExistsNoDB( zCdromRootDrive ) ) + hFile = FileOpen( zCdromRootDrive, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + if( hFile != 0 ) + { + FileClose( hFile ); + sprintf( zCdromRootDrive, "%sData\\NPC_Speech.slf", zCdromRootDrive ); + } + else + { + sprintf( zCdromRootDrive, "%sData\\NPC_Speech.slf", zCdromRootDrive ); + } + + uiLastTimeToCheckCDromDrive = GetJA2Clock(); + } +*/ + } + break; + + + case 'z': + SetErrorMode( SEM_FAILCRITICALERRORS ); + break; + + case 'q': +// ShouldMercSayPrecedentToRepeatOneSelf( 11, 99 ); + break; +#endif + } + } + } +} + +void SetOptionsExitScreen( UINT32 uiExitScreen ) +{ + guiOptionsScreen = uiExitScreen; + gfOptionsScreenExit = TRUE; +} + + +void BtnOptGotoSaveGameCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + SetOptionsExitScreen( SAVE_LOAD_SCREEN ); + gfSaveGame = TRUE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnOptGotoLoadGameCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + SetOptionsExitScreen( SAVE_LOAD_SCREEN ); + gfSaveGame = FALSE; + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnOptQuitCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //Confirm the Exit to the main menu screen + DoOptionsMessageBox( MSG_BOX_BASIC_STYLE, (INT16 *)zOptionsText[OPT_RETURN_TO_MAIN], OPTIONS_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmQuitToMainMenuMessageBoxCallBack ); + +/// SetOptionsExitScreen( MAINMENU_SCREEN ); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +void BtnDoneCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + SetOptionsExitScreen( guiPreviousOptionScreen ); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + +void BtnOptionsTogglesCallback( GUI_BUTTON *btn, INT32 reason ) +{ + UINT8 ubButton = (UINT8)MSYS_GetBtnUserData( btn, 0 ); + + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + HandleOptionToggle( ubButton, TRUE, FALSE, FALSE ); + +// gGameSettings.fOptions[ ubButton ] = TRUE; + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + btn->uiFlags &= ~BUTTON_CLICKED_ON; + + HandleOptionToggle( ubButton, FALSE, FALSE, FALSE); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if( btn->uiFlags & BUTTON_CLICKED_ON ) + { + HandleOptionToggle( ubButton, TRUE, TRUE, FALSE ); + + btn->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + btn->uiFlags &= ~BUTTON_CLICKED_ON; + + HandleOptionToggle( ubButton, FALSE, TRUE, FALSE ); + } + } + +} + + +void HandleOptionToggle( UINT8 ubButton, BOOLEAN fState, BOOLEAN fDown, BOOLEAN fPlaySound ) +{ + static UINT32 uiOptionToggleSound = NO_SAMPLE; + UINT32 uiSideToPlaySoundOn = MIDDLEPAN; +// static BOOLEAN fCheckBoxDrawnDownLastTime = FALSE; + + if( fState ) + { + gGameSettings.fOptions[ ubButton ] = TRUE; + + ButtonList[ guiOptionsToggles[ ubButton ] ]->uiFlags |= BUTTON_CLICKED_ON; + + if( fDown ) + DrawCheckBoxButtonOn( guiOptionsToggles[ ubButton ] ); + } + else + { + gGameSettings.fOptions[ ubButton ] = FALSE; + + ButtonList[ guiOptionsToggles[ ubButton ] ]->uiFlags &= ~BUTTON_CLICKED_ON; + + if( fDown ) + DrawCheckBoxButtonOff( guiOptionsToggles[ ubButton ] ); + + //check to see if the user is unselecting either the spech or subtitles toggle + if( ubButton == TOPTION_SPEECH || ubButton == TOPTION_SUBTITLES ) + { + //make sure that at least of of the toggles is still enabled + if( !(ButtonList[ guiOptionsToggles[ TOPTION_SPEECH ] ]->uiFlags & BUTTON_CLICKED_ON) ) + { + if( !( ButtonList[ guiOptionsToggles[ TOPTION_SUBTITLES ] ]->uiFlags & BUTTON_CLICKED_ON ) ) + { + gGameSettings.fOptions[ ubButton ] = TRUE; + ButtonList[ guiOptionsToggles[ ubButton ] ]->uiFlags |= BUTTON_CLICKED_ON; + + //Confirm the Exit to the main menu screen + DoOptionsMessageBox( MSG_BOX_BASIC_STYLE, (INT16 *)zOptionsText[OPT_NEED_AT_LEAST_SPEECH_OR_SUBTITLE_OPTION_ON], OPTIONS_SCREEN, MSG_BOX_FLAG_OK, NULL ); + gfExitOptionsDueToMessageBox = FALSE; + } + } + } + } + + + + //stop the sound if +// if( SoundIsPlaying( uiOptionToggleSound ) && !fDown ) + { + SoundStop( uiOptionToggleSound ); + } + + + if( fPlaySound ) + { + if( fDown ) + { + // case BTN_SND_CLICK_OFF: + PlayJA2Sample( BIG_SWITCH3_IN, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); + } + else + { + // case BTN_SND_CLICK_ON: + PlayJA2Sample( BIG_SWITCH3_OUT, RATE_11025, BTNVOLUME, 1, MIDDLEPAN ); + } + } +} + +void SoundFXSliderChangeCallBack( INT32 iNewValue ) +{ + SetSoundEffectsVolume( iNewValue ); + + guiSoundFxSliderMoving = GetJA2Clock(); +} + + +void SpeechSliderChangeCallBack( INT32 iNewValue ) +{ + SetSpeechVolume( iNewValue ); + + guiSpeechSliderMoving = GetJA2Clock(); +} + + +void MusicSliderChangeCallBack( INT32 iNewValue ) +{ + MusicSetVolume( iNewValue ); +} + +BOOLEAN DoOptionsMessageBoxWithRect( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ) +{ + // reset exit mode + gfExitOptionsDueToMessageBox = TRUE; + + // do message box and return + giOptionsMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); + + // send back return state + return( ( giOptionsMessageBox != -1 ) ); +} + +BOOLEAN DoOptionsMessageBox( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) +{ + SGPRect CenteringRect= {0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1 }; + + // reset exit mode + gfExitOptionsDueToMessageBox = TRUE; + + // do message box and return + giOptionsMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT16 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); + + // send back return state + return( ( giOptionsMessageBox != -1 ) ); +} + + + +void ConfirmQuitToMainMenuMessageBoxCallBack( UINT8 bExitValue ) +{ + // yes, Quit to main menu + if( bExitValue == MSG_BOX_RETURN_YES ) + { + gfEnteredFromMapScreen = FALSE; + gfExitOptionsAfterMessageBox = TRUE; + SetOptionsExitScreen( MAINMENU_SCREEN ); + + //We want to reinitialize the game + ReStartingGame(); + } + else + { + gfExitOptionsAfterMessageBox = FALSE; + gfExitOptionsDueToMessageBox = FALSE; + } +} + + +void SetOptionsScreenToggleBoxes() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags |= BUTTON_CLICKED_ON; + else + ButtonList[ guiOptionsToggles[ cnt ] ]->uiFlags &= (~BUTTON_CLICKED_ON ); + } +} + + + + +void GetOptionsScreenToggleBoxes() +{ + UINT8 cnt; + + for( cnt=0; cntuiFlags & BUTTON_CLICKED_ON ) + gGameSettings.fOptions[ cnt ] = TRUE; + else + gGameSettings.fOptions[ cnt ] = FALSE; + } +} + +void HandleSliderBarMovementSounds() +{ + static UINT32 uiLastSoundFxTime=0; + static UINT32 uiLastSpeechTime=0; + UINT32 uiCurTime = GetJA2Clock(); + static UINT32 uiLastPlayingSoundID = NO_SAMPLE; + static UINT32 uiLastPlayingSpeechID = NO_SAMPLE; + + if( ( uiLastSoundFxTime - OPT_MUSIC_SLIDER_PLAY_SOUND_DELAY ) > guiSoundFxSliderMoving ) + { + guiSoundFxSliderMoving = 0xffffffff; + + //The slider has stopped moving, reset the ambient sector sounds ( so it will change the volume ) + if( !DidGameJustStart() ) + HandleNewSectorAmbience( gTilesets[ giCurrentTilesetID ].ubAmbientID ); + + if( !SoundIsPlaying( uiLastPlayingSoundID ) ) + uiLastPlayingSoundID = PlayJA2SampleFromFile( "Sounds\\Weapons\\LMG Reload.wav", RATE_11025, HIGHVOLUME, 1 , MIDDLEPAN ); + } + else + uiLastSoundFxTime = GetJA2Clock(); + + + if( ( uiLastSpeechTime - OPT_MUSIC_SLIDER_PLAY_SOUND_DELAY ) > guiSpeechSliderMoving ) + { + guiSpeechSliderMoving = 0xffffffff; + + if( !SoundIsPlaying( uiLastPlayingSpeechID ) ) + uiLastPlayingSpeechID = PlayJA2GapSample( "BattleSnds\\m_cool.wav", RATE_11025, HIGHVOLUME, 1, MIDDLEPAN, NULL ); + } + else + uiLastSpeechTime = GetJA2Clock(); + +} + + + + +void SelectedOptionTextRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + UINT8 ubButton = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); + + if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + HandleOptionToggle( ubButton, (BOOLEAN)(!gGameSettings.fOptions[ ubButton ]), FALSE, TRUE ); + + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } + + + else if( iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN )//iReason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT || + { + if( gGameSettings.fOptions[ ubButton ] ) + { + HandleOptionToggle( ubButton, TRUE, TRUE, TRUE ); + } + else + { + HandleOptionToggle( ubButton, FALSE, TRUE, TRUE ); + } + } +} + + +void SelectedOptionTextRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) +{ + INT8 bButton = (INT8)MSYS_GetRegionUserData( pRegion, 0 ); + + if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + + HandleHighLightedText( FALSE ); + + gbHighLightedOptionText = -1; + + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } + else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + gbHighLightedOptionText = bButton; + + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } +} + + +void HandleHighLightedText( BOOLEAN fHighLight ) +{ + UINT16 usPosX=0; + UINT16 usPosY=0; + UINT8 ubCnt; + INT8 bHighLight=-1; + UINT16 usWidth; + + static INT8 bLastRegion = -1; + + if( gbHighLightedOptionText == -1 ) + fHighLight = FALSE; + + //if the user has the mouse in one of the checkboxes + for( ubCnt=0; ubCntArea.uiFlags & MSYS_MOUSE_IN_AREA ) + { + gbHighLightedOptionText = ubCnt; + fHighLight = TRUE; + } + } + + // If there is a valid section being highlighted + if( gbHighLightedOptionText != -1 ) + { + bLastRegion = gbHighLightedOptionText; + } + + bHighLight = gbHighLightedOptionText; + + + if( bLastRegion != -1 && gbHighLightedOptionText == -1 ) + { + fHighLight = FALSE; + bHighLight = bLastRegion; + bLastRegion = -1; + } + + //If we are to hide the blood and gore option, and we are to highlight an option past the blood and gore option + //reduce the highlight number by 1 + if( bHighLight >= TOPTION_BLOOD_N_GORE && gfHideBloodAndGoreOption ) + { + bHighLight--; + } + + if( bHighLight != -1 ) + { + if( bHighLight < OPT_FIRST_COLUMN_TOGGLE_CUT_OFF ) + { + usPosX = OPT_TOGGLE_BOX_FIRST_COL_TEXT_X; + usPosY = OPT_TOGGLE_BOX_FIRST_COLUMN_START_Y + OPT_TOGGLE_TEXT_OFFSET_Y + ( bHighLight * OPT_GAP_BETWEEN_TOGGLE_BOXES ) ; + } + else + { + usPosX = OPT_TOGGLE_BOX_SECOND_TEXT_X; + usPosY = OPT_TOGGLE_BOX_SECOND_COLUMN_START_Y + OPT_TOGGLE_TEXT_OFFSET_Y + ( ( bHighLight - OPT_FIRST_COLUMN_TOGGLE_CUT_OFF ) * OPT_GAP_BETWEEN_TOGGLE_BOXES ) ; + } + + //If we are to hide the blood and gore option, and we are to highlight an option past the blood and gore option + //reduce the highlight number by 1 + if( bHighLight >= TOPTION_BLOOD_N_GORE && gfHideBloodAndGoreOption ) + { + bHighLight++; + } + + + usWidth = StringPixLength( zOptionsToggleText[ bHighLight ], OPT_MAIN_FONT ); + + //if the string is going to wrap, move the string up a bit + if( usWidth > OPT_TOGGLE_BOX_TEXT_WIDTH ) + { + if( fHighLight ) + DisplayWrappedString( usPosX, usPosY, OPT_TOGGLE_BOX_TEXT_WIDTH, 2, OPT_MAIN_FONT, OPT_HIGHLIGHT_COLOR, zOptionsToggleText[ bHighLight ], FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); +// DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_HIGHLIGHT_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); + else + DisplayWrappedString( usPosX, usPosY, OPT_TOGGLE_BOX_TEXT_WIDTH, 2, OPT_MAIN_FONT, OPT_MAIN_COLOR, zOptionsToggleText[ bHighLight ], FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); +// DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); + } + else + { + if( fHighLight ) + DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_HIGHLIGHT_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); + else + DrawTextToScreen( zOptionsToggleText[ bHighLight ], usPosX, usPosY, 0, OPT_MAIN_FONT, OPT_MAIN_COLOR, FONT_MCOLOR_BLACK, TRUE, LEFT_JUSTIFIED ); + } + } +} + + + +void SelectedToggleBoxAreaRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ) +{ + if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + } + else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + UINT8 ubCnt; + + //loop through all the toggle box's and remove the in area flag + for( ubCnt=0;ubCntArea.uiFlags &= ~MSYS_MOUSE_IN_AREA; + } + + gbHighLightedOptionText = -1; + + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } +} diff --git a/Options Screen.h b/Options Screen.h new file mode 100644 index 00000000..a515274a --- /dev/null +++ b/Options Screen.h @@ -0,0 +1,29 @@ +#ifndef _OPTIONS_SCREEN__H_ +#define _OPTIONS_SCREEN__H_ + + +#define OPT_BUTTON_FONT FONT14ARIAL +#define OPT_BUTTON_ON_COLOR 73//FONT_MCOLOR_WHITE +#define OPT_BUTTON_OFF_COLOR 73//FONT_MCOLOR_WHITE + + + +//Record the previous screen the user was in. +extern UINT32 guiPreviousOptionScreen; + + + +UINT32 OptionsScreenShutdown( void ); +UINT32 OptionsScreenHandle( void ); +UINT32 OptionsScreenInit( void ); + + + +void SetOptionsScreenToggleBoxes(); +void GetOptionsScreenToggleBoxes(); + + +BOOLEAN DoOptionsMessageBox( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); + + +#endif diff --git a/Res/ja2.aps b/Res/ja2.aps new file mode 100644 index 0000000000000000000000000000000000000000..06012e76e6064b05e248e9306c748e293ec19978 GIT binary patch literal 20816 zcmds9d7K8jpQlc{yONOf1!%S=xQ^u!PtbO<334Q{v_ zpP~^#anBQ!prBC!{oFc%P+>ki3b`ql-W^1t)`c&QKXwj-HRdL}$>Gkk7~?4+KRu)7H6GwwC6_JhKryrw`m>uE<$T;MGIXTs{!}lzt)zgi?&S4 zOSkC!?aAY80wr$gX|6^X+W@{jTR^!lFG2m*C;I)+#k&{pT1sdczE2kQ?vtS*bzhGH zV|)zP0<;;wUfH|r#n;}Sq2bLmJOrae598W{>l$1;aqYsj8`oZ3`zSNEpT>sgXq4t4 zdya;2;VuQn*C>tE=V)x{9C~Vw>X|vJjBxrkqM;G01Ir+NbaWq$O+P}V&H);mnWO3L zNE_Zy!y_H4j6voo-Zz6gwui<z|oVQ6WngOB`uDJWcCW`st!@1T(#$g~T>cb5nQ zRaAp^Ak!E=?;E4x12Z)C$Zo3agYMUi(D1e)$k+)GdQ5XZeBXojj7%EYK0-q~GgN=% z0ByqrFgmjxdVz!TS?CZQ#PujXBW*jbZ72&ehbm}U$RF8OqTv~&Peb2p#;9`;?Yrjy z@*|D*qbdrWP(|R-hf2t^on;TB4@PNtM+a2!xE{kSa}1xi1ID=6 zfwtWP3~ey76TDqxC<^T`#C`b))zS9T+tB|zXTU+yzEK+4UPpbPC+avf+@a~2Ihw)M zLI2lB@m`vv%{wtxHt#~6hLLZWFqEnOFv@#mFLWG1KU6T@4$$;9kiQ!j_(Pcvl^(`8 zJh&fi1YP!yp-$k=K*s(K#>or~?PeX3wmm~bJBFx!;2_#G1AK-u`?jIKq0d3+UIFLP z9hBL%nZ|bS#dq}6PW0zBsQ>n1>O6w-HiPs3|FvM@qC*c^vUKsGhh03_&>VimvSrJU zJaTC0sH2V^*c?wh=1IpKi`Q{aLPrdEJ^3lepK#)dCqDIQBTpZIBI%@)WyWVbb1+W- z_V4HxyjIME(-WWd?D-&(e#)sw%1K(WR%S@kv(fil{wO(Xh6%+|xk#r!=ef^YwQ}{C zv9f4d%P%I|amOoV?~FB>qVHo+QMDG-%~fYMOrqxU^x@fFi!tr`U7Z^)qmO*_#+yF&@f&x4BKyft-7M7$ zW!!S>r?>ARI_1RAe(v+nylwUB>?%Jdo#+d<@4f5}k#gru75bFNvWl>t^{s+GieGcEh`OsONZ$)X}c(A96NHWbEg1yh3dim^T70$)A^HEk@pc%AUK^0(0fO-NnYEwX5fn-C(3>vo6h!n{{6QA-) zOlp#WDn1q`va~Q;q)G<5_*6`SJzX+T#)l`E$SRe|KpP*+1_`x-z;Ai=CbUGy0eDUb zxc-#Mx@Vw;PtWb821ct}Z6lAsa=@OKEG26Tqy%JDh*Uh=K{wTX!*T?eDfzTI1e@Mk zr)y8uj4HZ~%gf|^8jFLj*KwrKjP7GOCpC9{sN&VeWgg8(WIzJr4X<8z8X}!LjH_#h zSkUmCTB}oOiJWIxhoJ_z`ctRVtba+3L0J59n{h(!cQjv;K5rf2A$R5~0Q zIhu5h?u}s>gQ87z9ib`KPl{^GA%q3leJa(3&6VUFeMu$Pp^hBndY-%S zps%FCX5FzoBUG$N_ba^N)Ey&KqC^iQfY38=G`&m@Dx~T7xJ^|>4Fq(0HEP%FK&oNV zS5G1hm?B%mSDJoAt>*bIs1^T&2 z!Q$M2=NID^=@$YK3k6IuvZ3-B`jtp#GulA!zAW^f>x1E+@QlWVXQ4bT2z`WJer`vJ zVj0ngaw!tc(!v2Krb7wmXi*=$HVCSon5?syMi&pn!@-x$6zGrzTyLHPySzj&r5VDi zf|e?T*IMmnw+Cu;r~(^KFFi+xsdS^=3Szfh3ECX4&}J1@jaQ;vlM)(vnZkUdG43b~ zE5#V*NdsEabUIQc+fEB}uISAY7PdnQ!7y^9TT#M__9z9Iyc7|ARDvx(y4O&mEzpEs z6<%i4HcH(mriex-K@6oHBg%pAfi<8SOl36da2$!IgEB_RljA@%K*|{1Pl*H3*eGLA zAJ0H?C46$EU9;P?c*Vudi-jPa5(lb*^v_%rdujsUYWH$s`zQf&ReNBTR>nbASXx9` zVvaI#nAMKMdD7x=?|yPIB=tCgs018sSq*e~HjcH7<{Cd74=#E=r@$&!7!}VKbDpcY zR8WxZG}joG1!p{HhzZoS4Js*|eO>lDQ4e0v({mKWzMq0Ldai;nnt`;0IYu^}o~N*O zO)Lvo89-TDrJzV6JCqX6(P{;!?G3W$X-whm8joS=C(G;wG8D|~agnTPWJbyLZY}6K zjRuxq#sqE}!wl;R*TacOhzSMox!d)6&}g9mr(-$w7NRgh92^l>F?)fd6iKIXMXEYg zG3K0?+lPgbT%u+oLi)928FuHgp2}X|2j5A=g!+BNOelYUX7|f6Y3e-%& zu@ROlQY(dG#oX(mT#4E#xE1tefV_W!^;OD8U0JjmW6-!Y7 z1)5d>?mw|w(`F-u9eROc*dCmf80gXq6=-^`s!@;Q z==o^z!*62dT5%GqE2%R=5Sgasej$^l`>eAYjbF^78+O;*cV6vvrJYB5N zM$1hIFVGeR3Xe6eS&=SLXk-qocBA3cENMT>CED6g;kA6r6SKXWDVOO*^HZAeV?{fc z4SI1zV;@}F9`23MZ*VzC@)AXHVN78vTS1qnkggpFL%@;lmkuI{vDG8#^fE=lyvAaf z!K!GOGhVJxRgTrbLJL9FsH7adB1YqJ1D~!d+$kw1PnX9CJ$>Qd!4(%qPVx%$%0WEe zXxFStv@U>NMS7Lu!NNI>nt}Teg4<%w2Bk!=R+MNDA;BoqYZN1_TsU3eu8!(v&}$W| zU28bwsJB>%pb(Q@mj)9>SoC^@+b|V~DPz_Y4Ipc5(;Jcu69kw%-g%G=hqfyQ0)S0k z!-!i_gZuiXG={F>#j&el?tOC_M8vfu#9>?w0hjmoQKUxBEp5t8d-T(R5Mm9B!21rOnRg@>&UqlG11O@>@u zt)$T|#esW=8w!K5DNMCi(&+|;hWDFrF*G;{ABiC8io(Xl3(wIm|Fl@h0v=;MPZFi%*R$kl*WD%0*kBzAr-@CCAuvI2ZmTuH2SQfgarvk6VY@@(dlzB3Qujd$od-@x-Esl zQFj_*o6*$_jlPhAxxw53aYZ59(CPLRfd^yHA{bfPo5Fcog^xNVW_l?kM|Y%1p+&Hr znkTk3p-P_aOp&4niF|X-D9~LgP6KNv-gFRtj+}9fBHf*0VXH%#D5FGQOyOLorsHr# z7n+pmo)lg|zjr<1jcbNM_om<`a2ZuZZj<(IoJ^Kj@`K1)@1g_M} zp)V`QXuvG>`q|9T{V6Qo&!$EXq+qt6LCu#2!PM!&6pqmqxV@G)v$Q`&5SCR*$kA6* z1T<5++s;HvPFej4XmQDZVQXg z)4?Q(E9E-TcrF*{FG<|1VbEdJw7Og$G5B!8@~=r!*eW(Q*04g9bE>44=x<4CcqWGj zHA13;>QSb@C$q@gFENekSTFx0$ufgrP1R_uNd*(78YVsVcx)`P5tj^`$fCK3+w96J zg@{cH7lxZFbqp6c&b4s_{IN1a_aRug7DtEV%16iau{6oGad5+g`4$Rc`ZzQRhjB5k zWqAI<)iH@2mSmx~U}ABH$Y7(6S>(th19JqIB95=Ii8OOGlw?SI*RCbvu{x%cqat3j zTWPh_@e)_JH99s0vTX=si@L4TaVePRe;)Xb*g%1VEDfh9a7Zi3o5Rl0lT#$zwx(yp zs}ap+=jkaaLULHx1v)-O2p0lkjU$B=>4X%Ag?Lq%WW?>FTg5KXiHZi>Z;9}~8FacF zm%vvc4d*1DJ`XKM(&?mmNY(HdnyWimIyoZ2u3|buS;S$V6)IT_| zK>;7^$!4&=&57hmZ>?#FCPQMD@=;>A^@PM66{19JHG55-V3C}sqAIjym~8R+;HN}0 zREkiWcXv7NXZz!n%@k4e8ik2^Mu<*+91-Dk4qk~3NzR(3sv^j}<8VF5XpZU%l^r7X z4;jnTnK3NfIA)+g4F!leW^|^3(IPb!$^mc@EEUx#QAmrQ*!NRD@chxpAM1o&0R3TrASr3alFAHC_TUP@;1bAa*dZ zAB$lrz%q3eSP|zGcpn$}u(F?4&_n{#XuX1JfsK81tI?F%bb7wRS`Cb?8g2n0F-sfL zkkgzLP>#+`Lqb8s{Wqq7Nhz#A=cRz$q#AlRwe|h)8;{_l$)iC2Z7vb5S*he15p9y>5_q< z6kMQ72chDC3yUt&)KRV(>EE7jThY7r`FRm*X6t zEsH?uI_|;kNmL%?V<<;&j37&_miXr8c_Kq^O#*DUn~Z3*BZ)LyQ@(_BdRq#@rn|_L zr7IQEMEG}&!$ czC-);4eE3m@6FO=l$ZV6w)+!N)0Em0$r^TxFGQTOq|bJgQNdY z{F*d2S>d21Fpb`o#@LqzqSL$6$auqnrvNNV?@42({G9;?^Lx|Kl!M6sB&XWi$j)M#zN)xzrRci$LKRk#L)*K=J>r=2Cj~w6MrI6+nB9v9p z@fcm2R-_vg$T@_Qfv~woH^uk5IgkYAuWh7=$uqF&&yD9O7soI!frzw`@vF;GJR7aW*|;Wp&bo+NF{p+HpxJ`gH5<^DS-KL z(4vPGDCZfagH7L7Aa6MN28@r`zKr6Mj^@yJ<|9cn!FM9ga(#C`R%8vBht0n4DPD-c zR}c4O9IQpYpTx0F!7@^uRS?aCUA`amGoom;gB8ht^~3VSh0LF$1O0^PM2Dp0>A(9a z;mJqTp+G-Wu(V3`I{y#~Sc!f#0PDsM0XaBh{bR-9hVJ&V8}yTYD4E-&pDIe&f=Ylz zKO2Z9W!UscA4|>@(Jy6O9Fe7;E0VnBg*VjYGylLf`o&6Z$JpJ|Gd@B+ip zuV1Gyo&b7he_aPhzIkxn+08O)F#R&b;UN0_yMYWoL?BAR4DJ(7Ip%}cA10yu7hzNmN^alNKP6k>~{Sn0b-BQ zm8U6$BG~NuYaF+|36IY>m{V(=hS>aZu;2B!I0Y_d;L5vIO?F0({yu<&xh}@Z(?8-I zM4))J%x*={z)3n&?vFay@_H=J6QrQk3;a6R?V5`dLP1eL-@$GdPD0DyVb!|`ccK)- z=jNU2^&)n>7Q{I=Vhon!1-&SggH5l6aYjrE4skVGat^`X*P=KJy2uDVDmE_95IBZK zi{qU5?iZgAI3y1C1jJj!p(ms`QOn6*bZJQ($5`X-Najc_IoKH|$l9hNj1I><<1E}4 z*h}Hzpf)WX4td5&Tp2{?MC%G=5b-=bPT-AG(RSjHt!iJyJ&#E9AV_sH0-np_gm7;Z z^7vqp9D%aL0xcgv#G*cMYvCyk2b*a}4j{2+V&_3@q&g;^t}%cW8i^_STWGd2W|@w9 z93r1|pXzM|!rQ`Q24W);yDg|{?>w!+djQet7RNN{iH}2;RkrAuIH%?~cBEvwY@41G zr^>QL-=ZO<#WEc_HqOB@g2&O%rQ;rlEcC;c6YkV3#Z)Uq_Bf6->aMWt$-ct z7Ypa!2TtMZ4v(-9l!g)-yiYgUGTaYzrKG4-qo|s?i1;m z*l+gvQ3U*2a>NEY9Y0@{&v06YUp#NcQ=<4OR_pMqTYehWI@%)MF9NbfJniZ41bQBxf+RKmzpUqr zh2}{;my4$|9J=@gs73Uwu`Jqx+m4@ywhLFXU%%AXuRNBpYv;GI0gayni5zot@l<_a zs(eDoGoS%h?i!_^g)rY^@QP3fSrGrnaz#DyVLtk_pmUZtFG$x#K20J%M)?_iHZC=e zkx9JNGy3>Bd{^Q6SDwSi&)(yQg3O;M(nUQRV-ffxD1QDt%-}~*sXY9AJsWxEd%hk& zVPkeN;kg#`J+FhG%`ppHwNLbH4y6Ozf{|*R6WIdA;c<1a7Ux9cN^$-d D94*p% literal 0 HcmV?d00001 diff --git a/Res/ja2.rc b/Res/ja2.rc new file mode 100644 index 00000000..6659f40d --- /dev/null +++ b/Res/ja2.rc @@ -0,0 +1,111 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x7L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Sir-Tech Canada Ltd." + VALUE "FileDescription", "Jagged Alliance 2 Gold" + VALUE "FileVersion", "1, 0, 0, 6" + VALUE "InternalName", "Jagged Alliance 2" + VALUE "LegalCopyright", "Copyright © 1998" + VALUE "OriginalFilename", "Ja2.exe" + VALUE "ProductName", "Jagged Alliance 2 Gold" + VALUE "ProductVersion", "1, 0, 0, 6" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "jagged3.ico" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Res/jagged3.ico b/Res/jagged3.ico new file mode 100644 index 0000000000000000000000000000000000000000..e91881a75a5814acdf6281670c000d9bedee4fa4 GIT binary patch literal 2246 zcmds1TXz#x6#hy}6VSHPa&fd&#tS+kn$aqmR!GKpVOkNAiO`4|P|3Bf&Jjm^31SSQU{OCvk;P$w24N(OX|F=fga zZM7UU$Dg@LCS=A1LX0It*X_OPeC$F6O@y3`I0Z{`8meO}lHi9fwi^@ya#n}P(gc%d z($Kj#xV6u2n%MU#668b@Qj$&?2G6QMjC`C((n+H%Xb?*gXhT`(1?HZTAjSp8NRwn9 zrtQabj#8L#|^rsF*_JX#|QOq!xG<{QSM~*q>avUXt=;S$HAx85UeR3*g7$)9Kpo^eEEm}$=91S~6Kx}mQ8f5Y zA`r56j?^U-2uT5p_BkJy7@%;8DUHuI&y!g_~ zecQa__*ZrWBmS0G)6M<;O|7rJzVnSYqhlSj&30vs-932g?LF_j``(`H`|Tg>{jieW zXpE0O{v?qD7PNi(+2`}V@cY|+!Ew=nFTcw7>~l2xzXqaRQM+m5)`4Z;?Els|`}_#* z{jRHPB47Bvd)HvqKK#Rv2Y;#_D$?j&vTsbaG`e$O`$WFWTl{%PRb?*z<=5(dRCa`o zLQhp^92_`Q-H*!OeqU+)QPmw97)!-b1p>R5=NE<7`r9i>7gw*UnmW?!Rkj*FkGH*8 zX?ft!3G|VNakX3a8ir++&`ViCnev}Gz1B!0Ntg9kZ>@DeoPv#vRF8ZOvA!PKhWa|V swg9e?3YsWw%pIvCTy7%iA8`%a=pBVs#xSorYz@~OX6(PM>0A==FPCSW^Z)<= literal 0 HcmV?d00001 diff --git a/Res/resource.h b/Res/resource.h new file mode 100644 index 00000000..b8d4af7b --- /dev/null +++ b/Res/resource.h @@ -0,0 +1,23 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by ja2.rc +// +#define IDI_ICON1 113 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 114 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif + + + + + + + diff --git a/SCREENS.H b/SCREENS.H new file mode 100644 index 00000000..21462d69 --- /dev/null +++ b/SCREENS.H @@ -0,0 +1,37 @@ +#ifndef __SCREEN_MANAGER +#define __SCREEN_MANAGER + +#include "Types.h" +#include "ScreenIds.h" + +// Each screen in the game comes with a Status flag (what was the last thing the screen was doing), an Initialization +// function (which loads up the screen if necessary), a Handler function which is called while the screen is showing and +// a shutdown function which is called when the screen is getting ready to make another screen active. + +typedef struct Screens +{ + UINT32 (*InitializeScreen)(void); + UINT32 (*HandleScreen)(void); + UINT32 (*ShutdownScreen)(void); + +} Screens; + +// These defines are used as flags for each screen state. The only legal transition of states is +// SCR_INACTIVE -> SCR_INITIALIZING -> SCR_ACTIVE -> SCR_SHUTTING_DOWN -> SCR_INACTIVE ... Anything else +// will cause the system to yak. + +#define SCR_INACTIVE 0x00 +#define SCR_INITIALIZING 0x01 +#define SCR_ACTIVE 0x02 +#define SCR_SHUTTING_DOWN 0x04 + +// This extern is made available to make sure that external modules will have access to the screen information + +extern Screens GameScreens[MAX_SCREENS]; + +// We must include all the following .H files which have prototypes for all the initialization, handler and shutdown +// functions for all the screens. There should be as many includes as there are screens. + +#include "jascreens.h" + +#endif \ No newline at end of file diff --git a/SCREENS.cpp b/SCREENS.cpp new file mode 100644 index 00000000..4187668e --- /dev/null +++ b/SCREENS.cpp @@ -0,0 +1,51 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" +#else + #include "Screens.h" +#endif + +int iResolution; // INI file +// WANNE +int iScreenMode; // INI file (Windowed or Fullscreen) // REPLACE all defines WINDOWED_MODE with this variable + +int SCREEN_WIDTH; +int SCREEN_HEIGHT; + +int iScreenWidthOffset; +int iScreenHeightOffset; + +Screens GameScreens[MAX_SCREENS] = +{ + { EditScreenInit, EditScreenHandle, EditScreenShutdown }, + { SavingScreenInitialize, SavingScreenHandle, SavingScreenShutdown }, // Title Screen + { LoadingScreenInitialize, LoadingScreenHandle, LoadingScreenShutdown }, // Title Screen + { ErrorScreenInitialize, ErrorScreenHandle, ErrorScreenShutdown }, // Title Screen + { InitScreenInitialize, InitScreenHandle, InitScreenShutdown }, // Title Screen + { MainGameScreenInit, MainGameScreenHandle, MainGameScreenShutdown }, + { AniEditScreenInit, AniEditScreenHandle, AniEditScreenShutdown }, + { PalEditScreenInit, PalEditScreenHandle, PalEditScreenShutdown }, + { DebugScreenInit, DebugScreenHandle, DebugScreenShutdown }, + { MapScreenInit, MapScreenHandle, MapScreenShutdown }, + { LaptopScreenInit, LaptopScreenHandle, LaptopScreenShutdown }, + { LoadSaveScreenInit, LoadSaveScreenHandle, LoadSaveScreenShutdown }, + { MapUtilScreenInit, MapUtilScreenHandle, MapUtilScreenShutdown }, + { FadeScreenInit, FadeScreenHandle, FadeScreenShutdown }, + { MessageBoxScreenInit, MessageBoxScreenHandle, MessageBoxScreenShutdown }, + { MainMenuScreenInit, MainMenuScreenHandle, MainMenuScreenShutdown }, + { AutoResolveScreenInit, AutoResolveScreenHandle, AutoResolveScreenShutdown }, + { SaveLoadScreenInit, SaveLoadScreenHandle, SaveLoadScreenShutdown }, + { OptionsScreenInit, OptionsScreenHandle, OptionsScreenShutdown }, + { ShopKeeperScreenInit, ShopKeeperScreenHandle, ShopKeeperScreenShutdown }, + { SexScreenInit, SexScreenHandle, SexScreenShutdown }, + { GameInitOptionsScreenInit, GameInitOptionsScreenHandle, GameInitOptionsScreenShutdown }, + { DemoExitScreenInit, DemoExitScreenHandle, DemoExitScreenShutdown }, + { IntroScreenInit, IntroScreenHandle, IntroScreenShutdown }, + { CreditScreenInit, CreditScreenHandle, CreditScreenShutdown }, + + +#ifdef JA2BETAVERSION + { AIViewerScreenInit, AIViewerScreenHandle, AIViewerScreenShutdown }, +#endif + + { QuestDebugScreenInit, QuestDebugScreenHandle, QuestDebugScreenShutdown } +}; \ No newline at end of file diff --git a/SMACKW32.LIB b/SMACKW32.LIB new file mode 100644 index 0000000000000000000000000000000000000000..24979d46a86ae007803c2eaf9812f794343db25c GIT binary patch literal 42534 zcmeHQ+ix3H8vn&DEu>HalxuG(Ev1wa631?1C|$Qn(^il+ibDfJV5ZK5n%Z%2?1ds= z5qBhn5JDgX2!U3JKL8=b1FFzI>=Q!!utGc_Kk>lBYK2y-YK3<9J7?ycIcH`(-7!Wx zzo6px}0Y5pqCr3XiQk; zs6D(l=UImr=ck&LMtP}XvOCaiMV)!}WUbU(Hs{^cdaYV0)lK4iWUp5KxcPXS8}U|3 z>sMFW#Ff!7>W!d!xm%4_cD8niZwQ)V0HYoSvoV`tS{H< z4#M*lP7eTyE6lS>lfL z%nE0h8)lWVWi<-rYO|u&t59n$&hvK4i}vQEV~f1HvT~ewV)4Ynf=;5lOqA2fM-eq%Q&Uuk|DMoY7@syt`6g;%K@}g6}X0>Y6&&qm8G^Is@3CaxBODSf* z39=Z~V`}O?d9RbTO0#NC8_K&fXE14m;%vEU)+d{bB@UzFv8m}3Gqc5s!-esgW7D%I zW{S&9c0JDC`r`3>@43fYf-=h0rJ^qJERrtwTr@}ec`|JA;i5}P=%!0~=*kdM(M6^Q zD`lfMOO+k&Tq!4A8Pdn*T zswdwiT|N0y#(HveN$bt_mA5{{gs$>riFbp`-nO|?0=F+A<#5{~)&pnKSSjL`$!eC+ zh$^j(e0CSH?xkbPBde8@6p5`+HMycV7SR|Jo;TpjxS4u{ua*7lPQ#Dq>x-q{%W}8N+QmI;rkzA)J zg=tq7`-4zQmP(pEdhhYOixUTD4+;0yAIm|6eBN96Hr1t!U3 zdg&N>Ts7dKdEomT@X0>l$0qQ~1Hkzy;03zCH{^j$9s$_%*z1qcHQxdnZ;)4bimqD(ekN~fca^H~Ch*xaK;~WG zxu?jRdk^S;2WY)YUfqkp2J*Z%Jx?Cm2UPAu;Qg0@kIC~}GXi`&ME4&BKHo;y&XPB| z3s~Asd~F8?c9O?8L;3d;zq7>mN$#v-4ff$q>_-lFU=&$ouoq*v6zgymuE7AVz}2`C z7h?l1$6DNl-yx3!SdUHEjvLXB&A0(Oa1$=UR$Pb6a4oLKEw~vQaXW598hbE=E!c*g z7{smEh20oNA5#C9`;OoutcLZ!3c3xWTQBm+v0D_9=J1dcBW)E~X2okG4{}nsF097k zhKtLtP;#V2q0n?&Le22CBD4a+eo%-~hPs?vL6J9ekEQkw{#Pl*+;t*E+V zzuIeCwquM#^OXwo;4aj|md%aXeQgi--_w`E6~@!q7y3Zn2zf<7-@3ll8)&zE8lbEc z$nw8XqJpd}`{P@=xzLHfY5q`op1PKHq{U4bvlGPsee`2#75(xUIA@pJ%Zc>2o_@bq z$}xH#gXh@Roh~H;H4$%9>xyf66R%y+PN>DPa z3=y0%S%<>t+t{C-*qI=|)JZ9j>q^0eP9oRs;|MB${|h2V(xNw*A+nDna+>PJcxM~C zJ;)Qc5_@74BG3|hVj4j?&|8-R6vT0xaD0F0x@Y%#-lhuO!BuyP9$1OhWnLWE+dPH^ z+A<=Gm7`FHmRLEJp!3CoF5P=3nVjg6XU}9ceiI#BF8qghkNh8iIUgKE?n= zy1y+@bc<*b+NLl`|6UaN@EfSWLL+Hd9nsX=(Z2x=NzU}x=xZ?l=-;4*pSyhV<8T=W zn+|kX*5hCOLN$n*1Y*6sE&8b`tOUA3$Bj0*Df-ya`?-be*`YK@3J2-PD|=kixPk&Y zEBLY7Q;gHI4y~grHT>vP;CdN9I;UNhKf}rK)vwa_}2F*<95 zh8d+dCqrwIDI=oUSmEf68ur&&G?`td6!Nt1)ma*+f$#}!DUW)`nXitZ&&4!*i+*Yf zYw=vIqsMQybqr9X+c?7Vxm9VH6pqr74~qOa?k<`VH0t6S7n-y{0?@sB$1 z)HK()ujUf?5xjO8Luv2q7&hH3YEhp-YMU1Q)D+eRy51i{V*P;_NTET6eP`^~%^G!r zj=c7dM3LY&5JsUb=>(zZ2457(g#{CVBFSxcQIsGHdZUdZ*V>aYKu;$Yw2RBGq9#f6 zfHw)$*vpbe-|q3BEv{q8JrDS|nWdLakdE3caN@sIZ49JLCzejTh0}w&xk6hy37Sp5 zMMaUN^2g#3YxeJ@2%b%@udCl(#3W}t##S3K?q#l{ucvg4BqGbY6mpNpaB~@G)`X7k zWOCl|7(bJ57d6lPN~%+fergKqnGXuw$d6V;A2Ez?ksM!Kj}y{D)0!`?F7X~Pc(4Pk zcq4(mIzM=ujTLoa{OF^_e}1suE9zdcLglc#vL&0KF@iVRcyWI)A^Mo@IGS zv@+Xvfg9^%8Zq#h{C(}VE3*~Ynp<+w*#LDE+DA&zsGJ=(N_yBYYH=9W zaxMC)DQp~OmyH`5bE|%+GX`?TA2-3{`dnNF!X~^GuC^{#H!z zif!t*YP;J<;2nk4t81I=7HCmF7!?D&bkeKDzf2-OW!zoFBu6XVsv^euo>&Yp(~(wU z?}fuE}#ce8L$T(EK2ycHyKKlNX z|GE_P;aHhcI70jC2w|?JeEAK8Qs_ucHbFCdhg2-dZ&yYiKmO83pS|E-!A*XDZH|9R zG|0>ekC_o~&vviQak<@%8SUGq(Z`OC5)r!zp5r31qw%^TcZ9eO8^IZNVaWR8Vf3-{ zYvhjjs$)PGW_Y=iAYC=$!pvNGF+UtzOIepf?R1sJV|V3Dl1A)_Plgwo)v8fHn;(k- zUOE}E=kV8Uta$C3UX2fr+VVxrLCmM)fENGwus&kKJz`Jgu)BCk(ls5UIoNCCg@Q9v zQ}^XFagZd+S)^?WdtK2z$zLE;!b+AT^(5@Gk#e$DX;#f?V=+HMjT~2>I(QzO z#$#6zlccfZV>V*ujB+C$lEr_VUhvp)o4YQfBsrrwb12T1t7d(&xme1l;}CK2M~QCr zDx*0y?gC-5VyW0V+;6qvJ5V&rm6B1ZoT3>U@sKAWEft-=K&XVZR5D}Ukuray){ffv z&Gl5LmW=|j2^;;t6UDkQzd-I!JW#@T7Ri}Id$l0ZHib0(+r8BeZ{0;m&btn5ug)OY a&k<53SyC&-10()Ar>$i|7?IosqU66sr0i1w literal 0 HcmV?d00001 diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp new file mode 100644 index 00000000..c77eb619 --- /dev/null +++ b/SaveLoadGame.cpp @@ -0,0 +1,5427 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" + #include "PreBattle Interface.h" + #include "civ quotes.h" + #include "Militia Control.h" + #include "Strategic Event Handler.h" + #include "HelpScreen.h" + #include "Cheats.h" + #include "Animated ProgressBar.h" +#else + #include "Types.h" + #include "Soldier Profile.h" + #include "FileMan.h" + #include + #include + #include "Debug.h" + #include "OverHead.h" + #include "Keys.h" + #include "finances.h" + #include "History.h" + #include "files.h" + #include "Laptop.h" + #include "iniReader.h" + #include "Email.h" + #include "Strategicmap.h" + #include "Game Events.h" + #include "Game Clock.h" + #include "Soldier Create.h" + #include "WorldDef.h" + #include "LaptopSave.h" + #include "strategicmap.h" + #include "Queen Command.h" + #include "SaveLoadGame.h" + #include "Tactical Save.h" + #include "Squads.h" + #include "Environment.h" + #include "Lighting.h" + #include "Strategic Movement.h" + #include "Strategic.h" + #include "Isometric Utils.h" + #include "Quests.h" + #include "opplist.h" + #include "message.h" + #include "NPC.h" + #include "Merc Hiring.h" + #include "SaveLoadScreen.h" + #include "GameVersion.h" + #include "GameSettings.h" + #include "Music Control.h" + #include "GameScreen.h" + #include "Options Screen.h" + #include "Ai.h" + #include "RenderWorld.h" + #include "SmokeEffects.h" + #include "Random.h" + #include "Map Screen Interface.h" + #include "Map Screen Interface Border.h" + #include "Map Screen Interface Bottom.h" + + #include "Interface.h" + #include "Map Screen Helicopter.h" + #include "Environment.h" + #include "Arms Dealer Init.h" + #include "Tactical Placement GUI.h" + + #include "Strategic Mines.h" + #include "GameVersion.h" + #include "Strategic Town Loyalty.h" + #include "Vehicles.h" + #include "Merc Contract.h" + #include "Bullets.h" + #include "air raid.h" + #include "physics.h" + #include "Strategic Pathing.h" + + #include "TeamTurns.h" + + #include "explosion control.h" + #include "Creature Spreading.h" + #include "Strategic Status.h" + #include "Prebattle Interface.h" + #include "Boxing.h" + #include "Strategic AI.h" + #include "Map Screen Interface Map.h" + + #include "Meanwhile.h" + #include "dialogue control.h" + #include "text.h" + #include "Map Screen Interface.h" + #include "lighteffects.h" + #include "HelpScreen.h" + #include "Animated ProgressBar.h" +#endif + +#include "BobbyR.h" +#include "Imp Portraits.h" +#include "Loading Screen.h" +#include "Interface Utils.h" +#include "Squads.h" +#include "IMP Confirm.h" +#include "Enemy Soldier Save.h" +#include "BobbyRMailOrder.h" +#include "Mercs.h" +#include "INIReader.h" + +///////////////////////////////////////////////////// +// +// Local Defines +// +///////////////////////////////////////////////////// + + +void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ ); +extern void NextLoopCheckForEnoughFreeHardDriveSpace(); +extern void UpdatePersistantGroupsFromOldSave( UINT32 uiSavedGameVersion ); +extern void TrashAllSoldiers( ); +extern void ResetJA2ClockGlobalTimers( void ); + +extern void BeginLoadScreen( void ); +extern EndLoadScreen(); + +//Global variable used +#ifdef JA2BETAVERSION +UINT32 guiNumberOfMapTempFiles; //Test purposes +UINT32 guiSizeOfTempFiles; +CHAR gzNameOfMapTempFile[128]; +#endif + +extern SOLDIERTYPE *gpSMCurrentMerc; +extern INT32 giSortStateForMapScreenList; +extern INT16 sDeadMercs[ NUMBER_OF_SQUADS ][ NUMBER_OF_SOLDIERS_PER_SQUAD ]; +extern INT32 giRTAILastUpdateTime; +extern BOOLEAN gfRedrawSaveLoadScreen; +extern UINT8 gubScreenCount; +extern INT16 sWorldSectorLocationOfFirstBattle; +extern BOOLEAN gfGamePaused; +extern BOOLEAN gfLockPauseState; +extern BOOLEAN gfLoadedGame; +extern HELP_SCREEN_STRUCT gHelpScreen; +extern UINT8 gubDesertTemperature; +extern UINT8 gubGlobalTemperature; +extern BOOLEAN gfCreatureMeanwhileScenePlayed; +#ifdef JA2BETAVERSION + extern UINT8 gubReportMapscreenLock; +#endif + +BOOLEAN gMusicModeToPlay = FALSE; + +#ifdef JA2BETAVERSION +BOOLEAN gfDisplaySaveGamesNowInvalidatedMsg = FALSE; +#endif + +BOOLEAN gfUseConsecutiveQuickSaveSlots = FALSE; +UINT32 guiCurrentQuickSaveNumber = 0; +UINT32 guiLastSaveGameNum; +BOOLEAN DoesAutoSaveFileExist( BOOLEAN fLatestAutoSave ); + +UINT32 guiJA2EncryptionSet = 0; +UINT32 CalcJA2EncryptionSet( SAVED_GAME_HEADER * pSaveGameHeader ); + +typedef struct +{ + //The screen that the gaem was saved from + UINT32 uiCurrentScreen; + + UINT32 uiCurrentUniqueSoldierId; + + //The music that was playing when the game was saved + UINT8 ubMusicMode; + + //Flag indicating that we have purchased something from Tony + BOOLEAN fHavePurchasedItemsFromTony; + + //The selected soldier in tactical + UINT16 usSelectedSoldier; + + // The x and y scroll position + INT16 sRenderCenterX; + INT16 sRenderCenterY; + + BOOLEAN fAtLeastOneMercWasHired; + + //General Map screen state flags + BOOLEAN fShowItemsFlag; + BOOLEAN fShowTownFlag; + BOOLEAN fShowTeamFlag; + BOOLEAN fShowMineFlag; + BOOLEAN fShowAircraftFlag; + + // is the helicopter available to player? + BOOLEAN fHelicopterAvailable; + + // helicopter vehicle id + INT32 iHelicopterVehicleId; + + // total distance travelled + INT32 UNUSEDiTotalHeliDistanceSinceRefuel; + + // total owed to player + INT32 iTotalAccumulatedCostByPlayer; + + // whether or not skyrider is alive and well? and on our side yet? + BOOLEAN fSkyRiderAvailable; + + // skyrider engaging in a monologue + BOOLEAN UNUSEDfSkyriderMonologue; + + // list of sector locations + INT16 UNUSED[ 2 ][ 2 ]; + + // is the heli in the air? + BOOLEAN fHelicopterIsAirBorne; + + // is the pilot returning straight to base? + BOOLEAN fHeliReturnStraightToBase; + + // heli hovering + BOOLEAN fHoveringHelicopter; + + // time started hovering + UINT32 uiStartHoverTime; + + // what state is skyrider's dialogue in in? + UINT32 uiHelicopterSkyriderTalkState; + + // the flags for skyrider events + BOOLEAN fShowEstoniRefuelHighLight; + BOOLEAN fShowOtherSAMHighLight; + BOOLEAN fShowDrassenSAMHighLight; + + UINT32 uiEnvWeather; + + UINT8 ubDefaultButton; + + + + + BOOLEAN fSkyriderEmptyHelpGiven; + BOOLEAN fEnterMapDueToContract; + UINT8 ubHelicopterHitsTaken; + UINT8 ubQuitType; + BOOLEAN fSkyriderSaidCongratsOnTakingSAM; + INT16 sContractRehireSoldierID; + + + GAME_OPTIONS GameOptions; + + UINT32 uiSeedNumber; + + //The GetJA2Clock() value + UINT32 uiBaseJA2Clock; + + INT16 sCurInterfacePanel; + + UINT8 ubSMCurrentMercID; + + BOOLEAN fFirstTimeInMapScreen; + + BOOLEAN fDisableDueToBattleRoster; + + BOOLEAN fDisableMapInterfaceDueToBattle; + + INT16 sBoxerGridNo[ NUM_BOXERS ]; + UINT8 ubBoxerID[ NUM_BOXERS ]; + BOOLEAN fBoxerFought[ NUM_BOXERS ]; + + BOOLEAN fHelicopterDestroyed; //if the chopper is destroyed + BOOLEAN fShowMapScreenHelpText; //If true, displays help in mapscreen + + INT32 iSortStateForMapScreenList; + BOOLEAN fFoundTixa; + + UINT32 uiTimeOfLastSkyriderMonologue; + BOOLEAN fShowCambriaHospitalHighLight; + BOOLEAN fSkyRiderSetUp; + BOOLEAN fRefuelingSiteAvailable[ NUMBER_OF_REFUEL_SITES ]; + + + //Meanwhile stuff + MEANWHILE_DEFINITION gCurrentMeanwhileDef; + + BOOLEAN ubPlayerProgressSkyriderLastCommentedOn; + + BOOLEAN gfMeanwhileTryingToStart; + BOOLEAN gfInMeanwhile; + + // list of dead guys for squads...in id values -> -1 means no one home + INT16 sDeadMercs[ NUMBER_OF_SQUADS ][ NUMBER_OF_SOLDIERS_PER_SQUAD ]; + + // levels of publicly known noises + INT8 gbPublicNoiseLevel[MAXTEAMS]; + + UINT8 gubScreenCount; + + UINT16 usOldMeanWhileFlags; + + INT32 iPortraitNumber; + + INT16 sWorldSectorLocationOfFirstBattle; + + BOOLEAN fUnReadMailFlag; + BOOLEAN fNewMailFlag; + BOOLEAN fOldUnReadFlag; + BOOLEAN fOldNewMailFlag; + + BOOLEAN fShowMilitia; + + BOOLEAN fNewFilesInFileViewer; + + BOOLEAN fLastBoxingMatchWonByPlayer; + + UINT32 uiUNUSED; + + BOOLEAN fSamSiteFound[ NUMBER_OF_SAMS ]; + + UINT8 ubNumTerrorists; + UINT8 ubCambriaMedicalObjects; + + BOOLEAN fDisableTacticalPanelButtons; + + INT16 sSelMapX; + INT16 sSelMapY; + INT32 iCurrentMapSectorZ; + + UINT16 usHasPlayerSeenHelpScreenInCurrentScreen; + BOOLEAN fHideHelpInAllScreens; + UINT8 ubBoxingMatchesWon; + + UINT8 ubBoxersRests; + BOOLEAN fBoxersResting; + UINT8 ubDesertTemperature; + UINT8 ubGlobalTemperature; + + INT16 sMercArriveSectorX; + INT16 sMercArriveSectorY; + + BOOLEAN fCreatureMeanwhileScenePlayed; + UINT8 ubPlayerNum; + //New stuff for the Prebattle interface / autoresolve + BOOLEAN fPersistantPBI; + UINT8 ubEnemyEncounterCode; + + BOOLEAN ubExplicitEnemyEncounterCode; + BOOLEAN fBlitBattleSectorLocator; + UINT8 ubPBSectorX; + UINT8 ubPBSectorY; + + UINT8 ubPBSectorZ; + BOOLEAN fCantRetreatInPBI; + BOOLEAN fExplosionQueueActive; + UINT8 ubUnused[1]; + + UINT32 uiMeanWhileFlags; + + INT8 bSelectedInfoChar; + INT8 bHospitalPriceModifier; + INT8 bUnused2[ 2 ]; + + INT32 iHospitalTempBalance; + INT32 iHospitalRefund; + + INT8 fPlayerTeamSawJoey; + INT8 fMikeShouldSayHi; + + UINT8 ubFiller[550]; //This structure should be 1024 bytes + +} GENERAL_SAVE_INFO; + + + +UINT32 guiSaveGameVersion=0; + + +///////////////////////////////////////////////////// +// +// Global Variables +// +///////////////////////////////////////////////////// + +//CHAR8 gsSaveGameNameWithPath[ 512 ]; + +UINT8 gubSaveGameLoc=0; + +UINT32 guiScreenToGotoAfterLoadingSavedGame = 0; + +extern EmailPtr pEmailList; +extern UINT32 guiCurrentUniqueSoldierId; +extern BOOLEAN gfHavePurchasedItemsFromTony; + + +///////////////////////////////////////////////////// +// +// Function Prototypes +// +///////////////////////////////////////////////////// + +BOOLEAN SaveMercProfiles( HWFILE hFile ); +BOOLEAN LoadSavedMercProfiles( HWFILE hwFile ); + +BOOLEAN SaveSoldierStructure( HWFILE hFile ); +BOOLEAN LoadSoldierStructure( HWFILE hFile ); + +//BOOLEAN SavePtrInfo( PTR *pData, UINT32 uiSizeOfObject, HWFILE hFile ); +//BOOLEAN LoadPtrInfo( PTR *pData, UINT32 uiSizeOfObject, HWFILE hFile ); + +BOOLEAN SaveEmailToSavedGame( HWFILE hFile ); +BOOLEAN LoadEmailFromSavedGame( HWFILE hFile ); + +BOOLEAN SaveTacticalStatusToSavedGame( HWFILE hFile ); +BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ); + + +BOOLEAN SetMercsInsertionGridNo( ); + +BOOLEAN LoadOppListInfoFromSavedGame( HWFILE hFile ); +BOOLEAN SaveOppListInfoToSavedGame( HWFILE hFile ); + +BOOLEAN LoadMercPathToSoldierStruct( HWFILE hFilem, UINT8 ubID ); +BOOLEAN SaveMercPathFromSoldierStruct( HWFILE hFilem, UINT8 ubID ); + +BOOLEAN LoadGeneralInfo( HWFILE hFile ); +BOOLEAN SaveGeneralInfo( HWFILE hFile ); +BOOLEAN SavePreRandomNumbersToSaveGameFile( HWFILE hFile ); +BOOLEAN LoadPreRandomNumbersFromSaveGameFile( HWFILE hFile ); + +BOOLEAN SaveWatchedLocsToSavedGame( HWFILE hFile ); +BOOLEAN LoadWatchedLocsFromSavedGame( HWFILE hFile ); + +BOOLEAN LoadMeanwhileDefsFromSaveGameFile( HWFILE hFile ); +BOOLEAN SaveMeanwhileDefsFromSaveGameFile( HWFILE hFile ); + +void PauseBeforeSaveGame( void ); +void UnPauseAfterSaveGame( void ); +void UpdateMercMercContractInfo(); +void HandleOldBobbyRMailOrders(); +//ppp + + +#ifdef JA2BETAVERSION + void InitSaveGameFilePosition(); + void InitLoadGameFilePosition(); + void SaveGameFilePosition( INT32 iPos, STR pMsg ); + void LoadGameFilePosition( INT32 iPos, STR pMsg ); + + + void WriteTempFileNameToFile( STR pFileName, UINT32 uiSizeOfFile, HFILE hSaveFile ); + void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGameID ); +#endif + +#ifdef JA2BETAVERSION + extern BOOLEAN ValidateSoldierInitLinks( UINT8 ubCode ); +#endif + void TruncateStrategicGroupSizes(); + + ///////////////////////////////////////////////////// +// +// Functions +// +///////////////////////////////////////////////////// + + +BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ) +{ + UINT32 uiNumBytesWritten=0; + HWFILE hFile=0; + SAVED_GAME_HEADER SaveGameHeader; + CHAR8 zSaveGameName[ 512 ]; + UINT32 uiSizeOfGeneralInfo = sizeof( GENERAL_SAVE_INFO ); + UINT8 saveDir[100]; + BOOLEAN fPausedStateBeforeSaving = gfGamePaused; + BOOLEAN fLockPauseStateBeforeSaving = gfLockPauseState; + INT32 iSaveLoadGameMessageBoxID = -1; + UINT16 usPosX, usActualWidth, usActualHeight; + BOOLEAN fWePausedIt = FALSE; + + + sprintf( (char *) saveDir, "%S", pMessageStrings[ MSG_SAVEDIRECTORY ] ); + +#ifdef JA2BETAVERSION +#ifndef CRIPPLED_VERSION +#endif +#endif + + if( ubSaveGameID >= NUM_SAVE_GAMES && ubSaveGameID != SAVE__ERROR_NUM && ubSaveGameID != SAVE__END_TURN_NUM ) + return( FALSE ); //ddd + + //clear out the save game header + memset( &SaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); + + if ( !GamePaused() ) + { + PauseBeforeSaveGame(); + fWePausedIt = TRUE; + } + + + #ifdef JA2BETAVERSION + InitShutDownMapTempFileTest( TRUE, "SaveMapTempFile", ubSaveGameID ); + #endif + + + //Place a message on the screen telling the user that we are saving the game + iSaveLoadGameMessageBoxID = PrepareMercPopupBox( iSaveLoadGameMessageBoxID, BASIC_MERC_POPUP_BACKGROUND, BASIC_MERC_POPUP_BORDER, zSaveLoadText[ SLG_SAVING_GAME_MESSAGE ], 300, 0, 0, 0, &usActualWidth, &usActualHeight); + + usPosX = ( SCREEN_WIDTH - usActualWidth ) / 2 ; + + RenderMercPopUpBoxFromIndex( iSaveLoadGameMessageBoxID, usPosX, iScreenHeightOffset + 160, FRAME_BUFFER ); + + InvalidateRegion(0,0,SCREEN_WIDTH,SCREEN_HEIGHT); + + ExecuteBaseDirtyRectQueue( ); + EndFrameBufferRender( ); + RefreshScreen( NULL ); + + if( RemoveMercPopupBoxFromIndex( iSaveLoadGameMessageBoxID ) ) + { + iSaveLoadGameMessageBoxID = -1; + } + + // + // make sure we redraw the screen when we are done + // + + //if we are in the game screen + if( guiCurrentScreen == GAME_SCREEN ) + { + SetRenderFlags( RENDER_FLAG_FULL ); + } + + else if( guiCurrentScreen == MAP_SCREEN ) + { + fMapPanelDirty = TRUE; + fTeamPanelDirty = TRUE; + fCharacterInfoPanelDirty = TRUE; + } + + else if( guiCurrentScreen == SAVE_LOAD_SCREEN ) + { + gfRedrawSaveLoadScreen = TRUE; + } + + + + + gubSaveGameLoc = ubSaveGameID; + +#ifdef JA2BETAVERSION + InitSaveGameFilePosition(); +#endif + + + //Set the fact that we are saving a game + gTacticalStatus.uiFlags |= LOADING_SAVED_GAME; + + + //Save the current sectors open temp files to the disk + if( !SaveCurrentSectorsInformationToTempItemFile() ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_TESTVERSION, L"ERROR in SaveCurrentSectorsInformationToTempItemFile()"); + goto FAILED_TO_SAVE; + } + + //if we are saving the quick save, + if( ubSaveGameID == 0 ) + { +#ifdef JA2BETAVERSION + //Increment the quicksave counter + guiCurrentQuickSaveNumber++; + + if( gfUseConsecutiveQuickSaveSlots ) + swprintf( pGameDesc, L"%s%03d", pMessageStrings[ MSG_QUICKSAVE_NAME ], guiCurrentQuickSaveNumber ); + else +#endif + swprintf( pGameDesc, pMessageStrings[ MSG_QUICKSAVE_NAME ] ); + } + + //If there was no string, add one + if( pGameDesc[0] == '\0' ) + wcscpy( pGameDesc, pMessageStrings[ MSG_NODESC ] ); + + //Check to see if the save directory exists + if( FileGetAttributes( (STR) saveDir ) == 0xFFFFFFFF ) + { + //ok the direcotry doesnt exist, create it + if( !MakeFileManDirectory( (CHAR8 *)saveDir ) ) + { + goto FAILED_TO_SAVE; + } + } + + //Create the name of the file + CreateSavedGameFileNameFromNumber( ubSaveGameID, zSaveGameName ); + + //if the file already exists, delete it + if( FileExists( zSaveGameName ) ) + { + if( !FileDelete( zSaveGameName ) ) + { + goto FAILED_TO_SAVE; + } + } + + // create the save game file + hFile = FileOpen( zSaveGameName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); + if( !hFile ) + { + goto FAILED_TO_SAVE; + } + + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Just Opened File" ); + #endif + + + + + + // + // If there are no enemy or civilians to save, we have to check BEFORE savinf the sector info struct because + // the NewWayOfSavingEnemyAndCivliansToTempFile will RESET the civ or enemy flag AFTER they have been saved. + // + NewWayOfSavingEnemyAndCivliansToTempFile( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, TRUE, TRUE ); + NewWayOfSavingEnemyAndCivliansToTempFile( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, FALSE, TRUE ); + + + + + + + + // + // Setup the save game header + // + + SaveGameHeader.uiSavedGameVersion = guiSavedGameVersion; + wcscpy( SaveGameHeader.sSavedGameDesc, pGameDesc ); + strcpy( SaveGameHeader.zGameVersionNumber, czVersionNumber ); + + SaveGameHeader.uiFlags; + + //The following will be used to quickly access info to display in the save/load screen + SaveGameHeader.uiDay = GetWorldDay(); + SaveGameHeader.ubHour = (UINT8)GetWorldHour(); + SaveGameHeader.ubMin = (UINT8)guiMin; + + //copy over the initial game options + memcpy( &SaveGameHeader.sInitialGameOptions, &gGameOptions, sizeof( GAME_OPTIONS ) ); + + //Get the sector value to save. + GetBestPossibleSectorXYZValues( &SaveGameHeader.sSectorX, &SaveGameHeader.sSectorY, &SaveGameHeader.bSectorZ ); + +/* + + //if the current sector is valid + if( gfWorldLoaded ) + { + SaveGameHeader.sSectorX = gWorldSectorX; + SaveGameHeader.sSectorY = gWorldSectorY; + SaveGameHeader.bSectorZ = gbWorldSectorZ; + } + else if( Squad[ iCurrentTacticalSquad ][ 0 ] && iCurrentTacticalSquad != NO_CURRENT_SQUAD ) + { +// if( Squad[ iCurrentTacticalSquad ][ 0 ]->bAssignment != IN_TRANSIT ) + { + SaveGameHeader.sSectorX = Squad[ iCurrentTacticalSquad ][ 0 ]->sSectorX; + SaveGameHeader.sSectorY = Squad[ iCurrentTacticalSquad ][ 0 ]->sSectorY; + SaveGameHeader.bSectorZ = Squad[ iCurrentTacticalSquad ][ 0 ]->bSectorZ; + } + } + else + { + INT16 sSoldierCnt; + SOLDIERTYPE *pSoldier; + INT16 bLastTeamID; + INT8 bCount=0; + BOOLEAN fFoundAMerc=FALSE; + + // Set locator to first merc + sSoldierCnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + + for ( pSoldier = MercPtrs[ sSoldierCnt ]; sSoldierCnt <= bLastTeamID; sSoldierCnt++,pSoldier++) + { + if( pSoldier->bActive ) + { + if ( pSoldier->bAssignment != IN_TRANSIT && !pSoldier->fBetweenSectors) + { + SaveGameHeader.sSectorX = pSoldier->sSectorX; + SaveGameHeader.sSectorY = pSoldier->sSectorY; + SaveGameHeader.bSectorZ = pSoldier->bSectorZ; + fFoundAMerc = TRUE; + break; + } + } + } + + if( !fFoundAMerc ) + { + SaveGameHeader.sSectorX = gWorldSectorX; + SaveGameHeader.sSectorY = gWorldSectorY; + SaveGameHeader.bSectorZ = gbWorldSectorZ; + } + } +*/ + + SaveGameHeader.ubNumOfMercsOnPlayersTeam = NumberOfMercsOnPlayerTeam(); + SaveGameHeader.iCurrentBalance = LaptopSaveInfo.iCurrentBalance; + + + SaveGameHeader.uiCurrentScreen = guiPreviousOptionScreen; + + SaveGameHeader.fAlternateSector = GetSectorFlagStatus( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, SF_USE_ALTERNATE_MAP ); + + if( gfWorldLoaded ) + { + SaveGameHeader.fWorldLoaded = TRUE; + SaveGameHeader.ubLoadScreenID = GetLoadScreenID( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + } + else + { + SaveGameHeader.fWorldLoaded = FALSE; + SaveGameHeader.ubLoadScreenID = 0; + } + + SaveGameHeader.uiRandom = Random( RAND_MAX ); + + // + // Save the Save Game header file + // + + + FileWrite( hFile, &SaveGameHeader, sizeof( SAVED_GAME_HEADER ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( SAVED_GAME_HEADER ) ) + { + goto FAILED_TO_SAVE; + } + + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Save Game Header" ); + #endif + + guiJA2EncryptionSet = CalcJA2EncryptionSet( &SaveGameHeader ); + + // + //Save the gTactical Status array, plus the curent secotr location + // + if( !SaveTacticalStatusToSavedGame( hFile ) ) + { + goto FAILED_TO_SAVE; + } + + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Tactical Status" ); + #endif + + + + + + // save the game clock info + if( !SaveGameClock( hFile, fPausedStateBeforeSaving, fLockPauseStateBeforeSaving ) ) + { + goto FAILED_TO_SAVE; + } + + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Game Clock" ); + #endif + + + + + // save the strategic events + if( !SaveStrategicEventsToSavedGame( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Strategic Events" ); + #endif + + + + if( !SaveLaptopInfoToSavedGame( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Laptop Info" ); + #endif + + // + // Save the merc profiles + // + if( !SaveMercProfiles( hFile ) ) + { + goto FAILED_TO_SAVE; + } + + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Merc Profiles" ); + #endif + + + + + // + // Save the soldier structure + // + if( !SaveSoldierStructure( hFile ) ) + { + goto FAILED_TO_SAVE; + } + + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Soldier Structure" ); + #endif + + + //Save the Finaces Data file + if( !SaveFilesToSavedGame( FINANCES_DATA_FILE, hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Finances Data File" ); + #endif + + + + //Save the history file + if( !SaveFilesToSavedGame( HISTORY_DATA_FILE, hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "History file" ); + #endif + + + + //Save the Laptop File file + if( !SaveFilesToSavedGame( FILES_DAT_FILE, hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "The Laptop FILES file" ); + #endif + + + + + //Save email stuff to save file + if( !SaveEmailToSavedGame( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Email " ); + #endif + + + + //Save the strategic information + if( !SaveStrategicInfoToSavedFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Strategic Information" ); + #endif + + + + + //save the underground information + if( !SaveUnderGroundSectorInfoToSaveGame( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Underground Information" ); + #endif + + + + + //save the squad info + if( !SaveSquadInfoToSavedGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Squad Info" ); + #endif + + + + + if( !SaveStrategicMovementGroupsToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Strategic Movement Groups" ); + #endif + + + + + + //Save all the map temp files from the maps\temp directory into the saved game file + if( !SaveMapTempFilesToSavedGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "All the Map Temp files" ); + #endif + + + + + + if( !SaveQuestInfoToSavedGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Quest Info" ); + #endif + + + + + if( !SaveOppListInfoToSavedGame( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "OppList info" ); + #endif + + + + + + if( !SaveMapScreenMessagesToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "MapScreen Messages" ); + #endif + + + + + + if( !SaveNPCInfoToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "NPC Info" ); + #endif + + + + + + if( !SaveKeyTableToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "KeyTable" ); + #endif + + + + + if( !SaveTempNpcQuoteArrayToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "NPC Temp Quote File" ); + #endif + + + + + + if( !SavePreRandomNumbersToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "PreGenerated Random Files" ); + #endif + + + + + + if( !SaveSmokeEffectsToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Smoke Effect Structures" ); + #endif + + + if( !SaveArmsDealerInventoryToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Arms Dealers Inventory" ); + #endif + + + + + if( !SaveGeneralInfo( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Misc. Info" ); + #endif + + + + if( !SaveMineStatusToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Mine Status" ); + #endif + + + + + if( !SaveStrategicTownLoyaltyToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Town Loyalty" ); + #endif + + + + if( !SaveVehicleInformationToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Vehicle Information" ); + #endif + + + + if( !SaveBulletStructureToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Bullet Information" ); + #endif + + + + if( !SavePhysicsTableToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Physics Table" ); + #endif + + + + + + if( !SaveAirRaidInfoToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Air Raid Info" ); + #endif + + + if( !SaveTeamTurnsToTheSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Team Turn Info" ); + #endif + + + + if( !SaveExplosionTableToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Explosion Table" ); + #endif + + + + if( !SaveCreatureDirectives( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Creature Spreading" ); + #endif + + + if( !SaveStrategicStatusToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Strategic Status" ); + #endif + + + + if( !SaveStrategicAI( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Strategic AI" ); + #endif + + + if( !SaveLightEffectsToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Lighting Effects" ); + #endif + + + if( !SaveWatchedLocsToSavedGame( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Watched Locs Info" ); + #endif + + if( !SaveItemCursorToSavedGame( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "ItemCursor Info" ); + #endif + + if( !SaveCivQuotesToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Civ Quote System" ); + #endif + + if( !SaveBackupNPCInfoToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Backed up NPC Info" ); + #endif + + if ( !SaveMeanwhileDefsFromSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Meanwhile Definitions" ); + #endif + + // save meanwhiledefs + + if ( !SaveSchedules( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Schedules" ); + #endif + + // Save extra vehicle info + if ( !NewSaveVehicleMovementInfoToSavedGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + + SaveGameFilePosition( FileGetPos( hFile ), "Vehicle Movement Stuff" ); + #endif + + + // Save contract renewal sequence stuff + if ( !SaveContractRenewalDataToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Contract Renewal Data" ); + #endif + + + // Save leave list stuff + if ( !SaveLeaveItemList( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "leave list" ); + #endif + + + //do the new way of saving bobbyr mail order items + if( !NewWayOfSavingBobbyRMailOrdersToSaveGameFile( hFile ) ) + { + goto FAILED_TO_SAVE; + } + #ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "New way of saving Bobby R mailorders" ); + #endif + + + //sss + + //Close the saved game file + FileClose( hFile ); + + + //if we succesfully saved the game, mark this entry as the last saved game file + if( ubSaveGameID != SAVE__ERROR_NUM && ubSaveGameID != SAVE__END_TURN_NUM ) + { + gGameSettings.bLastSavedGameSlot = ubSaveGameID; + } + + //Save the save game settings + SaveGameSettings(); + + // + // Display a screen message that the save was succesful + // + + //if its the quick save slot + if( ubSaveGameID == 0 ) + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, pMessageStrings[ MSG_SAVESUCCESS ] ); + } +//#ifdef JA2BETAVERSION + else if( ubSaveGameID == SAVE__END_TURN_NUM ) + { +// ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, pMessageStrings[ MSG_END_TURN_AUTO_SAVE ] ); + } +//#endif + else + { + ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, pMessageStrings[ MSG_SAVESLOTSUCCESS ] ); + } + + //restore the music mode + SetMusicMode( gubMusicMode ); + + //Unset the fact that we are saving a game + gTacticalStatus.uiFlags &= ~LOADING_SAVED_GAME; + + UnPauseAfterSaveGame(); + + #ifdef JA2BETAVERSION + InitShutDownMapTempFileTest( FALSE, "SaveMapTempFile", ubSaveGameID ); + #endif + + #ifdef JA2BETAVERSION + ValidateSoldierInitLinks( 2 ); + #endif + + //Check for enough free hard drive space + NextLoopCheckForEnoughFreeHardDriveSpace(); + + return( TRUE ); + + //if there is an error saving the game +FAILED_TO_SAVE: + +#ifdef JA2BETAVERSION + SaveGameFilePosition( FileGetPos( hFile ), "Failed to Save!!!" ); +#endif + + FileClose( hFile ); + + if ( fWePausedIt ) + { + UnPauseAfterSaveGame(); + } + + //Delete the failed attempt at saving + DeleteSaveGameNumber( ubSaveGameID ); + + //Put out an error message + ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, zSaveLoadText[SLG_SAVE_GAME_ERROR] ); + + #ifdef JA2BETAVERSION + InitShutDownMapTempFileTest( FALSE, "SaveMapTempFile", ubSaveGameID ); + #endif + + //Check for enough free hard drive space + NextLoopCheckForEnoughFreeHardDriveSpace(); + +#ifdef JA2BETAVERSION + if( fDisableDueToBattleRoster || fDisableMapInterfaceDueToBattle ) + { + gubReportMapscreenLock = 2; + } +#endif + + return( FALSE ); +} + + + +UINT32 guiBrokenSaveGameVersion = 0; + +BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ) +{ + HWFILE hFile; + SAVED_GAME_HEADER SaveGameHeader; + UINT32 uiNumBytesRead=0; + + INT16 sLoadSectorX; + INT16 sLoadSectorY; + INT8 bLoadSectorZ; + CHAR8 zSaveGameName[ 512 ]; + UINT32 uiSizeOfGeneralInfo = sizeof( GENERAL_SAVE_INFO ); + + UINT32 uiRelStartPerc; + UINT32 uiRelEndPerc; + +#ifdef JA2BETAVERSION + gfDisplaySaveGamesNowInvalidatedMsg = FALSE; +#endif + + uiRelStartPerc = uiRelEndPerc =0; + + TrashAllSoldiers( ); + + //Empty the dialogue Queue cause someone could still have a quote in waiting + EmptyDialogueQueue( ); + + //If there is someone talking, stop them + StopAnyCurrentlyTalkingSpeech( ); + + ZeroAnimSurfaceCounts( ); + + ShutdownNPCQuotes(); + + +#ifdef JA2BETAVERSION + //AssertMsg( uiSizeOfGeneralInfo == 1024, String( "Saved General info is NOT 1024, it is %d. DF 1.", uiSizeOfGeneralInfo ) ); +#endif + + //is it a valid save number + if( ubSavedGameID >= NUM_SAVE_GAMES ) + { + if( ubSavedGameID != SAVE__END_TURN_NUM ) + return( FALSE ); + } + else if( !gbSaveGameArray[ ubSavedGameID ] ) + return( FALSE ); + + + #ifdef JA2BETAVERSION + InitShutDownMapTempFileTest( TRUE, "LoadMapTempFile", ubSavedGameID ); + #endif + + + //Used in mapescreen to disable the annoying 'swoosh' transitions + gfDontStartTransitionFromLaptop = TRUE; + + // Reset timer callbacks + gpCustomizableTimerCallback = NULL; + + gubSaveGameLoc = ubSavedGameID; +#ifdef JA2BETAVERSION + InitLoadGameFilePosition(); +#endif + + //Set the fact that we are loading a saved game + gTacticalStatus.uiFlags |= LOADING_SAVED_GAME; + + //Trash the existing world. This is done to ensure that if we are loading a game that doesn't have + //a world loaded, that we trash it beforehand -- else the player could theoretically enter that sector + //where it would be in a pre-load state. + TrashWorld(); + + + //Deletes all the Temp files in the Maps\Temp directory + InitTacticalSave( TRUE ); + + // ATE; Added to empry dialogue q + EmptyDialogueQueue( ); + + //Create the name of the file + CreateSavedGameFileNameFromNumber( ubSavedGameID, zSaveGameName ); + + // open the save game file + hFile = FileOpen( zSaveGameName, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Just Opened File" ); + #endif + + + //Load the Save Game header file + FileRead( hFile, &SaveGameHeader, sizeof( SAVED_GAME_HEADER ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( SAVED_GAME_HEADER ) ) + { + FileClose( hFile ); + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Save Game Header" ); + #endif + + guiJA2EncryptionSet = CalcJA2EncryptionSet( &SaveGameHeader ); + + guiBrokenSaveGameVersion = SaveGameHeader.uiSavedGameVersion; + + //if the player is loading up an older version of the game, and the person DOESNT have the cheats on, + if( SaveGameHeader.uiSavedGameVersion < 65 && !CHEATER_CHEAT_LEVEL( ) ) + { +#ifdef JA2BETAVERSION + gfDisplaySaveGamesNowInvalidatedMsg = TRUE; +#endif + //Fail loading the save + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + + //Store the loading screenID that was saved + gubLastLoadingScreenID = SaveGameHeader.ubLoadScreenID; + + //HACK + guiSaveGameVersion = SaveGameHeader.uiSavedGameVersion; + +/* + if( !LoadGeneralInfo( hFile ) ) + { + FileClose( hFile ); + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Misc info" ); + #endif +*/ + + + + //Load the gtactical status structure plus the current sector x,y,z + if( !LoadTacticalStatusFromSavedGame( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Tactical Status" ); + #endif + + + //This gets reset by the above function + gTacticalStatus.uiFlags |= LOADING_SAVED_GAME; + + + //Load the game clock ingo + if( !LoadGameClock( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Game Clock" ); + #endif + + + //if we are suppose to use the alternate sector + if( SaveGameHeader.fAlternateSector ) + { + SetSectorFlag( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, SF_USE_ALTERNATE_MAP ); + gfUseAlternateMap = TRUE; + } + + + //if the world was loaded when saved, reload it, otherwise dont + if( SaveGameHeader.fWorldLoaded || SaveGameHeader.uiSavedGameVersion < 50 ) + { + //Get the current world sector coordinates + sLoadSectorX = gWorldSectorX; + sLoadSectorY = gWorldSectorY; + bLoadSectorZ = gbWorldSectorZ; + + // This will guarantee that the sector will be loaded + gbWorldSectorZ = -1; + + + //if we should load a sector ( if the person didnt just start the game game ) + if( ( gWorldSectorX != 0 ) && ( gWorldSectorY != 0 ) ) + { + //Load the sector + SetCurrentWorldSector( sLoadSectorX, sLoadSectorY, bLoadSectorZ ); + } + } + else + { //By clearing these values, we can avoid "in sector" checks -- at least, that's the theory. + gWorldSectorX = gWorldSectorY = 0; + + //Since there is no + if( SaveGameHeader.sSectorX == -1 || SaveGameHeader.sSectorY == -1 || SaveGameHeader.bSectorZ == -1 ) + gubLastLoadingScreenID = LOADINGSCREEN_HELI; + else + gubLastLoadingScreenID = GetLoadScreenID( SaveGameHeader.sSectorX, SaveGameHeader.sSectorY, SaveGameHeader.bSectorZ ); + + BeginLoadScreen(); + } + + CreateLoadingScreenProgressBar(); + SetProgressBarColor( 0, 0, 0, 150 ); + +#ifdef JA2BETAVERSION + //set the font + SetProgressBarMsgAttributes( 0, FONT12ARIAL, FONT_MCOLOR_WHITE, 0 ); + + // + // Set the tile so we don see the text come up + // + + //if the world is unloaded, we must use the save buffer for the text + if( SaveGameHeader.fWorldLoaded ) + SetProgressBarTextDisplayFlag( 0, TRUE, TRUE, FALSE ); + else + SetProgressBarTextDisplayFlag( 0, TRUE, TRUE, TRUE ); +#endif + + uiRelStartPerc = 0; + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Strategic Events..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + //load the game events + if( !LoadStrategicEventsFromSavedGame( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Strategic Events" ); + #endif + + + uiRelEndPerc += 0; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Laptop Info" ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( !LoadLaptopInfoFromSavedGame( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Laptop Info" ); + #endif + + + + uiRelEndPerc += 0; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Merc Profiles..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + // + // Load all the saved Merc profiles + // + if( !LoadSavedMercProfiles( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Merc Profiles" ); + #endif + + + + uiRelEndPerc += 30; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Soldier Structure..." ); + uiRelStartPerc = uiRelEndPerc; + + + // + // Load the soldier structure info + // + if( !LoadSoldierStructure( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Soldier Structure" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Finances Data File..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + // + // Load the Finances Data and write it to a new file + // + if( !LoadFilesFromSavedGame( FINANCES_DATA_FILE, hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Finances Data File" ); + #endif + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"History File..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + // + // Load the History Data and write it to a new file + // + if( !LoadFilesFromSavedGame( HISTORY_DATA_FILE, hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "History File" ); + #endif + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"The Laptop FILES file..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + // + // Load the Files Data and write it to a new file + // + if( !LoadFilesFromSavedGame( FILES_DAT_FILE, hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "The Laptop FILES file" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Email..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + // Load the data for the emails + if( !LoadEmailFromSavedGame( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Email" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Strategic Information..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + //Load the strategic Information + if( !LoadStrategicInfoFromSavedFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Strategic Information" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"UnderGround Information..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + //Load the underground information + if( !LoadUnderGroundSectorInfoFromSavedGame( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "UnderGround Information" ); + #endif + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Squad Info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + // Load all the squad info from the saved game file + if( !LoadSquadInfoFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Squad Info" ); + #endif + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Strategic Movement Groups..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + //Load the group linked list + if( !LoadStrategicMovementGroupsFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Strategic Movement Groups" ); + #endif + + + uiRelEndPerc += 30; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"All the Map Temp files..." ); + uiRelStartPerc = uiRelEndPerc; + + + // Load all the map temp files from the saved game file into the maps\temp directory + if( !LoadMapTempFilesFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "All the Map Temp files" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Quest Info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( !LoadQuestInfoFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Quest Info" ); + #endif + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"OppList Info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + if( !LoadOppListInfoFromSavedGame( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "OppList Info" ); + #endif + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"MapScreen Messages..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( !LoadMapScreenMessagesFromSaveGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "MapScreen Messages" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"NPC Info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( !LoadNPCInfoFromSavedGameFile( hFile, SaveGameHeader.uiSavedGameVersion ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "NPC Info" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"KeyTable..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( !LoadKeyTableFromSaveedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "KeyTable" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Npc Temp Quote File..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + if( !LoadTempNpcQuoteArrayToSaveGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Npc Temp Quote File" ); + #endif + + + + + uiRelEndPerc += 0; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"PreGenerated Random Files..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + if( !LoadPreRandomNumbersFromSaveGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "PreGenerated Random Files" ); + #endif + + + + + uiRelEndPerc += 0; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Smoke Effect Structures..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( !LoadSmokeEffectsFromLoadGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Smoke Effect Structures" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Arms Dealers Inventory..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( !LoadArmsDealerInventoryFromSavedGameFile( hFile, ( BOOLEAN )( SaveGameHeader.uiSavedGameVersion >= 54 ), ( BOOLEAN )( SaveGameHeader.uiSavedGameVersion >= 55 ) ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Arms Dealers Inventory" ); + #endif + + + + uiRelEndPerc += 0; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Misc info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + if( !LoadGeneralInfo( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Misc info" ); + #endif + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Mine Status..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( !LoadMineStatusFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Mine Status" ); + #endif + + + + + uiRelEndPerc += 0; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Town Loyalty..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + + if( SaveGameHeader.uiSavedGameVersion >= 21 ) + { + if( !LoadStrategicTownLoyaltyFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Town Loyalty" ); + #endif + } + + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Vehicle Information..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 22 ) + { + if( !LoadVehicleInformationFromSavedGameFile( hFile, SaveGameHeader.uiSavedGameVersion ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Vehicle Information" ); + #endif + } + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Bullet Information..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 24 ) + { + if( !LoadBulletStructureFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Bullet Information" ); + #endif + } + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Physics table..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + + if( SaveGameHeader.uiSavedGameVersion >= 24 ) + { + if( !LoadPhysicsTableFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Physics table" ); + #endif + } + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Air Raid Info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 24 ) + { + if( !LoadAirRaidInfoFromSaveGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Air Raid Info" ); + #endif + } + + + + uiRelEndPerc += 0; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Team Turn Info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 24 ) + { + if( !LoadTeamTurnsFromTheSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Team Turn Info" ); + #endif + } + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Explosion Table..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 25 ) + { + if( !LoadExplosionTableFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Explosion Table" ); + #endif + } + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Creature Spreading..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + + if( SaveGameHeader.uiSavedGameVersion >= 27 ) + { + if( !LoadCreatureDirectives( hFile, SaveGameHeader.uiSavedGameVersion ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Creature Spreading" ); + #endif + } + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Strategic Status..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + + if( SaveGameHeader.uiSavedGameVersion >= 28 ) + { + if( !LoadStrategicStatusFromSaveGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Strategic Status" ); + #endif + } + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Strategic AI..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 31 ) + { + if( !LoadStrategicAI( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Strategic AI" ); + #endif + } + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Lighting Effects..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 37 ) + { + if( !LoadLightEffectsFromLoadGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return(FALSE); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Lighting Effects" ); + #endif + } + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Watched Locs Info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 38 ) + { + if ( !LoadWatchedLocsFromSavedGame( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Watched Locs Info" ); + #endif + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Item cursor Info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 39 ) + { + if ( !LoadItemCursorFromSavedGame( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Item cursor Info" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Civ Quote System..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 51 ) + { + if( !LoadCivQuotesFromLoadGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return FALSE; + } + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Civ Quote System" ); + #endif + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Backed up NPC Info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 53 ) + { + if( !LoadBackupNPCInfoFromSavedGameFile( hFile, SaveGameHeader.uiSavedGameVersion ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Backed up NPC Info" ); + #endif + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Meanwhile definitions..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 58 ) + { + if( !LoadMeanwhileDefsFromSaveGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Meanwhile definitions" ); + #endif + } + else + { + memcpy( &gMeanwhileDef[gCurrentMeanwhileDef.ubMeanwhileID], &gCurrentMeanwhileDef, sizeof( MEANWHILE_DEFINITION ) ); + } + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Schedules..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 59 ) + { + // trash schedules loaded from map + DestroyAllSchedulesWithoutDestroyingEvents(); + if ( !LoadSchedulesFromSave( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Schedules" ); + #endif + } + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Extra Vehicle Info..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion >= 61 ) + { + if( SaveGameHeader.uiSavedGameVersion < 84 ) + { + if ( !LoadVehicleMovementInfoFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Extra Vehicle Info" ); + #endif + } + else + { + if ( !NewLoadVehicleMovementInfoFromSavedGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Extra Vehicle Info" ); + #endif + } + } + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Contract renweal sequence stuff..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + if( SaveGameHeader.uiSavedGameVersion < 62 ) + { + // the older games had a bug where this flag was never being set + gfResetAllPlayerKnowsEnemiesFlags = TRUE; + } + + if( SaveGameHeader.uiSavedGameVersion >= 67 ) + { + if ( !LoadContractRenewalDataFromSaveGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Contract renweal sequence stuff" ); + #endif + } + + + if( SaveGameHeader.uiSavedGameVersion >= 70 ) + { + if ( !LoadLeaveItemList( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "Leave List" ); + #endif + } + + if( SaveGameHeader.uiSavedGameVersion <= 73 ) + { + // Patch vehicle fuel + AddVehicleFuelToSave( ); + } + + + if( SaveGameHeader.uiSavedGameVersion >= 85 ) + { + if ( !NewWayOfLoadingBobbyRMailOrdersToSaveGameFile( hFile ) ) + { + FileClose( hFile ); + guiSaveGameVersion=0; + return( FALSE ); + } + #ifdef JA2BETAVERSION + LoadGameFilePosition( FileGetPos( hFile ), "New way of loading Bobby R mailorders" ); + #endif + } + + //If there are any old Bobby R Mail orders, tranfer them to the new system + if( SaveGameHeader.uiSavedGameVersion < 85 ) + { + HandleOldBobbyRMailOrders(); + } + + + ///lll + + + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Final Checks..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + + + // + //Close the saved game file + // + FileClose( hFile ); + + // ATE: Patch? Patch up groups.....( will only do for old saves.. ) + UpdatePersistantGroupsFromOldSave( SaveGameHeader.uiSavedGameVersion ); + + + if( SaveGameHeader.uiSavedGameVersion <= 40 ) + { + // Cancel all pending purchase orders for BobbyRay's. Starting with version 41, the BR orders events are + // posted with the usItemIndex itself as the parameter, rather than the inventory slot index. This was + // done to make it easier to modify BR's traded inventory lists later on without breaking saves. + CancelAllPendingBRPurchaseOrders(); + } + + + //if the world is loaded, apply the temp files to the loaded map + if( SaveGameHeader.fWorldLoaded || SaveGameHeader.uiSavedGameVersion < 50 ) + { + // Load the current sectors Information From the temporary files + if( !LoadCurrentSectorsInformationFromTempItemsFile() ) + { + InitExitGameDialogBecauseFileHackDetected(); + guiSaveGameVersion=0; + return( TRUE ); + } + } + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Final Checks..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + InitAI(); + + //Update the mercs in the sector with the new soldier info + UpdateMercsInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + + //ReconnectSchedules(); + PostSchedules(); + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Final Checks..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + //Reset the lighting level if we are outside + if( gbWorldSectorZ == 0 ) + LightSetBaseLevel( GetTimeOfDayAmbientLightLevel() ); + + //if we have been to this sector before +// if( SectorInfo[ SECTOR( gWorldSectorX,gWorldSectorY) ].uiFlags & SF_ALREADY_VISITED ) + { + //Reset the fact that we are loading a saved game + gTacticalStatus.uiFlags &= ~LOADING_SAVED_GAME; + } + + // CJC January 13: we can't do this because (a) it resets militia IN THE MIDDLE OF + // COMBAT, and (b) if we add militia to the teams while LOADING_SAVED_GAME is set, + // the team counters will not be updated properly!!! +// ResetMilitia(); + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Final Checks..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + //if the UI was locked in the saved game file + if( gTacticalStatus.ubAttackBusyCount > 1 ) + { + //Lock the ui + SetUIBusy( (UINT8)gusSelectedSoldier ); + } + + //Reset the shadow + SetFontShadow( DEFAULT_SHADOW ); + +#ifdef JA2BETAVERSION + //AssertMsg( uiSizeOfGeneralInfo == 1024, String( "Saved General info is NOT 1024, it is %d. DF 1.", uiSizeOfGeneralInfo ) ); +#endif + + //if we succesfully LOADED! the game, mark this entry as the last saved game file + gGameSettings.bLastSavedGameSlot = ubSavedGameID; + + //Save the save game settings + SaveGameSettings(); + + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Final Checks..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + //Reset the Ai Timer clock + giRTAILastUpdateTime = 0; + + //if we are in tactical + if( guiScreenToGotoAfterLoadingSavedGame == GAME_SCREEN ) + { + //Initialize the current panel + InitializeCurrentPanel( ); + + SelectSoldier( gusSelectedSoldier, FALSE, TRUE ); + } + + uiRelEndPerc += 1; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Final Checks..." ); + RenderProgressBar( 0, 100 ); + uiRelStartPerc = uiRelEndPerc; + + + // init extern faces + InitalizeStaticExternalNPCFaces( ); + + // load portraits + LoadCarPortraitValues( ); + + // OK, turn OFF show all enemies.... + gTacticalStatus.uiFlags&= (~SHOW_ALL_MERCS ); + gTacticalStatus.uiFlags &= ~SHOW_ALL_ITEMS ; + + #ifdef JA2BETAVERSION + InitShutDownMapTempFileTest( FALSE, "LoadMapTempFile", ubSavedGameID ); + #endif + + if ( (gTacticalStatus.uiFlags & INCOMBAT) ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Setting attack busy count to 0 from load" ) ); + gTacticalStatus.ubAttackBusyCount = 0; + } + + if( SaveGameHeader.uiSavedGameVersion < 64 ) + { //Militia/enemies/creature team sizes have been changed from 32 to 20. This function + //will simply kill off the excess. This will allow the ability to load previous saves, though + //there will still be problems, though a LOT less than there would be without this call. + TruncateStrategicGroupSizes(); + } + + // ATE: if we are within this window where skyridder was foobared, fix! + if ( SaveGameHeader.uiSavedGameVersion >= 61 && SaveGameHeader.uiSavedGameVersion <= 65 ) + { + SOLDIERTYPE *pSoldier; + MERCPROFILESTRUCT *pProfile; + + if ( !fSkyRiderSetUp ) + { + // see if we can find him and remove him if so.... + pSoldier = FindSoldierByProfileID( SKYRIDER, FALSE ); + + if ( pSoldier != NULL ) + { + TacticalRemoveSoldier( pSoldier->ubID ); + } + + // add the pilot at a random location! + pProfile = &(gMercProfiles[ SKYRIDER ]); + switch( Random( 4 ) ) + { + case 0: + pProfile->sSectorX = 15; + pProfile->sSectorY = MAP_ROW_B; + pProfile->bSectorZ = 0; + break; + case 1: + pProfile->sSectorX = 14; + pProfile->sSectorY = MAP_ROW_E; + pProfile->bSectorZ = 0; + break; + case 2: + pProfile->sSectorX = 12; + pProfile->sSectorY = MAP_ROW_D; + pProfile->bSectorZ = 0; + break; + case 3: + pProfile->sSectorX = 16; + pProfile->sSectorY = MAP_ROW_C; + pProfile->bSectorZ = 0; + break; + } + } + } + + if ( SaveGameHeader.uiSavedGameVersion < 68 ) + { + // correct bVehicleUnderRepairID for all mercs + UINT8 ubID; + for( ubID = 0; ubID < MAXMERCS; ubID++ ) + { + Menptr[ ubID ].bVehicleUnderRepairID = -1; + } + } + + if ( SaveGameHeader.uiSavedGameVersion < 73 ) + { + if( LaptopSaveInfo.fMercSiteHasGoneDownYet ) + LaptopSaveInfo.fFirstVisitSinceServerWentDown = 2; + } + + + //Update the MERC merc contract lenght. Before save version 77 the data was stored in the SOLDIERTYPE, + //after 77 the data is stored in the profile + if ( SaveGameHeader.uiSavedGameVersion < 77 ) + { + UpdateMercMercContractInfo(); + } + + + if ( SaveGameHeader.uiSavedGameVersion <= 89 ) + { + // ARM: A change was made in version 89 where refuel site availability now also depends on whether the player has + // airspace control over that sector. To update the settings immediately, must call it here. + UpdateRefuelSiteAvailability(); + } + + if( SaveGameHeader.uiSavedGameVersion < 91 ) + { + //update the amount of money that has been paid to speck + CalcAproximateAmountPaidToSpeck(); + } + + gfLoadedGame = TRUE; + + uiRelEndPerc = 100; + SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Done!" ); + RenderProgressBar( 0, 100 ); + + RemoveLoadingScreenProgressBar(); + + SetMusicMode( gMusicModeToPlay ); + +#ifndef JA2TESTVERSION + RESET_CHEAT_LEVEL( ); +#endif + +#ifdef JA2BETAVERSION + if( fDisableDueToBattleRoster || fDisableMapInterfaceDueToBattle ) + { + gubReportMapscreenLock = 1; + } +#endif + + // reset to 0 + guiSaveGameVersion=0; + + // reset once-per-convo records for everyone in the loaded sector + ResetOncePerConvoRecordsForAllNPCsInLoadedSector(); + + if ( !(gTacticalStatus.uiFlags & INCOMBAT) ) + { + // fix lingering attack busy count problem on loading saved game by resetting a.b.c + // if we're not in combat. + gTacticalStatus.ubAttackBusyCount = 0; + } + + // fix squads + CheckSquadMovementGroups(); + + //The above function LightSetBaseLevel adjusts ALL the level node light values including the merc node, + //we must reset the values + HandlePlayerTogglingLightEffects( FALSE ); + + + return( TRUE ); +} + + + + + + + +BOOLEAN SaveMercProfiles( HWFILE hFile ) +{ + UINT16 cnt; + UINT32 uiNumBytesWritten=0; + UINT32 uiSaveSize = sizeof( MERCPROFILESTRUCT ); + + //Lopp through all the profiles to save + for( cnt=0; cnt< NUM_PROFILES; cnt++) + { + gMercProfiles[ cnt ].uiProfileChecksum = ProfileChecksum( &(gMercProfiles[ cnt ]) ); + if ( guiSavedGameVersion < 87 ) + { + JA2EncryptedFileWrite( hFile, &gMercProfiles[cnt], uiSaveSize, &uiNumBytesWritten ); + } + else + { + NewJA2EncryptedFileWrite( hFile, &gMercProfiles[cnt], uiSaveSize, &uiNumBytesWritten ); + } + if( uiNumBytesWritten != uiSaveSize ) + { + return(FALSE); + } + } + + return( TRUE ); +} + + + +BOOLEAN LoadSavedMercProfiles( HWFILE hFile ) +{ + UINT16 cnt; + UINT32 uiNumBytesRead=0; + + //Lopp through all the profiles to Load + for( cnt=0; cnt< NUM_PROFILES; cnt++) + { + if ( guiSaveGameVersion < 87 ) + { + JA2EncryptedFileRead( hFile, &gMercProfiles[cnt], sizeof( MERCPROFILESTRUCT ), &uiNumBytesRead ); + } + else + { + NewJA2EncryptedFileRead( hFile, &gMercProfiles[cnt], sizeof( MERCPROFILESTRUCT ), &uiNumBytesRead ); + } + if( uiNumBytesRead != sizeof( MERCPROFILESTRUCT ) ) + { + return(FALSE); + } + if ( gMercProfiles[ cnt ].uiProfileChecksum != ProfileChecksum( &(gMercProfiles[ cnt ]) ) ) + { + return( FALSE ); + } + } + + return( TRUE ); +} + + + + + + //Not saving any of these in the soldier struct + + // struct TAG_level_node *pLevelNode; + // struct TAG_level_node *pExternShadowLevelNode; + // struct TAG_level_node *pRoofUILevelNode; + // UINT16 *pBackGround; + // UINT16 *pZBackground; + // UINT16 *pForcedShade; + // + // UINT16 *pEffectShades[ NUM_SOLDIER_EFFECTSHADES ]; // Shading tables for effects + // THROW_PARAMS *pThrowParams; + // UINT16 *pCurrentShade; + // UINT16 *pGlowShades[ 20 ]; // + // UINT16 *pShades[ NUM_SOLDIER_SHADES ]; // Shading tables + // UINT16 *p16BPPPalette; + // SGPPaletteEntry *p8BPPPalette + // OBJECTTYPE *pTempObject; + + +BOOLEAN SaveSoldierStructure( HWFILE hFile ) +{ + UINT16 cnt; + UINT32 uiNumBytesWritten=0; + UINT8 ubOne = 1; + UINT8 ubZero = 0; + + UINT32 uiSaveSize = sizeof( SOLDIERTYPE ); + + + + //Loop through all the soldier structs to save + for( cnt=0; cnt< TOTAL_SOLDIERS; cnt++) + { + + //if the soldier isnt active, dont add them to the saved game file. + if( !Menptr[ cnt ].bActive ) + { + // Save the byte specifing to NOT load the soldiers + FileWrite( hFile, &ubZero, 1, &uiNumBytesWritten ); + if( uiNumBytesWritten != 1 ) + { + return(FALSE); + } + } + + else + { + // Save the byte specifing to load the soldiers + FileWrite( hFile, &ubOne, 1, &uiNumBytesWritten ); + if( uiNumBytesWritten != 1 ) + { + return(FALSE); + } + + // calculate checksum for soldier + Menptr[ cnt ].uiMercChecksum = MercChecksum( &(Menptr[ cnt ]) ); + // Save the soldier structure + if ( guiSavedGameVersion < 87 ) + { + JA2EncryptedFileWrite( hFile, &Menptr[ cnt ], uiSaveSize, &uiNumBytesWritten ); + } + else + { + NewJA2EncryptedFileWrite( hFile, &Menptr[ cnt ], uiSaveSize, &uiNumBytesWritten ); + } + if( uiNumBytesWritten != uiSaveSize ) + { + return(FALSE); + } + + + + // + // Save all the pointer info from the structure + // + + + //Save the pMercPath + if( !SaveMercPathFromSoldierStruct( hFile, (UINT8)cnt ) ) + return( FALSE ); + + + + // + //do we have a KEY_ON_RING *pKeyRing; + // + + if( Menptr[ cnt ].pKeyRing != NULL ) + { + // write to the file saying we have the .... + FileWrite( hFile, &ubOne, 1, &uiNumBytesWritten ); + if( uiNumBytesWritten != 1 ) + { + return(FALSE); + } + + // Now save the .... + FileWrite( hFile, Menptr[ cnt ].pKeyRing, NUM_KEYS * sizeof( KEY_ON_RING ), &uiNumBytesWritten ); + if( uiNumBytesWritten != NUM_KEYS * sizeof( KEY_ON_RING ) ) + { + return(FALSE); + } + } + else + { + // write to the file saying we DO NOT have the Key ring + FileWrite( hFile, &ubZero, 1, &uiNumBytesWritten ); + if( uiNumBytesWritten != 1 ) + { + return(FALSE); + } + } + } + } + + return( TRUE ); +} + + + +BOOLEAN LoadSoldierStructure( HWFILE hFile ) +{ + UINT16 cnt; + UINT32 uiNumBytesRead=0; + SOLDIERTYPE SavedSoldierInfo; + UINT32 uiSaveSize = sizeof( SOLDIERTYPE ); + UINT8 ubId; + UINT8 ubOne = 1; + UINT8 ubActive = 1; + UINT32 uiPercentage; + + SOLDIERCREATE_STRUCT CreateStruct; + + //Loop through all the soldier and delete them all + for( cnt=0; cnt< TOTAL_SOLDIERS; cnt++) + { + TacticalRemoveSoldier( cnt ); + } + + + + //Loop through all the soldier structs to load + for( cnt=0; cnt< TOTAL_SOLDIERS; cnt++) + { + + //update the progress bar + uiPercentage = (cnt * 100) / (TOTAL_SOLDIERS-1); + + RenderProgressBar( 0, uiPercentage ); + + + //Read in a byte to tell us whether or not there is a soldier loaded here. + FileRead( hFile, &ubActive, 1, &uiNumBytesRead ); + if( uiNumBytesRead != 1 ) + { + return(FALSE); + } + + // if the soldier is not active, continue + if( !ubActive ) + { + continue; + } + + // else if there is a soldier + else + { + //Read in the saved soldier info into a Temp structure + if ( guiSaveGameVersion < 87 ) + { + JA2EncryptedFileRead( hFile, &SavedSoldierInfo, uiSaveSize, &uiNumBytesRead ); + } + else + { + NewJA2EncryptedFileRead( hFile, &SavedSoldierInfo, uiSaveSize, &uiNumBytesRead ); + } + if( uiNumBytesRead != uiSaveSize ) + { + return(FALSE); + } + // check checksum + if ( MercChecksum( &SavedSoldierInfo ) != SavedSoldierInfo.uiMercChecksum ) + { + return( FALSE ); + } + + //Make sure all the pointer references are NULL'ed out. + SavedSoldierInfo.pTempObject = NULL; + SavedSoldierInfo.pKeyRing = NULL; + SavedSoldierInfo.p8BPPPalette = NULL; + SavedSoldierInfo.p16BPPPalette = NULL; + memset( SavedSoldierInfo.pShades, 0, sizeof( UINT16* ) * NUM_SOLDIER_SHADES ); + memset( SavedSoldierInfo.pGlowShades, 0, sizeof( UINT16* ) * 20 ); + SavedSoldierInfo.pCurrentShade = NULL; + SavedSoldierInfo.pThrowParams = NULL; + SavedSoldierInfo.pLevelNode = NULL; + SavedSoldierInfo.pExternShadowLevelNode = NULL; + SavedSoldierInfo.pRoofUILevelNode = NULL; + SavedSoldierInfo.pBackGround = NULL; + SavedSoldierInfo.pZBackground = NULL; + SavedSoldierInfo.pForcedShade = NULL; + SavedSoldierInfo.pMercPath = NULL; + memset( SavedSoldierInfo.pEffectShades, 0, sizeof( UINT16* ) * NUM_SOLDIER_EFFECTSHADES ); + + + //if the soldier wasnt active, dont add them now. Advance to the next merc + //if( !SavedSoldierInfo.bActive ) + // continue; + + + //Create the new merc + memset( &CreateStruct, 0, sizeof( SOLDIERCREATE_STRUCT ) ); + CreateStruct.bTeam = SavedSoldierInfo.bTeam; + CreateStruct.ubProfile = SavedSoldierInfo.ubProfile; + CreateStruct.fUseExistingSoldier = TRUE; + CreateStruct.pExistingSoldier = &SavedSoldierInfo; + + if( !TacticalCreateSoldier( &CreateStruct, &ubId ) ) + return( FALSE ); + + + // Load the pMercPath + if( !LoadMercPathToSoldierStruct( hFile, ubId ) ) + return( FALSE ); + + + // + //do we have a KEY_ON_RING *pKeyRing; + // + + // Read the file to see if we have to load the keys + FileRead( hFile, &ubOne, 1, &uiNumBytesRead ); + if( uiNumBytesRead != 1 ) + { + return(FALSE); + } + + if( ubOne ) + { + // Now Load the .... + FileRead( hFile, Menptr[ cnt ].pKeyRing, NUM_KEYS * sizeof( KEY_ON_RING ), &uiNumBytesRead ); + if( uiNumBytesRead != NUM_KEYS * sizeof( KEY_ON_RING ) ) + { + return(FALSE); + } + + } + else + { + Assert( Menptr[ cnt ].pKeyRing == NULL ); + } + + //if the soldier is an IMP character + if( Menptr[cnt].ubWhatKindOfMercAmI == MERC_TYPE__PLAYER_CHARACTER && Menptr[cnt].bTeam == gbPlayerNum ) + { + ResetIMPCharactersEyesAndMouthOffsets( Menptr[ cnt ].ubProfile ); + } + + //if the saved game version is before x, calculate the amount of money paid to mercs + if( guiSaveGameVersion < 83 ) + { + //if the soldier is someone + if( Menptr[ cnt ].ubProfile != NO_PROFILE ) + { + if( Menptr[cnt].ubWhatKindOfMercAmI == MERC_TYPE__MERC ) + { + gMercProfiles[ Menptr[ cnt ].ubProfile ].uiTotalCostToDate = gMercProfiles[ Menptr[ cnt ].ubProfile ].sSalary * gMercProfiles[ Menptr[ cnt ].ubProfile ].iMercMercContractLength; + } + else + { + gMercProfiles[ Menptr[ cnt ].ubProfile ].uiTotalCostToDate = gMercProfiles[ Menptr[ cnt ].ubProfile ].sSalary * Menptr[ cnt ].iTotalContractLength; + } + } + } + +#ifdef GERMAN + // Fix neutral flags + if ( guiSaveGameVersion < 94 ) + { + if ( Menptr[ cnt].bTeam == OUR_TEAM && Menptr[ cnt ].bNeutral && Menptr[ cnt ].bAssignment != ASSIGNMENT_POW ) + { + // turn off neutral flag + Menptr[ cnt].bNeutral = FALSE; + } + } +#endif + // JA2Gold: fix next-to-previous attacker value + if ( guiSaveGameVersion < 99 ) + { + Menptr[ cnt ].ubNextToPreviousAttackerID = NOBODY; + } + + } + } + + // Fix robot + if ( guiSaveGameVersion <= 87 ) + { + SOLDIERTYPE * pSoldier; + + if ( gMercProfiles[ ROBOT ].inv[ VESTPOS ] == SPECTRA_VEST ) + { + // update this + gMercProfiles[ ROBOT ].inv[ VESTPOS ] = SPECTRA_VEST_18; + gMercProfiles[ ROBOT ].inv[ HELMETPOS ] = SPECTRA_HELMET_18; + gMercProfiles[ ROBOT ].inv[ LEGPOS ] = SPECTRA_LEGGINGS_18; + gMercProfiles[ ROBOT ].bAgility = 50; + pSoldier = FindSoldierByProfileID( ROBOT, FALSE ); + if ( pSoldier ) + { + pSoldier->inv[ VESTPOS ].usItem = SPECTRA_VEST_18; + pSoldier->inv[ HELMETPOS ].usItem = SPECTRA_HELMET_18; + pSoldier->inv[ LEGPOS ].usItem = SPECTRA_LEGGINGS_18; + pSoldier->bAgility = 50; + } + } + } + + return( TRUE ); +} + + +/* +BOOLEAN SavePtrInfo( PTR *pData, UINT32 uiSizeOfObject, HWFILE hFile ) +{ + UINT8 ubOne = 1; + UINT8 ubZero = 0; + UINT32 uiNumBytesWritten; + + if( pData != NULL ) + { + // write to the file saying we have the .... + FileWrite( hFile, &ubOne, 1, &uiNumBytesWritten ); + if( uiNumBytesWritten != 1 ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FAILED to Write Soldier Structure to File" ) ); + return(FALSE); + } + + // Now save the .... + FileWrite( hFile, pData, uiSizeOfObject, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSizeOfObject ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FAILED to Write Soldier Structure to File" ) ); + return(FALSE); + } + } + else + { + // write to the file saying we DO NOT have the ... + FileWrite( hFile, &ubZero, 1, &uiNumBytesWritten ); + if( uiNumBytesWritten != 1 ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FAILED to Write Soldier Structure to File" ) ); + return(FALSE); + } + } + + return( TRUE ); +} + + + +BOOLEAN LoadPtrInfo( PTR *pData, UINT32 uiSizeOfObject, HWFILE hFile ) +{ + UINT8 ubOne = 1; + UINT8 ubZero = 0; + UINT32 uiNumBytesRead; + + // Read the file to see if we have to load the .... + FileRead( hFile, &ubOne, 1, &uiNumBytesRead ); + if( uiNumBytesRead != 1 ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FAILED to Read Soldier Structure from File" ) ); + return(FALSE); + } + + if( ubOne ) + { + // if there is memory already allocated, free it + MemFree( pData ); + + //Allocate space for the structure data + *pData = MemAlloc( uiSizeOfObject ); + if( pData == NULL ) + return( FALSE ); + + // Now Load the .... + FileRead( hFile, pData, uiSizeOfObject, &uiNumBytesRead ); + if( uiNumBytesRead != uiSizeOfObject ) + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FAILED to Write Soldier Structure to File" ) ); + return(FALSE); + } + } + else + { + // if there is memory already allocated, free it + if( pData ) + { + MemFree( pData ); + pData = NULL; + } + } + + + return( TRUE ); +} +*/ + +BOOLEAN SaveFilesToSavedGame( STR pSrcFileName, HWFILE hFile ) +{ + UINT32 uiFileSize; + UINT32 uiNumBytesWritten=0; + HWFILE hSrcFile; + UINT8 *pData; + UINT32 uiNumBytesRead; + + + //open the file + hSrcFile = FileOpen( pSrcFileName, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + if( !hSrcFile ) + { + return( FALSE ); + } + + #ifdef JA2BETAVERSION + guiNumberOfMapTempFiles++; //Increment counter: To determine where the temp files are crashing + #endif + + + //Get the file size of the source data file + uiFileSize = FileGetSize( hSrcFile ); + if( uiFileSize == 0 ) + return( FALSE ); + + // Write the the size of the file to the saved game file + FileWrite( hFile, &uiFileSize, sizeof( UINT32 ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( UINT32 ) ) + { + return(FALSE); + } + + + + //Allocate a buffer to read the data into + pData = (UINT8 *) MemAlloc( uiFileSize ); + if( pData == NULL ) + return( FALSE ); + memset( pData, 0, uiFileSize); + + // Read the saource file into the buffer + FileRead( hSrcFile, pData, uiFileSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiFileSize ) + { + //Free the buffer + MemFree( pData ); + + return(FALSE); + } + + + + // Write the buffer to the saved game file + FileWrite( hFile, pData, uiFileSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiFileSize ) + { + //Free the buffer + MemFree( pData ); + + return(FALSE); + } + + //Free the buffer + MemFree( pData ); + + //Clsoe the source data file + FileClose( hSrcFile ); + + #ifdef JA2BETAVERSION + //Write out the name of the temp file so we can track whcih ones get loaded, and saved + WriteTempFileNameToFile( pSrcFileName, uiFileSize, hFile ); + #endif + + return( TRUE ); +} + + +BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile ) +{ + UINT32 uiFileSize; + UINT32 uiNumBytesWritten=0; + HWFILE hSrcFile; + UINT8 *pData; + UINT32 uiNumBytesRead; + + + + //If the source file exists, delete it + if( FileExists( pSrcFileName ) ) + { + if( !FileDelete( pSrcFileName ) ) + { + //unable to delete the original file + return( FALSE ); + } + } + + #ifdef JA2BETAVERSION + guiNumberOfMapTempFiles++; //Increment counter: To determine where the temp files are crashing + #endif + + //open the destination file to write to + hSrcFile = FileOpen( pSrcFileName, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE ); + if( !hSrcFile ) + { + //error, we cant open the saved game file + return( FALSE ); + } + + + // Read the size of the data + FileRead( hFile, &uiFileSize, sizeof( UINT32 ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( UINT32 ) ) + { + FileClose( hSrcFile ); + + return(FALSE); + } + + + //if there is nothing in the file, return; + if( uiFileSize == 0 ) + { + FileClose( hSrcFile ); + return( TRUE ); + } + + //Allocate a buffer to read the data into + pData = (UINT8 *) MemAlloc( uiFileSize ); + if( pData == NULL ) + { + FileClose( hSrcFile ); + return( FALSE ); + } + + + // Read into the buffer + FileRead( hFile, pData, uiFileSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiFileSize ) + { + FileClose( hSrcFile ); + + //Free the buffer + MemFree( pData ); + + return(FALSE); + } + + + + // Write the buffer to the new file + FileWrite( hSrcFile, pData, uiFileSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiFileSize ) + { + FileClose( hSrcFile ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("FAILED to Write to the %s File", pSrcFileName ) ); + //Free the buffer + MemFree( pData ); + + return(FALSE); + } + + //Free the buffer + MemFree( pData ); + + //Close the source data file + FileClose( hSrcFile ); + + #ifdef JA2BETAVERSION + WriteTempFileNameToFile( pSrcFileName, uiFileSize, hFile ); + #endif + return( TRUE ); +} + + +BOOLEAN SaveEmailToSavedGame( HWFILE hFile ) +{ + UINT32 uiNumOfEmails=0; + UINT32 uiSizeOfEmails=0; + EmailPtr pEmail = pEmailList; + EmailPtr pTempEmail = NULL; + UINT32 cnt; + UINT32 uiStringLength=0; + UINT32 uiNumBytesWritten=0; + + SavedEmailStruct SavedEmail; + + //loop through all the email to find out the total number + while(pEmail) + { + pEmail=pEmail->Next; + uiNumOfEmails++; + } + + uiSizeOfEmails = sizeof( Email ) * uiNumOfEmails; + + //write the number of email messages + FileWrite( hFile, &uiNumOfEmails, sizeof( UINT32 ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( UINT32 ) ) + { + return(FALSE); + } + + + //loop trhough all the emails, add each one individually + pEmail = pEmailList; + for( cnt=0; cntpSubject ) + 1 ) * 2; + + //write the length of the current emails subject to the saved game file + FileWrite( hFile, &uiStringLength, sizeof( UINT32 ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( UINT32 ) ) + { + return(FALSE); + } + + //write the subject of the current email to the saved game file + FileWrite( hFile, pEmail->pSubject, uiStringLength, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiStringLength ) + { + return(FALSE); + } + + + //Get the current emails data and asign it to the 'Saved email' struct + SavedEmail.usOffset = pEmail->usOffset; + SavedEmail.usLength = pEmail->usLength; + SavedEmail.ubSender = pEmail->ubSender; + SavedEmail.iDate = pEmail->iDate; + SavedEmail.iId = pEmail->iId; + SavedEmail.iFirstData = pEmail->iFirstData; + SavedEmail.uiSecondData = pEmail->uiSecondData; + SavedEmail.fRead = pEmail->fRead; + SavedEmail.fNew = pEmail->fNew; + SavedEmail.iThirdData = pEmail->iThirdData; + SavedEmail.iFourthData = pEmail->iFourthData; + SavedEmail.uiFifthData = pEmail->uiFifthData; + SavedEmail.uiSixData = pEmail->uiSixData; + + + // write the email header to the saved game file + FileWrite( hFile, &SavedEmail, sizeof( SavedEmailStruct ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( SavedEmailStruct ) ) + { + return(FALSE); + } + + //advance to the next email + pEmail = pEmail->Next; + } + + return( TRUE ); +} + + +BOOLEAN LoadEmailFromSavedGame( HWFILE hFile ) +{ + UINT32 uiNumOfEmails=0; + UINT32 uiSizeOfSubject=0; + EmailPtr pEmail = pEmailList; + EmailPtr pTempEmail = NULL; + UINT8 *pData = NULL; + UINT32 cnt; + SavedEmailStruct SavedEmail; + UINT32 uiNumBytesRead=0; + + //Delete the existing list of emails + ShutDownEmailList(); + + pEmailList = NULL; + //Allocate memory for the header node + pEmailList = (EmailPtr) MemAlloc( sizeof( Email ) ); + if( pEmailList == NULL ) + return( FALSE ); + + memset( pEmailList, 0, sizeof( Email ) ); + + //read in the number of email messages + FileRead( hFile, &uiNumOfEmails, sizeof( UINT32 ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( UINT32 ) ) + { + return(FALSE); + } + + //loop through all the emails, add each one individually + pEmail = pEmailList; + for( cnt=0; cntusOffset = SavedEmail.usOffset; + pTempEmail->usLength = SavedEmail.usLength; + pTempEmail->ubSender = SavedEmail.ubSender; + pTempEmail->iDate = SavedEmail.iDate; + pTempEmail->iId = SavedEmail.iId; + pTempEmail->fRead = SavedEmail.fRead; + pTempEmail->fNew = SavedEmail.fNew; + pTempEmail->pSubject = (STR16) pData; + pTempEmail->iFirstData = SavedEmail.iFirstData; + pTempEmail->uiSecondData = SavedEmail.uiSecondData; + pTempEmail->iThirdData = SavedEmail.iThirdData; + pTempEmail->iFourthData = SavedEmail.iFourthData; + pTempEmail->uiFifthData = SavedEmail.uiFifthData; + pTempEmail->uiSixData = SavedEmail.uiSixData; + + + //add the current email in + pEmail->Next = pTempEmail; + pTempEmail->Prev = pEmail; + + //moved to the next email + pEmail = pEmail->Next; + + AddMessageToPages( pTempEmail->iId ); + + } + + //if there are emails + if( cnt ) + { + //the first node of the LL was a dummy, node,get rid of it + pTempEmail = pEmailList; + pEmailList = pEmailList->Next; + pEmailList->Prev = NULL; + MemFree( pTempEmail ); + } + else + { + MemFree( pEmailList ); + pEmailList = NULL; + } + + return( TRUE ); +} + + +BOOLEAN SaveTacticalStatusToSavedGame( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + + //write the gTacticalStatus to the saved game file + FileWrite( hFile, &gTacticalStatus, sizeof( TacticalStatusType ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( TacticalStatusType ) ) + { + return(FALSE); + } + + // + //Save the current sector location to the saved game file + // + + // save gWorldSectorX + FileWrite( hFile, &gWorldSectorX, sizeof( gWorldSectorX ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( gWorldSectorX ) ) + { + return(FALSE); + } + + + // save gWorldSectorY + FileWrite( hFile, &gWorldSectorY, sizeof( gWorldSectorY ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( gWorldSectorY ) ) + { + return(FALSE); + } + + + // save gbWorldSectorZ + FileWrite( hFile, &gbWorldSectorZ, sizeof( gbWorldSectorZ ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( gbWorldSectorZ ) ) + { + return(FALSE); + } + + return( TRUE ); +} + + + +BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + + //Read the gTacticalStatus to the saved game file + FileRead( hFile, &gTacticalStatus, sizeof( TacticalStatusType ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( TacticalStatusType ) ) + { + return(FALSE); + } + + // + //Load the current sector location to the saved game file + // + + // Load gWorldSectorX + FileRead( hFile, &gWorldSectorX, sizeof( gWorldSectorX ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( gWorldSectorX ) ) + { + return(FALSE); + } + + + // Load gWorldSectorY + FileRead( hFile, &gWorldSectorY, sizeof( gWorldSectorY ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( gWorldSectorY ) ) + { + return(FALSE); + } + + + // Load gbWorldSectorZ + FileRead( hFile, &gbWorldSectorZ, sizeof( gbWorldSectorZ ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( gbWorldSectorZ ) ) + { + return(FALSE); + } + + return( TRUE ); +} + + + +BOOLEAN CopySavedSoldierInfoToNewSoldier( SOLDIERTYPE *pDestSourceInfo, SOLDIERTYPE *pSourceInfo ) +{ + + + //Copy the old soldier information over to the new structure + memcpy( pDestSourceInfo, pSourceInfo, sizeof( SOLDIERTYPE ) ); + + + return( TRUE ); +} + + +BOOLEAN SetMercsInsertionGridNo( ) +{ + UINT16 cnt=0; + + // loop through all the mercs + for ( cnt=0; cnt < TOTAL_SOLDIERS; cnt++ ) + { + //if the soldier is active + if( Menptr[ cnt ].bActive ) + { + + if( Menptr[ cnt ].sGridNo != NOWHERE ) + { + //set the insertion type to gridno + Menptr[ cnt ].ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + + //set the insertion gridno + Menptr[ cnt ].usStrategicInsertionData = Menptr[ cnt ].sGridNo; + + //set the gridno + Menptr[ cnt ].sGridNo = NOWHERE; + } + } + } + + return( TRUE ); +} + + +BOOLEAN SaveOppListInfoToSavedGame( HWFILE hFile ) +{ + UINT32 uiSaveSize=0; + UINT32 uiNumBytesWritten=0; + + + // Save the Public Opplist + uiSaveSize = MAXTEAMS * TOTAL_SOLDIERS; + FileWrite( hFile, gbPublicOpplist, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + // Save the Seen Oppenents + uiSaveSize = TOTAL_SOLDIERS * TOTAL_SOLDIERS; + FileWrite( hFile, gbSeenOpponents, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + + + // Save the Last Known Opp Locations + uiSaveSize = TOTAL_SOLDIERS * TOTAL_SOLDIERS; + FileWrite( hFile, gsLastKnownOppLoc, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + // Save the Last Known Opp Level + uiSaveSize = TOTAL_SOLDIERS * TOTAL_SOLDIERS; + FileWrite( hFile, gbLastKnownOppLevel, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + + // Save the Public Last Known Opp Locations + uiSaveSize = MAXTEAMS * TOTAL_SOLDIERS; + FileWrite( hFile, gsPublicLastKnownOppLoc, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + // Save the Public Last Known Opp Level + uiSaveSize = MAXTEAMS * TOTAL_SOLDIERS; + FileWrite( hFile, gbPublicLastKnownOppLevel, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + + // Save the Public Noise Volume + uiSaveSize = MAXTEAMS; + FileWrite( hFile, gubPublicNoiseVolume, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + // Save the Public Last Noise Gridno + uiSaveSize = MAXTEAMS; + FileWrite( hFile, gsPublicNoiseGridno, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + + + return( TRUE ); +} + + +BOOLEAN LoadOppListInfoFromSavedGame( HWFILE hFile ) +{ + UINT32 uiLoadSize=0; + UINT32 uiNumBytesRead=0; + + // Load the Public Opplist + uiLoadSize = MAXTEAMS * TOTAL_SOLDIERS; + FileRead( hFile, gbPublicOpplist, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + // Load the Seen Oppenents + uiLoadSize = TOTAL_SOLDIERS * TOTAL_SOLDIERS; + FileRead( hFile, gbSeenOpponents, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + + + // Load the Last Known Opp Locations + uiLoadSize = TOTAL_SOLDIERS * TOTAL_SOLDIERS; + FileRead( hFile, gsLastKnownOppLoc, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + // Load the Last Known Opp Level + uiLoadSize = TOTAL_SOLDIERS * TOTAL_SOLDIERS; + FileRead( hFile, gbLastKnownOppLevel, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + + // Load the Public Last Known Opp Locations + uiLoadSize = MAXTEAMS * TOTAL_SOLDIERS; + FileRead( hFile, gsPublicLastKnownOppLoc, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + // Load the Public Last Known Opp Level + uiLoadSize = MAXTEAMS * TOTAL_SOLDIERS; + FileRead( hFile, gbPublicLastKnownOppLevel, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + + // Load the Public Noise Volume + uiLoadSize = MAXTEAMS; + FileRead( hFile, gubPublicNoiseVolume, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + // Load the Public Last Noise Gridno + uiLoadSize = MAXTEAMS; + FileRead( hFile, gsPublicNoiseGridno, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + return( TRUE ); +} + +BOOLEAN SaveWatchedLocsToSavedGame( HWFILE hFile ) +{ + UINT32 uiArraySize; + UINT32 uiSaveSize=0; + UINT32 uiNumBytesWritten=0; + + uiArraySize = TOTAL_SOLDIERS * NUM_WATCHED_LOCS; + + // save locations of watched points + uiSaveSize = uiArraySize * sizeof( INT16 ); + FileWrite( hFile, gsWatchedLoc, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + uiSaveSize = uiArraySize * sizeof( INT8 ); + + FileWrite( hFile, gbWatchedLocLevel, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + FileWrite( hFile, gubWatchedLocPoints, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + FileWrite( hFile, gfWatchedLocReset, uiSaveSize, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiSaveSize ) + { + return( FALSE ); + } + + return( TRUE ); +} + + +BOOLEAN LoadWatchedLocsFromSavedGame( HWFILE hFile ) +{ + UINT32 uiArraySize; + UINT32 uiLoadSize=0; + UINT32 uiNumBytesRead=0; + + uiArraySize = TOTAL_SOLDIERS * NUM_WATCHED_LOCS; + + uiLoadSize = uiArraySize * sizeof( INT16 ); + FileRead( hFile, gsWatchedLoc, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + uiLoadSize = uiArraySize * sizeof( INT8 ); + FileRead( hFile, gbWatchedLocLevel, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + FileRead( hFile, gubWatchedLocPoints, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + FileRead( hFile, gfWatchedLocReset, uiLoadSize, &uiNumBytesRead ); + if( uiNumBytesRead != uiLoadSize ) + { + return( FALSE ); + } + + + return( TRUE ); +} + +void CreateSavedGameFileNameFromNumber( UINT8 ubSaveGameID, STR pzNewFileName ) +{ + //if we are creating the QuickSave file + if( ubSaveGameID == 0 ) + { +#ifdef JA2BETAVERSION + //if the user wants to have consecutive quick saves + if( gfUseConsecutiveQuickSaveSlots ) + { + //if we are loading a game, and the user hasnt saved any consecutinve saves, load the defualt save + if( guiCurrentQuickSaveNumber == 0 ) + sprintf( pzNewFileName , "%S\\%S.%S", pMessageStrings[ MSG_SAVEDIRECTORY ], pMessageStrings[ MSG_QUICKSAVE_NAME ], pMessageStrings[ MSG_SAVEEXTENSION ] ); + else + sprintf( pzNewFileName , "%S\\%S%02d.%S", pMessageStrings[ MSG_SAVEDIRECTORY ], pMessageStrings[ MSG_QUICKSAVE_NAME ], guiCurrentQuickSaveNumber, pMessageStrings[ MSG_SAVEEXTENSION ] ); + } + else +#endif + sprintf( pzNewFileName , "%S\\%S.%S", pMessageStrings[ MSG_SAVEDIRECTORY ], pMessageStrings[ MSG_QUICKSAVE_NAME ], pMessageStrings[ MSG_SAVEEXTENSION ] ); + } +//#ifdef JA2BETAVERSION + else if( ubSaveGameID == SAVE__END_TURN_NUM ) + { + //The name of the file + sprintf( pzNewFileName , "%S\\Auto%02d.%S", pMessageStrings[ MSG_SAVEDIRECTORY ], guiLastSaveGameNum, pMessageStrings[ MSG_SAVEEXTENSION ] ); + + //increment end turn number + guiLastSaveGameNum++; + + //just have 2 saves + if( guiLastSaveGameNum == 2 ) + { + guiLastSaveGameNum = 0; + } + } +//#endif + + else + sprintf( pzNewFileName , "%S\\%S%02d.%S", pMessageStrings[ MSG_SAVEDIRECTORY ], pMessageStrings[ MSG_SAVE_NAME ], ubSaveGameID, pMessageStrings[ MSG_SAVEEXTENSION ] ); +} + + + + +BOOLEAN SaveMercPathFromSoldierStruct( HWFILE hFile, UINT8 ubID ) +{ + UINT32 uiNumOfNodes=0; + PathStPtr pTempPath = Menptr[ ubID ].pMercPath; + UINT32 uiNumBytesWritten=0; + + + //loop through to get all the nodes + while( pTempPath ) + { + uiNumOfNodes++; + pTempPath = pTempPath->pNext; + } + + + //Save the number of the nodes + FileWrite( hFile, &uiNumOfNodes, sizeof( UINT32 ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( UINT32 ) ) + { + return(FALSE); + } + + //loop through all the nodes and add them + pTempPath = Menptr[ ubID ].pMercPath; + + + //loop through nodes and save all the nodes + while( pTempPath ) + { + //Save the number of the nodes + FileWrite( hFile, pTempPath, sizeof( PathSt ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( PathSt ) ) + { + return(FALSE); + } + + pTempPath = pTempPath->pNext; + } + + + + return( TRUE ); +} + + + +BOOLEAN LoadMercPathToSoldierStruct( HWFILE hFile, UINT8 ubID ) +{ + UINT32 uiNumOfNodes=0; + PathStPtr pTempPath = NULL; + PathStPtr pTemp = NULL; + UINT32 uiNumBytesRead=0; + UINT32 cnt; + + + + //The list SHOULD be empty at this point +/* + //if there is nodes, loop through and delete them + if( Menptr[ ubID ].pMercPath ) + { + pTempPath = Menptr[ ubID ].pMercPath; + while( pTempPath ) + { + pTemp = pTempPath; + pTempPath = pTempPath->pNext; + + MemFree( pTemp ); + pTemp=NULL; + } + + Menptr[ ubID ].pMercPath = NULL; + } +*/ + + //Load the number of the nodes + FileRead( hFile, &uiNumOfNodes, sizeof( UINT32 ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( UINT32 ) ) + { + return(FALSE); + } + + //load all the nodes + for( cnt=0; cntpPrev = NULL; + } + else + { + pTempPath->pNext = pTemp; + pTemp->pPrev = pTempPath; + + pTempPath = pTempPath->pNext; + } + + pTemp->pNext = NULL; + } + + //move to beginning of list + pTempPath = MoveToBeginningOfPathList( pTempPath ); + + Menptr[ ubID ].pMercPath = pTempPath; + if( Menptr[ ubID ].pMercPath ) + Menptr[ ubID ].pMercPath->pPrev = NULL; + + return( TRUE ); +} + + +#ifdef JA2BETAVERSION +void InitSaveGameFilePosition() +{ + CHAR8 zFileName[128]; + + sprintf( zFileName, "%S\\SaveGameFilePos%2d.txt", pMessageStrings[ MSG_SAVEDIRECTORY ], gubSaveGameLoc ); + + FileDelete( zFileName ); +} + +void SaveGameFilePosition( INT32 iPos, STR pMsg ) +{ + HWFILE hFile; + CHAR8 zTempString[512]; + UINT32 uiNumBytesWritten; + UINT32 uiStrLen=0; + CHAR8 zFileName[128]; + + sprintf( zFileName, "%S\\SaveGameFilePos%2d.txt", pMessageStrings[ MSG_SAVEDIRECTORY ], gubSaveGameLoc ); + + // create the save game file + hFile = FileOpen( zFileName, FILE_ACCESS_WRITE | FILE_OPEN_ALWAYS, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + return; + } + + FileSeek( hFile, 0, FILE_SEEK_FROM_END ); + + sprintf( zTempString, "%8d %s\n", iPos, pMsg ); + uiStrLen = strlen( zTempString ); + + FileWrite( hFile, zTempString, uiStrLen, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiStrLen ) + { + FileClose( hFile ); + return; + } + + FileClose( hFile ); +} + + + +void InitLoadGameFilePosition() +{ + CHAR8 zFileName[128]; + + sprintf( zFileName, "%S\\LoadGameFilePos%2d.txt", pMessageStrings[ MSG_SAVEDIRECTORY ], gubSaveGameLoc ); + + FileDelete( zFileName ); +} +void LoadGameFilePosition( INT32 iPos, STR pMsg ) +{ + HWFILE hFile; + CHAR8 zTempString[512]; + UINT32 uiNumBytesWritten; + UINT32 uiStrLen=0; + + CHAR8 zFileName[128]; + + sprintf( zFileName, "%S\\LoadGameFilePos%2d.txt", pMessageStrings[ MSG_SAVEDIRECTORY ], gubSaveGameLoc ); + + // create the save game file + hFile = FileOpen( zFileName, FILE_ACCESS_WRITE | FILE_OPEN_ALWAYS, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + return; + } + + FileSeek( hFile, 0, FILE_SEEK_FROM_END ); + + sprintf( zTempString, "%8d %s\n", iPos, pMsg ); + uiStrLen = strlen( zTempString ); + + FileWrite( hFile, zTempString, uiStrLen, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiStrLen ) + { + FileClose( hFile ); + return; + } + + FileClose( hFile ); + + +} +#endif + + + +BOOLEAN SaveGeneralInfo( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + + GENERAL_SAVE_INFO sGeneralInfo; + memset( &sGeneralInfo, 0, sizeof( GENERAL_SAVE_INFO ) ); + + sGeneralInfo.ubMusicMode = gubMusicMode; + sGeneralInfo.uiCurrentUniqueSoldierId = guiCurrentUniqueSoldierId; + sGeneralInfo.uiCurrentScreen = guiPreviousOptionScreen; + + sGeneralInfo.usSelectedSoldier = gusSelectedSoldier; + sGeneralInfo.sRenderCenterX = gsRenderCenterX; + sGeneralInfo.sRenderCenterY = gsRenderCenterY; + sGeneralInfo.fAtLeastOneMercWasHired = gfAtLeastOneMercWasHired; + sGeneralInfo.fHavePurchasedItemsFromTony = gfHavePurchasedItemsFromTony; + + sGeneralInfo.fShowItemsFlag = fShowItemsFlag; + sGeneralInfo.fShowTownFlag = fShowTownFlag; + sGeneralInfo.fShowMineFlag = fShowMineFlag; + sGeneralInfo.fShowAircraftFlag = fShowAircraftFlag; + sGeneralInfo.fShowTeamFlag = fShowTeamFlag; + + sGeneralInfo.fHelicopterAvailable = fHelicopterAvailable; + + // helicopter vehicle id + sGeneralInfo.iHelicopterVehicleId = iHelicopterVehicleId; + + // total distance travelled +// sGeneralInfo.iTotalHeliDistanceSinceRefuel = iTotalHeliDistanceSinceRefuel; + + // total owed by player + sGeneralInfo.iTotalAccumulatedCostByPlayer = iTotalAccumulatedCostByPlayer; + + // whether or not skyrider is alive and well? and on our side yet? + sGeneralInfo.fSkyRiderAvailable = fSkyRiderAvailable; + + // is the heli in the air? + sGeneralInfo.fHelicopterIsAirBorne = fHelicopterIsAirBorne; + + // is the pilot returning straight to base? + sGeneralInfo.fHeliReturnStraightToBase = fHeliReturnStraightToBase; + + // heli hovering + sGeneralInfo.fHoveringHelicopter = fHoveringHelicopter; + + // time started hovering + sGeneralInfo.uiStartHoverTime = uiStartHoverTime; + + // what state is skyrider's dialogue in in? + sGeneralInfo.uiHelicopterSkyriderTalkState = guiHelicopterSkyriderTalkState; + + // the flags for skyrider events + sGeneralInfo.fShowEstoniRefuelHighLight = fShowEstoniRefuelHighLight; + sGeneralInfo.fShowOtherSAMHighLight = fShowOtherSAMHighLight; + sGeneralInfo.fShowDrassenSAMHighLight = fShowDrassenSAMHighLight; + sGeneralInfo.fShowCambriaHospitalHighLight = fShowCambriaHospitalHighLight; + + //The current state of the weather + sGeneralInfo.uiEnvWeather = guiEnvWeather; + + sGeneralInfo.ubDefaultButton = gubDefaultButton; + + sGeneralInfo.fSkyriderEmptyHelpGiven = gfSkyriderEmptyHelpGiven; + sGeneralInfo.ubHelicopterHitsTaken = gubHelicopterHitsTaken; + sGeneralInfo.fSkyriderSaidCongratsOnTakingSAM = gfSkyriderSaidCongratsOnTakingSAM; + sGeneralInfo.ubPlayerProgressSkyriderLastCommentedOn = gubPlayerProgressSkyriderLastCommentedOn; + + sGeneralInfo.fEnterMapDueToContract = fEnterMapDueToContract; + sGeneralInfo.ubQuitType = ubQuitType; + + if( pContractReHireSoldier != NULL ) + sGeneralInfo.sContractRehireSoldierID = pContractReHireSoldier->ubID; + else + sGeneralInfo.sContractRehireSoldierID = -1; + + memcpy( &sGeneralInfo.GameOptions, &gGameOptions, sizeof( GAME_OPTIONS ) ); + + + #ifdef JA2BETAVERSION + //Everytime we save get, and set a seed value, when reload, seed again + sGeneralInfo.uiSeedNumber = GetJA2Clock(); + srand( sGeneralInfo.uiSeedNumber ); + #endif + + //Save the Ja2Clock() + sGeneralInfo.uiBaseJA2Clock = guiBaseJA2Clock; + + // Save the current tactical panel mode + sGeneralInfo.sCurInterfacePanel = gsCurInterfacePanel; + + // Save the selected merc + if( gpSMCurrentMerc ) + sGeneralInfo.ubSMCurrentMercID = gpSMCurrentMerc->ubID; + else + sGeneralInfo.ubSMCurrentMercID = 255; + + //Save the fact that it is the first time in mapscreen + sGeneralInfo.fFirstTimeInMapScreen = fFirstTimeInMapScreen; + + //save map screen disabling buttons + sGeneralInfo.fDisableDueToBattleRoster = fDisableDueToBattleRoster; + sGeneralInfo.fDisableMapInterfaceDueToBattle = fDisableMapInterfaceDueToBattle; + + // Save boxing info + memcpy( &sGeneralInfo.sBoxerGridNo, &gsBoxerGridNo, NUM_BOXERS * sizeof( INT16 ) ); + memcpy( &sGeneralInfo.ubBoxerID, &gubBoxerID, NUM_BOXERS * sizeof( INT8 ) ); + memcpy( &sGeneralInfo.fBoxerFought, &gfBoxerFought, NUM_BOXERS * sizeof( BOOLEAN ) ); + + //Save the helicopter status + sGeneralInfo.fHelicopterDestroyed = fHelicopterDestroyed; + sGeneralInfo.fShowMapScreenHelpText = fShowMapScreenHelpText; + + sGeneralInfo.iSortStateForMapScreenList = giSortStateForMapScreenList; + sGeneralInfo.fFoundTixa = fFoundTixa; + + sGeneralInfo.uiTimeOfLastSkyriderMonologue = guiTimeOfLastSkyriderMonologue; + sGeneralInfo.fSkyRiderSetUp = fSkyRiderSetUp; + + memcpy( &sGeneralInfo.fRefuelingSiteAvailable, &fRefuelingSiteAvailable, NUMBER_OF_REFUEL_SITES * sizeof( BOOLEAN ) ); + + + //Meanwhile stuff + memcpy( &sGeneralInfo.gCurrentMeanwhileDef, &gCurrentMeanwhileDef, sizeof( MEANWHILE_DEFINITION ) ); + //sGeneralInfo.gfMeanwhileScheduled = gfMeanwhileScheduled; + sGeneralInfo.gfMeanwhileTryingToStart = gfMeanwhileTryingToStart; + sGeneralInfo.gfInMeanwhile = gfInMeanwhile; + + + // list of dead guys for squads...in id values -> -1 means no one home + memcpy( &sGeneralInfo.sDeadMercs, &sDeadMercs, sizeof( INT16 ) * NUMBER_OF_SQUADS * NUMBER_OF_SOLDIERS_PER_SQUAD ); + + // level of public noises + memcpy( &sGeneralInfo.gbPublicNoiseLevel, &gbPublicNoiseLevel, sizeof( INT8 ) * MAXTEAMS ); + + //The screen count for the initscreen + sGeneralInfo.gubScreenCount = gubScreenCount; + + + //used for the mean while screen + sGeneralInfo.uiMeanWhileFlags = uiMeanWhileFlags; + + //Imp portrait number + sGeneralInfo.iPortraitNumber = iPortraitNumber; + + // location of first enocunter with enemy + sGeneralInfo.sWorldSectorLocationOfFirstBattle = sWorldSectorLocationOfFirstBattle; + + + //State of email flags + sGeneralInfo.fUnReadMailFlag = fUnReadMailFlag; + sGeneralInfo.fNewMailFlag = fNewMailFlag; + sGeneralInfo.fOldUnReadFlag = fOldUnreadFlag; + sGeneralInfo.fOldNewMailFlag = fOldNewMailFlag; + + sGeneralInfo.fShowMilitia = fShowMilitia; + + sGeneralInfo.fNewFilesInFileViewer = fNewFilesInFileViewer; + + sGeneralInfo.fLastBoxingMatchWonByPlayer = gfLastBoxingMatchWonByPlayer; + + memcpy( &sGeneralInfo.fSamSiteFound, &fSamSiteFound, NUMBER_OF_SAMS * sizeof( BOOLEAN ) ); + + sGeneralInfo.ubNumTerrorists = gubNumTerrorists; + sGeneralInfo.ubCambriaMedicalObjects = gubCambriaMedicalObjects; + + sGeneralInfo.fDisableTacticalPanelButtons = gfDisableTacticalPanelButtons; + + sGeneralInfo.sSelMapX = sSelMapX; + sGeneralInfo.sSelMapY = sSelMapY; + sGeneralInfo.iCurrentMapSectorZ = iCurrentMapSectorZ; + + //Save the current status of the help screens flag that say wether or not the user has been there before + sGeneralInfo.usHasPlayerSeenHelpScreenInCurrentScreen = gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen; + + sGeneralInfo.ubBoxingMatchesWon = gubBoxingMatchesWon; + sGeneralInfo.ubBoxersRests = gubBoxersRests; + sGeneralInfo.fBoxersResting = gfBoxersResting; + + sGeneralInfo.ubDesertTemperature = gubDesertTemperature; + sGeneralInfo.ubGlobalTemperature = gubGlobalTemperature; + + sGeneralInfo.sMercArriveSectorX = gsMercArriveSectorX; + sGeneralInfo.sMercArriveSectorY = gsMercArriveSectorY; + + sGeneralInfo.fCreatureMeanwhileScenePlayed = gfCreatureMeanwhileScenePlayed; + + //save the global player num + sGeneralInfo.ubPlayerNum = gbPlayerNum; + + //New stuff for the Prebattle interface / autoresolve + sGeneralInfo.fPersistantPBI = gfPersistantPBI; + sGeneralInfo.ubEnemyEncounterCode = gubEnemyEncounterCode; + sGeneralInfo.ubExplicitEnemyEncounterCode = gubExplicitEnemyEncounterCode; + sGeneralInfo.fBlitBattleSectorLocator = gfBlitBattleSectorLocator; + sGeneralInfo.ubPBSectorX = gubPBSectorX; + sGeneralInfo.ubPBSectorY = gubPBSectorY; + sGeneralInfo.ubPBSectorZ = gubPBSectorZ; + sGeneralInfo.fCantRetreatInPBI = gfCantRetreatInPBI; + sGeneralInfo.fExplosionQueueActive = gfExplosionQueueActive; + + sGeneralInfo.bSelectedInfoChar = bSelectedInfoChar; + + sGeneralInfo.iHospitalTempBalance = giHospitalTempBalance; + sGeneralInfo.iHospitalRefund = giHospitalRefund; + sGeneralInfo.bHospitalPriceModifier = gbHospitalPriceModifier; + sGeneralInfo.fPlayerTeamSawJoey = gfPlayerTeamSawJoey; + sGeneralInfo.fMikeShouldSayHi = gfMikeShouldSayHi; + + //Setup the + //Save the current music mode + FileWrite( hFile, &sGeneralInfo, sizeof( GENERAL_SAVE_INFO ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( GENERAL_SAVE_INFO ) ) + { + FileClose( hFile ); + return( FALSE ); + } + + return( TRUE ); +} + + +BOOLEAN LoadGeneralInfo( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + + GENERAL_SAVE_INFO sGeneralInfo; + memset( &sGeneralInfo, 0, sizeof( GENERAL_SAVE_INFO ) ); + + + //Load the current music mode + FileRead( hFile, &sGeneralInfo, sizeof( GENERAL_SAVE_INFO ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( GENERAL_SAVE_INFO ) ) + { + FileClose( hFile ); + return( FALSE ); + } + + gMusicModeToPlay = sGeneralInfo.ubMusicMode; + + guiCurrentUniqueSoldierId = sGeneralInfo.uiCurrentUniqueSoldierId; + + guiScreenToGotoAfterLoadingSavedGame = sGeneralInfo.uiCurrentScreen; + +// gusSelectedSoldier = NOBODY; + gusSelectedSoldier = sGeneralInfo.usSelectedSoldier; + + gsRenderCenterX = sGeneralInfo.sRenderCenterX; + gsRenderCenterY = sGeneralInfo.sRenderCenterY; + + gfAtLeastOneMercWasHired = sGeneralInfo.fAtLeastOneMercWasHired; + + + + gfHavePurchasedItemsFromTony = sGeneralInfo.fHavePurchasedItemsFromTony; + + fShowItemsFlag = sGeneralInfo.fShowItemsFlag; + fShowTownFlag = sGeneralInfo.fShowTownFlag; + fShowMineFlag = sGeneralInfo.fShowMineFlag; + fShowAircraftFlag = sGeneralInfo.fShowAircraftFlag; + fShowTeamFlag = sGeneralInfo.fShowTeamFlag; + + fHelicopterAvailable = sGeneralInfo.fHelicopterAvailable; + + // helicopter vehicle id + iHelicopterVehicleId = sGeneralInfo.iHelicopterVehicleId; + + // total distance travelled +// iTotalHeliDistanceSinceRefuel = sGeneralInfo.iTotalHeliDistanceSinceRefuel; + + // total owed to player + iTotalAccumulatedCostByPlayer = sGeneralInfo.iTotalAccumulatedCostByPlayer; + + // whether or not skyrider is alive and well? and on our side yet? + fSkyRiderAvailable = sGeneralInfo.fSkyRiderAvailable; + + // is the heli in the air? + fHelicopterIsAirBorne = sGeneralInfo.fHelicopterIsAirBorne; + + // is the pilot returning straight to base? + fHeliReturnStraightToBase = sGeneralInfo.fHeliReturnStraightToBase; + + // heli hovering + fHoveringHelicopter = sGeneralInfo.fHoveringHelicopter; + + // time started hovering + uiStartHoverTime = sGeneralInfo.uiStartHoverTime; + + // what state is skyrider's dialogue in in? + guiHelicopterSkyriderTalkState = sGeneralInfo.uiHelicopterSkyriderTalkState; + + // the flags for skyrider events + fShowEstoniRefuelHighLight = sGeneralInfo.fShowEstoniRefuelHighLight; + fShowOtherSAMHighLight = sGeneralInfo.fShowOtherSAMHighLight; + fShowDrassenSAMHighLight = sGeneralInfo.fShowDrassenSAMHighLight; + fShowCambriaHospitalHighLight = sGeneralInfo.fShowCambriaHospitalHighLight; + + //The current state of the weather + guiEnvWeather = sGeneralInfo.uiEnvWeather; + + gubDefaultButton = sGeneralInfo.ubDefaultButton; + + gfSkyriderEmptyHelpGiven = sGeneralInfo.fSkyriderEmptyHelpGiven; + gubHelicopterHitsTaken = sGeneralInfo.ubHelicopterHitsTaken; + gfSkyriderSaidCongratsOnTakingSAM = sGeneralInfo.fSkyriderSaidCongratsOnTakingSAM; + gubPlayerProgressSkyriderLastCommentedOn = sGeneralInfo.ubPlayerProgressSkyriderLastCommentedOn; + + fEnterMapDueToContract = sGeneralInfo.fEnterMapDueToContract; + ubQuitType = sGeneralInfo.ubQuitType; + + //if the soldier id is valid + if( sGeneralInfo.sContractRehireSoldierID == -1 ) + pContractReHireSoldier = NULL; + else + pContractReHireSoldier = &Menptr[ sGeneralInfo.sContractRehireSoldierID ]; + + memcpy( &gGameOptions, &sGeneralInfo.GameOptions, sizeof( GAME_OPTIONS ) ); + + #ifdef JA2BETAVERSION + //Reset the random 'seed' number + srand( sGeneralInfo.uiSeedNumber ); + #endif + + //Restore the JA2 Clock + guiBaseJA2Clock = sGeneralInfo.uiBaseJA2Clock; + + // whenever guiBaseJA2Clock changes, we must reset all the timer variables that use it as a reference + ResetJA2ClockGlobalTimers(); + + + // Restore the selected merc + if( sGeneralInfo.ubSMCurrentMercID == 255 ) + gpSMCurrentMerc = NULL; + else + gpSMCurrentMerc = &Menptr[ sGeneralInfo.ubSMCurrentMercID ]; + + //Set the interface panel to the team panel + ShutdownCurrentPanel( ); + + //Restore the current tactical panel mode + gsCurInterfacePanel = sGeneralInfo.sCurInterfacePanel; + + /* + //moved to last stage in the LoadSaveGame() function + //if we are in tactical + if( guiScreenToGotoAfterLoadingSavedGame == GAME_SCREEN ) + { + //Initialize the current panel + InitializeCurrentPanel( ); + + SelectSoldier( gusSelectedSoldier, FALSE, TRUE ); + } + */ + + //Restore the fact that it is the first time in mapscreen + fFirstTimeInMapScreen = sGeneralInfo.fFirstTimeInMapScreen; + + //Load map screen disabling buttons + fDisableDueToBattleRoster = sGeneralInfo.fDisableDueToBattleRoster; + fDisableMapInterfaceDueToBattle = sGeneralInfo.fDisableMapInterfaceDueToBattle; + + memcpy( &gsBoxerGridNo, &sGeneralInfo.sBoxerGridNo, NUM_BOXERS * sizeof( INT16 ) ); + memcpy( &gubBoxerID, &sGeneralInfo.ubBoxerID, NUM_BOXERS * sizeof( INT8 ) ); + memcpy( &gfBoxerFought, &sGeneralInfo.fBoxerFought, NUM_BOXERS * sizeof( BOOLEAN ) ); + + //Load the helicopter status + fHelicopterDestroyed = sGeneralInfo.fHelicopterDestroyed; + fShowMapScreenHelpText = sGeneralInfo.fShowMapScreenHelpText; + + + giSortStateForMapScreenList = sGeneralInfo.iSortStateForMapScreenList; + fFoundTixa = sGeneralInfo.fFoundTixa; + + guiTimeOfLastSkyriderMonologue = sGeneralInfo.uiTimeOfLastSkyriderMonologue; + fSkyRiderSetUp = sGeneralInfo.fSkyRiderSetUp; + + memcpy( &fRefuelingSiteAvailable, &sGeneralInfo.fRefuelingSiteAvailable, NUMBER_OF_REFUEL_SITES * sizeof( BOOLEAN ) ); + + + //Meanwhile stuff + memcpy( &gCurrentMeanwhileDef, &sGeneralInfo.gCurrentMeanwhileDef, sizeof( MEANWHILE_DEFINITION ) ); +// gfMeanwhileScheduled = sGeneralInfo.gfMeanwhileScheduled; + gfMeanwhileTryingToStart = sGeneralInfo.gfMeanwhileTryingToStart; + gfInMeanwhile = sGeneralInfo.gfInMeanwhile; + + // list of dead guys for squads...in id values -> -1 means no one home + memcpy( &sDeadMercs, &sGeneralInfo.sDeadMercs, sizeof( INT16 ) * NUMBER_OF_SQUADS * NUMBER_OF_SOLDIERS_PER_SQUAD ); + + // level of public noises + memcpy( &gbPublicNoiseLevel, &sGeneralInfo.gbPublicNoiseLevel, sizeof( INT8 ) * MAXTEAMS ); + + //the screen count for the init screen + gubScreenCount = sGeneralInfo.gubScreenCount; + + //used for the mean while screen + if ( guiSaveGameVersion < 71 ) + { + uiMeanWhileFlags = sGeneralInfo.usOldMeanWhileFlags; + } + else + { + uiMeanWhileFlags = sGeneralInfo.uiMeanWhileFlags; + } + + //Imp portrait number + iPortraitNumber = sGeneralInfo.iPortraitNumber; + + // location of first enocunter with enemy + sWorldSectorLocationOfFirstBattle = sGeneralInfo.sWorldSectorLocationOfFirstBattle; + + fShowMilitia = sGeneralInfo.fShowMilitia; + + fNewFilesInFileViewer = sGeneralInfo.fNewFilesInFileViewer; + + gfLastBoxingMatchWonByPlayer = sGeneralInfo.fLastBoxingMatchWonByPlayer; + + memcpy( &fSamSiteFound, &sGeneralInfo.fSamSiteFound, NUMBER_OF_SAMS * sizeof( BOOLEAN ) ); + + gubNumTerrorists = sGeneralInfo.ubNumTerrorists; + gubCambriaMedicalObjects = sGeneralInfo.ubCambriaMedicalObjects; + + gfDisableTacticalPanelButtons = sGeneralInfo.fDisableTacticalPanelButtons; + + sSelMapX = sGeneralInfo.sSelMapX; + sSelMapY = sGeneralInfo.sSelMapY; + iCurrentMapSectorZ = sGeneralInfo.iCurrentMapSectorZ; + + //State of email flags + fUnReadMailFlag = sGeneralInfo.fUnReadMailFlag; + fNewMailFlag = sGeneralInfo.fNewMailFlag; + fOldUnreadFlag = sGeneralInfo.fOldUnReadFlag; + fOldNewMailFlag = sGeneralInfo.fOldNewMailFlag; + + //Save the current status of the help screens flag that say wether or not the user has been there before + gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen = sGeneralInfo.usHasPlayerSeenHelpScreenInCurrentScreen; + + gubBoxingMatchesWon = sGeneralInfo.ubBoxingMatchesWon; + gubBoxersRests = sGeneralInfo.ubBoxersRests; + gfBoxersResting = sGeneralInfo.fBoxersResting; + + gubDesertTemperature = sGeneralInfo.ubDesertTemperature; + gubGlobalTemperature = sGeneralInfo.ubGlobalTemperature; + + gsMercArriveSectorX = sGeneralInfo.sMercArriveSectorX; + gsMercArriveSectorY = sGeneralInfo.sMercArriveSectorY; + + gfCreatureMeanwhileScenePlayed = sGeneralInfo.fCreatureMeanwhileScenePlayed; + + //load the global player num + gbPlayerNum = sGeneralInfo.ubPlayerNum; + + //New stuff for the Prebattle interface / autoresolve + gfPersistantPBI = sGeneralInfo.fPersistantPBI; + gubEnemyEncounterCode = sGeneralInfo.ubEnemyEncounterCode; + gubExplicitEnemyEncounterCode = sGeneralInfo.ubExplicitEnemyEncounterCode; + gfBlitBattleSectorLocator = sGeneralInfo.fBlitBattleSectorLocator; + gubPBSectorX = sGeneralInfo.ubPBSectorX; + gubPBSectorY = sGeneralInfo.ubPBSectorY; + gubPBSectorZ = sGeneralInfo.ubPBSectorZ; + gfCantRetreatInPBI = sGeneralInfo.fCantRetreatInPBI; + gfExplosionQueueActive = sGeneralInfo.fExplosionQueueActive; + + bSelectedInfoChar = sGeneralInfo.bSelectedInfoChar; + + giHospitalTempBalance = sGeneralInfo.iHospitalTempBalance; + giHospitalRefund = sGeneralInfo.iHospitalRefund; + gbHospitalPriceModifier = sGeneralInfo.bHospitalPriceModifier; + gfPlayerTeamSawJoey = sGeneralInfo.fPlayerTeamSawJoey; + gfMikeShouldSayHi = sGeneralInfo.fMikeShouldSayHi; + + return( TRUE ); +} + +BOOLEAN SavePreRandomNumbersToSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + + //Save the Prerandom number index + FileWrite( hFile, &guiPreRandomIndex, sizeof( UINT32 ), &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( UINT32 ) ) + { + return( FALSE ); + } + + //Save the Prerandom number index + FileWrite( hFile, guiPreRandomNums, sizeof( UINT32 ) * MAX_PREGENERATED_NUMS, &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( UINT32 ) * MAX_PREGENERATED_NUMS ) + { + return( FALSE ); + } + + return( TRUE ); +} + +BOOLEAN LoadPreRandomNumbersFromSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + + //Load the Prerandom number index + FileRead( hFile, &guiPreRandomIndex, sizeof( UINT32 ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( UINT32 ) ) + { + return( FALSE ); + } + + //Load the Prerandom number index + FileRead( hFile, guiPreRandomNums, sizeof( UINT32 ) * MAX_PREGENERATED_NUMS, &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( UINT32 ) * MAX_PREGENERATED_NUMS ) + { + return( FALSE ); + } + + return( TRUE ); +} + +BOOLEAN LoadMeanwhileDefsFromSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesRead; + + if ( guiSaveGameVersion < 72 ) + { + //Load the array of meanwhile defs + FileRead( hFile, gMeanwhileDef, sizeof( MEANWHILE_DEFINITION ) * (NUM_MEANWHILES-1), &uiNumBytesRead ); + if ( uiNumBytesRead != sizeof( MEANWHILE_DEFINITION ) * (NUM_MEANWHILES-1) ) + { + return( FALSE ); + } + // and set the last one + memset( &(gMeanwhileDef[ NUM_MEANWHILES - 1]), 0, sizeof( MEANWHILE_DEFINITION ) ); + + } + else + { + //Load the array of meanwhile defs + FileRead( hFile, gMeanwhileDef, sizeof( MEANWHILE_DEFINITION ) * NUM_MEANWHILES, &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( MEANWHILE_DEFINITION ) * NUM_MEANWHILES ) + { + return( FALSE ); + } + } + + return( TRUE ); +} + +BOOLEAN SaveMeanwhileDefsFromSaveGameFile( HWFILE hFile ) +{ + UINT32 uiNumBytesWritten; + + //Save the array of meanwhile defs + FileWrite( hFile, &gMeanwhileDef, sizeof( MEANWHILE_DEFINITION ) * NUM_MEANWHILES, &uiNumBytesWritten ); + if ( uiNumBytesWritten != sizeof( MEANWHILE_DEFINITION ) * NUM_MEANWHILES ) + { + return( FALSE ); + } + + return( TRUE ); +} + +BOOLEAN DoesUserHaveEnoughHardDriveSpace() +{ + UINT32 uiBytesFree=0; + + uiBytesFree = GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( ); + + //check to see if there is enough hard drive space + if( uiBytesFree < REQUIRED_FREE_SPACE ) + { + return( FALSE ); + } + + return( TRUE ); +} + +#ifdef JA2BETAVERSION + +void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGameID ) +{ + CHAR8 zFileName[128]; + HWFILE hFile; + CHAR8 zTempString[512]; + UINT32 uiStrLen; + UINT32 uiNumBytesWritten; + + //strcpy( gzNameOfMapTempFile, pNameOfFile); + sprintf( gzNameOfMapTempFile, "%s%d", pNameOfFile, ubSaveGameID ); + + sprintf( zFileName, "%S\\%s.txt", pMessageStrings[ MSG_SAVEDIRECTORY ], gzNameOfMapTempFile ); + + if( fInit ) + { + guiNumberOfMapTempFiles = 0; //Test: To determine where the temp files are crashing + guiSizeOfTempFiles = 0; + + if( FileExists( zFileName ) ) + { + FileDelete( zFileName ); + } + } + else + { + // create the save game file + hFile = FileOpen( zFileName, FILE_ACCESS_WRITE | FILE_OPEN_ALWAYS, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + return; + } + + FileSeek( hFile, 0, FILE_SEEK_FROM_END ); + + sprintf( zTempString, "Number Of Files: %6d. Size of all files: %6d.\n", guiNumberOfMapTempFiles, guiSizeOfTempFiles ); + uiStrLen = strlen( zTempString ); + + FileWrite( hFile, zTempString, uiStrLen, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiStrLen ) + { + FileClose( hFile ); + return; + } + + FileClose( hFile ); + + } +} + +void WriteTempFileNameToFile( STR pFileName, UINT32 uiSizeOfFile, HFILE hSaveFile ) +{ + HWFILE hFile; + CHAR8 zTempString[512]; + UINT32 uiNumBytesWritten; + UINT32 uiStrLen=0; + + CHAR8 zFileName[128]; + + guiSizeOfTempFiles += uiSizeOfFile; + + sprintf( zFileName, "%S\\%s.txt", pMessageStrings[ MSG_SAVEDIRECTORY ], gzNameOfMapTempFile ); + + // create the save game file + hFile = FileOpen( zFileName, FILE_ACCESS_WRITE | FILE_OPEN_ALWAYS, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + return; + } + + FileSeek( hFile, 0, FILE_SEEK_FROM_END ); + + sprintf( zTempString, "%8d %6d %s\n", FileGetPos( hSaveFile ), uiSizeOfFile, pFileName ); + uiStrLen = strlen( zTempString ); + + FileWrite( hFile, zTempString, uiStrLen, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiStrLen ) + { + FileClose( hFile ); + return; + } + + FileClose( hFile ); +} + +#endif + +void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ ) +{ + //if the current sector is valid + if( gfWorldLoaded ) + { + *psSectorX = gWorldSectorX; + *psSectorY = gWorldSectorY; + *pbSectorZ = gbWorldSectorZ; + } + else if( iCurrentTacticalSquad != NO_CURRENT_SQUAD && Squad[ iCurrentTacticalSquad ][ 0 ] ) + { + if( Squad[ iCurrentTacticalSquad ][ 0 ]->bAssignment != IN_TRANSIT ) + { + *psSectorX = Squad[ iCurrentTacticalSquad ][ 0 ]->sSectorX; + *psSectorY = Squad[ iCurrentTacticalSquad ][ 0 ]->sSectorY; + *pbSectorZ = Squad[ iCurrentTacticalSquad ][ 0 ]->bSectorZ; + } + } + else + { + INT16 sSoldierCnt; + SOLDIERTYPE *pSoldier; + INT16 bLastTeamID; + INT8 bCount=0; + BOOLEAN fFoundAMerc=FALSE; + + // Set locator to first merc + sSoldierCnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + + //loop through all the mercs on the players team to find the one that is not moving + for ( pSoldier = MercPtrs[ sSoldierCnt ]; sSoldierCnt <= bLastTeamID; sSoldierCnt++,pSoldier++) + { + if( pSoldier->bActive ) + { + if ( pSoldier->bAssignment != IN_TRANSIT && !pSoldier->fBetweenSectors) + { + //we found an alive, merc that is not moving + *psSectorX = pSoldier->sSectorX; + *psSectorY = pSoldier->sSectorY; + *pbSectorZ = pSoldier->bSectorZ; + fFoundAMerc = TRUE; + break; + } + } + } + + //if we didnt find a merc + if( !fFoundAMerc ) + { + // Set locator to first merc + sSoldierCnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + + //loop through all the mercs and find one that is moving + for ( pSoldier = MercPtrs[ sSoldierCnt ]; sSoldierCnt <= bLastTeamID; sSoldierCnt++,pSoldier++) + { + if( pSoldier->bActive ) + { + //we found an alive, merc that is not moving + *psSectorX = pSoldier->sSectorX; + *psSectorY = pSoldier->sSectorY; + *pbSectorZ = pSoldier->bSectorZ; + fFoundAMerc = TRUE; + break; + } + } + + //if we STILL havent found a merc, give up and use the -1, -1, -1 + if( !fFoundAMerc ) + { + *psSectorX = gWorldSectorX; + *psSectorY = gWorldSectorY; + *pbSectorZ = gbWorldSectorZ; + } + } + } +} + + +void PauseBeforeSaveGame( void ) +{ + //if we are not in the save load screen + if( guiCurrentScreen != SAVE_LOAD_SCREEN ) + { + //Pause the game + PauseGame(); + } +} + +void UnPauseAfterSaveGame( void ) +{ + //if we are not in the save load screen + if( guiCurrentScreen != SAVE_LOAD_SCREEN ) + { + //UnPause time compression + UnPauseGame(); + } +} + +void TruncateStrategicGroupSizes() +{ + GROUP *pGroup; + SECTORINFO *pSector; + INT32 i; + + //Kaiden: Loading INI file to read Values... + CIniReader iniReader("..\\Ja2_Options.ini"); + INT32 iMaxEnemyGroupSize = iniReader.ReadInteger("Options","MAX_STRATEGIC_TEAM_SIZE",20); + + + for( i = SEC_A1; i < SEC_P16; i++ ) + { + pSector = &SectorInfo[ i ]; + if( pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites > iMaxEnemyGroupSize ) + { + if( pSector->ubNumAdmins > pSector->ubNumTroops ) + { + if( pSector->ubNumAdmins > pSector->ubNumElites ) + { + pSector->ubNumAdmins = 20; + pSector->ubNumTroops = 0; + pSector->ubNumElites = 0; + } + else + { + pSector->ubNumAdmins = 0; + pSector->ubNumTroops = 0; + pSector->ubNumElites = 20; + } + } + else if( pSector->ubNumTroops > pSector->ubNumElites ) + { + if( pSector->ubNumTroops > pSector->ubNumAdmins ) + { + pSector->ubNumAdmins = 0; + pSector->ubNumTroops = 20; + pSector->ubNumElites = 0; + } + else + { + pSector->ubNumAdmins = 20; + pSector->ubNumTroops = 0; + pSector->ubNumElites = 0; + } + } + else + { + if( pSector->ubNumElites > pSector->ubNumTroops ) + { + pSector->ubNumAdmins = 0; + pSector->ubNumTroops = 0; + pSector->ubNumElites = 20; + } + else + { + pSector->ubNumAdmins = 0; + pSector->ubNumTroops = 20; + pSector->ubNumElites = 0; + } + } + } + //militia + if( pSector->ubNumberOfCivsAtLevel[0] + pSector->ubNumberOfCivsAtLevel[1] + pSector->ubNumberOfCivsAtLevel[2] > iMaxEnemyGroupSize ) + { + if( pSector->ubNumberOfCivsAtLevel[0] > pSector->ubNumberOfCivsAtLevel[1] ) + { + if( pSector->ubNumberOfCivsAtLevel[0] > pSector->ubNumberOfCivsAtLevel[2] ) + { + pSector->ubNumberOfCivsAtLevel[0] = 20; + pSector->ubNumberOfCivsAtLevel[1] = 0; + pSector->ubNumberOfCivsAtLevel[2] = 0; + } + else + { + pSector->ubNumberOfCivsAtLevel[0] = 0; + pSector->ubNumberOfCivsAtLevel[1] = 0; + pSector->ubNumberOfCivsAtLevel[2] = 20; + } + } + else if( pSector->ubNumberOfCivsAtLevel[1] > pSector->ubNumberOfCivsAtLevel[2] ) + { + if( pSector->ubNumberOfCivsAtLevel[1] > pSector->ubNumberOfCivsAtLevel[0] ) + { + pSector->ubNumberOfCivsAtLevel[0] = 0; + pSector->ubNumberOfCivsAtLevel[1] = 20; + pSector->ubNumberOfCivsAtLevel[2] = 0; + } + else + { + pSector->ubNumberOfCivsAtLevel[0] = 20; + pSector->ubNumberOfCivsAtLevel[1] = 0; + pSector->ubNumberOfCivsAtLevel[2] = 0; + } + } + else + { + if( pSector->ubNumberOfCivsAtLevel[2] > pSector->ubNumberOfCivsAtLevel[1] ) + { + pSector->ubNumberOfCivsAtLevel[0] = 0; + pSector->ubNumberOfCivsAtLevel[1] = 0; + pSector->ubNumberOfCivsAtLevel[2] = 20; + } + else + { + pSector->ubNumberOfCivsAtLevel[0] = 0; + pSector->ubNumberOfCivsAtLevel[1] = 20; + pSector->ubNumberOfCivsAtLevel[2] = 0; + } + } + } + } + //Enemy groups + pGroup = gpGroupList; + while( pGroup ) + { + if( !pGroup->fPlayer ) + { + if( pGroup->pEnemyGroup->ubNumAdmins + pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites > iMaxEnemyGroupSize ) + { + pGroup->ubGroupSize = 20; + if( pGroup->pEnemyGroup->ubNumAdmins > pGroup->pEnemyGroup->ubNumTroops ) + { + if( pGroup->pEnemyGroup->ubNumAdmins > pGroup->pEnemyGroup->ubNumElites ) + { + pGroup->pEnemyGroup->ubNumAdmins = 20; + pGroup->pEnemyGroup->ubNumTroops = 0; + pGroup->pEnemyGroup->ubNumElites = 0; + } + else + { + pGroup->pEnemyGroup->ubNumAdmins = 0; + pGroup->pEnemyGroup->ubNumTroops = 0; + pGroup->pEnemyGroup->ubNumElites = 20; + } + } + else if( pGroup->pEnemyGroup->ubNumTroops > pGroup->pEnemyGroup->ubNumElites ) + { + if( pGroup->pEnemyGroup->ubNumTroops > pGroup->pEnemyGroup->ubNumAdmins ) + { + pGroup->pEnemyGroup->ubNumAdmins = 0; + pGroup->pEnemyGroup->ubNumTroops = 20; + pGroup->pEnemyGroup->ubNumElites = 0; + } + else + { + pGroup->pEnemyGroup->ubNumAdmins = 20; + pGroup->pEnemyGroup->ubNumTroops = 0; + pGroup->pEnemyGroup->ubNumElites = 0; + } + } + else + { + if( pGroup->pEnemyGroup->ubNumElites > pGroup->pEnemyGroup->ubNumTroops ) + { + pGroup->pEnemyGroup->ubNumAdmins = 0; + pGroup->pEnemyGroup->ubNumTroops = 0; + pGroup->pEnemyGroup->ubNumElites = 20; + } + else + { + pGroup->pEnemyGroup->ubNumAdmins = 0; + pGroup->pEnemyGroup->ubNumTroops = 20; + pGroup->pEnemyGroup->ubNumElites = 0; + } + } + } + } + pGroup = pGroup->next; + } +} + + +void UpdateMercMercContractInfo() +{ + UINT8 ubCnt; + SOLDIERTYPE *pSoldier; + + for( ubCnt=BIFF; ubCnt<= BUBBA; ubCnt++ ) + { + pSoldier = FindSoldierByProfileID( ubCnt, TRUE ); + + //if the merc is on the team + if( pSoldier == NULL ) + continue; + + gMercProfiles[ ubCnt ].iMercMercContractLength = pSoldier->iTotalContractLength; + + pSoldier->iTotalContractLength = 0; + } +} + +INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave ) +{ + CHAR zFileName1[256]; + CHAR zFileName2[256]; + HWFILE hFile; + BOOLEAN fFile1Exist, fFile2Exist; + SGP_FILETIME CreationTime1, LastAccessedTime1, LastWriteTime1; + SGP_FILETIME CreationTime2, LastAccessedTime2, LastWriteTime2; + + fFile1Exist = FALSE; + fFile2Exist = FALSE; + + + //The name of the file + sprintf( zFileName1, "%S\\Auto%02d.%S", pMessageStrings[ MSG_SAVEDIRECTORY ], 0, pMessageStrings[ MSG_SAVEEXTENSION ] ); + sprintf( zFileName2, "%S\\Auto%02d.%S", pMessageStrings[ MSG_SAVEDIRECTORY ], 1, pMessageStrings[ MSG_SAVEEXTENSION ] ); + + if( FileExists( zFileName1 ) ) + { + hFile = FileOpen( zFileName1, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + + GetFileManFileTime( hFile, &CreationTime1, &LastAccessedTime1, &LastWriteTime1 ); + + FileClose( hFile ); + + fFile1Exist = TRUE; + } + + if( FileExists( zFileName2 ) ) + { + hFile = FileOpen( zFileName2, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + + GetFileManFileTime( hFile, &CreationTime2, &LastAccessedTime2, &LastWriteTime2 ); + + FileClose( hFile ); + + fFile2Exist = TRUE; + } + + if( !fFile1Exist && !fFile2Exist ) + return( -1 ); + else if( fFile1Exist && !fFile2Exist ) + { + if( fLatestAutoSave ) + return( 0 ); + else + return( -1 ); + } + else if( !fFile1Exist && fFile2Exist ) + { + if( fLatestAutoSave ) + return( 1 ); + else + return( -1 ); + } + else + { + if( CompareSGPFileTimes( &LastWriteTime1, &LastWriteTime2 ) > 0 ) + return( 0 ); + else + return( 1 ); + } +} + +void HandleOldBobbyRMailOrders() +{ + INT32 iCnt; + INT32 iNewListCnt=0; + + if( LaptopSaveInfo.usNumberOfBobbyRayOrderUsed != 0 ) + { + //Allocate memory for the list + gpNewBobbyrShipments = (NewBobbyRayOrderStruct *) MemAlloc( sizeof( NewBobbyRayOrderStruct ) * LaptopSaveInfo.usNumberOfBobbyRayOrderUsed ); + if( gpNewBobbyrShipments == NULL ) + { + Assert(0); + return; + } + + giNumberOfNewBobbyRShipment = LaptopSaveInfo.usNumberOfBobbyRayOrderUsed; + + //loop through and add the old items to the new list + for( iCnt=0; iCnt< LaptopSaveInfo.usNumberOfBobbyRayOrderItems; iCnt++ ) + { + //if this slot is used + if( LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[iCnt].fActive ) + { + //copy over the purchase info + memcpy( gpNewBobbyrShipments[ iNewListCnt ].BobbyRayPurchase, + LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[iCnt].BobbyRayPurchase, + sizeof( BobbyRayPurchaseStruct ) * MAX_PURCHASE_AMOUNT ); + + gpNewBobbyrShipments[ iNewListCnt ].fActive = TRUE; + gpNewBobbyrShipments[ iNewListCnt ].ubDeliveryLoc = BR_DRASSEN; + gpNewBobbyrShipments[ iNewListCnt ].ubDeliveryMethod = 0; + gpNewBobbyrShipments[ iNewListCnt ].ubNumberPurchases = LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray[iCnt].ubNumberPurchases; + gpNewBobbyrShipments[ iNewListCnt ].uiPackageWeight = 1; + gpNewBobbyrShipments[ iNewListCnt ].uiOrderedOnDayNum = GetWorldDay(); + gpNewBobbyrShipments[ iNewListCnt ].fDisplayedInShipmentPage = TRUE; + + iNewListCnt++; + } + } + + //Clear out the old list + LaptopSaveInfo.usNumberOfBobbyRayOrderUsed = 0; + MemFree( LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray ); + LaptopSaveInfo.BobbyRayOrdersOnDeliveryArray = NULL; + } +} + + +UINT32 CalcJA2EncryptionSet( SAVED_GAME_HEADER * pSaveGameHeader ) +{ + UINT32 uiEncryptionSet = 0; + + uiEncryptionSet = pSaveGameHeader->uiSavedGameVersion; + uiEncryptionSet *= pSaveGameHeader->uiFlags; + uiEncryptionSet += pSaveGameHeader->iCurrentBalance; + uiEncryptionSet *= (pSaveGameHeader->ubNumOfMercsOnPlayersTeam + 1); + uiEncryptionSet += pSaveGameHeader->bSectorZ * 3; + uiEncryptionSet += pSaveGameHeader->ubLoadScreenID; + + if ( pSaveGameHeader->fAlternateSector ) + { + uiEncryptionSet += 7; + } + + if ( pSaveGameHeader->uiRandom % 2 == 0 ) + { + uiEncryptionSet++; + + if ( pSaveGameHeader->uiRandom % 7 == 0) + { + uiEncryptionSet++; + if ( pSaveGameHeader->uiRandom % 23 == 0 ) + { + uiEncryptionSet++; + } + if ( pSaveGameHeader->uiRandom % 79 == 0 ) + { + uiEncryptionSet += 2; + } + } + } + + #ifdef GERMAN + uiEncryptionSet *= 11; + #endif + + uiEncryptionSet = uiEncryptionSet % 10; + + uiEncryptionSet += pSaveGameHeader->uiDay / 10; + + uiEncryptionSet = uiEncryptionSet % 19; + + // now pick a different set of #s depending on what game options we've chosen + if ( pSaveGameHeader->sInitialGameOptions.fGunNut ) + { + uiEncryptionSet += BASE_NUMBER_OF_ROTATION_ARRAYS * 6; + } + + if ( pSaveGameHeader->sInitialGameOptions.ubGameStyle == STYLE_SCIFI) + { + uiEncryptionSet += BASE_NUMBER_OF_ROTATION_ARRAYS * 3; + } + + switch( pSaveGameHeader->sInitialGameOptions.ubDifficultyLevel ) + { + case DIF_LEVEL_EASY: + uiEncryptionSet += 0; + break; + case DIF_LEVEL_MEDIUM: + uiEncryptionSet += BASE_NUMBER_OF_ROTATION_ARRAYS; + break; + case DIF_LEVEL_HARD: + uiEncryptionSet += BASE_NUMBER_OF_ROTATION_ARRAYS * 2; + break; + case DIF_LEVEL_INSANE: + uiEncryptionSet += BASE_NUMBER_OF_ROTATION_ARRAYS * 3; + break; + } + + return( uiEncryptionSet ); +} \ No newline at end of file diff --git a/SaveLoadGame.h b/SaveLoadGame.h new file mode 100644 index 00000000..0d128e75 --- /dev/null +++ b/SaveLoadGame.h @@ -0,0 +1,82 @@ +#ifndef _SAVE_LOAD_GAME_H_ +#define _SAVE_LOAD_GAME_H_ + +#include "Soldier Control.h" + +#define BYTESINMEGABYTE 1048576 //1024*1024 +#define REQUIRED_FREE_SPACE (20 * BYTESINMEGABYTE) + +#define SIZE_OF_SAVE_GAME_DESC 128 + +#define GAME_VERSION_LENGTH 16 + +#define SAVE__ERROR_NUM 99 +#define SAVE__END_TURN_NUM 98 + +typedef struct +{ + UINT32 uiSavedGameVersion; + INT8 zGameVersionNumber[ GAME_VERSION_LENGTH ]; + + CHAR16 sSavedGameDesc[ SIZE_OF_SAVE_GAME_DESC ]; + + UINT32 uiFlags; + +#ifdef CRIPPLED_VERSION + UINT8 ubCrippleFiller[20]; +#endif + + + //The following will be used to quickly access info to display in the save/load screen + UINT32 uiDay; + UINT8 ubHour; + UINT8 ubMin; + INT16 sSectorX; + INT16 sSectorY; + INT8 bSectorZ; + UINT8 ubNumOfMercsOnPlayersTeam; + INT32 iCurrentBalance; + + UINT32 uiCurrentScreen; + + BOOLEAN fAlternateSector; + + BOOLEAN fWorldLoaded; + + UINT8 ubLoadScreenID; //The load screen that should be used when loading the saved game + + GAME_OPTIONS sInitialGameOptions; //need these in the header so we can get the info from it on the save load screen. + + UINT32 uiRandom; + + UINT8 ubFiller[110]; + +} SAVED_GAME_HEADER; + + + +extern UINT32 guiScreenToGotoAfterLoadingSavedGame; +extern UINT32 guiSaveGameVersion; + +void CreateSavedGameFileNameFromNumber( UINT8 ubSaveGameID, STR pzNewFileName ); + + + + +BOOLEAN SaveGame( UINT8 ubSaveGameID, STR16 pGameDesc ); +BOOLEAN LoadSavedGame( UINT8 ubSavedGameID ); + +BOOLEAN CopySavedSoldierInfoToNewSoldier( SOLDIERTYPE *pDestSourceInfo, SOLDIERTYPE *pSourceInfo ); + +BOOLEAN SaveFilesToSavedGame( STR pSrcFileName, HWFILE hFile ); +BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile ); + +BOOLEAN DoesUserHaveEnoughHardDriveSpace(); + +void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ ); + + +extern UINT32 guiLastSaveGameNum; +INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave ); + +#endif diff --git a/SaveLoadScreen.cpp b/SaveLoadScreen.cpp new file mode 100644 index 00000000..aa52081b --- /dev/null +++ b/SaveLoadScreen.cpp @@ -0,0 +1,2557 @@ +#ifdef PRECOMPILEDHEADERS + #include "JA2 All.h" +#else + #include "Types.h" + #include "SaveLoadScreen.h" + #include "Video.h" + #include "Font Control.h" + #include "Game Clock.h" + #include "Render Dirty.h" + #include "Text Input.h" + #include "SaveLoadGame.h" + #include "Stdio.h" + #include "WordWrap.h" + #include "StrategicMap.h" + #include "Finances.h" + #include "WCheck.h" + #include "Utilities.h" + #include "Cursors.h" + #include "VObject.h" + #include "Merc Hiring.h" + #include "LaptopSave.h" + #include "Options Screen.h" + #include "GameVersion.h" + #include "SysUtil.h" + #include "Tactical Save.h" + #include "OverHead.h" + #include "gamescreen.h" + #include "GameSettings.h" + #include "fade screen.h" + #include "English.h" + #include "Gameloop.h" + #include "Game Init.h" + #include "Sys Globals.h" + #include "Text.h" + #include "Message.h" + #include "Map Screen Interface.h" + #include "Multi Language Graphic Utils.h" +#endif + +#include "Campaign Init.h" + +BOOLEAN gfSchedulesHosed = FALSE; +extern UINT32 guiBrokenSaveGameVersion; + +////////////////////////////////////////////////////// +// +// Defines +// +////////////////////////////////////////////////////// + +#define SAVE_LOAD_TITLE_FONT FONT14ARIAL +#define SAVE_LOAD_TITLE_COLOR FONT_MCOLOR_WHITE + +#define SAVE_LOAD_NORMAL_FONT FONT12ARIAL +#define SAVE_LOAD_NORMAL_COLOR 2 +#define SAVE_LOAD_NORMAL_SHADOW_COLOR 118 + +#define SAVE_LOAD_QUICKSAVE_FONT FONT12ARIAL +#define SAVE_LOAD_QUICKSAVE_COLOR 2 +#define SAVE_LOAD_QUICKSAVE_SHADOW_COLOR 189 + +#define SAVE_LOAD_EMPTYSLOT_FONT FONT12ARIAL +#define SAVE_LOAD_EMPTYSLOT_COLOR 2 +#define SAVE_LOAD_EMPTYSLOT_SHADOW_COLOR 121 + +#define SAVE_LOAD_HIGHLIGHTED_FONT FONT12ARIAL +#define SAVE_LOAD_HIGHLIGHTED_COLOR FONT_MCOLOR_WHITE +#define SAVE_LOAD_HIGHLIGHTED_SHADOW_COLOR 2 + +#define SAVE_LOAD_SELECTED_FONT FONT12ARIAL +#define SAVE_LOAD_SELECTED_COLOR 2 +#define SAVE_LOAD_SELECTED_SHADOW_COLOR 130 + +#define SAVE_LOAD_NUMBER_FONT FONT12ARIAL +#define SAVE_LOAD_NUMBER_COLOR FONT_MCOLOR_WHITE + +#define SLG_SELECTED_COLOR FONT_MCOLOR_WHITE +#define SLG_UNSELECTED_COLOR FONT_MCOLOR_DKWHITE + +#define SLG_SAVELOCATION_WIDTH 605 +#define SLG_SAVELOCATION_HEIGHT 30 +#define SLG_FIRST_SAVED_SPOT_X iScreenWidthOffset + 17 +#define SLG_FIRST_SAVED_SPOT_Y iScreenHeightOffset + 49 +#define SLG_GAP_BETWEEN_LOCATIONS 35 + +#define SLG_DATE_OFFSET_X 13 +#define SLG_DATE_OFFSET_Y 11 + +#define SLG_SECTOR_OFFSET_X 95 +#define SLG_SECTOR_OFFSET_Y SLG_DATE_OFFSET_Y +#define SLG_SECTOR_WIDTH 98 + +#define SLG_NUM_MERCS_OFFSET_X 196 +#define SLG_NUM_MERCS_OFFSET_Y SLG_DATE_OFFSET_Y + +#define SLG_BALANCE_OFFSET_X 260 +#define SLG_BALANCE_OFFSET_Y SLG_DATE_OFFSET_Y + +#define SLG_SAVE_GAME_DESC_X 318 +#define SLG_SAVE_GAME_DESC_Y SLG_DATE_OFFSET_Y + +#define SLG_TITLE_POS_X iScreenWidthOffset +#define SLG_TITLE_POS_Y iScreenHeightOffset + +#define SLG_SAVE_CANCEL_POS_X iScreenWidthOffset + 226 +#define SLG_LOAD_CANCEL_POS_X iScreenWidthOffset + 329 +#define SLG_CANCEL_POS_Y iScreenHeightOffset + 438 + +#define SLG_SAVE_LOAD_BTN_POS_X iScreenWidthOffset + 123 +#define SLG_SAVE_LOAD_BTN_POS_Y iScreenHeightOffset + 438 + +#define SLG_SELECTED_SLOT_GRAPHICS_NUMBER 3 +#define SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER 2 + +#define SLG_DOUBLE_CLICK_DELAY 500 + +//defines for saved game version status +enum +{ + SLS_HEADER_OK, + SLS_SAVED_GAME_VERSION_OUT_OF_DATE, + SLS_GAME_VERSION_OUT_OF_DATE, + SLS_BOTH_SAVE_GAME_AND_GAME_VERSION_OUT_OF_DATE, +}; + +////////////////////////////////////////////////////// +// +// Global Variables +// +////////////////////////////////////////////////////// + +extern void NextLoopCheckForEnoughFreeHardDriveSpace(); + +BOOLEAN gfSaveLoadScreenEntry = TRUE; +BOOLEAN gfSaveLoadScreenExit = FALSE; +BOOLEAN gfRedrawSaveLoadScreen = TRUE; + +BOOLEAN gfExitAfterMessageBox = FALSE; +INT32 giSaveLoadMessageBox = -1; // SaveLoad pop up messages index value + +UINT32 guiSaveLoadExitScreen = SAVE_LOAD_SCREEN; + +//Contains the array of valid save game locations +BOOLEAN gbSaveGameArray[ NUM_SAVE_GAMES ]; + +BOOLEAN gfDoingQuickLoad = FALSE; + +BOOLEAN gfFailedToSaveGameWhenInsideAMessageBox = FALSE; + +//This flag is used to diferentiate between loading a game and saveing a game. +// gfSaveGame=TRUE For saving a game +// gfSaveGame=FALSE For loading a game +BOOLEAN gfSaveGame=TRUE; + +BOOLEAN gfSaveLoadScreenButtonsCreated = FALSE; + +INT8 gbSaveGameSelectedLocation[ NUM_SAVE_GAMES ]; +INT8 gbSelectedSaveLocation=-1; +INT8 gbHighLightedLocation=-1; +INT8 gbLastHighLightedLocation=-1; +INT8 gbSetSlotToBeSelected=-1; + +UINT32 guiSlgBackGroundImage; +UINT32 guiBackGroundAddOns; + + +// The string that will contain the game desc text +wchar_t gzGameDescTextField[ SIZE_OF_SAVE_GAME_DESC ] = {0} ; + + +BOOLEAN gfUserInTextInputMode = FALSE; +UINT8 gubSaveGameNextPass=0; + +BOOLEAN gfStartedFadingOut = FALSE; + + +BOOLEAN gfCameDirectlyFromGame = FALSE; + + +BOOLEAN gfLoadedGame = FALSE; //Used to know when a game has been loaded, the flag in gtacticalstatus might have been reset already + +BOOLEAN gfLoadGameUponEntry = FALSE; + +BOOLEAN gfHadToMakeBasementLevels = FALSE; + +BOOLEAN gfGettingNameFromSaveLoadScreen = FALSE; + +#ifdef JA2BETAVERSION +extern BOOLEAN gfDisplaySaveGamesNowInvalidatedMsg; +#endif + +// +//Buttons +// +INT32 guiSlgButtonImage; + +// Cancel Button +void BtnSlgCancelCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiSlgCancelBtn; + +// Save game Button +void BtnSlgSaveLoadCallback(GUI_BUTTON *btn,INT32 reason); +UINT32 guiSlgSaveLoadBtn; +INT32 guiSaveLoadImage; + +//Mouse regions for the currently selected save game +MOUSE_REGION gSelectedSaveRegion[ NUM_SAVE_GAMES ]; +void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); +void SelectedSaveRegionMovementCallBack(MOUSE_REGION * pRegion, INT32 reason ); + +MOUSE_REGION gSLSEntireScreenRegion; +void SelectedSLSEntireRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); + +////////////////////////////////////////////////////// +// +// Function Prototypes +// +////////////////////////////////////////////////////// + +BOOLEAN EnterSaveLoadScreen(); +void RenderSaveLoadScreen(); +void ExitSaveLoadScreen(); +void HandleSaveLoadScreen(); +void GetSaveLoadScreenUserInput(); +void SaveLoadGameNumber( INT8 bSaveGameID ); +BOOLEAN LoadSavedGameHeader( INT8 bEntry, SAVED_GAME_HEADER *pSaveGameHeader ); +BOOLEAN DisplaySaveGameEntry( INT8 bEntryID );//, UINT16 usPosY ); +BOOLEAN DisplaySaveGameList(); +void InitSaveLoadScreenTextInputBoxes(); +void DestroySaveLoadTextInputBoxes(); +void SetSelection( UINT8 ubNewSelection ); +UINT8 CompareSaveGameVersion( INT8 bSaveGameID ); +void LoadSavedGameWarningMessageBoxCallBack( UINT8 bExitValue ); +void LoadSavedGameDeleteAllSaveGameMessageBoxCallBack( UINT8 bExitValue ); +void DeleteAllSaveGameFile( ); +void DisplayOnScreenNumber( BOOLEAN fErase ); + + +void DisableSelectedSlot(); + +void ConfirmSavedGameMessageBoxCallBack( UINT8 bExitValue ); +void ConfirmLoadSavedGameMessageBoxCallBack( UINT8 bExitValue ); +//void FailedSavingGameCallBack( UINT8 bExitValue ); +void FailedLoadingGameCallBack( UINT8 bExitValue ); +void SetSaveLoadExitScreen( UINT32 uiScreen ); + +void NotEnoughHardDriveSpaceForQuickSaveMessageBoxCallBack( UINT8 bExitValue ); +void NotEnoughHardDriveSpaceForNormalSaveMessageBoxCallBack( UINT8 bExitValue ); + +void RedrawSaveLoadScreenAfterMessageBox( UINT8 bExitValue ); +void ClearSelectedSaveSlot(); +void MoveSelectionUpOrDown( BOOLEAN fUp ); +void SaveGameToSlotNum(); +void StartFadeOutForSaveLoadScreen(); + +//ppp + + + + +////////////////////////////////////////////////////// +// +// Code +// +////////////////////////////////////////////////////// + + +UINT32 SaveLoadScreenInit() +{ + //Set so next time we come in, we can set up + gfSaveLoadScreenEntry = TRUE; + + memset( gbSaveGameArray, -1, NUM_SAVE_GAMES); + + ClearSelectedSaveSlot(); + + gbHighLightedLocation=-1; + + + + return( TRUE ); +} + + + +UINT32 SaveLoadScreenHandle() +{ + StartFrameBufferRender(); + + if( gfSaveLoadScreenEntry ) + { + EnterSaveLoadScreen(); + gfSaveLoadScreenEntry = FALSE; + gfSaveLoadScreenExit = FALSE; + + PauseGame(); + + //save the new rect + BlitBufferToBuffer(guiRENDERBUFFER, guiSAVEBUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + } + + RestoreBackgroundRects(); + + //to guarentee that we do not accept input when we are fading out + if( !gfStartedFadingOut ) + { + GetSaveLoadScreenUserInput(); + } + else + gfRedrawSaveLoadScreen = FALSE; + + //if we have exited the save load screen, exit + if( !gfSaveLoadScreenButtonsCreated ) + return( guiSaveLoadExitScreen ); + + RenderAllTextFields(); + + HandleSaveLoadScreen(); + + if( gfRedrawSaveLoadScreen ) + { + RenderSaveLoadScreen(); + MarkButtonsDirty( ); + RenderButtons(); + + gfRedrawSaveLoadScreen = FALSE; + } + + if( gubSaveGameNextPass != 0 ) + { + gubSaveGameNextPass++; + + if( gubSaveGameNextPass == 5 ) + { + gubSaveGameNextPass = 0; + SaveLoadGameNumber( gbSelectedSaveLocation ); + } + } + + + //If we are not exiting the screen, render the buttons + if( !gfSaveLoadScreenExit && guiSaveLoadExitScreen == SAVE_LOAD_SCREEN ) + { + // render buttons marked dirty + RenderButtons( ); + } + + + // ATE: Put here to save RECTS before any fast help being drawn... + SaveBackgroundRects( ); + RenderButtonsFastHelp(); + + ExecuteBaseDirtyRectQueue( ); + EndFrameBufferRender( ); + + if ( HandleFadeOutCallback( ) ) + { + return( guiSaveLoadExitScreen ); + } + + if ( HandleBeginFadeOut( SAVE_LOAD_SCREEN ) ) + { + return( SAVE_LOAD_SCREEN ); + } + + + if( gfSaveLoadScreenExit ) + { + ExitSaveLoadScreen(); + } + + if ( HandleFadeInCallback( ) ) + { + // Re-render the scene! + RenderSaveLoadScreen(); + } + + if ( HandleBeginFadeIn( SAVE_LOAD_SCREEN ) ) + { + } + + return( guiSaveLoadExitScreen ); +} + + + +UINT32 SaveLoadScreenShutdown() +{ + + return( TRUE ); +} + + + + + + + + + + + +void SetSaveLoadExitScreen( UINT32 uiScreen ) +{ + if( uiScreen == GAME_SCREEN ) + { + EnterTacticalScreen( ); + } + + //If we are currently in the Message box loop +// if( gfExitAfterMessageBox ) +// ExitSaveLoadScreen(); + + + gfSaveLoadScreenExit = TRUE; + + guiSaveLoadExitScreen = uiScreen; + + SetPendingNewScreen( uiScreen ); + + if( gfDoingQuickLoad ) + { + fFirstTimeInGameScreen = TRUE; + SetPendingNewScreen( uiScreen ); + } + + ExitSaveLoadScreen(); + + DestroySaveLoadTextInputBoxes(); +} + + + +BOOLEAN EnterSaveLoadScreen() +{ + INT8 i; + VOBJECT_DESC VObjectDesc; + UINT16 usPosX = SLG_FIRST_SAVED_SPOT_X; + UINT16 usPosY = SLG_FIRST_SAVED_SPOT_Y; + + // WANNE + // Black background + //ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 ); + +// if( guiPreviousOptionScreen != MAINMENU_SCREEN ) +// gbSetSlotToBeSelected = -1; + + // This is a hack to get sector names , but... if the underground sector is NOT loaded + if( !gpUndergroundSectorInfoHead ) + { + BuildUndergroundSectorInfoList(); + gfHadToMakeBasementLevels = TRUE; + } + else + { + gfHadToMakeBasementLevels = FALSE; + } + + guiSaveLoadExitScreen = SAVE_LOAD_SCREEN; + //init the list + InitSaveGameArray(); + + //Clear out all the saved background rects + EmptyBackgroundRects( ); + + //if the user has asked to load the selected save + if( gfLoadGameUponEntry ) + { + //make sure the save is valid + if( gGameSettings.bLastSavedGameSlot != -1 && gbSaveGameArray[ gGameSettings.bLastSavedGameSlot ] ) + { + gbSelectedSaveLocation = gGameSettings.bLastSavedGameSlot; + + //load the saved game + ConfirmLoadSavedGameMessageBoxCallBack( MSG_BOX_RETURN_YES ); + } + else + { //else the save isnt valid, so dont load it + gfLoadGameUponEntry = FALSE; + } + } + + // load Main background graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + FilenameForBPP("INTERFACE\\LoadScreen.sti", VObjectDesc.ImageFile); + CHECKF(AddVideoObject(&VObjectDesc, &guiSlgBackGroundImage)); + + // load Load Screen Add ons graphic and add it + VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; + GetMLGFilename( VObjectDesc.ImageFile, MLG_LOADSAVEHEADER ); + CHECKF(AddVideoObject(&VObjectDesc, &guiBackGroundAddOns)); + + + guiSlgButtonImage = LoadButtonImage("INTERFACE\\LoadScreenAddOns.sti", -1,6,-1,9,-1 ); +// guiSlgButtonImage = UseLoadedButtonImage( guiBackGroundAddOns, -1,9,-1,6,-1 ); + + + //Cancel button +// if( gfSaveGame ) +// usPosX = SLG_SAVE_CANCEL_POS_X; +// else + usPosX = SLG_LOAD_CANCEL_POS_X; + + guiSlgCancelBtn = CreateIconAndTextButton( guiSlgButtonImage, zSaveLoadText[SLG_CANCEL], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + usPosX, SLG_CANCEL_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnSlgCancelCallback ); + + + //Either the save or load button + if( gfSaveGame ) + { + + //If we are saving, dont have the save game button + guiSaveLoadImage = UseLoadedButtonImage( guiSlgButtonImage, -1,5,-1,8,-1 ); + + guiSlgSaveLoadBtn = CreateIconAndTextButton( guiSaveLoadImage, zSaveLoadText[SLG_SAVE_GAME], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + SLG_SAVE_LOAD_BTN_POS_X, SLG_SAVE_LOAD_BTN_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnSlgSaveLoadCallback ); + + } + else + { + guiSaveLoadImage = UseLoadedButtonImage( guiSlgButtonImage, -1,4,-1,7,-1 ); + + guiSlgSaveLoadBtn = CreateIconAndTextButton( guiSaveLoadImage, zSaveLoadText[SLG_LOAD_GAME], OPT_BUTTON_FONT, + OPT_BUTTON_ON_COLOR, DEFAULT_SHADOW, + OPT_BUTTON_OFF_COLOR, DEFAULT_SHADOW, + TEXT_CJUSTIFIED, + SLG_SAVE_LOAD_BTN_POS_X, SLG_SAVE_LOAD_BTN_POS_Y, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, + DEFAULT_MOVE_CALLBACK, BtnSlgSaveLoadCallback ); + } + + //if we are loading, disable the load button +// if( !gfSaveGame ) + { + SpecifyDisabledButtonStyle( guiSlgSaveLoadBtn, DISABLED_STYLE_HATCHED ); + + if( gbSetSlotToBeSelected == -1 ) + DisableButton( guiSlgSaveLoadBtn ); + } + + + usPosX = SLG_FIRST_SAVED_SPOT_X; + usPosY = SLG_FIRST_SAVED_SPOT_Y; + for(i=0; iuiFlags |= BUTTON_FORCE_UNDIRTY; + ButtonList[ guiSlgSaveLoadBtn ]->uiFlags |= BUTTON_FORCE_UNDIRTY; + + + // CLEAR THE FRAME BUFFER + pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); + memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES ); + UnLockVideoSurface( FRAME_BUFFER ); + + // CLEAR THE guiRENDERBUFFER + pDestBuf = LockVideoSurface( guiRENDERBUFFER, &uiDestPitchBYTES ); + memset(pDestBuf, 0, SCREEN_HEIGHT * uiDestPitchBYTES ); + UnLockVideoSurface( guiRENDERBUFFER ); + } + + gfGettingNameFromSaveLoadScreen = FALSE; + + return( TRUE ); +} + + +void ExitSaveLoadScreen() +{ + INT8 i; + + + gfLoadGameUponEntry = FALSE; + + if( !gfSaveLoadScreenButtonsCreated ) + return; + + gfSaveLoadScreenExit = FALSE; + gfSaveLoadScreenEntry = TRUE; + gfExitAfterMessageBox = FALSE; + + + UnloadButtonImage( guiSlgButtonImage ); + + RemoveButton( guiSlgCancelBtn ); + + //Remove the save / load button +// if( !gfSaveGame ) + { + RemoveButton( guiSlgSaveLoadBtn ); + UnloadButtonImage( guiSaveLoadImage ); + } + + for(i=0; i= NUM_SAVE_GAMES || bSaveGameID < 0 ) + { + return; + } + + if( gfSaveGame ) + { + INT8 bActiveTextField; + + bActiveTextField = (INT8)GetActiveFieldID(); + if( bActiveTextField && bActiveTextField != -1 ) + { + Get16BitStringFromField( (UINT8)bActiveTextField, gzGameDescTextField ); + } + + //if there is save game in the slot, ask for confirmation before overwriting + if( gbSaveGameArray[ bSaveGameID ] ) + { + CHAR16 sText[512]; + + swprintf( sText, zSaveLoadText[SLG_CONFIRM_SAVE], bSaveGameID ); + + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, sText, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmSavedGameMessageBoxCallBack ); + } + else + { + //else do NOT put up a confirmation + + //Save the game + SaveGameToSlotNum(); + } + } + else + { + //Check to see if the save game headers are the same + ubRetVal = CompareSaveGameVersion( bSaveGameID ); + if( ubRetVal != SLS_HEADER_OK ) + { + if( ubRetVal == SLS_GAME_VERSION_OUT_OF_DATE ) + { + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_GAME_VERSION_DIF], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_YESNO, LoadSavedGameWarningMessageBoxCallBack ); + } + else if( ubRetVal == SLS_SAVED_GAME_VERSION_OUT_OF_DATE ) + { + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_SAVED_GAME_VERSION_DIF], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_YESNO, LoadSavedGameWarningMessageBoxCallBack ); + } + else + { + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_BOTH_GAME_AND_SAVED_GAME_DIF], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_YESNO, LoadSavedGameWarningMessageBoxCallBack ); + } + } + else + { +/* + IF YOU UNCOMMENT THIS -- LOCALIZE IT!!! + CHAR16 sText[512]; + + swprintf( sText, L"%s%d?", zSaveLoadText[SLG_CONFIRM_LOAD], bSaveGameID ); + + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, sText, SAVE_LOAD_SCREEN, MSG_BOX_FLAG_YESNO, ConfirmLoadSavedGameMessageBoxCallBack ); +*/ + //Setup up the fade routines + StartFadeOutForSaveLoadScreen(); + } + } +} + + +BOOLEAN DoSaveLoadMessageBoxWithRect( UINT8 ubStyle, INT16 *zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ) +{ + // do message box and return + giSaveLoadMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, pCenteringRect ); + + // send back return state + return( ( giSaveLoadMessageBox != -1 ) ); +} + +template +BOOLEAN DoSaveLoadMessageBox( UINT8 ubStyle, string2 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ) +{ + SGPRect CenteringRect= {0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1 }; + + // do message box and return + giSaveLoadMessageBox = DoMessageBox( ubStyle, zString, uiExitScreen, ( UINT8 ) ( usFlags| MSG_BOX_FLAG_USE_CENTERING_RECT ), ReturnCallback, &CenteringRect ); + + // send back return state + return( ( giSaveLoadMessageBox != -1 ) ); +} + + + +BOOLEAN InitSaveGameArray() +{ + INT8 cnt; + CHAR8 zSaveGameName[ 512 ]; + SAVED_GAME_HEADER SaveGameHeader; + + + for( cnt=0; cnt NUM_SAVE_GAMES ) + { + memset( &pSaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); + return( FALSE ); + } + + //Get the name of the file + CreateSavedGameFileNameFromNumber( bEntry, zSavedGameName ); + + if( FileExists( zSavedGameName ) ) + { + // create the save game file + hFile = FileOpen( zSavedGameName, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + gbSaveGameArray[ bEntry ] = FALSE; + return(FALSE); + } + + //Load the Save Game header file + FileRead( hFile, pSaveGameHeader, sizeof( SAVED_GAME_HEADER ), &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( SAVED_GAME_HEADER ) ) + { + FileClose( hFile ); + gbSaveGameArray[ bEntry ] = FALSE; + return(FALSE); + } + + FileClose( hFile ); + + // + // Do some Tests on the header to make sure it is valid + // + + //Check to see if the desc field is bigger then it should be, ie no null char + if( wcslen( pSaveGameHeader->sSavedGameDesc ) >= SIZE_OF_SAVE_GAME_DESC ) + { + memset( pSaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); + gbSaveGameArray[ bEntry ] = FALSE; + return(FALSE); + } + + //Check to see if the version # field is bigger then it should be, ie no null char + if( strlen( pSaveGameHeader->zGameVersionNumber ) >= GAME_VERSION_LENGTH ) + { + memset( pSaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); + gbSaveGameArray[ bEntry ] = FALSE; + return(FALSE); + } + } + else + { + memset( &pSaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); +#ifdef JA2BETAVERSION + wcscpy( pSaveGameHeader->sSavedGameDesc, L"ERROR loading saved game header, file doesn't exist!!" ); +#endif + } + + return( TRUE ); +} + + +void BtnSlgCancelCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + //Exit back + if( gfCameDirectlyFromGame ) + SetSaveLoadExitScreen( guiPreviousOptionScreen ); + + else if( guiPreviousOptionScreen == MAINMENU_SCREEN ) + SetSaveLoadExitScreen( MAINMENU_SCREEN ); + + else + SetSaveLoadExitScreen( OPTIONS_SCREEN ); + + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + + + +void BtnSlgSaveLoadCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + SaveLoadGameNumber( gbSelectedSaveLocation ); + + + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} + +/* +void BtnSlgLoadCallback(GUI_BUTTON *btn,INT32 reason) +{ + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + btn->uiFlags |= BUTTON_CLICKED_ON; + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + + SaveLoadGameNumber( gbSelectedSaveLocation ); + + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + } +} +*/ + + + +void SelectedSaveRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) +{ + INT8 bActiveTextField; + + if (iReason & MSYS_CALLBACK_REASON_INIT) + { + } + else if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + UINT8 bSelected = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); + static UINT32 uiLastTime = 0; + UINT32 uiCurTime = GetJA2Clock(); + INT32 i; + +/* + //If we are saving and this is the quick save slot + if( gfSaveGame && bSelected == 0 ) + { + //Display a pop up telling user what the quick save slot is + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_QUICK_SAVE_RESERVED_FOR_TACTICAL ], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); + return; + } + + SetSelection( bSelected ); +*/ + + //If we are saving and this is the quick save slot + if( gfSaveGame && bSelected == 0 ) + { + //Display a pop up telling user what the quick save slot is + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, pMessageStrings[ MSG_QUICK_SAVE_RESERVED_FOR_TACTICAL ], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_OK, RedrawSaveLoadScreenAfterMessageBox ); + return; + } + + //Reset the regions + for( i=0; iuiFlags &= (~BUTTON_CLICKED_ON ); + + + bTemp = gbHighLightedLocation; + gbHighLightedLocation = -1; +// DisplaySaveGameList(); + DisplaySaveGameEntry( bTemp ); + + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } + else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + pRegion->uiFlags |= BUTTON_CLICKED_ON ; + + //If we are saving and this is the quick save slot, leave + if( gfSaveGame && MSYS_GetRegionUserData( pRegion, 0 ) != 0 ) + { + return; + } + + gbLastHighLightedLocation = gbHighLightedLocation; + gbHighLightedLocation = (UINT8)MSYS_GetRegionUserData( pRegion, 0 ); + + DisplaySaveGameEntry( gbLastHighLightedLocation ); + DisplaySaveGameEntry( gbHighLightedLocation );//, usPosY ); + + InvalidateRegion(pRegion->RegionTopLeftX, pRegion->RegionTopLeftY, pRegion->RegionBottomRightX, pRegion->RegionBottomRightY); + } +} + + + + + +void InitSaveLoadScreenTextInputBoxes() +{ + UINT32 uiStartLoc=0; + UINT16 usPosY; + SAVED_GAME_HEADER SaveGameHeader; + + if( gbSelectedSaveLocation == -1 ) + return; + + if( !gfSaveGame ) + return; + + //if we are exiting, dont create the fields + if( gfSaveLoadScreenExit || guiSaveLoadExitScreen != SAVE_LOAD_SCREEN ) + return; + + + InitTextInputMode(); + + SetTextInputCursor( CUROSR_IBEAM_WHITE ); + SetTextInputFont( (UINT16) FONT12ARIALFIXEDWIDTH ); //FONT12ARIAL //FONT12ARIALFIXEDWIDTH + Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 0, 0, 0) ) ); + SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) ); + SetTextInputRegularColors( FONT_WHITE, 2 ); + SetTextInputHilitedColors( 2, FONT_WHITE, FONT_WHITE ); + SetCursorColor( Get16BPPColor(FROMRGB(255, 255, 255) ) ); + + AddUserInputField( NULL ); + + usPosY = SLG_FIRST_SAVED_SPOT_Y + SLG_GAP_BETWEEN_LOCATIONS * gbSelectedSaveLocation; + + //if there is already a string here, use its string + if( gbSaveGameArray[ gbSelectedSaveLocation ] ) + { + //if we are modifying a previously modifed string, use it + if( gzGameDescTextField[0] != '\0' ) + { + } + else + { + //Get the header for the specified saved game + LoadSavedGameHeader( gbSelectedSaveLocation, &SaveGameHeader ); + wcscpy( gzGameDescTextField, SaveGameHeader.sSavedGameDesc ); + } + } + else + gzGameDescTextField[0] = '\0'; + + //Game Desc Field + AddTextInputField( SLG_FIRST_SAVED_SPOT_X+SLG_SAVE_GAME_DESC_X, (INT16)(usPosY+SLG_SAVE_GAME_DESC_Y-5), SLG_SAVELOCATION_WIDTH-SLG_SAVE_GAME_DESC_X-7, 17, MSYS_PRIORITY_HIGH+2, gzGameDescTextField, 46, INPUTTYPE_ASCII );//23 + + SetActiveField( 1 ); + + gfUserInTextInputMode = TRUE; +} + +void DestroySaveLoadTextInputBoxes() +{ + gfUserInTextInputMode = FALSE; + KillAllTextInputModes(); + SetTextInputCursor( CURSOR_IBEAM ); +} + + +void SetSelection( UINT8 ubNewSelection ) +{ +// CHAR16 zMouseHelpTextString[256]; +// SAVED_GAME_HEADER SaveGameHeader; + + //if we are loading and there is no entry, return + if( !gfSaveGame ) + { + if( !gbSaveGameArray[ubNewSelection] ) + return; + } + + //Reset the selected slot background graphic + if( gbSelectedSaveLocation != -1 ) + { + gbSaveGameSelectedLocation[ gbSelectedSaveLocation ] = SLG_UNSELECTED_SLOT_GRAPHICS_NUMBER; + + //reset the slots help text + SetRegionFastHelpText( &gSelectedSaveRegion[ gbSelectedSaveLocation ], L"\0" ); + } + + gfRedrawSaveLoadScreen = TRUE; + DestroySaveLoadTextInputBoxes(); + + //if we are loading, + if( !gfSaveGame ) + { + //Enable the save/load button + EnableButton( guiSlgSaveLoadBtn ); + } + + //if we are to save + if( gfSaveGame ) + { + if( gbSelectedSaveLocation != ubNewSelection ) + { + //Destroy the previous region + DestroySaveLoadTextInputBoxes(); + + //reset selected slot + gbSelectedSaveLocation = ubNewSelection; + + //Null out the currently selected save game + gzGameDescTextField[0] = '\0'; + + //Init the text field for the game desc + InitSaveLoadScreenTextInputBoxes(); + } + + //Enable the save/load button + EnableButton( guiSlgSaveLoadBtn ); + } + + //reset selected slot + gbSelectedSaveLocation = ubNewSelection; + + //Set the selected slot background graphic + gbSaveGameSelectedLocation[ gbSelectedSaveLocation ] = SLG_SELECTED_SLOT_GRAPHICS_NUMBER; + +/* + //if we are saving AND it is the currently selected slot + if( gfSaveGame && gbSelectedSaveLocation == ubNewSelection ) + { + //copy over the initial game options + memcpy( &SaveGameHeader.sInitialGameOptions, &gGameOptions, sizeof( GAME_OPTIONS ) ); + } + else + { + //Get the header for the specified saved game + if( !LoadSavedGameHeader( ubNewSelection, &SaveGameHeader ) ) + { + memset( &SaveGameHeader, 0, sizeof( SaveGameHeader ) ); + } + } + + swprintf( zMouseHelpTextString, L"%s: %s\n%s: %s\n%s: %s\n%s: %s", gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], + gzGIOScreenText[ GIO_DIF_LEVEL_TEXT + SaveGameHeader.sInitialGameOptions.ubDifficultyLevel + 1 ], + + gzGIOScreenText[ GIO_TIMED_TURN_TITLE_TEXT ], + gzGIOScreenText[ GIO_TIMED_TURN_TITLE_TEXT + SaveGameHeader.sInitialGameOptions.fTurnTimeLimit + 1], + + gzGIOScreenText[ GIO_GUN_OPTIONS_TEXT ], + gzGIOScreenText[ GIO_GUN_OPTIONS_TEXT + 2 - SaveGameHeader.sInitialGameOptions.fGunNut ], + + gzGIOScreenText[ GIO_GAME_STYLE_TEXT ], + gzGIOScreenText[ GIO_GAME_STYLE_TEXT + (SaveGameHeader.sInitialGameOptions.ubGameStyle == STYLE_SCIFI)?1:0; + 1 ] ); + + //set the slots help text + SetRegionFastHelpText( &gSelectedSaveRegion[ gbSelectedSaveLocation ], zMouseHelpTextString ); + */ +} + + +UINT8 CompareSaveGameVersion( INT8 bSaveGameID ) +{ + UINT8 ubRetVal=SLS_HEADER_OK; + + SAVED_GAME_HEADER SaveGameHeader; + + //Get the heade for the saved game + LoadSavedGameHeader( bSaveGameID, &SaveGameHeader ); + + // check to see if the saved game version in the header is the same as the current version + if( SaveGameHeader.uiSavedGameVersion != guiSavedGameVersion ) + { + ubRetVal = SLS_SAVED_GAME_VERSION_OUT_OF_DATE; + } + + if( strcmp( SaveGameHeader.zGameVersionNumber, czVersionNumber ) != 0 ) + { + if( ubRetVal == SLS_SAVED_GAME_VERSION_OUT_OF_DATE ) + ubRetVal = SLS_BOTH_SAVE_GAME_AND_GAME_VERSION_OUT_OF_DATE; + else + ubRetVal = SLS_GAME_VERSION_OUT_OF_DATE; + } + + return( ubRetVal ); +} + + +void LoadSavedGameWarningMessageBoxCallBack( UINT8 bExitValue ) +{ + // yes, load the game + if( bExitValue == MSG_BOX_RETURN_YES ) + { + //Setup up the fade routines + StartFadeOutForSaveLoadScreen(); + } + + //The user does NOT want to continue.. + else + { + //ask if the user wants to delete all the saved game files + DoSaveLoadMessageBox( MSG_BOX_BASIC_STYLE, zSaveLoadText[SLG_DELETE_ALL_SAVE_GAMES], SAVE_LOAD_SCREEN, MSG_BOX_FLAG_YESNO, LoadSavedGameDeleteAllSaveGameMessageBoxCallBack ); + } +} + + +void LoadSavedGameDeleteAllSaveGameMessageBoxCallBack( UINT8 bExitValue ) +{ + // yes, Delete all the save game files + if( bExitValue == MSG_BOX_RETURN_YES ) + { + DeleteAllSaveGameFile( ); + gfSaveLoadScreenExit = TRUE; + } + + gfExitAfterMessageBox = TRUE; + + SetSaveLoadExitScreen( OPTIONS_SCREEN ); + + gbSelectedSaveLocation=-1; +} + +void DeleteAllSaveGameFile( ) +{ + UINT8 cnt; + + for( cnt=0; cnt 1 ) + { + SetSelection( (UINT8)(gbSelectedSaveLocation-1) ); + } + } + else + { + //if the selected slot is invalid + if( gbSelectedSaveLocation == -1 ) + { + SetSelection( 1 ); + } + else + { + if( gbSelectedSaveLocation >= 1 && gbSelectedSaveLocation < NUM_SAVE_GAMES-1 ) + { + SetSelection( (UINT8)(gbSelectedSaveLocation + 1) ); + } + } + } + } + + else + { + if( fUp ) + { + for( i=gbSelectedSaveLocation-1; i>=0; i--) + { + if( gbSaveGameArray[i] ) + { + ClearSelectedSaveSlot(); + + SetSelection( (UINT8)i ); + break; + } + } + } + else + { + //if there is no selected slot, move the selected slot to the first slot + if( gbSelectedSaveLocation == -1 ) + { + ClearSelectedSaveSlot(); + + SetSelection( 0 ); + } + else + { + for( i=gbSelectedSaveLocation+1; i +BOOLEAN DoSaveLoadMessageBox( UINT8 ubStyle, string2 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback ); + +BOOLEAN InitSaveGameArray(); + +void DoneFadeOutForSaveLoadScreen( void ); +void DoneFadeInForSaveLoadScreen( void ); + + +BOOLEAN DoQuickSave(); +BOOLEAN DoQuickLoad(); + +BOOLEAN IsThereAnySavedGameFiles(); + +void DeleteSaveGameNumber( UINT8 ubSaveGameSlotID ); + + +#endif diff --git a/Standard Gaming Platform/Bitmap.h b/Standard Gaming Platform/Bitmap.h new file mode 100644 index 00000000..81bc4b35 --- /dev/null +++ b/Standard Gaming Platform/Bitmap.h @@ -0,0 +1,63 @@ +//************************************************************************** +// +// Filename : bitmap.h +// +// Purpose : bitmap format +// +// Modification history : +// +// 20nov96:HJH - Creation +// +//************************************************************************** + +#ifndef _bitmap_h +#define _bitmap_h + +//************************************************************************** +// +// Includes +// +//************************************************************************** + +#include "types.h" + +//************************************************************************** +// +// Defines +// +//************************************************************************** + +//************************************************************************** +// +// Typedefs +// +//************************************************************************** + +typedef struct sgpBmHeadertag +{ + UINT32 uiNumBytes; // number of bytes of the bitmap, including the + // memory for all variables in this structure plus + // all the memory in bitmap + UINT32 uiWidth; // width of bitmap in pixels + UINT32 uiHeight; // height of bitmap in pixels + UINT8 uiBitDepth; // 8, 16, 24, or 32 + UINT8 uiNumPalEntries; // if uiBitDepth is 8, non-zero, else 0 +} SGPBmHeader; + +typedef struct sgpBitmaptag +{ + SGPBmHeader header; + UINT8 uiData[1]; // if uiNumPalEntries != 0 + // uiNumPalEntries*3 (rgb) bytes for palette + // if uiBitDepth == 8 + // uiWidth * uiHeight bytes + // else if uiBitDepth == 16 + // uiWidth * uiHeight * 2 bytes + // else if uiBitDepth == 24 + // uiWidth * uiHeight * 3 bytes + // else if uiBitDepth == 32 + // uiWidth * uiHeight * 4 bytes +} SGPBitmap; + +#endif + diff --git a/Standard Gaming Platform/Button Sound Control.cpp b/Standard Gaming Platform/Button Sound Control.cpp new file mode 100644 index 00000000..404fe718 --- /dev/null +++ b/Standard Gaming Platform/Button Sound Control.cpp @@ -0,0 +1,193 @@ +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "types.h" + #include "Button System.h" + #include "Button Sound Control.h" + #include "Sound Control.h" + #include "jascreens.h" +#endif + +void SpecifyButtonSoundScheme( INT32 iButtonID, INT8 bSoundScheme ) +{ + ButtonList[ iButtonID ]->ubSoundSchemeID = (UINT8)bSoundScheme; + if( bSoundScheme == BUTTON_SOUND_SCHEME_GENERIC ) + { + #ifdef JA2 + switch( guiCurrentScreen ) + { + case MAINMENU_SCREEN: + case OPTIONS_SCREEN: + case LOADSAVE_SCREEN: + case SAVE_LOAD_SCREEN: + case INIT_SCREEN: + ButtonList[ iButtonID ]->ubSoundSchemeID = BUTTON_SOUND_SCHEME_BIGSWITCH3; + break; + + case LAPTOP_SCREEN: + ButtonList[ iButtonID ]->ubSoundSchemeID = BUTTON_SOUND_SCHEME_COMPUTERBEEP2; + break; + + case AUTORESOLVE_SCREEN: + case MAP_SCREEN: + case GAME_SCREEN: + case SHOPKEEPER_SCREEN: + ButtonList[ iButtonID ]->ubSoundSchemeID = BUTTON_SOUND_SCHEME_SMALLSWITCH2; + break; + + case GAME_INIT_OPTIONS_SCREEN: + ButtonList[ iButtonID ]->ubSoundSchemeID = BUTTON_SOUND_SCHEME_VERYSMALLSWITCH2; + break; + + //Anything not handled gets NO sound. + //SHOPKEEPER_SCREEN, + //GAME_SCREEN, + //MSG_BOX_SCREEN, + + //ERROR_SCREEN, + //ANIEDIT_SCREEN, + //PALEDIT_SCREEN, + //DEBUG_SCREEN, + //SEX_SCREEN, + } + #endif + if( bSoundScheme == BUTTON_SOUND_SCHEME_GENERIC ) + bSoundScheme = BUTTON_SOUND_SCHEME_NONE; + } +} + +void PlayButtonSound( INT32 iButtonID, INT32 iSoundType ) +{ + if ( ButtonList[ iButtonID ] == NULL ) + { + return; + } + + switch( ButtonList[ iButtonID ]->ubSoundSchemeID ) + { + case BUTTON_SOUND_SCHEME_NONE: + case BUTTON_SOUND_SCHEME_GENERIC: + break; + +#ifdef JA2 + + case BUTTON_SOUND_SCHEME_VERYSMALLSWITCH1: + switch( iSoundType ) + { + case BUTTON_SOUND_CLICKED_ON: + PlayJA2Sample( VSM_SWITCH1_IN, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_CLICKED_OFF: + PlayJA2Sample( VSM_SWITCH1_OUT, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_DISABLED_CLICK: + PlayJA2SampleFromFile( "Sounds\\Disabled Button.wav", RATE_11025, 15, 1, MIDDLEPAN ); + break; + } + break; + case BUTTON_SOUND_SCHEME_VERYSMALLSWITCH2: + switch( iSoundType ) + { + case BUTTON_SOUND_CLICKED_ON: + PlayJA2Sample( VSM_SWITCH2_IN, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_CLICKED_OFF: + PlayJA2Sample( VSM_SWITCH2_OUT, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_DISABLED_CLICK: + PlayJA2SampleFromFile( "Sounds\\Disabled Button.wav", RATE_11025, 15, 1, MIDDLEPAN ); + break; + } + break; + case BUTTON_SOUND_SCHEME_SMALLSWITCH1: + switch( iSoundType ) + { + case BUTTON_SOUND_CLICKED_ON: + PlayJA2Sample( SM_SWITCH1_IN, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_CLICKED_OFF: + PlayJA2Sample( SM_SWITCH1_OUT, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_DISABLED_CLICK: + PlayJA2SampleFromFile( "Sounds\\Disabled Button.wav", RATE_11025, 15, 1, MIDDLEPAN ); + break; + } + break; + case BUTTON_SOUND_SCHEME_SMALLSWITCH2: + switch( iSoundType ) + { + case BUTTON_SOUND_CLICKED_ON: + PlayJA2Sample( SM_SWITCH2_IN, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_CLICKED_OFF: + PlayJA2Sample( SM_SWITCH2_OUT, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_DISABLED_CLICK: + PlayJA2SampleFromFile( "Sounds\\Disabled Button.wav", RATE_11025, 15, 1, MIDDLEPAN ); + break; + } + break; + case BUTTON_SOUND_SCHEME_SMALLSWITCH3: + switch( iSoundType ) + { + case BUTTON_SOUND_CLICKED_ON: + PlayJA2Sample( SM_SWITCH3_IN, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_CLICKED_OFF: + PlayJA2Sample( SM_SWITCH3_OUT, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_DISABLED_CLICK: + PlayJA2SampleFromFile( "Sounds\\Disabled Button.wav", RATE_11025, 15, 1, MIDDLEPAN ); + break; + } + break; + case BUTTON_SOUND_SCHEME_BIGSWITCH3: + switch( iSoundType ) + { + case BUTTON_SOUND_CLICKED_ON: + PlayJA2Sample( BIG_SWITCH3_IN, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_CLICKED_OFF: + PlayJA2Sample( BIG_SWITCH3_OUT, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_DISABLED_CLICK: + PlayJA2SampleFromFile( "Sounds\\Disabled Button.wav", RATE_11025, 15, 1, MIDDLEPAN ); + break; + } + break; + case BUTTON_SOUND_SCHEME_COMPUTERBEEP2: + switch( iSoundType ) + { + case BUTTON_SOUND_CLICKED_ON: + PlayJA2Sample( COMPUTER_BEEP2_IN, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_CLICKED_OFF: + PlayJA2Sample( COMPUTER_BEEP2_OUT, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_DISABLED_CLICK: + PlayJA2SampleFromFile( "Sounds\\Disabled Button.wav", RATE_11025, 15, 1, MIDDLEPAN ); + break; + } + break; + case BUTTON_SOUND_SCHEME_COMPUTERSWITCH1: + switch( iSoundType ) + { + case BUTTON_SOUND_CLICKED_ON: + PlayJA2Sample( COMPUTER_SWITCH1_IN, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_CLICKED_OFF: + PlayJA2Sample( COMPUTER_SWITCH1_OUT, RATE_11025, 15, 1, MIDDLEPAN ); + break; + case BUTTON_SOUND_DISABLED_CLICK: + PlayJA2SampleFromFile( "Sounds\\Disabled Button.wav", RATE_11025, 15, 1, MIDDLEPAN ); + break; + } + break; + +#endif + + } + +} \ No newline at end of file diff --git a/Standard Gaming Platform/Button Sound Control.h b/Standard Gaming Platform/Button Sound Control.h new file mode 100644 index 00000000..0a1d6c14 --- /dev/null +++ b/Standard Gaming Platform/Button Sound Control.h @@ -0,0 +1,20 @@ +#ifndef __BUTTON_SOUND_CONTROL_H +#define __BUTTON_SOUND_CONTROL_H + + +//These are gener +enum +{ + BUTTON_SOUND_SCHEME_NONE, + BUTTON_SOUND_SCHEME_GENERIC, + BUTTON_SOUND_SCHEME_VERYSMALLSWITCH1, + BUTTON_SOUND_SCHEME_VERYSMALLSWITCH2, + BUTTON_SOUND_SCHEME_SMALLSWITCH1, + BUTTON_SOUND_SCHEME_SMALLSWITCH2, + BUTTON_SOUND_SCHEME_SMALLSWITCH3, + BUTTON_SOUND_SCHEME_BIGSWITCH3, + BUTTON_SOUND_SCHEME_COMPUTERBEEP2, + BUTTON_SOUND_SCHEME_COMPUTERSWITCH1, +}; + +#endif diff --git a/Standard Gaming Platform/Button System.cpp b/Standard Gaming Platform/Button System.cpp new file mode 100644 index 00000000..2ec4f4b2 --- /dev/null +++ b/Standard Gaming Platform/Button System.cpp @@ -0,0 +1,4416 @@ +/*********************************************************************************************** + Button System.c + + Rewritten mostly by Kris Morness +***********************************************************************************************/ + +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "types.h" + #include + #include + #include + #include "debug.h" + #include "input.h" + #include "memman.h" + #include "english.h" + #include "vobject.h" + #include "vobject_blitters.h" + #include "soundman.h" + #include "Button System.h" + #include "line.h" + #include + #if defined( JA2 ) || defined( UTIL ) + #include "WordWrap.h" + #include "video.h" + #include "Button Sound Control.h" + #ifdef _JA2_RENDER_DIRTY + #include "Font Control.h" + #include "Render Dirty.h" + #include "utilities.h" + #endif + #else + #include "video2.h" + #endif +#endif + + +//ATE: Added to let Wiz default creating mouse regions with no cursor, JA2 default to a cursor ( first one ) +#ifdef JA2 + #define MSYS_STARTING_CURSORVAL 0 +#else + #define MSYS_STARTING_CURSORVAL MSYS_NO_CURSOR + // The following should be moved from here + #define GETPIXELDEPTH( ) ( gbPixelDepth ) // From "utilities.h" in JA2 + #define COLOR_RED 162 // From "lighting.h" in JA2 + #define COLOR_BLUE 203 + #define COLOR_YELLOW 144 + #define COLOR_GREEN 184 + #define COLOR_LTGREY 134 + #define COLOR_BROWN 80 + #define COLOR_PURPLE 160 + #define COLOR_ORANGE 76 + #define COLOR_WHITE 208 + #define COLOR_BLACK 72 + // this doesn't exactly belong here either... (From "Font Control.h" in JA2) + #define FONT_MCOLOR_BLACK 0 +#endif +#define COLOR_DKGREY 136 + + +#define MAX_GENERIC_PICS 40 +#define MAX_BUTTON_ICONS 40 + + +#define GUI_BTN_NONE 0 +#define GUI_BTN_DUPLICATE_VOBJ 1 +#define GUI_BTN_EXTERNAL_VOBJ 2 + + +UINT8 str[128]; + +//Kris: December 2, 1997 +//Special internal debugging utilities that will ensure that you don't attempt to delete +//an already deleted button, or it's images, etc. It will also ensure that you don't create +//the same button that already exists. +//TO REMOVE ALL DEBUG FUNCTIONALITY: simply comment out BUTTONSYSTEM_DEBUGGING definition +#ifdef JA2 + #ifdef _DEBUG + #define BUTTONSYSTEM_DEBUGGING + #endif +#endif + +#ifdef BUTTONSYSTEM_DEBUGGING +BOOLEAN gfIgnoreShutdownAssertions; // symbol already declared globally in mousesystem.cpp (jonathanl) +//Called immediately before assigning the button to the button list. +void AssertFailIfIdenticalButtonAttributesFound( GUI_BUTTON *b ) +{ + INT32 x; + GUI_BUTTON *c; + for( x = 0; x < MAX_BUTTONS; x++ ) + { + c = ButtonList[ x ]; + if( !c ) continue; + if( c->uiFlags & BUTTON_DELETION_PENDING ) continue; + if( c->UserData[3] == 0xffffffff ) continue; + if( b->Area.PriorityLevel != c->Area.PriorityLevel ) continue; + if( b->Area.RegionTopLeftX != c->Area.RegionTopLeftX ) continue; + if( b->Area.RegionTopLeftY != c->Area.RegionTopLeftY ) continue; + if( b->Area.RegionBottomRightX != c->Area.RegionBottomRightX ) continue; + if( b->Area.RegionBottomRightY != c->Area.RegionBottomRightY ) continue; + if( b->ClickCallback != c->ClickCallback ) continue; + if( b->MoveCallback != c->MoveCallback ) continue; + if( b->XLoc != c->XLoc ) continue; + if( b->YLoc != c->YLoc ) continue; + //if we get this far, it is reasonably safe to assume that the newly created + //button already exists. Placing a break point on the following assert will + //allow the coder to easily isolate the case! + sprintf( (char *)str, "Attempting to create a button that has already been created (existing buttonID %d).", c->IDNum ); + AssertMsg( 0, str ); + } +} +#endif + +//Kris: +//These are the variables used for the anchoring of a particular button. +//When you click on a button, it get's anchored, until you release the mouse button. +//When you move around, you don't want to select other buttons, even when you release +//it. This follows the Windows 95 convention. +GUI_BUTTON *gpAnchoredButton; +GUI_BUTTON *gpPrevAnchoredButton; +BOOLEAN gfAnchoredState; +void ReleaseAnchorMode(); + +INT8 gbDisabledButtonStyle; +void DrawHatchOnButton( GUI_BUTTON *b ); +void DrawShadeOnButton( GUI_BUTTON *b ); +void DrawDefaultOnButton( GUI_BUTTON *b ); + +GUI_BUTTON *gpCurrentFastHelpButton; + +BOOLEAN gfRenderHilights = TRUE; + +BUTTON_PICS ButtonPictures[MAX_BUTTON_PICS]; +INT32 ButtonPicsLoaded; + +UINT32 ButtonDestBuffer = BACKBUFFER; +UINT32 ButtonDestPitch = 640*2; +UINT32 ButtonDestBPP = 16; + +GUI_BUTTON *ButtonList[MAX_BUTTONS]; + +INT32 ButtonsInList=0; + +UINT16 GetWidthOfButtonPic( UINT16 usButtonPicID, INT32 iSlot ) +{ + return ButtonPictures[ usButtonPicID ].vobj->pETRLEObject[ iSlot ].usWidth; +} + +HVOBJECT GenericButtonGrayed[MAX_GENERIC_PICS]; +HVOBJECT GenericButtonOffNormal[MAX_GENERIC_PICS]; +HVOBJECT GenericButtonOffHilite[MAX_GENERIC_PICS]; +HVOBJECT GenericButtonOnNormal[MAX_GENERIC_PICS]; +HVOBJECT GenericButtonOnHilite[MAX_GENERIC_PICS]; +HVOBJECT GenericButtonBackground[MAX_GENERIC_PICS]; +UINT16 GenericButtonFillColors[MAX_GENERIC_PICS]; +UINT16 GenericButtonBackgroundIndex[MAX_GENERIC_PICS]; +INT16 GenericButtonOffsetX[MAX_GENERIC_PICS]; +INT16 GenericButtonOffsetY[MAX_GENERIC_PICS]; + +HVOBJECT GenericButtonIcons[MAX_BUTTON_ICONS]; + +// flag to state we wish to render buttons on the one after the next pass through render buttons +BOOLEAN fPausedMarkButtonsDirtyFlag = FALSE; +BOOLEAN fDisableHelpTextRestoreFlag = FALSE; + +BOOLEAN gfDelayButtonDeletion = FALSE; +BOOLEAN gfPendingButtonDeletion = FALSE; +void RemoveButtonsMarkedForDeletion(); + +extern MOUSE_REGION *MSYS_PrevRegion; +extern MOUSE_REGION *MSYS_CurrRegion; + +//============================================================================= +// FindFreeButtonSlot +// +// Finds an available slot for loading button pictures +// +INT32 FindFreeButtonSlot(void) +{ + int slot; + + // Are there any slots available? + if(ButtonPicsLoaded >= MAX_BUTTON_PICS) + return(BUTTON_NO_SLOT); + + // Search for a slot + for(slot=0;slot(unsigned char *, INT32, INT32, INT32, INT32, INT32); +template INT32 LoadButtonImage(char *, INT32, INT32, INT32, INT32, INT32); +template +INT32 LoadButtonImage(type1 filename, INT32 Grayed, INT32 OffNormal, INT32 OffHilite, INT32 OnNormal, INT32 OnHilite) +{ + VOBJECT_DESC vo_desc; + UINT32 UseSlot; + ETRLEObject *pTrav; + UINT32 MaxHeight,MaxWidth,ThisHeight,ThisWidth; + UINT32 MemBefore,MemAfter,MemUsed; + + AssertMsg(filename!=BUTTON_NO_FILENAME, "Attempting to LoadButtonImage() with null filename." ); + AssertMsg(strlen(filename), "Attempting to LoadButtonImage() with empty filename string." ); + + // is there ANY file to open? + if((Grayed == BUTTON_NO_IMAGE) && (OffNormal == BUTTON_NO_IMAGE) && (OffHilite == BUTTON_NO_IMAGE) && + (OnNormal == BUTTON_NO_IMAGE) && (OnHilite == BUTTON_NO_IMAGE)) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("No button pictures selected for %s",filename)); + return(-1); + } + + // Get a button image slot + if((UseSlot=FindFreeButtonSlot()) == BUTTON_NO_SLOT) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("Out of button image slots for %s",filename)); + return(-1); + } + + // Load the image + vo_desc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy(vo_desc.ImageFile, filename); + + MemBefore = MemGetFree(); + if((ButtonPictures[UseSlot].vobj = CreateVideoObject(&vo_desc)) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("Couldn't create VOBJECT for %s",filename)); + return(-1); + } + MemAfter = MemGetFree(); + MemUsed = MemBefore-MemAfter; + + // Init the QuickButton image structure with indexes to use + ButtonPictures[UseSlot].Grayed=Grayed; + ButtonPictures[UseSlot].OffNormal=OffNormal; + ButtonPictures[UseSlot].OffHilite=OffHilite; + ButtonPictures[UseSlot].OnNormal=OnNormal; + ButtonPictures[UseSlot].OnHilite=OnHilite; + ButtonPictures[UseSlot].fFlags = GUI_BTN_NONE; + + // Fit the button size to the largest image in the set + MaxWidth=MaxHeight=0; + if(Grayed != BUTTON_NO_IMAGE) + { + pTrav = &(ButtonPictures[UseSlot].vobj->pETRLEObject[Grayed]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OffNormal]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OffHilite]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OnNormal]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OnHilite]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[Grayed]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OffNormal]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OffHilite]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OnNormal]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OnHilite]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[Grayed]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OffNormal]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OffHilite]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OnNormal]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidthpETRLEObject[OnHilite]); + ThisHeight = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + ThisWidth = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + if(MaxWidth= MAX_BUTTON_PICS ) + { + sprintf( (char *)str, "Attempting to UnloadButtonImage with out of range index %d.", Index ); + AssertMsg( 0, str ); + } + + if( !ButtonPictures[ Index ].vobj ) + { + #ifdef BUTTONSYSTEM_DEBUGGING + if( gfIgnoreShutdownAssertions ) + #endif + return; + AssertMsg( 0, "Attempting to UnloadButtonImage that has a null vobj (already deleted)."); + } + + // If this is a duplicated button image, then don't trash the vobject + if(ButtonPictures[Index].fFlags & GUI_BTN_DUPLICATE_VOBJ || ButtonPictures[Index].fFlags & GUI_BTN_EXTERNAL_VOBJ) + { + ButtonPictures[Index].vobj = NULL; + ButtonPicsLoaded--; + } + else + { + // Deleting a non-duplicate, so see if any dups present. if so, then + // convert one of them to an original! + + fDone = FALSE; + for( x = 0; x < MAX_BUTTON_PICS && !fDone; x++ ) + { + if( (x != Index) && (ButtonPictures[x].vobj == ButtonPictures[Index].vobj) ) + { + if ( ButtonPictures[x].fFlags & GUI_BTN_DUPLICATE_VOBJ ) + { + // If we got here, then we got a duplicate object of the one we + // want to delete, so convert it to an original! + ButtonPictures[x].fFlags &= (~GUI_BTN_DUPLICATE_VOBJ); + + // Now remove this button, but not it's vobject + ButtonPictures[Index].vobj = NULL; + + fDone = TRUE; + ButtonPicsLoaded--; + } + } + } + } + + // If image slot isn't empty, delete the image + if(ButtonPictures[Index].vobj != NULL) + { + DeleteVideoObject(ButtonPictures[Index].vobj); + ButtonPictures[Index].vobj = NULL; + ButtonPicsLoaded--; + } +} + + + +//============================================================================= +// EnableButton +// +// Enables an already created button. +// +BOOLEAN EnableButton( INT32 iButtonID ) +{ + GUI_BUTTON *b; + UINT32 OldState; + + if( iButtonID < 0 || iButtonID >= MAX_BUTTONS ) + { + sprintf( (char *)str, "Attempting to EnableButton with out of range buttonID %d.", iButtonID ); + AssertMsg( 0, str ); + } + + b = ButtonList[ iButtonID ]; + + // If button exists, set the ENABLED flag + if( b ) + { + OldState = b->uiFlags & BUTTON_ENABLED; + b->uiFlags |= ( BUTTON_ENABLED | BUTTON_DIRTY ); + } + else + OldState = 0; + + + // Return previous ENABLED state of this button + return((OldState==BUTTON_ENABLED)?TRUE:FALSE); +} + + + +//============================================================================= +// DisableButton +// +// Disables a button. The button remains in the system list, and can be +// reactivated by calling EnableButton. +// +// Diabled buttons will appear "grayed out" on the screen (unless the +// graphics for such are not available). +// +BOOLEAN DisableButton(INT32 iButtonID ) +{ + GUI_BUTTON *b; + UINT32 OldState; + + if( iButtonID < 0 || iButtonID >= MAX_BUTTONS ) + { + sprintf( (char *)str, "Attempting to DisableButton with out of range buttonID %d.", iButtonID ); + AssertMsg( 0, str ); + } + + b = ButtonList[ iButtonID ]; + + // If button exists, reset the ENABLED flag + if( b ) + { + OldState = b->uiFlags & BUTTON_ENABLED; + b->uiFlags &= (~BUTTON_ENABLED); + b->uiFlags |= BUTTON_DIRTY; + } + else + OldState = 0; + + // Return previous ENABLED state of button + return((OldState==BUTTON_ENABLED)?TRUE:FALSE); +} + + + +//============================================================================= +// InitializeButtonImageManager +// +// Initializes the button image sub-system. This function is called by +// InitButtonSystem. +// +BOOLEAN InitializeButtonImageManager(INT32 DefaultBuffer, INT32 DefaultPitch, INT32 DefaultBPP) +{ + VOBJECT_DESC vo_desc; + UINT8 Pix; + int x; + + // Set up the default settings + if(DefaultBuffer != BUTTON_USE_DEFAULT) + ButtonDestBuffer = (UINT32)DefaultBuffer; + else + ButtonDestBuffer = FRAME_BUFFER; + + if(DefaultPitch != BUTTON_USE_DEFAULT) + ButtonDestPitch = (UINT32)DefaultPitch; + else + ButtonDestPitch = 640*2; + + if(DefaultBPP != BUTTON_USE_DEFAULT) + ButtonDestBPP = (UINT32)DefaultBPP; + else + ButtonDestBPP = 16; + + // Blank out all QuickButton images + for(x=0;xp16BPPPalette[Pix]; + else if(GETPIXELDEPTH()==8) + GenericButtonFillColors[0]=COLOR_DKGREY; + + return(TRUE); +} + + + +//============================================================================= +// FindFreeGenericSlot +// +// Finds the next available slot for generic (TEXT and/or ICONIC) buttons. +// +INT16 FindFreeGenericSlot(void) +{ + INT16 slot,x; + + slot=BUTTON_NO_SLOT; + for(x=0;x(char *); +template INT16 LoadGenericButtonIcon(char const *); +template +INT16 LoadGenericButtonIcon(string1 filename) +{ + INT16 ImgSlot; + VOBJECT_DESC vo_desc; + + AssertMsg(filename != BUTTON_NO_FILENAME, "Attempting to LoadGenericButtonIcon() with null filename."); + + // Get slot for icon image + if((ImgSlot=FindFreeIconSlot()) == BUTTON_NO_SLOT) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, "LoadGenericButtonIcon: Out of generic button icon slots"); + return(-1); + } + + // Load the icon + vo_desc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy(vo_desc.ImageFile, filename); + + if((GenericButtonIcons[ImgSlot] = CreateVideoObject(&vo_desc)) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("LoadGenericButtonIcon: Couldn't create VOBJECT for %s",filename)); + return(-1); + } + + // Return the slot number + return(ImgSlot); +} + +//============================================================================= +// UnloadGenericButtonIcon +// +// Removes a button icon graphic from the system +// +BOOLEAN UnloadGenericButtonIcon(INT16 GenImg) +{ + if( GenImg < 0 || GenImg >= MAX_BUTTON_ICONS ) + { + sprintf( (char *)str, "Attempting to UnloadGenericButtonIcon with out of range index %d.", GenImg ); + AssertMsg( 0, str ); + } + + if( !GenericButtonIcons[ GenImg ] ) + { + #ifdef BUTTONSYSTEM_DEBUGGING + if( gfIgnoreShutdownAssertions ) + #endif + return FALSE; + AssertMsg( 0, "Attempting to UnloadGenericButtonIcon that has no icon (already deleted)." ); + } + // If an icon is present in the slot, remove it. + DeleteVideoObject(GenericButtonIcons[GenImg]); + GenericButtonIcons[GenImg]=NULL; + return TRUE; +} + + + +//============================================================================= +// UnloadGenericButtonImage +// +// Removes the images associated with a generic button. Except the icon +// image of iconic buttons. See above. +// +BOOLEAN UnloadGenericButtonImage(INT16 GenImg) +{ + BOOLEAN fDeletedSomething = FALSE; + if( GenImg < 0 || GenImg >= MAX_GENERIC_PICS ) + { + sprintf( (char *)str, "Attempting to UnloadGenericButtonImage with out of range index %d.", GenImg ); + AssertMsg( 0, str ); + } + + // For each possible image type in a generic button, check if it's + // present, and if so, remove it. + if(GenericButtonGrayed[GenImg]!=NULL) + { + DeleteVideoObject(GenericButtonGrayed[GenImg]); + GenericButtonGrayed[GenImg]=NULL; + fDeletedSomething = TRUE; + } + + if(GenericButtonOffNormal[GenImg]!=NULL) + { + DeleteVideoObject(GenericButtonOffNormal[GenImg]); + GenericButtonOffNormal[GenImg]=NULL; + fDeletedSomething = TRUE; + } + + if(GenericButtonOffHilite[GenImg]!=NULL) + { + DeleteVideoObject(GenericButtonOffHilite[GenImg]); + GenericButtonOffHilite[GenImg]=NULL; + fDeletedSomething = TRUE; + } + + if(GenericButtonOnNormal[GenImg]!=NULL) + { + DeleteVideoObject(GenericButtonOnNormal[GenImg]); + GenericButtonOnNormal[GenImg]=NULL; + fDeletedSomething = TRUE; + } + + if(GenericButtonOnHilite[GenImg]!=NULL) + { + DeleteVideoObject(GenericButtonOnHilite[GenImg]); + GenericButtonOnHilite[GenImg]=NULL; + fDeletedSomething = TRUE; + } + + if(GenericButtonBackground[GenImg]!=NULL) + { + DeleteVideoObject(GenericButtonBackground[GenImg]); + GenericButtonBackground[GenImg]=NULL; + fDeletedSomething = TRUE; + } + + #ifdef BUTTONSYSTEM_DEBUGGING + if( !gfIgnoreShutdownAssertions && !fDeletedSomething ) + AssertMsg( 0, "Attempting to UnloadGenericButtonImage that has no images (already deleted)." ); + #endif + + // Reset the remaining variables + GenericButtonFillColors[GenImg]=0; + GenericButtonBackgroundIndex[GenImg]=0; + GenericButtonOffsetX[GenImg]=0; + GenericButtonOffsetY[GenImg]=0; + + return(TRUE); +} + + + +//============================================================================= +// LoadGenericButtonImages +// +// Loads the image files required for displaying a generic button. +// +INT16 LoadGenericButtonImages(UINT8 *GrayName,UINT8 *OffNormName,UINT8 *OffHiliteName,UINT8 *OnNormName,UINT8 *OnHiliteName,UINT8 *BkGrndName,INT16 Index,INT16 OffsetX, INT16 OffsetY) +{ + INT16 ImgSlot; + VOBJECT_DESC vo_desc; + UINT8 Pix; + + // if the images for Off-Normal and On-Normal don't exist, abort call + if((OffNormName == BUTTON_NO_FILENAME) || (OnNormName == BUTTON_NO_FILENAME)) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, "LoadGenericButtonImages: No filenames for OFFNORMAL and/or ONNORMAL images"); + return(-1); + } + + // Get a slot number for these images + if((ImgSlot=FindFreeGenericSlot()) == -1) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, "LoadGenericButtonImages: Out of generic button slots"); + return(-1); + } + + // Load the image for the Off-Normal button state (required) + vo_desc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy(vo_desc.ImageFile, OffNormName); + + if((GenericButtonOffNormal[ImgSlot] = CreateVideoObject(&vo_desc)) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("LoadGenericButtonImages: Couldn't create VOBJECT for %s",OffNormName)); + return(-1); + } + + // Load the image for the On-Normal button state (required) + vo_desc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy(vo_desc.ImageFile, OnNormName); + + if((GenericButtonOnNormal[ImgSlot] = CreateVideoObject(&vo_desc)) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("LoadGenericButtonImages: Couldn't create VOBJECT for %s",OnNormName)); + return(-1); + } + + // For the optional button state images, see if a filename was given, and + // if so, load it. + + if(GrayName != BUTTON_NO_FILENAME) + { + vo_desc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy(vo_desc.ImageFile, GrayName); + + if((GenericButtonGrayed[ImgSlot] = CreateVideoObject(&vo_desc)) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("LoadGenericButtonImages: Couldn't create VOBJECT for %s",GrayName)); + return(-1); + } + } + else + GenericButtonGrayed[ImgSlot] = NULL; + + if(OffHiliteName != BUTTON_NO_FILENAME) + { + vo_desc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy(vo_desc.ImageFile, OffHiliteName); + + if((GenericButtonOffHilite[ImgSlot] = CreateVideoObject(&vo_desc)) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("LoadGenericButtonImages: Couldn't create VOBJECT for %s",OffHiliteName)); + return(-1); + } + } + else + GenericButtonOffHilite[ImgSlot] = NULL; + + if(OnHiliteName != BUTTON_NO_FILENAME) + { + vo_desc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy(vo_desc.ImageFile, OnHiliteName); + + if((GenericButtonOnHilite[ImgSlot] = CreateVideoObject(&vo_desc)) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("LoadGenericButtonImages: Couldn't create VOBJECT for %s",OnHiliteName)); + return(-1); + } + } + else + GenericButtonOnHilite[ImgSlot] = NULL; + + if(BkGrndName != BUTTON_NO_FILENAME) + { + vo_desc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + strcpy(vo_desc.ImageFile, BkGrndName); + + if((GenericButtonBackground[ImgSlot] = CreateVideoObject(&vo_desc)) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, String("LoadGenericButtonImages: Couldn't create VOBJECT for %s",BkGrndName)); + return(-1); + } + } + else + GenericButtonBackground[ImgSlot] = NULL; + + GenericButtonBackgroundIndex[ImgSlot]=Index; + + // Get the background fill color from the last (9th) sub-image in the + // Off-Normal image. + Pix=0; + if(!GetETRLEPixelValue(&Pix,GenericButtonOffNormal[ImgSlot],8,0,0)) + { + DbgMessage(TOPIC_BUTTON_HANDLER, DBG_LEVEL_0, "LoadGenericButtonImages: Couldn't get generic button's background pixel value"); + return(-1); + } + + GenericButtonFillColors[ImgSlot]=GenericButtonOffNormal[ImgSlot]->p16BPPPalette[Pix]; + + // Set the button's background image adjustement offsets + GenericButtonOffsetX[ImgSlot]=OffsetX; + GenericButtonOffsetY[ImgSlot]=OffsetY; + + // Return the slot number used. + return(ImgSlot); +} + + +//============================================================================= +// ShutdownButtonImageManager +// +// Cleans up, and shuts down the button image manager sub-system. +// +// This function is called by ShutdownButtonSystem. +// +void ShutdownButtonImageManager(void) +{ + int x; + + #ifdef BUTTONSYSTEM_DEBUGGING + gfIgnoreShutdownAssertions = TRUE; + #endif + + // Remove all QuickButton images + for(x=0;xuiFlags & BUTTON_DELETION_PENDING ) + { + RemoveButton( i ); + } + } +} + +//============================================================================= +// RemoveButton +// +// Removes a button from the system's list. All memory associated with the +// button is released. +// +void RemoveButton(INT32 iButtonID) +{ + GUI_BUTTON *b; + + if( iButtonID < 0 || iButtonID >= MAX_BUTTONS ) + { + sprintf( (char *)str, "Attempting to RemoveButton with out of range buttonID %d.", iButtonID ); + AssertMsg( 0, str ); + } + + b = ButtonList[ iButtonID ]; + + // If button exists... + if( !b ) + { + #ifdef BUTTONSYSTEM_DEBUGGING + if( gfIgnoreShutdownAssertions ) + #endif + return; + AssertMsg( 0, "Attempting to remove a button that has already been deleted." ); + } + + //If we happen to be in the middle of a callback, and attempt to delete a button, + //like deleting a node during list processing, then we delay it till after the callback + //is completed. + if( gfDelayButtonDeletion ) + { + b->uiFlags |= BUTTON_DELETION_PENDING; + gfPendingButtonDeletion = TRUE; + return; + } + + //Kris: + if( b->uiFlags & BUTTON_SELFDELETE_IMAGE ) + { //checkboxes and simple create buttons have their own graphics associated with them, + //and it is handled internally. We delete it here. This provides the advantage of less + //micromanagement, but with the disadvantage of wasting more memory if you have lots of + //buttons using the same graphics. + UnloadButtonImage( b->ImageNum ); + } + + // ...kill it!!! + MSYS_RemoveRegion(&b->Area); + +#ifdef _JA2_RENDER_DIRTY + if ( b->uiFlags & BUTTON_SAVEBACKGROUND ) + { + FreeBackgroundRectPending(b->BackRect); + } +#endif + + // Get rid of the text string + if (b->string != NULL) + MemFree( b->string ); + + if( b == gpAnchoredButton ) + gpAnchoredButton = NULL; + if( b == gpPrevAnchoredButton ) + gpPrevAnchoredButton = NULL; + + MemFree(b); + b=NULL; + ButtonList[ iButtonID ] = NULL; +} + + + +//============================================================================= +// GetNextButtonNumber +// +// Finds the next available button slot. +// +INT32 GetNextButtonNumber(void) +{ + INT32 x; + + for(x=0;x= MAX_BUTTONS ) + { + sprintf( (char *)str, "Attempting to resize button with out of range buttonID %d.", iButtonID ); + AssertMsg( 0, str ); + } + + // if button size is too small, adjust it. + if(w<4) + w=4; + if(h<3) + h=3; + + b = ButtonList[ iButtonID ]; + + if( !b ) + { + sprintf( (char *)str, "Attempting to resize deleted button with buttonID %d", iButtonID ); + AssertMsg( 0, str ); + } + + // If this is a QuickButton, ignore this call + if((b->uiFlags & BUTTON_TYPES) == BUTTON_QUICK) + return; + + // Get current button screen location + xloc=b->XLoc; + yloc=b->YLoc; + + // Set the new MOUSE_REGION area values to reflect change in size. + b->Area.RegionTopLeftX=(UINT16)xloc; + b->Area.RegionTopLeftY=(UINT16)yloc; + b->Area.RegionBottomRightX=(UINT16)(xloc+w); + b->Area.RegionBottomRightY=(UINT16)(yloc+h); + b->uiFlags |= BUTTON_DIRTY; + +#ifdef _JA2_RENDER_DIRTY + if ( b->uiFlags & BUTTON_SAVEBACKGROUND ) + { + FreeBackgroundRectPending(b->BackRect); + b->BackRect = RegisterBackgroundRect(BGND_FLAG_PERMANENT | BGND_FLAG_SAVERECT, NULL, + (INT16)xloc, (INT16)yloc, (INT16)(xloc+w), (INT16)(yloc+h) ); + } +#endif + +} + + + +//============================================================================= +// SetButtonPosition +// +// Sets the position of a button on the screen. The position is relative +// to the top left corner of the button. +// +void SetButtonPosition( INT32 iButtonID ,INT16 x, INT16 y) +{ + GUI_BUTTON *b; + INT32 xloc,yloc,w,h; + + if( iButtonID < 0 || iButtonID >= MAX_BUTTONS ) + { + sprintf( (char *)str, "Attempting to set button position with out of range buttonID %d.", iButtonID ); + AssertMsg( 0, str ); + } + + b=ButtonList[ iButtonID ]; + + if( !b ) + { + sprintf( (char *)str, "Attempting to set button position with buttonID %d", iButtonID ); + AssertMsg( 0, str ); + } + + // Get new screen position + xloc=(INT16)x; + yloc=(INT16)y; + // Compute current width and height of this button + w = b->Area.RegionBottomRightX - b->Area.RegionTopLeftX; + h = b->Area.RegionBottomRightY - b->Area.RegionTopLeftY; + + // Set button to new location + b->XLoc=x; + b->YLoc=y; + // Set the buttons MOUSE_REGION to appropriate area + b->Area.RegionTopLeftX=(UINT16)xloc; + b->Area.RegionTopLeftY=(UINT16)yloc; + b->Area.RegionBottomRightX=(UINT16)(xloc+w); + b->Area.RegionBottomRightY=(UINT16)(yloc+h); + b->uiFlags |= BUTTON_DIRTY; + +#ifdef _JA2_RENDER_DIRTY + if ( b->uiFlags & BUTTON_SAVEBACKGROUND ) + { + FreeBackgroundRectPending(b->BackRect); + b->BackRect = RegisterBackgroundRect(BGND_FLAG_PERMANENT | BGND_FLAG_SAVERECT, NULL, + (INT16)xloc, (INT16)yloc, (INT16)(xloc+w), (INT16)(yloc+h) ); + } +#endif + +} + +//============================================================================= +// SetButtonIcon +// +// Sets the icon to be displayed on a IconicButton. +// +// Calling this function with a button type other than Iconic has no effect. +// +INT32 SetButtonIcon( INT32 iButtonID, INT16 Icon, INT16 IconIndex ) +{ + GUI_BUTTON *b; + + if( iButtonID < 0 || iButtonID >= MAX_BUTTONS ) + { + sprintf( (char *)str, "Attempting to set button icon with out of range buttonID %d.", iButtonID ); + AssertMsg( 0, str ); + return -1; + } + if( Icon < 0 || Icon >= MAX_BUTTON_ICONS ) + { + sprintf( (char *)str, "Attempting to set button[%d] icon with out of range icon index %d.", iButtonID, Icon ); + AssertMsg( 0, str ); + return -1; + } + + b = ButtonList[ iButtonID ]; + + if( !b ) + { + sprintf( (char *)str, "Attempting to set deleted button icon with buttonID %d", iButtonID ); + AssertMsg( 0, str ); + return -1; + } + + // If button isn't an icon button, ignore this call + if(((b->uiFlags & BUTTON_TYPES) == BUTTON_QUICK) || + ((b->uiFlags & BUTTON_TYPES) == BUTTON_HOT_SPOT) || + ((b->uiFlags & BUTTON_TYPES) == BUTTON_GENERIC)) + { + return -1; + } + + // Set the icon number and index to use for this button + b->iIconID = Icon; + b->usIconIndex = IconIndex; + + return Icon; +} + + + +//============================================================================= +// CreateIconButton +// +// Creates an Iconic type button. +// +INT32 CreateIconButton(INT16 Icon,INT16 IconIndex,INT16 GenImg,INT16 xloc,INT16 yloc,INT16 w,INT16 h,INT32 Type,INT16 Priority,GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback) +{ + GUI_BUTTON *b; + INT32 ButtonNum; + INT32 BType,x; + + if( xloc < 0 || yloc < 0 ) + { + sprintf( (char *)str, "Attempting to CreateIconButton with invalid position of %d,%d", xloc, yloc ); + AssertMsg( 0, str ); + } + if( GenImg < -1 || GenImg >= MAX_GENERIC_PICS ) + { + sprintf( (char *)str, "Attempting to CreateIconButton with out of range iconID %d.", GenImg ); + AssertMsg( 0, str ); + } + + // if button size is too small, adjust it. + if(w<4) + w=4; + if(h<3) + h=3; + + // Strip off any extraneous bits from button type + BType = Type & ( BUTTON_TYPE_MASK | BUTTON_NEWTOGGLE ); + + // Get a button number (slot) for this new button + if((ButtonNum = GetNextButtonNumber()) == BUTTON_NO_SLOT) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"CreateIconButton: No more button slots"); + return(-1); + } + + // Allocate memory for the GUI_BUTTON structure + if((b=(GUI_BUTTON *)MemAlloc(sizeof(GUI_BUTTON))) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"CreateIconButton: Can't alloc mem for button struct"); + return(-1); + } + + // Init the values in the struct + b->uiFlags = BUTTON_DIRTY; + b->uiOldFlags = 0; + b->IDNum = ButtonNum; + b->XLoc = xloc; + b->YLoc = yloc; + + if(GenImg<0) + b->ImageNum = 0; + else + b->ImageNum = GenImg; + + for(x=0;x<4;x++) + b->UserData[x] = 0; + b->Group = -1; + + b->bDefaultStatus = DEFAULT_STATUS_NONE; + b->bDisabledStyle = DISABLED_STYLE_DEFAULT; + //Init text + b->string = NULL; + b->usFont = 0; + b->fMultiColor=FALSE; + b->sForeColor = 0; + b->sWrappedWidth = -1; + b->sShadowColor = -1; + b->sForeColorDown = -1; + b->sShadowColorDown = -1; + b->sForeColorHilited = -1; + b->sShadowColorHilited = -1; + b->bJustification = BUTTON_TEXT_CENTER; + b->bTextXOffset = -1; + b->bTextYOffset = -1; + b->bTextXSubOffSet = 0; + b->bTextYSubOffSet = 0; + b->fShiftText = TRUE; + //Init icon + b->iIconID = Icon; + b->usIconIndex = IconIndex; + b->bIconXOffset = -1; + b->bIconYOffset = -1; + b->fShiftImage = TRUE; + + // Set the click callback function (if any) + if(ClickCallback != BUTTON_NO_CALLBACK) + { + b->ClickCallback = ClickCallback; + BType |= BUTTON_CLICK_CALLBACK; + } + else + b->ClickCallback = BUTTON_NO_CALLBACK; + + // Set the move callback function (if any) + if(MoveCallback != BUTTON_NO_CALLBACK) + { + b->MoveCallback = MoveCallback; + BType |= BUTTON_MOVE_CALLBACK; + } + else + b->MoveCallback = BUTTON_NO_CALLBACK; + + // Define a mouse region for this button + MSYS_DefineRegion(&b->Area, (UINT16)xloc, (UINT16)yloc, (UINT16)(xloc+w), (UINT16)(yloc+h), + (INT8)Priority, MSYS_STARTING_CURSORVAL, (MOUSE_CALLBACK)QuickButtonCallbackMMove, (MOUSE_CALLBACK)QuickButtonCallbackMButn); + + // Link the mouse region to this button (for callback purposes) + MSYS_SetRegionUserData(&b->Area,0,ButtonNum); + + // Set this button's flags + b->uiFlags |= ( BUTTON_ENABLED | BType | BUTTON_GENERIC ); + +#ifdef _JA2_RENDER_DIRTY + b->BackRect = -1; +#endif + + // Add button to the button list + #ifdef BUTTONSYSTEM_DEBUGGING + AssertFailIfIdenticalButtonAttributesFound( b ); + #endif + ButtonList[ButtonNum]=b; + + SpecifyButtonSoundScheme( b->IDNum, BUTTON_SOUND_SCHEME_GENERIC ); + + // return this button's slot number + return(ButtonNum); +} + +//Creates a generic button with text on it. +INT32 CreateTextButton(UINT16 *string, UINT32 uiFont, INT16 sForeColor, INT16 sShadowColor, INT16 GenImg, INT16 xloc, INT16 yloc, INT16 w, INT16 h, INT32 Type, INT16 Priority,GUI_CALLBACK MoveCallback, GUI_CALLBACK ClickCallback) +{ + GUI_BUTTON *b; + INT32 ButtonNum; + INT32 BType,x; + + if( xloc < 0 || yloc < 0 ) + { + sprintf( (char *)str, "Attempting to CreateTextButton with invalid position of %d,%d", xloc, yloc ); + AssertMsg( 0, str ); + } + if( GenImg < -1 || GenImg >= MAX_GENERIC_PICS ) + { + sprintf( (char *)str, "Attempting to CreateTextButton with out of range iconID %d.", GenImg ); + AssertMsg( 0, str ); + } + + // if button size is too small, adjust it. + if(w<4) + w=4; + if(h<3) + h=3; + + // Strip off any extraneous bits from button type + BType = Type & ( BUTTON_TYPE_MASK | BUTTON_NEWTOGGLE ); + + // Get a button number for this new button + if((ButtonNum = GetNextButtonNumber()) == BUTTON_NO_SLOT) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"CreateTextButton: No more button slots"); + return(-1); + } + + // Allocate memory for a GUI_BUTTON structure + if((b=(GUI_BUTTON *)MemAlloc(sizeof(GUI_BUTTON))) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"CreateTextButton: Can't alloc mem for button struct"); + return(-1); + } + + // Allocate memory for the button's text string... + b->string = NULL; + if ( string && wcslen( string ) ) + { + b->string = (UINT16*)MemAlloc( (wcslen(string)+1)*sizeof(UINT16) ); + AssertMsg( b->string, "Out of memory error: Couldn't allocate string in CreateTextButton." ); + wcscpy( b->string, string ); + } + + // Init the button structure variables + b->uiFlags = BUTTON_DIRTY; + b->uiOldFlags = 0; + b->IDNum = ButtonNum; + b->XLoc = xloc; + b->YLoc = yloc; + + if(GenImg<0) + b->ImageNum = 0; + else + b->ImageNum = GenImg; + + for(x=0;x<4;x++) + b->UserData[x] = 0; + b->Group = -1; + b->bDefaultStatus = DEFAULT_STATUS_NONE; + b->bDisabledStyle = DISABLED_STYLE_DEFAULT; + //Init string + b->usFont = (UINT16)uiFont; + b->fMultiColor=FALSE; + b->sForeColor = sForeColor; + b->sWrappedWidth = -1; + b->sShadowColor = sShadowColor; + b->sForeColorDown = -1; + b->sShadowColorDown = -1; + b->sForeColorHilited = -1; + b->sShadowColorHilited = -1; + b->bJustification = BUTTON_TEXT_CENTER; + b->bTextXOffset = -1; + b->bTextYOffset = -1; + b->bTextXSubOffSet = 0; + b->bTextYSubOffSet = 0; + b->fShiftText = TRUE; + //Init icon + b->iIconID = -1; + b->usIconIndex = -1; + b->bIconXOffset = -1; + b->bIconYOffset = -1; + b->fShiftImage = TRUE; + + // Set the button click callback function (if any) + if(ClickCallback != BUTTON_NO_CALLBACK) + { + b->ClickCallback = ClickCallback; + BType |= BUTTON_CLICK_CALLBACK; + } + else + b->ClickCallback = BUTTON_NO_CALLBACK; + + // Set the button's mouse movement callback function (if any) + if(MoveCallback != BUTTON_NO_CALLBACK) + { + b->MoveCallback = MoveCallback; + BType |= BUTTON_MOVE_CALLBACK; + } + else + b->MoveCallback = BUTTON_NO_CALLBACK; + + // Define a MOUSE_REGION for this button + MSYS_DefineRegion(&b->Area, (UINT16)xloc, (UINT16)yloc, (UINT16)(xloc+w), (UINT16)(yloc+h), + (INT8)Priority, MSYS_STARTING_CURSORVAL, (MOUSE_CALLBACK)QuickButtonCallbackMMove, (MOUSE_CALLBACK)QuickButtonCallbackMButn); + + // Link the MOUSE_REGION to this button + MSYS_SetRegionUserData(&b->Area,0,ButtonNum); + + // Set the flags for this button + b->uiFlags |= ( BUTTON_ENABLED | BType | BUTTON_GENERIC); + +#ifdef _JA2_RENDER_DIRTY + b->BackRect = -1; +#endif + + // Add this button to the button list + #ifdef BUTTONSYSTEM_DEBUGGING + AssertFailIfIdenticalButtonAttributesFound( b ); + #endif + ButtonList[ButtonNum]=b; + + SpecifyButtonSoundScheme( b->IDNum, BUTTON_SOUND_SCHEME_GENERIC ); + + // return the slot number + return(ButtonNum); +} + + + +//============================================================================= +// CreateHotSpot +// +// Creates a button like HotSpot. HotSpots have no graphics associated with +// them. +// +INT32 CreateHotSpot(INT16 xloc, INT16 yloc, INT16 Width, INT16 Height,INT16 Priority,GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback) +{ + GUI_BUTTON *b; + INT32 ButtonNum; + INT16 BType,x; + + if( xloc < 0 || yloc < 0 || Width < 0 || Height < 0 ) + { + sprintf( (char *)str, "Attempting to CreateHotSpot with invalid coordinates: %d,%d, width: %d, and height: %d.", + xloc, yloc, Width, Height ); + AssertMsg( 0, str ); + } + + BType=0; + + // Get a button number for this hotspot + if((ButtonNum = GetNextButtonNumber()) == BUTTON_NO_SLOT) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"CreateHotSpot: No more button slots"); + return(-1); + } + + // Allocate memory for the GUI_BUTTON structure + if((b=(GUI_BUTTON *)MemAlloc(sizeof(GUI_BUTTON))) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"CreateHotSpot: Can't alloc mem for button struct"); + return(-1); + } + + // Init the structure values + b->uiFlags = 0; + b->uiOldFlags = 0; + b->IDNum = ButtonNum; + b->XLoc = xloc; + b->YLoc = yloc; + b->ImageNum = 0xffffffff; + for(x=0;x<4;x++) + b->UserData[x] = 0; + b->Group = -1; + b->string = NULL; + + // Set the hotspot click callback function (if any) + if(ClickCallback != BUTTON_NO_CALLBACK) + { + b->ClickCallback = ClickCallback; + BType |= BUTTON_CLICK_CALLBACK; + } + else + b->ClickCallback = BUTTON_NO_CALLBACK; + + // Set the hotspot's mouse movement callback function (if any) + if(MoveCallback != BUTTON_NO_CALLBACK) + { + b->MoveCallback = MoveCallback; + BType |= BUTTON_MOVE_CALLBACK; + } + else + b->MoveCallback = BUTTON_NO_CALLBACK; + + // define a MOUSE_REGION for this hotspot + MSYS_DefineRegion(&b->Area,(UINT16)xloc,(UINT16)yloc,(UINT16)(xloc+Width),(UINT16)(yloc+Height), + (INT8)Priority, MSYS_STARTING_CURSORVAL, (MOUSE_CALLBACK)QuickButtonCallbackMMove, (MOUSE_CALLBACK)QuickButtonCallbackMButn); + + // Link the MOUSE_REGION to this hotspot + MSYS_SetRegionUserData(&b->Area,0,ButtonNum); + + // Set the flags entry for this hotspot + b->uiFlags |= (BUTTON_ENABLED|BType|BUTTON_HOT_SPOT); + +#ifdef _JA2_RENDER_DIRTY + b->BackRect = -1; +#endif + + // Add this button (hotspot) to the button list + #ifdef BUTTONSYSTEM_DEBUGGING + AssertFailIfIdenticalButtonAttributesFound( b ); + #endif + ButtonList[ButtonNum]=b; + + SpecifyButtonSoundScheme( b->IDNum, BUTTON_SOUND_SCHEME_GENERIC ); + + // return the button slot number + return(ButtonNum); +} + + + +// ============================================================================ +// Addition Oct15/97, Carter +// SetButtonCursor +// will simply set the cursor for the mouse region the button occupies +BOOLEAN SetButtonCursor(INT32 iBtnId, UINT16 crsr) +{ + GUI_BUTTON *b; + b = ButtonList[iBtnId]; + if (!b) + return FALSE; + b->Area.Cursor = crsr; + return TRUE; +} + +//============================================================================= +// QuickCreateButton +// +// Creates a QuickButton. QuickButtons only have graphics associated with +// them. They cannot be re-sized, nor can the graphic be changed. +// +INT32 QuickCreateButton(UINT32 Image,INT16 xloc,INT16 yloc,INT32 Type,INT16 Priority,GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback) +{ + GUI_BUTTON *b; + INT32 ButtonNum; + INT32 BType,x; + + if( xloc < 0 || yloc < 0 ) + { + sprintf( (char *)str, "Attempting to QuickCreateButton with invalid position of %d,%d", xloc, yloc ); + AssertMsg( 0, str ); + } + if( Image < 0 || Image >= MAX_BUTTON_PICS ) + { + sprintf( (char *)str, "Attempting to QuickCreateButton with out of range ImageID %d.", Image ); + AssertMsg( 0, str ); + } + + // Strip off any extraneous bits from button type + BType = Type & ( BUTTON_TYPE_MASK | BUTTON_NEWTOGGLE ); + + // Is there a QuickButton image in the given image slot? + if(ButtonPictures[Image].vobj == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"QuickCreateButton: Invalid button image number"); + return(-1); + } + + // Get a new button number + if((ButtonNum = GetNextButtonNumber()) == BUTTON_NO_SLOT) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"QuickCreateButton: No more button slots"); + return(-1); + } + + // Allocate memory for a GUI_BUTTON structure + if((b=(GUI_BUTTON *)MemAlloc(sizeof(GUI_BUTTON))) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"QuickCreateButton: Can't alloc mem for button struct"); + return(-1); + } + + // Set the values for this buttn + b->uiFlags = BUTTON_DIRTY; + b->uiOldFlags = 0; + + // Set someflags if of s certain type.... + if ( Type & BUTTON_NEWTOGGLE ) + { + b->uiFlags |= BUTTON_NEWTOGGLE; + } + + // shadow style + b->bDefaultStatus = DEFAULT_STATUS_NONE; + b->bDisabledStyle = DISABLED_STYLE_DEFAULT; + + b->Group = -1; + //Init string + b->string = NULL; + b->usFont = 0; + b->fMultiColor=FALSE; + b->sForeColor = 0; + b->sWrappedWidth = -1; + b->sShadowColor = -1; + b->sForeColorDown = -1; + b->sShadowColorDown = -1; + b->sForeColorHilited = -1; + b->sShadowColorHilited = -1; + b->bJustification = BUTTON_TEXT_CENTER; + b->bTextXOffset = -1; + b->bTextYOffset = -1; + b->bTextXSubOffSet = 0; + b->bTextYSubOffSet = 0; + b->fShiftText = TRUE; + //Init icon + b->iIconID = -1; + b->usIconIndex = -1; + b->bIconXOffset = -1; + b->bIconYOffset = -1; + b->fShiftImage = TRUE; + //Init quickbutton + b->IDNum = ButtonNum; + b->ImageNum = Image; + for(x=0;x<4;x++) + b->UserData[x] = 0; + + b->XLoc = xloc; + b->YLoc = yloc; + + b->ubToggleButtonOldState = 0; + b->ubToggleButtonActivated = FALSE; + + // Set the button click callback function (if any) + if(ClickCallback != BUTTON_NO_CALLBACK) + { + b->ClickCallback = ClickCallback; + BType |= BUTTON_CLICK_CALLBACK; + } + else + b->ClickCallback = BUTTON_NO_CALLBACK; + + // Set the button's mouse movement callback function (if any) + if(MoveCallback != BUTTON_NO_CALLBACK) + { + b->MoveCallback = MoveCallback; + BType |= BUTTON_MOVE_CALLBACK; + } + else + b->MoveCallback = BUTTON_NO_CALLBACK; + + memset( &b->Area, 0, sizeof( MOUSE_REGION ) ); + // Define a MOUSE_REGION for this QuickButton + MSYS_DefineRegion(&b->Area,(UINT16)xloc,(UINT16)yloc, + (UINT16)(xloc+(INT16)ButtonPictures[Image].MaxWidth), + (UINT16)(yloc+(INT16)ButtonPictures[Image].MaxHeight), + (INT8)Priority, MSYS_STARTING_CURSORVAL, + (MOUSE_CALLBACK)QuickButtonCallbackMMove, + (MOUSE_CALLBACK)QuickButtonCallbackMButn); + + // Link the MOUSE_REGION with this QuickButton + MSYS_SetRegionUserData(&b->Area,0,ButtonNum); + + // Set the flags for this button + b->uiFlags |= BUTTON_ENABLED | BType | BUTTON_QUICK; +#ifdef _JA2_RENDER_DIRTY + b->BackRect = -1; +#endif + + // Add this QuickButton to the button list + #ifdef BUTTONSYSTEM_DEBUGGING + AssertFailIfIdenticalButtonAttributesFound( b ); + #endif + ButtonList[ButtonNum]=b; + + SpecifyButtonSoundScheme( b->IDNum, BUTTON_SOUND_SCHEME_GENERIC ); + + // return the button number (slot) + return(ButtonNum); +} + +//A hybrid of QuickCreateButton. Takes a lot less parameters, but makes more assumptions. It self manages the +//loading, and deleting of the image. The size of the image determines the size of the button. It also uses +//the default move callback which emulates Win95. Finally, it sets the priority to normal. The function you +//choose also determines the type of button (toggle, notoggle, or newtoggle) +template INT32 CreateEasyNoToggleButton(INT32, INT32, char *, GUI_CALLBACK); +template INT32 CreateEasyNoToggleButton(INT32, INT32, char const *, GUI_CALLBACK); +template +INT32 CreateEasyNoToggleButton ( INT32 x, INT32 y, string3 filename, GUI_CALLBACK ClickCallback ) +{ + return CreateSimpleButton( x, y, filename, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, ClickCallback ); +} + +template INT32 CreateEasyToggleButton(INT32, INT32, char *, GUI_CALLBACK); +template INT32 CreateEasyToggleButton(INT32, INT32, char const *, GUI_CALLBACK); +template +INT32 CreateEasyToggleButton ( INT32 x, INT32 y, string3 filename, GUI_CALLBACK ClickCallback ) +{ + return CreateSimpleButton( x, y, filename, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, ClickCallback ); +} + +template INT32 CreateEasyNewToggleButton(INT32, INT32, char const *, GUI_CALLBACK); +template INT32 CreateEasyNewToggleButton(INT32, INT32, short *, GUI_CALLBACK); +template +INT32 CreateEasyNewToggleButton( INT32 x, INT32 y, string3 filename, GUI_CALLBACK ClickCallback ) +{ + return CreateSimpleButton( x, y, filename, BUTTON_NEWTOGGLE, MSYS_PRIORITY_NORMAL, ClickCallback ); +} + +//Same as above, but accepts specify toggle type +template INT32 CreateEasyButton(INT32, INT32, short *, INT32, GUI_CALLBACK); +template +INT32 CreateEasyButton( INT32 x, INT32 y, string3 filename, INT32 Type, GUI_CALLBACK ClickCallback) +{ + return CreateSimpleButton( x, y, filename, Type, MSYS_PRIORITY_NORMAL, ClickCallback ); +} + +//Same as above, but accepts priority specification. +template INT32 CreateSimpleButton(INT32, INT32, char *, INT32, INT16, GUI_CALLBACK); +template INT32 CreateSimpleButton(INT32, INT32, char const *, INT32, INT16, GUI_CALLBACK); +template +INT32 CreateSimpleButton( INT32 x, INT32 y, string3 filename, INT32 Type, INT16 Priority, GUI_CALLBACK ClickCallback ) +{ + INT32 ButPic,ButNum; + + if( !filename || !strlen(filename) ) + AssertMsg( 0, "Attempting to CreateSimpleButton with null filename." ); + + if( ( ButPic = LoadButtonImage( filename, -1, 1, 2, 3, 4 ) ) == -1) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"Can't load button image"); + return( -1 ); + } + + ButNum = (INT16)QuickCreateButton( ButPic, (INT16)x,(INT16)y, Type, Priority, DEFAULT_MOVE_CALLBACK, ClickCallback); + + AssertMsg( ButNum != -1, "Failed to CreateSimpleButton." ); + + ButtonList[ ButNum ]->uiFlags |= BUTTON_SELFDELETE_IMAGE; + + SpecifyDisabledButtonStyle( ButNum, DISABLED_STYLE_SHADED ); + + return( ButNum ); +} + +template INT32 CreateIconAndTextButton(INT32, unsigned short const *, UINT32, INT16, INT16, INT16, INT16, INT8, INT16, INT16, INT32, INT16, GUI_CALLBACK, GUI_CALLBACK); +template INT32 CreateIconAndTextButton(INT32, unsigned short *, UINT32, INT16, INT16, INT16, INT16, INT8, INT16, INT16, INT32, INT16, GUI_CALLBACK, GUI_CALLBACK); +template INT32 CreateIconAndTextButton(INT32, short *, UINT32, INT16, INT16, INT16, INT16, INT8, INT16, INT16, INT32, INT16, GUI_CALLBACK, GUI_CALLBACK); +template +INT32 CreateIconAndTextButton( INT32 Image, string2 string, UINT32 uiFont, + INT16 sForeColor, INT16 sShadowColor, + INT16 sForeColorDown, INT16 sShadowColorDown, + INT8 bJustification, + INT16 xloc, INT16 yloc, INT32 Type, INT16 Priority, + GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback) +{ + GUI_BUTTON *b; + INT32 iButtonID; + INT32 BType,x; + + if( xloc < 0 || yloc < 0 ) + { + sprintf( (char *)str, "Attempting to CreateIconAndTextButton with invalid position of %d,%d", xloc, yloc ); + AssertMsg( 0, str ); + } + if( Image < 0 || Image >= MAX_BUTTON_PICS ) + { + sprintf( (char *)str, "Attemting to CreateIconAndTextButton with out of range ImageID %d.", Image ); + AssertMsg( 0, str ); + } + + // Strip off any extraneous bits from button type + BType = Type & ( BUTTON_TYPE_MASK | BUTTON_NEWTOGGLE ); + + // Is there a QuickButton image in the given image slot? + if(ButtonPictures[Image].vobj == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"QuickCreateButton: Invalid button image number"); + return(-1); + } + + // Get a new button number + if((iButtonID = GetNextButtonNumber()) == BUTTON_NO_SLOT) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"QuickCreateButton: No more button slots"); + return(-1); + } + + // Allocate memory for a GUI_BUTTON structure + if((b=(GUI_BUTTON *)MemAlloc(sizeof(GUI_BUTTON))) == NULL) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"QuickCreateButton: Can't alloc mem for button struct"); + return(-1); + } + + // Set the values for this button + b->uiFlags = BUTTON_DIRTY; + b->uiOldFlags = 0; + b->IDNum = iButtonID; + b->XLoc = xloc; + b->YLoc = yloc; + b->ImageNum = Image; + for(x=0;x<4;x++) + b->UserData[x] = 0; + b->Group = -1; + b->bDefaultStatus = DEFAULT_STATUS_NONE; + b->bDisabledStyle = DISABLED_STYLE_DEFAULT; + + // Allocate memory for the button's text string... + b->string = NULL; + if ( string ) + { + b->string = (UINT16*)MemAlloc( (wcslen((wchar_t *)string)+1)*sizeof(UINT16) ); + AssertMsg( b->string, "Out of memory error: Couldn't allocate string in CreateIconAndTextButton." ); + wcscpy( b->string, string ); + } + + b->bJustification = bJustification; + b->usFont = (UINT16)uiFont; + b->fMultiColor=FALSE; + b->sForeColor = sForeColor; + b->sWrappedWidth = -1; + b->sShadowColor = sShadowColor; + b->sForeColorDown = sForeColorDown; + b->sShadowColorDown = sShadowColorDown; + b->sForeColorHilited = -1; + b->sShadowColorHilited = -1; + b->bTextXOffset = -1; + b->bTextYOffset = -1; + b->bTextXSubOffSet = 0; + b->bTextYSubOffSet = 0; + b->fShiftText = TRUE; + + b->iIconID = -1; + b->usIconIndex = 0; + + // Set the button click callback function (if any) + if(ClickCallback != BUTTON_NO_CALLBACK) + { + b->ClickCallback = ClickCallback; + BType |= BUTTON_CLICK_CALLBACK; + } + else + b->ClickCallback = BUTTON_NO_CALLBACK; + + // Set the button's mouse movement callback function (if any) + if(MoveCallback != BUTTON_NO_CALLBACK) + { + b->MoveCallback = MoveCallback; + BType |= BUTTON_MOVE_CALLBACK; + } + else + b->MoveCallback = BUTTON_NO_CALLBACK; + + // Define a MOUSE_REGION for this QuickButton + MSYS_DefineRegion(&b->Area,(UINT16)xloc,(UINT16)yloc, + (UINT16)(xloc+(INT16)ButtonPictures[Image].MaxWidth), + (UINT16)(yloc+(INT16)ButtonPictures[Image].MaxHeight), + (INT8)Priority, MSYS_STARTING_CURSORVAL, + (MOUSE_CALLBACK)QuickButtonCallbackMMove, + (MOUSE_CALLBACK)QuickButtonCallbackMButn); + + // Link the MOUSE_REGION with this QuickButton + MSYS_SetRegionUserData(&b->Area,0,iButtonID); + + // Set the flags for this button + b->uiFlags |= ( BUTTON_ENABLED | BType | BUTTON_QUICK ); + +#ifdef _JA2_RENDER_DIRTY + b->BackRect = -1; +#endif + + // Add this QuickButton to the button list + #ifdef BUTTONSYSTEM_DEBUGGING + AssertFailIfIdenticalButtonAttributesFound( b ); + #endif + ButtonList[iButtonID]=b; + + SpecifyButtonSoundScheme( b->IDNum, BUTTON_SOUND_SCHEME_GENERIC ); + + // return the button number (slot) + return(iButtonID); +} + +//New functions +void SpecifyButtonText( INT32 iButtonID, UINT16 * string ) +{ + GUI_BUTTON *b; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + + b = ButtonList[ iButtonID ]; + + //free the previous strings memory if applicable + if( b->string ) + MemFree( b->string ); + b->string = NULL; + + if( string && wcslen( string ) ) + { + //allocate memory for the new string + b->string = (UINT16*)MemAlloc( (wcslen(string)+1)*sizeof(UINT16) ); + Assert( b->string ); + //copy the string to the button + wcscpy( b->string, string ); + b->uiFlags |= BUTTON_DIRTY; + } +} + +void SpecifyButtonMultiColorFont(INT32 iButtonID, BOOLEAN fMultiColor) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + b->fMultiColor = fMultiColor; + b->uiFlags |= BUTTON_DIRTY ; +} + +void SpecifyButtonFont( INT32 iButtonID, UINT32 uiFont ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + b->usFont = (UINT16)uiFont; + b->uiFlags |= BUTTON_DIRTY ; +} + +void SpecifyButtonUpTextColors( INT32 iButtonID, INT16 sForeColor, INT16 sShadowColor ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + b->sForeColor = sForeColor; + b->sShadowColor = sShadowColor; + b->uiFlags |= BUTTON_DIRTY ; +} + +void SpecifyButtonDownTextColors( INT32 iButtonID, INT16 sForeColorDown, INT16 sShadowColorDown ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + b->sForeColorDown = sForeColorDown; + b->sShadowColorDown = sShadowColorDown; + b->uiFlags |= BUTTON_DIRTY ; +} + +void SpecifyButtonHilitedTextColors( INT32 iButtonID, INT16 sForeColorHilited, INT16 sShadowColorHilited ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + b->sForeColorHilited = sForeColorHilited; + b->sShadowColorHilited = sShadowColorHilited; + b->uiFlags |= BUTTON_DIRTY ; +} + +void SpecifyButtonTextJustification( INT32 iButtonID, INT8 bJustification ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + //Range check: if invalid, then set it to center justified. + if( bJustification < BUTTON_TEXT_LEFT || bJustification > BUTTON_TEXT_RIGHT ) + bJustification = BUTTON_TEXT_CENTER; + b->bJustification = bJustification; + b->uiFlags |= BUTTON_DIRTY ; +} + +void SpecifyFullButtonTextAttributes( INT32 iButtonID, UINT16 *string, INT32 uiFont, + INT16 sForeColor, INT16 sShadowColor, + INT16 sForeColorDown, INT16 sShadowColorDown, INT8 bJustification ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + //Copy over information + SpecifyButtonText( iButtonID, string ); + b->usFont = (UINT16)uiFont; + b->sForeColor = sForeColor; + b->sShadowColor = sShadowColor; + b->sForeColorDown = sForeColorDown; + b->sShadowColorDown = sShadowColorDown; + //Range check: if invalid, then set it to center justified. + if( bJustification < BUTTON_TEXT_LEFT || bJustification > BUTTON_TEXT_RIGHT ) + bJustification = BUTTON_TEXT_CENTER; + b->bJustification = bJustification; + b->uiFlags |= BUTTON_DIRTY ; +} + +void SpecifyGeneralButtonTextAttributes( INT32 iButtonID, UINT16 *string, INT32 uiFont, + INT16 sForeColor, INT16 sShadowColor ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + //Copy over information + SpecifyButtonText( iButtonID, string ); + b->usFont = (UINT16)uiFont; + b->sForeColor = sForeColor; + b->sShadowColor = sShadowColor; + b->uiFlags |= BUTTON_DIRTY ; +} + +void SpecifyButtonTextOffsets( INT32 iButtonID, INT8 bTextXOffset, INT8 bTextYOffset, BOOLEAN fShiftText ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + //Copy over information + b->bTextXOffset = bTextXOffset; + b->bTextYOffset = bTextYOffset; + b->fShiftText = fShiftText; +} + +void SpecifyButtonTextSubOffsets( INT32 iButtonID, INT8 bTextXOffset, INT8 bTextYOffset, BOOLEAN fShiftText ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + //Copy over information + b->bTextXSubOffSet = bTextXOffset; + b->bTextYSubOffSet = bTextYOffset; + b->fShiftText = fShiftText; +} + + +void SpecifyButtonTextWrappedWidth(INT32 iButtonID, INT16 sWrappedWidth) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + + b->sWrappedWidth = sWrappedWidth; +} + +void SpecifyDisabledButtonStyle( INT32 iButtonID, INT8 bStyle ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + + Assert( bStyle >= DISABLED_STYLE_NONE && bStyle <= DISABLED_STYLE_SHADED ); + + b->bDisabledStyle = bStyle; +} + + +//Note: Text is always on top +//If fShiftImage is true, then the image will shift down one pixel and right one pixel +//just like the text does. +BOOLEAN SpecifyButtonIcon( INT32 iButtonID, INT32 iVideoObjectID, UINT16 usVideoObjectIndex, + INT8 bXOffset, INT8 bYOffset, BOOLEAN fShiftImage ) +{ + GUI_BUTTON *b; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + + b->iIconID = iVideoObjectID; + b->usIconIndex = usVideoObjectIndex; + + if( b->iIconID == -1 ) + return FALSE; + + b->bIconXOffset = bXOffset; + b->bIconYOffset = bYOffset; + b->fShiftImage = TRUE; + + b->uiFlags |= BUTTON_DIRTY; + + return TRUE; +} + +void RemoveTextFromButton( INT32 iButtonID ) +{ + GUI_BUTTON *b; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + //Init string + if( b->string ) + MemFree( b->string ); + b->string = NULL; + b->usFont = 0; + b->sForeColor = 0; + b->sWrappedWidth = -1; + b->sShadowColor = -1; + b->sForeColorDown = -1; + b->sShadowColorDown = -1; + b->sForeColorHilited = -1; + b->sShadowColorHilited = -1; + b->bJustification = BUTTON_TEXT_CENTER; + b->bTextXOffset = -1; + b->bTextYOffset = -1; + b->bTextXSubOffSet = 0; + b->bTextYSubOffSet = 0; + b->fShiftText = TRUE; +} + +void RemoveIconFromButton( INT32 iButtonID ) +{ + GUI_BUTTON *b; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + //Clear icon + b->iIconID = -1; + b->usIconIndex = -1; + b->bIconXOffset = -1; + b->bIconYOffset = -1; + b->fShiftImage = TRUE; +} + +void AllowDisabledButtonFastHelp( INT32 iButtonID, BOOLEAN fAllow ) +{ + GUI_BUTTON *b; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS ); + b = ButtonList[ iButtonID ]; + Assert( b ); + + b->Area.uiFlags |= MSYS_ALLOW_DISABLED_FASTHELP; +} + +//============================================================================= +// SetButtonFastHelpText +// +// Set the text that will be displayed as the FastHelp +// +void SetButtonFastHelpText(INT32 iButton, UINT16 * Text) +{ + GUI_BUTTON *b; + if(iButton<0 || iButton>MAX_BUTTONS) + return; + b = ButtonList[iButton]; + AssertMsg( b, "Called SetButtonFastHelpText() with a non-existant button." ); + SetRegionFastHelpText( &b->Area, Text ); +} + +void SetBtnHelpEndCallback( INT32 iButton, MOUSE_HELPTEXT_DONE_CALLBACK CallbackFxn ) +{ + GUI_BUTTON *b; + if(iButton<0 || iButton>MAX_BUTTONS) + return; + b = ButtonList[iButton]; + AssertMsg( b, "Called SetBtnHelpEndCallback() with a non-existant button." ); + + SetRegionHelpEndCallback( &b->Area, CallbackFxn ); +} + +//============================================================================= +// QuickButtonCallbackMMove +// +// Dispatches all button callbacks for mouse movement. This function gets +// called by the Mouse System. *DO NOT CALL DIRECTLY* +// +void QuickButtonCallbackMMove(MOUSE_REGION *reg,INT32 reason) +{ + GUI_BUTTON *b; + INT32 iButtonID; + + + Assert(reg != NULL); + + iButtonID = MSYS_GetRegionUserData(reg,0); + + sprintf( (char *)str, "QuickButtonCallbackMMove: Mouse Region #%d (%d,%d to %d,%d) has invalid buttonID %d", + reg->IDNumber, reg->RegionTopLeftX, reg->RegionTopLeftY, reg->RegionBottomRightX, reg->RegionBottomRightY, iButtonID ); + + AssertMsg( iButtonID >= 0, str ); + AssertMsg( iButtonID < MAX_BUTTONS, str ); + + b = ButtonList[ iButtonID ]; + + AssertMsg( b != NULL, str ); + + if( !b ) + return; //This is getting called when Adding new regions... + + + if( b->uiFlags & BUTTON_ENABLED && + reason & (MSYS_CALLBACK_REASON_LOST_MOUSE | MSYS_CALLBACK_REASON_GAIN_MOUSE) ) + { + b->uiFlags |= BUTTON_DIRTY; + } + + // Mouse moved on the button, so reset it's timer to maximum. + if( b->Area.uiFlags & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + //check for sound playing stuff + if( b->ubSoundSchemeID ) + { + if( &b->Area == MSYS_PrevRegion && !gpAnchoredButton ) + { + if( b->uiFlags & BUTTON_ENABLED ) + { + PlayButtonSound( iButtonID, BUTTON_SOUND_MOVED_ONTO ); + } + else + { + PlayButtonSound( iButtonID, BUTTON_SOUND_DISABLED_MOVED_ONTO ); + } + } + } + } + else + { + //Check if we should play a sound + if( b->ubSoundSchemeID ) + { + if( b->uiFlags & BUTTON_ENABLED ) + { + if( &b->Area == MSYS_PrevRegion && !gpAnchoredButton ) + { + PlayButtonSound( iButtonID, BUTTON_SOUND_MOVED_OFF_OF ); + } + } + else + { + PlayButtonSound( iButtonID, BUTTON_SOUND_DISABLED_MOVED_OFF_OF ); + } + } + } + + // ATE: New stuff for toggle buttons that work with new Win95 paridigm + if ( ( b->uiFlags & BUTTON_NEWTOGGLE ) ) + { + if(reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + if ( b->ubToggleButtonActivated ) + { + b->ubToggleButtonActivated = FALSE; + + if ( !b->ubToggleButtonOldState ) + { + b->uiFlags &= (~BUTTON_CLICKED_ON ); + } + else + { + b->uiFlags |= BUTTON_CLICKED_ON; + } + } + } + } + + // If this button is enabled and there is a callback function associated with it, + // call the callback function. + if((b->uiFlags & BUTTON_ENABLED) && (b->uiFlags & BUTTON_MOVE_CALLBACK)) + (b->MoveCallback)(b,reason); +} + + + +//============================================================================= +// QuickButtonCallbackMButn +// +// Dispatches all button callbacks for button presses. This function is +// called by the Mouse System. *DO NOT CALL DIRECTLY* +// +void QuickButtonCallbackMButn( MOUSE_REGION *reg, INT32 reason ) +{ + GUI_BUTTON *b; + INT32 iButtonID; + BOOLEAN MouseBtnDown; + BOOLEAN StateBefore,StateAfter; + + + Assert(reg != NULL); + + iButtonID = MSYS_GetRegionUserData(reg,0); + + sprintf( (char *)str, "QuickButtonCallbackMButn: Mouse Region #%d (%d,%d to %d,%d) has invalid buttonID %d", + reg->IDNumber, reg->RegionTopLeftX, reg->RegionTopLeftY, reg->RegionBottomRightX, reg->RegionBottomRightY, iButtonID ); + + AssertMsg( iButtonID >= 0, str ); + AssertMsg( iButtonID < MAX_BUTTONS, str ); + + b = ButtonList[ iButtonID ]; + + AssertMsg( b != NULL, str ); + + if( !b ) + return; + + + if( reason & (MSYS_CALLBACK_REASON_LBUTTON_DWN | MSYS_CALLBACK_REASON_RBUTTON_DWN) ) + MouseBtnDown = TRUE; + else + MouseBtnDown = FALSE; + + StateBefore = (b->uiFlags & BUTTON_CLICKED_ON) ? (TRUE) : (FALSE); + + // ATE: New stuff for toggle buttons that work with new Win95 paridigm + if( b->uiFlags & BUTTON_NEWTOGGLE && b->uiFlags & BUTTON_ENABLED ) + { + if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if ( !b->ubToggleButtonActivated ) + { + if ( !(b->uiFlags & BUTTON_CLICKED_ON ) ) + { + b->ubToggleButtonOldState = FALSE; + b->uiFlags |= BUTTON_CLICKED_ON; + } + else + { + b->ubToggleButtonOldState = TRUE; + b->uiFlags &= (~BUTTON_CLICKED_ON); + } + b->ubToggleButtonActivated = TRUE; + } + } + else if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + b->ubToggleButtonActivated = FALSE; + } + } + + + //Kris: + //Set the anchored button incase the user moves mouse off region while still holding + //down the button, but only if the button is up. In Win95, buttons that are already + //down, and anchored never change state, unless you release the mouse in the button area. + + if( b->MoveCallback == DEFAULT_MOVE_CALLBACK && b->uiFlags & BUTTON_ENABLED ) + { + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + gpAnchoredButton = b; + gfAnchoredState = StateBefore; + b->uiFlags |= BUTTON_CLICKED_ON; + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP && b->uiFlags & BUTTON_NO_TOGGLE ) + { + b->uiFlags &= (~BUTTON_CLICKED_ON); + } + } + else if( b->uiFlags & BUTTON_CHECKBOX ) + { + if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { //the check box button gets anchored, though it doesn't actually use the anchoring move callback. + //The effect is different, we don't want to toggle the button state, but we do want to anchor this + //button so that we don't effect any other buttons while we move the mouse around in anchor mode. + gpAnchoredButton = b; + gfAnchoredState = StateBefore; + + //Trick the before state of the button to be different so the sound will play properly as checkbox buttons + //are processed differently. + StateBefore = (b->uiFlags & BUTTON_CLICKED_ON) ? FALSE : TRUE; + StateAfter = !StateBefore; + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + b->uiFlags ^= BUTTON_CLICKED_ON; //toggle the checkbox state upon release inside button area. + //Trick the before state of the button to be different so the sound will play properly as checkbox buttons + //are processed differently. + StateBefore = (b->uiFlags & BUTTON_CLICKED_ON) ? FALSE : TRUE; + StateAfter = !StateBefore; + } + } + + // Should we play a sound if clicked on while disabled? + if( b->ubSoundSchemeID && !(b->uiFlags & BUTTON_ENABLED) && MouseBtnDown ) + { + PlayButtonSound( iButtonID, BUTTON_SOUND_DISABLED_CLICK ); + } + + // If this button is disabled, and no callbacks allowed when disabled + // callback + if(!(b->uiFlags & BUTTON_ENABLED) && !(b->uiFlags & BUTTON_ALLOW_DISABLED_CALLBACK)) + return; + + // Button not enabled but allowed to use callback, then do that! + if(!(b->uiFlags & BUTTON_ENABLED) && (b->uiFlags & BUTTON_ALLOW_DISABLED_CALLBACK)) + { + if( b->uiFlags & BUTTON_CLICK_CALLBACK ) + { + (b->ClickCallback)(b, reason | BUTTON_DISABLED_CALLBACK ); + } + return; + } + + // If there is a callback function with this button, call it + if(b->uiFlags & BUTTON_CLICK_CALLBACK) + { + //Kris: January 6, 1998 + //Added these checks to avoid a case where it was possible to process a leftbuttonup message when + //the button wasn't anchored, and should have been. + gfDelayButtonDeletion = TRUE; + if( !(reason & MSYS_CALLBACK_REASON_LBUTTON_UP) || b->MoveCallback != DEFAULT_MOVE_CALLBACK || + b->MoveCallback == DEFAULT_MOVE_CALLBACK && gpPrevAnchoredButton == b ) + (b->ClickCallback)(b,reason); + gfDelayButtonDeletion = FALSE; + } + else if((reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) && !(b->uiFlags & BUTTON_IGNORE_CLICKS)) + { + // Otherwise, do default action with this button. + b->uiFlags^=BUTTON_CLICKED_ON; + } + + if( b->uiFlags & BUTTON_CHECKBOX ) + { + StateAfter = (b->uiFlags & BUTTON_CLICKED_ON) ? (TRUE) : (FALSE); + } + + // Play sounds for this enabled button (disabled sounds have already been done) + if( b->ubSoundSchemeID && b->uiFlags & BUTTON_ENABLED ) + { + if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if( b->ubSoundSchemeID && StateBefore && !StateAfter ) + { + PlayButtonSound( iButtonID, BUTTON_SOUND_CLICKED_OFF ); + } + } + else if( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + if( b->ubSoundSchemeID && !StateBefore && StateAfter) + { + PlayButtonSound( iButtonID, BUTTON_SOUND_CLICKED_ON ); + } + } + } + + if( StateBefore != StateAfter ) + { +#ifdef JA2 + InvalidateRegion(b->Area.RegionTopLeftX, b->Area.RegionTopLeftY, b->Area.RegionBottomRightX, b->Area.RegionBottomRightY); +#endif + } + + if( gfPendingButtonDeletion ) + { + RemoveButtonsMarkedForDeletion(); + } +} + +void RenderButtons(void) +{ + INT32 iButtonID; + BOOLEAN fOldButtonDown, fOldEnabled; + GUI_BUTTON *b; + + SaveFontSettings(); + for(iButtonID=0;iButtonIDArea.uiFlags & MSYS_REGION_ENABLED ) + { + // Check for buttonchanged status + fOldButtonDown = (BOOLEAN)(b->uiFlags & BUTTON_CLICKED_ON); + + if ( fOldButtonDown != ( b->uiOldFlags & BUTTON_CLICKED_ON ) ) + { + //Something is different, set dirty! + b->uiFlags |= BUTTON_DIRTY; + } + + // Check for button dirty flags + fOldEnabled = (BOOLEAN)(b->uiFlags & BUTTON_ENABLED); + + if ( fOldEnabled != ( b->uiOldFlags & BUTTON_ENABLED ) ) + { + //Something is different, set dirty! + b->uiFlags |= BUTTON_DIRTY; + } + + // If we ABSOLUTELY want to render every frame.... + if ( b->uiFlags & BUTTON_SAVEBACKGROUND ) + { + b->uiFlags |= BUTTON_DIRTY; + } + + // Set old flags + b->uiOldFlags = b->uiFlags; + + if ( b->uiFlags & BUTTON_FORCE_UNDIRTY ) + { + b->uiFlags &= ~( BUTTON_DIRTY ); + b->uiFlags &= ~( BUTTON_FORCE_UNDIRTY ); + } + + // Check if we need to update! + if ( b->uiFlags & BUTTON_DIRTY ) + { + // Turn off dirty flag + b->uiFlags &= (~BUTTON_DIRTY); + DrawButtonFromPtr(b); + +#ifdef JA2 + InvalidateRegion(b->Area.RegionTopLeftX, b->Area.RegionTopLeftY, b->Area.RegionBottomRightX, b->Area.RegionBottomRightY); +//#else +// InvalidateRegion(b->Area.RegionTopLeftX, b->Area.RegionTopLeftY, b->Area.RegionBottomRightX, b->Area.RegionBottomRightY, FALSE); +#endif + + } + } + } + + // check if we want to render 1 frame later? + if( ( fPausedMarkButtonsDirtyFlag == TRUE ) && ( fDisableHelpTextRestoreFlag == FALSE ) ) + { + fPausedMarkButtonsDirtyFlag = FALSE; + MarkButtonsDirty( ); + } + + RestoreFontSettings(); +} + +//***************************************************************************** +// MarkAButtonDirty +// +void MarkAButtonDirty( INT32 iButtonNum ) +{ + // surgical dirtying -> marks a user specified button dirty, without dirty the whole lot of them + + + // If the button exists, and it's not owned by another object, draw it + if( ButtonList[ iButtonNum ] ) + { + // Turn on dirty flag + ButtonList[ iButtonNum ]->uiFlags |= BUTTON_DIRTY; + } + +} + +//============================================================================= +// MarkButtonsDirty +// +void MarkButtonsDirty( void ) +{ + INT32 x; + for(x=0;xuiFlags |= BUTTON_DIRTY; + } + } +} + + +void UnMarkButtonDirty( INT32 iButtonIndex ) +{ + if ( ButtonList[ iButtonIndex ] ) + { + ButtonList[ iButtonIndex ]->uiFlags &= ~( BUTTON_DIRTY ); + } +} + +void UnmarkButtonsDirty( void ) +{ + INT32 x; + for(x=0;xuiFlags &= ~( BUTTON_DIRTY ); + ButtonList[ iButtonIndex ]->uiFlags |= BUTTON_FORCE_UNDIRTY; +} + +//============================================================================= +// PauseMarkButtonsDirty +// + +void PausedMarkButtonsDirty( void ) +{ + // set flag for frame after the next rendering of buttons + fPausedMarkButtonsDirtyFlag = TRUE; + + return; +} + +//============================================================================= +// DrawButton +// +// Draws a single button on the screen. +// +BOOLEAN DrawButton(INT32 iButtonID ) +{ + // Fail if button handle out of range + if( iButtonID < 0 || iButtonID > MAX_BUTTONS ) + return FALSE; + + // Fail if button handle is invalid + if( !ButtonList[ iButtonID ] ) + return FALSE; + + if( ButtonList[ iButtonID ]->string ) + SaveFontSettings(); + // Draw this button + if( ButtonList[ iButtonID ]->Area.uiFlags & MSYS_REGION_ENABLED ) + { + DrawButtonFromPtr( ButtonList[ iButtonID ] ); + } + + if( ButtonList[ iButtonID ]->string ) + RestoreFontSettings(); + return TRUE; +} + + + +//============================================================================= +// DrawButtonFromPtr +// +// Given a pointer to a GUI_BUTTON structure, draws the button on the +// screen. +// +void DrawButtonFromPtr(GUI_BUTTON *b) +{ + Assert( b ); + // Draw the appropriate button according to button type + gbDisabledButtonStyle = DISABLED_STYLE_NONE; + switch(b->uiFlags & BUTTON_TYPES) + { + case BUTTON_QUICK: + DrawQuickButton(b); + break; + case BUTTON_GENERIC: + DrawGenericButton(b); + break; + case BUTTON_HOT_SPOT: + if(b->uiFlags & BUTTON_NO_TOGGLE) + b->uiFlags &= (~BUTTON_CLICKED_ON); + return; //hotspots don't have text, but if you want to, change this to a break! + case BUTTON_CHECKBOX: + DrawCheckBoxButton(b); + break; + } + //If button has an icon, overlay it on current button. + if( b->iIconID != -1 ) + DrawIconOnButton( b ); + //If button has text, draw it now + if( b->string ) + DrawTextOnButton( b ); + //If the button is disabled, and a style has been calculated, then + //draw the style last. + switch( gbDisabledButtonStyle ) + { + case DISABLED_STYLE_HATCHED: + DrawHatchOnButton( b ); + break; + case DISABLED_STYLE_SHADED: + DrawShadeOnButton( b ); + break; + } + if( b->bDefaultStatus ) + { + DrawDefaultOnButton( b ); + } +} + +//============================================================================= +// DrawQuickButton +// +// Draws a QuickButton type button on the screen. +// +void DrawQuickButton(GUI_BUTTON *b) +{ + INT32 UseImage; + UseImage=0; + // Is button Enabled, or diabled but no "Grayed" image associated with this QuickButton? + if(b->uiFlags & BUTTON_ENABLED ) + { + // Is the button's state ON? + if(b->uiFlags & BUTTON_CLICKED_ON) + { + // Is the mouse over this area, and we have a hilite image? + if((b->Area.uiFlags & MSYS_MOUSE_IN_AREA) && gfRenderHilights && + (ButtonPictures[b->ImageNum].OnHilite != -1)) + UseImage = ButtonPictures[b->ImageNum].OnHilite; // Use On-Hilite image + else if(ButtonPictures[b->ImageNum].OnNormal != -1) + UseImage = ButtonPictures[b->ImageNum].OnNormal; // Use On-Normal image + } + else + { + // Is the mouse over the button, and do we have hilite image? + if((b->Area.uiFlags & MSYS_MOUSE_IN_AREA) && gfRenderHilights && + (ButtonPictures[b->ImageNum].OffHilite != -1)) + UseImage = ButtonPictures[b->ImageNum].OffHilite; // Use Off-Hilite image + else if(ButtonPictures[b->ImageNum].OffNormal != -1) + UseImage = ButtonPictures[b->ImageNum].OffNormal; // Use Off-Normal image + } + } + else if( ButtonPictures[b->ImageNum].Grayed != -1) + { // Button is diabled so use the "Grayed-out" image + UseImage = ButtonPictures[b->ImageNum].Grayed; + } + else + { + UseImage = ButtonPictures[b->ImageNum].OffNormal; + switch( b->bDisabledStyle ) + { + case DISABLED_STYLE_DEFAULT: + gbDisabledButtonStyle = b->string ? DISABLED_STYLE_SHADED : DISABLED_STYLE_HATCHED; + break; + case DISABLED_STYLE_HATCHED: + case DISABLED_STYLE_SHADED: + gbDisabledButtonStyle = b->bDisabledStyle; + break; + } + } + + // Display the button image + BltVideoObject(ButtonDestBuffer, ButtonPictures[b->ImageNum].vobj, + (UINT16)UseImage, b->XLoc, b->YLoc, + VO_BLT_SRCTRANSPARENCY, NULL); +} + +void DrawHatchOnButton( GUI_BUTTON *b ) +{ + UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + SGPRect ClipRect; + ClipRect.iLeft = b->Area.RegionTopLeftX; + ClipRect.iRight = b->Area.RegionBottomRightX - 1; + ClipRect.iTop = b->Area.RegionTopLeftY; + ClipRect.iBottom = b->Area.RegionBottomRightY - 1; + pDestBuf = LockVideoSurface( ButtonDestBuffer, &uiDestPitchBYTES ); + Blt16BPPBufferHatchRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect ); + UnLockVideoSurface( ButtonDestBuffer ); +} + +void DrawShadeOnButton( GUI_BUTTON *b ) +{ + UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + SGPRect ClipRect; + ClipRect.iLeft = b->Area.RegionTopLeftX; + ClipRect.iRight = b->Area.RegionBottomRightX-1; + ClipRect.iTop = b->Area.RegionTopLeftY; + ClipRect.iBottom = b->Area.RegionBottomRightY-1; + pDestBuf = LockVideoSurface( ButtonDestBuffer, &uiDestPitchBYTES ); + Blt16BPPBufferShadowRect( (UINT16*)pDestBuf, uiDestPitchBYTES, &ClipRect ); + UnLockVideoSurface( ButtonDestBuffer ); +} + +void DrawDefaultOnButton( GUI_BUTTON *b ) +{ + UINT8 *pDestBuf; + UINT32 uiDestPitchBYTES; + pDestBuf = LockVideoSurface( ButtonDestBuffer, &uiDestPitchBYTES ); + SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); + if( b->bDefaultStatus == DEFAULT_STATUS_DARKBORDER || b->bDefaultStatus == DEFAULT_STATUS_WINDOWS95 ) + { + //left (one thick) + LineDraw( TRUE, b->Area.RegionTopLeftX-1, b->Area.RegionTopLeftY-1, b->Area.RegionTopLeftX-1, b->Area.RegionBottomRightY+1, 0, pDestBuf ); + //top (one thick) + LineDraw( TRUE, b->Area.RegionTopLeftX-1, b->Area.RegionTopLeftY-1, b->Area.RegionBottomRightX+1, b->Area.RegionTopLeftY-1, 0, pDestBuf ); + //right (two thick) + LineDraw( TRUE, b->Area.RegionBottomRightX, b->Area.RegionTopLeftY-1, b->Area.RegionBottomRightX, b->Area.RegionBottomRightY+1, 0, pDestBuf ); + LineDraw( TRUE, b->Area.RegionBottomRightX+1, b->Area.RegionTopLeftY-1, b->Area.RegionBottomRightX+1, b->Area.RegionBottomRightY+1, 0, pDestBuf ); + //bottom (two thick) + LineDraw( TRUE, b->Area.RegionTopLeftX-1, b->Area.RegionBottomRightY, b->Area.RegionBottomRightX+1, b->Area.RegionBottomRightY, 0, pDestBuf ); + LineDraw( TRUE, b->Area.RegionTopLeftX-1, b->Area.RegionBottomRightY+1, b->Area.RegionBottomRightX+1, b->Area.RegionBottomRightY+1, 0, pDestBuf ); + #ifdef JA2 + InvalidateRegion( b->Area.RegionTopLeftX-1, b->Area.RegionTopLeftY-1, b->Area.RegionBottomRightX+1, b->Area.RegionBottomRightY+1 ); + #endif + } + if( b->bDefaultStatus == DEFAULT_STATUS_DOTTEDINTERIOR || b->bDefaultStatus == DEFAULT_STATUS_WINDOWS95 ) + { //Draw an internal dotted rectangle. + + } + UnLockVideoSurface( ButtonDestBuffer ); +} + +void DrawCheckBoxButtonOn( INT32 iButtonID ) +{ + GUI_BUTTON *b; + BOOLEAN fLeftButtonState = gfLeftButtonState; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS); + b = ButtonList[ iButtonID ]; + Assert( b ); + + gfLeftButtonState = TRUE; + b->Area.uiFlags |= MSYS_MOUSE_IN_AREA; + + DrawButton( iButtonID ); + + gfLeftButtonState = fLeftButtonState; +} + +void DrawCheckBoxButtonOff( INT32 iButtonID ) +{ + GUI_BUTTON *b; + BOOLEAN fLeftButtonState = gfLeftButtonState; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS); + b = ButtonList[ iButtonID ]; + Assert( b ); + + gfLeftButtonState = FALSE; + b->Area.uiFlags |= MSYS_MOUSE_IN_AREA; + + DrawButton( iButtonID ); + + gfLeftButtonState = fLeftButtonState; +} + + +void DrawCheckBoxButton( GUI_BUTTON *b ) +{ + INT32 UseImage; + + UseImage=0; + // Is button Enabled, or diabled but no "Grayed" image associated with this QuickButton? + if( b->uiFlags & BUTTON_ENABLED ) + { + // Is the button's state ON? + if(b->uiFlags & BUTTON_CLICKED_ON) + { + // Is the mouse over this area, and we have a hilite image? + if( b->Area.uiFlags & MSYS_MOUSE_IN_AREA && gfRenderHilights && + gfLeftButtonState && + ButtonPictures[b->ImageNum].OnHilite != -1 ) + UseImage = ButtonPictures[b->ImageNum].OnHilite; // Use On-Hilite image + else if(ButtonPictures[b->ImageNum].OnNormal != -1) + UseImage = ButtonPictures[b->ImageNum].OnNormal; // Use On-Normal image + } + else + { + // Is the mouse over the button, and do we have hilite image? + if( b->Area.uiFlags & MSYS_MOUSE_IN_AREA && gfRenderHilights && + gfLeftButtonState && + ButtonPictures[b->ImageNum].OffHilite != -1 ) + UseImage = ButtonPictures[b->ImageNum].OffHilite; // Use Off-Hilite image + else if(ButtonPictures[b->ImageNum].OffNormal != -1) + UseImage = ButtonPictures[b->ImageNum].OffNormal; // Use Off-Normal image + } + } + else if( ButtonPictures[b->ImageNum].Grayed != -1 ) + { // Button is disabled so use the "Grayed-out" image + UseImage = ButtonPictures[b->ImageNum].Grayed; + } + else //use the disabled style + { + if( b->uiFlags & BUTTON_CLICKED_ON ) + UseImage = ButtonPictures[b->ImageNum].OnHilite; + else + UseImage = ButtonPictures[b->ImageNum].OffHilite; + switch( b->bDisabledStyle ) + { + case DISABLED_STYLE_DEFAULT: + gbDisabledButtonStyle = DISABLED_STYLE_HATCHED; + break; + case DISABLED_STYLE_HATCHED: + case DISABLED_STYLE_SHADED: + gbDisabledButtonStyle = b->bDisabledStyle; + break; + } + } + + // Display the button image + BltVideoObject(ButtonDestBuffer, ButtonPictures[b->ImageNum].vobj, + (UINT16)UseImage, b->XLoc, b->YLoc, + VO_BLT_SRCTRANSPARENCY, NULL); +} + +void DrawIconOnButton(GUI_BUTTON *b) +{ + INT32 xp,yp,width,height,IconX,IconY; + INT32 IconW,IconH; + SGPRect NewClip,OldClip; + ETRLEObject *pTrav; + HVOBJECT hvObject; + + // If there's an actual icon on this button, try to show it. + if(b->iIconID >= 0) + { + // Get width and height of button area + width = b->Area.RegionBottomRightX - b->Area.RegionTopLeftX; + height = b->Area.RegionBottomRightY - b->Area.RegionTopLeftY; + + // Compute viewable area (inside borders) + NewClip.iLeft = b->XLoc + 3; + NewClip.iRight = b->XLoc + width - 3; + NewClip.iTop = b->YLoc + 2; + NewClip.iBottom = b->YLoc + height - 2; + + // Get Icon's blit start coordinates + IconX = NewClip.iLeft; + IconY = NewClip.iTop; + + // Get current clip area + GetClippingRect(&OldClip); + + // Clip button's viewable area coords to screen + if(NewClip.iLeft < OldClip.iLeft) + NewClip.iLeft = OldClip.iLeft; + + // Is button right off the right side of the screen? + if(NewClip.iLeft > OldClip.iRight) + return; + + if(NewClip.iRight > OldClip.iRight) + NewClip.iRight = OldClip.iRight; + + // Is button completely off the left side of the screen? + if(NewClip.iRight < OldClip.iLeft) + return; + + if(NewClip.iTop < OldClip.iTop) + NewClip.iTop = OldClip.iTop; + + // Are we right off the bottom of the screen? + if(NewClip.iTop > OldClip.iBottom) + return; + + if(NewClip.iBottom > OldClip.iBottom) + NewClip.iBottom = OldClip.iBottom; + + // Are we off the top? + if(NewClip.iBottom < OldClip.iTop) + return; + + // Did we clip the viewable area out of existance? + if((NewClip.iRight <= NewClip.iLeft) || (NewClip.iBottom <= NewClip.iTop)) + return; + + // Get the width and height of the icon itself + if( b->uiFlags & BUTTON_GENERIC ) + pTrav = &(GenericButtonIcons[b->iIconID]->pETRLEObject[b->usIconIndex]); + else + { + GetVideoObject( &hvObject, b->iIconID ); + pTrav = &(hvObject->pETRLEObject[b->usIconIndex] ); + } + IconH = (UINT32)(pTrav->usHeight+pTrav->sOffsetY); + IconW = (UINT32)(pTrav->usWidth+pTrav->sOffsetX); + + // Compute coordinates for centering the icon on the button or + // use the offset system. + if( b->bIconXOffset == -1 ) + xp = (((width-6)-IconW) / 2) + IconX; + else + xp = b->Area.RegionTopLeftX + b->bIconXOffset; + if( b->bIconYOffset == -1 ) + yp = (((height-4)-IconH) / 2) + IconY; + else + yp = b->Area.RegionTopLeftY + b->bIconYOffset; + + // Was the button clicked on? if so, move the image slightly for the illusion + // that the image moved into the screen. + if( b->uiFlags & BUTTON_CLICKED_ON && b->fShiftImage ) + { + xp++; + yp++; + } + + // Set the clipping rectangle to the viewable area of the button + SetClippingRect(&NewClip); + // Blit the icon + if( b->uiFlags & BUTTON_GENERIC ) + BltVideoObject( ButtonDestBuffer,GenericButtonIcons[b->iIconID], b->usIconIndex, (INT16)xp, (INT16)yp, + VO_BLT_SRCTRANSPARENCY, NULL); + else + BltVideoObject( ButtonDestBuffer, hvObject, b->usIconIndex, (INT16)xp, (INT16)yp, + VO_BLT_SRCTRANSPARENCY, NULL ); + // Restore previous clip region + SetClippingRect(&OldClip); + } +} + + +//If a button has text attached to it, then it'll draw it last. +void DrawTextOnButton(GUI_BUTTON *b) +{ + INT32 xp,yp,width,height,TextX,TextY; + SGPRect NewClip,OldClip; + INT16 sForeColor; + + // If this button actually has a string to print + if( b->string ) + { + // Get the width and height of this button + width = b->Area.RegionBottomRightX - b->Area.RegionTopLeftX; + height = b->Area.RegionBottomRightY - b->Area.RegionTopLeftY; + + // Compute the viewable area on this button + NewClip.iLeft = b->XLoc + 3; + NewClip.iRight = b->XLoc + width - 3; + NewClip.iTop = b->YLoc + 2; + NewClip.iBottom = b->YLoc + height - 2; + + // Get the starting coordinates to print + TextX = NewClip.iLeft; + TextY = NewClip.iTop; + + // Get the current clipping area + GetClippingRect(&OldClip); + + // Clip the button's viewable area to the screen + if(NewClip.iLeft < OldClip.iLeft) + NewClip.iLeft = OldClip.iLeft; + + // Are we off hte right side? + if(NewClip.iLeft > OldClip.iRight) + return; + + if(NewClip.iRight > OldClip.iRight) + NewClip.iRight = OldClip.iRight; + + // Are we off the left side? + if(NewClip.iRight < OldClip.iLeft) + return; + + if(NewClip.iTop < OldClip.iTop) + NewClip.iTop = OldClip.iTop; + + // Are we off the bottom of the screen? + if(NewClip.iTop > OldClip.iBottom) + return; + + if(NewClip.iBottom > OldClip.iBottom) + NewClip.iBottom = OldClip.iBottom; + + // Are we off the top? + if(NewClip.iBottom < OldClip.iTop) + return; + + // Did we clip the viewable area out of existance? + if((NewClip.iRight <= NewClip.iLeft) || (NewClip.iBottom <= NewClip.iTop)) + return; + + // Set the font printing settings to the buttons viewable area + SetFontDestBuffer(ButtonDestBuffer, NewClip.iLeft, + NewClip.iTop, NewClip.iRight, + NewClip.iBottom, FALSE); + + // Compute the coordinates to center the text + if( b->bTextYOffset == -1 ) + yp = (((height) - GetFontHeight(b->usFont)) / 2) + TextY - 1; + else + yp = b->Area.RegionTopLeftY + b->bTextYOffset; + if( b->bTextXOffset == -1 ) + { + switch( b->bJustification ) + { + case BUTTON_TEXT_LEFT: + xp = TextX + 3; + break; + case BUTTON_TEXT_RIGHT: + xp = NewClip.iRight - StringPixLength(b->string, b->usFont) - 3; + break; + case BUTTON_TEXT_CENTER: + default: + xp = (((width-6)-StringPixLength(b->string,b->usFont)) / 2) + TextX; + break; + } + } + else + xp = b->Area.RegionTopLeftX + b->bTextXOffset; + + // Set the printing font to the button text font + SetFont(b->usFont); + + // print the text + SetFontBackground( FONT_MCOLOR_BLACK ); + SetFontForeground( (UINT8)b->sForeColor ); + sForeColor = b->sForeColor; + if( b->sShadowColor != -1 ) + SetFontShadow( (UINT8)b->sShadowColor ); + //Override the colors if necessary. + if( b->uiFlags & BUTTON_ENABLED && b->Area.uiFlags & MSYS_MOUSE_IN_AREA && b->sForeColorHilited != -1 ) + { + SetFontForeground( (UINT8)b->sForeColorHilited ); + sForeColor = b->sForeColorHilited; + } + else if( b->uiFlags & BUTTON_CLICKED_ON && b->sForeColorDown != -1 ) + { + SetFontForeground( (UINT8)b->sForeColorDown ); + sForeColor = b->sForeColorDown; + } + if( b->uiFlags & BUTTON_ENABLED && b->Area.uiFlags & MSYS_MOUSE_IN_AREA && b->sShadowColorHilited != -1 ) + { + SetFontShadow( (UINT8)b->sShadowColorHilited ); + } + else if( b->uiFlags & BUTTON_CLICKED_ON && b->sShadowColorDown != -1 ) + { + SetFontShadow( (UINT8)b->sShadowColorDown ); + } + if( b->uiFlags & BUTTON_CLICKED_ON && b->fShiftText ) + { // Was the button clicked on? if so, move the text slightly for the illusion + // that the text moved into the screen. + xp++; + yp++; + } +#ifdef JA2 + if( b->sWrappedWidth != -1 ) + { + UINT8 bJustified=0; + switch( b->bJustification ) + { + case BUTTON_TEXT_LEFT: bJustified = LEFT_JUSTIFIED; break; + case BUTTON_TEXT_RIGHT: bJustified = RIGHT_JUSTIFIED; break; + case BUTTON_TEXT_CENTER: bJustified = CENTER_JUSTIFIED; break; + default: Assert( 0 ); break; + } + if( b->bTextXOffset == -1 ) + { + //Kris: + //There needs to be recalculation of the start positions based on the + //justification and the width specified wrapped width. I was drawing a + //double lined word on the right side of the button to find it drawing way + //over to the left. I've added the necessary code for the right and center + //justification. + yp = b->Area.RegionTopLeftY + 2; + + switch( b->bJustification ) + { + case BUTTON_TEXT_RIGHT: + xp = b->Area.RegionBottomRightX - 3 - b->sWrappedWidth; + + if( b->fShiftText && b->uiFlags & BUTTON_CLICKED_ON ) + xp++, yp++; + break; + case BUTTON_TEXT_CENTER: + xp = b->Area.RegionTopLeftX + 3 + b->sWrappedWidth/2; + + if( b->fShiftText && b->uiFlags & BUTTON_CLICKED_ON ) + xp++, yp++; + break; + } + } + yp+= b->bTextYSubOffSet; + xp+= b->bTextXSubOffSet; + DisplayWrappedString((UINT16)xp, (UINT16)yp, b->sWrappedWidth, 1, b->usFont, (UINT8)sForeColor, b->string, FONT_MCOLOR_BLACK, FALSE, bJustified); + } + else + { + yp+= b->bTextYSubOffSet; + xp+= b->bTextXSubOffSet; + mprintf(xp, yp, b->string); + } +#else + if(b->fMultiColor) + gprintf(xp, yp, b->string); + else + mprintf(xp, yp, b->string); +#endif + // Restore the old text printing settings + } +} + + + +//============================================================================= +// DrawGenericButton +// +// This function is called by the DrawIconicButton and DrawTextButton +// routines to draw the borders and background of the buttons. +// +void DrawGenericButton(GUI_BUTTON *b) +{ + INT32 NumChunksWide,NumChunksHigh,cx,cy,width,height,hremain,wremain; + INT32 q,ImgNum,ox,oy; + INT32 iBorderHeight, iBorderWidth; + HVOBJECT BPic; + UINT32 uiDestPitchBYTES; + UINT8 *pDestBuf; + SGPRect ClipRect; + ETRLEObject *pTrav; + + // Select the graphics to use depending on the current state of the button + if( b->uiFlags & BUTTON_ENABLED ) + { + if ( !(b->uiFlags & BUTTON_ENABLED) && (GenericButtonGrayed[b->ImageNum]==NULL) ) + BPic = GenericButtonOffNormal[b->ImageNum]; + else if(b->uiFlags & BUTTON_CLICKED_ON) + { + if((b->Area.uiFlags & MSYS_MOUSE_IN_AREA) && (GenericButtonOnHilite[b->ImageNum]!=NULL) && gfRenderHilights ) + BPic = GenericButtonOnHilite[b->ImageNum]; + else + BPic = GenericButtonOnNormal[b->ImageNum]; + } + else + { + if((b->Area.uiFlags & MSYS_MOUSE_IN_AREA) && (GenericButtonOffHilite[b->ImageNum]!=NULL) && gfRenderHilights ) + BPic = GenericButtonOffHilite[b->ImageNum]; + else + BPic = GenericButtonOffNormal[b->ImageNum]; + } + } + else if( GenericButtonGrayed[ b->ImageNum ] ) + BPic = GenericButtonGrayed[b->ImageNum]; + else + { + BPic = GenericButtonOffNormal[ b->ImageNum ]; + switch( b->bDisabledStyle ) + { + case DISABLED_STYLE_DEFAULT: + gbDisabledButtonStyle = b->string ? DISABLED_STYLE_SHADED : DISABLED_STYLE_HATCHED; + break; + case DISABLED_STYLE_HATCHED: + case DISABLED_STYLE_SHADED: + gbDisabledButtonStyle = b->bDisabledStyle; + break; + } + } + + iBorderWidth=3; + iBorderHeight=2; + pTrav=NULL; + +// DB - Added this to support more flexible sizing of border images +// The 3x2 size was a bit limiting. JA2 should default to the original +// size, unchanged + +#ifndef JA2 + pTrav = &(BPic->pETRLEObject[0] ); + iBorderHeight = (INT32)pTrav->usHeight; + iBorderWidth = (INT32)pTrav->usWidth; +#endif + + // Compute the number of button "chunks" needed to be blitted + width = b->Area.RegionBottomRightX - b->Area.RegionTopLeftX; + height = b->Area.RegionBottomRightY - b->Area.RegionTopLeftY; + NumChunksWide = width / iBorderWidth; + NumChunksHigh = height / iBorderHeight; + hremain = height % iBorderHeight; + wremain = width % iBorderWidth; + + cx = (b->XLoc + ((NumChunksWide-1)*iBorderWidth) + wremain); + cy = (b->YLoc + ((NumChunksHigh-1)*iBorderHeight) + hremain); + + // Fill the button's area with the button's background color + ColorFillVideoSurfaceArea(ButtonDestBuffer,b->Area.RegionTopLeftX, + b->Area.RegionTopLeftY, + b->Area.RegionBottomRightX, + b->Area.RegionBottomRightY, + GenericButtonFillColors[b->ImageNum]); + + // If there is a background image, fill the button's area with it + if(GenericButtonBackground[b->ImageNum]!=NULL) + { + ox=oy=0; + // if the button was clicked on, adjust the background image so that we get + // the illusion that it is sunk into the screen. + if(b->uiFlags & BUTTON_CLICKED_ON) + ox=oy=1; + + // Fill the area with the image, tilling it if need be. + ImageFillVideoSurfaceArea(ButtonDestBuffer,b->Area.RegionTopLeftX+ox, + b->Area.RegionTopLeftY+oy, + b->Area.RegionBottomRightX, + b->Area.RegionBottomRightY, + GenericButtonBackground[b->ImageNum], + GenericButtonBackgroundIndex[b->ImageNum], + GenericButtonOffsetX[b->ImageNum], + GenericButtonOffsetY[b->ImageNum]); + } + + // Lock the dest buffer + pDestBuf = LockVideoSurface( ButtonDestBuffer, &uiDestPitchBYTES ); + + GetClippingRect(&ClipRect); + + // Draw the button's borders and corners (horizontally) + for(q=0;qXLoc + (q*iBorderWidth)), + (INT32)b->YLoc, + (UINT16)ImgNum, &ClipRect ); + } + else if(gbPixelDepth==8) + { + Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)(b->XLoc + (q*iBorderWidth)), + (INT32)b->YLoc, + (UINT16)ImgNum, &ClipRect ); + } + + if(q==0) + ImgNum=5; + else + ImgNum=6; + + if(gbPixelDepth==16) + { + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)(b->XLoc + (q*iBorderWidth)), + cy, (UINT16)ImgNum, &ClipRect ); + } + else if(gbPixelDepth==8) + { + Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)(b->XLoc + (q*iBorderWidth)), + cy, (UINT16)ImgNum, &ClipRect ); + } + + } + // Blit the right side corners + if(gbPixelDepth==16) + { + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)b->YLoc, + 2, &ClipRect ); + } + else if(gbPixelDepth==8) + { + Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)b->YLoc, + 2, &ClipRect ); + } + + + if(gbPixelDepth==16) + { + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, cy, 7, &ClipRect ); + } + else if(gbPixelDepth==8) + { + Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, cy, 7, &ClipRect ); + } + // Draw the vertical members of the button's borders + NumChunksHigh--; + + if(hremain!=0) + { + q=NumChunksHigh; + if(gbPixelDepth==16) + { + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)b->XLoc, + (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), + 3, &ClipRect ); + } + else if(gbPixelDepth==8) + { + Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)b->XLoc, + (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), + 3, &ClipRect ); + } + + if(gbPixelDepth==16) + { + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), + 4, &ClipRect ); + } + else if(gbPixelDepth==8) + { + Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), + 4, &ClipRect ); + } + } + + for(q=1;qXLoc, + (INT32)(b->YLoc + (q*iBorderHeight)), + 3, &ClipRect ); + } + else if(gbPixelDepth==8) + { + Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)b->XLoc, + (INT32)(b->YLoc + (q*iBorderHeight)), + 3, &ClipRect ); + } + + if(gbPixelDepth==16) + { + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)(b->YLoc + (q*iBorderHeight)), + 4, &ClipRect ); + } + else if(gbPixelDepth==8) + { + Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)(b->YLoc + (q*iBorderHeight)), + 4, &ClipRect ); + } + } + + // Unlock buffer + UnLockVideoSurface( ButtonDestBuffer ); + +} + + + + + +//======================================================================================================= +// Dialog box code +// + + +//======================================================================================================= +//======================================================================================================= +// +// Very preliminary stuff follows +// +//======================================================================================================= +//======================================================================================================= + + + +typedef struct _CreateDlgInfo { + INT32 iFlags; // Holds the creation flags + + INT32 iPosX; // Screen position of dialog box + INT32 iPosY; + INT32 iWidth; // Dimensions of dialog box (if needed) + INT32 iHeight; + + INT32 iAreaWidth; // Dimensions of area the dialog box will be + INT32 iAreaHeight; // placed (for auto-sizing and auto-placement + INT32 iAreaOffsetX; // only) + INT32 iAreaOffsetY; + + UINT16 *zDlgText; // Text to be displayed (if any) + INT32 iTextFont; // Font to be used for text (if any) + UINT16 usTextCols; // Font colors (for mono fonts only) + + INT32 iTextAreaX; // Area in dialog box where text is to be + INT32 iTextAreaY; // put (for non-auto placed text) + INT32 iTextAreaWidth; + INT32 iTextAreaHeight; + + HVOBJECT hBackImg; // Background pic for dialog box (if any) + INT32 iBackImgIndex; // Sub-image index to use for image + INT32 iBackOffsetX; // Offset on dialog box where to put image + INT32 iBackOffsetY; + + HVOBJECT hIconImg; // Icon image pic and index. + INT32 iIconImgIndex; + INT32 iIconPosX; + INT32 iIconPosY; + + INT32 iBtnTypes; + + INT32 iOkPosX; // Ok button info + INT32 iOkPosY; + INT32 iOkWidth; + INT32 iOkHeight; + INT32 iOkImg; + + INT32 iCnclPosX; // Cancel button info + INT32 iCnclPosY; + INT32 iCnclWidth; + INT32 iCnclHeight; + INT32 iCnclImg; +} CreateDlgInfo; + +#define DLG_RESTRICT_MOUSE 1 +#define DLG_OK_BUTTON 2 +#define DLG_CANCEL_BUTTON 4 +#define DLG_AUTOSIZE 8 +#define DLG_RECREATE 16 +#define DLG_AUTOPOSITION 32 +#define DLG_TEXT_IN_AREA 64 +#define DLG_USE_BKGRND_IMAGE 128 +#define DLG_USE_BORDERS 256 +#define DLG_USE_BTN_HOTSPOTS 512 +#define DLG_USE_MONO_FONTS 1024 +#define DLG_IS_ACTIVE 2048 + +#define DLG_MANUAL_RENDER 0 +#define DLG_START_RENDER 1 +#define DLG_STOP_RENDER 2 +#define DLG_AUTO_RENDER 3 + +#define DLG_GET_STATUS 0 +#define DLG_WAIT_FOR_RESPONSE 1 + +#define DLG_STATUS_NONE 0 +#define DLG_STATUS_OK 1 +#define DLG_STATUS_CANCEL 2 +#define DLG_STATUS_PENDING 3 + +#define DLG_CLEARALL 0 +#define DLG_POSITION 1 +#define DLG_AREA 2 +#define DLG_TEXT 3 +#define DLG_TEXTAREA 4 +#define DLG_BACKPIC 5 +#define DLG_ICON 6 +#define DLG_OKBUTTON 7 +#define DLG_CANCELBUTTON 8 +#define DLG_OPTIONS 9 +#define DLG_SIZE 10 + + +BOOLEAN SetDialogAttributes( CreateDlgInfo *pDlgInfo, INT32 iAttrib, ... ) +{ + va_list arg; + INT32 iFont,iFontOptions; + UINT16 *zString; + INT32 iX,iY,iW,iH; + INT32 iIndex; + HVOBJECT hVObj; + INT32 iButnImg; + INT32 iFlags; + UINT8 ubFGrnd,ubBGrnd; + + // Set up for var args + va_start( arg, iAttrib ); // Init variable argument list + + switch (iAttrib) + { + case DLG_CLEARALL: + // Check to make sure it's not enabled, if so either abort or trash it! + memset( pDlgInfo, 0, sizeof(CreateDlgInfo) ); + break; + + case DLG_POSITION: + // Screen X/Y position of dialog box + iFlags = va_arg( arg, INT32 ); + iX = va_arg( arg, INT32 ); + iY = va_arg( arg, INT32 ); + + iW = va_arg( arg, INT32 ); + iH = va_arg( arg, INT32 ); + break; + + case DLG_SIZE: + // Width and height of doalog box + iFlags = va_arg( arg, INT32 ); + iW = va_arg( arg, INT32 ); + iH = va_arg( arg, INT32 ); + break; + + case DLG_AREA: + // Area where dialog box should be placed in (if not screen) + iFlags = va_arg( arg, INT32 ); + iX = va_arg( arg, INT32 ); + iY = va_arg( arg, INT32 ); + iW = va_arg( arg, INT32 ); + iH = va_arg( arg, INT32 ); + break; + + case DLG_TEXT: + // Set text and font for this dialog box + iFontOptions = va_arg( arg, INT32 ); + + iFont = va_arg( arg, INT32 ); + pDlgInfo->iTextFont = iFont; + + zString = (UINT16 *)va_arg( arg, UINT32 ); + + if ( pDlgInfo->zDlgText != NULL ) + MemFree( pDlgInfo->zDlgText ); + + if ( zString == NULL ) + pDlgInfo->zDlgText = NULL; + else + { + pDlgInfo->zDlgText = NULL; // Temp + } + + if ( iFontOptions & DLG_USE_MONO_FONTS ) + { + ubFGrnd = va_arg( arg, UINT8 ); + ubBGrnd = va_arg( arg, UINT8 ); + pDlgInfo->usTextCols = ((((UINT16)ubBGrnd)<<8) | (UINT16)ubFGrnd); + } + break; + + case DLG_TEXTAREA: + // Area on dialog box where the text should go! + iFlags = va_arg( arg, INT32 ); + iX = va_arg( arg, INT32 ); + iY = va_arg( arg, INT32 ); + iW = va_arg( arg, INT32 ); + iH = va_arg( arg, INT32 ); + break; + + case DLG_BACKPIC: + iFlags = va_arg( arg, INT32 ); + hVObj = (HVOBJECT)va_arg( arg, UINT32 ); + iIndex = va_arg( arg, INT32 ); + iX = va_arg( arg, INT32 ); + iY = va_arg( arg, INT32 ); + break; + + case DLG_ICON: + // Icon + iFlags = va_arg( arg, INT32 ); + hVObj = (HVOBJECT)va_arg( arg, UINT32 ); + iIndex = va_arg( arg, INT32 ); + iX = va_arg( arg, INT32 ); + iY = va_arg( arg, INT32 ); + break; + + case DLG_OKBUTTON: + // Ok button options + iFlags = va_arg( arg, INT32 ); + iX = va_arg( arg, INT32 ); + iY = va_arg( arg, INT32 ); + iW = va_arg( arg, INT32 ); + iH = va_arg( arg, INT32 ); + iButnImg = va_arg( arg, INT32 ); + break; + + case DLG_CANCELBUTTON: + // Cancel button options + iFlags = va_arg( arg, INT32 ); + iX = va_arg( arg, INT32 ); + iY = va_arg( arg, INT32 ); + iW = va_arg( arg, INT32 ); + iH = va_arg( arg, INT32 ); + iButnImg = va_arg( arg, INT32 ); + break; + + case DLG_OPTIONS: + iFlags = va_arg( arg, INT32 ); + break; + } + + va_end( arg ); // Must have this for proper exit + + return(TRUE); +} + +INT32 CreateDialogBox( CreateDlgInfo *pDlgInfo ) +{ + return (-1); +} + + +void RemoveDialogBox( void ) +{ +} + + +void DrawDialogBox( INT32 iDlgBox ) +{ +} + + +//------------------------------------------------------------------------------------------------------ + +template INT32 CreateCheckBoxButton(INT16, INT16, char *, INT16, GUI_CALLBACK); +template INT32 CreateCheckBoxButton(INT16, INT16, char const *, INT16, GUI_CALLBACK); +template +INT32 CreateCheckBoxButton( INT16 x, INT16 y, string3 filename, INT16 Priority, GUI_CALLBACK ClickCallback ) +{ + GUI_BUTTON *b; + INT32 ButPic, iButtonID; + Assert( filename != NULL ); + Assert( strlen(filename) ); + if( ( ButPic = LoadButtonImage(filename,-1,0,1,2,3) ) == -1 ) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"CreateCheckBoxButton: Can't load button image"); + return( -1 ); + } + iButtonID = (INT16)QuickCreateButton( + (UINT32)ButPic, x, y, BUTTON_CHECKBOX, Priority, + MSYS_NO_CALLBACK, ClickCallback ); + if( iButtonID == - 1 ) + { + DbgMessage(TOPIC_BUTTON_HANDLER,DBG_LEVEL_0,"CreateCheckBoxButton: Can't create button"); + return( -1 ); + } + + //change the flags so that it isn't a quick button anymore + b = ButtonList[ iButtonID ]; + b->uiFlags &= ( ~BUTTON_QUICK ); + b->uiFlags |= ( BUTTON_CHECKBOX | BUTTON_SELFDELETE_IMAGE); + + return( iButtonID ); +} + +// Added Oct17, 97 Carter - kind of mindless, but might as well have it +void MSYS_SetBtnUserData(INT32 iButtonNum,INT32 index,INT32 userdata) +{ + GUI_BUTTON *b; + b=ButtonList[iButtonNum]; + if(index < 0 || index > 3) + return; + b->UserData[index]=userdata; +} + +INT32 MSYS_GetBtnUserData(GUI_BUTTON *b,INT32 index) +{ + + + if(index < 0 || index > 3) + return(0); + + return(b->UserData[index]); +} + + +//Generic Button Movement Callback to reset the mouse button if the mouse is no longer +//in the button region. +void BtnGenericMouseMoveButtonCallback(GUI_BUTTON *btn,INT32 reason) +{ + //If the button isn't the anchored button, then we don't want to modify the button state. + if( btn != gpAnchoredButton ) + return; + if( reason & MSYS_CALLBACK_REASON_LOST_MOUSE ) + { + if( !gfAnchoredState ) + { + btn->uiFlags &= (~BUTTON_CLICKED_ON ); + if( btn->ubSoundSchemeID ) + { + PlayButtonSound( btn->IDNum, BUTTON_SOUND_CLICKED_OFF ); + } + } + #ifdef JA2 + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + #endif + } + else if( reason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) + { + btn->uiFlags |= BUTTON_CLICKED_ON ; + if( btn->ubSoundSchemeID ) + { + PlayButtonSound( btn->IDNum, BUTTON_SOUND_CLICKED_ON ); + } + #ifdef JA2 + InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); + #endif + } +} + +void ReleaseAnchorMode() +{ + if( !gpAnchoredButton ) + return; + + if( gusMouseXPos < gpAnchoredButton->Area.RegionTopLeftX || + gusMouseXPos > gpAnchoredButton->Area.RegionBottomRightX || + gusMouseYPos < gpAnchoredButton->Area.RegionTopLeftY || + gusMouseYPos > gpAnchoredButton->Area.RegionBottomRightY ) + { + //released outside button area, so restore previous button state. + if( gfAnchoredState ) + gpAnchoredButton->uiFlags |= BUTTON_CLICKED_ON; + else + gpAnchoredButton->uiFlags &= ( ~BUTTON_CLICKED_ON ); + #ifdef JA2 + InvalidateRegion(gpAnchoredButton->Area.RegionTopLeftX, gpAnchoredButton->Area.RegionTopLeftY, gpAnchoredButton->Area.RegionBottomRightX, gpAnchoredButton->Area.RegionBottomRightY); + #endif + } + gpPrevAnchoredButton = gpAnchoredButton; + gpAnchoredButton = NULL; +} + +#ifdef _JA2_RENDER_DIRTY + + +// Used to setup a dirtysaved region for buttons +BOOLEAN SetButtonSavedRect( INT32 iButton ) +{ + GUI_BUTTON *b; + INT32 xloc,yloc,w,h; + + Assert( iButton >=0 ); + Assert( iButton XLoc; + yloc=b->YLoc; + w = ( b->Area.RegionBottomRightX - b->Area.RegionTopLeftX ); + h = ( b->Area.RegionBottomRightY - b->Area.RegionTopLeftY ); + + if ( !(b->uiFlags & BUTTON_SAVEBACKGROUND ) ) + { + b->uiFlags |= BUTTON_SAVEBACKGROUND; + + b->BackRect = RegisterBackgroundRect(BGND_FLAG_PERMANENT | BGND_FLAG_SAVERECT, NULL, + (INT16)xloc, (INT16)yloc, (INT16)(xloc+w), (INT16)(yloc+h) ); + } + + return( TRUE ); +} + +void FreeButtonSavedRect( INT32 iButton ) +{ + GUI_BUTTON *b; + + Assert( iButton >=0 ); + Assert( iButton uiFlags & BUTTON_SAVEBACKGROUND ) ) + { + b->uiFlags &= (~BUTTON_SAVEBACKGROUND); + FreeBackgroundRectPending(b->BackRect); + } +} + +#endif + +//Kris: +//Yet new logical additions to the winbart library. +void HideButton( INT32 iButtonNum ) +{ + GUI_BUTTON *b; + + Assert( iButtonNum >= 0 ); + Assert( iButtonNum < MAX_BUTTONS); + + b = ButtonList[ iButtonNum ]; + + Assert( b ); + + b->Area.uiFlags &= (~MSYS_REGION_ENABLED); + b->uiFlags |= BUTTON_DIRTY; + #ifdef JA2 + InvalidateRegion(b->Area.RegionTopLeftX, b->Area.RegionTopLeftY, b->Area.RegionBottomRightX, b->Area.RegionBottomRightY); + #endif +} + +void ShowButton( INT32 iButtonNum ) +{ + GUI_BUTTON *b; + + Assert( iButtonNum >= 0 ); + Assert( iButtonNum < MAX_BUTTONS); + + b = ButtonList[ iButtonNum ]; + + Assert( b ); + + b->Area.uiFlags |= MSYS_REGION_ENABLED; + b->uiFlags |= BUTTON_DIRTY; + #ifdef JA2 + InvalidateRegion(b->Area.RegionTopLeftX, b->Area.RegionTopLeftY, b->Area.RegionBottomRightX, b->Area.RegionBottomRightY); + #endif +} + +void DisableButtonHelpTextRestore( void ) +{ + fDisableHelpTextRestoreFlag = TRUE; +} + +void EnableButtonHelpTextRestore( void ) +{ + fDisableHelpTextRestoreFlag = TRUE; +} + +void GiveButtonDefaultStatus( INT32 iButtonID, INT32 iDefaultStatus ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS); + b = ButtonList[ iButtonID ]; + //If new default status added, then this assert may need to be adjusted. + AssertMsg( iDefaultStatus >= DEFAULT_STATUS_NONE && iDefaultStatus <= DEFAULT_STATUS_WINDOWS95, + String( "Illegal button default status of %d", iDefaultStatus ) ); + Assert( b ); + + if( b->bDefaultStatus != (INT8)iDefaultStatus ) + { + b->bDefaultStatus = (INT8)iDefaultStatus; + b->uiFlags |= BUTTON_DIRTY; + } +} + +void RemoveButtonDefaultStatus( INT32 iButtonID ) +{ + GUI_BUTTON *b; + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS); + b = ButtonList[ iButtonID ]; + Assert( b ); + + if( b->bDefaultStatus ) + { + b->bDefaultStatus = DEFAULT_STATUS_NONE; + b->uiFlags |= BUTTON_DIRTY; + } +} + +BOOLEAN GetButtonArea(INT32 iButtonID, SGPRect *pRect) +{ +GUI_BUTTON *b; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS); + Assert(pRect); + + b = ButtonList[ iButtonID ]; + Assert( b ); + + if((pRect==NULL) || (b==NULL)) + return(FALSE); + + pRect->iLeft=b->Area.RegionTopLeftX; + pRect->iTop=b->Area.RegionTopLeftY; + pRect->iRight=b->Area.RegionBottomRightX; + pRect->iBottom=b->Area.RegionBottomRightY; + + return(TRUE); +} + +INT32 GetButtonWidth(INT32 iButtonID) +{ +GUI_BUTTON *b; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS); + + b = ButtonList[ iButtonID ]; + Assert( b ); + + if(b==NULL) + return(-1); + + return(b->Area.RegionBottomRightX - b->Area.RegionTopLeftX); +} + +INT32 GetButtonHeight(INT32 iButtonID) +{ +GUI_BUTTON *b; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS); + + b = ButtonList[ iButtonID ]; + Assert( b ); + + if(b==NULL) + return(-1); + + return(b->Area.RegionBottomRightY - b->Area.RegionTopLeftY); +} + +INT32 GetButtonX(INT32 iButtonID) +{ +GUI_BUTTON *b; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS); + + b = ButtonList[ iButtonID ]; + Assert( b ); + + if(b==NULL) + return(0); + + return(b->Area.RegionTopLeftX); +} + +INT32 GetButtonY(INT32 iButtonID) +{ +GUI_BUTTON *b; + + Assert( iButtonID >= 0 ); + Assert( iButtonID < MAX_BUTTONS); + + b = ButtonList[ iButtonID ]; + Assert( b ); + + if(b==NULL) + return(0); + + return(b->Area.RegionTopLeftY); +} diff --git a/Standard Gaming Platform/Button System.h b/Standard Gaming Platform/Button System.h new file mode 100644 index 00000000..a3d87362 --- /dev/null +++ b/Standard Gaming Platform/Button System.h @@ -0,0 +1,369 @@ +//***************************************************************************************************** +// Button System.h +// +// by Kris Morness (originally created by Bret Rowden) +//***************************************************************************************************** + +#ifndef __BUTTON_SYSTEM_H +#define __BUTTON_SYSTEM_H + +#include "vobject.h" +#include "mousesystem.h" +#include "soundman.h" +#include "Button Sound Control.h" + + +// Moved here from Button System.c by DB 99/01/07 +// Names of the default generic button image files. +#ifdef JA2 +#define DEFAULT_GENERIC_BUTTON_OFF "GENBUTN.STI" +#define DEFAULT_GENERIC_BUTTON_ON "GENBUTN2.STI" +#define DEFAULT_GENERIC_BUTTON_OFF_HI "GENBUTN3.STI" +#define DEFAULT_GENERIC_BUTTON_ON_HI "GENBUTN4.STI" +#else +#define DEFAULT_GENERIC_BUTTON_OFF "Data\\Message Box\\GENBUTN.STI" +#define DEFAULT_GENERIC_BUTTON_ON "Data\\Message Box\\GENBUTN2.STI" +#define DEFAULT_GENERIC_BUTTON_OFF_HI "Data\\Message Box\\GENBUTN3.STI" +#define DEFAULT_GENERIC_BUTTON_ON_HI "Data\\Message Box\\GENBUTN4.STI" +#endif + +#define BUTTON_TEXT_LEFT -1 +#define BUTTON_TEXT_CENTER 0 +#define BUTTON_TEXT_RIGHT 1 + +#define TEXT_LJUSTIFIED BUTTON_TEXT_LEFT +#define TEXT_CJUSTIFIED BUTTON_TEXT_CENTER +#define TEXT_RJUSTIFIED BUTTON_TEXT_RIGHT + + +// Some GUI_BUTTON system defines +#define BUTTON_USE_DEFAULT -1 +#define BUTTON_NO_FILENAME NULL +#define BUTTON_NO_CALLBACK NULL +#define BUTTON_NO_IMAGE -1 +#define BUTTON_NO_SLOT -1 + +#define BUTTON_INIT 1 +#define BUTTON_WAS_CLICKED 2 + +//effects how the button is rendered. +#define BUTTON_TYPES ( BUTTON_QUICK | BUTTON_GENERIC | BUTTON_HOT_SPOT | BUTTON_CHECKBOX ) +//effects how the button is processed +#define BUTTON_TYPE_MASK (BUTTON_NO_TOGGLE| BUTTON_ALLOW_DISABLED_CALLBACK | BUTTON_CHECKBOX | BUTTON_IGNORE_CLICKS ) + +//button flags +#define BUTTON_TOGGLE 0x00000000 +#define BUTTON_QUICK 0x00000000 +#define BUTTON_ENABLED 0x00000001 +#define BUTTON_CLICKED_ON 0x00000002 +#define BUTTON_NO_TOGGLE 0x00000004 +#define BUTTON_CLICK_CALLBACK 0x00000008 +#define BUTTON_MOVE_CALLBACK 0x00000010 +#define BUTTON_GENERIC 0x00000020 +#define BUTTON_HOT_SPOT 0x00000040 +#define BUTTON_SELFDELETE_IMAGE 0x00000080 +#define BUTTON_DELETION_PENDING 0x00000100 +#define BUTTON_ALLOW_DISABLED_CALLBACK 0x00000200 +#define BUTTON_DIRTY 0x00000400 +#define BUTTON_SAVEBACKGROUND 0x00000800 +#define BUTTON_CHECKBOX 0x00001000 +#define BUTTON_NEWTOGGLE 0x00002000 +#define BUTTON_FORCE_UNDIRTY 0x00004000 // no matter what happens this buttons does NOT get marked dirty +#define BUTTON_IGNORE_CLICKS 0x00008000 // Ignore any clicks on this button +#define BUTTON_DISABLED_CALLBACK 0x80000000 + +#define BUTTON_SOUND_NONE 0x00 +#define BUTTON_SOUND_CLICKED_ON 0x01 +#define BUTTON_SOUND_CLICKED_OFF 0x02 +#define BUTTON_SOUND_MOVED_ONTO 0x04 +#define BUTTON_SOUND_MOVED_OFF_OF 0x08 +#define BUTTON_SOUND_DISABLED_CLICK 0x10 +#define BUTTON_SOUND_DISABLED_MOVED_ONTO 0x20 +#define BUTTON_SOUND_DISABLED_MOVED_OFF_OF 0x40 +#define BUTTON_SOUND_ALREADY_PLAYED 0X80 + +#define BUTTON_SOUND_ALL_EVENTS 0xff + + +// Internal use! +#define GUI_SND_CLK_ON BUTTON_SOUND_CLICKED_ON +#define GUI_SND_CLK_OFF BUTTON_SOUND_CLICKED_OFF +#define GUI_SND_MOV_ON BUTTON_SOUND_MOVED_ONTO +#define GUI_SND_MOV_OFF BUTTON_SOUND_MOVED_OFF_OF +#define GUI_SND_DCLK BUTTON_SOUND_DISABLED_CLICK +#define GUI_SND_DMOV BUTTON_SOUND_DISABLED_MOVED_ONTO + +extern UINT32 ButtonDestBuffer; + +// GUI_BUTTON callback function type +typedef void (*GUI_CALLBACK)(struct _GUI_BUTTON *,INT32); + +// GUI_BUTTON structure definitions. +typedef struct _GUI_BUTTON { + INT32 IDNum; // ID Number, contains it's own button number + UINT32 ImageNum; // Image number to use (see DOCs for details) + MOUSE_REGION Area; // Mouse System's mouse region to use for this button + GUI_CALLBACK ClickCallback; // Button Callback when button is clicked + GUI_CALLBACK MoveCallback; // Button Callback when mouse moved on this region + INT16 Cursor; // Cursor to use for this button + UINT32 uiFlags; // Button state flags etc.( 32-bit ) + UINT32 uiOldFlags; // Old flags from previous render loop + INT16 XLoc; // Coordinates where button is on the screen + INT16 YLoc; + INT32 UserData[4]; // Place holder for user data etc. + INT16 Group; // Group this button belongs to (see DOCs) + INT8 bDefaultStatus; + //Button disabled style + INT8 bDisabledStyle; + //For buttons with text + UINT16 *string; //the string + UINT16 usFont; //font for text + BOOLEAN fMultiColor; //font is a multi-color font + INT16 sForeColor; //text colors if there is text + INT16 sShadowColor; + INT16 sForeColorDown; //text colors when button is down (optional) + INT16 sShadowColorDown; + INT16 sForeColorHilited; //text colors when button is down (optional) + INT16 sShadowColorHilited; + INT8 bJustification; // BUTTON_TEXT_LEFT, BUTTON_TEXT_CENTER, BUTTON_TEXT_RIGHT + INT8 bTextXOffset; + INT8 bTextYOffset; + INT8 bTextXSubOffSet; + INT8 bTextYSubOffSet; + BOOLEAN fShiftText; + INT16 sWrappedWidth; + //For buttons with icons (don't confuse this with quickbuttons which have up to 5 states ) + INT32 iIconID; + INT16 usIconIndex; + INT8 bIconXOffset; //-1 means horizontally centered + INT8 bIconYOffset; //-1 means vertically centered + BOOLEAN fShiftImage; //if true, icon is shifted +1,+1 when button state is down. + + UINT8 ubToggleButtonOldState; // Varibles for new toggle buttons that work + UINT8 ubToggleButtonActivated; + + INT32 BackRect; // Handle to a Background Rectangle + UINT8 ubSoundSchemeID; +} GUI_BUTTON; + + +#define MAX_BUTTONS 400 + +extern GUI_BUTTON *ButtonList[MAX_BUTTONS]; // Button System's Main Button List + +#define GetButtonPtr(x) (((x>=0) && (x +INT16 LoadGenericButtonIcon(string1 filename); + +BOOLEAN UnloadGenericButtonIcon(INT16 GenImg); + +template +INT32 LoadButtonImage(type1 filename, INT32 Grayed, INT32 OffNormal, INT32 OffHilite, INT32 OnNormal, INT32 OnHilite); +INT32 UseLoadedButtonImage(INT32 LoadedImg, INT32 Grayed, INT32 OffNormal, INT32 OffHilite, INT32 OnNormal, INT32 OnHilite); +INT32 UseVObjAsButtonImage(HVOBJECT hVObject, INT32 Grayed, INT32 OffNormal, INT32 OffHilite, INT32 OnNormal, INT32 OnHilite); +void UnloadButtonImage(INT32 Index); +INT16 LoadGenericButtonImages(UINT8 *GrayName,UINT8 *OffNormName,UINT8 *OffHiliteName,UINT8 *OnNormName,UINT8 *OnHiliteName,UINT8 *BkGrndName,INT16 Index,INT16 OffsetX, INT16 OffsetY); +BOOLEAN UnloadGenericButtonImage(INT16 GenImg); + +BOOLEAN SetButtonDestBuffer(UINT32 DestBuffer); + +BOOLEAN EnableButton(INT32 iButtonID); +BOOLEAN DisableButton(INT32 iButtonID); +void RemoveButton(INT32 iButtonID ); +void HideButton( INT32 iButtonID ); +void ShowButton( INT32 iButton ); + +void RenderButtons(void); +BOOLEAN DrawButton(INT32 iButtonID); +void DrawButtonFromPtr(GUI_BUTTON *b); + +//Base button types +void DrawGenericButton(GUI_BUTTON *b); +void DrawQuickButton(GUI_BUTTON *b); +void DrawCheckBoxButton( GUI_BUTTON *b ); +//Additional layers on buttons that can exist in any combination on generic or quick buttons +//To do so, use the new specify functions below. +void DrawIconOnButton(GUI_BUTTON *b); +void DrawTextOnButton(GUI_BUTTON *b); + +extern BOOLEAN gfRenderHilights; +#define EnableHilightsAndHelpText() gfRenderHilights = TRUE; +#define DisableHilightsAndHelpText() gfRenderHilights = FALSE; + +//Providing you have allocated your own image, this is a somewhat simplified function. +INT32 QuickCreateButton(UINT32 Image, INT16 xloc, INT16 yloc, INT32 Type,INT16 Priority,GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback); + +//A hybrid of QuickCreateButton. Takes a lot less parameters, but makes more assumptions. It self manages the +//loading, and deleting of the image. The size of the image determines the size of the button. It also uses +//the default move callback which emulates Win95. Finally, it sets the priority to normal. The function you +//choose also determines the type of button (toggle, notoggle, or newtoggle) +template +INT32 CreateEasyNoToggleButton ( INT32 x, INT32 y, string3 filename, GUI_CALLBACK ClickCallback ); + +template +INT32 CreateEasyToggleButton ( INT32 x, INT32 y, string3 filename, GUI_CALLBACK ClickCallback ); + +template +INT32 CreateEasyNewToggleButton( INT32 x, INT32 y, string3 filename, GUI_CALLBACK ClickCallback ); +//Same as above, but accepts specify toggle type + +template +INT32 CreateEasyButton( INT32 x, INT32 y, string3 filename, INT32 Type, GUI_CALLBACK ClickCallback); +//Same as above, but accepts priority specification. +template +INT32 CreateSimpleButton( INT32 x, INT32 y, string3 filename, INT32 Type, INT16 Priority, GUI_CALLBACK ClickCallback ); + +template +INT32 CreateCheckBoxButton( INT16 x, INT16 y, string3 filename, INT16 Priority, GUI_CALLBACK ClickCallback ); + +INT32 CreateIconButton(INT16 Icon,INT16 IconIndex,INT16 GenImg,INT16 xloc,INT16 yloc,INT16 w,INT16 h,INT32 Type,INT16 Priority,GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback); +INT32 CreateHotSpot(INT16 xloc, INT16 yloc, INT16 Width, INT16 Height,INT16 Priority,GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback); + +INT32 CreateTextButton(UINT16 *string, UINT32 uiFont, INT16 sForeColor, INT16 sShadowColor, INT16 GenImg, INT16 xloc, INT16 yloc, INT16 w, INT16 h, INT32 Type, INT16 Priority,GUI_CALLBACK MoveCallback, GUI_CALLBACK ClickCallback); +template +INT32 CreateIconAndTextButton( INT32 Image, string2 string, UINT32 uiFont, + INT16 sForeColor, INT16 sShadowColor, + INT16 sForeColorDown, INT16 sShadowColorDown, + INT8 bJustification, + INT16 xloc, INT16 yloc, INT32 Type, INT16 Priority, + GUI_CALLBACK MoveCallback,GUI_CALLBACK ClickCallback); + +//New functions +void SpecifyButtonText( INT32 iButtonID, UINT16 * string ); +void SpecifyButtonFont( INT32 iButtonID, UINT32 uiFont ); +void SpecifyButtonMultiColorFont(INT32 iButtonID, BOOLEAN fMultiColor); +void SpecifyButtonUpTextColors( INT32 iButtonID, INT16 sForeColor, INT16 sShadowColor ); +void SpecifyButtonDownTextColors( INT32 iButtonID, INT16 sForeColorDown, INT16 sShadowColorDown ); +void SpecifyButtonHilitedTextColors( INT32 iButtonID, INT16 sForeColorHilited, INT16 sShadowColorHilited ); +void SpecifyButtonTextJustification( INT32 iButtonID, INT8 bJustification ); +void SpecifyGeneralButtonTextAttributes( INT32 iButtonID, UINT16 *string, INT32 uiFont, + INT16 sForeColor, INT16 sShadowColor ); +void SpecifyFullButtonTextAttributes( INT32 iButtonID, UINT16 *string, INT32 uiFont, + INT16 sForeColor, INT16 sShadowColor, + INT16 sForeColorDown, INT16 sShadowColorDown, INT8 bJustification ); +void SpecifyGeneralButtonTextAttributes( INT32 iButtonID, UINT16 *string, INT32 uiFont, + INT16 sForeColor, INT16 sShadowColor ); +void SpecifyButtonTextOffsets( INT32 iButtonID, INT8 bTextXOffset, INT8 bTextYOffset, BOOLEAN fShiftText ); +void SpecifyButtonTextSubOffsets( INT32 iButtonID, INT8 bTextXOffset, INT8 bTextYOffset, BOOLEAN fShiftText ); +void SpecifyButtonTextWrappedWidth(INT32 iButtonID, INT16 sWrappedWidth); + +void SpecifyButtonSoundScheme( INT32 iButtonID, INT8 bSoundScheme ); +void PlayButtonSound( INT32 iButtonID, INT32 iSoundType ); + +void AllowDisabledButtonFastHelp( INT32 iButtonID, BOOLEAN fAllow ); + +enum{ + DEFAULT_STATUS_NONE, + DEFAULT_STATUS_DARKBORDER, //shades the borders 2 pixels deep + DEFAULT_STATUS_DOTTEDINTERIOR, //draws the familiar dotted line in the interior portion of the button. + DEFAULT_STATUS_WINDOWS95, //both DARKBORDER and DOTTEDINTERIOR +}; +void GiveButtonDefaultStatus( INT32 iButtonID, INT32 iDefaultStatus ); +void RemoveButtonDefaultStatus( INT32 iButtonID ); + +enum //for use with SpecifyDisabledButtonStyle +{ + DISABLED_STYLE_NONE, //for dummy buttons, panels, etc. Always displays normal state. + DISABLED_STYLE_DEFAULT, //if button has text then shade, else hatch + DISABLED_STYLE_HATCHED, //always hatches the disabled button + DISABLED_STYLE_SHADED //always shades the disabled button 25% darker +}; +void SpecifyDisabledButtonStyle( INT32 iButtonID, INT8 bStyle ); + + +void RemoveTextFromButton( INT32 iButtonID ); +void RemoveIconFromButton( INT32 iButtonID ); + +//Note: Text is always on top +//If fShiftImage is true, then the image will shift down one pixel and right one pixel +//just like the text does. +BOOLEAN SpecifyButtonIcon( INT32 iButtonID, INT32 iVideoObjectID, UINT16 usVideoObjectIndex, + INT8 bXOffset, INT8 bYOffset, BOOLEAN fShiftImage ); + + + +void SetButtonPosition(INT32 iButtonID,INT16 x, INT16 y); +void ResizeButton(INT32 iButtonID,INT16 w, INT16 h); + + +void QuickButtonCallbackMMove(MOUSE_REGION *reg,INT32 reason); +void QuickButtonCallbackMButn(MOUSE_REGION *reg,INT32 reason); + +BOOLEAN SetButtonCursor(INT32 iBtnId, UINT16 crsr); +void MSYS_SetBtnUserData(INT32 iButtonNum,INT32 index,INT32 userdata); +INT32 MSYS_GetBtnUserData(GUI_BUTTON *b,INT32 index); +void MarkAButtonDirty( INT32 iButtonNum ); // will mark only selected button dirty +void MarkButtonsDirty(void);// Function to mark buttons dirty ( all will redraw at next RenderButtons ) +void PausedMarkButtonsDirty( void ); // mark buttons dirty for button render the frame after the next +void UnMarkButtonDirty( INT32 iButtonIndex ); // unmark button +void UnmarkButtonsDirty( void ); // unmark ALL the buttoms on the screen dirty +void ForceButtonUnDirty( INT32 iButtonIndex ); // forces button undirty no matter the reason, only lasts one frame + +// DB 98-05-05 +BOOLEAN GetButtonArea(INT32 iButtonID, SGPRect *pRect); +// DB 99-01-13 +INT32 GetButtonWidth(INT32 iButtonID); +INT32 GetButtonHeight(INT32 iButtonID); + +// DB 99-08-27 +INT32 GetButtonX(INT32 iButtonID); +INT32 GetButtonY(INT32 iButtonID); + +void BtnGenericMouseMoveButtonCallback(GUI_BUTTON *btn,INT32 reason); +#define DEFAULT_MOVE_CALLBACK BtnGenericMouseMoveButtonCallback + + +void DrawCheckBoxButtonOn( INT32 iButtonID ); + +void DrawCheckBoxButtonOff( INT32 iButtonID ); + +extern UINT16 GetWidthOfButtonPic( UINT16 usButtonPicID, INT32 iSlot ); + +#endif + diff --git a/Standard Gaming Platform/Compression.cpp b/Standard Gaming Platform/Compression.cpp new file mode 100644 index 00000000..bf371583 --- /dev/null +++ b/Standard Gaming Platform/Compression.cpp @@ -0,0 +1,165 @@ +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "MemMan.h" + #include "debug.h" + #include "zlib.h" +#endif + + +// mem allocation functions for ZLIB's purposes + +voidpf ZAlloc( voidpf opaque, uInt items, uInt size ) +{ + return( MemAlloc( items * size ) ); +} + +void ZFree( voidpf opaque, voidpf address ) +{ + MemFree( address ); +} + +PTR DecompressInit( BYTE * pCompressedData, UINT32 uiDataSize ) +{ + z_stream * pZStream; + int iZRetCode; + + // allocate memory for the z_stream struct + pZStream = MemAlloc( sizeof( z_stream ) ); + if( pZStream == NULL ) + { // out of memory! + return( NULL ); + } + + // initial defines + pZStream->zalloc = ZAlloc; + pZStream->zfree = ZFree; + pZStream->opaque = NULL; + + // call the ZLIB init routine + iZRetCode = inflateInit( pZStream ); + if( iZRetCode != Z_OK ) + { // ZLIB init error! + MemFree( pZStream ); + return( NULL ); + } + + // set up our parameters + pZStream->next_in = pCompressedData; + pZStream->avail_in = uiDataSize; + return( (PTR) pZStream ); +} + +UINT32 Decompress( PTR pDecompPtr, BYTE * pBuffer, UINT32 uiBufferLen ) +{ + int iZRetCode; + z_stream * pZStream = (z_stream *) pDecompPtr; + + // these assertions is in here to ensure that we get passed a proper z_stream pointer + Assert( pZStream != NULL ); + Assert( pZStream->zalloc == ZAlloc ); + + if (pZStream->avail_in == 0) + { // There is nothing left to decompress! + return( 0 ); + } + + // set up the z_stream with our parameters + pZStream->next_out = pBuffer; + pZStream->avail_out = uiBufferLen; + + // decompress! + iZRetCode = inflate( pZStream, Z_PARTIAL_FLUSH ); + Assert( iZRetCode == Z_OK || iZRetCode == Z_STREAM_END ); + + return( uiBufferLen - pZStream->avail_out ); +} + +void DecompressFini( PTR pDecompPtr ) +{ + z_stream * pZStream = (z_stream *) pDecompPtr; + + // these assertions is in here to ensure that we get passed a proper z_stream pointer + Assert( pZStream != NULL ); + Assert( pZStream->zalloc == ZAlloc ); + + inflateEnd( pZStream ); + MemFree( pZStream ); +} + +UINT32 CompressedBufferSize( UINT32 uiDataSize ) +{ // Function that calculates the worst-case buffer size needed to + // hold uiDataSize bytes compressed + + return( uiDataSize + uiDataSize / 10 + 13 ); +} + +PTR CompressInit( BYTE * pUncompressedData, UINT32 uiDataSize ) +{ + z_stream * pZStream; + int iZRetCode; + + // allocate memory for the z_stream struct + pZStream = MemAlloc( sizeof( z_stream ) ); + if( pZStream == NULL ) + { // out of memory! + return( NULL ); + } + + // initial defines + pZStream->zalloc = ZAlloc; + pZStream->zfree = ZFree; + pZStream->opaque = NULL; + + // call the ZLIB init routine + iZRetCode = deflateInit( pZStream, Z_BEST_COMPRESSION ); + if( iZRetCode != Z_OK ) + { // ZLIB init error! + MemFree( pZStream ); + return( NULL ); + } + + // set up our parameters + pZStream->next_in = pUncompressedData; + pZStream->avail_in = uiDataSize; + return( (PTR) pZStream ); +} + +UINT32 Compress( PTR pCompPtr, BYTE * pBuffer, UINT32 uiBufferLen ) +{ + int iZRetCode; + z_stream * pZStream = (z_stream *) pCompPtr; + + // these assertions is in here to ensure that we get passed a proper z_stream pointer + Assert( pZStream != NULL ); + Assert( pZStream->zalloc == ZAlloc ); + + if (pZStream->avail_in == 0) + { // There is nothing left to compress! + return( 0 ); + } + + // set up the z_stream with our parameters + pZStream->next_out = pBuffer; + pZStream->avail_out = uiBufferLen; + + // decompress! + iZRetCode = deflate( pZStream, Z_FINISH ); + Assert( iZRetCode == Z_STREAM_END ); + + return( uiBufferLen - pZStream->avail_out ); +} + +void CompressFini( PTR pCompPtr ) +{ + z_stream * pZStream = (z_stream *) pCompPtr; + + // these assertions is in here to ensure that we get passed a proper z_stream pointer + Assert( pZStream != NULL ); + Assert( pZStream->zalloc == ZAlloc ); + + deflateEnd( pZStream ); + MemFree( pZStream ); +} diff --git a/Standard Gaming Platform/Compression.h b/Standard Gaming Platform/Compression.h new file mode 100644 index 00000000..4cee9e44 --- /dev/null +++ b/Standard Gaming Platform/Compression.h @@ -0,0 +1,52 @@ +#if !defined( COMPRESSION_H ) + +#define COMPRESSION_H + +#include "types.h" + +// Notes on how to use these functions without getting your hands dirty: + +// To decompress: +// +// 1) call DecompressInit() with a pointer to your compressed data, and the +// size of that compressed data. DecompressInit() returns a "decompression +// pointer" that you should pass to Decompress() and DecompressFini() +// +// 2) call Decompress() with the decompression pointer, a pointer to a +// buffer for decompressed data, and the length of that buffer. If the +// buffer is not large enough to hold all of the decompressed data, +// Decompress() will fill it completely, and you can call Decompress() again +// to continue your decompression. You are responsible for knowing the +// size your data will be after decompression. (The STI/STCI file format +// records your original data size for you...) Decompress() returns the +// number of bytes of output. +// +// 3) call DecompressFini() with the decompression pointer when you're done + +PTR DecompressInit( BYTE * pCompressedData, UINT32 uiDataSize ); +UINT32 Decompress( PTR pDecompPtr, BYTE * pBuffer, UINT32 uiBufferLen ); +void DecompressFini( PTR pDecompPtr ); + +// To compress: +// +// 1) call CompressInit() with a pointer to your uncompressed data, and the +// size of that uncompressed data. CompressInit() returns a "compression +// pointer" that you should pass to Compress() and CompressFini() +// +// 2) call Compress() with the compression pointer, a pointer to a +// buffer for compressed data, and the length of that buffer. If the +// buffer is not large enough to hold all of the compressed data, +// Compress() will fill it completely, and you can call Compress() again +// with a new or emptied buffer to continue your compression later. You +// can call CompressedBufferSize() to determine the largest buffer size you +// should need for a certain number of bytes. Ccompress() returns the number +// of bytes of output. +// +// 3) call CompressFini() with the compression pointer when you're done + +UINT32 CompressedBufferSize( UINT32 uiDataSize ); +PTR CompressInit( BYTE * pUncompressedData, UINT32 uiDataSize ); +UINT32 Compress( PTR pCompPtr, BYTE * pBuffer, UINT32 uiBufferLen ); +void CompressFini( PTR pCompPtr ); + +#endif \ No newline at end of file diff --git a/Standard Gaming Platform/Container.cpp b/Standard Gaming Platform/Container.cpp new file mode 100644 index 00000000..3cf4c46d --- /dev/null +++ b/Standard Gaming Platform/Container.cpp @@ -0,0 +1,2112 @@ +//***************************************************************************** +// +// Filename : Container.c +// +// Purpose : Function definition for the Container +// +// Modification History : +// 25 nov 96 TS creation +// +// 19 Dec 97 AM Replace all memcpy() with memmove(), since overlap possibilities +// abound (and there were already bugs in do_copy() for ordered lists) +// While the memcpy() was working in _DEBUG mode, it was failing +// reproducibly in RELEASE mode whenever regions overlapped! +// Having read the code, I strongly suggest that you DO NOT use this +// stuff at all and write your own instead. Tarun was no Carmack... +// - Alex Meduna +// 1998 KM Detached all references to this file from JA2 as it caused a lot of hard to debug +// crashes. The VOBJECT/VSURFACE lists are now self-maintained and no longer use the +// this crap. DON'T USE THIS -- NO MATTER WHAT!!! +//***************************************************************************** + +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "types.h" + #include + #include + #include + #include "windows.h" + #include "MemMan.h" + #include "Debug.h" + #include "Container.h" + #include +#endif + + +//***************************************************************************** +// +// Defines and typedefs +// +// +//***************************************************************************** +#define STRICT + +typedef struct StackHeaderTag +{ + UINT32 uiTotal_items; + UINT32 uiSiz_of_elem; + UINT32 uiMax_size; + +} StackHeader; + +typedef struct HeaderTag +{ + UINT32 uiTotal_items; + UINT32 uiSiz_of_elem; + UINT32 uiMax_size; + UINT32 uiHead; + UINT32 uiTail; + +} QueueHeader , ListHeader; + +typedef struct OrdHeaderTag +{ + UINT32 uiTotal_items; + UINT32 uiSiz_of_elem; + UINT32 uiMax_size; + UINT32 uiHead; + UINT32 uiTail; + INT8 (*pCompare)(void *,void *, UINT32); + +} OrdListHeader; + + typedef struct test + { + UINT32 me; + long you; + char *k; + char *p; + + } TEST; + +//***************************************************************************** +// +// CreateStack +// +// Parameter List : num_items - estimated number +// of items in stack +// siz_each - size of each item +// Return Value NULL if unsuccesful +// pointer to allocated memory +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** + +HSTACK CreateStack(UINT32 uiNum_items, UINT32 uiSiz_each) +{ + UINT32 uiAmount; + HSTACK hStack; + StackHeader *pStack; + + // assign an initial amount of memory to allocate + if ((uiNum_items > 0) && (uiSiz_each > 0)) + uiAmount = uiNum_items * uiSiz_each; + else + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "Requested stack items and size have to be >0"); + return NULL; + } + // allocate the container memory + if ((hStack = MemAlloc(uiAmount + sizeof(StackHeader))) == 0) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "Could not allocate stack container memory"); + return NULL; + } + pStack = (StackHeader *)hStack; + //initialize the header variables + pStack->uiMax_size = uiAmount + sizeof(StackHeader); + pStack->uiTotal_items = 0; + pStack->uiSiz_of_elem = uiSiz_each; + + // return the pointer to the memory + + return hStack; +} + +//***************************************************************************** +// +// CreateQueue +// +// Parameter List : num_items - estimated number +// of items in queue +// siz_each - size of each item +// Return Value NULL if unsuccesful +// pointer to allocated memory +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +HQUEUE CreateQueue(UINT32 uiNum_items, UINT32 uiSiz_each) +{ + UINT32 uiAmount; + HQUEUE hQueue; + QueueHeader *pQueue; + + // check to see if the queue has more than 1 + // element to be created and that the size > 1 + + if ((uiNum_items > 0) && (uiSiz_each > 0)) + uiAmount = uiNum_items * uiSiz_each; + else + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Requested queue items and size have to be >0"); + return NULL; + } + + // allocate the queue memory + if ((hQueue = MemAlloc(uiAmount + sizeof(QueueHeader))) == 0) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Could not allocate queue container memory"); + return NULL; + } + + pQueue = (QueueHeader *)hQueue; + //initialize the queue structure + + pQueue->uiMax_size = uiAmount + sizeof(QueueHeader); + pQueue->uiTotal_items = 0; + pQueue->uiSiz_of_elem = uiSiz_each; + pQueue->uiTail = pQueue->uiHead = sizeof(QueueHeader); + + // return the pointer to memory + return hQueue; +} +//***************************************************************************** +// +// CreateList +// +// Parameter List : num_items - estimated number +// of items in ordered list +// siz_each - size of each item +// Return Value NULL if unsuccesful +// pointer to allocated memory +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +HLIST CreateList(UINT32 uiNum_items, UINT32 uiSiz_each) +{ + UINT32 uiAmount; + HLIST hList; + ListHeader *pList; + + // check to see if the queue has more than 1 + // element to be created and that the size > 1 + + if ((uiNum_items > 0) && (uiSiz_each > 0)) + uiAmount = uiNum_items * uiSiz_each; + else + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Requested queue items and size have to be >0"); + return 0; + } + + // allocate the list memory + if ((hList = MemAlloc(uiAmount + sizeof(ListHeader))) == 0) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not allocate queue container memory"); + return 0; + } + + pList = (ListHeader *)hList; + //initialize the list structure + + pList->uiMax_size = uiAmount + sizeof(ListHeader); + pList->uiTotal_items = 0; + pList->uiSiz_of_elem = uiSiz_each; + pList->uiTail = pList->uiHead = sizeof(ListHeader); + + // return the pointer to memory + + return hList; + +} + + + +//***************************************************************************** +// +// CreateOrdList +// +// Parameter List : num_items - estimated number +// of items in ordered list +// siz_each - size of each item +// Return Value NULL if unsuccesful +// pointer to allocated memory +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +HORDLIST CreateOrdList(UINT32 uiNum_items, UINT32 uiSiz_each, INT8 (*compare)(void *, void *, UINT32)) +{ + UINT32 uiAmount; + HLIST hOrdList; + OrdListHeader *pOrdList; + + // check to see if the ordered list has more than 1 + // element to be created and that the size > 1 + + if ((uiNum_items > 0) && (uiSiz_each > 0)) + uiAmount = uiNum_items * uiSiz_each; + else + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Requested ordered list items and size have to be >0"); + return 0; + } + + // allocate the list memory + if ((hOrdList = MemAlloc(uiAmount + sizeof(OrdListHeader))) == 0) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not allocate queue container memory"); + return 0; + } + + pOrdList = (OrdListHeader *)hOrdList; + //initialize the list structure + + pOrdList->uiMax_size = uiAmount + sizeof(OrdListHeader); + pOrdList->uiTotal_items = 0; + pOrdList->uiSiz_of_elem = uiSiz_each; + pOrdList->uiTail = pOrdList->uiHead = sizeof(OrdListHeader); + pOrdList->pCompare = compare; + + // return the pointer to memory + + return hOrdList; +} + + + +//***************************************************************************** +// +// push +// +// Parameter List : void * - pointer to stack +// container +// data - data to add to stack +// +// Return Value BOOLEAN true if push ok +// else false +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +HSTACK Push(HSTACK hStack, void *pdata) +{ + StackHeader *pTemp_cont; + UINT32 uiOffset; + UINT32 uiNew_size; + void *pvoid; + BYTE *pbyte; + + // check for a NULL pointer + + if (hStack == NULL) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the stack"); + return NULL; + } + + // some valid data should be passed in + if (pdata == NULL) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto stack is NULL"); + return NULL; + } + + //perform operations to calculate offset and decide if the container has to resized + pTemp_cont = (StackHeader *)hStack; + uiOffset = (pTemp_cont->uiSiz_of_elem * pTemp_cont->uiTotal_items) + sizeof(StackHeader); + + if ((uiOffset + pTemp_cont->uiSiz_of_elem) > pTemp_cont->uiMax_size) + { + uiNew_size = pTemp_cont->uiMax_size + (pTemp_cont->uiMax_size - sizeof(StackHeader)); + pTemp_cont->uiMax_size = uiNew_size; + if ((hStack = MemRealloc(hStack, uiNew_size)) == NULL) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "Could not resize stack container memory"); + return NULL; + } + pTemp_cont = (StackHeader *)hStack; + } + pbyte = (BYTE *)hStack; + pbyte += uiOffset; + pvoid = (void *)pbyte; + //copy data from pdata to pvoid - the stack + memmove(pvoid, pdata, pTemp_cont->uiSiz_of_elem); + pTemp_cont->uiTotal_items++; + //return push succeeded + return hStack; +} +//***************************************************************************** +// +// pop +// +// Parameter List : void * - pointer to stack +// container +// +// +// Return Value : void * - pointer to stack +// after pushing element +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN Pop(HSTACK hStack, void *pdata) +{ + StackHeader *pTemp_cont; + UINT32 uiOffset; + UINT32 uiSize_of_each; + UINT32 uiTotal; + void *pvoid; + BYTE *pbyte; + + // check for a NULL queue + + if (hStack == NULL) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the stack"); + return FALSE; + } + if (pdata == NULL) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "Variable where data is to be stored is NULL"); + return FALSE; + } + pTemp_cont = (StackHeader *)hStack; + uiTotal = pTemp_cont->uiTotal_items; + uiSize_of_each = pTemp_cont->uiSiz_of_elem; + if (uiTotal == 0) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "There is no data in stack to pop"); + return FALSE; + } + + // calculate offsets to decide if the page should be rezied + uiOffset = (uiSize_of_each * uiTotal) + sizeof(StackHeader); + uiOffset -= uiSize_of_each; + pbyte = (BYTE *)hStack; + pbyte += uiOffset; + pvoid = (void *)pbyte; + // get the data from pvoid and store in pdata + memmove(pdata, pvoid, uiSize_of_each); + pTemp_cont->uiTotal_items--; + return TRUE; +} +//***************************************************************************** +// +// PeekStack +// +// Parameter List : void * - buffer to hold data +// +// +// Return Value : TRUE if stack not empty +// +// Modification History : +// Apr 14 2000 SCT -> Created +// +//***************************************************************************** +BOOLEAN PeekStack(HSTACK hStack, void *pdata) +{ + StackHeader *pTemp_cont; + UINT32 uiOffset; + UINT32 uiSize_of_each; + UINT32 uiTotal; + void *pvoid; + BYTE *pbyte; + + // check for a NULL queue + + if (hStack == NULL) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the stack"); + return FALSE; + } + if (pdata == NULL) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "Variable where data is to be stored is NULL"); + return FALSE; + } + pTemp_cont = (StackHeader *)hStack; + uiTotal = pTemp_cont->uiTotal_items; + uiSize_of_each = pTemp_cont->uiSiz_of_elem; + if (uiTotal == 0) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "There is no data in stack to pop"); + return FALSE; + } + + // calculate offsets to decide if the page should be rezied + uiOffset = (uiSize_of_each * uiTotal) + sizeof(StackHeader); + uiOffset -= uiSize_of_each; + pbyte = (BYTE *)hStack; + pbyte += uiOffset; + pvoid = (void *)pbyte; + // get the data from pvoid and store in pdata + memmove(pdata, pvoid, uiSize_of_each); + return TRUE; +} +//***************************************************************************** +// +// DeleteStack +// +// Parameter List : pointer to memory +// +// Return Value : BOOLEAN +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN DeleteStack(HSTACK hStack) +{ + if (hStack == NULL) + { + DbgMessage(TOPIC_STACK_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the stack"); + return FALSE; + } + // free the memory assigned to the handle + MemFree(hStack); + return TRUE; +} +//***************************************************************************** +// +// DeleteQueue +// +// Parameter List : pointer to memory +// +// Return Value : BOOLEAN +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN DeleteQueue(HQUEUE hQueue) +{ + if (hQueue == NULL) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the queue"); + return FALSE; + } + // free the memory assigned to the handle + MemFree(hQueue); + return TRUE; +} +//***************************************************************************** +// +// DeleteList +// +// Parameter List : pointer to memory +// +// Return Value : BOOLEAN +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN DeleteList(HLIST hList) +{ + if (hList == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the list"); + return FALSE; + } + // free the memory assigned to the list + MemFree(hList); + return TRUE; +} +//***************************************************************************** +// +// DeleteOrdList +// +// Parameter List : pointer to memory +// +// Return Value : BOOLEAN +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN DeleteOrdList(HORDLIST hOrdList) +{ + if (hOrdList == NULL) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the ordered list"); + return FALSE; + } + // free the memory assigned to the list + MemFree(hOrdList); + return TRUE; +} +//***************************************************************************** +// +// InitializeContainers +// +// Parameter List : none +// +// Return Value : void +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** + +void InitializeContainers(void) +{ + // register the appropriate debug topics + RegisterDebugTopic(TOPIC_STACK_CONTAINERS, "Stack Container"); + RegisterDebugTopic(TOPIC_LIST_CONTAINERS, "List Container"); + RegisterDebugTopic(TOPIC_QUEUE_CONTAINERS, "Queue Container"); + RegisterDebugTopic(TOPIC_ORDLIST_CONTAINERS, "Ordered List Container"); +} + +//***************************************************************************** +// +// ShutdownContainers +// +// Parameter List : none +// +// Return Value : void +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** + +void ShutdownContainers( void ) +{ + UnRegisterDebugTopic(TOPIC_STACK_CONTAINERS, "Stack Container"); + UnRegisterDebugTopic(TOPIC_LIST_CONTAINERS, "List Container"); + UnRegisterDebugTopic(TOPIC_QUEUE_CONTAINERS, "Queue Container"); + UnRegisterDebugTopic(TOPIC_ORDLIST_CONTAINERS, "Ordered List Container"); +} +//***************************************************************************** +// +// PeekQueue - gets the first item in queue without +// actually deleting it. +// +// Parameter List : pvoid_queue - pointer to queue +// container +// data - data removed from queue +// +// Return Value pointer to queue with data removed +// or NULL if failed +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN PeekQueue(HQUEUE hQueue, void *pdata) +{ + QueueHeader *pTemp_cont; + void *pvoid; + BYTE *pbyte; + + // cannot check for invalid handle , only 0 + if (hQueue == NULL) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the queue"); + return FALSE; + } + if (pdata == NULL) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Memory fo Data to be removed from queue is NULL"); + return FALSE; + } + + //assign to temporary variables + pTemp_cont = (QueueHeader *)hQueue; + + // if theres no elements to remove return error + if (pTemp_cont->uiTotal_items == 0) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "There is nothing in the queue"); + return FALSE; + } + + //copy the element pointed to by uiHead + + pbyte = (BYTE *)hQueue; + pbyte += pTemp_cont->uiHead; + pvoid = (void *)pbyte; + memmove(pdata, pvoid, pTemp_cont->uiSiz_of_elem); + + return TRUE; +} +//***************************************************************************** +// +// PeekList - gets the specified item in the list without +// actually deleting it. +// +// Parameter List : hList - pointer to list +// container +// data - data where list element is stored +// +// Return Value BOOLEAN +// +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN PeekList(HLIST hList, void *pdata, UINT32 uiPos) +{ + ListHeader *pTemp_cont; + void *pvoid; + UINT32 uiOffsetSrc; + BYTE *pbyte; + + // cannot check for invalid handle , only 0 + if (hList == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the list"); + return FALSE; + } + if (pdata == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Memory fo Data to be removed from list is NULL"); + return FALSE; + } + + //assign to temporary variables + pTemp_cont = (ListHeader *)hList; + + // if theres no elements to peek return error + if (pTemp_cont->uiTotal_items == 0) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "There is nothing in the list"); + return FALSE; + } + if (uiPos >= pTemp_cont->uiTotal_items) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "There is no item at this position"); + return FALSE; + } + + //copy the element pointed to by uiHead + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + if (uiOffsetSrc >= pTemp_cont->uiMax_size) + uiOffsetSrc = sizeof(ListHeader) + (uiOffsetSrc - pTemp_cont->uiMax_size); + + pbyte = (BYTE *)hList; + pbyte += uiOffsetSrc; + pvoid = (void *)pbyte; + memmove(pdata, pvoid, pTemp_cont->uiSiz_of_elem); + + return TRUE; +} + + +//***************************************************************************** +// +// SwapListNode - Swaps the contents of a list node with the given parameter. +// Note: The data being swapped in MUST have the same size as +// the current node size or strange things could happen. +// Contents of node and pdata parameter are swapped. +// +// Parameter List : hList - pointer to list container +// pdata - pointer to data to be swapped +// uiPos - List position with which to swap. +// +// Return Value BOOLEAN - TRUE if successful, FALSE if function fails. +// +// +// Modification History : +// Added to SGP by Bret Rowdon for use with JA2. May 1 '97. +// - This function was based on the PeekList function. +// +//***************************************************************************** +BOOLEAN SwapListNode(HLIST hList, void *pdata, UINT32 uiPos) +{ + ListHeader *pTemp_cont; + BYTE *pvoid; + UINT32 uiOffsetSrc; + BYTE *pbyte; + BYTE *pSrc; + + + // cannot check for invalid handle, only 0 + if (hList == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Invalid pointer to list"); + return FALSE; + } + + if (pdata == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Data pointer to be swapped from list is NULL"); + return FALSE; + } + + //assign to temporary variables + pTemp_cont = (ListHeader *)hList; + + // if theres no elements to peek return error + if (pTemp_cont->uiTotal_items == 0) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Empty list"); + return FALSE; + } + + if (uiPos >= pTemp_cont->uiTotal_items) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Invalid list position"); + return FALSE; + } + + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + if (uiOffsetSrc >= pTemp_cont->uiMax_size) + uiOffsetSrc = sizeof(ListHeader) + (uiOffsetSrc - pTemp_cont->uiMax_size); + + pbyte = (BYTE *)hList; + pbyte += uiOffsetSrc; + pvoid = pbyte; + pSrc = (BYTE *) pdata; + + // possible overlap, use memmove() + memmove(pvoid, pdata, pTemp_cont->uiSiz_of_elem); + //memmove(pvoid, pdata, pTemp_cont->uiSiz_of_elem); + + return TRUE; +} + + + +//***************************************************************************** +// +// StoreListNode - Stores the contents of a list node with the given parameter. +// Unlike SwapListNode(), this does NOT swap previous contents +// back into the pdata buffer! +// +// Parameter List : hList - pointer to list container +// pdata - pointer to data to be stored +// uiPos - List position into which to store. +// +// Return Value BOOLEAN - TRUE if successful, FALSE if function fails. +// +// +// Modification History : +// Added to SGP by Alex Meduna for use with Wiz8. Oct 31 '97. +// - This function is nearly identical to the SwapListNode() function. +// +//***************************************************************************** +BOOLEAN StoreListNode(HLIST hList, void *pdata, UINT32 uiPos) +{ + ListHeader *pTemp_cont; + UINT32 uiOffsetSrc; + BYTE *pbyte; + + // cannot check for invalid handle , only 0 + if (hList == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Invalid pointer to list"); + return FALSE; + } + + if (pdata == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Data pointer to be swapped from list is NULL"); + return FALSE; + } + + //assign to temporary variables + pTemp_cont = (ListHeader *)hList; + + // if theres no elements to peek return error + if (pTemp_cont->uiTotal_items == 0) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Empty list"); + return FALSE; + } + + if (uiPos >= pTemp_cont->uiTotal_items) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Invalid list position"); + return FALSE; + } + + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + if (uiOffsetSrc >= pTemp_cont->uiMax_size) + uiOffsetSrc = sizeof(ListHeader) + (uiOffsetSrc - pTemp_cont->uiMax_size); + + pbyte = (BYTE *)hList; + pbyte += uiOffsetSrc; + + memmove(pbyte, pdata, pTemp_cont->uiSiz_of_elem); + + return TRUE; +} + + + +//***************************************************************************** +// +// PeekOrdList - gets the specified item in the list without +// actually deleting it. +// +// Parameter List : hList - pointer to ordered list +// container +// data - data where list element is stored +// +// Return Value BOOLEAN +// +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN PeekOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) +{ + OrdListHeader *pTemp_cont; + void *pvoid; + UINT32 uiOffsetSrc; + BYTE *pbyte; + + // cannot check for invalid handle , only 0 + if (hOrdList == NULL) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the ordered list"); + return FALSE; + } + if (pdata == NULL) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Memory fo Data to be removed from ordered list is NULL"); + return FALSE; + } + + //assign to temporary variables + pTemp_cont = (OrdListHeader *)hOrdList; + + // if theres no elements to peek return error + if (pTemp_cont->uiTotal_items == 0) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "There is nothing in the list"); + return FALSE; + } + if (uiPos >= pTemp_cont->uiTotal_items) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "There is no item at this position"); + return FALSE; + } + + //copy the element pointed to by uiHead + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + if (uiOffsetSrc >= pTemp_cont->uiMax_size) + uiOffsetSrc = sizeof(OrdListHeader) + (uiOffsetSrc - pTemp_cont->uiMax_size); + + pbyte = (BYTE *)hOrdList; + pbyte += uiOffsetSrc; + pvoid = (void *)pbyte; + memmove(pdata, pvoid, pTemp_cont->uiSiz_of_elem); + + return TRUE; +} +//***************************************************************************** +// +// RemfromQueue +// +// Parameter List : pvoid_queue - pointer to queue +// container +// data - data removed from queue +// +// Return Value pointer to queue with data removed +// or NULL if failed +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN RemfromQueue(HQUEUE hQueue, void *pdata) +{ + QueueHeader *pTemp_cont; + void *pvoid; + BYTE *pbyte; + + // cannot check for invalid handle , only 0 + if (hQueue == NULL) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the queue"); + return FALSE; + } + if (pdata == NULL) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Memory fo Data to be removed from queue is NULL"); + return FALSE; + } + + //assign to temporary variables + pTemp_cont = (QueueHeader *)hQueue; + + // if theres no elements to remove return error + if (pTemp_cont->uiTotal_items == 0) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "There is nothing in the queue to remove"); + return FALSE; + } + + //remove the element pointed to by uiHead + + pbyte = (BYTE *)hQueue; + pbyte += pTemp_cont->uiHead; + pvoid = (void *)pbyte; + memmove(pdata, pvoid, pTemp_cont->uiSiz_of_elem); + pTemp_cont->uiTotal_items--; + pTemp_cont->uiHead += pTemp_cont->uiSiz_of_elem; + + // if after removing an element head = tail then set them both + // to the beginning of the container as it is empty + + if (pTemp_cont->uiHead == pTemp_cont->uiTail) + pTemp_cont->uiHead = pTemp_cont->uiTail = sizeof(QueueHeader); + + // if only the head is at the end of the container then make it point + // to the beginning of the container + + if (pTemp_cont->uiHead == pTemp_cont->uiMax_size) + pTemp_cont->uiHead = sizeof(QueueHeader); + + return TRUE; +} + +//***************************************************************************** +// +// AddtoQueue +// +// Parameter List : pvoid_queue - pointer to queue +// container +// pdata - pointer to data to add to queue +// +// Return Value pointer to queue with data added +// else false +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +HQUEUE AddtoQueue(HQUEUE hQueue, void *pdata) +{ + QueueHeader *pTemp_cont; + UINT32 uiMax_size; + UINT32 uiSize_of_each; + UINT32 uiTotal; + UINT32 uiNew_size; + UINT32 uiHead; + UINT32 uiTail; + void *pvoid; + BYTE *pbyte; + BYTE *pmaxsize; + BYTE *presize; + BOOLEAN fresize; + + // check for invalid handle = 0 + if (hQueue == NULL) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "This is not a valid pointer to the queue"); + return NULL; + } + + // check for data = NULL + if (pdata == NULL) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Data to be added onto queue is NULL"); + return NULL; + } + + // assign some temporary variables + fresize = FALSE; + pTemp_cont = (QueueHeader *)hQueue; + uiTotal = pTemp_cont->uiTotal_items; + uiSize_of_each = pTemp_cont->uiSiz_of_elem; + uiMax_size = pTemp_cont->uiMax_size; + uiHead = pTemp_cont->uiHead; + uiTail = pTemp_cont->uiTail; + if ((uiTail + uiSize_of_each) > uiMax_size) + { + uiTail = pTemp_cont->uiTail = sizeof(QueueHeader); + fresize = TRUE; + } + if ((uiHead == uiTail) && ((uiHead >= (sizeof(QueueHeader) + uiSize_of_each)) || (fresize == TRUE))) + { + uiNew_size = uiMax_size + (uiMax_size - sizeof(QueueHeader)); + pTemp_cont->uiMax_size = uiNew_size; + if ((hQueue = MemRealloc(hQueue, uiNew_size)) == NULL) + { + DbgMessage(TOPIC_QUEUE_CONTAINERS, DBG_LEVEL_0, "Could not resize queue container memory"); + return NULL; + } + // copy memory from beginning of container to end of container + // so that all the data is in one continuous block + + pTemp_cont = (QueueHeader *)hQueue; + presize = (BYTE *)hQueue; + pmaxsize = (BYTE *)hQueue; + presize += sizeof(QueueHeader); + pmaxsize += uiMax_size; + if (uiHead > sizeof(QueueHeader)) + memmove(pmaxsize, presize, uiHead-sizeof(QueueHeader)); + pTemp_cont->uiTail = uiMax_size + (uiHead-sizeof(QueueHeader)); + } + pbyte = (BYTE *)hQueue; + pbyte += pTemp_cont->uiTail; + pvoid = (void *)pbyte; + memmove(pvoid, pdata, uiSize_of_each); + pTemp_cont->uiTotal_items++; + pTemp_cont->uiTail += uiSize_of_each; + return hQueue; +} + +//***************************************************************************** +// +// do_copy +// +// Parameter List : pointer to mem, source offset, dest offset, size +// +// Return Value BOOLEAN +// +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN do_copy(void *pmem_void, UINT32 uiSourceOfst, UINT32 uiDestOfst, UINT32 uiSize) +{ + BYTE *pOffsetSrc; + BYTE *pOffsetDst; + void *pvoid_src; + void *pvoid_dest; + + if ((uiSourceOfst < 0) || (uiDestOfst < 0) || (uiSize < 0)) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Invalid parameters passed to do_copy"); + return FALSE; + } + + if (pmem_void == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Invalid pointer passed to do_copy"); + return FALSE; + } + pOffsetSrc = (BYTE *)pmem_void; + pOffsetSrc += uiSourceOfst; + pOffsetDst = (BYTE *)pmem_void; + pOffsetDst += uiDestOfst; + pvoid_src = (void *)pOffsetSrc; + pvoid_dest = (void *)pOffsetDst; + memmove(pvoid_dest, pvoid_src, uiSize); + return TRUE; +} +//***************************************************************************** +// +// do_copy_data +// +// Parameter List : pointer to mem, pointer to data, source offset, size +// +// Return Value BOOLEAN +// +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN do_copy_data(void *pmem_void, void *data, UINT32 uiSrcOfst, UINT32 uiSize) +{ + BYTE *pOffsetSrc; + void *pvoid_src; + + if ((uiSrcOfst < 0) || (uiSize < 0)) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Invalid parameters passed to do_copy_data"); + return FALSE; + } + + if (pmem_void == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Invalid pointer passed to do_copy_data"); + return FALSE; + } + pOffsetSrc = (BYTE *)pmem_void; + pOffsetSrc += uiSrcOfst; + pvoid_src = (void *)pOffsetSrc; + memmove(data, pvoid_src, uiSize); + return TRUE; +} +//***************************************************************************** +// +// StackSize +// +// Parameter List : pointer to stack +// +// Return Value UINT32 stack size +// +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +UINT32 StackSize(HSTACK hStack) +{ + StackHeader *pTemp_cont; + if (hStack == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Stack pointer is NULL"); + return 0; + } + pTemp_cont = (StackHeader *)hStack; + return pTemp_cont->uiTotal_items; +} +//***************************************************************************** +// +// QueueSize +// +// Parameter List : pointer to queue +// +// Return Value UINT32 queue size +// +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +UINT32 QueueSize(HQUEUE hQueue) +{ + QueueHeader *pTemp_cont; + if (hQueue == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Queue pointer is NULL"); + return 0; + } + pTemp_cont = (QueueHeader *)hQueue; + return pTemp_cont->uiTotal_items; +} +//***************************************************************************** +// +// ListSize +// +// Parameter List : pointer to queue +// +// Return Value UINT32 list size +// +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +UINT32 ListSize(HLIST hList) +{ + ListHeader *pTemp_cont; + if (hList == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "List pointer is NULL"); + return 0; + } + pTemp_cont = (ListHeader *)hList; + return pTemp_cont->uiTotal_items; +} +//***************************************************************************** +// +// OrdListSize +// +// Parameter List : pointer to list +// +// Return Value UINT32 Ordlist size +// +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +UINT32 OrdListSize(HORDLIST hOrdList) +{ + OrdListHeader *pTemp_cont; + if (hOrdList == NULL) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Ordered List pointer is NULL"); + return 0; + } + pTemp_cont = (OrdListHeader *)hOrdList; + return pTemp_cont->uiTotal_items; +} +//***************************************************************************** +// +// AddtoList +// +// Parameter List : HCONTAINER - handle to list +// container +// data - data to add to queue +// position - position after which data is to added +// +// Return Value BOOLEAN true if push ok +// else false +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +HLIST AddtoList(HLIST hList, void *pdata, UINT32 uiPos) +{ + ListHeader *pTemp_cont; + UINT32 uiMax_size; + UINT32 uiSize_of_each; + UINT32 uiTotal; + UINT32 uiNew_size; + UINT32 uiHead; + UINT32 uiTail; + void *pvoid; + BYTE *pbyte; + UINT32 uiOffsetSrc; + UINT32 uiOffsetDst; + UINT32 uiFinalLoc = 0; + BOOLEAN fTail_check=FALSE; + + // check for invalid handle = 0 + if (hList == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "This is not a valid handle to the list"); + return NULL; + } + + // check for data = NULL + if (pdata == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto list is NULL"); + return NULL; + } + // check for a 0 or negative position passed in + if (uiPos < 0) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto list is NULL"); + return NULL; + } + + // assign some temporary variables + + pTemp_cont = (ListHeader *)hList; + if (uiPos > pTemp_cont->uiTotal_items) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "There are not enough elements in the list"); + return NULL; + } + uiTotal = pTemp_cont->uiTotal_items; + uiSize_of_each = pTemp_cont->uiSiz_of_elem; + uiMax_size = pTemp_cont->uiMax_size; + uiHead = pTemp_cont->uiHead; + uiTail = pTemp_cont->uiTail; + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + if (uiOffsetSrc >= uiMax_size) + uiOffsetSrc = sizeof(ListHeader) + (uiOffsetSrc - uiMax_size); + if (uiTail == uiOffsetSrc) + fTail_check = TRUE; + // copy appropriate blocks + if (((uiTail + uiSize_of_each) <= uiMax_size) && + ((uiTail > uiHead) || ((uiTail == uiHead) && (uiHead == sizeof(ListHeader))))) + { + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + uiOffsetDst = uiOffsetSrc + pTemp_cont->uiSiz_of_elem; + if (fTail_check == FALSE) + { + if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + } + if (fTail_check == FALSE) + pTemp_cont->uiTail += uiSize_of_each; + uiFinalLoc = uiOffsetSrc; + } + + + if ((((uiTail + uiSize_of_each) <= uiMax_size) && (uiTail < uiHead)) + || (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead >= (sizeof(ListHeader) + uiSize_of_each)))) + { + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + + if (uiOffsetSrc >= uiMax_size) + { + uiOffsetSrc = sizeof(ListHeader) + (uiOffsetSrc - uiMax_size); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + if (do_copy(hList, uiOffsetDst, uiOffsetSrc, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + uiFinalLoc = uiOffsetSrc; + } else + { + uiOffsetSrc = sizeof(ListHeader); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + + uiOffsetSrc = uiMax_size - uiSize_of_each; + uiOffsetDst = sizeof(ListHeader); + if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiSize_of_each) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + if (do_copy(hList, uiOffsetSrc, uiOffsetDst, (uiMax_size-uiSize_of_each) - uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + } + pTemp_cont->uiTail += uiSize_of_each; + uiFinalLoc = uiOffsetSrc; + }// end if + + + + if ((((uiTail + uiSize_of_each) <= uiMax_size) && (uiTail == uiHead) && (uiHead >= (sizeof(ListHeader) + uiSize_of_each))) + || (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead == sizeof(ListHeader)))) + { + // need to resize the container + uiNew_size = uiMax_size + (uiMax_size - sizeof(ListHeader)); + pTemp_cont->uiMax_size = uiNew_size; + if ((hList = MemRealloc(hList, uiNew_size)) == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not resize list container memory"); + return NULL; + } + pTemp_cont = (ListHeader *)hList; + if (do_copy(hList, sizeof(ListHeader), uiMax_size, uiHead - sizeof(ListHeader)) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not copy list container memory"); + return NULL; + } + pTemp_cont->uiTail = uiMax_size + (uiHead-sizeof(ListHeader)); + + // now make place for the actual element + + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + uiOffsetDst = uiOffsetSrc + pTemp_cont->uiSiz_of_elem; + if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + pTemp_cont->uiTail += uiSize_of_each; + uiFinalLoc = uiOffsetSrc; + } + + + // finally insert data at position uiFinalLoc + + pbyte = (BYTE *)hList; + if (uiFinalLoc == 0) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "This should never happen! report this problem!"); + return NULL; + } + pbyte += uiFinalLoc; + pvoid = (void *)pbyte; + + memmove(pvoid, pdata, pTemp_cont->uiSiz_of_elem); + pTemp_cont->uiTotal_items++; + if (fTail_check == TRUE) + pTemp_cont->uiTail += pTemp_cont->uiSiz_of_elem; + return hList; +} + +//***************************************************************************** +// +// RemfromList +// +// Parameter List : HLIST - handle to list +// container +// data - data to remove from list +// position - position after which data is to added +// +// Return Value BOOLEAN true if push ok +// else false +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN RemfromList(HLIST hList, void *pdata, UINT32 uiPos) +{ + ListHeader *pTemp_cont; + UINT32 uiMax_size; + UINT32 uiSize_of_each; + UINT32 uiTotal; + UINT32 uiHead; + UINT32 uiTail; + UINT32 uiOffsetSrc; + UINT32 uiOffsetDst; + UINT32 uiFinalLoc = 0; + BOOLEAN fTail_check=FALSE; + + // check for invalid handle = 0 + if (hList == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "This is not a valid handle to the list"); + return FALSE; + } + + // check for data = NULL + if (pdata == NULL) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto list is NULL"); + return FALSE; + } + // check for a 0 or negative position passed in + if (uiPos < 0) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto list is NULL"); + return FALSE; + } + + // assign some temporary variables + pTemp_cont = (ListHeader *)hList; + + if (uiPos >= pTemp_cont->uiTotal_items) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Cannot delete at the specified position"); + return FALSE; + } + if (pTemp_cont->uiTotal_items == 0) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "There are no elements in the list to remove"); + return FALSE; + } + + uiTotal = pTemp_cont->uiTotal_items; + uiSize_of_each = pTemp_cont->uiSiz_of_elem; + uiMax_size = pTemp_cont->uiMax_size; + uiHead = pTemp_cont->uiHead; + uiTail = pTemp_cont->uiTail; + + // copy appropriate blocks + if ((uiTail > uiHead) || ((uiTail == uiHead) && (uiHead == sizeof(ListHeader)))) + { + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + uiOffsetDst = uiOffsetSrc + pTemp_cont->uiSiz_of_elem; + if (do_copy_data(hList, pdata, uiOffsetSrc, uiSize_of_each) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from list"); + return FALSE; + } + if (do_copy(hList, uiOffsetDst, uiOffsetSrc, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not remove the data the list"); + return FALSE; + } + pTemp_cont->uiTail -= uiSize_of_each; + pTemp_cont->uiTotal_items--; + } + + + if ((uiTail < uiHead) || ((uiTail == uiHead) && (uiHead <= (sizeof(ListHeader)+uiSize_of_each)))) + { + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + + if (uiOffsetSrc >= uiMax_size) + { + uiOffsetSrc = sizeof(ListHeader) + (uiOffsetSrc - uiMax_size); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + if (do_copy_data(hList, pdata, uiOffsetSrc, uiSize_of_each) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from list"); + return FALSE; + } + if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return FALSE; + } + uiFinalLoc = uiOffsetSrc; + } + else + { + uiOffsetSrc = sizeof(ListHeader); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return FALSE; + } + + uiOffsetSrc = uiMax_size - uiSize_of_each; + uiOffsetDst = sizeof(ListHeader); + if (do_copy(hList, uiOffsetSrc, uiOffsetDst, uiSize_of_each) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return FALSE; + } + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + if (do_copy_data(hList, pdata, uiOffsetSrc, uiSize_of_each) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from list"); + return FALSE; + } + if (do_copy(hList, uiOffsetSrc, uiOffsetDst, (uiMax_size-uiSize_of_each) - uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_LIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return FALSE; + } + } + pTemp_cont->uiTail -= uiSize_of_each; + pTemp_cont->uiTotal_items--; + } // end if + + return TRUE; +} + + + +//***************************************************************************** +// +// RemfromOrdList +// +// Parameter List : HORDLIST - handle to ordered list +// container +// data - data to remove from ordered list +// position - position after which data is to added +// +// Return Value BOOLEAN true if push ok +// else false +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +BOOLEAN RemfromOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) +{ + OrdListHeader *pTemp_cont; + UINT32 uiMax_size; + UINT32 uiSize_of_each; + UINT32 uiTotal; + UINT32 uiHead; + UINT32 uiTail; + UINT32 uiOffsetSrc; + UINT32 uiOffsetDst; + UINT32 uiFinalLoc = 0; + + + // check for invalid handle = 0 + if (hOrdList == NULL) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "This is not a valid handle to the ordered list"); + return FALSE; + } + + // check for data = NULL + if (pdata == NULL) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto ordered list is NULL"); + return FALSE; + } + // check for a 0 or negative position passed in + if (uiPos < 0) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto ordered list is NULL"); + return FALSE; + } + + // assign some temporary variables + + pTemp_cont = (OrdListHeader *)hOrdList; + if (uiPos >= pTemp_cont->uiTotal_items) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Cannot delete at the specified position"); + return FALSE; + } + + if (pTemp_cont->uiTotal_items == 0) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "There are no elements in the ordered list to remove"); + return FALSE; + } + + uiTotal = pTemp_cont->uiTotal_items; + uiSize_of_each = pTemp_cont->uiSiz_of_elem; + uiMax_size = pTemp_cont->uiMax_size; + uiHead = pTemp_cont->uiHead; + uiTail = pTemp_cont->uiTail; + + // copy appropriate blocks + if ((uiTail > uiHead) || ((uiTail == uiHead) && (uiHead == sizeof(OrdListHeader)))) + { + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + uiOffsetDst = uiOffsetSrc + pTemp_cont->uiSiz_of_elem; + if (do_copy_data(hOrdList, pdata, uiOffsetSrc, uiSize_of_each) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from ordered list"); + return FALSE; + } + + if (do_copy(hOrdList, uiOffsetDst, uiOffsetSrc, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not remove the data from the ordered list"); + return FALSE; + } + + pTemp_cont->uiTail -= uiSize_of_each; + pTemp_cont->uiTotal_items--; + } + + + if ((uiTail < uiHead) || ((uiTail == uiHead) && (uiHead <= (sizeof(OrdListHeader)+uiSize_of_each)))) + { + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + + if (uiOffsetSrc >= uiMax_size) + { + uiOffsetSrc = sizeof(OrdListHeader) + (uiOffsetSrc - uiMax_size); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + if (do_copy_data(hOrdList, pdata, uiOffsetSrc, uiSize_of_each) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from list"); + return FALSE; + } + if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return FALSE; + } + + uiFinalLoc = uiOffsetSrc; + } + else + { + uiOffsetSrc = sizeof(OrdListHeader); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + + if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return FALSE; + } + + uiOffsetSrc = uiMax_size - uiSize_of_each; + uiOffsetDst = sizeof(OrdListHeader); + + if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiSize_of_each) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return FALSE; + } + + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + if (do_copy_data(hOrdList, pdata, uiOffsetSrc, uiSize_of_each) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from list"); + return FALSE; + } + + if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, (uiMax_size-uiSize_of_each) - uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return FALSE; + } + } + + pTemp_cont->uiTail -= uiSize_of_each; + pTemp_cont->uiTotal_items--; + } // end if + + + return TRUE; +} + + + +//***************************************************************************** +// +// StoreinOrdList +// +// Parameter List : HORDLIST - handle to ordered list +// container +// data - data to add to the ordered list +// position - position after which data is to added +// +// Return Value BOOLEAN true if push ok +// else false +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// +//***************************************************************************** +HORDLIST StoreinOrdList(HORDLIST hOrdList, void *pdata, UINT32 uiPos) +{ + OrdListHeader *pTemp_cont; + UINT32 uiMax_size; + UINT32 uiSize_of_each; + UINT32 uiTotal; + UINT32 uiNew_size; + UINT32 uiHead; + UINT32 uiTail; + void *pvoid; + BYTE *pbyte; + UINT32 uiOffsetSrc; + UINT32 uiOffsetDst; + UINT32 uiFinalLoc = 0; + BOOLEAN fTail_check=FALSE; + + + // check for invalid handle = 0 + if (hOrdList == NULL) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "This is not a valid handle to the ordered list"); + return NULL; + } + + // check for data = NULL + if (pdata == NULL) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Data to be pushed onto ordered list is NULL"); + return NULL; + } + + // assign some temporary variables + pTemp_cont = (OrdListHeader *)hOrdList; + + // check for invalid position + if (uiPos > pTemp_cont->uiTotal_items) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "There are not enough elements in the ordered list to add after"); + return NULL; + } + + + uiTotal = pTemp_cont->uiTotal_items; + uiSize_of_each = pTemp_cont->uiSiz_of_elem; + uiMax_size = pTemp_cont->uiMax_size; + uiHead = pTemp_cont->uiHead; + uiTail = pTemp_cont->uiTail; + uiOffsetSrc = pTemp_cont->uiHead + (uiPos * pTemp_cont->uiSiz_of_elem); + + + // this shouldn't be necessary? position should never be outside the range? + if (uiOffsetSrc >= uiMax_size) + uiOffsetSrc = sizeof(OrdListHeader) + (uiOffsetSrc - uiMax_size); + + if (uiTail == uiOffsetSrc) + fTail_check = TRUE; + + + // now copy the appropriate blocks to make room... + + if (((uiTail + uiSize_of_each) <= uiMax_size) && + ((uiTail > uiHead) || ((uiTail == uiHead) && (uiHead == sizeof(OrdListHeader))))) + { + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + uiOffsetDst = uiOffsetSrc + pTemp_cont->uiSiz_of_elem; + + if (fTail_check == FALSE) + { + if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in ordered list"); + return NULL; + } + } + + if (fTail_check == FALSE) + pTemp_cont->uiTail += uiSize_of_each; + + uiFinalLoc = uiOffsetSrc; + } + + + if ((((uiTail + uiSize_of_each) <= uiMax_size) && (uiTail < uiHead)) || + (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead >= (sizeof(OrdListHeader) + uiSize_of_each)))) + { + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + + if (uiOffsetSrc >= uiMax_size) + { + uiOffsetSrc = sizeof(OrdListHeader) + (uiOffsetSrc - uiMax_size); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + + if (do_copy(hOrdList, uiOffsetDst, uiOffsetSrc, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + uiFinalLoc = uiOffsetSrc; + } + else + { + uiOffsetSrc = sizeof(OrdListHeader); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + + if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + + uiOffsetSrc = uiMax_size - uiSize_of_each; + uiOffsetDst = sizeof(OrdListHeader); + + if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiSize_of_each) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + uiOffsetDst = uiOffsetSrc + uiSize_of_each; + + if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, (uiMax_size-uiSize_of_each) - uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + } + + pTemp_cont->uiTail += uiSize_of_each; + uiFinalLoc = uiOffsetSrc; + } // end if + + + + if ((((uiTail + uiSize_of_each) <= uiMax_size) && (uiTail == uiHead) && (uiHead >= (sizeof(OrdListHeader) + uiSize_of_each))) + || (((uiTail + uiSize_of_each) > uiMax_size) && (uiHead == sizeof(OrdListHeader)))) + { + // need to resize the container + uiNew_size = uiMax_size + (uiMax_size - sizeof(OrdListHeader)); + pTemp_cont->uiMax_size = uiNew_size; + + if ((hOrdList = MemRealloc(hOrdList, uiNew_size)) == NULL) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not resize ordered list container memory"); + return NULL; + } + + pTemp_cont = (OrdListHeader *)hOrdList; + + if (do_copy(hOrdList, sizeof(OrdListHeader), uiMax_size, uiHead - sizeof(OrdListHeader)) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy ordered list container memory"); + return NULL; + } + + pTemp_cont->uiTail = uiMax_size + (uiHead-sizeof(OrdListHeader)); + + // now make place for the actual element + + uiOffsetSrc = pTemp_cont->uiHead + (uiPos*pTemp_cont->uiSiz_of_elem); + uiOffsetDst = uiOffsetSrc + pTemp_cont->uiSiz_of_elem; + + if (do_copy(hOrdList, uiOffsetSrc, uiOffsetDst, uiTail-uiOffsetSrc) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not store the data in list"); + return NULL; + } + pTemp_cont->uiTail += uiSize_of_each; + uiFinalLoc = uiOffsetSrc; + } + + if (uiFinalLoc == 0) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "This should never happen! report this problem!"); + return NULL; + } + + + // finally insert data at position uiFinalLoc + pbyte = (BYTE *)hOrdList; + pbyte += uiFinalLoc; + pvoid = (void *)pbyte; + memmove(pvoid, pdata, pTemp_cont->uiSiz_of_elem); + pTemp_cont->uiTotal_items++; + + if (fTail_check == TRUE) + pTemp_cont->uiTail += pTemp_cont->uiSiz_of_elem; + + return hOrdList; +} + + + +//***************************************************************************** +// +// AddtoOrdList +// +// Parameter List : HORDLIST - handle to ordered list +// container +// data - data to add to the ordered list +// +// Return Value BOOLEAN true if Add ok else false +// +// Modification History : +// Nov 26th 1996 -> modified for use by Wizardry +// Dec 19th 1997 -> verified, cleaned up, and heavily commented by AM +// +//***************************************************************************** +HORDLIST AddtoOrdList(HORDLIST hOrdList, void *pdata) +{ + OrdListHeader *pOrdList; + void *pTemp_data; + UINT32 uiOffset; + BOOLEAN fContinue = FALSE; + BOOLEAN fLessThan = FALSE; + BOOLEAN fMoreThan = FALSE; + INT8 sbResult; + UINT32 uiPosition; + + + // get a pointer into the list header + pOrdList = (OrdListHeader *)hOrdList; + + + // if the list is empty or full) + if (pOrdList->uiHead == pOrdList->uiTail) + { + // if the head offset points to position 0, presumably that means it's empty (?) + if (pOrdList->uiHead == sizeof(OrdListHeader)) + { + // so store it in position 0 + if ((hOrdList = StoreinOrdList(hOrdList, pdata, 0)) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data into ordered list"); + return NULL; + } + + return hOrdList; + } + + // set flag to go through the while loop even though head == tail + fContinue = TRUE; + } + + + // grab enough space to store one list entry + pTemp_data = MemAlloc(pOrdList->uiSiz_of_elem); + + // start offset by pointing at the last entry in the the list + uiOffset = pOrdList->uiTail; + + // figure out the index of the entry that the tail points to + uiPosition = (pOrdList->uiTail - sizeof(OrdListHeader)) / pOrdList->uiSiz_of_elem; + + + // continue looping while offset hasn't reached the start of the list yet (or at least once if list is full) + while ((uiOffset != pOrdList->uiHead) || (fContinue)) + { + // when offset reaches the top of the list + if (uiOffset == sizeof(OrdListHeader)) + { + // wrap around to the very bottom of the list (guaranteed to hold data?) + uiOffset = pOrdList->uiMax_size; + uiPosition = (pOrdList->uiMax_size - sizeof(OrdListHeader)) / pOrdList->uiSiz_of_elem; + } + + // get entry data at the current offset position and store it in pTemp_data + if (do_copy_data(hOrdList, pTemp_data, (uiOffset - pOrdList->uiSiz_of_elem), pOrdList->uiSiz_of_elem ) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data from list"); + MemFree(pTemp_data); + return NULL; + } + + // run the compare function + sbResult = pOrdList->pCompare(pTemp_data, pdata, pOrdList->uiSiz_of_elem); + + // and do the right thing based on the result... + switch (sbResult) + { + case ORDLIST_ERROR : + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not perform comparison for ordered lists"); + MemFree(pTemp_data); + return NULL; + } + + case ORDLIST_EQUAL : + case ORDLIST_LEFT_LESS : + { + // found the right spot! Insert it at the current position + if ((hOrdList = StoreinOrdList(hOrdList, pdata, uiPosition)) == NULL) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data into ordered list"); + MemFree(pTemp_data); + return NULL; + } + return hOrdList; + } + + case ORDLIST_RIGHT_LESS : + { + // keep looking + uiOffset -= pOrdList->uiSiz_of_elem; + uiPosition--; + break; + } + + default : + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Invalid result received from Compare function"); + MemFree(pTemp_data); + return NULL; + } + } // end switch + + fContinue = FALSE; + } // end while + + + // don't need this anymore + MemFree(pTemp_data); + pTemp_data = NULL; + + + // never found the right spot, which means we must have reached the head (damn well better) + if (uiOffset != pOrdList->uiHead) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "ERROR - left the while loop but not at the head"); + return NULL; + } + + // the new item will be first in list, so calculate the position based on the head + uiPosition = (pOrdList->uiHead - sizeof(OrdListHeader)) / pOrdList->uiSiz_of_elem; + + // and stick it in there... + if ((hOrdList = StoreinOrdList(hOrdList, pdata, uiPosition)) == FALSE) + { + DbgMessage(TOPIC_ORDLIST_CONTAINERS, DBG_LEVEL_0, "Could not copy the data into ordered list"); + return NULL; + } + + + return hOrdList; +} + + + +INT8 Compare(void *p, void *q, UINT32 size) +{ + TEST *temp1; + TEST *temp2; + + + temp1 = (TEST *)p; + temp2 = (TEST *)q; + + if (temp1->me < temp2->me) + return ORDLIST_LEFT_LESS; + + if (temp1->me > temp2->me) + return ORDLIST_RIGHT_LESS; + + if (temp1->me == temp2->me) + return ORDLIST_EQUAL; + + return ORDLIST_ERROR; +} diff --git a/Standard Gaming Platform/Container.h b/Standard Gaming Platform/Container.h new file mode 100644 index 00000000..1811c286 --- /dev/null +++ b/Standard Gaming Platform/Container.h @@ -0,0 +1,132 @@ +//*********************************************** +// +// Filename : Container.h +// +// Purpose : prototypes for the container file +// +// Modification History : 25 Nov 96 Creation +// +//*********************************************** + +#ifndef _CONTAINER_H +#define _CONTAINER_H + +//*********************************************** +// +// Includes +// +// +//*********************************************** + +#include "types.h" + +//*********************************************** +// +// Defines and typedefs +// +//*********************************************** +#define ORDLIST_ERROR -1 +#define ORDLIST_EQUAL 0 +#define ORDLIST_LEFT_LESS 1 +#define ORDLIST_RIGHT_LESS 2 + +typedef void * HCONTAINER; +typedef HCONTAINER HSTACK; +typedef HCONTAINER HQUEUE; +typedef HCONTAINER HLIST; +typedef HCONTAINER HORDLIST; + +//*********************************************** +// +// Function Prototypes +// +//*********************************************** +#ifdef __cplusplus +extern "C" { +#endif + +// call these functions to initialize and shutdown the debug messages for +// containers +extern void InitializeContainers(void); +extern void ShutdownContainers(void); + +// Stack Functions +// CreateStack(estimated number of items in stack, size of each item +// Push(handle to container returned from CreateStack, data to be passed in (must be void *) +// : returns handle to new stack +// Pop(handle to container returned from CreateStack, data to be passed in (must be void *) +// : returns BOOLEAN +// DeleteStack deletes the stack container +// StackSize returns size of stack + +extern HSTACK CreateStack(UINT32 num_of_elem , UINT32 siz_of_each); +extern HSTACK Push(HSTACK hStack, void *data); +extern BOOLEAN Pop(HSTACK hStack, void *data); +extern UINT32 StackSize(HSTACK hStack); +extern BOOLEAN DeleteStack(HSTACK hStack); +extern BOOLEAN PeekStack(HSTACK hStack, void *data); + +// Queue Functions +// CreateQueue(estimated number of items in queue, size of each item +// AddtoQueue(handle to container returned from CreateQueue, data to be passed in (must be void *)) +// : returns handle to queue +// RemfromQueue(handle to container returned from CreateQueue, variable where data is stored (must be void *)) +// : returns BOOLEAN +// PeekQueue(handle to the queue, variable where peeked data is stored). Item is not deleted. +// : returns BOOLEAN +// QueueSize(handle to the queue) returns the queue size +// DeleteQueue(handle to container) Delete the queue container +// : returns BOOLEAN + +extern HQUEUE CreateQueue(UINT32 num_of_elem, UINT32 siz_of_each); +extern HQUEUE AddtoQueue(HQUEUE hQueue, void *data); +extern BOOLEAN RemfromQueue(HQUEUE hQueue,void *data); +extern BOOLEAN PeekQueue(HQUEUE hQueue, void *data); +extern UINT32 QueueSize(HQUEUE hQueue); +extern BOOLEAN DeleteQueue(HQUEUE hQueue); + +// List Functions +// CreateList(estimated number of items in queue, size of each item +// AddtoList(handle to container returned from CreateQueue, data to be passed in (must be void *) +// position where data is to be added (0...sizeof(list)) +// : returns handle to new list +// RemfromList(handle to container returned from CreateList, variable where data is stored (must be void *) +// position where data is to be deleted (0...sizeof(list)-1) +// PeekList(handle to the list, variable where peeked data is stored). Item is not deleted. +// position where data is to be peeked (0...sizeof(list)-1) +// ListSize(handle to the list) returns the list size +// DeleteList(handle to the list) Delete the list container + +extern HLIST CreateList(UINT32 num_of_elem, UINT32 siz_of_each); +extern HLIST AddtoList(HLIST hList, void *data, UINT32 position); +extern BOOLEAN RemfromList(HLIST hList,void *data, UINT32 position); +extern BOOLEAN PeekList(HLIST hList, void *data, UINT32 position); +extern UINT32 ListSize(HLIST hList); +extern BOOLEAN DeleteList(HLIST hList); +extern BOOLEAN SwapListNode(HLIST hList, void *pdata, UINT32 uiPos); +extern BOOLEAN StoreListNode(HLIST hList, void *pdata, UINT32 uiPos); + +// Ordered List Functions +// CreateOrdList(estimated number of items in ordered list, size of each item, +// pointer to a compare function that returns info on whether the data in the ordered stack +// is < or > the new data to be added into the ordered list. +// AddtoOrdList(handle to container returned from CreateOrdList, data to be passed in (must be void *) +// RemfromOrdList(handle to container returned from CreateList, variable where data is stored (must be void *) +// position where data is to be deleted (0...sizeof(list)-1) +// PeekOrdList(handle to the list, variable where peeked data is stored). Item is not deleted. +// position where data is to be peeked (0...sizeof(list)-1) +// OrdListSize(handle to the list) returns the ordered list size +// DeleteOrdList(handle to the list) Delete the ordered list container + +extern HLIST CreateOrdList(UINT32 num_of_elem, UINT32 siz_of_each, INT8 (*compare)(void *,void *, UINT32)); +extern HLIST AddtoOrdList(HLIST hList, void *data); +extern BOOLEAN RemfromOrdList(HLIST hList,void *data, UINT32 position); +extern BOOLEAN PeekOrdList(HLIST hList, void *data, UINT32 position); +extern UINT32 OrdListSize(HLIST hList); +extern BOOLEAN DeleteOrdList(HLIST hList); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/Standard Gaming Platform/Cursor Control.cpp b/Standard Gaming Platform/Cursor Control.cpp new file mode 100644 index 00000000..ad812f5f --- /dev/null +++ b/Standard Gaming Platform/Cursor Control.cpp @@ -0,0 +1,653 @@ +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "Cursor Control.h" + + #if defined( JA2 ) || defined( UTIL ) + #include "video.h" + #else + #include "video2.h" + #endif + + #include "wcheck.h" +#endif + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Cursor Database +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +BOOLEAN gfCursorDatabaseInit = FALSE; + +CursorFileData *gpCursorFileDatabase; +CursorData *gpCursorDatabase; +INT16 gsGlobalCursorYOffset = 0; +INT16 gsCurMouseOffsetX = 0; +INT16 gsCurMouseOffsetY = 0; +UINT16 gsCurMouseHeight = 0; +UINT16 gsCurMouseWidth = 0; +UINT16 gusNumDataFiles = 0; +UINT32 guiExternVo; +UINT16 gusExternVoSubIndex; +UINT32 guiExtern2Vo; +UINT16 gusExtern2VoSubIndex; +UINT32 guiOldSetCursor = 0; +UINT32 guiDelayTimer = 0; + + +MOUSEBLT_HOOK gMouseBltOverride = NULL; + + + +BOOLEAN BltToMouseCursorFromVObject( HVOBJECT hVObject, UINT16 usVideoObjectSubIndex, UINT16 usXPos, UINT16 usYPos ) +{ + BOOLEAN ReturnValue; + + ReturnValue = BltVideoObject(MOUSE_BUFFER, hVObject, usVideoObjectSubIndex, usXPos, usYPos, VO_BLT_SRCTRANSPARENCY, NULL); + + return ReturnValue; +} + +BOOLEAN BltToMouseCursorFromVObjectWithOutline( HVOBJECT hVObject, UINT16 usVideoObjectSubIndex, UINT16 usXPos, UINT16 usYPos ) +{ + BOOLEAN ReturnValue; + ETRLEObject *pTrav; + INT16 sXPos, sYPos; + + // Adjust for offsets + pTrav = &(hVObject->pETRLEObject[ usVideoObjectSubIndex ] ); + + sXPos = 0; + sYPos = 0; + + // Remove offsets... + sXPos -= pTrav->sOffsetX; + sYPos -= pTrav->sOffsetY; + + // Center! + sXPos += ( ( gsCurMouseWidth - pTrav->usWidth ) / 2 ); + sYPos += ( ( gsCurMouseHeight - pTrav->usHeight ) / 2 ); + + ReturnValue = BltVideoObjectOutline(MOUSE_BUFFER, hVObject, usVideoObjectSubIndex, sXPos, sYPos, Get16BPPColor( FROMRGB( 0, 255, 0 ) ), TRUE ); + + return ReturnValue; +} + + +// THESE TWO PARAMETERS MUST POINT TO STATIC OR GLOBAL DATA, NOT AUTOMATIC VARIABLES +void InitCursorDatabase( CursorFileData *pCursorFileData, CursorData *pCursorData, UINT16 suNumDataFiles ) +{ + // Set global values! + + gpCursorFileDatabase = pCursorFileData; + gpCursorDatabase = pCursorData; + gusNumDataFiles = suNumDataFiles; + gfCursorDatabaseInit = TRUE; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Cursor Handlers +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +BOOLEAN LoadCursorData(UINT32 uiCursorIndex) +{ + // Load cursor data will load all data required for the cursor specified by this index + CursorData *pCurData; + CursorImage *pCurImage; + UINT32 cnt; + INT16 sMaxHeight = -1; + INT16 sMaxWidth = -1; + ETRLEObject *pTrav; + + pCurData = &( gpCursorDatabase[ uiCursorIndex ] ); + + for ( cnt = 0; cnt < pCurData->usNumComposites; cnt++ ) + { + + pCurImage = &( pCurData->Composites[ cnt ] ); + + if ( gpCursorFileDatabase[ pCurImage->uiFileIndex ].fLoaded == FALSE ) + { + // + // The file containing the video object hasn't been loaded yet. Let's load it now + // + VOBJECT_DESC VideoObjectDescription; + // FIRST LOAD AS AN HIMAGE SO WE CAN GET AUX DATA! + HIMAGE hImage; + AuxObjectData *pAuxData; + + + // ATE: First check if we are using an extern vo cursor... + if ( gpCursorFileDatabase[ pCurImage->uiFileIndex ].ubFlags & USE_EXTERN_VO_CURSOR ) + { + // Let's check if we have NOT NULL here... + if ( gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject == NULL ) + { + // Something wrong here... + + } + + } + else + { + hImage = CreateImage( (CHAR8 *)gpCursorFileDatabase[ pCurImage->uiFileIndex ].ubFilename, IMAGE_ALLDATA ); + if (hImage == NULL) + { + return( FALSE ); + } + + VideoObjectDescription.fCreateFlags = VOBJECT_CREATE_FROMHIMAGE; + VideoObjectDescription.hImage = hImage; + + if ( !AddVideoObject( &VideoObjectDescription, &( gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex) ) ) + { + return( FALSE ); + } + + // Check for animated tile + if (hImage->uiAppDataSize > 0 ) + { + // Valid auxiliary data, so get # od frames from data + pAuxData = ( AuxObjectData* ) hImage->pAppData; + + if ( pAuxData->fFlags & AUX_ANIMATED_TILE ) + { + gpCursorFileDatabase[ pCurImage->uiFileIndex ].ubFlags |= ANIMATED_CURSOR; + gpCursorFileDatabase[ pCurImage->uiFileIndex ].ubNumberOfFrames = pAuxData->ubNumberOfFrames; + } + } + + // the hImage is no longer needed + DestroyImage( hImage ); + + // Save hVObject.... + GetVideoObject( &(gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject), gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex ); + + } + + gpCursorFileDatabase[ pCurImage->uiFileIndex ].fLoaded = TRUE; + + } + + // Get ETRLE Data for this video object + pTrav = &(gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject->pETRLEObject[ pCurImage->uiSubIndex ] ); + + if( !pTrav ) + { + return FALSE; + } + + if ( pTrav->usHeight > sMaxHeight ) + { + sMaxHeight = pTrav->usHeight; + } + + if ( pTrav->usWidth > sMaxWidth ) + { + sMaxWidth = pTrav->usWidth; + } + + } + + + pCurData->usHeight = sMaxHeight; + pCurData->usWidth = sMaxWidth; + + + if ( pCurData->sOffsetX == CENTER_CURSOR ) + { + pCurData->sOffsetX = ( pCurData->usWidth / 2 ); + } + if ( pCurData->sOffsetX == RIGHT_CURSOR ) + { + pCurData->sOffsetX = pCurData->usWidth; + } + if ( pCurData->sOffsetX == LEFT_CURSOR ) + { + pCurData->sOffsetX = 0; + } + + if ( pCurData->sOffsetY == CENTER_CURSOR ) + { + pCurData->sOffsetY = ( pCurData->usHeight / 2 ); + } + if ( pCurData->sOffsetY == BOTTOM_CURSOR ) + { + pCurData->sOffsetY = pCurData->usHeight; + } + if ( pCurData->sOffsetY == TOP_CURSOR ) + { + pCurData->sOffsetY = 0; + } + + + gsCurMouseOffsetX = pCurData->sOffsetX; + gsCurMouseOffsetY = pCurData->sOffsetY; + gsCurMouseHeight = pCurData->usHeight; + gsCurMouseWidth = pCurData->usWidth; + + // Adjust relative offsets + for ( cnt = 0; cnt < pCurData->usNumComposites; cnt++ ) + { + pCurImage = &( pCurData->Composites[ cnt ] ); + + // Get ETRLE Data for this video object + pTrav = &(gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject->pETRLEObject[ pCurImage->uiSubIndex ] ); + + if( !pTrav ) + { + return FALSE; + } + + if ( pCurImage->usPosX == CENTER_SUBCURSOR ) + { + pCurImage->usPosX = pCurData->sOffsetX - ( pTrav->usWidth / 2 ); + } + + if ( pCurImage->usPosY == CENTER_SUBCURSOR ) + { + pCurImage->usPosY = pCurData->sOffsetY - ( pTrav->usHeight / 2 ); + } + + } + + + return TRUE; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +void UnLoadCursorData(UINT32 uiCursorIndex) +{ + // This function will unload add data used for this cursor + // + // Ok, first we make sure that the video object file is indeed loaded. Once this is verified, we will + // move on to the deletion + // + CursorData *pCurData; + CursorImage *pCurImage; + UINT32 cnt; + + pCurData = &( gpCursorDatabase[ uiCursorIndex ] ); + + for ( cnt = 0; cnt < pCurData->usNumComposites; cnt++ ) + { + + pCurImage = &( pCurData->Composites[ cnt ] ); + + if ( gpCursorFileDatabase[ pCurImage->uiFileIndex ].fLoaded ) + { + if ( !( gpCursorFileDatabase[ pCurImage->uiFileIndex ].ubFlags & USE_EXTERN_VO_CURSOR ) ) + { + DeleteVideoObjectFromIndex( gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex); + gpCursorFileDatabase[ pCurImage->uiFileIndex ].uiIndex = 0; + } + gpCursorFileDatabase[ pCurImage->uiFileIndex ].fLoaded = FALSE; + } + + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +void CursorDatabaseClear(void) +{ + UINT32 uiIndex; + + for (uiIndex = 0; uiIndex < gusNumDataFiles; uiIndex++) + { + if (gpCursorFileDatabase[uiIndex].fLoaded == TRUE) + { + if ( !( gpCursorFileDatabase[ uiIndex ].ubFlags & USE_EXTERN_VO_CURSOR ) ) + { + DeleteVideoObjectFromIndex( gpCursorFileDatabase[uiIndex].uiIndex); + gpCursorFileDatabase[uiIndex].uiIndex = 0; + } + + gpCursorFileDatabase[uiIndex].fLoaded = FALSE; + } + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ) +{ +#ifdef JA2 + + BOOLEAN ReturnValue = TRUE; + UINT16 usSubIndex; + CursorData *pCurData; + CursorImage *pCurImage; + UINT32 cnt; + INT16 sCenterValX, sCenterValY; + HVOBJECT hVObject; + ETRLEObject *pTrav; + UINT16 usEffHeight, usEffWidth; + + if ( gfCursorDatabaseInit ) + { + // Enter mouse buffer mutex + //EnterMutex(MOUSE_BUFFER_MUTEX, __LINE__, __FILE__); + + // If the current cursor is the first index, disable cursors + + if ( uiCursorIndex == VIDEO_NO_CURSOR ) + { + EraseMouseCursor( ); + + SetMouseCursorProperties( 0, 0, 5, 5 ); + DirtyCursor( ); + + //EnableCursor( FALSE ); + + } + else + { + // CHECK FOR EXTERN CURSOR + if ( uiCursorIndex == EXTERN_CURSOR || uiCursorIndex == EXTERN2_CURSOR ) + { + INT16 sSubX, sSubY; + HVOBJECT hVObjectTemp; + ETRLEObject *pTravTemp; + + // Erase old cursor + EraseMouseCursor( ); + + if ( uiCursorIndex == EXTERN2_CURSOR ) + { + // Get ETRLE values + GetVideoObject( &hVObject, guiExtern2Vo ); + pTrav = &(hVObject->pETRLEObject[ gusExtern2VoSubIndex ] ); + } + else + { + // Get ETRLE values + GetVideoObject( &hVObject, guiExternVo ); + pTrav = &(hVObject->pETRLEObject[ gusExternVoSubIndex ] ); + } + + // Determine center + sCenterValX = 0; + sCenterValY = 0; + + // Effective height + usEffHeight = pTrav->usHeight + pTrav->sOffsetY; + usEffWidth = pTrav->usWidth + pTrav->sOffsetX; + + + // ATE: Check for extern 2nd... + if ( uiCursorIndex == EXTERN2_CURSOR ) + { + BltVideoObjectOutlineFromIndex( MOUSE_BUFFER, guiExtern2Vo, gusExtern2VoSubIndex, 0, 0, 0, FALSE ); + + // Get ETRLE values + GetVideoObject( &hVObjectTemp, guiExternVo ); + pTravTemp = &(hVObjectTemp->pETRLEObject[ gusExternVoSubIndex ] ); + + sSubX = ( pTrav->usWidth - pTravTemp->usWidth - pTravTemp->sOffsetX ) / 2; + sSubY = ( pTrav->usHeight - pTravTemp->usHeight - pTravTemp->sOffsetY ) / 2; + + BltVideoObjectOutlineFromIndex( MOUSE_BUFFER, guiExternVo, gusExternVoSubIndex, sSubX, sSubY, 0, FALSE ); + + } + else + { + BltVideoObjectOutlineFromIndex( MOUSE_BUFFER, guiExternVo, gusExternVoSubIndex, 0, 0, 0, FALSE ); + } + + // Hook into hook function + if ( gMouseBltOverride != NULL ) + { + gMouseBltOverride( ); + } + + + #ifdef JA2 + SetMouseCursorProperties( (INT16)(usEffWidth/2), (INT16)(usEffHeight/2), (UINT16)(usEffHeight), (UINT16)(usEffWidth ) ); + #else + SetMouseCursorProperties( sCenterValY, (INT16)( sCenterValY + gsGlobalCursorYOffset ), MAX_CURSOR_HEIGHT, MAX_CURSOR_WIDTH ); + #endif + DirtyCursor( ); + + } + else + { + pCurData = &( gpCursorDatabase[ uiCursorIndex ] ); + + // First check if we are a differnet curosr... + if ( uiCursorIndex != guiOldSetCursor ) + { + // OK, check if we are a delay cursor... + if ( pCurData->bFlags & DELAY_START_CURSOR ) + { + guiDelayTimer = GetTickCount( ); + } + } + + guiOldSetCursor = uiCursorIndex; + + // Olny update if delay timer has elapsed... + if ( pCurData->bFlags & DELAY_START_CURSOR ) + { + if ( ( GetTickCount( ) - guiDelayTimer ) < 1000 ) + { + EraseMouseCursor( ); + + SetMouseCursorProperties( 0, 0, 5, 5 ); + DirtyCursor( ); + + return( TRUE ); + } + } + + + // + // Call LoadCursorData to make sure that the video object is loaded + // + LoadCursorData(uiCursorIndex); + + // Erase old cursor + EraseMouseCursor( ); + // NOW ACCOMODATE COMPOSITE CURSORS + pCurData = &( gpCursorDatabase[ uiCursorIndex ] ); + + for ( cnt = 0; cnt < pCurData->usNumComposites; cnt++ ) + { + + // Check if we are a flashing cursor! + if ( pCurData->bFlags & CURSOR_TO_FLASH ) + { + if ( cnt <= 1 ) + { + if ( pCurData->bFlashIndex != cnt ) + { + continue; + } + } + } + // Check if we are a sub cursor! + // IN this case, do all frames but + // skip the 1st or second! + + if ( pCurData->bFlags & CURSOR_TO_SUB_CONDITIONALLY ) + { + if ( pCurData->bFlags & CURSOR_TO_FLASH ) + { + if ( cnt <= 1 ) + { + if ( pCurData->bFlashIndex != cnt ) + { + continue; + } + } + } + else if ( pCurData->bFlags & CURSOR_TO_FLASH2 ) + { + if ( cnt <= 2 && cnt > 0 ) + { + if ( pCurData->bFlashIndex != cnt ) + { + continue; + } + } + } + else + { + if ( cnt <= 1 ) + { + if ( pCurData->bFlashIndex != cnt ) + { + continue; + } + } + } + } + + pCurImage = &( pCurData->Composites[ cnt ] ); + + // Adjust sub-index if cursor is animated + if ( gpCursorFileDatabase[ pCurImage->uiFileIndex].ubFlags & ANIMATED_CURSOR ) + { + usSubIndex = (UINT16)pCurImage->uiCurrentFrame; + } + else + { + usSubIndex = pCurImage->uiSubIndex; + } + + if ( pCurImage->usPosX != HIDE_SUBCURSOR && pCurImage->usPosY != HIDE_SUBCURSOR ) + { + // Blit cursor at position in mouse buffer + if ( gpCursorFileDatabase[ pCurImage->uiFileIndex].ubFlags & USE_OUTLINE_BLITTER ) + { + ReturnValue = BltToMouseCursorFromVObjectWithOutline( gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject , usSubIndex, pCurImage->usPosX, pCurImage->usPosY ); + } + else + { + ReturnValue = BltToMouseCursorFromVObject( gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject , usSubIndex, pCurImage->usPosX, pCurImage->usPosY ); + } + if ( !ReturnValue ) + { + return( FALSE ); + } + + } + + //if ( pCurData->bFlags & CURSOR_TO_FLASH ) + //{ + // break; + //} + } + + // Hook into hook function + if ( gMouseBltOverride != NULL ) + { + gMouseBltOverride( ); + } + + + sCenterValX = pCurData->sOffsetX; + sCenterValY = pCurData->sOffsetY; + + #ifdef JA2 + SetMouseCursorProperties( sCenterValX, (INT16)( sCenterValY + gsGlobalCursorYOffset ), pCurData->usHeight, pCurData->usWidth ); + #else + SetMouseCursorProperties( sCenterValY, (INT16)( sCenterValY + gsGlobalCursorYOffset ), MAX_CURSOR_HEIGHT, MAX_CURSOR_WIDTH ); + #endif + DirtyCursor( ); + } + } + } + else + { + if ( uiCursorIndex == VIDEO_NO_CURSOR ) + { + EraseMouseCursor( ); + + SetMouseCursorProperties( 0, 0, 5, 5 ); + DirtyCursor( ); + + //EnableCursor( FALSE ); + + } + else + { + + SetCurrentCursor( (UINT16)uiCursorIndex, 0, 0 ); + ReturnValue = TRUE; + } + } + + return ( ReturnValue ); +#else + return(0); +#endif + +} + +void SetMouseBltHook( MOUSEBLT_HOOK pMouseBltOverride ) +{ + gMouseBltOverride = pMouseBltOverride; +} + + +// Sets an external video object as cursor file data.... +void SetExternVOData( UINT32 uiCursorIndex, HVOBJECT hVObject, UINT16 usSubIndex ) +{ + CursorData *pCurData; + CursorImage *pCurImage; + UINT32 cnt; + + pCurData = &( gpCursorDatabase[ uiCursorIndex ] ); + + for ( cnt = 0; cnt < pCurData->usNumComposites; cnt++ ) + { + pCurImage = &( pCurData->Composites[ cnt ] ); + + if ( gpCursorFileDatabase[ pCurImage->uiFileIndex ].ubFlags & USE_EXTERN_VO_CURSOR ) + { + // OK, set Video Object here.... + + // If loaded, unload... + UnLoadCursorData( uiCursorIndex ); + + // Set extern vo + gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject = hVObject; + pCurImage->uiSubIndex = usSubIndex; + + + // Reload.... + LoadCursorData( uiCursorIndex ); + } + } +} + + +void RemoveExternVOData( UINT32 uiCursorIndex ) +{ + CursorData *pCurData; + CursorImage *pCurImage; + UINT32 cnt; + + pCurData = &( gpCursorDatabase[ uiCursorIndex ] ); + + for ( cnt = 0; cnt < pCurData->usNumComposites; cnt++ ) + { + pCurImage = &( pCurData->Composites[ cnt ] ); + + if ( gpCursorFileDatabase[ pCurImage->uiFileIndex ].ubFlags & USE_EXTERN_VO_CURSOR ) + { + gpCursorFileDatabase[ pCurImage->uiFileIndex ].hVObject = NULL; + } + + } +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Standard Gaming Platform/Cursor Control.h b/Standard Gaming Platform/Cursor Control.h new file mode 100644 index 00000000..3040db6c --- /dev/null +++ b/Standard Gaming Platform/Cursor Control.h @@ -0,0 +1,119 @@ +#ifndef __CURSOR_DATABASE_ +#define __CURSOR_DATABASE_ + +#include "Types.h" +#include "FileMan.h" +#include "VObject.h" +#include "VSurface.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#if defined( JA2 ) || defined( UTIL ) +#include "Video.h" +#else +#include "video2.h" +#endif + + +extern UINT32 GetCursorHandle(UINT32 uiCursorIndex); +extern void UnloadCursorData(UINT32 uiCursorIndex); +extern BOOLEAN LoadCursorData(UINT32 uiCursorIndex); +extern void CursorDatabaseClear(void); +extern UINT16 GetCursorSubIndex(UINT32 uiCursorIndex); +extern BOOLEAN SetCurrentCursorFromDatabase( UINT32 uiCursorIndex ); + +#define ANIMATED_CURSOR 0x02 +#define USE_EXTERN_VO_CURSOR 0x04 +#define USE_OUTLINE_BLITTER 0x08 + +#define EXTERN_CURSOR 0xFFF0 +#define EXTERN2_CURSOR 0xFFE0 +#define MAX_COMPOSITES 5 +#define CENTER_SUBCURSOR 31000 +#define HIDE_SUBCURSOR 32000 + +#define CENTER_CURSOR 32000 +#define RIGHT_CURSOR 32001 +#define LEFT_CURSOR 32002 +#define TOP_CURSOR 32003 +#define BOTTOM_CURSOR 32004 + +#define CURSOR_TO_FLASH 0x01 +#define CURSOR_TO_FLASH2 0x02 +#define CURSOR_TO_SUB_CONDITIONALLY 0x04 +#define DELAY_START_CURSOR 0x08 +#define CURSOR_TO_PLAY_SOUND 0x10 + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Cursor Database +// +/////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef struct +{ + UINT8 ubFilename[MAX_FILENAME_LEN]; + BOOLEAN fLoaded; + UINT32 uiIndex; + UINT8 ubFlags; + UINT8 ubNumberOfFrames; + HVOBJECT hVObject; + +} CursorFileData; + +typedef struct +{ + UINT32 uiFileIndex; + UINT16 uiSubIndex; + UINT32 uiCurrentFrame; + INT16 usPosX; + INT16 usPosY; + +} CursorImage; + +typedef struct +{ + CursorImage Composites[ MAX_COMPOSITES ]; + UINT16 usNumComposites; + INT16 sOffsetX; + INT16 sOffsetY; + UINT16 usHeight; + UINT16 usWidth; + UINT8 bFlags; + UINT8 bFlashIndex; + +} CursorData; + +extern INT16 gsGlobalCursorYOffset; + +// Globals for cursor database offset values +extern INT16 gsCurMouseOffsetX; +extern INT16 gsCurMouseOffsetY; +extern UINT16 gsCurMouseHeight; +extern UINT16 gsCurMouseWidth; + +extern UINT32 guiExternVo; +extern UINT16 gusExternVoSubIndex; +extern UINT32 guiExtern2Vo; +extern UINT16 gusExtern2VoSubIndex; +extern BOOLEAN gfExternUse2nd; + +typedef void (*MOUSEBLT_HOOK)( void ); + +void InitCursorDatabase( CursorFileData *pCursorFileData, CursorData *pCursorData, UINT16 suNumDataFiles ); +void SetMouseBltHook( MOUSEBLT_HOOK pMouseBltOverride ); + +void SetExternVOData( UINT32 uiCursorIndex, HVOBJECT hVObject, UINT16 usSubIndex ); +void RemoveExternVOData( UINT32 uiCursorIndex ); + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Standard Gaming Platform/DEBUG.H b/Standard Gaming Platform/DEBUG.H new file mode 100644 index 00000000..7f2a5950 --- /dev/null +++ b/Standard Gaming Platform/DEBUG.H @@ -0,0 +1,172 @@ +//************************************************************************** +// +// Filename : debug.h +// +// Purpose : prototypes for the debug manager +// +// Modification history : +// +// xxxxx96:LH - Creation +// xxnov96:HJH - made it work +// +//************************************************************************** + +#ifndef __DEBUG_MANAGER_ +#define __DEBUG_MANAGER_ + +#include + +#include "types.h" +#include "TopicOps.h" +#include "TopicIDs.h" + +/* +#ifdef __cplusplus +extern "C" { +#endif +*/ + +#define INVALID_TOPIC 0xffff +#define MAX_TOPICS_ALLOTED 1024 + + +extern BOOLEAN gfRecordToFile; +extern BOOLEAN gfRecordToDebugger; +extern UINT32 guiProfileStart, guiExecutions, guiProfileTime; +extern INT32 giProfileCount; + +#define PROFILE(x) guiProfileStart=GetTickCount(); \ + guiExecutions=x; \ + for(giProfileCount=0; giProfileCount < x; giProfileCount++) + +#define PROFILE_REPORT() guiProfileTime=(GetTickCount()-guiProfileStart); \ + _RPT3(_CRT_WARN, "*** PROFILE REPORT: %d executions took %dms, average of %.2fms per iteration.\n", guiExecutions, guiProfileTime, (FLOAT)guiProfileTime/guiExecutions); + +extern void _Null(void); +extern UINT8 *String(const char *String, ...); + + + +#if defined ( _DEBUG ) || defined ( FORCE_ASSERTS_ON ) + +// If DEBUG_ is defined, we need to initialize all the debug macros. Otherwise all the +// debug macros will be substituted by blank lines at compile time +//******************************************************************************************* +// Debug Mode +//******************************************************************************************* + +//Modified the Assertion code. As of the writing of this code, there are no other functions that +//make use of _FailMessage. With that assumption made, we can then make two functions, the first Assert, taking +//one argument, and passing a NULL string. The second one, AssertMsg(), accepts a string as the second parameter. +//This string that has vanished for Assert is now built inside of fail message. This is the case for both Asserts, but the second one +//also is added. Ex: +//Assert( pointer ); +//Assert( pointer, "This pointer is null and you tried to access it in function A "); +//It'll make debugging a little simpler. In anal cases, you could build the string first, then assert +//with it. +template +extern void _FailMessage(type1 pString, UINT32 uiLineNum, type2 pSourceFile ); + +#define Assert(a) (a) ? _Null() : _FailMessage( NULL, __LINE__, __FILE__ ) +#define AssertMsg(a,b) (a) ? _Null() : _FailMessage( b, __LINE__, __FILE__ ) + +extern UINT8 gubAssertString[128]; + + +#else + +#define Assert(a) ((void *)0) +#define AssertMsg(a,b) ((void *)0) + +//******************************************************************************************* +#endif + +// Moved these out of the defines - debug mgr always initialized +#define InitializeDebugManager() DbgInitialize() +#define ShutdownDebugManager() DbgShutdown() + +extern BOOLEAN DbgInitialize(void); +extern void DbgShutdown(void); + + +#ifdef SGP_DEBUG +// If DEBUG_ is defined, we need to initialize all the debug macros. Otherwise all the +// debug macros will be substituted by blank lines at compile time +//******************************************************************************************* +// Debug Mode +//******************************************************************************************* + +extern BOOLEAN gfDebugTopics[MAX_TOPICS_ALLOTED]; +// These are the debug macros (the ones the use will use). The user should never call +// the actual debug functions directly + +// Force a breakpoint in the debugger +#define DebugBreakpoint() __asm { int 3 } + + +#define DbgMessage(a, b, c) DbgMessageReal( (UINT16)(a), (UINT8)(TOPIC_MESSAGE), (UINT8)(b), (CHAR8 *)(c) ) +#define FastDebugMsg(a) _DebugMessage( (UINT8 *)(a), (UINT32)(__LINE__), (UINT8 *)(__FILE__) ) + +#define UnRegisterDebugTopic(a, b) DbgTopicRegistration( (UINT8)TOPIC_UNREGISTER, (UINT16 *)(&(a)), (CHAR8 *)(b) ) +#define ClearAllDebugTopics( ) DbgClearAllTopics( ) + +#define ErrorMsg(a) _DebugMessage( (UINT8 *)(a), (UINT32)(__LINE__), (UINT8 *)(__FILE__)) + +// Enable the debug topic we want +#if defined( JA2 ) || defined( UTIL ) +#define RegisterJA2DebugTopic(a, b) DbgTopicRegistration( TOPIC_REGISTER, &(a), (b) ) +#define RegisterDebugTopic(a, b) ((void *)0) +#define DebugMsg(a, b, c) DbgMessageReal( (a), TOPIC_MESSAGE, (b), (c) ) +#else +#define RegisterJA2DebugTopic(a, b) ((void *)0) +#define RegisterDebugTopic(a, b) DbgTopicRegistration( (UINT8)TOPIC_REGISTER, (UINT16 *)(&(a)), (CHAR8 *)(b) ) +#define DebugMsg(a) _DebugMessage((UINT8 *)(a), (UINT32)(__LINE__), (UINT8 *)(__FILE__)) +#endif + +// public interface to debug methods: +template +extern void DbgMessageReal(UINT16 uiTopicId, UINT8 uiCommand, UINT8 uiDebugLevel, type4 strMessage); + +extern BOOLEAN DbgSetDebugLevel(UINT16 TopicId, UINT8 uiDebugLevel); +extern void DbgFailedAssertion( BOOLEAN fExpression, char *szFile, int nLine ); +//extern void _FailMessage(UINT8 *pString, UINT32 uiLineNum, UINT8 *pSourceFile ); +extern void DbgTopicRegistration( UINT8 ubCmd, UINT16 *usTopicID, CHAR8 *zMessage ); +extern void DbgClearAllTopics( void ); +extern void _DebugMessage(UINT8 *pSourceFile, UINT32 uiLineNum, UINT8 *pString); + +//******************************************************************************************* + +#else + +//******************************************************************************************* +// Release Mode +//******************************************************************************************* +#define DebugBreakpoint() ((void *)0) + +#define RegisterDebugTopic(a, b) ((void *)0) +#define UnRegisterDebugTopic(a, b) ((void *)0) +#define ClearAllDebugTopics( ) ((void *)0) + +#define FastDebugMsg(a) ((void *)0) +#define ErrorMsg(a) ((void *)0) + +#define DbgTopicRegistration(a, b, c); ((void *)0) +#define DbgMessage(a, b, c) ((void *)0) + +#if defined( JA2 ) || defined( UTIL ) +#define RegisterJA2DebugTopic(a, b) ((void *)0) +#define DebugMsg(a, b, c) ((void *)0) +#else +#define DebugMsg(a) ((void *)0) +#endif + +//******************************************************************************************* +#endif + +/* +#ifdef __cplusplus +} +#endif +*/ + +#endif \ No newline at end of file diff --git a/Standard Gaming Platform/DEBUG.cpp b/Standard Gaming Platform/DEBUG.cpp new file mode 100644 index 00000000..3a3b1a50 --- /dev/null +++ b/Standard Gaming Platform/DEBUG.cpp @@ -0,0 +1,638 @@ + +// JA2 + +//************************************************************************** +// +// Filename : debug.c +// +// Purpose : debug manager implementation +// +// Modification history : +// +// xxxxx96:LH - Creation +// xxnov96:HJH - made it work +// +//************************************************************************** + +// Because we're in a library, define SGP_DEBUG here - the client may not always +// use the code to write text, because the header switches on the define +#define SGP_DEBUG + + +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "types.h" + #include + #include + #include + #include "debug.h" + #include "WCheck.h" + #include "TopicIDs.h" + #include "TopicOps.h" + #include "WizShare.h" + + //Kris addition + #ifdef JA2 + #include "screenids.h" + #include "Sys Globals.h" + #include "jascreens.h" + #include "gameloop.h" + #include "input.h" + #endif + + // CJC added + #ifndef _NO_DEBUG_TXT + #include "fileman.h" + #endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +BOOLEAN gfRecordToFile = FALSE; +BOOLEAN gfRecordToDebugger = TRUE; + +// moved from header file: 24mar98:HJH +UINT32 guiProfileStart, guiExecutions, guiProfileTime; +INT32 giProfileCount; + +// Had to move these outside the ifdef SGP_DEBUG below, because +// they are required for the String() function, which is NOT a +// debug-mode only function, it's used in release-mode as well! -- DB + +UINT8 gubAssertString[128]; + +#define MAX_MSG_LENGTH2 512 +UINT8 gbTmpDebugString[8][MAX_MSG_LENGTH2]; +UINT8 gubStringIndex = 0; + +#ifdef SGP_DEBUG + +//************************************************************************** +// +// Defines +// +//************************************************************************** + +#define BUFSIZE 100 +#define TIMER_TIMEOUT 1000 + +//************************************************************************** +// +// Variables +// +//************************************************************************** + +UINT16 TOPIC_MEMORY_MANAGER = INVALID_TOPIC; +UINT16 TOPIC_FILE_MANAGER = INVALID_TOPIC; +UINT16 TOPIC_DATABASE_MANAGER = INVALID_TOPIC; +UINT16 TOPIC_GAME = INVALID_TOPIC; +UINT16 TOPIC_SGP = INVALID_TOPIC; +UINT16 TOPIC_VIDEO = INVALID_TOPIC; +UINT16 TOPIC_INPUT = INVALID_TOPIC; +UINT16 TOPIC_STACK_CONTAINERS = INVALID_TOPIC; +UINT16 TOPIC_LIST_CONTAINERS = INVALID_TOPIC; +UINT16 TOPIC_QUEUE_CONTAINERS = INVALID_TOPIC; +UINT16 TOPIC_PRILIST_CONTAINERS = INVALID_TOPIC; +UINT16 TOPIC_HIMAGE = INVALID_TOPIC; +UINT16 TOPIC_ORDLIST_CONTAINERS = INVALID_TOPIC; +UINT16 TOPIC_3DENGINE = INVALID_TOPIC; +UINT16 TOPIC_VIDEOOBJECT = INVALID_TOPIC; +UINT16 TOPIC_FONT_HANDLER = INVALID_TOPIC; +UINT16 TOPIC_VIDEOSURFACE = INVALID_TOPIC; +UINT16 TOPIC_MOUSE_SYSTEM = INVALID_TOPIC; +UINT16 TOPIC_BUTTON_HANDLER = INVALID_TOPIC; +UINT16 TOPIC_MUTEX = INVALID_TOPIC; +UINT16 TOPIC_JA2 = 3; +UINT16 TOPIC_BLIT_QUEUE = INVALID_TOPIC; +UINT16 TOPIC_JA2OPPLIST = 2; +UINT16 TOPIC_JA2AI = 1; + + +UINT32 guiTimerID = 0; +UINT8 guiDebugLevels[NUM_TOPIC_IDS]; // don't change this, Luis!!!! + +BOOLEAN gfDebugTopics[MAX_TOPICS_ALLOTED]; +UINT16 *gpDbgTopicPtrs[MAX_TOPICS_ALLOTED]; + + +// remove debug .txt file +void RemoveDebugText( void ); + +STRING512 gpcDebugLogFileName; + +#ifdef __cplusplus +} +#endif + +//************************************************************************** +// +// Functions +// +//************************************************************************** + + +//************************************************************************** +// +// DbgGetLogFileName +// +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// xxjun98:CJC -> creation +// +//************************************************************************** +BOOLEAN DbgGetLogFileName( STRING512 pcName ) +{ + // use the provided buffer to get the directory name, then tack on + // "\debug.txt" +#ifndef _NO_DEBUG_TXT + if ( ! GetExecutableDirectory( pcName ) ) + { + return( FALSE ); + } + + if ( strlen( pcName ) > (512 - strlen( "\\debug.txt" ) - 1 ) ) + { + // no room! + return( FALSE ); + } + + strcat( pcName, "\\debug.txt" ); +#endif + + return( TRUE ); +} + + +//************************************************************************** +// +// DbgInitialize +// +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// xxnov96:HJH -> creation +// +//************************************************************************** + +BOOLEAN DbgInitialize(void) +{ + INT32 iX; + + for( iX = 0; iX < MAX_TOPICS_ALLOTED; iX++ ) + { + gpDbgTopicPtrs[iX] = NULL; + } + + DbgClearAllTopics(); + + gfRecordToFile = TRUE; + gfRecordToDebugger = TRUE; + gubAssertString[0] = '\0'; + +#ifndef _NO_DEBUG_TXT + if (! DbgGetLogFileName( gpcDebugLogFileName ) ) + { + return( FALSE ); + } + // clear debug text file out + RemoveDebugText( ); +#endif + + return(TRUE); +} + +//************************************************************************** +// +// DbgShutdown +// +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// xxnov96:HJH -> creation +// +//************************************************************************** + +void DbgShutdown(void) +{ + DbgMessageReal( (UINT16)(-1), CLIENT_SHUTDOWN, 0, "SGP Going Down" ); +} + + +//************************************************************************** +// +// DbgTopicRegistration +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// June 97: BR -> creation +// +//************************************************************************** + +void DbgTopicRegistration( UINT8 ubCmd, UINT16 *usTopicID, CHAR8 *zMessage ) +{ + UINT16 usIndex,usUse; + BOOLEAN fFound; + + if ( usTopicID == NULL ) + return; + + if( ubCmd == TOPIC_REGISTER ) + { + usUse = INVALID_TOPIC; + fFound = FALSE; + for( usIndex = 0; usIndex < MAX_TOPICS_ALLOTED && !fFound; usIndex++) + { + if ( !gfDebugTopics[usIndex] ) + { + fFound = TRUE; + usUse = usIndex; + } + } + + gfDebugTopics[ usUse ] = TRUE; + *usTopicID = usUse; + gpDbgTopicPtrs[usUse] = usTopicID; + DbgMessageReal(usUse, TOPIC_MESSAGE, DBG_LEVEL_0, zMessage ); + } + else if( ubCmd == TOPIC_UNREGISTER ) + { + if ( *usTopicID >= MAX_TOPICS_ALLOTED ) + return; + + DbgMessageReal( *usTopicID, TOPIC_MESSAGE, DBG_LEVEL_0, zMessage ); + gfDebugTopics[ *usTopicID ] = FALSE; + + + if (gpDbgTopicPtrs[ *usTopicID ] != NULL ) + { + gpDbgTopicPtrs[ *usTopicID ] = NULL; + } + + *usTopicID = INVALID_TOPIC; + } +} + + +// ************************************************************************* +// Clear the debug txt file out to prevent it from getting huge +// +// +// ************************************************************************* + +void RemoveDebugText( void ) +{ + DeleteFile( gpcDebugLogFileName ); +} + + +//************************************************************************** +// +// DbgClearAllTopics +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// June 97: BR -> creation +// +//************************************************************************** + +void DbgClearAllTopics( void ) +{ + UINT16 usIndex; + + for( usIndex = 0; usIndex < MAX_TOPICS_ALLOTED; usIndex++) + { + gfDebugTopics[ usIndex ] = FALSE; + if ( gpDbgTopicPtrs[ usIndex ] != NULL ) + { + *gpDbgTopicPtrs[usIndex] = INVALID_TOPIC; + gpDbgTopicPtrs[usIndex] = NULL; + } + } +} + + +//************************************************************************** +// +// DbgMessageReal +// +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// xxnov96:HJH -> creation +// +//************************************************************************** +template void DbgMessageReal(UINT16, UINT8, UINT8, unsigned char *); +template +void DbgMessageReal(UINT16 uiTopicId, UINT8 uiCommand, UINT8 uiDebugLevel, type4 strMessage) +{ +#ifndef _NO_DEBUG_TXT + FILE *OutFile; +#endif + + // Check for a registered topic ID + if ( uiTopicId < MAX_TOPICS_ALLOTED )//&& gfDebugTopics[uiTopicId] ) + { + OutputDebugString ( (LPCSTR) strMessage ); + OutputDebugString ( "\n" ); + +//add _NO_DEBUG_TXT to your SGP preprocessor definitions to avoid this f**king huge file from +//slowly growing behind the scenes!!!! +#ifndef _NO_DEBUG_TXT + if ((OutFile = fopen(gpcDebugLogFileName, "a+t")) != NULL) + { + fprintf(OutFile, "%s\n", strMessage); + fclose(OutFile); + } +#endif + } + +} + +//************************************************************************** +// +// DbgSetDebugLevel +// +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// 11nov96:HJH -> creation +// +//************************************************************************** + +BOOLEAN DbgSetDebugLevel(UINT16 uiTopicId, UINT8 uiDebugLevel) +{ + return(TRUE); +} + +//************************************************************************** +// +// DbgFailedAssertion +// +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// xxnov96:HJH -> creation +// +//************************************************************************** + +void DbgFailedAssertion( BOOLEAN fExpression, char *szFile, int nLine ) +{ +#ifndef _NO_DEBUG_TXT + FILE *OutFile; + + if ( fExpression == FALSE ) + { + if ((OutFile = fopen(gpcDebugLogFileName, "a+t")) != NULL) + { + fprintf(OutFile, "Assertion Failed at:\n line %i\n %s\n", nLine, szFile); + fclose(OutFile); + } + } +#endif +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +void _DebugRecordToFile(BOOLEAN gfState) +{ + gfRecordToFile = gfState; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +void _DebugRecordToDebugger(BOOLEAN gfState) +{ + gfRecordToDebugger = gfState; +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Wiz8 compatible debug messaging + +void _DebugMessage(UINT8 *pString, UINT32 uiLineNum, UINT8 *pSourceFile) +{ + UINT8 ubOutputString[512]; +#ifndef _NO_DEBUG_TXT + FILE *DebugFile; +#endif + + // + // Build the output string + // + + sprintf( (char *) ubOutputString, "{ %ld } %s [Line %d in %s]\n", GetTickCount(), pString, uiLineNum, pSourceFile ); + + // + // Output to debugger + // + + if (gfRecordToDebugger) + { + OutputDebugString( (LPCSTR) ubOutputString ); + } + + // + // Record to file if required + // + +#ifndef _NO_DEBUG_TXT + if (gfRecordToFile) + { + if ((DebugFile = fopen( gpcDebugLogFileName, "a+t" )) != NULL) + { + fputs( (const char *)ubOutputString, DebugFile ); + fclose( DebugFile ); + } + } +#endif +} + + + +////////////////////////////////////////////////////////////////////// +// This func is used by Assert() +void _Null(void) +{ +} + +extern HVOBJECT FontObjs[25]; + +#ifdef JA2 //JAGGED ALLIANCE 2 VERSION ONLY +template void _FailMessage(char *, unsigned int, char const *); +template void _FailMessage(char const *, unsigned int, char const *); +template void _FailMessage(int, unsigned int, char const *); +template void _FailMessage(int, unsigned int, char *); +template void _FailMessage(char *, unsigned int, char *); +template void _FailMessage(unsigned char *, unsigned int, char *); +template void _FailMessage(unsigned char *, unsigned int, char const *); +template +void _FailMessage( type1 pString, UINT32 uiLineNum, type2 pSourceFile ) +{ + MSG Message; + UINT8 ubOutputString[512]; +#ifndef _NO_DEBUG_TXT + FILE *DebugFile; +#endif + BOOLEAN fDone = FALSE; + //Build the output strings + sprintf( (char *)ubOutputString, "{ %ld } Assertion Failure [Line %d in %s]\n", GetTickCount(), uiLineNum, pSourceFile ); + if( pString ) + sprintf( (char *)gubAssertString, (const char *)pString ); + else + sprintf( (char *)gubAssertString, "" ); + + //Output to debugger + if (gfRecordToDebugger) + OutputDebugString( (LPCSTR)ubOutputString ); + + //Record to file if required +#ifndef _NO_DEBUG_TXT + if (gfRecordToFile) + { + if ((DebugFile = fopen( gpcDebugLogFileName, "a+t" )) != NULL) + { + fputs( (const char *)ubOutputString, DebugFile ); + fclose( DebugFile ); + } + } + +#if 0 + if( !FontObjs[0] ) + { //Font manager hasn't yet been initialized so use the windows error system + sprintf( gubErrorText, "Assertion Failure -- Line %d in %s", uiLineNum, pSourceFile ); + MessageBox( NULL, gubErrorText, "Jagged Alliance 2", MB_OK ); + gfProgramIsRunning = FALSE; + return; + } +#endif + + //Kris: + //NASTY HACK, THE GAME IS GOING TO DIE ANYWAY, SO WHO CARES WHAT WE DO. + //This will actually bring up a screen that prints out the assert message + //until the user hits esc or alt-x. + sprintf( (char *)gubErrorText, "Assertion Failure -- Line %d in %s", uiLineNum, pSourceFile ); + SetPendingNewScreen( ERROR_SCREEN ); + SetCurrentScreen( ERROR_SCREEN ); + while (gfProgramIsRunning) + { + if (PeekMessage(&Message, NULL, 0, 0, PM_NOREMOVE)) + { // We have a message on the WIN95 queue, let's get it + if (!GetMessage(&Message, NULL, 0, 0)) + { // It's quitting time + continue; + } + // Ok, now that we have the message, let's handle it + TranslateMessage(&Message); + DispatchMessage(&Message); + } + else + { // Windows hasn't processed any messages, therefore we handle the rest + GameLoop(); + gfSGPInputReceived = FALSE; + } + } +#endif + exit(0); +} + +#else //NOT JAGGED ALLIANCE 2 + +void _FailMessage(UINT8 *pString, UINT32 uiLineNum, UINT8 *pSourceFile) +{ + UINT8 ubOutputString[512]; + BOOLEAN fDone = FALSE; + +#ifndef _NO_DEBUG_TXT + FILE *DebugFile; +#endif + + + // Build the output string + sprintf( ubOutputString, "{ %ld } Assertion Failure: %s [Line %d in %s]\n", GetTickCount(), pString, uiLineNum, pSourceFile ); + if( pString ) + sprintf( gubAssertString, pString ); + // Output to debugger + if (gfRecordToDebugger) + { + OutputDebugString( ubOutputString ); + if( pString ) + { //tag on the assert message + OutputDebugString( gubAssertString ); + } + } + // Record to file if required +#ifndef _NO_DEBUG_TXT + if (gfRecordToFile) + { + if ((DebugFile = fopen( gpcDebugLogFileName, "a+t" )) != NULL) + { + fputs( ubOutputString, DebugFile ); + if( pString ) + { //tag on the assert message + fputs( gubAssertString, DebugFile ); + } + fclose( DebugFile ); + } + } +#endif + exit( 0 ); +} + +#endif + +#endif + +// This is NOT a _DEBUG only function! It is also needed in +// release mode builds. -- DB +UINT8 *String(const char *String, ...) +{ + + va_list ArgPtr; + UINT8 usIndex; + + // Record string index. This index is used since we live in a multitasking environment. + // It is still not bulletproof, but it's better than a single string + usIndex = gubStringIndex++; + if (gubStringIndex == 8) + { // reset string pointer + gubStringIndex = 0; + } + + va_start(ArgPtr, String); + vsprintf((char *) gbTmpDebugString[usIndex], String, ArgPtr); + va_end(ArgPtr); + + return gbTmpDebugString[usIndex]; + +} diff --git a/Standard Gaming Platform/DbMan.cpp b/Standard Gaming Platform/DbMan.cpp new file mode 100644 index 00000000..834770a4 --- /dev/null +++ b/Standard Gaming Platform/DbMan.cpp @@ -0,0 +1,1038 @@ +//************************************************************************** +// +// Filename : DbMan.c +// +// Purpose : function definitions for the database manager +// +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +//************************************************************************** +// +// Includes +// +//************************************************************************** + +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "types.h" + #include + #include + #include + #include "windows.h" + #include "FileMan.h" + #include "MemMan.h" + #include "DbMan.h" + #include "Debug.h" +#endif + +//************************************************************************** +// +// Defines +// +//************************************************************************** + +#define FILENAME_LENGTH 600 +#define IM_FILENAME_LENGTH 100 +#define BUCKET_FILENAME_LENGTH 100 +#define INITIAL_NUM_HANDLES 20 +#define NUM_FILES_TO_ADD_AT_A_TIME 20 + +#define CHECKF(exp) if (!(exp)) { return(FALSE); } +#define CHECKV(exp) if (!(exp)) { return; } +#define CHECKN(exp) if (!(exp)) { return(NULL); } +#define CHECKBI(exp) if (!(exp)) { return(-1); } +#define CHECK0(exp) if (!(exp)) { return(0); } + +#define PRINT_DEBUG_INFO FileDebugPrint(); + +#define ExtractFileIndex( exp ) ( (HFILEINDEX)((exp)>>16) ) +#define ExtractDbIndex( exp ) ( (HDBINDEX)((exp)&0x0000FFFF) ) + +//************************************************************************** +// +// Typedefs +// +//************************************************************************** + + +// NOTE: the file format of the index file will be as follows: +// +// UINT32 # - number of entries to follow for filenames starting with '0' +// entry 1 filename +// entry 1 databasename +// entry 2 filename +// entry 2 databasename +// ... +// entry # filename +// entry # databasename +// +// UINT32 # - number of entries to follow for filenames starting with '1' +// entry 1 filename +// entry 1 databasename +// entry 2 filename +// entry 2 databasename +// ... +// entry # filename +// entry # databasename +// +// ... +// +// UINT32 # - number of entries to follow for filenames starting with 'z' +// entry 1 filename +// entry 1 databasename +// entry 2 filename +// entry 2 databasename +// ... +// entry # filename +// entry # databasename +// +// UINT32 #### - offset in file to entries for the letter '0' +// ... +// UINT32 #### - offset in file to entries for the letter '9' +// UINT32 #### - offset in file to entries for the letter 'a' +// ... +// UINT32 #### - offset in file to entries for the letter 'z' +// +// - each set of entries for a letter will comprise a bucket + +typedef struct DbBucketTag +{ + CHAR cFirstLetter; + + CHAR *pstrFilenames; + CHAR *pstrDatabasenames; + UINT32 uiNumNames; +} DbBucket; + +typedef struct DbFileTag +{ + CHAR strFilename[FILENAME_LENGTH]; + INT32 iFileSize; // if 0, this structure is not in use + INT32 iOffsetIntoFile; + INT32 iCurrentPosition; +} DbFile; + +typedef struct DbInfoTag +{ + CHAR strFilename[FILENAME_LENGTH]; + HWFILE hFile; // if 0, this structure is not in use + + DbFile *pOpenFiles; + UINT32 uiNumFiles; +} DbInfo; + +typedef struct DbSystemTag +{ + DbBucket bucket; + CHAR strIndexFilename[FILENAME_LENGTH]; + + DbInfo *pDBFiles; + UINT32 uiNumDBFiles; + + BOOLEAN fDebug; +} DbSystem; + +// this is for reading the database file +typedef struct DbHeaderTag +{ + CHAR strSignature[20]; + INT32 iNumFiles; + INT32 iOffsetToIndex; +} DbHeader; + +// this is for reading the database file +typedef struct IndexMemberTag +{ + CHAR strFilename[IM_FILENAME_LENGTH]; + INT32 iFileSize; + INT32 iOffsetIntoFile; + INT32 time; +} IndexMember; + +//************************************************************************** +// +// Variables +// +//************************************************************************** + +DbSystem gdb; + +//************************************************************************** +// +// Function Prototypes +// +//************************************************************************** + +void DbDebugPrint( void ); +HDBFILE CreateDBFileHandle( HFILEINDEX, HDBINDEX ); +BOOLEAN InitDB( DbInfo *pDBInfo, STR strFilename ); +HDBINDEX OpenDatabaseContainingFile( STR strFilename ); +BOOLEAN InitFile( HWFILE hDBFile, DbFile *pFileInfo, STR strFilename ); +BOOLEAN LoadBucket( CHAR cFirstLetter ); +BOOLEAN GetShortFilename( STR strFilename, STR strPathname ); + +//************************************************************************** +// +// Functions +// +//************************************************************************** + +//************************************************************************** +// +// CreateDBFileHandle +// +// Creates a file handle from two indices. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +HDBFILE CreateDBFileHandle( HFILEINDEX high, HDBINDEX low ) +{ + return( (((LONG)high)<<16)|low ); +} + +//************************************************************************** +// +// DbSystemInit +// +// Starts up the database system. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +BOOLEAN InitializeDatabaseManager( STR strIndexFilename ) +{ + INT32 i; + UINT32 uiSize; + + if ( !FileExistsNoDB( strIndexFilename ) ) + { + return(FALSE); + } + + uiSize = INITIAL_NUM_HANDLES * sizeof(DbInfo); + gdb.fDebug = FALSE; + gdb.pDBFiles = (DbInfo *) MemAlloc( uiSize ); + CHECKF( gdb.pDBFiles ); + + gdb.uiNumDBFiles = INITIAL_NUM_HANDLES; + + for ( i=0 ; i creation +// +//************************************************************************** + +void ShutdownDatabaseManager( void ) +{ + UINT32 i; + + MemFree( gdb.bucket.pstrFilenames ); + MemFree( gdb.bucket.pstrDatabasenames ); + + // close any unclosed files + for ( i=1 ; i creation +// +//************************************************************************** + +void DbDebug( BOOLEAN fFlag ) +{ + gdb.fDebug = fFlag; +} + +//************************************************************************** +// +// DbExists +// +// Checks if a database file exists. +// +// Parameter List : +// +// STR -> name of file to check existence of +// +// Return Value : +// +// BOOLEAN -> TRUE if it exists +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +BOOLEAN DbExists( STR strFilename ) +{ + return( FileExists( strFilename ) ); +} + +//************************************************************************** +// +// DbOpen +// +// Opens a database. +// +// Parameter List : +// +// STR -> filename +// +// Return Value : +// +// HDBINDEX -> handle of opened file +// -> 0 if unsuccessful +// +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +HDBINDEX DbOpen( STR strFilename ) +{ + HDBINDEX hDBIndex; + UINT16 i; + CHAR cShortFilename[FILENAME_LENGTH]; + CHAR cShortDBName[FILENAME_LENGTH]; + BOOLEAN fFound; + + fFound = FALSE; + hDBIndex = 0; + + // first, find any already open databases, and make sure that if we're trying to + // open one that's already open, then we just return an index to it + for ( i=1 ; i handle to database file to close +// +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +void DbClose( HDBINDEX hFile ) +{ + if ( hFile && gdb.pDBFiles[hFile].hFile ) + { + MemFree( gdb.pDBFiles[hFile].pOpenFiles ); + FileClose( gdb.pDBFiles[hFile].hFile ); + gdb.pDBFiles[hFile].hFile = 0; + + DbgMessage( TOPIC_DATABASE_MANAGER, DBG_LEVEL_2, "Closing Database File" ); + } +} + +//************************************************************************** +// +// DbFileOpen +// +// Opens a file in a database. +// +// Parameter List : +// +// STR -> filename +// UIN32 -> access - read or write, or both +// BOOLEAN -> delete on close +// +// Return Value : +// +// HWFILE -> handle of opened file +// +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +HDBFILE DbFileOpen( STR strFilename ) +{ + HDBFILE hFile; + HFILEINDEX hFileIndex; + HDBINDEX hDBIndex; + UINT16 i; + + hDBIndex = OpenDatabaseContainingFile( strFilename ); + if ( !hDBIndex ) + return(0); + + for ( i=1 ; i handle to database file to close +// +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +void DbFileClose( HDBFILE hDBFile ) +{ + HFILEINDEX hFileIndex; + HDBINDEX hDBIndex; + + hFileIndex = ExtractFileIndex( hDBFile ); + hDBIndex = ExtractDbIndex( hDBFile ); + + if ( hDBIndex >= gdb.uiNumDBFiles ) + return; + + if ( gdb.pDBFiles[hDBIndex].pOpenFiles ) + { + if ( hFileIndex >= gdb.pDBFiles[hDBIndex].uiNumFiles ) + return; + + if ( gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize ) + { + gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize = 0; + } + } +} + +//************************************************************************** +// +// DbFileRead +// +// To read a file in a database. +// +// Parameter List : +// +// HWFILE -> handle to file to read from +// void * -> source buffer +// UINT32 -> num bytes to read +// UINT32 -> num bytes read +// +// Return Value : +// +// BOOLEAN -> TRUE if successful +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +BOOLEAN DbFileRead(HDBFILE hDBFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead) +{ + HFILEINDEX hFileIndex; + HDBINDEX hDBIndex; + HWFILE hFile; + UINT32 uiStartPos, uiCurPos, uiBytesRead; + + hFileIndex = ExtractFileIndex( hDBFile ); + hDBIndex = ExtractDbIndex( hDBFile ); + + CHECKF( hDBIndex < gdb.uiNumDBFiles ); + CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles ) + CHECKF( hFileIndex < gdb.pDBFiles[hDBIndex].uiNumFiles ); + CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize ); + + hFile = gdb.pDBFiles[hDBIndex].hFile; + uiStartPos = gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iOffsetIntoFile; + uiCurPos = gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iCurrentPosition; + + CHECKF( hFile ); + + FileSeek( hFile, uiStartPos + uiCurPos, FILE_SEEK_FROM_START ); + FileRead( hFile, pDest, uiBytesToRead, &uiBytesRead ); + + if ( puiBytesRead ) + *puiBytesRead = uiBytesRead; + + gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iCurrentPosition += uiBytesToRead; + + return(TRUE); +} + +//************************************************************************** +// +// DbFileLoad +// +// To open, read, and close a file. +// +// Parameter List : +// +// +// Return Value : +// +// BOOLEAN -> TRUE if successful +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +BOOLEAN DbFileLoad(STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead) +{ + HDBFILE hDBFile; + UINT32 uiBytesRead; + + hDBFile = DbFileOpen( filename ); + CHECKF( hDBFile ); + + DbFileRead( hDBFile, pDest, uiBytesToRead, &uiBytesRead ); + DbFileClose( hDBFile ); + + if ( puiBytesRead ) + *puiBytesRead = uiBytesRead; + + return(TRUE); +} + +//************************************************************************** +// +// DbFileSeek +// +// To seek to a position in a file in a database. +// +// Parameter List : +// +// HWFILE -> handle to file to seek in +// UINT32 -> distance to seek +// UINT8 -> how to seek +// +// Return Value : +// +// BOOLEAN -> TRUE if successful +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +BOOLEAN DbFileSeek( HDBFILE hDBFile, UINT32 uiDistance, UINT8 uiHow ) +{ + HFILEINDEX hFileIndex; + HDBINDEX hDBIndex; + UINT32 uiStartPos, uiCurPos, uiSize; + + hFileIndex = ExtractFileIndex( hDBFile ); + hDBIndex = ExtractDbIndex( hDBFile ); + + CHECKF( hDBIndex < gdb.uiNumDBFiles ); + CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles ) + CHECKF( hFileIndex < gdb.pDBFiles[hDBIndex].uiNumFiles ); + CHECKF( gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize ); + + uiStartPos = gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iOffsetIntoFile; + uiCurPos = gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iCurrentPosition; + uiSize = gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize; + + if ( uiHow == FILE_SEEK_FROM_START ) + uiCurPos = uiDistance; + else if ( uiHow == FILE_SEEK_FROM_END ) + uiCurPos = uiSize - uiDistance; + else if ( uiHow == FILE_SEEK_FROM_CURRENT ) + uiCurPos += uiDistance; + else + return(FALSE); + + return(TRUE); +} + +//************************************************************************** +// +// DbFileGetSize +// +// To get the current position in a file. +// +// Parameter List : +// +// HWFILE -> handle to file +// +// Return Value : +// +// INT32 -> current offset in file if successful +// -> -1 if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +UINT32 DbFileGetPos( HDBFILE hDBFile ) +{ + HFILEINDEX hFileIndex; + HDBINDEX hDBIndex; + + hFileIndex = ExtractFileIndex( hDBFile ); + hDBIndex = ExtractDbIndex( hDBFile ); + + CHECK0( hDBIndex < gdb.uiNumDBFiles ); + CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles ) + CHECK0( hFileIndex < gdb.pDBFiles[hDBIndex].uiNumFiles ); + CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize ); + + return(gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iCurrentPosition); +} + +//************************************************************************** +// +// DbFileGetSize +// +// To get the current file size. +// +// Parameter List : +// +// HWFILE -> handle to file +// +// Return Value : +// +// INT32 -> file size in file if successful +// -> 0 if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +UINT32 DbFileGetSize( HDBFILE hDBFile ) +{ + HFILEINDEX hFileIndex; + HDBINDEX hDBIndex; + + hFileIndex = ExtractFileIndex( hDBFile ); + hDBIndex = ExtractDbIndex( hDBFile ); + + CHECK0( hDBIndex < gdb.uiNumDBFiles ); + CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles ) + CHECK0( hFileIndex < gdb.pDBFiles[hDBIndex].uiNumFiles ); + CHECK0( gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize ); + + return(gdb.pDBFiles[hDBIndex].pOpenFiles[hFileIndex].iFileSize); +} + +//************************************************************************** +// +// DbDebugPrint +// +// To print the debug state to output. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +void DbDebugPrint( void ) +{ +} + +//************************************************************************** +// +// InitDB +// +// To initialize a database info structure. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 15oct96:HJH -> creation +// +//************************************************************************** + +BOOLEAN InitDB( DbInfo *pDBInfo, STR strFilename ) +{ + HWFILE hFile; + INT32 i; + + CHECKF(pDBInfo); + + hFile = FileOpen( strFilename, FILE_ACCESS_READ, FALSE ); + CHECKF( hFile ); + + strcpy( pDBInfo->strFilename, strFilename ); + pDBInfo->hFile = hFile; + pDBInfo->pOpenFiles = (DbFile *) MemAlloc(INITIAL_NUM_HANDLES * sizeof(DbFile)); + + if ( !pDBInfo->pOpenFiles ) + { + FileClose( hFile ); + return(FALSE); + } + + for ( i=0 ; ipOpenFiles[i].iFileSize = 0; + } + pDBInfo->uiNumFiles = INITIAL_NUM_HANDLES; + + return(TRUE); +} + +//************************************************************************** +// +// OpenDatabaseContainingFile +// +// To open, or find the already opened database, containing the given file. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 15oct96:HJH -> creation +// +//************************************************************************** + +HDBINDEX OpenDatabaseContainingFile( STR strFilename ) +{ + CHAR cFirst, cFilename[FILENAME_LENGTH], cCheckname[FILENAME_LENGTH]; + UINT32 i; + HDBINDEX hIndex; + + hIndex = 0; + GetShortFilename( cFilename, strFilename ); + + cFirst = cFilename[0]; + + if ( cFirst != gdb.bucket.cFirstLetter ) + LoadBucket( cFirst ); + + for ( i=0 ; i creation +// +//************************************************************************** + +BOOLEAN InitFile( HWFILE hDBFile, DbFile *pFileInfo, STR strFilename ) +{ + DbHeader header; + IndexMember im; + UINT32 uiBytesRead; + INT32 i; + CHAR cFilename[FILENAME_LENGTH], cShortFilename[FILENAME_LENGTH]; + + CHECKF( pFileInfo ); + CHECKF( strFilename ); + CHECKF( hDBFile ); + + FileSeek( hDBFile, 0, FILE_SEEK_FROM_START ); + FileRead( hDBFile, &header, sizeof(DbHeader), &uiBytesRead ); + CHECKF( uiBytesRead == sizeof(DbHeader) ); + FileSeek( hDBFile, header.iOffsetToIndex, FILE_SEEK_FROM_START ); + + GetShortFilename( cShortFilename, strFilename ); + for ( i=0 ; istrFilename, strFilename ); + pFileInfo->iFileSize = im.iFileSize; + pFileInfo->iOffsetIntoFile = im.iOffsetIntoFile; + pFileInfo->iCurrentPosition = 0; + return(TRUE); + } + } + + return(FALSE); +} + +//************************************************************************** +// +// LoadBucket +// +// To load a bucketfull of file-database name pairs. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 15oct96:HJH -> creation +// +//************************************************************************** + +BOOLEAN LoadBucket( CHAR cFirstLetter ) +{ + HWFILE hFile; + UINT32 i, uiPosition, uiBytesRead, uiNumEntries, uiSize; + CHAR cFilename[FILENAME_LENGTH], cDatabasename[FILENAME_LENGTH]; + + uiNumEntries = 0; + + MemFree( gdb.bucket.pstrFilenames ); + MemFree( gdb.bucket.pstrDatabasenames ); + + hFile = FileOpen( gdb.strIndexFilename, FILE_ACCESS_READ, FALSE ); + CHECKF(hFile); + uiSize = FileGetSize( hFile ); + + if ( cFirstLetter >= 'a' && cFirstLetter <= 'z' ) + uiPosition = 'z' - cFirstLetter + 1; + else + uiPosition = 26 + ('9' - cFirstLetter + 1); + + FileSeek( hFile, sizeof(UINT32)*uiPosition, FILE_SEEK_FROM_END ); + FileRead( hFile, &uiPosition, sizeof(UINT32), &uiBytesRead ); + if ( uiPosition > uiSize ) + { + // error + return(FALSE); + } + + FileSeek( hFile, uiPosition, FILE_SEEK_FROM_START ); + FileRead( hFile, &uiNumEntries, sizeof(UINT32), &uiBytesRead ); + + CHECKF(uiNumEntries); + + gdb.bucket.pstrFilenames = (CHAR *)MemAlloc( uiNumEntries * FILENAME_LENGTH); + CHECKF(gdb.bucket.pstrFilenames); + + gdb.bucket.pstrDatabasenames = (CHAR *)MemAlloc( uiNumEntries * FILENAME_LENGTH); + if ( !gdb.bucket.pstrDatabasenames ) + { + MemFree(gdb.bucket.pstrFilenames); + return(FALSE); + } + + + for ( i=0 ; i creation +// +//************************************************************************** + +BOOLEAN GetShortFilename( STR strFilename, STR strPathname ) +{ + CHAR *pcLast; + + pcLast = strrchr( strPathname, '\\' ); + + if ( pcLast ) + { + pcLast = pcLast + 1; + strcpy( strFilename, pcLast ); + } + else + strcpy( strFilename, strPathname ); + + return(TRUE); +} + diff --git a/Standard Gaming Platform/DbMan.h b/Standard Gaming Platform/DbMan.h new file mode 100644 index 00000000..85b20e43 --- /dev/null +++ b/Standard Gaming Platform/DbMan.h @@ -0,0 +1,87 @@ +//************************************************************************** +// +// Filename : DbMan.h +// +// Purpose : prototypes for the database manager +// +// Modification history : +// +// 08oct96:HJH - Creation +// +//************************************************************************** + +#ifndef _DBMAN_H +#define _DBMAN_H + +//************************************************************************** +// +// Includes +// +//************************************************************************** + +#include "types.h" + +//************************************************************************** +// +// Defines +// +//************************************************************************** + +#ifndef FILE_ACCESS_READ +#define FILE_ACCESS_READ 0x01 +#endif + +#ifndef FILE_ACCESS_WRITE +#define FILE_ACCESS_WRITE 0x02 +#endif + +#define FILE_SEEK_FROM_START 0x01 // keep in sync with fileman.h +#define FILE_SEEK_FROM_END 0x02 // keep in sync with fileman.h +#define FILE_SEEK_FROM_CURRENT 0x04 // keep in sync with fileman.h + +//************************************************************************** +// +// Typedefs +// +//************************************************************************** + +typedef UINT8 BYTE; +typedef UINT32 HDBFILE; +typedef UINT16 HFILEINDEX; +typedef UINT16 HDBINDEX; + +//************************************************************************** +// +// Function Prototypes +// +//************************************************************************** + +#ifdef __cplusplus +extern "C" { +#endif + +extern BOOLEAN InitializeDatabaseManager( STR strIndexFilename ); +extern void ShutdownDatabaseManager( void ); +extern void DbDebug( BOOLEAN f ); + +extern BOOLEAN DbExists( STR filename ); + +extern HDBINDEX DbOpen( STR filename ); +extern void DbClose( HDBINDEX ); + +extern HDBFILE DbFileOpen( STR filename ); +extern void DbFileClose( HDBFILE ); + +extern BOOLEAN DbFileRead( HDBFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); +extern BOOLEAN DbFileLoad( STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); +extern BOOLEAN DbFileSeek( HDBFILE hFile, UINT32 uiDistance, UINT8 uiHow ); + +extern UINT32 DbFileGetPos( HDBFILE hFile ); +extern UINT32 DbFileGetSize( HDBFILE ); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/Standard Gaming Platform/DirectDraw Calls.cpp b/Standard Gaming Platform/DirectDraw Calls.cpp new file mode 100644 index 00000000..90a004ab --- /dev/null +++ b/Standard Gaming Platform/DirectDraw Calls.cpp @@ -0,0 +1,541 @@ +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "DirectX Common.h" + #include "DirectDraw Calls.h" + + #include + #include "debug.h" + #include "video_private.h" +#endif + +// DirectDrawSurface2 Calls +void +DDCreateSurface ( LPDIRECTDRAW2 pExistingDirectDraw, + DDSURFACEDESC *pNewSurfaceDesc, + LPDIRECTDRAWSURFACE *ppNewSurface1, + LPDIRECTDRAWSURFACE2 *ppNewSurface2 ) +{ + Assert ( pExistingDirectDraw != NULL ); + Assert ( pNewSurfaceDesc != NULL ); + Assert ( ppNewSurface1 != NULL ); + Assert ( ppNewSurface2 != NULL ); + + // create the directdraw surface + ATTEMPT ( IDirectDraw2_CreateSurface ( pExistingDirectDraw, + pNewSurfaceDesc, ppNewSurface1, NULL ) ); + + //get the direct draw surface 2 interface + ATTEMPT ( IDirectDrawSurface_QueryInterface ( *ppNewSurface1, /*&*/IID_IDirectDrawSurface2, (LPVOID*) ppNewSurface2 ) ); // (jonathanl) +} + + +// DirectDrawSurface2 Calls +void +DDCreateSurfaceInMemory ( LPDIRECTDRAW2 pExistingDirectDraw, + DDSURFACEDESC *pNewSurfaceDesc, + BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppNewSurface1, + LPDIRECTDRAWSURFACE2 *ppNewSurface2 ) +{ + DDSURFACEDESC DDSurfaceDesc; + BOOLEAN fDestination; + + Assert ( pExistingDirectDraw != NULL ); + Assert ( pNewSurfaceDesc != NULL ); + Assert ( ppNewSurface1 != NULL ); + Assert ( ppNewSurface2 != NULL ); + + // copy to a local so we don't change the input parameter + memcpy ( &DDSurfaceDesc, pNewSurfaceDesc, sizeof ( DDSURFACEDESC ) ); + + // must have caps set since we are adding to the ddsCaps element + DDSurfaceDesc.dwFlags |= DDSD_CAPS; + + // If this is a hardware D3D driver, the Z-Buffer MUST end up in video + // memory. Otherwise, it MUST end up in system memory. + if ( fVideoMemory ) + DDSurfaceDesc.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY; + else + DDSurfaceDesc.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; + + // create the surface + DDCreateSurface ( pExistingDirectDraw, &DDSurfaceDesc, ppNewSurface1, ppNewSurface2 ); + + // get surface information + DDGetSurfaceDescription ( *ppNewSurface2, &DDSurfaceDesc ); + + // was the surface created in video memory? + fDestination = ( DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY ) ? + TRUE : FALSE; + + // did we create the surface in the right memory area? + if ( fDestination != fVideoMemory ) + { + // nope we couldn't do it right so release the newly created surface + // and pass back a NULL pointer to the user + DDReleaseSurface ( ppNewSurface1, ppNewSurface2 ); + } +} + +// Lock, unlock calls +void DDLockSurface ( LPDIRECTDRAWSURFACE2 pSurface, LPRECT pDestRect, LPDDSURFACEDESC pSurfaceDesc, UINT32 uiFlags, HANDLE hEvent ) +{ + HRESULT ReturnCode; + + Assert( pSurface != NULL ); + Assert( pSurfaceDesc != NULL ); + + ZEROMEM ( *pSurfaceDesc ); + pSurfaceDesc->dwSize = sizeof(DDSURFACEDESC); + + do + { + ReturnCode = IDirectDrawSurface2_Lock( pSurface, pDestRect, pSurfaceDesc, uiFlags, hEvent); + + } while( ReturnCode == DDERR_WASSTILLDRAWING ); + + ATTEMPT( ReturnCode ); + +} + +void DDUnlockSurface( LPDIRECTDRAWSURFACE2 pSurface, PTR pSurfaceData ) +{ + Assert( pSurface != NULL ); + + ATTEMPT( IDirectDrawSurface2_Unlock( pSurface, pSurfaceData ) ); + +} + + +void DDGetSurfaceDescription ( LPDIRECTDRAWSURFACE2 pSurface, DDSURFACEDESC *pSurfaceDesc ) +{ + Assert ( pSurface != NULL ); + Assert ( pSurfaceDesc != NULL ); + + ZEROMEM ( *pSurfaceDesc ); + pSurfaceDesc->dwSize = sizeof ( DDSURFACEDESC ); + + ATTEMPT ( IDirectDrawSurface2_GetSurfaceDesc ( pSurface, pSurfaceDesc ) ); +} + +void DDGetSurfaceCaps ( LPDIRECTDRAWSURFACE2 pSurface, DDSCAPS *pSurfaceCaps ) +{ + Assert( pSurface != NULL ); + Assert( pSurfaceCaps != NULL ); + + ATTEMPT( IDirectDrawSurface2_GetCaps( pSurface, pSurfaceCaps ) ); + +} + +void DDCreateRasterSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight, + BOOLEAN fVideoMemory, + LPDIRECTDRAWSURFACE *ppRasterSurface1, + LPDIRECTDRAWSURFACE2 *ppRasterSurface2 ) +{ + DDSURFACEDESC DDSurfaceDesc; + + // validate used portions of the structure + Assert ( pDirectDraw != NULL ); + Assert ( iWidth != 0 ); + Assert ( iHeight != 0 ); + Assert ( ppRasterSurface1 != NULL ); + Assert ( ppRasterSurface2 != NULL ); + + // create the raster surface + ZEROMEM ( DDSurfaceDesc ); + DDSurfaceDesc.dwSize = sizeof ( DDSurfaceDesc ); + DDSurfaceDesc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + DDSurfaceDesc.dwWidth = iWidth; + DDSurfaceDesc.dwHeight = iHeight; + DDSurfaceDesc.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_OFFSCREENPLAIN; + DDCreateSurfaceInMemory ( pDirectDraw, &DDSurfaceDesc, fVideoMemory, ppRasterSurface1, ppRasterSurface2 ); +} + +void DDCreateZBufferSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight, + BOOLEAN fVideoMemory, + LPDIRECTDRAWSURFACE *ppZBufferSurface1, + LPDIRECTDRAWSURFACE2 *ppZBufferSurface2 ) +{ + DDSURFACEDESC DDSurfaceDesc; + + // validate used portions of the structure + Assert ( pDirectDraw != NULL ); + Assert ( iWidth != 0 ); + Assert ( iHeight != 0 ); + Assert ( ppZBufferSurface1 != NULL ); + Assert ( ppZBufferSurface2 != NULL ); + + // create the z buffer + ZEROMEM ( DDSurfaceDesc ); + DDSurfaceDesc.dwSize = sizeof ( DDSurfaceDesc ); + DDSurfaceDesc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_ZBUFFERBITDEPTH; + DDSurfaceDesc.dwWidth = iWidth; + DDSurfaceDesc.dwHeight = iHeight; + DDSurfaceDesc.dwZBufferBitDepth = 16; + DDSurfaceDesc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; + DDCreateSurfaceInMemory ( pDirectDraw, &DDSurfaceDesc, fVideoMemory, ppZBufferSurface1, ppZBufferSurface2 ); +} + +void +DDAddAttachedSurface ( LPDIRECTDRAWSURFACE2 pParentSurface, + LPDIRECTDRAWSURFACE2 pAddChildSurface ) +{ + Assert ( pParentSurface != NULL ); + Assert ( pAddChildSurface != NULL ); + + // attach the child to the parent surface + ATTEMPT ( IDirectDrawSurface2_AddAttachedSurface ( pParentSurface, + pAddChildSurface ) ); +} + +void +DDDeleteAttachedSurface ( LPDIRECTDRAWSURFACE2 pParentSurface, + LPDIRECTDRAWSURFACE2 pDeleteChildSurface ) +{ + Assert ( pParentSurface != NULL ); + Assert ( pDeleteChildSurface != NULL ); + + // seperate the z buffer surface from the raster surface + ATTEMPT ( IDirectDrawSurface2_DeleteAttachedSurface ( pParentSurface, + 0, pDeleteChildSurface ) ); +} + +void +DDReleaseSurface ( LPDIRECTDRAWSURFACE *ppOldSurface1, LPDIRECTDRAWSURFACE2 *ppOldSurface2 ) +{ + Assert ( ppOldSurface1 != NULL ); + Assert ( ppOldSurface2 != NULL ); + Assert ( *ppOldSurface1 != NULL ); + Assert ( *ppOldSurface2 != NULL ); + + ATTEMPT ( IDirectDrawSurface2_Release ( *ppOldSurface2 ) ); + ATTEMPT ( IDirectDrawSurface_Release ( *ppOldSurface1 ) ); + + *ppOldSurface1 = NULL; + *ppOldSurface2 = NULL; +} + +void DDRestoreSurface( LPDIRECTDRAWSURFACE2 pSurface ) +{ + Assert( pSurface != NULL ); + + ATTEMPT( IDirectDrawSurface2_Restore( pSurface ) ); +} + + +void DDBltFastSurface( LPDIRECTDRAWSURFACE2 pDestSurface, UINT32 uiX, UINT32 uiY, LPDIRECTDRAWSURFACE2 pSrcSurface, + LPRECT pSrcRect, UINT32 uiTrans) +{ + HRESULT ReturnCode; + + Assert( pDestSurface != NULL ); + Assert( pSrcSurface != NULL ); + + do + { + ReturnCode = IDirectDrawSurface2_SGPBltFast( pDestSurface, uiX, uiY, pSrcSurface, pSrcRect, uiTrans ); + + } while( ReturnCode == DDERR_WASSTILLDRAWING ); +} + + +void DDBltSurface( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface, + LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx ) +{ + + HRESULT ReturnCode; + + Assert( pDestSurface != NULL ); + + do + { + ReturnCode = IDirectDrawSurface2_SGPBlt( pDestSurface, pDestRect, pSrcSurface, pSrcRect, uiFlags, pDDBltFx ); + + } while( ReturnCode == DDERR_WASSTILLDRAWING ); + + ATTEMPT( ReturnCode ); +} + + +void DDCreatePalette( LPDIRECTDRAW2 pDirectDraw, UINT32 uiFlags, LPPALETTEENTRY pColorTable, LPDIRECTDRAWPALETTE FAR *ppDDPalette, + IUnknown FAR * pUnkOuter) +{ + + Assert( pDirectDraw != NULL ); + + ATTEMPT( IDirectDraw2_CreatePalette( pDirectDraw, uiFlags, pColorTable, ppDDPalette, pUnkOuter ) ); + +} + +void DDSetSurfacePalette( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAWPALETTE pDDPalette ) +{ + Assert( pDDPalette != NULL ); + Assert( pSurface != NULL ); + + ATTEMPT( IDirectDrawSurface2_SetPalette( pSurface, pDDPalette ) ); + +} + +void DDGetSurfacePalette( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAWPALETTE *ppDDPalette ) +{ + Assert( ppDDPalette != NULL ); + Assert( pSurface != NULL ); + + ATTEMPT( IDirectDrawSurface2_GetPalette( pSurface, ppDDPalette ) ); + +} + +void DDSetPaletteEntries( LPDIRECTDRAWPALETTE pPalette, UINT32 uiFlags, UINT32 uiStartingEntry, + UINT32 uiCount, LPPALETTEENTRY pEntries ) +{ + Assert( pPalette != NULL ); + Assert( pEntries != NULL ); + + ATTEMPT( IDirectDrawPalette_SetEntries( pPalette, uiFlags, uiStartingEntry, uiCount, pEntries ) ); + +} + +void DDGetPaletteEntries( LPDIRECTDRAWPALETTE pPalette, UINT32 uiFlags, UINT32 uiBase, + UINT32 uiNumEntries, LPPALETTEENTRY pEntries ) +{ + Assert( pPalette != NULL ); + Assert( pEntries != NULL ); + + ATTEMPT( IDirectDrawPalette_GetEntries( pPalette, uiFlags, uiBase, uiNumEntries, pEntries ) ); + +} + +void DDReleasePalette( LPDIRECTDRAWPALETTE pPalette ) +{ + Assert( pPalette != NULL ); + + ATTEMPT( IDirectDrawPalette_Release( pPalette ) ); +} + +void DDGetDC( LPDIRECTDRAWSURFACE2 pSurface, HDC *phDC ) +{ + + Assert( pSurface != NULL ); + Assert( phDC != NULL ); + + ATTEMPT( IDirectDrawSurface2_GetDC( pSurface, phDC ) ); + +} + +void DDReleaseDC( LPDIRECTDRAWSURFACE2 pSurface, HDC hDC ) +{ + + Assert( pSurface != NULL ); + + ATTEMPT( IDirectDrawSurface2_ReleaseDC( pSurface, hDC ) ); + +} + +void DDSetSurfaceColorKey( LPDIRECTDRAWSURFACE2 pSurface, UINT32 uiFlags, LPDDCOLORKEY pDDColorKey ) +{ + Assert( pSurface != NULL ); + Assert( pDDColorKey != NULL ); + + ATTEMPT( IDirectDrawSurface2_SetColorKey( pSurface, uiFlags, pDDColorKey ) ); + +} + +void DDGetDDInterface( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAW *ppDirectDraw ) +{ + Assert( pSurface != NULL ); + Assert( ppDirectDraw != NULL ); + + ATTEMPT( IDirectDrawSurface2_GetDDInterface( pSurface, (LPVOID *)ppDirectDraw ) ); +} + +// Clipper FUnctions +void DDCreateClipper( LPDIRECTDRAW2 pDirectDraw, UINT32 fFlags, LPDIRECTDRAWCLIPPER *pDDClipper ) +{ + Assert( pDirectDraw != NULL ); + Assert( pDDClipper != NULL ); + + ATTEMPT( IDirectDraw2_CreateClipper( pDirectDraw, 0, pDDClipper, NULL ) ); + +} + +void DDSetClipper( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAWCLIPPER pDDClipper ) +{ + Assert( pSurface != NULL ); + Assert( pDDClipper != NULL ); + + ATTEMPT( IDirectDrawSurface2_SetClipper( pSurface, pDDClipper ) ); + +} + +void DDReleaseClipper( LPDIRECTDRAWCLIPPER pDDClipper ) +{ + Assert( pDDClipper != NULL ); + + ATTEMPT( IDirectDrawClipper_Release( pDDClipper ) ); +} + +void DDSetClipperList( LPDIRECTDRAWCLIPPER pDDClipper, LPRGNDATA pClipList, UINT32 uiFlags) +{ + Assert( pDDClipper != NULL ); + Assert( pClipList != NULL ); + + ATTEMPT( IDirectDrawClipper_SetClipList( pDDClipper, pClipList, uiFlags ) ); +} + + + +HRESULT BltFastDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, INT32 uiX, INT32 uiY, LPDIRECTDRAWSURFACE2 pSrcSurface, LPRECT pSrcRect, UINT32 uiTrans ) +{ + DDSURFACEDESC SurfaceDescription; + UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; + UINT8 *pDestBuf, *pSrcBuf; + HRESULT ReturnCode; + DDCOLORKEY ColorKey; + UINT16 us16BPPColorKey; + + + // Lock surfaces + DDLockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL, &SurfaceDescription, 0, NULL); + uiDestPitchBYTES = SurfaceDescription.lPitch; + pDestBuf = (UINT8 *) SurfaceDescription.lpSurface; + + + // Lock surfaces + DDLockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL, &SurfaceDescription, 0, NULL); + uiSrcPitchBYTES = SurfaceDescription.lPitch; + pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface; + + if ( uiTrans == DDBLTFAST_NOCOLORKEY ) + { + Blt16BPPTo16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + uiX , uiY, + pSrcRect->left , pSrcRect->top, + ( pSrcRect->right - pSrcRect->left ), + ( pSrcRect->bottom - pSrcRect->top ) ); + } + else if ( uiTrans == DDBLTFAST_SRCCOLORKEY ) + { + // Get 16 bpp color key..... + ReturnCode = IDirectDrawSurface2_GetColorKey( pSrcSurface, DDCKEY_SRCBLT, &ColorKey); + + if (ReturnCode == DD_OK) + { + us16BPPColorKey = (UINT16)ColorKey.dwColorSpaceLowValue; + + Blt16BPPTo16BPPTrans( (UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + uiX , uiY, + pSrcRect->left , pSrcRect->top, + ( pSrcRect->right - pSrcRect->left ), + ( pSrcRect->bottom - pSrcRect->top ), us16BPPColorKey ); + + } + } + else + { + // Not supported..... + } + + + DDUnlockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL ); + DDUnlockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL ); + + return( DD_OK ); +} + + +HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface, LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx ) +{ + DDSURFACEDESC SurfaceDescription; + UINT32 uiDestPitchBYTES, uiSrcPitchBYTES; + UINT8 *pDestBuf, *pSrcBuf; + HRESULT ReturnCode; + DDCOLORKEY ColorKey; + UINT16 us16BPPColorKey; + + + // Lock surfaces + DDLockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL, &SurfaceDescription, 0, NULL); + uiDestPitchBYTES = SurfaceDescription.lPitch; + pDestBuf = (UINT8 *) SurfaceDescription.lpSurface; + + + if ( pSrcSurface != NULL ) + { + // Lock surfaces + DDLockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL, &SurfaceDescription, 0, NULL); + uiSrcPitchBYTES = SurfaceDescription.lPitch; + pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface; + } + + if ( pSrcRect != NULL && + ( ( pSrcRect->right - pSrcRect->left ) != ( pDestRect->right - pDestRect->left ) || + ( pSrcRect->bottom - pSrcRect->top ) != ( pDestRect->bottom - pDestRect->top ) ) ) + { + DDUnlockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL ); + + if ( pSrcSurface != NULL ) + { + DDUnlockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL ); + } + + // Fall back to DD + IDirectDrawSurface2_Blt( pDestSurface, pDestRect, pSrcSurface, pSrcRect, uiFlags, pDDBltFx ); + + return( DD_OK ); + } + else if ( uiFlags == DDBLT_WAIT ) + { + // Lock surfaces + DDLockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL, &SurfaceDescription, 0, NULL); + uiSrcPitchBYTES = SurfaceDescription.lPitch; + pSrcBuf = (UINT8 *) SurfaceDescription.lpSurface; + + Blt16BPPTo16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + pDestRect->left , pDestRect->top, + pSrcRect->left , pSrcRect->top, + ( pSrcRect->right - pSrcRect->left ), + ( pSrcRect->bottom - pSrcRect->top ) ); + } + else if ( uiFlags & DDBLT_KEYSRC ) + { + // Get 16 bpp color key..... + ReturnCode = IDirectDrawSurface2_GetColorKey( pSrcSurface, DDCKEY_SRCBLT, &ColorKey); + + if (ReturnCode == DD_OK) + { + us16BPPColorKey = (UINT16)ColorKey.dwColorSpaceLowValue; + + Blt16BPPTo16BPPTrans( (UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + pDestRect->left , pDestRect->top, + pSrcRect->left , pSrcRect->top, + ( pSrcRect->right - pSrcRect->left ), + ( pSrcRect->bottom - pSrcRect->top ), us16BPPColorKey ); + + } + } + else if ( uiFlags & DDBLT_COLORFILL ) + { + // do color fill here... + FillRect16BPP( (UINT16 *)pDestBuf, uiDestPitchBYTES, pDestRect->left, pDestRect->top, pDestRect->right, pDestRect->bottom, (UINT16)pDDBltFx->dwFillColor ); + } + else + { + // Not supported..... + } + + + DDUnlockSurface( (LPDIRECTDRAWSURFACE2)pDestSurface, NULL ); + + if ( pSrcSurface != NULL ) + { + DDUnlockSurface( (LPDIRECTDRAWSURFACE2)pSrcSurface, NULL ); + } + + return( DD_OK ); +} diff --git a/Standard Gaming Platform/DirectDraw Calls.h b/Standard Gaming Platform/DirectDraw Calls.h new file mode 100644 index 00000000..3e653cef --- /dev/null +++ b/Standard Gaming Platform/DirectDraw Calls.h @@ -0,0 +1,97 @@ +#ifndef __DirectDraw_Calls_H__ +#define __DirectDraw_Calls_H__ + +#include "DirectX Common.h" +#include + +// Direct Draw Functions + +#ifdef __cplusplus +extern "C" { +#endif + +// Surface Functions + +void DDCreateSurface ( LPDIRECTDRAW2 pExistingDirectDraw, + DDSURFACEDESC *pNewSurfaceDesc, LPDIRECTDRAWSURFACE *ppNewSurface1, LPDIRECTDRAWSURFACE2 *ppNewSurface2 ); +void DDCreateSurfaceInMemory ( LPDIRECTDRAW2 pExistingDirectDraw, + DDSURFACEDESC *pNewSurfaceDesc, + BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppNewSurface1, + LPDIRECTDRAWSURFACE2 *ppNewSurface2 ); +void DDCreateZBufferSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight, + BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppZBufferSurface1, + LPDIRECTDRAWSURFACE2 *ppZBufferSurface2 ); +void DDCreateRasterSurface ( LPDIRECTDRAW2 pDirectDraw, INT32 iWidth, INT32 iHeight, + BOOLEAN fVideoMemory, LPDIRECTDRAWSURFACE *ppRasterSurface1, + LPDIRECTDRAWSURFACE2 *ppRasterSurface2 ); +void DDGetSurfaceDescription ( LPDIRECTDRAWSURFACE2 pSurface, DDSURFACEDESC *pSurfaceDesc ); +void DDGetSurfaceCaps ( LPDIRECTDRAWSURFACE2 pSurface, DDSCAPS *pSurfaceCaps ); +void DDAddAttachedSurface ( LPDIRECTDRAWSURFACE2 pParentSurface, + LPDIRECTDRAWSURFACE2 pAddChildSurface ); +void DDDeleteAttachedSurface ( LPDIRECTDRAWSURFACE2 pParentSurface, + LPDIRECTDRAWSURFACE2 pDeleteChildSurface ); +void DDReleaseSurface ( LPDIRECTDRAWSURFACE *ppOldSurface1, LPDIRECTDRAWSURFACE2 *ppOldSurface2 ); + +void DDGetDDInterface( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAW *ppDirectDraw ); + + +void DDLockSurface( LPDIRECTDRAWSURFACE2 pSurface, LPRECT pDestRect, LPDDSURFACEDESC pSurfaceDesc, + UINT32 uiFlags, HANDLE hEvent); + +void DDUnlockSurface( LPDIRECTDRAWSURFACE2 pSurface, PTR pSurfaceData ); + +void DDRestoreSurface( LPDIRECTDRAWSURFACE2 pSurface ); + +void DDBltFastSurface( LPDIRECTDRAWSURFACE2 pDestSurface, UINT32 uiX, UINT32 uiY, LPDIRECTDRAWSURFACE2 pSrcSurface, + LPRECT pSrcRect, UINT32 uiTrans); + +void DDBltSurface( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface, + LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx ); + +void DDSetSurfacePalette( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAWPALETTE pDDPalette ); + +void DDGetSurfacePalette( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAWPALETTE *ppDDPalette ); + +void DDGetDC( LPDIRECTDRAWSURFACE2 pSurface, HDC *phDC ); + +void DDReleaseDC( LPDIRECTDRAWSURFACE2 pSurface, HDC hDC ); + +void DDSetSurfaceColorKey( LPDIRECTDRAWSURFACE2 pSurface, UINT32 uiFlags, LPDDCOLORKEY pDDColorKey ); + + +// Palette Functions + +void DDCreatePalette( LPDIRECTDRAW2 pDirectDraw, UINT32 uiFlags, LPPALETTEENTRY pColorTable, LPDIRECTDRAWPALETTE FAR *ppDDPalette, + IUnknown FAR * pUnkOuter); + + +void DDSetPaletteEntries( LPDIRECTDRAWPALETTE pPalette, UINT32 uiFlags, UINT32 uiStartingEntry, + UINT32 uiCount, LPPALETTEENTRY pEntries ); + +void DDReleasePalette( LPDIRECTDRAWPALETTE pPalette ); + + +void DDGetPaletteEntries( LPDIRECTDRAWPALETTE pPalette, UINT32 uiFlags, UINT32 uiBase, + UINT32 uiNumEntries, LPPALETTEENTRY pEntries ); + + +// Clipper functions +void DDCreateClipper( LPDIRECTDRAW2 pDirectDraw, UINT32 fFlags, LPDIRECTDRAWCLIPPER *pDDClipper ); +void DDSetClipper( LPDIRECTDRAWSURFACE2 pSurface, LPDIRECTDRAWCLIPPER pDDClipper ); +void DDReleaseClipper( LPDIRECTDRAWCLIPPER pDDClipper ); +void DDSetClipperList( LPDIRECTDRAWCLIPPER pDDClipper, LPRGNDATA pClipList, UINT32 uiFlags); + +HRESULT BltFastDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, INT32 uiX, INT32 uiY, LPDIRECTDRAWSURFACE2 pSrcSurface, LPRECT pSrcRect, UINT32 uiTrans ); +HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDestRect, LPDIRECTDRAWSURFACE2 pSrcSurface, LPRECT pSrcRect, UINT32 uiFlags, LPDDBLTFX pDDBltFx ); + + +#define IDirectDrawSurface2_SGPBltFast(p,a,b,c,d,e) ( ( gfDontUseDDBlits == TRUE ) ? BltFastDDSurfaceUsingSoftware( p, a, b, c, d, e ) : ( IDirectDrawSurface2_BltFast(p,a,b,c,d,e) ) ) +#define IDirectDrawSurface2_SGPBlt(p,a,b,c,d,e) ( ( gfDontUseDDBlits == TRUE ) ? BltDDSurfaceUsingSoftware( p, a, b, c, d, e ) : ( IDirectDrawSurface2_Blt(p,a,b,c,d,e) ) ) + + +#ifdef __cplusplus +} +#endif + + +#endif // __DirectDraw_Calls_H__ \ No newline at end of file diff --git a/Standard Gaming Platform/DirectX Common.cpp b/Standard Gaming Platform/DirectX Common.cpp new file mode 100644 index 00000000..a7eb6d67 --- /dev/null +++ b/Standard Gaming Platform/DirectX Common.cpp @@ -0,0 +1,244 @@ +#include "types.h" +#include +#include + +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "types.h" + #include + #include "DirectX Common.h" + #include + #include "debug.h" +#endif + +void DirectXZeroMem ( void* pMemory, int nSize ) +{ + memset ( pMemory, 0, nSize ); +} + + +void DirectXAttempt ( INT32 iErrorCode, INT32 nLine, char *szFilename ) +{ +#ifdef _DEBUG + if ( iErrorCode != DD_OK ) + { + FastDebugMsg("DIRECTX COMMON: DirectX Error\n" ); + FastDebugMsg(DirectXErrorDescription(iErrorCode)); + } +#endif +} + +char* DirectXErrorDescription ( INT32 iDXReturn ) +{ + switch( iDXReturn ) + { + case DD_OK + : return "No error.\0"; + case DDERR_ALREADYINITIALIZED + : return "The object has already been initialized."; + case DDERR_BLTFASTCANTCLIP + : return "A DirectDrawClipper object is attached to a source surface that has passed into a call to the IDirectDrawSurface2::BltFast method."; + case DDERR_CANNOTATTACHSURFACE + : return "A surface cannot be attached to another requested surface."; + case DDERR_CANNOTDETACHSURFACE + : return "A surface cannot be detached from another requested surface."; + case DDERR_CANTCREATEDC + : return "Windows cannot create any more device contexts (DCs)."; + case DDERR_CANTDUPLICATE + : return "Primary and 3D surfaces, or surfaces that are implicitly created, cannot be duplicated."; + case DDERR_CANTLOCKSURFACE + : return "Access to this surface is refused because an attempt was made to lock the primary surface without DCI support."; + case DDERR_CANTPAGELOCK + : return "An attempt to page lock a surface failed. Page lock will not work on a display-memory surface or an emulated primary surface."; + case DDERR_CANTPAGEUNLOCK + : return "An attempt to page unlock a surface failed. Page unlock will not work on a display-memory surface or an emulated primary surface."; + case DDERR_CLIPPERISUSINGHWND + : return "An attempt was made to set a clip list for a DirectDrawClipper object that is already monitoring a window handle."; + case DDERR_COLORKEYNOTSET + : return "No source color key is specified for this operation."; + case DDERR_CURRENTLYNOTAVAIL + : return "No support is currently available."; + case DDERR_DCALREADYCREATED + : return "A device context (DC) has already been returned for this surface. Only one DC can be retrieved for each surface."; + case DDERR_DIRECTDRAWALREADYCREATED + : return "A DirectDraw object representing this driver has already been created for this process."; + case DDERR_EXCEPTION + : return "An exception was encountered while performing the requested operation."; + case DDERR_EXCLUSIVEMODEALREADYSET + : return "An attempt was made to set the cooperative level when it was already set to exclusive."; + case DDERR_GENERIC + : return "There is an undefined error condition."; + case DDERR_HEIGHTALIGN + : return "The height of the provided rectangle is not a multiple of the required alignment."; + case DDERR_HWNDALREADYSET + : return "The DirectDraw cooperative level window handle has already been set. It cannot be reset while the process has surfaces or palettes created."; + case DDERR_HWNDSUBCLASSED + : return "DirectDraw is prevented from restoring state because the DirectDraw cooperative level window handle has been subclassed."; + case DDERR_IMPLICITLYCREATED + : return "The surface cannot be restored because it is an implicitly created surface."; + case DDERR_INCOMPATIBLEPRIMARY + : return "The primary surface creation request does not match with the existing primary surface."; + case DDERR_INVALIDCAPS + : return "One or more of the capability bits passed to the callback function are incorrect."; + case DDERR_INVALIDCLIPLIST + : return "DirectDraw does not support the provided clip list."; + case DDERR_INVALIDDIRECTDRAWGUID + : return "The globally unique identifier (GUID) passed to the DirectDrawCreate function is not a valid DirectDraw driver identifier."; + case DDERR_INVALIDMODE + : return "DirectDraw does not support the requested mode."; + case DDERR_INVALIDOBJECT + : return "DirectDraw received a pointer that was an invalid DirectDraw object."; + case DDERR_INVALIDPARAMS + : return "One or more of the parameters passed to the method are incorrect."; + case DDERR_INVALIDPIXELFORMAT + : return "The pixel format was invalid as specified."; + case DDERR_INVALIDPOSITION + : return "The position of the overlay on the destination is no longer legal."; + case DDERR_INVALIDRECT + : return "The provided rectangle was invalid."; + case DDERR_INVALIDSURFACETYPE + : return "The requested operation could not be performed because the surface was of the wrong type."; + case DDERR_LOCKEDSURFACES + : return "One or more surfaces are locked, causing the failure of the requested operation."; + case DDERR_NO3D + : return "No 3D hardware or emulation is present."; + case DDERR_NOALPHAHW + : return "No alpha acceleration hardware is present or available, causing the failure of the requested operation."; + case DDERR_NOBLTHW + : return "No blitter hardware is present."; + case DDERR_NOCLIPLIST + : return "No clip list is available."; + case DDERR_NOCLIPPERATTACHED + : return "No DirectDrawClipper object is attached to the surface object."; + case DDERR_NOCOLORCONVHW + : return "The operation cannot be carried out because no color-conversion hardware is present or available."; + case DDERR_NOCOLORKEY + : return "The surface does not currently have a color key."; + case DDERR_NOCOLORKEYHW + : return "The operation cannot be carried out because there is no hardware support for the destination color key."; + case DDERR_NOCOOPERATIVELEVELSET + : return "A create function is called without the IDirectDraw2::SetCooperativeLevel method being called."; + case DDERR_NODC + : return "No DC has ever been created for this surface."; + case DDERR_NODDROPSHW + : return "No DirectDraw raster operation (ROP) hardware is available."; + case DDERR_NODIRECTDRAWHW + : return "Hardware-only DirectDraw object creation is not possible; the driver does not support any hardware."; + case DDERR_NODIRECTDRAWSUPPORT + : return "DirectDraw support is not possible with the current display driver."; + case DDERR_NOEMULATION + : return "Software emulation is not available."; + case DDERR_NOEXCLUSIVEMODE + : return "The operation requires the application to have exclusive mode, but the application does not have exclusive mode."; + case DDERR_NOFLIPHW + : return "Flipping visible surfaces is not supported."; + case DDERR_NOGDI + : return "No GDI is present."; + case DDERR_NOHWND + : return "Clipper notification requires a window handle, or no window handle has been previously set as the cooperative level window handle."; + case DDERR_NOMIPMAPHW + : return "The operation cannot be carried out because no mipmap texture mapping hardware is present or available."; + case DDERR_NOMIRRORHW + : return "The operation cannot be carried out because no mirroring hardware is present or available."; + case DDERR_NOOVERLAYDEST + : return "The IDirectDrawSurface2::GetOverlayPosition method is called on an overlay that the IDirectDrawSurface2::UpdateOverlay method has not been called on to establish a destination."; + case DDERR_NOOVERLAYHW + : return "The operation cannot be carried out because no overlay hardware is present or available."; + case DDERR_NOPALETTEATTACHED + : return "No palette object is attached to this surface."; + case DDERR_NOPALETTEHW + : return "There is no hardware support for 16- or 256-color palettes."; + case DDERR_NORASTEROPHW + : return "The operation cannot be carried out because no appropriate raster operation hardware is present or available."; + case DDERR_NOROTATIONHW + : return "The operation cannot be carried out because no rotation hardware is present or available."; + case DDERR_NOSTRETCHHW + : return "The operation cannot be carried out because there is no hardware support for stretching."; + case DDERR_NOT4BITCOLOR + : return "The DirectDrawSurface object is not using a 4-bit color palette and the requested operation requires a 4-bit color palette."; + case DDERR_NOT4BITCOLORINDEX + : return "The DirectDrawSurface object is not using a 4-bit color index palette and the requested operation requires a 4-bit color index palette."; + case DDERR_NOT8BITCOLOR + : return "The DirectDrawSurface object is not using an 8-bit color palette and the requested operation requires an 8-bit color palette."; + case DDERR_NOTAOVERLAYSURFACE + : return "An overlay component is called for a non-overlay surface."; + case DDERR_NOTEXTUREHW + : return "The operation cannot be carried out because no texture-mapping hardware is present or available."; + case DDERR_NOTFLIPPABLE + : return "An attempt has been made to flip a surface that cannot be flipped."; + case DDERR_NOTFOUND + : return "The requested item was not found."; + case DDERR_NOTINITIALIZED + : return "An attempt was made to call an interface method of a DirectDraw object created by CoCreateInstance before the object was initialized."; + case DDERR_NOTLOCKED + : return "An attempt is made to unlock a surface that was not locked."; + case DDERR_NOTPAGELOCKED + : return "An attempt is made to page unlock a surface with no outstanding page locks."; + case DDERR_NOTPALETTIZED + : return "The surface being used is not a palette-based surface."; + case DDERR_NOVSYNCHW + : return "The operation cannot be carried out because there is no hardware support for vertical blank synchronized operations."; + case DDERR_NOZBUFFERHW + : return "The operation to create a z-buffer in display memory or to perform a blit using a z-buffer cannot be carried out because there is no hardware support for z-buffers."; + case DDERR_NOZOVERLAYHW + : return "The overlay surfaces cannot be z-layered based on the z-order because the hardware does not support z-ordering of overlays."; + case DDERR_OUTOFCAPS + : return "The hardware needed for the requested operation has already been allocated."; + case DDERR_OUTOFMEMORY + : return "DirectDraw does not have enough memory to perform the operation."; + case DDERR_OUTOFVIDEOMEMORY + : return "DirectDraw does not have enough display memory to perform the operation."; + case DDERR_OVERLAYCANTCLIP + : return "The hardware does not support clipped overlays."; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE + : return "An attempt was made to have more than one color key active on an overlay."; + case DDERR_OVERLAYNOTVISIBLE + : return "The IDirectDrawSurface2::GetOverlayPosition method is called on a hidden overlay."; + case DDERR_PALETTEBUSY + : return "Access to this palette is refused because the palette is locked by another thread."; + case DDERR_PRIMARYSURFACEALREADYEXISTS + : return "This process has already created a primary surface."; + case DDERR_REGIONTOOSMALL + : return "The region passed to the IDirectDrawClipper::GetClipList method is too small."; + case DDERR_SURFACEALREADYATTACHED + : return "An attempt was made to attach a surface to another surface to which it is already attached."; + case DDERR_SURFACEALREADYDEPENDENT + : return "An attempt was made to make a surface a dependency of another surface to which it is already dependent."; + case DDERR_SURFACEBUSY + : return "Access to the surface is refused because the surface is locked by another thread."; + case DDERR_SURFACEISOBSCURED + : return "Access to the surface is refused because the surface is obscured."; + case DDERR_SURFACELOST + : return "Access to the surface is refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have the IDirectDrawSurface2::Restore method called on it."; + case DDERR_SURFACENOTATTACHED + : return "The requested surface is not attached."; + case DDERR_TOOBIGHEIGHT + : return "The height requested by DirectDraw is too large."; + case DDERR_TOOBIGSIZE + : return "The size requested by DirectDraw is too large. However, the individual height and width are OK."; + case DDERR_TOOBIGWIDTH + : return "The width requested by DirectDraw is too large."; + case DDERR_UNSUPPORTED + : return "The operation is not supported."; + case DDERR_UNSUPPORTEDFORMAT + : return "The FourCC format requested is not supported by DirectDraw."; + case DDERR_UNSUPPORTEDMASK + : return "The bitmask in the pixel format requested is not supported by DirectDraw."; + case DDERR_UNSUPPORTEDMODE + : return "The display is currently in an unsupported mode."; + case DDERR_VERTICALBLANKINPROGRESS + : return "A vertical blank is in progress."; + case DDERR_WASSTILLDRAWING + : return "The previous blit operation that is transferring information to or from this surface is incomplete."; + case DDERR_WRONGMODE + : return "This surface cannot be restored because it was created in a different mode."; + case DDERR_XALIGN + : return "The provided rectangle was not horizontally aligned on a required boundary."; + default + : return "Unrecognized error value.\0"; + } +} + diff --git a/Standard Gaming Platform/DirectX Common.h b/Standard Gaming Platform/DirectX Common.h new file mode 100644 index 00000000..9aee08d8 --- /dev/null +++ b/Standard Gaming Platform/DirectX Common.h @@ -0,0 +1,29 @@ +#ifndef __DirectX_Common_H__ +#define __DirectX_Common_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + // local functions + char* DirectXErrorDescription ( INT32 iDXReturn ); + void DirectXAttempt ( INT32 iErrorCode, INT32 nLine, char *szFilename ); + void DirectXAssert ( BOOLEAN fValue, INT32 nLine, char *szFilename ); + void DirectXZeroMem ( void* pMemory, int nSize ); + + #undef ATTEMPT + #define ATTEMPT(x) DirectXAttempt ((x),__LINE__,__FILE__) + + #undef ZEROMEM + #define ZEROMEM(x) DirectXZeroMem ( (void*)&(x), sizeof(x) ) + + #undef DEBUGMSG + #define DEBUGMSG(x) OutputDebugString(x) + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/Standard Gaming Platform/English.cpp b/Standard Gaming Platform/English.cpp new file mode 100644 index 00000000..8350be57 --- /dev/null +++ b/Standard Gaming Platform/English.cpp @@ -0,0 +1,1040 @@ +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "english.h" +#endif + +// The gsKeyTranslationTable is used to return KEY values on the basis of the virtual key code and +// SHIFT/ALT/CTRL key states. Range 0-255 is for normal keys, 256-511 is when SHIFT is pressed +// 512-767 is when ALT is pressed and 768-1023 is when CTRL is pressed. This table should be modified +// during translation + +UINT16 gsKeyTranslationTable[1024] = +{ + 0, // + 1, // + 2, // + 3, // + 4, // + 5, // + 6, // + 7, // + 8, // BACK + 9, // TAB + 10, // + 11, // + 12, // + 13, // ENTER + 14, // + 15, // + 16, // SHIFT + 17, // CTRL + 18, // ALT + 19, // PAUSE + 20, // CAPS + 21, // + 22, // + 23, // + 24, // + 25, // + 26, // + 27, // ESC + 28, // + 29, // + 30, // + 31, // + 32, // SPACE + 33, // + 34, // + 35, // + 36, // + 37, // + 38, // + 39, // + 40, // + 41, // + 42, // + 43, // + 44, // + 45, // + 46, // + 47, // + 48, // 0 + 49, // 1 + 50, // 2 + 51, // 3 + 52, // 4 + 53, // 5 + 54, // 6 + 55, // 7 + 56, // 8 + 57, // 9 + 58, // + 59, // + 60, // + 61, // + 62, // + 63, // + 64, // + 97, // a + 98, // b + 99, // c + 100, // d + 101, // e + 102, // f + 103, // g + 104, // h + 105, // i + 106, // j + 107, // k + 108, // l + 109, // m + 110, // n + 111, // o + 112, // p + 113, // q + 114, // r + 115, // s + 116, // t + 117, // u + 118, // v + 119, // w + 120, // x + 121, // y + 122, // z + 91, // + 92, // + 93, // + 94, // + 95, // + 96, // + 97, // + 98, // + 99, // + 100, // + 101, // + 102, // + 103, // + 104, // + 105, // + 42, // NUM_TIMES + 43, // NUM_PLUS + 108, // + 45, // NUM_MINUS + 110, // + 47, // NUM_SLASH + 124, // F1 + 125, // F2 + 126, // F3 + 127, // F4 + 128, // F5 + 129, // F6 + 130, // F7 + 131, // F8 + 132, // F9 + 133, // F10 + 134, // F11 + 135, // F12 + 124, // + 125, // + 126, // + 127, // + 128, // + 129, // + 130, // + 131, // + 132, // + 133, // + 134, // + 135, // + 136, // + 137, // + 138, // + 139, // + 140, // + 141, // + 142, // + 143, // + 144, // NUM_LOCK + 145, // SCRL + 146, // + 147, // + 148, // + 149, // + 150, // + 151, // + 152, // + 153, // + 154, // + 155, // + 156, // + 157, // + 158, // + 159, // + 160, // + 161, // + 162, // + 163, // + 164, // + 165, // + 166, // + 167, // + 168, // + 169, // + 170, // + 171, // + 172, // + 173, // + 174, // + 175, // + 176, // + 177, // + 178, // + 179, // + 180, // + 181, // + 182, // + 183, // + 184, // + 185, // + 59, // ; + 61, // = + 44, // , + 45, // - + 46, // . + 47, // slash + 96, // ` + 193, // + 194, // + 195, // + 196, // + 197, // + 198, // + 199, // + 200, // + 201, // + 202, // + 203, // + 204, // + 205, // + 206, // + 207, // + 208, // + 209, // + 210, // + 211, // + 212, // + 213, // + 214, // + 215, // + 216, // + 217, // + 218, // + 91, // [ + 92, // back slash + 93, // ] + 39, // ' + 48, // NUM_0 (ON) + 46, // NUM_PERIOD (ON) + 49, // NUM_1 (ON) + 50, // NUM_2 (ON) + 51, // NUM_3 (ON) + 52, // NUM_4 (ON) + 53, // NUM_5 (ON) + 54, // NUM_6 (ON) + 55, // NUM_7 (ON) + 56, // NUM_8 (ON) + 57, // NUM_9 (ON) + 245, // NUM_0 (OFF) + 246, // NUM_PERIOD (OFF) + 247, // NUM_1 (OFF) + 248, // NUM_2 (OFF) + 249, // NUM_3 (OFF) + 250, // NUM_4 (OFF) + 0, // NUM_5 (OFF) + 251, // NUM_6 (OFF) + 252, // NUM_7 (OFF) + 253, // NUM_8 (OFF) + 254, // NUM_9 (OFF) + 245, // INS + 246, // DEL + 247, // END + 248, // DOWN + 249, // PGDN + 250, // LEFT + 251, // RIGHT + 252, // HOME + 253, // UP + 254, // PGUP + 255, // + 256, // + 257, // + 258, // + 259, // + 260, // + 261, // + 262, // + 263, // + 8, // BACK + 265, // TAB + 266, // + 267, // + 268, // + 13, // ENTER + 270, // + 271, // + 16, // SHIFT + 17, // CTRL + 18, // ALT + 19, // PAUSE + 20, // CAPS + 277, // + 278, // + 279, // + 280, // + 281, // + 282, // + 27, // ESC + 284, // + 285, // + 286, // + 287, // + 32, // SPACE + 289, // + 290, // + 291, // + 292, // + 293, // + 294, // + 295, // + 296, // + 297, // + 298, // + 299, // + 300, // + 301, // + 302, // + 303, // + 41, // ) + 33, // ! + 64, // @ + 35, // # + 36, // $ + 37, // % + 94, // ^ + 38, // & + 42, // * + 40, // ( + 314, // + 315, // + 316, // + 317, // + 318, // + 319, // + 320, // + 65, // A + 66, // B + 67, // C + 68, // D + 69, // E + 70, // F + 71, // G + 72, // H + 73, // I + 74, // J + 75, // K + 76, // L + 77, // M + 78, // N + 79, // O + 80, // P + 81, // Q + 82, // R + 83, // S + 84, // T + 85, // U + 86, // V + 87, // W + 88, // X + 89, // Y + 90, // Z + 347, // + 348, // + 349, // + 350, // + 351, // + 352, // + 353, // + 354, // + 355, // + 356, // + 357, // + 358, // + 359, // + 360, // + 361, // + 42, // NUM_TIMES + 43, // NUM_PLUS + 364, // + 45, // NUM_MINUS + 366, // + 47, // NUM_SLASH + 368, // SHIFT-F1 + 369, // SHIFT-F2 + 370, // SHIFT-F3 + 371, // SHIFT-F4 + 372, // SHIFT-F5 + 373, // SHIFT-F6 + 374, // SHIFT-F7 + 375, // SHIFT-F8 + 376, // SHIFT-F9 + 377, // SHIFT-F10 + 378, // SHIFT-F11 + 379, // SHIFT-F12 + 380, // + 381, // + 382, // + 383, // + 384, // + 385, // + 386, // + 387, // + 388, // + 389, // + 390, // + 391, // + 392, // + 393, // + 394, // + 395, // + 396, // + 397, // + 398, // + 399, // + 144, // NUM_LOCK + 145, // SCRL + 402, // + 403, // + 404, // + 405, // + 406, // + 407, // + 408, // + 409, // + 410, // + 411, // + 412, // + 413, // + 414, // + 415, // + 416, // + 417, // + 418, // + 419, // + 420, // + 421, // + 422, // + 423, // + 424, // + 425, // + 426, // + 427, // + 428, // + 429, // + 430, // + 431, // + 432, // + 433, // + 434, // + 435, // + 436, // + 437, // + 438, // + 439, // + 440, // + 441, // + 58, // : + 43, // + + 60, // < + 95, // _ + 62, // > + 63, // ? + 126, // ~ + 449, // + 450, // + 451, // + 452, // + 453, // + 454, // + 455, // + 456, // + 457, // + 458, // + 459, // + 460, // + 461, // + 462, // + 463, // + 464, // + 465, // + 466, // + 467, // + 468, // + 469, // + 470, // + 471, // + 472, // + 473, // + 474, // + 123, // { + 124, // | + 125, // } + 34, // " + 48, // NUM_0 (ON) + 46, // NUM_PERIOD (ON) + 49, // NUM_1 (ON) + 50, // NUM_2 (ON) + 51, // NUM_3 (ON) + 52, // NUM_4 (ON) + 53, // NUM_5 (ON) + 54, // NUM_6 (ON) + 55, // NUM_7 (ON) + 56, // NUM_8 (ON) + 57, // NUM_9 (ON) + 501, // SHIFT-NUM_0 (OFF) + 502, // SHIFT-NUM_PERIOD (OFF) + 503, // SHIFT-NUM_1 (OFF) + 504, // SHIFT-NUM_2 (OFF) + 505, // SHIFT-NUM_3 (OFF) + 506, // SHIFT-NUM_4 (OFF) + 0, // SHIFT-NUM_5 (OFF) + 507, // SHIFT-NUM_6 (OFF) + 508, // SHIFT-NUM_7 (OFF) + 509, // SHIFT-NUM_8 (OFF) + 510, // SHIFT-NUM_9 (OFF) + 501, // SHIFT-INS + 502, // SHIFT-DEL + 503, // SHIFT-END + 504, // SHIFT-DOWN + 505, // SHIFT-PGDN + 506, // SHIFT-LEFT + 507, // SHIFT-RIGHT + 508, // SHIFT-HOME + 509, // SHIFT-UP + 510, // SHIFT-PGUP + 511, // + 512, // + 513, // + 514, // + 515, // + 516, // + 517, // + 518, // + 519, // + 8, // BACK + 521, // TAB + 522, // + 523, // + 524, // + 13, // ENTER + 526, // + 527, // + 16, // SHIFT + 17, // CTRL + 18, // ALT + 19, // PAUSE + 20, // CAPS + 533, // + 534, // + 535, // + 536, // + 537, // + 538, // + 27, // ESC + 540, // + 541, // + 542, // + 543, // + 32, // SPACE + 545, // + 546, // + 547, // + 548, // + 549, // + 550, // + 551, // + 552, // + 553, // + 554, // + 555, // + 556, // + 557, // + 558, // + 559, // + 560, // + 561, // + 562, // + 563, // + 564, // + 565, // + 566, // + 567, // + 568, // + 569, // + 570, // + 571, // + 572, // + 573, // + 574, // + 575, // + 576, // + 577, // + 578, // + 579, // + 580, // + 581, // + 582, // + 583, // + 584, // + 585, // + 586, // + 587, // + 588, // + 589, // + 590, // + 591, // + 592, // + 593, // + 594, // + 595, // + 596, // + 597, // + 598, // + 599, // + 600, // + 601, // + 602, // + 603, // + 604, // + 605, // + 606, // + 607, // + 608, // + 609, // + 610, // + 611, // + 612, // + 613, // + 614, // + 615, // + 616, // + 617, // + 42, // NUM_TIMES + 43, // NUM_PLUS + 620, // + 45, // NUM_MINUS + 622, // + 47, // NUM_SLASH + 624, // ALT-F1 + 625, // ALT-F2 + 626, // ALT-F3 + 627, // ALT-F4 + 628, // ALT-F5 + 629, // ALT-F6 + 630, // ALT-F7 + 631, // ALT-F8 + 632, // ALT-F9 + 633, // ALT-F10 + 634, // ALT-F11 + 635, // ALT-F12 + 636, // + 637, // + 638, // + 639, // + 640, // + 641, // + 642, // + 643, // + 644, // + 645, // + 646, // + 647, // + 648, // + 649, // + 650, // + 651, // + 652, // + 653, // + 654, // + 655, // + 144, // NUM_LOCK + 145, // SCRL + 658, // + 659, // + 660, // + 661, // + 662, // + 663, // + 664, // + 665, // + 666, // + 667, // + 668, // + 669, // + 670, // + 671, // + 672, // + 673, // + 674, // + 675, // + 676, // + 677, // + 678, // + 679, // + 680, // + 681, // + 682, // + 683, // + 684, // + 685, // + 686, // + 687, // + 688, // + 689, // + 690, // + 691, // + 692, // + 693, // + 694, // + 695, // + 696, // + 697, // + 698, // + 699, // + 700, // + 701, // + 702, // + 703, // + 704, // + 705, // + 706, // + 707, // + 708, // + 709, // + 710, // + 711, // + 712, // + 713, // + 714, // + 715, // + 716, // + 717, // + 718, // + 719, // + 720, // + 721, // + 722, // + 723, // + 724, // + 725, // + 726, // + 727, // + 728, // + 729, // + 730, // + 731, // + 732, // + 733, // + 734, // + 48, // NUM_0 (ON) + 46, // NUM_PERIOD (ON) + 49, // NUM_1 (ON) + 50, // NUM_2 (ON) + 51, // NUM_3 (ON) + 52, // NUM_4 (ON) + 53, // NUM_5 (ON) + 54, // NUM_6 (ON) + 55, // NUM_7 (ON) + 56, // NUM_8 (ON) + 57, // NUM_9 (ON) + 757, // ALT-NUM_0 (OFF) + 758, // ALT-NUM_PERIOD (OFF) + 759, // ALT-NUM_1 (OFF) + 760, // ALT-NUM_2 (OFF) + 761, // ALT-NUM_3 (OFF) + 762, // ALT-NUM_4 (OFF) + 0, // ALT-NUM_5 (OFF) + 763, // ALT-NUM_6 (OFF) + 764, // ALT-NUM_7 (OFF) + 765, // ALT-NUM_8 (OFF) + 766, // ALT-NUM_9 (OFF) + 757, // ALT-INS + 758, // ALT-DEL + 759, // ALT-END + 760, // ALT-DOWN + 761, // ALT-PGDN + 762, // ALT-LEFT + 763, // ALT-RIGHT + 764, // ALT-HOME + 765, // ALT-UP + 766, // ALT-PGUP + 767, // + 768, // + 769, // + 770, // + 771, // + 772, // + 773, // + 774, // + 775, // + 8, // BACK + 777, // TAB + 778, // + 779, // + 780, // + 13, // ENTER + 782, // + 783, // + 16, // SHIFT + 17, // CTRL + 18, // ALT + 19, // PAUSE + 20, // CAPS + 789, // + 790, // + 791, // + 792, // + 793, // + 794, // + 27, // ESC + 796, // + 797, // + 798, // + 799, // + 32, // SPACE + 801, // + 802, // + 803, // + 804, // + 805, // + 806, // + 807, // + 808, // + 809, // + 810, // + 811, // + 812, // + 813, // + 814, // + 815, // + 816, // + 817, // + 818, // + 819, // + 820, // + 821, // + 822, // + 823, // + 824, // + 825, // + 826, // + 827, // + 828, // + 829, // + 830, // + 831, // + 832, // + 833, // + 834, // + 835, // + 836, // + 837, // + 838, // + 839, // + 840, // + 841, // + 842, // + 843, // + 844, // + 845, // + 846, // + 847, // + 848, // + 849, // + 850, // + 851, // + 852, // + 853, // + 854, // + 855, // + 856, // + 857, // + 858, // + 859, // + 860, // + 861, // + 862, // + 863, // + 864, // + 865, // + 866, // + 867, // + 868, // + 869, // + 870, // + 871, // + 872, // + 873, // + 42, // NUM_TIMES + 43, // NUM_PLUS + 876, // + 45, // NUM_MINUS + 878, // + 47, // NUM_SLASH + 880, // CTRL-F1 + 881, // CTRL-F2 + 882, // CTRL-F3 + 883, // CTRL-F4 + 884, // CTRL-F5 + 885, // CTRL-F6 + 886, // CTRL-F7 + 887, // CTRL-F8 + 888, // CTRL-F9 + 889, // CTRL-F10 + 890, // CTRL-F11 + 891, // CTRL-F12 + 892, // + 893, // + 894, // + 895, // + 896, // + 897, // + 898, // + 899, // + 900, // + 901, // + 902, // + 903, // + 904, // + 905, // + 906, // + 907, // + 908, // + 909, // + 910, // + 911, // + 144, // NUM_LOCK + 145, // SCRL + 914, // + 915, // + 916, // + 917, // + 918, // + 919, // + 920, // + 921, // + 922, // + 923, // + 924, // + 925, // + 926, // + 927, // + 928, // + 929, // + 930, // + 931, // + 932, // + 933, // + 934, // + 935, // + 936, // + 937, // + 938, // + 939, // + 940, // + 941, // + 942, // + 943, // + 944, // + 945, // + 946, // + 947, // + 948, // + 949, // + 950, // + 951, // + 952, // + 953, // + 954, // + 955, // + 956, // + 957, // + 958, // + 959, // + 960, // + 961, // + 962, // + 963, // + 964, // + 965, // + 966, // + 967, // + 968, // + 969, // + 970, // + 971, // + 972, // + 973, // + 974, // + 975, // + 976, // + 977, // + 978, // + 979, // + 980, // + 981, // + 982, // + 983, // + 984, // + 985, // + 986, // + 987, // + 988, // + 989, // + 990, // + 48, // NUM_0 (ON) + 46, // NUM_PERIOD (ON) + 49, // NUM_1 (ON) + 50, // NUM_2 (ON) + 51, // NUM_3 (ON) + 52, // NUM_4 (ON) + 53, // NUM_5 (ON) + 54, // NUM_6 (ON) + 55, // NUM_7 (ON) + 56, // NUM_8 (ON) + 57, // NUM_9 (ON) +1013, // CTRL-NUM_0 (OFF) +1014, // CTRL-NUM_PERIOD (OFF) +1015, // CTRL-NUM_1 (OFF) +1016, // CTRL-NUM_2 (OFF) +1017, // CTRL-NUM_3 (OFF) +1018, // CTRL-NUM_4 (OFF) + 0, // CTRL-NUM_5 (OFF) +1019, // CTRL-NUM_6 (OFF) +1020, // CTRL-NUM_7 (OFF) +1021, // CTRL-NUM_8 (OFF) +1022, // CTRL-NUM_9 (OFF) +1013, // CTRL-INS +1014, // CTRL-DEL +1015, // CTRL-END +1016, // CTRL-DOWN +1017, // CTRL-PGDN +1018, // CTRL-LEFT +1019, // CTRL-RIGHT +1020, // CTRL-HOME +1021, // CTRL-UP +1022, // CTRL-PGUP +1023 // CURSOR +}; diff --git a/Standard Gaming Platform/ExceptionHandling.cpp b/Standard Gaming Platform/ExceptionHandling.cpp new file mode 100644 index 00000000..1894fddf --- /dev/null +++ b/Standard Gaming Platform/ExceptionHandling.cpp @@ -0,0 +1,558 @@ +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "Types.h" + #include + #include + #include +#endif + +#include "ExceptionHandling.h" + + +#ifdef JA2 + #include "GameVersion.h" +#endif + + + + +//If we are to use exception handling +#ifdef ENABLE_EXCEPTION_HANDLING + + + + +const int NumCodeBytes = 16; // Number of code bytes to record. +const int MaxStackDump = 2048; // Maximum number of DWORDS in stack dumps. +const int StackColumns = 8; // Number of columns in stack dump. + +#define ONEK 1024 +#define SIXTYFOURK (64*ONEK) +#define ONEM (ONEK*ONEK) +#define ONEG (ONEK*ONEK*ONEK) + + + + + + + + +//ppp +void ErrorLog(HWFILE LogFile, char* Format, ...); +STR GetExceptionString( DWORD uiExceptionCode ); +void DisplayRegisters( HWFILE hFile, CONTEXT *pContext ); +BOOLEAN GetAndDisplayModuleAndSystemInfo( HWFILE hFile, CONTEXT *pContext ); +BOOLEAN DisplayStack( HWFILE hFile, CONTEXT *pContext ); +void RecordModuleList(HWFILE hFile ); +void PrintTime(char *output, FILETIME TimeToPrint); +static void ShowModuleInfo(HWFILE hFile, HINSTANCE ModuleHandle); + + + +INT32 RecordExceptionInfo( EXCEPTION_POINTERS *pExceptInfo ) +{ + EXCEPTION_RECORD Record; + CONTEXT Context; + CHAR8 zFileName[512]; + CHAR8 zDate[512]; + CHAR8 zTime[512]; + HWFILE hFile; + CHAR8 zString[2048]; + SYSTEMTIME SysTime; + CHAR8 zNewLine[] = "\r\n"; + + + //create local copies of the exception info + memcpy( &Record, pExceptInfo->ExceptionRecord , sizeof( EXCEPTION_RECORD ) ); + memcpy( &Context, pExceptInfo->ContextRecord, sizeof( CONTEXT ) ); + + + // + // Open a file to output the current state of the game + // + + + // Get the current time + GetLocalTime( &SysTime ); + + //create a date string + sprintf( zDate, "%02d_%02d_%d", SysTime.wDay, SysTime.wMonth, SysTime.wYear ); + + //create a time string + sprintf( zTime, "%02d_%02d", SysTime.wHour, SysTime.wMinute ); + + //create the crash file + sprintf( zFileName, "Crash Report_%s___%s.txt", zDate, zTime ); + + // create the save game file + hFile = FileOpen( zFileName, FILE_ACCESS_WRITE | FILE_OPEN_ALWAYS, FALSE ); + if( !hFile ) + { + FileClose( hFile ); + return( 0 ); + } + + // + // Display the version number + // +#ifdef JA2 + + //Dispay Ja's version number + ErrorLog( hFile, "%S: %s. %S",zVersionLabel, czVersionNumber, zTrackingNumber ); + + //Insert a new line + ErrorLog( hFile, zNewLine ); + + //Insert a new line + ErrorLog( hFile, zNewLine ); +#endif + + + + // + // Write out the current state of the system + // + + GetAndDisplayModuleAndSystemInfo( hFile, &Context ); + + + //Insert a new line + ErrorLog( hFile, zNewLine ); + + //Display the address of where the exception occured + sprintf( zString, "Exception occured at address: 0x%08x\r\n", Record.ExceptionAddress ); + ErrorLog( hFile, zString ); + + + //if the exception was an access violation, display the offending address + if( Record.ExceptionCode == EXCEPTION_ACCESS_VIOLATION && Record.NumberParameters != 0 ) + { + if( Record.ExceptionInformation[0] != 0 ) + { + //Display the address of where the access violation occured + sprintf( zString, "\tWrite Access Violation at: 0x%08x\r\n", Record.ExceptionInformation[1] ); + } + else + { + //Display the address of where the access violation occured + sprintf( zString, "\tWrite Access Violation at: 0x%08x\r\n", Record.ExceptionInformation[1] ); + } + + ErrorLog( hFile, zString ); + } + + + //Insert a new line + ErrorLog( hFile, zNewLine ); + + //Display the exception that caused this + sprintf( zString, "Exact Error Message \r\n \"%s\"\r\n", GetExceptionString( Record.ExceptionCode ) ); + ErrorLog( hFile, zString ); + + //Insert a new line + ErrorLog( hFile, zNewLine ); + + //Dispay if the code 'could' continue + if( Record.ExceptionFlags != 0 ) + sprintf( zString, "%s\r\n", "The game 'can NOT' continue" ); + else + sprintf( zString, "%s\r\n", "The game 'CAN' continue" ); + ErrorLog( hFile, zString ); + + + //Insert a new line + ErrorLog( hFile, zNewLine ); + ErrorLog( hFile, zNewLine ); + + + // + // Display the current context information + // + DisplayRegisters( hFile, &Context ); + + ErrorLog( hFile, zNewLine ); + ErrorLog( hFile, zNewLine ); + + //display the stack ( call stack + local variables ) + DisplayStack( hFile, &Context); + + //Display some spaces + ErrorLog( hFile, zNewLine ); + ErrorLog( hFile, zNewLine ); + + //Display all modules currently loaded + RecordModuleList(hFile ); + + + //eee + + FileClose( hFile ); + + return( EXCEPTION_EXECUTE_HANDLER ); +} + + + +void ErrorLog( HWFILE hFile, char* Format, ...) +{ + char buffer[2000]; // wvsprintf never prints more than one K. + UINT32 uiNumBytesWritten=0; + UINT32 uiStringWidth; + va_list arglist; + va_start( arglist, Format); + wvsprintf(buffer, Format, arglist); + va_end( arglist); + + //WriteFile(LogFile, buffer, lstrlen(buffer), &NumBytes, 0); + + + uiStringWidth = lstrlen(buffer); + + //write out the string + FileWrite( hFile, buffer, uiStringWidth, &uiNumBytesWritten ); + if( uiNumBytesWritten != uiStringWidth ) + { + FileClose( hFile ); + return; + } + +} + +STR GetExceptionString( DWORD uiExceptionCode ) +{ + switch( uiExceptionCode ) + { + case EXCEPTION_ACCESS_VIOLATION: + return( "The thread tried to read from or write to a virtual address for which it does not have the appropriate access."); + break; + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + return( "The thread tried to access an array element that is out of bounds and the underlying hardware supports bounds checking."); + case EXCEPTION_BREAKPOINT: + return( "A breakpoint was encountered."); + case EXCEPTION_DATATYPE_MISALIGNMENT: + return( "The thread tried to read or write data that is misaligned on hardware that does not provide alignment. For example, 16-bit values must be aligned on 2-byte boundaries; 32-bit values on 4-byte boundaries, and so on."); + case EXCEPTION_FLT_DENORMAL_OPERAND: + return( "One of the operands in a floating-point operation is denormal. A denormal value is one that is too small to represent as a standard floating-point value."); + case EXCEPTION_FLT_DIVIDE_BY_ZERO: + return( "The thread tried to divide a floating-point value by a floating-point divisor of zero."); + case EXCEPTION_FLT_INEXACT_RESULT: + return( "The result of a floating-point operation cannot be represented exactly as a decimal fraction."); + case EXCEPTION_FLT_INVALID_OPERATION: + return( "This exception represents any floating-point exception not included in this list."); + case EXCEPTION_FLT_OVERFLOW: + return( "The exponent of a floating-point operation is greater than the magnitude allowed by the corresponding type."); + case EXCEPTION_FLT_STACK_CHECK: + return( "The stack overflowed or underflowed as the result of a floating-point operation."); + case EXCEPTION_FLT_UNDERFLOW: + return( "The exponent of a floating-point operation is less than the magnitude allowed by the corresponding type."); + case EXCEPTION_ILLEGAL_INSTRUCTION: + return( "The thread tried to execute an invalid instruction."); + case EXCEPTION_IN_PAGE_ERROR: + return( "The thread tried to access a page that was not present, and the system was unable to load the page. For example, this exception might occur if a network connection is lost while running a program over the network."); + case EXCEPTION_INT_DIVIDE_BY_ZERO: + return( "The thread tried to divide an integer value by an integer divisor of zero."); + case EXCEPTION_INT_OVERFLOW: + return( "The result of an integer operation caused a carry out of the most significant bit of the result."); + case EXCEPTION_INVALID_DISPOSITION: + return( "An exception handler returned an invalid disposition to the exception dispatcher. Programmers using a high-level language such as C should never encounter this exception."); + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + return( "The thread tried to continue execution after a noncontinuable exception occurred."); + case EXCEPTION_PRIV_INSTRUCTION: + return( "The thread tried to execute an instruction whose operation is not allowed in the current machine mode."); + case EXCEPTION_SINGLE_STEP: + return( "A trace trap or other single-instruction mechanism signaled that one instruction has been executed."); + case EXCEPTION_STACK_OVERFLOW: + return( "The thread used up its stack."); + + default: + return("Exception not in case "); + break; + } +} + + +void DisplayRegisters( HWFILE hFile, CONTEXT *pContext ) +{ + ErrorLog( hFile, "Registers:\r\n"); + ErrorLog( hFile, "\tEAX=%08x CS=%04x EIP=%08x EFLGS=%08x\r\n", + pContext->Eax, pContext->SegCs, pContext->Eip, pContext->EFlags); + ErrorLog( hFile, "\tEBX=%08x SS=%04x ESP=%08x EBP=%08x\r\n", + pContext->Ebx, pContext->SegSs, pContext->Esp, pContext->Ebp); + ErrorLog( hFile, "\tECX=%08x DS=%04x ESI=%08x FS=%04x\r\n", + pContext->Ecx, pContext->SegDs, pContext->Esi, pContext->SegFs); + ErrorLog( hFile, "\tEDX=%08x ES=%04x EDI=%08x GS=%04x\r\n", + pContext->Edx, pContext->SegEs, pContext->Edi, pContext->SegGs); +// ErrorLog( hFile, "Bytes at CS:EIP:\r\n"); +} + +BOOLEAN GetAndDisplayModuleAndSystemInfo( HWFILE hFile, CONTEXT *pContext ) +{ + char zFileName[2048]; + char zString[2048]; + SYSTEM_INFO SystemInfo; + MEMORYSTATUS MemInfo; +// MEMORY_BASIC_INFORMATION MemBasicInfo; + size_t PageSize; + size_t pageNum = 0; + FILETIME LastWriteTime; + + if( GetModuleFileName(0, zFileName, sizeof(zFileName) ) == 0) + { + return( FALSE ); + } + + MemInfo.dwLength = sizeof(MemInfo); + GlobalMemoryStatus(&MemInfo); + + //Display the filename + ErrorLog( hFile, "File:\r\n\t%s\r\n", zFileName); + + + //Get the time the file was created + if (GetFileTime(GetRealFileHandleFromFileManFileHandle( hFile ), 0, 0, &LastWriteTime)) + { + PrintTime( zString, LastWriteTime); + + ErrorLog( hFile, "\tFile created on: %s\r\n", zString ); + } + + + //Get cpu type and number + GetSystemInfo(&SystemInfo); + ErrorLog( hFile, "\t%d type %d processor.\r\n", SystemInfo.dwNumberOfProcessors, SystemInfo.dwProcessorType ); + + //Get free ram + ErrorLog( hFile, "\tTotal Physical Memory: %d Megs.\r\n", MemInfo.dwTotalPhys/(1024*1024) ); + + + PageSize = SystemInfo.dwPageSize; + + pageNum = 0; + +/* + //Get current instruction pointer + if( VirtualQuery((void *)(pageNum * PageSize), &MemBasicInfo, sizeof(MemBasicInfo) ) ) + { + if (MemBasicInfo.RegionSize > 0) + { + ErrorLog( hFile, "\r\n\r\nJagged is loaded into memory at: 0x%08d.\r\n", MemBasicInfo.AllocationBase ); + } + } +*/ + + ErrorLog( hFile, "Segment( CS:EIP ):\t%04x:%08x.\r\n", pContext->SegCs, pContext->Eip ); + + return( TRUE ); +} + + + +// +// This code for this function is based ( stolen ) from Bruce Dawson's article in Game Developer Magazine Jan 99 +// +BOOLEAN DisplayStack( HWFILE hFile, CONTEXT *pContext ) +{ + int Count = 0; + char buffer[1000] = ""; + const int safetyzone = 50; + char* nearend = buffer + sizeof(buffer) - safetyzone; + char* output = buffer; + + // Time to print part or all of the stack to the error log. This allows + // us to figure out the call stack, parameters, local variables, etc. + ErrorLog( hFile, "Stack dump:\r\n" ); + + __try + { + // Esp contains the bottom of the stack, or at least the bottom of + // the currently used area. + DWORD* pStack = (DWORD *)pContext->Esp; + DWORD* pStackTop; + __asm + { + // Load the top (highest address) of the stack from the + // thread information block. It will be found there in + // Win9x and Windows NT. + mov eax, fs:[4] + mov pStackTop, eax + } + if (pStackTop > pStack + MaxStackDump) + pStackTop = pStack + MaxStackDump; + + + // Too many calls to WriteFile can take a long time, causing + // confusing delays when programs crash. Therefore I implemented + // simple buffering for the stack dumping code instead of calling + // hprintf directly. + + while (pStack + 1 <= pStackTop) + { + char *Suffix = " "; + + if ((Count % StackColumns) == 0) + output += wsprintf(output, "%08x: ", pStack); + + if ((++Count % StackColumns) == 0 || pStack + 2 > pStackTop) + Suffix = "\r\n"; + output += wsprintf(output, "%08x%s", *pStack, Suffix); + pStack++; + + // Check for when the buffer is almost full, and flush it to disk. + if (output > nearend) + { + ErrorLog( hFile, "%s", buffer); + buffer[0] = 0; + output = buffer; + } + } + // Print out any final characters from the cache. + ErrorLog( hFile, "%s", buffer); + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + ErrorLog( hFile, "Exception encountered during stack dump.\r\n"); + } + + return( TRUE ); +} + + +// +// This code for this function is ( stolen :) from Bruce Dawson's article in Game Developer Magazine Jan 99 +// + +// Print the specified FILETIME to output in a human readable format, +// without using the C run time. + +void PrintTime(char *output, FILETIME TimeToPrint) +{ + WORD Date, Time; + if (FileTimeToLocalFileTime(&TimeToPrint, &TimeToPrint) && + FileTimeToDosDateTime(&TimeToPrint, &Date, &Time)) + { + // What a silly way to print out the file date/time. Oh well, + // it works, and I'm not aware of a cleaner way to do it. + wsprintf(output, "%02d/%02d/%d %02d:%02d:%02d", + (Date / 32) & 15, Date & 31, (Date / 512) + 1980, + (Time / 2048), (Time / 32) & 63, (Time & 31) * 2); + } + else + output[0] = 0; +} + + + + + + + +// +// This code for this function is ( stolen :) from Bruce Dawson's article in Game Developer Magazine Jan 99 +// + +// Scan memory looking for code modules (DLLs or EXEs). VirtualQuery is used +// to find all the blocks of address space that were reserved or committed, +// and ShowModuleInfo will display module information if they are code +// modules. + + +void RecordModuleList(HWFILE hFile ) +{ + ErrorLog( hFile, "\r\n" + "Module list: names, addresses, sizes, time stamps " + "and file times:\r\n"); + SYSTEM_INFO SystemInfo; + GetSystemInfo(&SystemInfo); + const size_t PageSize = SystemInfo.dwPageSize; + // Set NumPages to the number of pages in the 4GByte address space, + // while being careful to avoid overflowing ints. + const size_t NumPages = 4 * size_t(ONEG / PageSize); + size_t pageNum = 0; + void *LastAllocationBase = 0; + while (pageNum < NumPages) + { + MEMORY_BASIC_INFORMATION MemInfo; + if (VirtualQuery((void *)(pageNum * PageSize), &MemInfo, + sizeof(MemInfo))) + { + if (MemInfo.RegionSize > 0) + { + // Adjust the page number to skip over this block of memory. + pageNum += MemInfo.RegionSize / PageSize; + if (MemInfo.State == MEM_COMMIT && MemInfo.AllocationBase > + LastAllocationBase) + { + // Look for new blocks of committed memory, and try + // recording their module names - this will fail + // gracefully if they aren't code modules. + LastAllocationBase = MemInfo.AllocationBase; + ShowModuleInfo(hFile, (HINSTANCE)LastAllocationBase); + } + } + else + pageNum += SIXTYFOURK / PageSize; + } + else + pageNum += SIXTYFOURK / PageSize; + // If VirtualQuery fails we advance by 64K because that is the + // granularity of address space doled out by VirtualAlloc(). + } +} + + + +// +// This code for this function is ( stolen :) from Bruce Dawson's article in Game Developer Magazine Jan 99 +// +static void ShowModuleInfo(HWFILE hFile, HINSTANCE ModuleHandle) +{ + char ModName[MAX_PATH]; + __try + { + if (GetModuleFileName(ModuleHandle, ModName, sizeof(ModName)) > 0) + { + // If GetModuleFileName returns greater than zero then this must + // be a valid code module address. Therefore we can try to walk + // our way through its structures to find the link time stamp. + IMAGE_DOS_HEADER *DosHeader = (IMAGE_DOS_HEADER*)ModuleHandle; + if (IMAGE_DOS_SIGNATURE != DosHeader->e_magic) + return; + IMAGE_NT_HEADERS *NTHeader = (IMAGE_NT_HEADERS*)((char *)DosHeader + + DosHeader->e_lfanew); + if (IMAGE_NT_SIGNATURE != NTHeader->Signature) + return; + // Open the code module file so that we can get its file date + // and size. + HANDLE ModuleFile = CreateFile(ModName, GENERIC_READ, + FILE_SHARE_READ, 0, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, 0); + char TimeBuffer[100] = ""; + DWORD FileSize = 0; + if (ModuleFile != INVALID_HANDLE_VALUE) + { + FileSize = GetFileSize(ModuleFile, 0); + FILETIME LastWriteTime; + if (GetFileTime(ModuleFile, 0, 0, &LastWriteTime)) + { + wsprintf(TimeBuffer, " - file date is "); + PrintTime(TimeBuffer + lstrlen(TimeBuffer), LastWriteTime); + } + CloseHandle(ModuleFile); + } + ErrorLog( hFile, "%-35s, loaded at 0x%08x - %7d bytes - %08x%s\r\n", + ModName, ModuleHandle, FileSize, + NTHeader->FileHeader.TimeDateStamp, TimeBuffer); + } + } + // Handle any exceptions by continuing from this point. + __except(EXCEPTION_EXECUTE_HANDLER) + { + } +} + + +#endif \ No newline at end of file diff --git a/Standard Gaming Platform/ExceptionHandling.h b/Standard Gaming Platform/ExceptionHandling.h new file mode 100644 index 00000000..0403194e --- /dev/null +++ b/Standard Gaming Platform/ExceptionHandling.h @@ -0,0 +1,31 @@ +#ifndef _EXCEPTION_HANDLING__H_ +#define _EXCEPTION_HANDLING__H_ + + +//uncomment this line if you want Exceptions to be handled +#ifdef JA2 + +#ifndef _DEBUG + #define ENABLE_EXCEPTION_HANDLING +#endif + +#else + //Wizardry +//#define ENABLE_EXCEPTION_HANDLING +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + + +INT32 RecordExceptionInfo( EXCEPTION_POINTERS *pExceptInfo ); + + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/Standard Gaming Platform/FileCat.cpp b/Standard Gaming Platform/FileCat.cpp new file mode 100644 index 00000000..95bd9a91 --- /dev/null +++ b/Standard Gaming Platform/FileCat.cpp @@ -0,0 +1,97 @@ +// +// Snap: Implementation of the TFileCat class +// +#include "FileCat.h" +#include "readdir.h" + + +// Remove a slash or backslash (if any) from the end of a string +void ChompSlash(std::string& s) +{ + if ( s.empty() ) return; + + if ( *s.rbegin() == '\\' || *s.rbegin() == '/' ) { + s.erase( s.length() - 1 ); + } +} + + +// Build a new file catalogue by recursively traversing the root directory +void TFileCat::NewCat(std::string root) +{ + fRootDir = root; + ChompSlash(fRootDir); + + fFileCat.clear(); + + TraverseDir(fRootDir); +} + + +// Look for a given file in the catalogue +// Unless pathIncludesRoot == true, will prepend the root directory to path +bool TFileCat::FindFile(std::string path, bool pathIncludesRoot) const +{ + if (pathIncludesRoot) return fFileCat.find(path) != fFileCat.end(); + else return fFileCat.find(fRootDir + '\\' + path) != fFileCat.end(); +} + + +// Delete a given file from the catalogue +// Unless pathIncludesRoot == true, will prepend the root directory to path +size_t TFileCat::RemoveFile(std::string path, bool pathIncludesRoot) +{ + if (pathIncludesRoot) return fFileCat.erase(path); + else return fFileCat.erase(fRootDir + '\\' + path); +} + + +// Delete all files from a given directory in the catalogue +// Unless pathIncludesRoot == true, will prepend the root directory to path +size_t TFileCat::RemoveDir(std::string dir, bool pathIncludesRoot) +{ + if ( !pathIncludesRoot ) dir = fRootDir + '\\' + dir; + ChompSlash(dir); + std::string dirlower = dir + '\\'; + std::string dirupper = dir + char('\\'+1); + + TCatalogue::iterator upper = fFileCat.upper_bound(dirupper); + TCatalogue::iterator lower; + + int deleted = 0; + + while ( ( lower = fFileCat.lower_bound(dirlower) ) != upper) { + fFileCat.erase(lower); + deleted++; + } + + return deleted; +} + + +// Recursively traverse a directory, adding regular files to the catalogue +void TFileCat::TraverseDir(std::string dir, int depth) +{ + using std::string; + + if (!dir.empty()) dir += '\\'; + + TReadDir readDir((dir + "*").c_str()); + + char const* fileName; + unsigned attrib; + + while ( readDir.NextFile(fileName, attrib) ) { + if (string(".") == fileName || string("..") == fileName) continue; + + string fullPath = dir + fileName; + + if (attrib & FILE_ATTRIBUTE_DIRECTORY) { + if (depth < 0) TraverseDir(fullPath); + else if (depth > 0) TraverseDir(fullPath, depth-1); + } + else { + fFileCat.insert(fullPath); + } + } +} diff --git a/Standard Gaming Platform/FileCat.h b/Standard Gaming Platform/FileCat.h new file mode 100644 index 00000000..80ca0059 --- /dev/null +++ b/Standard Gaming Platform/FileCat.h @@ -0,0 +1,48 @@ +// +// Snap: Declaration of the TFileCat class +// +// This class catalogues files in a directory and all its subdirectories +// +#ifndef FILECAT_H +#define FILECAT_H + +#include "stringicmp.h" +#include +#include + + +class TFileCat { +public: + + TFileCat(std::string root) { NewCat(root); } + TFileCat() {} + + // Build a new file catalogue by recursively traversing the root directory + void NewCat(std::string root); + + std::string GetRootDir() const { return fRootDir; } + + // Look for a given file in the catalogue + // Unless pathIncludesRoot == true, will prepend the root directory to path + bool FindFile(std::string path, bool pathIncludesRoot = false) const; + + // Delete a given file from the catalogue + // Unless pathIncludesRoot == true, will prepend the root directory to path + size_t RemoveFile(std::string path, bool pathIncludesRoot = false); + + // Delete all files from a given directory in the catalogue + // Unless pathIncludesRoot == true, will prepend the root directory to path + size_t RemoveDir(std::string dir, bool pathIncludesRoot = false); + +private: + + typedef std::set TCatalogue; + + std::string fRootDir; + TCatalogue fFileCat; + + // Recursively traverse a directory, adding regular files to the catalogue + void TraverseDir(std::string dir, int depth = -1); +}; + +#endif // FILECAT_H \ No newline at end of file diff --git a/Standard Gaming Platform/FileMan.cpp b/Standard Gaming Platform/FileMan.cpp new file mode 100644 index 00000000..6622d078 --- /dev/null +++ b/Standard Gaming Platform/FileMan.cpp @@ -0,0 +1,2102 @@ +//************************************************************************** +// +// Filename : FileMan.c +// +// Purpose : function definitions for the memory manager +// +// Modification history : +// +// 24sep96:HJH -> creation +// 08Apr97:ARM -> Assign return value from Push() calls back to HStack +// handle, because it may possibly do a MemRealloc() +// 29Dec97:Kris Morness +// -> Added functionality for setting file attributes which +// allows for read-only attribute overriding +// -> Also added a simple function that clears all file attributes +// to normal. +// +// 5 Feb 98:Dave French -> extensive modification to support libraries +// +//************************************************************************** + +//************************************************************************** +// +// Includes +// +//************************************************************************** +#ifdef JA2_PRECOMPILED_HEADERS + #include "JA2 SGP ALL.H" +#elif defined( WIZ8_PRECOMPILED_HEADERS ) + #include "WIZ8 SGP ALL.H" +#else + #include "Types.h" + #include + #include + #include + #include + + #include "windows.h" + #include "FileMan.h" + #include "MemMan.h" + #include "DbMan.h" + #include "Debug.h" + #include "RegInst.h" + #include "Container.h" + #include "LibraryDataBase.h" + #include "io.h" + +#endif +//************************************************************************** +// +// Defines +// +//************************************************************************** + +#define FILENAME_LENGTH 600 + +#define CHECKF(exp) if (!(exp)) { return(FALSE); } +#define CHECKV(exp) if (!(exp)) { return; } +#define CHECKN(exp) if (!(exp)) { return(NULL); } +#define CHECKBI(exp) if (!(exp)) { return(-1); } + +#define PRINT_DEBUG_INFO FileDebugPrint(); + +//************************************************************************** +// +// Typedefs +// +//************************************************************************** + +typedef struct FMFileInfoTag +{ + CHAR strFilename[FILENAME_LENGTH]; + UINT8 uiFileAccess; + UINT32 uiFilePosition; + HANDLE hFileHandle; + HDBFILE hDBFile; + +} FMFileInfo; // for 'File Manager File Information' + +typedef struct FileSystemTag +{ + FMFileInfo *pFileInfo; + UINT32 uiNumHandles; + BOOLEAN fDebug; + BOOLEAN fDBInitialized; + + CHAR *pcFileNames; + UINT32 uiNumFilesInDirectory; +} FileSystem; + +//************************************************************************** +// +// Variables +// +//************************************************************************** + + +//The FileDatabaseHeader +DatabaseManagerHeaderStruct gFileDataBase; + + +//FileSystem gfs; + +WIN32_FIND_DATA Win32FindInfo[20]; +BOOLEAN fFindInfoInUse[20] = {FALSE,FALSE,FALSE,FALSE,FALSE, + FALSE,FALSE,FALSE,FALSE,FALSE, + FALSE,FALSE,FALSE,FALSE,FALSE, + FALSE,FALSE,FALSE,FALSE,FALSE }; +HANDLE hFindInfoHandle[20] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, + INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, + INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, + INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, + INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, + INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, + INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, + INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, + INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, + INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE }; + +// Snap: At program launch we build two directory catalogues: +// one for the default Data directory, the other for the custom Data directory. +TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) +TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) + +//************************************************************************** +// +// Function Prototypes +// +//************************************************************************** + +void W32toSGPFileFind( GETFILESTRUCT *pGFStruct, WIN32_FIND_DATA *pW32Struct ); + +void FileDebugPrint( void ); +HANDLE GetHandleToRealFile( HWFILE hFile, BOOLEAN *pfDatabaseFile ); +HWFILE CreateFileHandle( HANDLE hRealFile, BOOLEAN fDatabaseFile ); +void DestroyFileHandle( HWFILE hFile ); +void BuildFileDirectory( void ); +INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *, HANDLE hFile, WIN32_FIND_DATA *pFind ); + +//************************************************************************** +// +// Functions +// +//************************************************************************** + +//************************************************************************** +// +// FileSystemInit +// +// Starts up the file system. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** +BOOLEAN InitializeFileManager( STR strIndexFilename ) +{ + RegisterDebugTopic( TOPIC_FILE_MANAGER, "File Manager" ); + return( TRUE ); +} + + + +//************************************************************************** +// +// FileSystemShutdown +// +// Shuts down the file system. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +// 9 Feb 98 DEF - modified to work with the library system +// +//************************************************************************** + +void ShutdownFileManager( void ) +{ + UnRegisterDebugTopic( TOPIC_FILE_MANAGER, "File Manager" ); +} + +//************************************************************************** +// +// FileDebug +// +// To set whether or not we should print debug info. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +void FileDebug( BOOLEAN f ) +{ +// gfs.fDebug = f; +} + +//************************************************************************** +// +// FileExists +// +// Checks if a file exists. +// +// Parameter List : +// +// STR -> name of file to check existence of +// +// Return Value : +// +// BOOLEAN -> TRUE if it exists +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +// 9 Feb 98 DEF - modified to work with the library system +// +// Oct 2005: Snap - Rewrote, made to check data catalogues +// +//************************************************************************** +BOOLEAN FileExists( STR strFilename ) +{ + // First check to see if it's in a library (most files should be there) + if ( gFileDataBase.fInitialized && + CheckIfFileExistInLibrary( (STR) strFilename ) ) return TRUE; + + // ... then check if it's in the custom Data directory + if ( gCustomDataCat.FindFile(strFilename) ) return TRUE; + + // ... then check if it's in the default Data directory + if ( gDefaultDataCat.FindFile(strFilename) ) return TRUE; + + // ... lastly, try to locate it in the file system + DWORD attribs = GetFileAttributes(strFilename); + if ( attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY) ) + return TRUE; + + return FALSE; +} + +//************************************************************************** +// +// FileExistsNoDB +// +// Checks if a file exists, but doesn't check the database files. +// +// Parameter List : +// +// STR -> name of file to check existence of +// +// Return Value : +// +// BOOLEAN -> TRUE if it exists +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +// Oct 2005: Snap - Rewrote, made to check data catalogues +// +//************************************************************************** +extern BOOLEAN FileExistsNoDB( STR strFilename ) +{ + // First check if it's in the custom Data directory + if ( gCustomDataCat.FindFile(strFilename) ) return TRUE; + + // ... then check if it's in the default Data directory + if ( gDefaultDataCat.FindFile(strFilename) ) return TRUE; + + // ... lastly, try to locate it in the file system + DWORD attribs = GetFileAttributes(strFilename); + if ( attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY) ) + return TRUE; + + return FALSE; +} + +//************************************************************************** +// +// FileDelete +// +// Deletes a file. +// +// Parameter List : +// +// STR -> name of file to delete +// +// Return Value : +// +// BOOLEAN -> TRUE if successful +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** +BOOLEAN FileDelete( STR strFilename ) +{ + // Snap: delete the file from the default Data catalogue (if it is there) + // Since the path can be either relative or absolute, try both methods + gDefaultDataCat.RemoveFile(strFilename, true); + gDefaultDataCat.RemoveFile(strFilename, false); + + return( DeleteFile( (LPCSTR) strFilename ) ); +} + +//************************************************************************** +// +// FileOpen +// +// Opens a file. +// +// Parameter List : +// +// STR -> filename +// UIN32 -> access - read or write, or both +// BOOLEAN -> delete on close +// +// Return Value : +// +// HWFILE -> handle of opened file +// +// Modification history : +// +// 24sep96:HJH -> creation +// +// 9 Feb 98 DEF - modified to work with the library system +// +// Oct 2005: Snap - modified to work with the custom Data directory +// +//************************************************************************** +HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose ) +{ + HWFILE hFile; + HANDLE hRealFile; + DWORD dwAccess; + DWORD dwFlagsAndAttributes; + BOOLEAN fExists; + HDBFILE hDBFile; + DWORD dwCreationFlags; + HWFILE hLibFile; + + hFile = 0; + hDBFile = 0; + dwCreationFlags = 0; + + dwAccess = 0; + if ( uiOptions & FILE_ACCESS_READ ) + dwAccess |= GENERIC_READ; + if ( uiOptions & FILE_ACCESS_WRITE ) + dwAccess |= GENERIC_WRITE; + + dwFlagsAndAttributes = FILE_FLAG_RANDOM_ACCESS; + if ( fDeleteOnClose ) + dwFlagsAndAttributes |= FILE_FLAG_DELETE_ON_CLOSE; + + // Snap: This seems like an unnecessary check, but I don't feel like + // rewriting the function to eliminate it... + + // check if the file exists - note that we use the function FileExistsNoDB + // because it doesn't check the databases, and we don't want to do that here + fExists = FileExistsNoDB( strFilename ); + + // Snap: First see if the file is in the custom Data catalogue: + std::string filePath; + if ( gCustomDataCat.FindFile(strFilename) ) { + filePath = gCustomDataCat.GetRootDir() + '\\'; + } + filePath += strFilename; + // Bad cast! strFilename should have been const. Oh well... + strFilename = const_cast( filePath.c_str() ); + // Now strFilename points either to the original file name, + // or to the full file path in the custom Data directory. + // Except for this substitution, the rest of the function is unchanged. + + //if the file is on the disk + if ( fExists ) + { + hRealFile = CreateFile( (LPCSTR) strFilename, dwAccess, 0, NULL, OPEN_ALWAYS, + dwFlagsAndAttributes, NULL ); + + if ( hRealFile == INVALID_HANDLE_VALUE ) + { + return(0); + } + + //create a file handle for the 'real file' + hFile = CreateRealFileHandle( hRealFile ); + } + + // if the file did not exist, try to open it from the database + else if ( gFileDataBase.fInitialized ) + { + //if the file is to be opened for writing, return an error cause you cant write a file that is in the database library + if( fDeleteOnClose ) + { + return( 0 ); + } + + //if the file doesnt exist on the harddrive, but it is to be created, dont try to load it from the file database + if( uiOptions & FILE_ACCESS_WRITE ) + { + //if the files is to be written to + if( ( uiOptions & FILE_CREATE_NEW ) || ( uiOptions & FILE_OPEN_ALWAYS ) || ( uiOptions & FILE_CREATE_ALWAYS ) || ( uiOptions & FILE_TRUNCATE_EXISTING ) ) + { + hFile = 0; + } + } + //else if the file is to be opened using FILE_OPEN_EXISTING, and the file doesnt exists, fail out of the function) +// else if( uiOptions & FILE_OPEN_EXISTING ) +// { + //fail out of the function +// return( 0 ); +// } + else + { + //If the file is in the library, get a handle to it. + hLibFile = OpenFileFromLibrary( (STR) strFilename ); + + //tried to open a file that wasnt in the database + if( !hLibFile ) + return( 0 ); + else + return( hLibFile ); //return the file handle + } + } + + if ( !hFile ) + { + if ( uiOptions & FILE_CREATE_NEW ) + { + dwCreationFlags = CREATE_NEW; + } + else if ( uiOptions & FILE_CREATE_ALWAYS ) + { + dwCreationFlags = CREATE_ALWAYS; + } + else if ( uiOptions & FILE_OPEN_EXISTING || uiOptions & FILE_ACCESS_READ ) + { + dwCreationFlags = OPEN_EXISTING; + } + else if ( uiOptions & FILE_OPEN_ALWAYS ) + { + dwCreationFlags = OPEN_ALWAYS; + } + else if ( uiOptions & FILE_TRUNCATE_EXISTING ) + { + dwCreationFlags = TRUNCATE_EXISTING; + } + else + { + dwCreationFlags = OPEN_ALWAYS; + } + + + hRealFile = CreateFile( (LPCSTR) strFilename, dwAccess, 0, NULL, dwCreationFlags, + dwFlagsAndAttributes, NULL ); + if ( hRealFile == INVALID_HANDLE_VALUE ) + { + UINT32 uiLastError = GetLastError(); + char zString[1024]; + FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, 0, uiLastError, 0, zString, 1024, NULL); + + return(0); + } + + hFile = CreateRealFileHandle( hRealFile ); + } + + if ( !hFile ) + return(0); + + return(hFile); +} + + + +//************************************************************************** +// +// FileClose +// +// +// Parameter List : +// +// HWFILE hFile -> handle to file to close +// +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +// 9 Feb 98 DEF - modified to work with the library system +// +//************************************************************************** + +void FileClose( HWFILE hFile ) +{ + INT16 sLibraryID; + UINT32 uiFileNum; + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + //if its the 'real file' library + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + //if its not already closed + if( gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].uiFileID != 0 ) + { + CloseHandle( gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle ); + gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].uiFileID = 0; + gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle= 0; + gFileDataBase.RealFiles.iNumFilesOpen--; + if( gFileDataBase.RealFiles.iNumFilesOpen < 0 ) + { + //if for some reason we are below 0, report an error ( should never be ) + Assert( 0 ); + } + } + } + else + { + //if the database is initialized + if( gFileDataBase.fInitialized ) + CloseLibraryFile( sLibraryID, uiFileNum ); + } +} + +//************************************************************************** +// +// FileRead +// +// To read a file. +// +// Parameter List : +// +// HWFILE -> handle to file to read from +// void * -> source buffer +// UINT32 -> num bytes to read +// UINT32 -> num bytes read +// +// Return Value : +// +// BOOLEAN -> TRUE if successful +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// 08Dec97:ARM -> return FALSE if bytes to read != bytes read +// +// 9 Feb 98 DEF - modified to work with the library system +// +//************************************************************************** + +#ifdef JA2TESTVERSION + extern UINT32 uiTotalFileReadTime; + extern UINT32 uiTotalFileReadCalls; + #include "Timer Control.h" +#endif + + +BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ) +{ + HANDLE hRealFile; + DWORD dwNumBytesToRead, dwNumBytesRead; + BOOLEAN fRet = FALSE; + INT16 sLibraryID; + UINT32 uiFileNum; + +#ifdef JA2TESTVERSION + UINT32 uiStartTime = GetJA2Clock(); +#endif + + //init the variables + dwNumBytesToRead = dwNumBytesRead = 0; + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + dwNumBytesToRead = (DWORD)uiBytesToRead; + + //if its a real file, read the data from the file + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + //if the file is opened + if( uiFileNum != 0 ) + { + hRealFile = gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle; + + fRet = ReadFile( hRealFile, pDest, dwNumBytesToRead, &dwNumBytesRead, NULL ); + if ( dwNumBytesToRead != dwNumBytesRead ) + { + UINT32 uiLastError = GetLastError(); + char zString[1024]; + FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, 0, uiLastError, 0, zString, 1024, NULL); + + fRet = FALSE; + } + + if ( puiBytesRead ) + *puiBytesRead = (UINT32)dwNumBytesRead; + } + } + else + { + //if the database is initialized + if( gFileDataBase.fInitialized ) + { + //if the library is open + if( IsLibraryOpened( sLibraryID ) ) + { + //if the file is opened + if( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].uiFileID != 0 ) + { + //read the data from the library + fRet = LoadDataFromLibrary( sLibraryID, uiFileNum, pDest, dwNumBytesToRead, (UINT32 *) &dwNumBytesRead ); + if ( puiBytesRead ) + { + *puiBytesRead = (UINT32)dwNumBytesRead; + } + } + } + } + } + #ifdef JA2TESTVERSION + //Add the time that we spent in this function to the total. + uiTotalFileReadTime += GetJA2Clock() - uiStartTime; + uiTotalFileReadCalls++; + #endif + + return(fRet); +} + +//************************************************************************** +// +// FileWrite +// +// To write a file. +// +// Parameter List : +// +// HWFILE -> handle to file to write to +// void * -> destination buffer +// UINT32 -> num bytes to write +// UINT32 -> num bytes written +// +// Return Value : +// +// BOOLEAN -> TRUE if successful +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// 08Dec97:ARM -> return FALSE if dwNumBytesToWrite != dwNumBytesWritten +// +// 9 Feb 98 DEF - modified to work with the library system +// +//************************************************************************** + +BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBytesWritten ) +{ + HANDLE hRealFile; + DWORD dwNumBytesToWrite, dwNumBytesWritten; + BOOLEAN fRet; + INT16 sLibraryID; + UINT32 uiFileNum; + + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + //if its a real file, read the data from the file + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + dwNumBytesToWrite = (DWORD)uiBytesToWrite; + + //get the real file handle to the file + hRealFile = gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle; + + fRet = WriteFile( hRealFile, pDest, dwNumBytesToWrite, &dwNumBytesWritten, NULL ); + + if (dwNumBytesToWrite != dwNumBytesWritten) + fRet = FALSE; + + if ( puiBytesWritten ) + *puiBytesWritten = (UINT32)dwNumBytesWritten; + } + else + { + //we cannot write to a library file + if ( puiBytesWritten ) + *puiBytesWritten = 0; + return(FALSE); + } + + return(fRet); +} + +//************************************************************************** +// +// FileLoad +// +// To open, read, and close a file. +// +// Parameter List : +// +// +// Return Value : +// +// BOOLEAN -> TRUE if successful +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// 08Dec97:ARM -> return FALSE if bytes to read != bytes read (CHECKF is inappropriate?) +// +//************************************************************************** + +BOOLEAN FileLoad( STR strFilename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ) +{ + HWFILE hFile; + UINT32 uiNumBytesRead; + BOOLEAN fRet; + + hFile = FileOpen( strFilename, FILE_ACCESS_READ, FALSE ); + if ( hFile ) + { + fRet = FileRead( hFile, pDest, uiBytesToRead, &uiNumBytesRead ); + FileClose( hFile ); + + if (uiBytesToRead != uiNumBytesRead) + fRet = FALSE; + + if ( puiBytesRead ) + *puiBytesRead = uiNumBytesRead; + + CHECKF( uiNumBytesRead == uiBytesToRead ); + } + else + fRet = FALSE; + + return(fRet); +} + +//************************************************************************** +// +// FilePrintf +// +// To printf to a file. +// +// Parameter List : +// +// HWFILE -> handle to file to seek in +// ... -> arguments, 1st of which should be a string +// +// Return Value : +// +// BOOLEAN -> TRUE if successful +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +// 9 Feb 98 DEF - modified to work with the library system +// +//************************************************************************** +BOOLEAN _cdecl FilePrintf( HWFILE hFile, char * strFormatted, ... ) +{ + UINT8 strToSend[80]; + va_list argptr; + BOOLEAN fRetVal = FALSE; + + INT16 sLibraryID; + UINT32 uiFileNum; + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + //if its a real file, read the data from the file + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + va_start(argptr, strFormatted); + vsprintf( (char *)strToSend, (char *)strFormatted, argptr ); + va_end(argptr); + + fRetVal = FileWrite( hFile, strToSend, strlen(strToSend), NULL ); + } + else + { + //its a library file, cant write to it so return an error + fRetVal = FALSE; + } + + return( fRetVal ); +} + +//************************************************************************** +// +// FileSeek +// +// To seek to a position in a file. +// +// Parameter List : +// +// HWFILE -> handle to file to seek in +// UINT32 -> distance to seek +// UINT8 -> how to seek +// +// Return Value : +// +// BOOLEAN -> TRUE if successful +// -> FALSE if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +// 9 Feb 98 DEF - modified to work with the library system +// +//************************************************************************** + +BOOLEAN FileSeek( HWFILE hFile, UINT32 uiDistance, UINT8 uiHow ) +{ + HANDLE hRealFile; + LONG lDistanceToMove; + DWORD dwMoveMethod; + INT32 iDistance=0; + + INT16 sLibraryID; + UINT32 uiFileNum; + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + //if its a real file, read the data from the file + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + //Get the handle to the real file + hRealFile = gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle; + + iDistance = (INT32) uiDistance; + + if ( uiHow == FILE_SEEK_FROM_START ) + dwMoveMethod = FILE_BEGIN; + else if ( uiHow == FILE_SEEK_FROM_END ) + { + dwMoveMethod = FILE_END; + if( iDistance > 0 ) + iDistance = -(iDistance); + } + else + dwMoveMethod = FILE_CURRENT; + + lDistanceToMove = (LONG)uiDistance; + + if ( SetFilePointer( hRealFile, iDistance, NULL, dwMoveMethod ) == 0xFFFFFFFF ) + return(FALSE); + } + else + { + //if the database is initialized + if( gFileDataBase.fInitialized ) + LibraryFileSeek( sLibraryID, uiFileNum, uiDistance, uiHow ); + } + + return(TRUE); +} + +//************************************************************************** +// +// FileGetPos +// +// To get the current position in a file. +// +// Parameter List : +// +// HWFILE -> handle to file +// +// Return Value : +// +// INT32 -> current offset in file if successful +// -> -1 if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +// 9 Feb 98 DEF - modified to work with the library system +// +//************************************************************************** + +INT32 FileGetPos( HWFILE hFile ) +{ + HANDLE hRealFile; + UINT32 uiPositionInFile=0; + + INT16 sLibraryID; + UINT32 uiFileNum; + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + //if its a real file, read the data from the file + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + //Get the handle to the real file + hRealFile = gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle; + + uiPositionInFile = SetFilePointer( hRealFile, 0, NULL, FILE_CURRENT); + if( uiPositionInFile == 0xFFFFFFFF ) + { + uiPositionInFile = 0; + } + return( uiPositionInFile ); + } + else + { + //if the library is open + if( IsLibraryOpened( sLibraryID ) ) + { + //check if the file is open + if( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].uiFileID != 0 ) + { + uiPositionInFile = gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].uiFilePosInFile; + return( uiPositionInFile ); + } + } + } + + return(BAD_INDEX); +} + +//************************************************************************** +// +// FileGetSize +// +// To get the current file size. +// +// Parameter List : +// +// HWFILE -> handle to file +// +// Return Value : +// +// INT32 -> file size in file if successful +// -> 0 if not +// +// Modification history : +// +// 24sep96:HJH -> creation +// +// 9 Feb 98 DEF - modified to work with the library system +// +//************************************************************************** + +UINT32 FileGetSize( HWFILE hFile ) +{ + HANDLE hRealHandle; + UINT32 uiFileSize = 0xFFFFFFFF; + + INT16 sLibraryID; + UINT32 uiFileNum; + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + //if its a real file, read the data from the file + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + //Get the handle to a real file + hRealHandle = gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle; + + uiFileSize = GetFileSize( hRealHandle, NULL ); + } + else + { + //if the library is open + if( IsLibraryOpened( sLibraryID ) ) + uiFileSize = gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].pFileHeader->uiFileLength; + } + + + if ( uiFileSize == 0xFFFFFFFF ) + return(0); + else + return( uiFileSize ); +} + +//************************************************************************** +// +// FileDebugPrint +// +// To print the state of memory to output. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** + +void FileDebugPrint( void ) +{ +} + +//************************************************************************** +// +// GetHandleToRealFile +// +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +// 9 Feb 98 DEF - modified to work with the library system +// +//************************************************************************** + +HANDLE GetHandleToRealFile( HWFILE hFile, BOOLEAN *pfDatabaseFile ) +{ + HANDLE hRealFile; + + INT16 sLibraryID; + UINT32 uiFileNum; + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + //if its a real file, read the data from the file + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + //Get the handle to the real file + hRealFile = gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle; + *pfDatabaseFile = FALSE; + } + else + { + *pfDatabaseFile = TRUE; + hRealFile = (HANDLE) hFile; + } + + return(hRealFile); +} + +//************************************************************************** +// +// CreateFileHandle +// +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// 24sep96:HJH -> creation +// +//************************************************************************** +/* + + not needed anymore + +HWFILE CreateFileHandle( HANDLE hRealFile, BOOLEAN fDatabaseFile ) +{ + UINT32 i, uiOldNumHandles; + FMFileInfo *pNewFileInfo; + + Assert( !fDatabaseFile || (fDatabaseFile && gfs.fDBInitialized) ); + + // don't use 1st position - it'll confuse the users + for ( i=1 ; i creation +// +//************************************************************************** +/* +void DestroyFileHandle( HWFILE hFile ) +{ + if ( hFile < gfs.uiNumHandles && hFile ) + { + gfs.pFileInfo[hFile].hFileHandle = 0; + gfs.pFileInfo[hFile].hDBFile = 0; + } +} +*/ + + + +//************************************************************************** +// +// BuildFileDirectory +// +// +// +// Parameter List : +// Return Value : +// Modification history : +// +// ??nov96:HJH -> creation +// +//************************************************************************** + +void BuildFileDirectory( void ) +{ + + return; // temporary until container stuff is fixed +/* + INT32 i, iNumFiles = 0; + HANDLE hFile, hFileIn; + WIN32_FIND_DATA find, inFind; + BOOLEAN fMore = TRUE; + CHAR cName[FILENAME_LENGTH], cDir[FILENAME_LENGTH], cSubDir[FILENAME_LENGTH]; + HCONTAINER hStack; + + + + // + // First, push all the file names in the directory (and subdirectories) + // onto the stack. + // + + GetProfileChar( "Startup", "InstPath", "", cDir ); + + if ( strlen( cDir ) == 0 ) + return; + + hStack = CreateStack( 100, FILENAME_LENGTH ); + if (hStack == NULL) + { + FastDebugMsg(String("BuildFileDirectory: CreateStack Failed for the filename stack")); + return; + } + + find.dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY; + + strcpy( &(cDir[strlen(cDir)]), "\\*.*\0" ); + hFile = FindFirstFile( cDir, &find ); + while ( fMore ) + { + if ( find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) + { + if ( strcmp( find.cFileName, "." ) != 0 && strcmp( find.cFileName, ".." ) != 0 ) + { + // a valid directory + inFind.dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY; + strcpy( cSubDir, cDir ); + strcpy( &(cSubDir[strlen(cDir)-3]), find.cFileName ); + strcpy( &(cSubDir[strlen(cSubDir)]), "\\*.*\0" ); + hFileIn = FindFirstFile( cSubDir, &inFind ); + iNumFiles += GetFilesInDirectory( hStack, cSubDir, hFileIn, &inFind ); + FindClose( hFileIn ); + } + } + else + { + iNumFiles++; + strcpy( cName, cDir ); + strcpy( &(cName[strlen(cName)-3]), find.cFileName ); + CharLower( cName ); + hStack = Push( hStack, cName ); + } + find.dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY; + fMore = FindNextFile( hFile, &find ); + } + FindClose( hFile ); + + // + // Okay, we have all the files in the stack, now put them in place. + // + gfs.uiNumFilesInDirectory = iNumFiles; + + gfs.pcFileNames = (CHAR *)MemAlloc( iNumFiles * FILENAME_LENGTH ); + + if ( gfs.pcFileNames ) + { + for ( i=0 ; i creation +// +//************************************************************************** + +INT32 GetFilesInDirectory( HCONTAINER hStack, CHAR *pcDir, HANDLE hFile, WIN32_FIND_DATA *pFind ) +{ + INT32 iNumFiles; + WIN32_FIND_DATA inFind; + BOOLEAN fMore; + CHAR cName[FILENAME_LENGTH], cDir[FILENAME_LENGTH]; + HANDLE hFileIn; + + fMore = TRUE; + iNumFiles = 0; + + while ( fMore ) + { + if ( pFind->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) + { + if ( strcmp( pFind->cFileName, "." ) != 0 && strcmp( pFind->cFileName, ".." ) != 0 ) + { + // a valid directory - recurse and find the files in that directory + + inFind.dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY; + strcpy( cDir, pcDir ); + strcpy( &(cDir[strlen(cDir)-3]), pFind->cFileName ); + strcpy( &(cDir[strlen(cDir)]), "\\*.*\0" ); + hFileIn = FindFirstFile( cDir, &inFind ); + iNumFiles += GetFilesInDirectory( hStack, cDir, hFileIn, &inFind ); + FindClose( hFileIn ); + } + } + else + { + iNumFiles++; + strcpy( cName, pcDir ); + strcpy( &(cName[strlen(cName)-3]), pFind->cFileName ); + CharLower( cName ); + hStack = Push( hStack, cName ); + } + pFind->dwFileAttributes = FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY; + fMore = FindNextFile( hFile, pFind ); + } + + return(iNumFiles); +} + +BOOLEAN SetFileManCurrentDirectory( STR pcDirectory ) +{ + return( SetCurrentDirectory( pcDirectory ) ); +} + + +BOOLEAN GetFileManCurrentDirectory( STRING512 pcDirectory ) +{ + if (GetCurrentDirectory( 512, pcDirectory ) == 0) + { + return( FALSE ); + } + return( TRUE ); +} + + +BOOLEAN DirectoryExists( STRING512 pcDirectory ) +{ + UINT32 uiAttribs; + DWORD uiLastError; + + uiAttribs = GetFileAttributes( pcDirectory ); + + if ( uiAttribs == 0xFFFFFFFF ) + { + // an error, make sure it's the right error + uiLastError = GetLastError(); + + if (uiLastError != ERROR_FILE_NOT_FOUND) + { + FastDebugMsg(String("DirectoryExists: ERROR - GetFileAttributes failed, error #%d on file %s", uiLastError, pcDirectory)); + } + } + else + { + // something's there, make sure it's a directory + if ( uiAttribs & FILE_ATTRIBUTE_DIRECTORY ) + { + return TRUE; + } + } + + // this could also mean that the name given is that of a file, or that an error occurred + return FALSE; +} + + +BOOLEAN MakeFileManDirectory( STRING512 pcDirectory ) +{ + return CreateDirectory( pcDirectory, NULL ); +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Removes ALL FILES in the specified directory (and all subdirectories with their files if fRecursive is TRUE) +// Use EraseDirectory() to simply delete directory contents without deleting the directory itself +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive ) +{ + WIN32_FIND_DATA sFindData; + HANDLE SearchHandle; + const CHAR8 *pFileSpec = "*.*"; + BOOLEAN fDone = FALSE; + BOOLEAN fRetval=FALSE; + CHAR8 zOldDir[512]; + CHAR8 zSubdirectory[512]; + + GetFileManCurrentDirectory( zOldDir ); + + if( !SetFileManCurrentDirectory( pcDirectory ) ) + { + FastDebugMsg(String("RemoveFileManDirectory: ERROR - SetFileManCurrentDirectory on %s failed, error %d", pcDirectory, GetLastError())); + return( FALSE ); //Error going into directory + } + + //If there are files in the directory, DELETE THEM + SearchHandle = FindFirstFile( pFileSpec, &sFindData); + if( SearchHandle != INVALID_HANDLE_VALUE ) + { + + fDone = FALSE; + do + { + // if the object is a directory + if( GetFileAttributes( sFindData.cFileName ) == FILE_ATTRIBUTE_DIRECTORY ) + { + // only go in if the fRecursive flag is TRUE (like Deltree) + if (fRecursive) + { + sprintf(zSubdirectory, "%s\\%s", pcDirectory, sFindData.cFileName); + + if ((strcmp(sFindData.cFileName, ".") != 0) && (strcmp(sFindData.cFileName, "..") != 0)) + { + if (!RemoveFileManDirectory(zSubdirectory, TRUE)) + { + FastDebugMsg(String("RemoveFileManDirectory: ERROR - Recursive call on %s failed", zSubdirectory)); + break; + } + } + } + // otherwise, all the individual files will be deleted, but the subdirectories remain, causing + // RemoveDirectory() at the end to fail, thus this function will return FALSE in that event (failure) + } + else + { + FileDelete( sFindData.cFileName ); + } + + //find the next file in the directory + fRetval = FindNextFile( SearchHandle, &sFindData ); + if( fRetval == 0 ) + { + fDone = TRUE; + } + } while(!fDone); + + // very important: close the find handle, or subsequent RemoveDirectory() calls will fail + FindClose( SearchHandle ); + } + + if( !SetFileManCurrentDirectory( zOldDir ) ) + { + FastDebugMsg(String("RemoveFileManDirectory: ERROR - SetFileManCurrentDirectory on %s failed, error %d", zOldDir, GetLastError())); + return( FALSE ); //Error returning from subdirectory + } + + + // The directory MUST be empty + fRetval = RemoveDirectory( pcDirectory ); + if (!fRetval) + { + FastDebugMsg(String("RemoveFileManDirectory: ERROR - RemoveDirectory on %s failed, error %d", pcDirectory, GetLastError())); + } + + return fRetval; +} + + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Removes ALL FILES in the specified directory but leaves the directory alone. Does not affect any subdirectories! +// Use RemoveFilemanDirectory() to also delete the directory itself, or to recursively delete subdirectories. +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +BOOLEAN EraseDirectory( STRING512 pcDirectory) +{ + WIN32_FIND_DATA sFindData; + HANDLE SearchHandle; + const CHAR8 *pFileSpec = "*.*"; + BOOLEAN fDone = FALSE; + CHAR8 zOldDir[512]; + + GetFileManCurrentDirectory( zOldDir ); + + if( !SetFileManCurrentDirectory( pcDirectory ) ) + { + FastDebugMsg(String("EraseDirectory: ERROR - SetFileManCurrentDirectory on %s failed, error %d", pcDirectory, GetLastError())); + return( FALSE ); //Error going into directory + } + + //If there are files in the directory, DELETE THEM + SearchHandle = FindFirstFile( pFileSpec, &sFindData); + if( SearchHandle != INVALID_HANDLE_VALUE ) + { + + fDone = FALSE; + do + { + // if it's a file, not a directory + if( GetFileAttributes( sFindData.cFileName ) != FILE_ATTRIBUTES_DIRECTORY ) + { + FileDelete( sFindData.cFileName ); + } + + //find the next file in the directory + if ( !FindNextFile( SearchHandle, &sFindData )) + { + fDone = TRUE; + } + } while(!fDone); + + // very important: close the find handle, or subsequent RemoveDirectory() calls will fail + FindClose( SearchHandle ); + } + + // Snap: Delete the directory from the default Data catalogue (if it is there) + // Since the path can be either relative or absolute, try both methods + gDefaultDataCat.RemoveDir(pcDirectory, true); + gDefaultDataCat.RemoveDir(pcDirectory, false); + + if( !SetFileManCurrentDirectory( zOldDir ) ) + { + FastDebugMsg(String("EraseDirectory: ERROR - SetFileManCurrentDirectory on %s failed, error %d", zOldDir, GetLastError())); + return( FALSE ); //Error returning from directory + } + + return( TRUE ); +} + + +BOOLEAN GetExecutableDirectory( STRING512 pcDirectory ) +{ + SGPFILENAME ModuleFilename; + UINT32 cnt; + + if ( GetModuleFileName( NULL, ModuleFilename, sizeof( ModuleFilename ) ) == 0 ) + { + return( FALSE ); + } + + // Now get directory + strcpy( pcDirectory, ModuleFilename ); + + for ( cnt = strlen( pcDirectory ) - 1; cnt >= 0; cnt -- ) + { + if ( pcDirectory[ cnt ] == '\\' ) + { + pcDirectory[ cnt ] = '\0'; + break; + } + } + + return( TRUE ); +} + +BOOLEAN GetFileFirst( CHAR8 * pSpec, GETFILESTRUCT *pGFStruct ) +{ + INT32 x,iWhich=0; + BOOLEAN fFound; + + CHECKF( pSpec != NULL ); + CHECKF( pGFStruct != NULL ); + + fFound = FALSE; + for( x = 0; x < 20 && !fFound; x++) + { + if( !fFindInfoInUse[x] ) + { + iWhich = x; + fFound = TRUE; + } + } + + if ( !fFound ) + return(FALSE); + + pGFStruct->iFindHandle = iWhich; + + hFindInfoHandle[iWhich] = FindFirstFile( pSpec, &Win32FindInfo[iWhich] ); + + if ( hFindInfoHandle[iWhich] == INVALID_HANDLE_VALUE ) + return(FALSE); + fFindInfoInUse[iWhich] = TRUE; + + W32toSGPFileFind( pGFStruct, &Win32FindInfo[iWhich] ); + + return(TRUE); +} + +BOOLEAN GetFileNext( GETFILESTRUCT *pGFStruct ) +{ + CHECKF( pGFStruct != NULL ); + + if ( FindNextFile(hFindInfoHandle[pGFStruct->iFindHandle], &Win32FindInfo[pGFStruct->iFindHandle]) ) + { + W32toSGPFileFind( pGFStruct, &Win32FindInfo[pGFStruct->iFindHandle] ); + return(TRUE); + } + return(FALSE); +} + +void GetFileClose( GETFILESTRUCT *pGFStruct ) +{ + if ( pGFStruct == NULL ) + return; + + FindClose( hFindInfoHandle[pGFStruct->iFindHandle] ); + hFindInfoHandle[pGFStruct->iFindHandle] = INVALID_HANDLE_VALUE; + fFindInfoInUse[pGFStruct->iFindHandle] = FALSE; + + return; +} + +void W32toSGPFileFind( GETFILESTRUCT *pGFStruct, WIN32_FIND_DATA *pW32Struct ) +{ + UINT32 uiAttribMask; + + // Copy the filename + strcpy(pGFStruct->zFileName, pW32Struct->cFileName); + + // Get file size + if ( pW32Struct->nFileSizeHigh != 0 ) + pGFStruct->uiFileSize = 0xffffffff; + else + pGFStruct->uiFileSize = pW32Struct->nFileSizeLow; + + // Copy the file attributes + pGFStruct->uiFileAttribs = 0; + + for( uiAttribMask = 0x80000000; uiAttribMask > 0; uiAttribMask >>= 1) + { + switch( pW32Struct->dwFileAttributes & uiAttribMask ) + { + case FILE_ATTRIBUTE_ARCHIVE: + pGFStruct->uiFileAttribs |= FILE_IS_ARCHIVE; + break; + + case FILE_ATTRIBUTE_DIRECTORY: + pGFStruct->uiFileAttribs |= FILE_IS_DIRECTORY; + break; + + case FILE_ATTRIBUTE_HIDDEN: + pGFStruct->uiFileAttribs |= FILE_IS_HIDDEN; + break; + + case FILE_ATTRIBUTE_NORMAL: + pGFStruct->uiFileAttribs |= FILE_IS_NORMAL; + break; + + case FILE_ATTRIBUTE_READONLY: + pGFStruct->uiFileAttribs |= FILE_IS_READONLY; + break; + + case FILE_ATTRIBUTE_SYSTEM: + pGFStruct->uiFileAttribs |= FILE_IS_SYSTEM; + break; + + case FILE_ATTRIBUTE_TEMPORARY: + pGFStruct->uiFileAttribs |= FILE_IS_TEMPORARY; + break; + + case FILE_ATTRIBUTE_COMPRESSED: + pGFStruct->uiFileAttribs |= FILE_IS_COMPRESSED; + break; + + case FILE_ATTRIBUTE_OFFLINE: + pGFStruct->uiFileAttribs |= FILE_IS_OFFLINE; + break; + } + } +} + + + +BOOLEAN FileCopy(STR strSrcFile, STR strDstFile, BOOLEAN fFailIfExists) +{ + return(CopyFile(strSrcFile, strDstFile, fFailIfExists)); + +// Not needed, use Windows CopyFile +/* + HWFILE hFile; + UINT32 uiSize; + CHAR *pBuffer; + UINT32 uiBytesRead, uiBytesWritten; + + + // open source file + hFile = FileOpen(strSrcFile, FILE_ACCESS_READ, FALSE); + if (hFile == 0) + { + FastDebugMsg(String("FileCopy: FileOpen failed on Src file %s", strSrcFile)); + return(FALSE); + } + + // get its size + uiSize = FileGetSize(hFile); + if (uiSize == 0) + { + FastDebugMsg(String("FileCopy: size is 0, Src file %s", strSrcFile)); + FileClose(hFile); + return(FALSE); + } + + // allocate a buffer big enough to hold the entire file + pBuffer = MemAlloc(uiSize); + if (pBuffer == NULL) + { + FastDebugMsg(String("FileCopy: ERROR - MemAlloc pBuffer failed, size %d", uiSize)); + FileClose(hFile); + return(FALSE); + } + + // read the file into memory + if (!FileRead(hFile, pBuffer, uiSize, &uiBytesRead)) + { + FastDebugMsg(String("FileCopy: FileRead failed, file %s", strSrcFile)); + FileClose(hFile); + return(FALSE); + } + + // close source file + FileClose(hFile); + + + // open destination file + hFile = FileOpen(strDstFile, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE); + if (hFile == 0) + { + FastDebugMsg(String("FileCopy: FileOpen failed on Dst file %s", strDstFile)); + return(FALSE); + } + + // write buffer to the destination file + if (!FileWrite(hFile, pBuffer, uiSize, &uiBytesWritten)) + { + FastDebugMsg(String("FileCopy: FileWrite failed, file %s", strDstFile)); + FileClose(hFile); + return(FALSE); + } + + // close destination file + FileClose(hFile); + + + MemFree(pBuffer); + pBuffer = NULL; + return(TRUE); +*/ +} + +BOOLEAN FileMove(STR strOldName, STR strNewName) +{ + // rename + return(MoveFile(strOldName, strNewName)); +} + +//Additions by Kris Morness +BOOLEAN FileSetAttributes( STR strFilename, UINT32 uiNewAttribs ) +{ + UINT32 uiFileAttrib = 0; + + if( uiNewAttribs & FILE_ATTRIBUTES_ARCHIVE ) + uiFileAttrib |= FILE_ATTRIBUTE_ARCHIVE; + + if( uiNewAttribs & FILE_ATTRIBUTES_HIDDEN ) + uiFileAttrib |= FILE_ATTRIBUTE_HIDDEN; + + if( uiNewAttribs & FILE_ATTRIBUTES_NORMAL ) + uiFileAttrib |= FILE_ATTRIBUTE_NORMAL; + + if( uiNewAttribs & FILE_ATTRIBUTES_OFFLINE ) + uiFileAttrib |= FILE_ATTRIBUTE_OFFLINE; + + if( uiNewAttribs & FILE_ATTRIBUTES_READONLY ) + uiFileAttrib |= FILE_ATTRIBUTE_READONLY; + + if( uiNewAttribs & FILE_ATTRIBUTES_SYSTEM ) + uiFileAttrib |= FILE_ATTRIBUTE_SYSTEM; + + if( uiNewAttribs & FILE_ATTRIBUTES_TEMPORARY ) + uiFileAttrib |= FILE_ATTRIBUTE_TEMPORARY; + + return SetFileAttributes( strFilename, uiFileAttrib ); +} + + +UINT32 FileGetAttributes( STR strFilename ) +{ + UINT32 uiAttribs = 0; + UINT32 uiFileAttrib = 0; + + uiAttribs = GetFileAttributes( strFilename ); + + if( uiAttribs == 0xFFFFFFFF ) + return( uiAttribs ); + + if( uiAttribs & FILE_ATTRIBUTE_ARCHIVE ) + uiFileAttrib |= FILE_ATTRIBUTES_ARCHIVE; + + if( uiAttribs & FILE_ATTRIBUTE_HIDDEN ) + uiFileAttrib |= FILE_ATTRIBUTES_HIDDEN; + + if( uiAttribs & FILE_ATTRIBUTE_NORMAL ) + uiFileAttrib |= FILE_ATTRIBUTES_NORMAL; + + if( uiAttribs & FILE_ATTRIBUTE_OFFLINE ) + uiFileAttrib |= FILE_ATTRIBUTES_OFFLINE; + + if( uiAttribs & FILE_ATTRIBUTE_READONLY ) + uiFileAttrib |= FILE_ATTRIBUTES_READONLY; + + if( uiAttribs & FILE_ATTRIBUTE_SYSTEM ) + uiFileAttrib |= FILE_ATTRIBUTES_SYSTEM; + + if( uiAttribs & FILE_ATTRIBUTE_TEMPORARY ) + uiFileAttrib |= FILE_ATTRIBUTES_TEMPORARY; + + if( uiAttribs & FILE_ATTRIBUTE_DIRECTORY ) + uiFileAttrib |= FILE_ATTRIBUTES_DIRECTORY; + + + + return( uiFileAttrib ); +} + +BOOLEAN FileClearAttributes( STR strFilename ) +{ + return SetFileAttributes( (LPCSTR) strFilename, FILE_ATTRIBUTE_NORMAL ); +} + + +//returns true if at end of file, else false +BOOLEAN FileCheckEndOfFile( HWFILE hFile ) +{ + INT16 sLibraryID; + UINT32 uiFileNum; + HANDLE hRealFile; +// UINT8 Data; + UINT32 uiNumberOfBytesRead=0; + UINT32 uiOldFilePtrLoc=0; + UINT32 uiEndOfFilePtrLoc=0; + UINT32 temp=0; + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + //if its a real file, read the data from the file + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + //Get the handle to the real file + hRealFile = gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle; + + //Get the current position of the file pointer + uiOldFilePtrLoc = SetFilePointer( hRealFile, 0, NULL, FILE_CURRENT ); + + //Get the end of file ptr location + uiEndOfFilePtrLoc = SetFilePointer( hRealFile, 0, NULL, FILE_END ); + + //reset back to the original location + temp = SetFilePointer( hRealFile, -( (INT32)( uiEndOfFilePtrLoc - uiOldFilePtrLoc ) ), NULL, FILE_END ); + + //if the 2 pointers are the same, we are at the end of a file + if( uiEndOfFilePtrLoc <= uiOldFilePtrLoc ) + { + return( 1 ); + } + } + + //else it is a library file + else + { + //if the database is initialized + if( gFileDataBase.fInitialized ) + { + //if the library is open + if( IsLibraryOpened( sLibraryID ) ) + { + //if the file is opened + if( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].uiFileID != 0 ) + { + UINT32 uiLength; //uiOffsetInLibrary +// HANDLE hLibraryFile; +// UINT32 uiNumBytesRead; + UINT32 uiCurPos; + + uiLength = gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].pFileHeader->uiFileLength; + uiCurPos = gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].uiFilePosInFile; + + //if we are trying to read more data then the size of the file, return an error + if( uiCurPos >= uiLength ) + { + return( TRUE ); + } + } + } + } + } + + //we are not and the end of a file + return( 0 ); +} + + + +BOOLEAN GetFileManFileTime( HWFILE hFile, SGP_FILETIME *pCreationTime, SGP_FILETIME *pLastAccessedTime, SGP_FILETIME *pLastWriteTime ) +{ + HANDLE hRealFile; + INT16 sLibraryID; + UINT32 uiFileNum; + + FILETIME sCreationUtcFileTime; + FILETIME sLastAccessedUtcFileTime; + FILETIME sLastWriteUtcFileTime; + + //Initialize the passed in variables + memset( pCreationTime, 0, sizeof( SGP_FILETIME ) ); + memset( pLastAccessedTime, 0, sizeof( SGP_FILETIME ) ); + memset( pLastWriteTime, 0, sizeof( SGP_FILETIME ) ); + + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + //if its a real file, read the data from the file + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + //get the real file handle to the file + hRealFile = gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle; + + //Gets the UTC file time for the 'real' file + GetFileTime( hRealFile, &sCreationUtcFileTime, &sLastAccessedUtcFileTime, &sLastWriteUtcFileTime ); + + //converts the creation UTC file time to the current time used for the file + FileTimeToLocalFileTime( &sCreationUtcFileTime, pCreationTime ); + + //converts the accessed UTC file time to the current time used for the file + FileTimeToLocalFileTime( &sLastAccessedUtcFileTime, pLastAccessedTime ); + + //converts the write UTC file time to the current time used for the file + FileTimeToLocalFileTime( &sLastWriteUtcFileTime, pLastWriteTime ); + } + else + { + //if the database is initialized + if( gFileDataBase.fInitialized ) + { + //if the library is open + if( IsLibraryOpened( sLibraryID ) ) + { + //if the file is opened + if( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].uiFileID != 0 ) + { + if( !GetLibraryFileTime( sLibraryID, uiFileNum, pLastWriteTime ) ) + { + return( FALSE ); + } + } + } + } + } + + return( TRUE ); +} + + +INT32 CompareSGPFileTimes( SGP_FILETIME *pFirstFileTime, SGP_FILETIME *pSecondFileTime ) +{ + return( CompareFileTime( pFirstFileTime, pSecondFileTime ) ); +} + +UINT32 FileSize(STR strFilename) +{ +HWFILE hFile; +UINT32 uiSize; + + if((hFile=FileOpen(strFilename, FILE_OPEN_EXISTING | FILE_ACCESS_READ, FALSE))==0) + return(0); + + uiSize=FileGetSize(hFile); + FileClose(hFile); + + return(uiSize); +} + + + +HANDLE GetRealFileHandleFromFileManFileHandle( HWFILE hFile ) +{ + INT16 sLibraryID; + UINT32 uiFileNum; + + GetLibraryAndFileIDFromLibraryFileHandle( hFile, &sLibraryID, &uiFileNum ); + + //if its the 'real file' library + if( sLibraryID == REAL_FILE_LIBRARY_ID ) + { + //if its not already closed + if( gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].uiFileID != 0 ) + { + return( gFileDataBase.RealFiles.pRealFilesOpen[ uiFileNum ].hRealFileHandle ); + } + } + else + { + //if the file is not opened, dont close it + if( gFileDataBase.pLibraries[ sLibraryID ].pOpenFiles[ uiFileNum ].uiFileID != 0 ) + { + return( gFileDataBase.pLibraries[ sLibraryID ].hLibraryHandle ); + } + } + return( 0 ); +} + +//************************************************************************** +// +// AddSubdirectoryToPath +// +// Puts a subdirectory of the current working directory into the current +// task's system path. +// +// Parameter List : +// Return Value : +// Modification history : +// +// 10June98:DB -> creation +// +//************************************************************************** +BOOLEAN AddSubdirectoryToPath(CHAR8 *pDirectory) +{ +CHAR8 *pSystemPath; +CHAR8 *pPath; +UINT32 uiPathLen; + + // Check for NULL + if(!pDirectory) + return(FALSE); + + // Check for zero length string + if(!strlen(pDirectory)) + return(FALSE); + + if((pSystemPath=(CHAR8 *)MemAlloc(_MAX_PATH))==NULL) + return(FALSE); + + memset(pSystemPath, 0, _MAX_PATH); + + if((pPath=(CHAR8 *)MemAlloc(_MAX_PATH))==NULL) + { + MemFree(pSystemPath); + return(FALSE); + } + + memset(pPath, 0, _MAX_PATH); + + // Builds a path to the directory with the SR DLL files. + _getcwd(pPath, _MAX_PATH); + uiPathLen=strlen(pPath); + if(uiPathLen) + uiPathLen--; + if(pPath[uiPathLen]!='\\') + strcat(pPath, "\\"); + + strcat(pPath, pDirectory); + + // Appends it to the path for the current task + if(GetEnvironmentVariable("PATH", pSystemPath, _MAX_PATH)) + { + strcat(pSystemPath, ";"); + strcat(pSystemPath, pPath); + SetEnvironmentVariable("PATH", pSystemPath); + MemFree(pSystemPath); + MemFree(pPath); + return(TRUE); + } + else + { + MemFree(pSystemPath); + MemFree(pPath); + return(FALSE); + } + +} + + +UINT32 GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( ) +{ + STRING512 zExecDir; + STRING512 zDrive; + STRING512 zDir; + STRING512 zFileName; + STRING512 zExt; + + UINT32 uiFreeSpace = 0; + + GetExecutableDirectory( zExecDir ); + + //get the drive letter from the exec dir + _splitpath( zExecDir, zDrive, zDir, zFileName, zExt); + + sprintf( zDrive, "%s\\", zDrive ); + + uiFreeSpace = GetFreeSpaceOnHardDrive( zDrive ); + + return( uiFreeSpace ); +} + + + + +UINT32 GetFreeSpaceOnHardDrive( STR pzDriveLetter ) +{ + UINT32 uiBytesFree=0; + + UINT32 uiSectorsPerCluster=0; + UINT32 uiBytesPerSector=0; + UINT32 uiNumberOfFreeClusters=0; + UINT32 uiTotalNumberOfClusters=0; + + if( !GetDiskFreeSpace( pzDriveLetter, (LPDWORD) &uiSectorsPerCluster, (LPDWORD) &uiBytesPerSector, + (LPDWORD) &uiNumberOfFreeClusters, (LPDWORD) &uiTotalNumberOfClusters ) ) + { + UINT32 uiLastError = GetLastError(); + char zString[1024]; + FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, 0, uiLastError, 0, zString, 1024, NULL); + + return( TRUE ); + } + + uiBytesFree = uiBytesPerSector * uiNumberOfFreeClusters * uiSectorsPerCluster; + + return( uiBytesFree ); +} + diff --git a/Standard Gaming Platform/FileMan.h b/Standard Gaming Platform/FileMan.h new file mode 100644 index 00000000..6d32abcb --- /dev/null +++ b/Standard Gaming Platform/FileMan.h @@ -0,0 +1,199 @@ +//************************************************************************** +// +// Filename : FileMan.h +// +// Purpose : prototypes for the file manager +// +// Modification history : +// +// 24sep96:HJH - Creation +// +//************************************************************************** + +#ifndef _FILEMAN_H +#define _FILEMAN_H + +//************************************************************************** +// +// Includes +// +//************************************************************************** + +#include "types.h" + +#include "Windows.h" + +#include "FileCat.h" + +//************************************************************************** +// +// Defines +// +//************************************************************************** + +#define MAX_FILENAME_LEN 48 + +#define FILE_ACCESS_READ 0x01 +#define FILE_ACCESS_WRITE 0x02 +#define FILE_ACCESS_READWRITE 0x03 + +#define FILE_CREATE_NEW 0x0010 // create new file. fail if exists +#define FILE_CREATE_ALWAYS 0x0020 // create new file. overwrite existing +#define FILE_OPEN_EXISTING 0x0040 // open a file. fail if doesn't exist +#define FILE_OPEN_ALWAYS 0x0080 // open a file, create if doesn't exist +#define FILE_TRUNCATE_EXISTING 0x0100 // open a file, truncate to size 0. fail if no exist + +#define FILE_SEEK_FROM_START 0x01 // keep in sync with dbman.h +#define FILE_SEEK_FROM_END 0x02 // keep in sync with dbman.h +#define FILE_SEEK_FROM_CURRENT 0x04 // keep in sync with dbman.h + +// GetFile file attributes +#define FILE_IS_READONLY 1 +#define FILE_IS_DIRECTORY 2 +#define FILE_IS_HIDDEN 4 +#define FILE_IS_NORMAL 8 +#define FILE_IS_ARCHIVE 16 +#define FILE_IS_SYSTEM 32 +#define FILE_IS_TEMPORARY 64 +#define FILE_IS_COMPRESSED 128 +#define FILE_IS_OFFLINE 256 + + + +//File Attributes settings +#define FILE_ATTRIBUTES_ARCHIVE FILE_ATTRIBUTE_ARCHIVE +#define FILE_ATTRIBUTES_HIDDEN FILE_ATTRIBUTE_HIDDEN +#define FILE_ATTRIBUTES_NORMAL FILE_ATTRIBUTE_NORMAL +#define FILE_ATTRIBUTES_OFFLINE FILE_ATTRIBUTE_OFFLINE +#define FILE_ATTRIBUTES_READONLY FILE_ATTRIBUTE_READONLY +#define FILE_ATTRIBUTES_SYSTEM FILE_ATTRIBUTE_SYSTEM +#define FILE_ATTRIBUTES_TEMPORARY FILE_ATTRIBUTE_TEMPORARY +#define FILE_ATTRIBUTES_DIRECTORY FILE_ATTRIBUTE_DIRECTORY + +// Snap, Kaiden: This define duplicates a standard MFC define +// Added to resolve some intractable issue with MSVC6 +#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) + +typedef FILETIME SGP_FILETIME; + +//************************************************************************** +// +// Globals +// +//************************************************************************** + +// Snap: At program launch we build two directory catalogues: +// one for the default Data directory, the other for the custom Data directory. +extern TFileCat gDefaultDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) +extern TFileCat gCustomDataCat; // Init in InitializeStandardGamingPlatform (sgp.cpp) + +//************************************************************************** +// +// Function Prototypes +// +//************************************************************************** +/* +#ifdef __cplusplus +extern "C" { +#endif +*/ + +extern BOOLEAN InitializeFileManager( STR strIndexFilename ); + +extern void ShutdownFileManager( void ); +extern void FileDebug( BOOLEAN f ); + + +BOOLEAN FileExists( STR strFilename ); +extern BOOLEAN FileExistsNoDB( STR strFilename ); +extern BOOLEAN FileDelete( STR strFilename ); +extern HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose ); + +extern void FileClose( HWFILE ); + +extern BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); +extern BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBytesWritten ); +extern BOOLEAN FileLoad( STR filename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiBytesRead ); + +extern BOOLEAN _cdecl FilePrintf( HWFILE hFile, char * strFormatted, ... ); + +extern BOOLEAN FileSeek( HWFILE, UINT32 uiDistance, UINT8 uiHow ); +extern INT32 FileGetPos( HWFILE ); + +extern UINT32 FileGetSize( HWFILE ); +extern UINT32 FileSize(STR strFilename); + +BOOLEAN SetFileManCurrentDirectory( STR pcDirectory ); +BOOLEAN GetFileManCurrentDirectory( STRING512 pcDirectory ); +BOOLEAN GetExecutableDirectory( STRING512 pcDirectory ); + +BOOLEAN DirectoryExists( STRING512 pcDirectory ); +BOOLEAN MakeFileManDirectory( STRING512 pcDirectory ); + +// WARNING: THESE DELETE ALL FILES IN THE DIRECTORY ( and all subdirectories if fRecursive is TRUE!! ) +BOOLEAN RemoveFileManDirectory( STRING512 pcDirectory, BOOLEAN fRecursive); +BOOLEAN EraseDirectory( STRING512 pcDirectory); + +typedef struct _GETFILESTRUCT_TAG { + INT32 iFindHandle; + CHAR8 zFileName[ 260 ]; // changed from UINT16, Alex Meduna, Mar-20'98 + UINT32 uiFileSize; + UINT32 uiFileAttribs; +} GETFILESTRUCT; + +BOOLEAN GetFileFirst( CHAR8 * pSpec, GETFILESTRUCT *pGFStruct ); + +BOOLEAN GetFileNext( GETFILESTRUCT *pGFStruct ); +void GetFileClose( GETFILESTRUCT *pGFStruct ); + +BOOLEAN FileCopy(STR strSrcFile, STR strDstFile, BOOLEAN fFailIfExists); +BOOLEAN FileMove(STR strOldName, STR strNewName); + +//Added by Kris Morness +BOOLEAN FileSetAttributes( STR filename, UINT32 uiNewAttribs ); +UINT32 FileGetAttributes( STR filename ); + +BOOLEAN FileClearAttributes( STR strFilename ); + +//returns true if at end of file, else false +BOOLEAN FileCheckEndOfFile( HWFILE hFile ); + + + +BOOLEAN GetFileManFileTime( HWFILE hFile, SGP_FILETIME *pCreationTime, SGP_FILETIME *pLastAccessedTime, SGP_FILETIME *pLastWriteTime ); + + + + + +// CompareSGPFileTimes() returns... +// -1 if the First file time is less than second file time. ( first file is older ) +// 0 First file time is equal to second file time. +// +1 First file time is greater than second file time ( first file is newer ). +INT32 CompareSGPFileTimes( SGP_FILETIME *pFirstFileTime, SGP_FILETIME *pSecondFileTime ); + +// One call comparison of file times, allowing for a certain leeway in cases where +// files times may be slightly different due to SourceSafe of copying +BOOLEAN FileIsOlderThanFile(CHAR8 *pcFileName1, CHAR8 *pcFileName2, UINT32 ulNumSeconds); + +// Pass in the Fileman file handle of an OPEN file and it will return.. +// if its a Real File, the return will be the handle of the REAL file +// if its a LIBRARY file, the return will be the handle of the LIBRARY +HANDLE GetRealFileHandleFromFileManFileHandle( HWFILE hFile ); + +BOOLEAN AddSubdirectoryToPath(CHAR8 *pDirectory); + + +//Gets the amount of free space on the hard drive that the main executeablt is runnning from +UINT32 GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( ); + +//Gets the free hard drive space from the drive letter passed in. It has to be the root dir. ( eg. c:\ ) +UINT32 GetFreeSpaceOnHardDrive( STR pzDriveLetter ); + +/* +#ifdef __cplusplus +} +#endif +*/ + +#endif diff --git a/Standard Gaming Platform/Flic.cpp b/Standard Gaming Platform/Flic.cpp new file mode 100644 index 00000000..5a0c5e7c --- /dev/null +++ b/Standard Gaming Platform/Flic.cpp @@ -0,0 +1,1699 @@ +//************************************************************************** +// +// Filename : flic.c +// +// Purpose : Display System for .flc and .fli Flic Files +// +// This program is derived from the program decribed in the article "The +// Flic File Format" on page 18 of the March 1993 edition of Dr. Dobb's +// Journal. It was restructured from the top down to meet the +// requirements of Sir-Tech. The high level routines were designed to +// provided easy integration with existing applications. Except for a few +// identifiers, the low level routines were not modified. +// +// All of the code for these routines in contained in this file and the +// file "flic.h". +// +// Modification history : +// +// 06-09-94:??? - Creation +// ???:David Smoth - ??? +// ???:Bret Rowdon for RIO/GORGE - added 640x480 SVGA support +// 05-11jun96:HJH - added routines for bitmap use, and +// other utilities +// 08-May-97 ARM Adapted for Win95 Standard Gaming Platform +// +//************************************************************************** + +//************************************************************************** +// +// Includes +// +//************************************************************************** + +//#include "stdafx.h" +#include +#include "flic.h" +#include "windows.h" +#include "types.h" +#include "wcheck.h" + +//************************************************************************** +// +// Variables +// +//************************************************************************** + +//Flic flic; +char pcxbuf[(640*480)]; +char FlicPal[768]; + +//extern char buffer[(640*480)]; +//extern char buffer2[(640*480)]; + +//************************************************************************** +// +// Function prototypes. +// +//************************************************************************** + +static ErrCode flic_next_frame(Flic *flic, BOOL fDecode); + +//************************************************************************** +// +// Functions +// +//************************************************************************** + +//************************************************************************** +// +// Low level Functions +// +//************************************************************************** + +//************************************************************************** +// +// screen_put_dot +// +// Set one dot. +// +// Parameter List : +// Return Value : +// Modification history : +// +//************************************************************************** + +static void screen_put_dot(FlicScreen *s, int x, int y, Pixel color) +{ + // First clip it. + if (x < 0 || y < 0 || x >= s->width || y >= s->height) + return; + + // Then set it. + s->pixels[(unsigned)(s->height-y-1) * s->width + x] = color; +} + +//************************************************************************** +// +// line_clip +// +// Clip a horizontal line segment so that it fits on the screen. +// Return FALSE if clipped out entirely. +// +// Parameter List : +// Return Value : +// Modification history : +// +//************************************************************************** + +static Boolean line_clip(FlicScreen *s, int *px, int *py, int *pwidth) +{ + int x = *px; + int y = *py; + int width = *pwidth; + int xend = x + width; + + if (y < 0 || y >= s->height || xend < 0 || x >= s->width) + return FALSE; /* Clipped off screen. */ + if (x < 0) + { + *pwidth = width = width + x; /* and shortens width. */ + *px = 0; + } + if (xend > s->width) + { + *pwidth = width = width - (xend - s->width); + } + if (width < 0) + return FALSE; + return TRUE; +} + +//************************************************************************** +// +// oldscreen_copy_seg +// +// Copy pixels from memory into screen. +// +// Parameter List : +// Return Value : +// Modification history : +// +//************************************************************************** + +static void oldscreen_copy_seg(FlicScreen *s, int x, int y, Pixel *pixels, int count) +{ + Pixel *pt; + //int xend; + int unclipped_x = x; + int dx; + + // First let's do some clipping. + if (!line_clip(s, &x, &y, &count)) + return; + + dx = x - unclipped_x; // Clipping change in start position. + if (dx != 0) + pixels += dx; // Advance over clipped pixels. + + // Calculate start screen address. + //pt = s->pixels + (unsigned)y * (unsigned)s->width + (unsigned)x; + pt = s->pixels + (unsigned)(s->height-y-1) * (unsigned)s->width + (unsigned)x; + + // Copy pixels to display. + while (--count >= 0) + *pt++ = *pixels++; +} + +//************************************************************************** +// +// screen_repeat_one +// +// Draw a horizontal line of a solid color +// +// Parameter List : +// +// FlicScreen *s -> screen to write to +// int x -> x position to write to +// int y -> y position to write to +// Pixel color -> colour to write +// int count -> how many times to write +// +// Return Value : +// +// Modification history : +// +// 01jun96:HJH -> reversed the screen up and down so that the +// bitmaps wouldn't come out upside down (I put in +// the "s->height -") +// +//************************************************************************** + +static void screen_repeat_one(FlicScreen *s, int x, int y, Pixel color, int count) +{ + Pixel *pt; + + // First let's do some clipping. + if (!line_clip(s, &x, &y, &count)) + return; + + // Calculate start screen address. + pt = s->pixels + (unsigned)(s->height-y-1) * (unsigned)s->width + (unsigned)x; + + // Repeat pixel on display. + while (--count >= 0) + *pt++ = color; +} + +//************************************************************************** +// +// screen_repeat_two +// +// Repeat 2 pixels count times on screen. +// +// Parameter List : +// Return Value : +// Modification history : +// +//************************************************************************** + +static void screen_repeat_two(FlicScreen *s, int x, int y, Pixels2 pixels2, int count) +{ + Pixels2 *pt; + int is_odd; + + // First let's do some clipping. + count <<= 1; // Convert from word to pixel count. + if (!line_clip(s, &x, &y, &count)) + return; + is_odd = (count&1); // Did it turn odd after clipping? Ack! + count >>= 1; // Convert back to word count. + + // Calculate start screen address. + pt = (Pixels2 *)(s->pixels + (unsigned)(s->height-y-1) * (unsigned)s->width + (unsigned)x); + + while (--count >= 0) // Go set screen 2 pixels at a time. + *pt++ = pixels2; + + if (is_odd) // Deal with pixel at end of screen if needed. + { + Pixel *end = (Pixel *)pt; + *end = pixels2.pixels[0]; + } +} + +//************************************************************************** +// +// screen_put_colors +// +// Set count colors in color map starting at start. RGB values +// go from 0 to 255. +// +// Parameter List : +// +// FlicScreen *s -> screen data +// int start -> start position +// Colour *colors -> the colors, of course +// int count -> how many +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static void screen_put_colors(FlicScreen *s, int start, Colour *colors, int count) +{ + int end = start + count; + int ix; + + for (ix = start; ix < end; ++ix) + { + FlicPal[ix*3]=colors->r>>2; + FlicPal[ix*3+1]=colors->g>>2; + FlicPal[ix*3+2]=colors->b>>2; + ++colors; + } +} + +//************************************************************************** +// +// screen_put_colors_64 +// +// Set count colors in color map starting at start. RGB values +// go from 0 to 64. */ +// +// Parameter List : +// +// FlicScreen *s -> screen data +// int start -> start position +// Colour *colors -> the colors, of course +// int count -> how many +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static void screen_put_colors_64(FlicScreen *s, int start, Colour *colors, int count) +{ + int end = start + count; + int ix; + + for (ix = start; ix < end; ++ix) + { + FlicPal[ix*3]=colors->r; + FlicPal[ix*3+1]=colors->g; + FlicPal[ix*3+2]=colors->b; + + ++colors; + } +} + +//************************************************************************** +// +// decode_byte_run +// +// Byte-run-length decompression. +// +// Parameter List : +// +// Uchar *data -> data to be decoded +// Flic *flic -> flic data containing where to decode to +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static void decode_byte_run(Uchar *data, Flic *flic) +{ + int x,y; + int width = flic->head.width; + int height = flic->head.height; + int psize; // was char -> HJH + Char *cpt = (Char *)data; + int end; + + y = flic->yoff; + end = flic->xoff + width; + while (--height >= 0) + { + x = flic->xoff; + cpt += 1; /* skip over obsolete opcount byte */ + psize = 0; + while ((x+=psize) < end) + { + psize = (char)(*cpt++); + if (psize >= 0) + { + screen_repeat_one(&flic->screen, x, y, *cpt++, psize); + } + else + { + psize = -psize; + oldscreen_copy_seg(&(flic->screen),(long) x,(long) y, (unsigned char *)cpt, (long)psize); + cpt += psize; + } + } + y++; + } +} + +//************************************************************************** +// +// decode_delta_fli +// +// Fli style delta decompression. +// +// Parameter List : +// +// Uchar *data -> data to be decoded +// Flic *flic -> flic data containing where to decode to +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static void decode_delta_fli(Uchar *data, Flic *flic) +{ + int xorg = flic->xoff; + int yorg = flic->yoff; + Short *wpt = (Short *)data; + Uchar *cpt = (Uchar *)(wpt + 2); + int x,y; + Short lines; + Uchar opcount; + Char psize; + + y = yorg + *wpt++; + lines = *wpt; + while (--lines >= 0) + { + x = xorg; + opcount = *cpt++; + while (opcount > 0) + { + x += *cpt++; + psize = *cpt++; + if (psize < 0) + { + psize = -psize; + screen_repeat_one(&flic->screen, x, y, *cpt++, psize); + x += psize; + opcount-=1; + } + else + { + oldscreen_copy_seg(&(flic->screen), (long)x, (long)y, (unsigned char *)cpt,(long) psize); + cpt += psize; + x += psize; + opcount -= 1; + } + } + y++; + } +} + +//************************************************************************** +// +// decode_delta_flc +// +// Flc-style delta decompression. The data is word oriented though +// a lot of the control info (how to skip, how many words to +// copy) are byte oriented still to save space. +// +// Parameter List : +// +// Uchar *data -> data to be decoded +// Flic *flic -> flic data containing where to decode to +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static void decode_delta_flc(Uchar *data, Flic *flic) +{ + int xorg = flic->xoff; + int yorg = flic->yoff; + int width = flic->head.width; + int x,y; + Short lp_count; + Short opcount; + int psize; + union {Short *w; Uchar *ub; Char *b; Pixels2 *p2;} wpt; + int lastx; + + + lastx = xorg + width - 1; + wpt.ub = data; + lp_count = *wpt.w++; + y = yorg; + goto LPACK; + +SKIPLINES: /* Advance over some lines. */ + y -= opcount; + +LPACK: /* do next line */ + if ((opcount = *wpt.w++) >= 0) + goto DO_SS2OPS; + if( ((Ushort)opcount) & 0x4000) /* skip lines */ + goto SKIPLINES; + screen_put_dot(&flic->screen,(Uchar)opcount,lastx,(Pixel)y); /* put dot at eol with low byte */ + if((opcount = *wpt.w++) == 0) + { + ++y; + if (--lp_count > 0) + goto LPACK; + goto OUTT; + } +DO_SS2OPS: + x = xorg; + +PPACK: /* do next packet */ + x += *wpt.ub++; + psize = *wpt.b++; + if ((psize += psize) >= 0) + { + oldscreen_copy_seg(&(flic->screen), (long)x, (long)y, (unsigned char *)wpt.ub,(long) psize); + x += psize; + wpt.ub += psize; + if (--opcount != 0) + goto PPACK; + ++y; + if (--lp_count > 0) + goto LPACK; + } + else + { + psize = -psize; + screen_repeat_two(&flic->screen, x, y, *wpt.p2++, psize>>1); + x += psize; + if (--opcount != 0) + goto PPACK; + ++y; + if (--lp_count > 0) + goto LPACK; + } +OUTT: + return; +} + +//************************************************************************** +// +// decode_black +// +// Decode a BLACK chunk. Set frame to solid color 0 one +// line at a time. +// +// Parameter List : +// +// Uchar *data -> data to be decoded +// Flic *flic -> flic data containing where to decode to +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static void decode_black(Uchar *data, Flic *flic) +{ + Pixels2 black; + int i; + int height = flic->head.height; + int width = flic->head.width; + int x = flic->xoff; + int y = flic->yoff; + + black.pixels[0] = black.pixels[1] = 0; + for (i=0; iscreen, x, y+i, black, width/2); + if (width & 1) /* if odd set last pixel */ + screen_put_dot(&flic->screen, x+width-1, y+i, 0); + } +} + +//************************************************************************** +// +// decode_literal +// +// Decode a LITERAL chunk. Just copy data to screen one line at +// a time. +// +// Parameter List : +// +// Uchar *data -> data to be decoded +// Flic *flic -> flic data containing where to decode to +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static void decode_literal(Uchar *data, Flic *flic) +{ + int i; + int height = flic->head.height; + int width = flic->head.width; + int x = flic->xoff; + int y = flic->yoff; + + for (i=0; iscreen),(long) x,(long)(y+i), (unsigned char *)data,(long) width); + data += width; + } +} + + +typedef void ColorOut(FlicScreen *s, int start, Colour *colors, int count); + /* This is the type of output parameter to our decode_color below. + * Not coincedently screen_put_color is of this type. */ + + +//************************************************************************** +// +// decode_color +// +// Decode color map. Put results into output. The two color +// compressions are identical except for whether the RGB values +// are 0-63 or 0-255. Passing in an output that does the appropriate +// shifting on the way to the real pallete lets us use the same +// code for both COLOR_64 and COLOR_256 compression. +// +// Parameter List : +// +// Uchar *data -> data to decode +// Flic *flic -> the flic +// ColorOut *output -> place to put decoded data +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static void decode_color(Uchar *data, Flic *flic, ColorOut *output) +{ + int start = 0; + Uchar *cbuf = (Uchar *)data; + Short *wp = (Short *)cbuf; + Short ops; + int count; + + ops = *wp; + cbuf += sizeof(*wp); + while (--ops >= 0) + { + start += *cbuf++; + if ((count = *cbuf++) == 0) + count = 256; + (*output)(&flic->screen, start, (Colour *)cbuf, count); + cbuf += 3*count; + start += count; + } +} + +//************************************************************************** +// +// decode_color_256 +// +// Decode COLOR_256 chunk. +// +// Parameter List : +// +// Uchar *data -> data to decode +// Flic *flic -> the flic +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static void decode_color_256(Uchar *data, Flic *flic) +{ + decode_color(data, flic, screen_put_colors); +} + +//************************************************************************** +// +// decode_color_64 +// +// Decode COLOR_64 chunk. +// +// Parameter List : +// +// Uchar *data -> data to decode +// Flic *flic -> the flic +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static void decode_color_64(Uchar *data, Flic *flic) +{ + decode_color(data, flic, screen_put_colors_64); +} + +//************************************************************************** +// +// decode_frame +// +// Decode a frame that is in memory already into screen. +// Here we just loop through each chunk calling appropriate +// chunk decoder. +// +// Parameter List : +// +// Flic *flic -> the flic +// FrameHead *frame -> info about the frame +// Uchar *data -> data to decode +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static ErrCode decode_frame(Flic *flic, FrameHead *frame, Uchar *data) +{ + int i; + ChunkHead *chunk; + + for (i=0; ichunks; ++i) + { + chunk = (ChunkHead *)data; + data += chunk->size; + switch (chunk->type) + { + case COLOR_256: + if (flic->screen.change_palette) + //decode_color_256((Uchar *)(chunk+1), flic); + decode_color_256( (((Uchar *)chunk) + 4 ), flic); + break; + case DELTA_FLC: + decode_delta_flc((Uchar *)(chunk+1), flic); + break; + case COLOR_64: + if (flic->screen.change_palette) + decode_color_64((Uchar *)(chunk+1), flic); + break; + case DELTA_FLI: + decode_delta_fli((Uchar *)(chunk+1), flic); + break; + case BLACK_FRAME: + decode_black((Uchar *)(chunk+1), flic); + break; + case BYTE_RUN: + decode_byte_run((Uchar *)(chunk+1), flic); + break; + case LITERAL: + decode_literal((Uchar *)(chunk+1), flic); + break; + default: + break; + } + } + return 0; +} + +static ErrCode file_read_big_block(FILE *file, char *block, Ulong size) + /* Read in a big block. Could be bigger than 64K. */ +{ + char *pt = block; + unsigned size1; + + while (size != 0) + { + size1 = ((size > 0xFFF0) ? 0xFFF0 : size); + if ( fread(pt, size1, 1, file) != 1 ) + return ErrFlicRead; + pt += size1; // Advance pointer to next batch. + size -= size1; // Subtract current batch from size to go. + } + return 0; +} + +//************************************************************************** +// +// fill_in_frame2 +// +// This figures out where the second frame of the flic is +// (useful for playing in a loop). +// +// Parameter List : +// +// Flic *flic -> the flic +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static ErrCode fill_in_frame2(Flic *flic) +{ + FrameHead head; + //ErrCode err; + + (*flic->seek)(flic, flic->head.oframe1); + if ( fread(&head, sizeof(head), 1, flic->file) != 1 ) + return ErrFlicRead; + + if ( fread(&head, sizeof(head), 1, flic->file) != 1 ) + return ErrFlicRead; + + flic->head.oframe2 = flic->head.oframe1 + head.size; + + return 0; +} + +//************************************************************************** +// +// flic_next_frame +// +// Advance to next frame of flic. +// +// Parameter List : +// +// Flic *flic -> the flic +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static ErrCode flic_next_frame(Flic *flic, BOOL fDecode) +{ + FrameHead head; + ErrCode err = 0; + long size; + + if ( fread(&head, sizeof(head), 1, flic->file) != 1 ) + err = ErrFlicRead; + else + { + if (head.type == FRAME_TYPE) + { + size = head.size - sizeof(head); /* Don't include head. */ + if (size > 0) + { + if (size > 500000) + { + //TRACE("FLC chunk too big: %d\n",size); + //Assert(0); + FastDebugMsg(String("flic_next_frame: FLC chunk too big: %d", size)); + size = 64000; + } + if (!(err = file_read_big_block(flic->file, pcxbuf, size))) + { + if ( fDecode ) + err = decode_frame(flic, &head, (unsigned char *)pcxbuf); + } + } + } + else + err = ErrFlicBadFrame; + } + return err; +} + +//************************************************************************** +// +// flic_check_frame +// +// A dummy routine to be called for each frame. +// +// Parameter List : +// +// Flic *flic -> the flic +// +// Return Value : +// Modification history : +// +//************************************************************************** + +static Boolean flic_check_frame(Flic *flic) +{ + return TRUE; +} + +//************************************************************************** +// +// File io +// +//************************************************************************** + +static ErrCode flic_open(Flic *flic, const char *filename) +{ + return (flic->file = fopen(filename, "rb")) ? 0 : ErrFlicAccess; +} + +static ErrCode flic_seek(Flic *flic, long offset) +{ + return fseek(flic->file, offset, SEEK_SET) ? ErrFlicSeek : 0; +} + +//************************************************************************** +// +// FlicInit +// +// Initializes a flic object. +// +// Parameter List : +// +// Flic *flic -> the flic +// +// Return Value : +// Modification history : +// +//************************************************************************** + +void FlicInit(Flic *flic, unsigned screen_width, unsigned screen_height, char change_palette, char *Buff) +{ + flic->file = NULL; + //flic->lib.names = NULL; + + flic->open = flic_open; /* Set routines for single flick file access */ + flic->seek = flic_seek; + + flic->check_frame = flic_check_frame; /* Select a dummy routine */ + + /** Info used by low level routines */ + + flic->screen.pixels = (unsigned char *)Buff; // (char *) 0xa0000; + flic->screen.width = screen_width; + flic->screen.height = screen_height; + flic->screen.change_palette = change_palette; +} + +//************************************************************************** +// +// FlicOpen +// +// Opens a flic file or locates a flic file in a library. +// +// Parameter List : +// +// Flic *flic -> the flic +// const char *filename -> filename of flic to open +// +// Return Value : +// Modification history : +// +//************************************************************************** + +ErrCode FlicOpen(Flic *flic, const char *filename) +{ + ErrCode err; + + flic->xoff = flic->yoff = 0; + + if ( !(err = (*flic->open)(flic, filename)) ) + { + if (fread(&flic->head, sizeof(flic->head), 1, flic->file) != 1) + err = ErrFlicRead; + else + { + flic->name = filename; + + if (flic->head.type == FLC_TYPE) + { + /* Seek frame 1. */ + (*flic->seek)(flic, flic->head.oframe1); + return 0; + } + if (flic->head.type == FLI_TYPE) + { + long i; + /* Do some conversion work here. */ + flic->head.oframe1 = sizeof(flic->head); + i=flic->head.speed * 1000L; + flic->head.speed = i / 70; + return 0; + } + else + { + err = ErrFlicBad; + printf("flic was bad! \n"); + _getch(); + exit(0); + } + } + } + + FlicClose(flic); /* Close down and scrub partially opened flic. */ + return err; +} + +//************************************************************************** +// +// FlicSetOrigin +// +// Sets the location of the top left corner of the flic in terms of screen +// coordinates. +// +// Parameter List : +// +// Flic *flic -> the flic +// unsigned x -> x-coord of origin +// unsigned y -> y-coord of origin +// +// Return Value : +// Modification history : +// +//************************************************************************** + +void FlicSetOrigin(Flic *flic, unsigned x, unsigned y) +{ + flic->xoff = x; + flic->yoff = y; +} + +//************************************************************************** +// +// FlicClose +// +// Closes a flic file if one is open. If a library is open, this function has +// no effect. +// +// Parameter List : +// +// Flic *flic -> the flic +// +// Return Value : +// Modification history : +// +//************************************************************************** + +void FlicClose(Flic *flic) +{ + if ( flic->file ) + { + fclose(flic->file); + flic->file = NULL; + } +} + +//************************************************************************** +// +// flic_play_loop_timer +// +// This routine is called at the end of each timer period. The timer is used +// by the FlicPlay routine. The global variable timer_flag indicates that +// a time interval has elapsed. FlicPlay resets timer_flag for the next +// interval. +// +// Stack checking must be disabled. +// +// Parameter List : +// Return Value : +// Modification history : +// +//************************************************************************** + +#ifdef DEBUG +#pragma off (check_stack) +#endif + +static volatile int timer_flag=1; + +static void flic_play_loop_timer() +{ + timer_flag = 1; +} + +#ifdef DEBUG +#pragma on (check_stack) +#endif + +//************************************************************************** +// +// FlicPlay +// +// This is the engine for the flic display system. Call this function to +// display a flic. +// +// Parameter List : +// +// Flic *flic -> the flic +// +// Return Value : +// Modification history : +// +//************************************************************************** + +ErrCode FlicPlay(Flic *flic, Ulong max_loop) +{ +/* + ErrCode err; + HTIMER timer; + + flic->status.max_loop_count = max_loop; + flic->status.max_frame_index = flic->head.frames; + + if (flic->head.oframe2 == 0) + { + fill_in_frame2(flic); + // FastBlitRegionSVGA((char *)(0xa0000),(char *)(flic->screen.pixels),(long)0,(long)640,(long)480,(long)0,(long)640); + // BlitSVGAPage((char *)(flic->screen.pixels)); + // BlitRegionSVGATst((void *)0xa0000,(void *)(flic->screen.pixels),(long)640,(long)480,(long)640); + //BlitRegionSVGA((char *)0xa0000,(char *)flic->screen.pixels,(long)0,(long)640,(long)480,(long)0,(long)640); + } + + // Seek to first frame. + (*flic->seek)(flic, flic->head.oframe1); + // Save time to move on. + + //videoSetMode(3); + //printf("speed is %d\n",flic->head.speed); + //_getch(); + //exit(0); + + //timer = AIL_register_timer(flic_play_loop_timer); + //AIL_set_timer_period(timer, flic->head.speed* 1000); + //timer_flag = 0; + //AIL_start_timer(timer); + + // Display first frame. + if (err = flic_next_frame(flic, TRUE)) + { + //AIL_release_timer_handle(timer); + return err; + } + + for (flic->status.loop_count = 0; !max_loop || flic->status.loop_count < max_loop; + ++flic->status.loop_count) + { + // Seek to second frame + (*flic->seek)(flic, flic->head.oframe2); + // Loop from 2nd frame thru ring frame + for (flic->status.frame_index=0; + (flic->status.frame_index < (flic->head.frames-1)) || + ( (flic->status.frame_index < flic->head.frames) && + ( !max_loop || (flic->status.loop_count < (max_loop - 1)))); + ++flic->status.frame_index) + { + while (!timer_flag); + + if (err = flic_next_frame(flic, TRUE)) + return err; + //else + // FastBlitRegionSVGA((char *)(0xa0000),(char *)(flic->screen.pixels),(long)0,(long)640,(long)480,(long)0,(long)640); + // BlitSVGAPage((char *)(flic->screen.pixels)); + // BlitRegionSVGATst((void *)0xa0000,(void *)(flic->screen.pixels),(long)640,(long)480,(long)640); + // BlitRegionSVGA((char *)0xa0000,(char *)flic->screen.pixels,(long)0,(long)640,(long)480,(long)0,(long)640); + + timer_flag = 0; + } + } + + //AIL_release_timer_handle(timer); +*/ + return 0; +} + +void FlicSeekFirst(Flic *flic) +{ +// if (flic->head.oframe2 == 0) +// fill_in_frame2(flic); + + // Seek to first frame. + flic_seek(flic, flic->head.oframe1); + + // Display first frame. + //flic_next_frame(flic, TRUE); HJH + flic->status.frame_index=0;//1; HJH +} + +int FlicAdvance(Flic *flic, BOOL fDecode) +{ + // Seek to second frame + //(*flic->seek)(flic, flic->head.oframe2); + // Loop from 2nd frame thru ring frame + + // for (flic->status.frame_index=0; + // (flic->status.frame_index < (flic->head.frames-1)) || + // ( (flic->status.frame_index < flic->head.frames) && + // ( !max_loop || (flic->status.loop_count < (max_loop - 1)))); + // ++flic->status.frame_index) + // { + + if(flic->status.frame_index < flic->head.frames) + { + flic_next_frame(flic, fDecode); + flic->status.frame_index++; + //memcpy(buffer, buffer2, (HSIZE*VSIZE)); + return(1); + } + else + return(0); + + // if (flic->check_frame && !(*flic->check_frame)(flic)) + // return 0; +} + +static void center_flic(Flic *flic) + /* Set flic.xoff and flic.yoff so flic plays centered rather + * than in upper left corner of display. */ +{ + flic->xoff = (flic->screen.width - (signed)flic->head.width)/2; + flic->yoff = (flic->screen.height - (signed)flic->head.height)/2; +} + +void set_flic_origin(Flic *flic, int x, int y) +{ + flic->xoff = x; + flic->yoff = y; +} + +int frame_check(Flic *flic) +{ +/* + char key; + + if (Esc()) + { + //AbortScript = TRUE; + return 0; + } + + if (flic->status.frame_index == FlcSoundFrames[FlcSoundIndex][0]) + { + // if the "sound" number is less than 100, then it's a VOC buffer + if (FlcSoundFrames[FlcSoundIndex][1] < 100) + { + PlayVoc(FlcSoundFrames[FlcSoundIndex][1],-1); + } + else // otherwise a raw sound data file to be streamed off of disk + { + if (FlcSoundNameList[FlcSoundNameIndex][0]!='\0') + { + retcode = lmLibSeek(SNDLIBINFO,FlcSoundNameList[FlcSoundNameIndex++],&SNDoffset,&SNDlength); + if (retcode == 0) + StPlay(glbPlayRate,IGNORE_AUDIO_GAPS); + } + } + + // now that the sound has been triggered, ready the next frame number + FlcSoundIndex++; + } + else + if (FlcSoundFrames[FlcSoundIndex][0] == 9998) // start music? + { + PlayXmi(FlcSoundFrames[FlcSoundIndex++][1],FALSE); + XmiVolume(1,127,0); + } + RefreshSound(); +*/ + return 1; +} + +//************************************************************************** +// +// FlicStart +// +// Parameter List : +// +// char *filename -> filename of flic to start processing +// char *buffer -> screen buffer to put data into +// Flic *flic -> the flic +// int usepal -> flag - should we use the palette? (I think) +// +// Return Value : +// Modification history : +// +//************************************************************************** + +int FlicStart(char *filename, int width, int height, char *buffer, Flic *flic, char usepal) +{ + FlicInit(flic, width, height, usepal, buffer); + + if(FlicOpen(flic, filename)) + return(-1); + + FlicSetOrigin(flic, 0, 0); + FlicSeekFirst(flic); + FlicAdvance(flic, TRUE); // HJH - we go to 1st, then go process it + + //memcpy(buffer, buffer2, (HSIZE*VSIZE)); + + return(0); +} + +//************************************************************************** +// +// FlicStop +// +// Parameter List : +// +// Flic *flic -> the flic +// +// Return Value : +// Modification history : +// +//************************************************************************** + +void FlicStop(Flic *flic) +{ + FlicClose(flic); +} + +//************************************************************************** +// +// FlicGetStats +// +// Gets statistics for the given file. +// +// Parameter List : +// +// char *filename -> the flic filename +// Flic *flic -> the flic +// int *piBufferSize -> this function will fill in how large a +// buffer is needed to store a screen of +// this flick +// int *piColourPalSize->this function will fill in how large +// the colour palette is +// +// Return Value : +// +// ErrCode -> 0 if successfull, non-zero otherwise +// +// Modification history : +// +// 05jun96:HJH -> creation +// +//************************************************************************** + +ErrCode FlicGetStats(char *filename, int width, int height, Flic *flic, int *piBufferSize, int *piColourPalSize) +{ + ErrCode err=0; + FlicInit(flic, width, height, 1, NULL); + + flic->xoff = flic->yoff = 0; + + if ( !(err = (*flic->open)(flic, filename)) ) + { + if (fread(&flic->head, sizeof(flic->head), 1, flic->file) != 1) + err = ErrFlicRead; + } + + if ( !err && piBufferSize ) + *piBufferSize = flic->head.width * flic->head.height; + + FlicSeekChunk( flic, 0, COLOR_256, piColourPalSize ); + FlicClose(flic); /* Close down and scrub partially opened flic. */ + + return err; +} + +//************************************************************************** +// +// FlicGetColourPalette +// +// To get the colour palette from the given flic file. +// +// Parameter List : +// +// char *filename -> the flic file to extract the palette from +// char **ppBuffer -> the place to put the palette +// +// Return Value : +// +// ErrCode -> 0 if successful, non-zero otherwise +// +// Modification history : +// +// 10jun96:HJH -> creation +// 19jun96:HJH -> removed <<2 after colors->r/g/b +// +//************************************************************************** + +ErrCode FlicGetColourPalette(CHAR *filename, int width, int height, CHAR **ppBuffer, INT *piNumColours) +{ + Flic flic; + INT iBufferSize; + INT iColourPaletteSize=0; + ErrCode err = 0; + ChunkHead *chunk = NULL; + CHAR *pcPosition; + + if ( FlicGetStats( filename, width, height, &flic, &iBufferSize, &iColourPaletteSize ) ) + err = -1; + + if ( piNumColours ) + *piNumColours = iColourPaletteSize; + + if ( !err && iColourPaletteSize ) + { + FlicInit(&flic, flic.head.width, flic.head.height, 1, NULL); + + if(FlicOpen(&flic, filename)) + return(-1); + + FlicSetOrigin(&flic, 0, 0); + + *ppBuffer = (CHAR *)MemAlloc( iColourPaletteSize ); + chunk = (ChunkHead *)FlicSeekChunk( &flic, 0, COLOR_256, NULL ); + pcPosition = (CHAR *)(((BYTE *)chunk)+6); + + if ( chunk ) + { + INT ix, end, count, start = 0; + Uchar *cbuf = (Uchar *)pcPosition; + Short *wp = (Short *)cbuf; + Short ops; + Colour *colors; + + ops = *wp; + cbuf += sizeof(*wp); + while (--ops >= 0) + { + start += *cbuf++; + if ((count = *cbuf++) == 0) + count = 256; + { + colors = (Colour *)cbuf; + end = start + count; + + for (ix = start; ix < end; ++ix) + { + (*ppBuffer)[ix*3] =colors->r; + (*ppBuffer)[ix*3+1]=colors->g; + (*ppBuffer)[ix*3+2]=colors->b; + ++colors; + } + } + cbuf += 3*count; + start += count; + } + } + } + else + { + err = -1; + } + + return(err); +} + +//************************************************************************** +// +// FlicSeekChunk +// +// To seek to a particular chunk in the flic file. +// +// Parameter List : +// +// Flic *flic -> the flic to search +// INT iFrame -> frame in which to search +// ChunkTypes eType -> type of chunk to search for +// INT *piChunkSize-> the function puts the size of the chunk here +// +// Return Value : +// +// char * -> the returned chunk +// +// Modification history : +// +// 05jun96:HJH -> creation +// +//************************************************************************** + +CHAR *FlicSeekChunk(Flic *flic, INT iFrame, ChunkTypes eType, INT *piChunkSize) +{ + FrameHead head; + LONG lSize; + BOOL fFound = FALSE; + ErrCode err=0; + INT i; + + FlicSeekFirst(flic); + + for ( i=0 ; i