From ca2e5bc7e6e2ba571141445d43355ebfba40f342 Mon Sep 17 00:00:00 2001 From: Justin Marshall Date: Fri, 5 Jun 2020 18:49:43 -0700 Subject: [PATCH] SCENERIO_EDITOR now compiles. --- REDALERT/DEBUG.H | 43 - REDALERT/FUNCTION.H | 49 + REDALERT/GSCREEN.CPP | 1 - REDALERT/INIT.CPP | 2 +- REDALERT/MAPEDDLG.CPP | 6 +- REDALERT/MAPEDIT.CPP | 5 +- REDALERT/MAPEDIT.H | 1 + REDALERT/MAPEDTM.CPP | 8 +- REDALERT/MENUS.CPP | 3 + REDALERT/RedAlert.vcxproj | 11 +- REDALERT/TEAMTYPE.CPP | 8 +- REDALERT/TEAMTYPE.H | 2 +- REDALERT/TEVENT.H | 7 +- REDALERT/TRIGTYPE.CPP | 3031 +++++++++++++++++++------------------ REDALERT/TRIGTYPE.H | 5 +- REDALERT/VECTOR.H | 14 +- REDALERT/WINSTUB.CPP | 2 +- 17 files changed, 1614 insertions(+), 1584 deletions(-) diff --git a/REDALERT/DEBUG.H b/REDALERT/DEBUG.H index f8ac1ac..547e3a5 100644 --- a/REDALERT/DEBUG.H +++ b/REDALERT/DEBUG.H @@ -13,46 +13,3 @@ // GNU General Public License along with permitted additional restrictions // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection -#define TXT_CLEAR_MAP 0x3e8 // Clear the map -#define TXT_INHERIT_MAP 0x3e9 // Inherit previous map -#define TXT_SPECIAL_OPTIONS 0x3ea // Select Special Options -#define TXT_VISIBLE_TARGET 0x3eb // Targeting flash visible to -#define TXT_TREE_TARGET 0x3ec // Allow targeting of trees. -#define TXT_MCV_DEPLOY 0x3ed // Allow undeploy of -#define TXT_SMART_DEFENCE 0x3ee // Employ smarter self defense -#define TXT_SLOW_BUILD 0x3ef // Moderate production speed. -#define TXT_THREE_POINT 0x3f0 // Use three point turn logic. -#define TXT_TIBERIUM_GROWTH 0x3f1 // Ore will grow. -#define TXT_TIBERIUM_SPREAD 0x3f2 // Ore will spread. -#define TXT_ROAD_PIECES 0x3f3 // Disable building "bib" -#define TXT_SCATTER 0x3f4 // Allow running from -#define TXT_SHOW_NAMES 0x3f5 // Show true object names. -#define TXT_DEFENDER_ADVANTAGE 0x3f6 // Defender has the advantage. -#define TXT_SEPARATE_HELIPAD 0x3f7 // Allow separate helipad -#define TXT_PASSWORD_CAPTION 0x3f8 // Password Request -#define TXT_PASSWORD_MESSAGE 0x3f9 // Enter Red Alert access code -#define TXT_PASSWORD_ERROR 0x3fa // Access code error detected. -#define TXT_TRY_AGAIN 0x3fb // Try Again -#define TXT_MINE_AWARE 0x3fc // Friendly units avoid -#define TXT_TRIGGER_EDITOR 0x3fd // Trigger Editor -#define TXT_TRIGGER_JUST_EVENT 0x3fe // Just This Event -#define TXT_TRIGGER_AND 0x3ff // ... and ... -#define TXT_TRIGGER_OR 0x400 // ... or ... -#define TXT_TRIGGER_LINKED 0x401 // ... linked ... -#define TXT_TRIGGER_JUST_ACTION 0x402 // Just This Action -#define TXT_TEAM_EDIT 0x403 // Team Editor -#define TXT_SELLABLE 0x404 // Sellable -#define TXT_REBUILD 0x405 // Rebuild -#define TXT_SPEED_BUILD 0x406 // Building constructin time -#define TXT_SCENARIO_ERRORx 0x407 // Scenario authentication -#define TXT_DEBUG_STRESS 0x408 // ÚFrames:ÄÂF/R:ÂCPU:ÄÄÂF/R:ÄÄ -#define TXT_DEBUG_VEHICLE 0x409 // ÚFull -#define TXT_DEBUG_INFANTRY 0x40a // ÚFull -#define TXT_DEBUG_SHIP 0x40b // ÚFull -#define TXT_DEBUG_BUILDING 0x40c // ÚFull -#define TXT_DEBUG_PERFORMANCE 0x40d // Game Objects³ Drawing -#define TXT_DEBUG_AIRCRAFT 0x40e // ÚFull -#define TXT_DEBUG_HOUSE 0x40f // ÚFull Name:ÄÄÄÄÄÄÄÄÂAct -#define TXT_NO_PENTIUM 0x410 // **************************** -#define TXT_SIZE_MAP 0x411 // Size Map -#define TXT_TRUCK_CRATE 0x412 // Trucks drop crate when diff --git a/REDALERT/FUNCTION.H b/REDALERT/FUNCTION.H index 01a52f8..8d1d6de 100644 --- a/REDALERT/FUNCTION.H +++ b/REDALERT/FUNCTION.H @@ -1088,4 +1088,53 @@ void Enable_Uncompressed_Shapes (void); */ void On_Achievement_Event(const HouseClass* player_ptr, const char *achievement_type, const char *achievement_reason); +// jmarshall - editor +#define TXT_CLEAR_MAP 0x3e8 // Clear the map +#define TXT_INHERIT_MAP 0x3e9 // Inherit previous map +#define TXT_SPECIAL_OPTIONS 0x3ea // Select Special Options +#define TXT_VISIBLE_TARGET 0x3eb // Targeting flash visible to +#define TXT_TREE_TARGET 0x3ec // Allow targeting of trees. +#define TXT_MCV_DEPLOY 0x3ed // Allow undeploy of +#define TXT_SMART_DEFENCE 0x3ee // Employ smarter self defense +#define TXT_SLOW_BUILD 0x3ef // Moderate production speed. +#define TXT_THREE_POINT 0x3f0 // Use three point turn logic. +#define TXT_TIBERIUM_GROWTH 0x3f1 // Ore will grow. +#define TXT_TIBERIUM_SPREAD 0x3f2 // Ore will spread. +#define TXT_ROAD_PIECES 0x3f3 // Disable building "bib" +#define TXT_SCATTER 0x3f4 // Allow running from +#define TXT_SHOW_NAMES 0x3f5 // Show true object names. +#define TXT_DEFENDER_ADVANTAGE 0x3f6 // Defender has the advantage. +#define TXT_SEPARATE_HELIPAD 0x3f7 // Allow separate helipad +#define TXT_PASSWORD_CAPTION 0x3f8 // Password Request +#define TXT_PASSWORD_MESSAGE 0x3f9 // Enter Red Alert access code +#define TXT_PASSWORD_ERROR 0x3fa // Access code error detected. +#define TXT_TRY_AGAIN 0x3fb // Try Again +#define TXT_MINE_AWARE 0x3fc // Friendly units avoid +#define TXT_TRIGGER_EDITOR 0x3fd // Trigger Editor +#define TXT_TRIGGER_JUST_EVENT 0x3fe // Just This Event +#define TXT_TRIGGER_AND 0x3ff // ... and ... +#define TXT_TRIGGER_OR 0x400 // ... or ... +#define TXT_TRIGGER_LINKED 0x401 // ... linked ... +#define TXT_TRIGGER_JUST_ACTION 0x402 // Just This Action +#define TXT_TEAM_EDIT 0x403 // Team Editor +#define TXT_SELLABLE 0x404 // Sellable +#define TXT_REBUILD 0x405 // Rebuild +#define TXT_SPEED_BUILD 0x406 // Building constructin time +#define TXT_SCENARIO_ERRORx 0x407 // Scenario authentication +#define TXT_DEBUG_STRESS 0x408 // ÚFrames:ÄÂF/R:ÂCPU:ÄÄÂF/R:ÄÄ +#define TXT_DEBUG_VEHICLE 0x409 // ÚFull +#define TXT_DEBUG_INFANTRY 0x40a // ÚFull +#define TXT_DEBUG_SHIP 0x40b // ÚFull +#define TXT_DEBUG_BUILDING 0x40c // ÚFull +#define TXT_DEBUG_PERFORMANCE 0x40d // Game Objects³ Drawing +#define TXT_DEBUG_AIRCRAFT 0x40e // ÚFull +#define TXT_DEBUG_HOUSE 0x40f // ÚFull Name:ÄÄÄÄÄÄÄÄÂAct +#define TXT_NO_PENTIUM 0x410 // **************************** +#define TXT_SIZE_MAP 0x411 // Size Map +#define TXT_TRUCK_CRATE 0x412 // Trucks drop crate when + +extern const int NUM_EDIT_MISSIONS; + + + #endif \ No newline at end of file diff --git a/REDALERT/GSCREEN.CPP b/REDALERT/GSCREEN.CPP index 20532fc..e8e9195 100644 --- a/REDALERT/GSCREEN.CPP +++ b/REDALERT/GSCREEN.CPP @@ -394,7 +394,6 @@ void GScreenClass::Render(void) // IsToRedraw = true; //} - if (IsToUpdate || IsToRedraw) { BStart(BENCH_GSCREEN_RENDER); diff --git a/REDALERT/INIT.CPP b/REDALERT/INIT.CPP index 1dd8210..4a11d4e 100644 --- a/REDALERT/INIT.CPP +++ b/REDALERT/INIT.CPP @@ -3591,7 +3591,7 @@ static void Init_Keys(void) FastKey = ini.Get_PKey(true); #ifdef SCENARIO_EDITOR - SlowKey = ini.Get_PKey(false); + //SlowKey = ini.Get_PKey(false); #endif } diff --git a/REDALERT/MAPEDDLG.CPP b/REDALERT/MAPEDDLG.CPP index f75e990..9bdf3a3 100644 --- a/REDALERT/MAPEDDLG.CPP +++ b/REDALERT/MAPEDDLG.CPP @@ -2574,7 +2574,7 @@ int MapEditClass::Select_Trigger(void) */ ControlClass * commands = NULL; // the button list - TListClass > triggerlist(TRIGGER_LIST, D_LIST_X, D_LIST_Y, D_LIST_W, D_LIST_H, + TListClass triggerlist(TRIGGER_LIST, D_LIST_X, D_LIST_Y, D_LIST_W, D_LIST_H, TPF_EFNT|TPF_NOSHADOW, MFCD::Retrieve("EBTN-UP.SHP"), MFCD::Retrieve("EBTN-DN.SHP")); @@ -2610,7 +2610,7 @@ int MapEditClass::Select_Trigger(void) if (TriggerTypes.Count()==0) { CurTrigger = NULL; } else { - CurTrigger = triggerlist.Current_Item(); + CurTrigger = (TriggerTypeClass *)triggerlist.Current_Item(); // if (!CurTrigger) { // CurTrigger = &*triggerlist.Current_Item(); // } @@ -2660,7 +2660,7 @@ int MapEditClass::Select_Trigger(void) */ switch (input) { case (TRIGGER_LIST | KN_BUTTON): - CurTrigger = &*triggerlist.Current_Item(); + CurTrigger = (TriggerTypeClass *)&*triggerlist.Current_Item(); // CurTrigger = (TriggerTypeClass *)&*triggerlist.Current_Item(); break; diff --git a/REDALERT/MAPEDIT.CPP b/REDALERT/MAPEDIT.CPP index c064e7a..669b96a 100644 --- a/REDALERT/MAPEDIT.CPP +++ b/REDALERT/MAPEDIT.CPP @@ -73,7 +73,7 @@ MissionType MapEditClass::MapEditMissions[] = { MISSION_HUNT, MISSION_SLEEP, }; -#define NUM_EDIT_MISSIONS (sizeof(MapEditClass::MapEditMissions) / sizeof(MapEditClass::MapEditMissions[0])) +const int NUM_EDIT_MISSIONS = (sizeof(MapEditClass::MapEditMissions) / sizeof(MapEditClass::MapEditMissions[0])); /* @@ -1282,7 +1282,8 @@ void MapEditClass::AI(KeyNumType & input, int x, int y) /* ** Derive strength from current gauge reading */ - strength = CurrentObject[0]->Class_Of().MaxStrength * fixed(HealthGauge->Get_Value(), 256); + int val = fixed(HealthGauge->Get_Value(), 256); + strength = CurrentObject[0]->Class_Of().MaxStrength * val; // strength = Fixed_To_Cardinal((unsigned)CurrentObject[0]->Class_Of().MaxStrength, (unsigned)HealthGauge->Get_Value()); /* diff --git a/REDALERT/MAPEDIT.H b/REDALERT/MAPEDIT.H index c2e343a..19b8f20 100644 --- a/REDALERT/MAPEDIT.H +++ b/REDALERT/MAPEDIT.H @@ -335,6 +335,7 @@ class MapEditClass : public MouseClass static char HealthBuf[20]; GaugeClass *BaseGauge; TextLabelClass *BaseLabel; +public: static MissionType MapEditMissions[]; }; diff --git a/REDALERT/MAPEDTM.CPP b/REDALERT/MAPEDTM.CPP index 1ff3699..7c07909 100644 --- a/REDALERT/MAPEDTM.CPP +++ b/REDALERT/MAPEDTM.CPP @@ -251,7 +251,7 @@ int MapEditClass::Select_Team(char const * ) */ GadgetClass * commands = NULL; // the button list - TListClass > teamlist (TEAM_LIST, + TListClass teamlist (TEAM_LIST, D_LIST_X, D_LIST_Y, D_LIST_W, D_LIST_H, TPF_EFNT | TPF_NOSHADOW, MFCD::Retrieve("EBTN-UP.SHP"), @@ -280,11 +280,11 @@ int MapEditClass::Select_Team(char const * ) if (CurTeam) { teamlist.Set_Selected_Index(CurTeam); - CurTeam = teamlist.Current_Item(); + CurTeam = (TeamTypeClass *)teamlist.Current_Item(); } else { teamlist.Set_Selected_Index(0); if (TeamTypes.Count()) { - CurTeam = teamlist.Current_Item(); + CurTeam = (TeamTypeClass*)teamlist.Current_Item(); } } @@ -337,7 +337,7 @@ int MapEditClass::Select_Team(char const * ) */ switch (input) { case (TEAM_LIST | KN_BUTTON): - CurTeam = teamlist.Current_Item(); + CurTeam = (TeamTypeClass*)teamlist.Current_Item(); break; case (BUTTON_EDIT | KN_BUTTON): diff --git a/REDALERT/MENUS.CPP b/REDALERT/MENUS.CPP index a339111..e85c0cb 100644 --- a/REDALERT/MENUS.CPP +++ b/REDALERT/MENUS.CPP @@ -42,6 +42,9 @@ #include +#undef RESFACTOR +#define RESFACTOR (2 + (ScreenWidth / 640)) + /***************************** ** Function prototypes ******************************/ diff --git a/REDALERT/RedAlert.vcxproj b/REDALERT/RedAlert.vcxproj index 9d76d96..30cac57 100644 --- a/REDALERT/RedAlert.vcxproj +++ b/REDALERT/RedAlert.vcxproj @@ -95,13 +95,14 @@ ../external/dxsdk/Include;../external/ffmpeg-win32/include;../external/sdl2/include;./win32lib;../external/openal/include true false - WINDOWS_IGNORE_PACKING_MISMATCH;TRUE_FALSE_DEFINED;ENGLISH;WIN32;NDEBUG;_WINDOWS;_USRDLL;REDALERT_EXPORTS;%(PreprocessorDefinitions) + SCENARIO_EDITOR;WINDOWS_IGNORE_PACKING_MISMATCH;TRUE_FALSE_DEFINED;ENGLISH;WIN32;NDEBUG;_WINDOWS;_USRDLL;REDALERT_EXPORTS;%(PreprocessorDefinitions) 1Byte false MultiThreaded 4800;4244;4996 false false + false true @@ -124,12 +125,13 @@ false true ProgramDatabase - WINDOWS_IGNORE_PACKING_MISMATCH;TRUE_FALSE_DEFINED;ENGLISH;WIN32;_DEBUG;_WINDOWS;_USRDLL;REDALERT_EXPORTS;%(PreprocessorDefinitions) + SCENARIO_EDITOR;WINDOWS_IGNORE_PACKING_MISMATCH;TRUE_FALSE_DEFINED;ENGLISH;WIN32;_DEBUG;_WINDOWS;_USRDLL;REDALERT_EXPORTS;%(PreprocessorDefinitions) false MultiThreadedDebug 1Byte 4800;4244;4996 false + false d3d9.lib;winmm.lib;Ws2_32.lib;%(AdditionalDependencies) @@ -314,7 +316,10 @@ - + + true + true + diff --git a/REDALERT/TEAMTYPE.CPP b/REDALERT/TEAMTYPE.CPP index 6cfbd33..43c02f9 100644 --- a/REDALERT/TEAMTYPE.CPP +++ b/REDALERT/TEAMTYPE.CPP @@ -613,7 +613,7 @@ NeedType TeamMission_Needs(TeamMissionType tmtype) * HISTORY: * * 01/05/1996 JLB : Created. * *=============================================================================================*/ -void TeamMissionClass::Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags) +void TeamMissionClass::Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags) const { RemapControlType * scheme = GadgetClass::Get_Color_Scheme(); static int _tabs[] = {13,40}; @@ -937,7 +937,7 @@ bool TeamTypeClass::Edit(void) mlist.Set_Selected_Index(0); mlist.Add_Tail(*commands); - TListClass missionlist2(BUTTON_MISSION2, missionlist1.X+60, missionlist1.Y+22, 240, 8*7, + TListClass missionlist2(BUTTON_MISSION2, missionlist1.X+60, missionlist1.Y+22, 240, 8*7, TPF_EFNT | TPF_NOSHADOW, MFCD::Retrieve("EBTN-UP.SHP"), MFCD::Retrieve("EBTN-DN.SHP")); @@ -1225,7 +1225,7 @@ bool TeamTypeClass::Edit(void) */ case BUTTON_REPLACE | KN_BUTTON: if (missionlist2.Count()) { - TeamMissionClass * tm = missionlist2.Current_Item(); + TeamMissionClass * tm = (TeamMissionClass *)missionlist2.Current_Item(); tm->Mission = TeamMissionType(missionlist1.Current_Index()); tm->Data.Value = 0; switch (TeamMission_Needs(tm->Mission)) { @@ -1274,7 +1274,7 @@ bool TeamTypeClass::Edit(void) */ case BUTTON_DELETE | KN_BUTTON: if (missionlist2.Count()) { - TeamMissionClass * tm = missionlist2.Current_Item(); + TeamMissionClass * tm = (TeamMissionClass*)missionlist2.Current_Item(); missionlist2.Remove_Index(missionlist2.Current_Index()); delete tm; } diff --git a/REDALERT/TEAMTYPE.H b/REDALERT/TEAMTYPE.H index 905f557..131ca15 100644 --- a/REDALERT/TEAMTYPE.H +++ b/REDALERT/TEAMTYPE.H @@ -79,7 +79,7 @@ class TeamMissionClass char const * Description(int index) const; operator const char * () const {return(Description(0));}; #endif - void Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags); + void Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags) const; TeamMissionType Mission; // Mission type. union { diff --git a/REDALERT/TEVENT.H b/REDALERT/TEVENT.H index cd0fe7d..7d55088 100644 --- a/REDALERT/TEVENT.H +++ b/REDALERT/TEVENT.H @@ -32,9 +32,7 @@ * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ - -#ifndef TEVENT_H -#define TEVENT_H +#pragma once /* ** These are the trigger events that are checked for and if qualified, they will signal @@ -180,6 +178,3 @@ class EventChoiceClass { }; extern EventChoiceClass EventChoices[TEVENT_COUNT]; - - -#endif diff --git a/REDALERT/TRIGTYPE.CPP b/REDALERT/TRIGTYPE.CPP index 9e2c1b1..e197d7c 100644 --- a/REDALERT/TRIGTYPE.CPP +++ b/REDALERT/TRIGTYPE.CPP @@ -50,9 +50,1541 @@ #include "function.h" -#include "trigtype.h" +#include "trigtype.h" +#ifdef SCENARIO_EDITOR +enum { + /* + ** Dialog position and dimensions. + */ + D_DIALOG_W = 320 + 100, + D_DIALOG_H = 200 + 20, + D_DIALOG_X = 0, + D_DIALOG_Y = 0, + + /* + ** Event entry list box coordinates and dimensions. + */ + E1_X = D_DIALOG_X + 45, + E1_Y = D_DIALOG_Y + 65, + E2_X = E1_X, + E2_Y = E1_Y + 22, + E_WIDTH = 160, + E_HEIGHT = 8 * 5, + + /* + ** Event optional data entry coordinates and dimensions. + */ + ED1_X = E1_X + E_WIDTH + 20, + ED1_Y = E1_Y, + ED2_X = ED1_X, + ED2_Y = E2_Y, + + ED_WIDTH = 95, + ED_HEIGHT = 8 * 5, + + /* + ** Action entry list box coordinates. + */ + A1_X = E1_X, + A1_Y = D_DIALOG_Y + 120, + A2_X = E1_X, + A2_Y = A1_Y + 22, + + /* + ** Action optional data entry coordinates. + */ + AD1_X = A1_X + E_WIDTH + 20, + AD1_Y = A1_Y, + AD2_X = AD1_X, + AD2_Y = A2_Y, + + /* + ** Misc control values. + */ + GENERAL_SIZE = 10, // Text length for general data entry fields. + ENTRY_SIZE = 35, // Maximum size of event or action description text. + WAYPOINT_SIZE = 3, // Text length maximum for waypoint entry. + TEAM_SIZE = 10, // Team name text entry field length. + DESC_SIZE = 35 // Maximum length of object full name description. +}; + +/* +** Button enumerations: +*/ +enum { + EVENT_LIST = 100, // Primary event list. + EVENT_LIST2, // Secondary event list. + ACTION_LIST, // Primary action list. + ACTION_LIST2, // Secondary action list. + NAME_EDIT, // Trigger name edit field. + DATA_SPEECH1, // Primary action speech. + DATA_SPEECH2, // Secondary action speech. + DATA_THEME1, // Primary action theme. + DATA_THEME2, // Secondary action theme. + DATA_MOVIE1, // Primary action movie. + DATA_MOVIE2, // Secondary action movie. + DATA_SOUND1, // Primary action sound effect. + DATA_SOUND2, // Secondary action sound effect. + DATA_SPECIAL1, // Primary action special weapon. + DATA_SPECIAL2, // Secondary action special weapon. + DATA_EDIT, // Primary event waypoint data field. + DATA_EDIT2, // Secondary event waypoint data field. + DATA_EDIT3, // Primary action waypoint data field. + DATA_EDIT4, // Secondary action waypoint data field. + DATA_HTYPE1, // Primary event house choice list. + DATA_HTYPE2, // Secondary event house choice list. + DATA_HTYPE3, // Primary action house choice list. + DATA_HTYPE4, // Secondary action house choice list. + DATA_BOOLTYPE1, // Primary action boolean data list. + DATA_BOOLTYPE2, // Secondary action boolean data list. + DATA_GENERAL1, // Primary event general data field. + DATA_GENERAL2, // Secondary event general data field. + DATA_GENERAL3, // Primary action general data field. + DATA_GENERAL4, // Secondary action general data field. + DATA_BTYPE1, // Primary event building type list. + DATA_BTYPE2, // Secondary event building type list. + DATA_ITYPE1, // Primary event infantry type list. + DATA_ITYPE2, // Secondary event infantry type list. + DATA_ATYPE1, // Primary event aircraft type list. + DATA_ATYPE2, // Secondary event aircraft type list. + DATA_UTYPE1, // Primary event unit type list. + DATA_UTYPE2, // Secondary event unit type list. + DATA_TTYPE1, // Primary event team type entry list. + DATA_TTYPE2, // Secondary event team type entry list. + DATA_TTYPE3, // Primary action team type entry list. + DATA_TTYPE4, // Secondary action team type entry list. + DATA_TRTYPE1, // Primary action trigger list. + DATA_TRTYPE2, // Secondary action trigger list. + BUTTON_HOUSE, // House ownership for this trigger. + BUTTON_PERSISTANCE, // Persistence of this trigger. + BUTTON_OK, // Ok button - save and exit. + BUTTON_CANCEL, // Cancel button - just exit. + BUTTON_ACTION, // Multiple action control button. + BUTTON_EVENT, // Multiple event control button. +}; + + /*********************************************************************************************** + * TriggerTypeClass::Edit -- Edit the trigger type through the scenario editor. * + * * + * This is the scenario editor interface to a trigger type class object. It brings up a * + * fancy schmancy dialog to allow full edit control of the trigger type. * + * * + * INPUT: none * + * * + * OUTPUT: bool; Was the "OK" button pressed? A false return value indicates that the edits * + * to this trigger type class object should be rejected. * + * * + * WARNINGS: none * + * * + * HISTORY: * + * 07/09/1996 JLB : Created. * + *=============================================================================================*/ +bool TriggerTypeClass::Edit(void) +{ + /* + ** Dialog variables: + */ + bool cancel = false; // true = user cancels + int i; // loop counter + RemapControlType* scheme = GadgetClass::Get_Color_Scheme(); + + /* + ** Buttons + */ + ControlClass* commands = NULL; // the button list + + /* + ** List of events allowed. + */ + char eventtext[ENTRY_SIZE] = ""; + TDropListClass event1list(EVENT_LIST, eventtext, sizeof(eventtext), + TPF_EFNT | TPF_NOSHADOW, + E1_X, E1_Y, E_WIDTH, E_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char event2text[ENTRY_SIZE] = ""; + TDropListClass event2list(EVENT_LIST2, event2text, sizeof(event2text), + TPF_EFNT | TPF_NOSHADOW, + E2_X, E2_Y, E_WIDTH, E_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + for (TEventType event = TEVENT_FIRST; event < TEVENT_COUNT; event++) { + event1list.Add_Item(&EventChoices[event]); + event2list.Add_Item(&EventChoices[event]); + } + + PBubble_Sort(&event1list[0], event1list.Count()); + PBubble_Sort(&event2list[0], event2list.Count()); + + if (Event1.Event == TEVENT_NONE) Event1.Event = TEVENT_FIRST; + event1list.Set_Selected_Index(&EventChoices[Event1.Event]); + if (Event2.Event == TEVENT_NONE) Event2.Event = TEVENT_FIRST; + event2list.Set_Selected_Index(&EventChoices[Event2.Event]); + + /* + ** List of actions allowed. + */ + char actiontext[ENTRY_SIZE] = ""; + TDropListClass action1list(ACTION_LIST, actiontext, sizeof(actiontext), + TPF_EFNT | TPF_NOSHADOW, + A1_X, A1_Y, E_WIDTH, E_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char action2text[ENTRY_SIZE] = ""; + TDropListClass action2list(ACTION_LIST2, action2text, sizeof(action2text), + TPF_EFNT | TPF_NOSHADOW, + A2_X, A2_Y, E_WIDTH, E_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + for (TActionType action = TACTION_FIRST; action < TACTION_COUNT; action++) { + action1list.Add_Item(&ActionChoices[action]); + action2list.Add_Item(&ActionChoices[action]); + } + + PBubble_Sort(&action1list[0], action1list.Count()); + PBubble_Sort(&action2list[0], action2list.Count()); + + if (Action1.Action == ACTION_NONE) Action1.Action = TACTION_FIRST; + action1list.Set_Selected_Index(&ActionChoices[Action1.Action]); + if (Action2.Action == ACTION_NONE) Action2.Action = TACTION_FIRST; + action2list.Set_Selected_Index(&ActionChoices[Action2.Action]); + + /* + ** Optional waypoint entry field. + */ + char way1[WAYPOINT_SIZE] = "A"; + EditClass way1data(DATA_EDIT, way1, sizeof(way1), TPF_EFNT | TPF_NOSHADOW, + ED1_X, ED1_Y, ED_WIDTH, 9, EditClass::ALPHA); + if (Event_Needs(Event1.Event) == NEED_WAYPOINT) { + if (Event1.Data.Value < 26) { + sprintf(way1data.Get_Text(), "%c", Event1.Data.Value + 'A'); + } + else { + sprintf(way1data.Get_Text(), "%c%c", (Event1.Data.Value / 26) + 'A' - 1, (Event1.Data.Value % 26) + 'A'); + } + } + + char way2[WAYPOINT_SIZE] = "A"; + EditClass way2data(DATA_EDIT2, way2, sizeof(way2), TPF_EFNT | TPF_NOSHADOW, + ED2_X, ED2_Y, ED_WIDTH, 9, EditClass::ALPHA); + if (Event_Needs(Event2.Event) == NEED_WAYPOINT) { + if (Event2.Data.Value < 26) { + sprintf(way2data.Get_Text(), "%c", Event2.Data.Value + 'A'); + } + else { + sprintf(way2data.Get_Text(), "%c%c", (Event2.Data.Value / 26) + 'A' - 1, (Event2.Data.Value % 26) + 'A'); + } + } + + char way3[WAYPOINT_SIZE] = "A"; + EditClass way3data(DATA_EDIT3, way3, sizeof(way3), TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, 9, EditClass::ALPHA); + if (Action_Needs(Action1.Action) == NEED_WAYPOINT) { + if (Action1.Data.Value < 26) { + sprintf(way3data.Get_Text(), "%c", Action1.Data.Value + 'A'); + } + else { + sprintf(way3data.Get_Text(), "%c%c", (Action1.Data.Value / 26) + 'A' - 1, (Action1.Data.Value % 26) + 'A'); + } + } + + char way4[WAYPOINT_SIZE] = "A"; + EditClass way4data(DATA_EDIT4, way4, sizeof(way4), TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, 9, EditClass::ALPHA); + if (Action_Needs(Action2.Action) == NEED_WAYPOINT) { + if (Action2.Data.Value < 26) { + sprintf(way4data.Get_Text(), "%c", Action2.Data.Value + 'A'); + } + else { + sprintf(way4data.Get_Text(), "%c%c", (Action2.Data.Value / 26) + 'A' - 1, (Action2.Data.Value % 26) + 'A'); + } + } + + /* + ** Optional event data entry field. + */ + char databuf1[GENERAL_SIZE] = ""; + EditClass event1data(DATA_GENERAL1, databuf1, sizeof(databuf1), + TPF_EFNT | TPF_NOSHADOW, + ED1_X, ED1_Y, ED_WIDTH, 9, EditClass::NUMERIC); + switch (Event_Needs(Event1.Event)) { + case NEED_TIME: + case NEED_NUMBER: + sprintf(event1data.Get_Text(), "%d", Event1.Data.Value); + break; + } + + char databuf2[GENERAL_SIZE] = ""; + EditClass event2data(DATA_GENERAL2, databuf2, sizeof(databuf2), + TPF_EFNT | TPF_NOSHADOW, + ED2_X, ED2_Y, ED_WIDTH, 9, EditClass::NUMERIC); + switch (Event_Needs(Event2.Event)) { + case NEED_TIME: + case NEED_NUMBER: + sprintf(event2data.Get_Text(), "%d", Event2.Data.Value); + break; + } + + char actionbuf1[GENERAL_SIZE] = ""; + EditClass action1data(DATA_GENERAL3, actionbuf1, sizeof(actionbuf1), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, 9, EditClass::NUMERIC); + switch (Action_Needs(Action1.Action)) { + case NEED_NUMBER: + sprintf(action1data.Get_Text(), "%d", Action1.Data.Value); + break; + } + + char actionbuf2[GENERAL_SIZE] = ""; + EditClass action2data(DATA_GENERAL4, actionbuf2, sizeof(actionbuf2), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, 9, EditClass::NUMERIC); + switch (Action_Needs(Action2.Action)) { + case NEED_NUMBER: + sprintf(action2data.Get_Text(), "%d", Action2.Data.Value); + break; + } + + /* + ** Optional team entry list. + */ + char tbuf1[TEAM_SIZE] = ""; + DropListClass ttype1list(DATA_TTYPE1, tbuf1, sizeof(tbuf1), + TPF_EFNT | TPF_NOSHADOW, + ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char tbuf2[TEAM_SIZE] = ""; + DropListClass ttype2list(DATA_TTYPE2, tbuf2, sizeof(tbuf2), + TPF_EFNT | TPF_NOSHADOW, + ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char tbuf3[TEAM_SIZE] = ""; + DropListClass ttype3list(DATA_TTYPE3, tbuf3, sizeof(tbuf3), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char tbuf4[TEAM_SIZE] = ""; + DropListClass ttype4list(DATA_TTYPE4, tbuf4, sizeof(tbuf4), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (int index = 0; index < TeamTypes.Count(); index++) { + ttype1list.Add_Item(TeamTypes.Ptr(index)->IniName); + ttype2list.Add_Item(TeamTypes.Ptr(index)->IniName); + ttype3list.Add_Item(TeamTypes.Ptr(index)->IniName); + ttype4list.Add_Item(TeamTypes.Ptr(index)->IniName); + } + + if (Event1.Team.Is_Valid()) { + ttype1list.Set_Selected_Index(Event1.Team->IniName); + } + else { + ttype1list.Set_Selected_Index(0); + } + if (Event2.Team.Is_Valid()) { + ttype2list.Set_Selected_Index(Event2.Team->IniName); + } + else { + ttype2list.Set_Selected_Index(0); + } + if (Action1.Team.Is_Valid()) { + ttype3list.Set_Selected_Index(Action1.Team->IniName); + } + else { + ttype3list.Set_Selected_Index(0); + } + if (Action2.Team.Is_Valid()) { + ttype4list.Set_Selected_Index(Action2.Team->IniName); + } + else { + ttype4list.Set_Selected_Index(0); + } + + /* + ** Optional trigger entry list. + */ + char trbuf1[TEAM_SIZE] = ""; + DropListClass trtype1list(DATA_TRTYPE1, trbuf1, sizeof(trbuf1), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char trbuf2[TEAM_SIZE] = ""; + DropListClass trtype2list(DATA_TRTYPE2, trbuf2, sizeof(trbuf2), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (index = 0; index < TriggerTypes.Count(); index++) { + trtype1list.Add_Item(TriggerTypes.Ptr(index)->IniName); + trtype2list.Add_Item(TriggerTypes.Ptr(index)->IniName); + } + + if (Action1.Trigger.Is_Valid()) { + trtype1list.Set_Selected_Index(Action1.Trigger->IniName); + } + else { + trtype1list.Set_Selected_Index(0); + } + if (Action2.Trigger.Is_Valid()) { + trtype2list.Set_Selected_Index(Action2.Trigger->IniName); + } + else { + trtype2list.Set_Selected_Index(0); + } + + /* + ** Optional boolean value list. + */ + char boolbuf1[TEAM_SIZE] = ""; + DropListClass booltype1list(DATA_BOOLTYPE1, boolbuf1, sizeof(boolbuf1), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char boolbuf2[TEAM_SIZE] = ""; + DropListClass booltype2list(DATA_BOOLTYPE2, boolbuf2, sizeof(boolbuf2), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + booltype1list.Add_Item("OFF"); + booltype1list.Add_Item("ON"); + booltype2list.Add_Item("OFF"); + booltype2list.Add_Item("ON"); + + booltype1list.Set_Selected_Index(Action1.Data.Bool); + booltype2list.Set_Selected_Index(Action2.Data.Bool); + + /* + ** Optional musical theme choice list. + */ + char themebuf1[DESC_SIZE] = ""; + DropListClass themetype1list(DATA_THEME1, themebuf1, sizeof(themebuf1), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char themebuf2[DESC_SIZE] = ""; + DropListClass themetype2list(DATA_THEME2, themebuf2, sizeof(themebuf2), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (ThemeType theme = THEME_FIRST; theme < THEME_COUNT; theme++) { + themetype1list.Add_Item(Theme.Full_Name(theme)); + themetype2list.Add_Item(Theme.Full_Name(theme)); + } + + if (Action_Needs(Action1.Action) == NEED_THEME) { + themetype1list.Set_Selected_Index(Action1.Data.Theme); + } + else { + themetype1list.Set_Selected_Index(0); + } + if (Action_Needs(Action2.Action) == NEED_THEME) { + themetype2list.Set_Selected_Index(Action2.Data.Theme); + } + else { + themetype2list.Set_Selected_Index(0); + } + + /* + ** Optional movie list. + */ + char moviebuf1[DESC_SIZE] = ""; + DropListClass movietype1list(DATA_MOVIE1, moviebuf1, sizeof(moviebuf1), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char moviebuf2[DESC_SIZE] = ""; + DropListClass movietype2list(DATA_MOVIE2, moviebuf2, sizeof(moviebuf2), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (VQType movie = VQ_FIRST; movie < VQ_COUNT; movie++) { + movietype1list.Add_Item(VQName[movie]); + movietype2list.Add_Item(VQName[movie]); + } + + if (Action_Needs(Action1.Action) == NEED_MOVIE) { + movietype1list.Set_Selected_Index(Action1.Data.Movie); + } + else { + movietype1list.Set_Selected_Index(0); + } + if (Action_Needs(Action2.Action) == NEED_MOVIE) { + movietype2list.Set_Selected_Index(Action2.Data.Movie); + } + else { + movietype2list.Set_Selected_Index(0); + } + + /* + ** Optional sound effect list. + */ + char soundbuf1[DESC_SIZE] = ""; + DropListClass soundtype1list(DATA_SOUND1, soundbuf1, sizeof(soundbuf1), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char soundbuf2[DESC_SIZE] = ""; + DropListClass soundtype2list(DATA_SOUND2, soundbuf2, sizeof(soundbuf2), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (VocType sound = VOC_FIRST; sound < VOC_COUNT; sound++) { + soundtype1list.Add_Item(Voc_Name(sound)); + soundtype2list.Add_Item(Voc_Name(sound)); + } + + if (Action_Needs(Action1.Action) == NEED_SOUND) { + soundtype1list.Set_Selected_Index(Action1.Data.Sound); + } + else { + soundtype1list.Set_Selected_Index(0); + } + if (Action_Needs(Action2.Action) == NEED_SOUND) { + soundtype2list.Set_Selected_Index(Action2.Data.Sound); + } + else { + soundtype2list.Set_Selected_Index(0); + } + + /* + ** Optional speech effect list. + */ + char speechbuf1[DESC_SIZE] = ""; + DropListClass speechtype1list(DATA_SPEECH1, speechbuf1, sizeof(speechbuf1), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char speechbuf2[DESC_SIZE] = ""; + DropListClass speechtype2list(DATA_SPEECH2, speechbuf2, sizeof(speechbuf2), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (VoxType speech = VOX_FIRST; speech < VOX_COUNT; speech++) { + speechtype1list.Add_Item(Speech_Name(speech)); + speechtype2list.Add_Item(Speech_Name(speech)); + } + + if (Action_Needs(Action1.Action) == NEED_SPEECH) { + speechtype1list.Set_Selected_Index(Action1.Data.Speech); + } + else { + speechtype1list.Set_Selected_Index(0); + } + if (Action_Needs(Action2.Action) == NEED_SPEECH) { + speechtype2list.Set_Selected_Index(Action2.Data.Speech); + } + else { + speechtype2list.Set_Selected_Index(0); + } + + /* + ** Optional building type entry list. + */ + char bbuf1[DESC_SIZE] = ""; + DropListClass btype1list(DATA_BTYPE1, bbuf1, sizeof(bbuf1), + TPF_EFNT | TPF_NOSHADOW, + ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char bbuf2[DESC_SIZE] = ""; + DropListClass btype2list(DATA_BTYPE2, bbuf2, sizeof(bbuf2), + TPF_EFNT | TPF_NOSHADOW, + ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (StructType ss = STRUCT_FIRST; ss < STRUCT_COUNT; ss++) { + btype1list.Add_Item(Text_String(BuildingTypeClass::As_Reference(ss).Full_Name())); + btype2list.Add_Item(Text_String(BuildingTypeClass::As_Reference(ss).Full_Name())); + } + + if (Event_Needs(Event1.Event) == NEED_STRUCTURE) { + btype1list.Set_Selected_Index(Event1.Data.Structure); + } + else { + btype1list.Set_Selected_Index(0); + } + if (Event_Needs(Event2.Event) == NEED_STRUCTURE) { + btype2list.Set_Selected_Index(Event2.Data.Structure); + } + else { + btype2list.Set_Selected_Index(0); + } + + /* + ** Optional infantry type entry list. + */ + char ibuf1[DESC_SIZE] = ""; + DropListClass itype1list(DATA_ITYPE1, ibuf1, sizeof(ibuf1), + TPF_EFNT | TPF_NOSHADOW, + ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char ibuf2[DESC_SIZE] = ""; + DropListClass itype2list(DATA_ITYPE2, ibuf2, sizeof(ibuf2), + TPF_EFNT | TPF_NOSHADOW, + ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (InfantryType ii = INFANTRY_FIRST; ii < INFANTRY_COUNT; ii++) { + itype1list.Add_Item(Text_String(InfantryTypeClass::As_Reference(ii).Full_Name())); + itype2list.Add_Item(Text_String(InfantryTypeClass::As_Reference(ii).Full_Name())); + } + + if (Event_Needs(Event1.Event) == NEED_INFANTRY) { + itype1list.Set_Selected_Index(Event1.Data.Infantry); + } + else { + itype1list.Set_Selected_Index(0); + } + if (Event_Needs(Event2.Event) == NEED_INFANTRY) { + itype2list.Set_Selected_Index(Event2.Data.Infantry); + } + else { + itype2list.Set_Selected_Index(0); + } + + /* + ** Optional aircraft type entry list. + */ + char abuf1[DESC_SIZE] = ""; + DropListClass atype1list(DATA_ATYPE1, abuf1, sizeof(abuf1), + TPF_EFNT | TPF_NOSHADOW, + ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char abuf2[DESC_SIZE] = ""; + DropListClass atype2list(DATA_ATYPE2, abuf2, sizeof(abuf2), + TPF_EFNT | TPF_NOSHADOW, + ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (AircraftType aa = AIRCRAFT_FIRST; aa < AIRCRAFT_COUNT; aa++) { + atype1list.Add_Item(Text_String(AircraftTypeClass::As_Reference(aa).Full_Name())); + atype2list.Add_Item(Text_String(AircraftTypeClass::As_Reference(aa).Full_Name())); + } + + if (Event_Needs(Event1.Event) == NEED_AIRCRAFT) { + atype1list.Set_Selected_Index(Event1.Data.Aircraft); + } + else { + atype1list.Set_Selected_Index(0); + } + if (Event_Needs(Event2.Event) == NEED_AIRCRAFT) { + atype2list.Set_Selected_Index(Event2.Data.Aircraft); + } + else { + atype2list.Set_Selected_Index(0); + } + + /* + ** Optional unit type entry list. + */ + char ubuf1[DESC_SIZE] = ""; + DropListClass utype1list(DATA_UTYPE1, ubuf1, sizeof(ubuf1), + TPF_EFNT | TPF_NOSHADOW, + ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char ubuf2[DESC_SIZE] = ""; + DropListClass utype2list(DATA_UTYPE2, ubuf2, sizeof(ubuf2), + TPF_EFNT | TPF_NOSHADOW, + ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (UnitType uu = UNIT_FIRST; uu < UNIT_COUNT; uu++) { + utype1list.Add_Item(Text_String(UnitTypeClass::As_Reference(uu).Full_Name())); + utype2list.Add_Item(Text_String(UnitTypeClass::As_Reference(uu).Full_Name())); + } + + if (Event_Needs(Event1.Event) == NEED_UNIT) { + utype1list.Set_Selected_Index(Event1.Data.Unit); + } + else { + utype1list.Set_Selected_Index(0); + } + if (Event_Needs(Event2.Event) == NEED_UNIT) { + utype2list.Set_Selected_Index(Event2.Data.Unit); + } + else { + utype2list.Set_Selected_Index(0); + } + + /* + ** Optional house type entry list. + */ + char housebuf1[DESC_SIZE] = ""; + DropListClass htype1list(DATA_HTYPE1, housebuf1, sizeof(housebuf1), + TPF_EFNT | TPF_NOSHADOW, + ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char housebuf2[DESC_SIZE] = ""; + DropListClass htype2list(DATA_HTYPE2, housebuf2, sizeof(housebuf2), + TPF_EFNT | TPF_NOSHADOW, + ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char housebuf3[DESC_SIZE] = ""; + DropListClass htype3list(DATA_HTYPE3, housebuf3, sizeof(housebuf3), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char housebuf4[DESC_SIZE] = ""; + DropListClass htype4list(DATA_HTYPE4, housebuf4, sizeof(housebuf4), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + + for (HousesType hh = HOUSE_FIRST; hh < HOUSE_COUNT; hh++) { + htype1list.Add_Item(HouseTypeClass::As_Reference(hh).IniName); + htype2list.Add_Item(HouseTypeClass::As_Reference(hh).IniName); + htype3list.Add_Item(HouseTypeClass::As_Reference(hh).IniName); + htype4list.Add_Item(HouseTypeClass::As_Reference(hh).IniName); + } + + if (Event_Needs(Event1.Event) == NEED_HOUSE) { + htype1list.Set_Selected_Index(Event1.Data.House); + } + else { + htype1list.Set_Selected_Index(0); + } + if (Event_Needs(Event2.Event) == NEED_HOUSE) { + htype2list.Set_Selected_Index(Event2.Data.House); + } + else { + htype2list.Set_Selected_Index(0); + } + if (Action_Needs(Action1.Action) == NEED_HOUSE) { + htype3list.Set_Selected_Index(Action1.Data.House); + } + else { + htype3list.Set_Selected_Index(0); + } + if (Action_Needs(Action2.Action) == NEED_HOUSE) { + htype4list.Set_Selected_Index(Action2.Data.House); + } + else { + htype4list.Set_Selected_Index(0); + } + + /* + ** Optional special weapon list. + */ + char special1[DESC_SIZE] = ""; + DropListClass spc1(DATA_SPECIAL1, special1, sizeof(special1), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char special2[DESC_SIZE] = ""; + DropListClass spc2(DATA_SPECIAL2, special2, sizeof(special2), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + for (SpecialWeaponType spec = SPC_FIRST; spec < SPC_COUNT; spec++) { + spc1.Add_Item(SpecialWeaponName[spec]); + spc2.Add_Item(SpecialWeaponName[spec]); + } + if ((unsigned)Action1.Data.Special < SPC_COUNT) { + spc1.Set_Selected_Index(Action1.Data.Special); + } + else { + spc1.Set_Selected_Index(0); + } + if ((unsigned)Action2.Data.Special < SPC_COUNT) { + spc2.Set_Selected_Index(Action2.Data.Special); + } + else { + spc2.Set_Selected_Index(0); + } + + /* + ** Optional quarry type. + */ + char quarry1[DESC_SIZE] = ""; + DropListClass qlist1(DATA_SPECIAL1, quarry1, sizeof(quarry1), + TPF_EFNT | TPF_NOSHADOW, + AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + char quarry2[DESC_SIZE] = ""; + DropListClass qlist2(DATA_SPECIAL2, quarry2, sizeof(quarry2), + TPF_EFNT | TPF_NOSHADOW, + AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + for (QuarryType q = QUARRY_FIRST; q < QUARRY_COUNT; q++) { + qlist1.Add_Item(QuarryName[q]); + qlist2.Add_Item(QuarryName[q]); + } + if ((unsigned)Action1.Data.Quarry < QUARRY_COUNT) { + qlist1.Set_Selected_Index(Action1.Data.Quarry); + } + else { + qlist1.Set_Selected_Index(0); + } + if ((unsigned)Action2.Data.Quarry < QUARRY_COUNT) { + qlist2.Set_Selected_Index(Action2.Data.Quarry); + } + else { + qlist2.Set_Selected_Index(0); + } + + /* + ** Name of this trigger text edit field. + */ + char namebuf[5] = ""; + EditClass name_edt(NAME_EDIT, namebuf, sizeof(namebuf), TPF_EFNT | TPF_NOSHADOW, D_DIALOG_X + 40, D_DIALOG_Y + 30, 40, 9, EditClass::ALPHANUMERIC); + strcpy(namebuf, IniName); // Name + + /* + ** Create the list of house's allowed for trigger. + */ + char housetext[DESC_SIZE] = ""; + DropListClass housebtn(BUTTON_HOUSE, housetext, sizeof(housetext), + TPF_EFNT | TPF_NOSHADOW, + name_edt.X + name_edt.Width + 20, name_edt.Y, 95, 8 * 5, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + for (HousesType house = HOUSE_FIRST; house < HOUSE_COUNT; house++) { + housebtn.Add_Item(HouseTypeClass::As_Reference(house).IniName); + } + if (House == HOUSE_NONE) House = HOUSE_GOOD; + housebtn.Set_Selected_Index(House); + + /* + ** Must match order and number of PersistantType specified in + ** TriggerTypeClass definition. + */ + char perstext[DESC_SIZE] = ""; + static char* _perstext[3] = { + "Volatile", + "Semi-persistent", + "Persistent" + }; + DropListClass persbtn(BUTTON_PERSISTANCE, perstext, sizeof(perstext), + TPF_EFNT | TPF_NOSHADOW, + housebtn.X + housebtn.Width + 20, housebtn.Y, 105, 8 * 5, + MFCD::Retrieve("EBTN-UP.SHP"), + MFCD::Retrieve("EBTN-DN.SHP")); + for (i = 0; i < sizeof(_perstext) / sizeof(_perstext[0]); i++) { + persbtn.Add_Item(_perstext[i]); + } + persbtn.Set_Selected_Index(IsPersistant); + + /* + ** This button controls the existence and relationship of a second trigger + ** event. + */ + int eventflag = EventControl; + TextButtonClass eventbtn(BUTTON_EVENT, TXT_TRIGGER_JUST_EVENT, TPF_EBUTTON, event1list.X, event1list.Y + 11, 100, 9); + + /* + ** This button controls the existence of a secondary action. + */ + bool actionflag = ActionControl; + TextButtonClass actionbtn(BUTTON_ACTION, TXT_TRIGGER_JUST_ACTION, TPF_EBUTTON, action1list.X, action1list.Y + 11, 100, 9); + + /* + ** Create the ubiquitous OK and Cancel buttons. + */ + TextButtonClass okbtn(BUTTON_OK, TXT_OK, TPF_EBUTTON, D_DIALOG_X + 35, D_DIALOG_Y + D_DIALOG_H - 30, 45, 9); + TextButtonClass cancelbtn(BUTTON_CANCEL, TXT_CANCEL, TPF_EBUTTON, D_DIALOG_X + D_DIALOG_W - 80, D_DIALOG_Y + D_DIALOG_H - 30, 45, 9); + + /* + ** Initialize + */ + Set_Logic_Page(SeenBuff); + + /* + ** Build the button list + */ + commands = &okbtn; + cancelbtn.Add_Tail(*commands); + event1list.Add_Tail(*commands); + action1list.Add_Tail(*commands); + eventbtn.Add_Tail(*commands); + actionbtn.Add_Tail(*commands); + name_edt.Add_Tail(*commands); + persbtn.Add_Tail(*commands); + housebtn.Add_Tail(*commands); + + /* + ** Main Processing Loop + */ + bool display = true; + bool process = true; + while (process) { + + /* + ** Invoke game callback + */ + Call_Back(); + + /* + ** Refresh display if needed + */ + if (display /*&& LogicPage->Lock()*/) { + + /* + ** Display the dialog box + */ + Hide_Mouse(); + Dialog_Box(D_DIALOG_X, D_DIALOG_Y, D_DIALOG_W, D_DIALOG_H); + Draw_Caption(TXT_TRIGGER_EDITOR, D_DIALOG_X, D_DIALOG_Y, D_DIALOG_W); + + /* + ** Draw the captions + */ + Fancy_Text_Print("Trigger Event:", event1list.X, event1list.Y - 7, scheme, TBLACK, TPF_EFNT | TPF_NOSHADOW); + Fancy_Text_Print("Action to Perform:", action1list.X, action1list.Y - 7, scheme, TBLACK, TPF_EFNT | TPF_NOSHADOW); + Fancy_Text_Print("House:", housebtn.X, housebtn.Y - 7, scheme, TBLACK, TPF_EFNT | TPF_NOSHADOW); + Fancy_Text_Print("Name:", name_edt.X, name_edt.Y - 7, scheme, TBLACK, TPF_EFNT | TPF_NOSHADOW); + Fancy_Text_Print("Persistence:", persbtn.X, persbtn.Y - 7, scheme, TBLACK, TPF_EFNT | TPF_NOSHADOW); + + if (eventflag == 3) { + LogicPage->Draw_Line(event1list.X - 1, event1list.Y + 3, event1list.X - 2 * RESFACTOR, event1list.Y + 3, WHITE); + LogicPage->Draw_Line(event1list.X - 2 * RESFACTOR, event1list.Y + 3, action1list.X - 2 * RESFACTOR, action1list.Y + 3, WHITE); + LogicPage->Draw_Line(action1list.X - 1, action1list.Y + 3, action1list.X - 2 * RESFACTOR, action1list.Y + 3, WHITE); + + LogicPage->Draw_Line(event2list.X - 1, event2list.Y + 3, event2list.X - 5 * RESFACTOR, event2list.Y + 3, WHITE); + LogicPage->Draw_Line(event2list.X - 5 * RESFACTOR, event2list.Y + 3, action2list.X - 5 * RESFACTOR, action2list.Y + 3, WHITE); + LogicPage->Draw_Line(action2list.X - 1, action2list.Y + 3, action2list.X - 5 * RESFACTOR, action2list.Y + 3, WHITE); + } + + /* + ** Adjust the button list to match current control settings. + */ + event2list.Remove(); + switch (eventflag) { + case 0: + eventbtn.Set_Text(TXT_TRIGGER_JUST_EVENT); + break; + + case 1: + eventbtn.Set_Text(TXT_TRIGGER_AND); + event2list.Add(*commands); + break; + + case 2: + eventbtn.Set_Text(TXT_TRIGGER_OR); + event2list.Add(*commands); + break; + + case 3: + eventbtn.Set_Text(TXT_TRIGGER_LINKED); + event2list.Add(*commands); + break; + } + + /* + ** Prepare the primary event data field. + */ + htype1list.Remove(); + way1data.Remove(); + event1data.Remove(); + btype1list.Remove(); + itype1list.Remove(); + atype1list.Remove(); + utype1list.Remove(); + ttype1list.Remove(); + switch (Event_Needs(*event1list.Current_Item())) { + case NEED_HOUSE: + htype1list.Add(*commands); + break; + + case NEED_TEAM: + ttype1list.Add(*commands); + break; + + case NEED_WAYPOINT: + way1data.Add(*commands); + break; + + case NEED_TIME: + case NEED_NUMBER: + event1data.Add(*commands); + break; + + case NEED_STRUCTURE: + btype1list.Add(*commands); + break; + + case NEED_INFANTRY: + itype1list.Add(*commands); + break; + + case NEED_AIRCRAFT: + atype1list.Add(*commands); + break; + + case NEED_UNIT: + utype1list.Add(*commands); + break; + + default: + break; + } + + /* + ** Prepare the secondary event data field. + */ + htype2list.Remove(); + way2data.Remove(); + event2data.Remove(); + btype2list.Remove(); + itype2list.Remove(); + atype2list.Remove(); + utype2list.Remove(); + ttype2list.Remove(); + if (commands->Extract_Gadget(EVENT_LIST2)) { + switch (Event_Needs(*event2list.Current_Item())) { + case NEED_HOUSE: + htype2list.Add(*commands); + break; + + case NEED_TEAM: + ttype2list.Add(*commands); + break; + + case NEED_WAYPOINT: + way2data.Add(*commands); + break; + + case NEED_TIME: + case NEED_NUMBER: + event2data.Add(*commands); + break; + + case NEED_STRUCTURE: + btype2list.Add(*commands); + break; + + case NEED_INFANTRY: + itype2list.Add(*commands); + break; + + case NEED_AIRCRAFT: + atype2list.Add(*commands); + break; + + case NEED_UNIT: + utype2list.Add(*commands); + break; + + default: + break; + } + } + + /* + ** Setup the action buttons and associated data entry fields. + */ + actionbtn.Remove(); + action2list.Remove(); + if (eventflag == 3) { + action2list.Add(*commands); + } + else { + actionbtn.Add(*commands); + if (actionflag) { + actionbtn.Set_Text(TXT_TRIGGER_AND); + action2list.Add(*commands); + } + else { + actionbtn.Set_Text(TXT_TRIGGER_JUST_ACTION); + } + } + + qlist1.Remove(); + spc1.Remove(); + htype3list.Remove(); + booltype1list.Remove(); + trtype1list.Remove(); + way3data.Remove(); + action1data.Remove(); + ttype3list.Remove(); + themetype1list.Remove(); + soundtype1list.Remove(); + movietype1list.Remove(); + speechtype1list.Remove(); + switch (Action_Needs(*action1list.Current_Item())) { + case NEED_MOVIE: + movietype1list.Add(*commands); + break; + + case NEED_SPECIAL: + spc1.Add(*commands); + break; + + case NEED_HOUSE: + htype3list.Add(*commands); + break; + + case NEED_BOOL: + booltype1list.Add(*commands); + break; + + case NEED_TRIGGER: + trtype1list.Add(*commands); + break; + + case NEED_TEAM: + ttype3list.Add(*commands); + break; + + case NEED_NUMBER: + action1data.Add(*commands); + break; + + case NEED_WAYPOINT: + way3data.Add(*commands); + break; + + case NEED_THEME: + themetype1list.Add(*commands); + break; + + case NEED_SOUND: + soundtype1list.Add(*commands); + break; + + case NEED_SPEECH: + speechtype1list.Add(*commands); + break; + + case NEED_QUARRY: + qlist1.Add(*commands); + break; + } + + qlist2.Remove(); + spc2.Remove(); + htype4list.Remove(); + booltype2list.Remove(); + trtype2list.Remove(); + way4data.Remove(); + action2data.Remove(); + ttype4list.Remove(); + themetype2list.Remove(); + soundtype2list.Remove(); + movietype2list.Remove(); + speechtype2list.Remove(); + if (commands->Extract_Gadget(ACTION_LIST2)) { + switch (Action_Needs(*action2list.Current_Item())) { + case NEED_MOVIE: + movietype2list.Add(*commands); + break; + + case NEED_SPECIAL: + spc2.Add(*commands); + break; + + case NEED_HOUSE: + htype4list.Add(*commands); + break; + + case NEED_BOOL: + booltype2list.Add(*commands); + break; + + case NEED_TRIGGER: + trtype2list.Add(*commands); + break; + + case NEED_TEAM: + ttype4list.Add(*commands); + break; + + case NEED_NUMBER: + action2data.Add(*commands); + break; + + case NEED_WAYPOINT: + way4data.Add(*commands); + break; + + case NEED_THEME: + themetype2list.Add(*commands); + break; + + case NEED_SOUND: + soundtype2list.Add(*commands); + break; + + case NEED_SPEECH: + speechtype2list.Add(*commands); + break; + + case NEED_QUARRY: + qlist2.Add(*commands); + break; + } + } + + /* + ** Collapse any dropped down list boxes. + */ + spc1.Collapse(); + spc2.Collapse(); + qlist1.Collapse(); + qlist2.Collapse(); + htype1list.Collapse(); + htype2list.Collapse(); + htype3list.Collapse(); + htype4list.Collapse(); + ttype1list.Collapse(); + ttype2list.Collapse(); + ttype3list.Collapse(); + ttype4list.Collapse(); + btype1list.Collapse(); + btype2list.Collapse(); + utype1list.Collapse(); + utype2list.Collapse(); + itype1list.Collapse(); + itype2list.Collapse(); + atype1list.Collapse(); + atype2list.Collapse(); + trtype1list.Collapse(); + trtype2list.Collapse(); + action1list.Collapse(); + action2list.Collapse(); + event1list.Collapse(); + event2list.Collapse(); + housebtn.Collapse(); + persbtn.Collapse(); + booltype1list.Collapse(); + booltype2list.Collapse(); + themetype1list.Collapse(); + themetype2list.Collapse(); + soundtype1list.Collapse(); + soundtype2list.Collapse(); + movietype1list.Collapse(); + movietype2list.Collapse(); + speechtype1list.Collapse(); + speechtype2list.Collapse(); + commands->Flag_List_To_Redraw(); + Show_Mouse(); + display = false; + // LogicPage->Unlock(); + } + + /* + ** Get user input + */ + KeyNumType input = commands->Input(); + + /* + ** Process input + */ + switch (input) { + case BUTTON_EVENT | KN_BUTTON: + eventflag = (eventflag + 1) % 4; + display = true; + break; + + case BUTTON_ACTION | KN_BUTTON: + actionflag = (actionflag == false); + display = true; + break; + + case DATA_SPEECH1 | KN_BUTTON: + Speak(VoxType(speechtype1list.Current_Index())); + display = true; + break; + + case DATA_SPEECH2 | KN_BUTTON: + Speak(VoxType(speechtype2list.Current_Index())); + display = true; + break; + + case DATA_SOUND1 | KN_BUTTON: + Sound_Effect(VocType(soundtype1list.Current_Index())); + display = true; + break; + + case DATA_SOUND2 | KN_BUTTON: + Sound_Effect(VocType(soundtype2list.Current_Index())); + display = true; + break; + + /* + ** Transfer all the necessary values from the edit fields into their + ** respective positions within the trigger object. + */ + case KN_RETURN: + case BUTTON_OK | KN_BUTTON: + House = HousesType(housebtn.Current_Index()); + IsPersistant = PersistantType(persbtn.Current_Index()); + if (strlen(namebuf) == 0) { + Set_Name("____"); + } + else { + Set_Name(namebuf); + } + + /* + ** Primary event specific data retrieval. + */ + EventControl = MultiStyleType(eventflag); + Event1.Event = *event1list.Current_Item(); + switch (Event_Needs(Event1.Event)) { + case NEED_HOUSE: + Event1.Data.House = HousesType(htype1list.Current_Index()); + break; + + case NEED_TIME: + Event1.Data.Value = atoi(event1data.Get_Text()); + break; + + case NEED_NUMBER: + Event1.Data.Value = atoi(event1data.Get_Text()); + break; + + case NEED_STRUCTURE: + Event1.Data.Structure = StructType(btype1list.Current_Index()); + break; + + case NEED_UNIT: + Event1.Data.Unit = UnitType(utype1list.Current_Index()); + break; + + case NEED_INFANTRY: + Event1.Data.Infantry = InfantryType(itype1list.Current_Index()); + break; + + case NEED_AIRCRAFT: + Event1.Data.Aircraft = AircraftType(atype1list.Current_Index()); + break; + + case NEED_WAYPOINT: + Event1.Data.Value = toupper(way1[0]) - 'A'; + if (way1[1] != '\0') { + Event1.Data.Value = (Event1.Data.Value + 1) * 26; + Event1.Data.Value += toupper(way1[1]) - 'A'; + } + break; + + case NEED_TEAM: + Event1.Team = TeamTypeClass::From_Name(ttype1list.Current_Item()); + break; + } + + /* + ** Secondary event specific data retrieval. + */ + Event2.Event = *event2list.Current_Item(); + switch (Event_Needs(Event2.Event)) { + case NEED_HOUSE: + Event2.Data.House = HousesType(htype2list.Current_Index()); + break; + + case NEED_TIME: + Event2.Data.Value = atoi(event2data.Get_Text()); + break; + + case NEED_NUMBER: + Event2.Data.Value = atoi(event2data.Get_Text()); + break; + + case NEED_STRUCTURE: + Event2.Data.Structure = StructType(btype2list.Current_Index()); + break; + + case NEED_UNIT: + Event2.Data.Unit = UnitType(utype2list.Current_Index()); + break; + + case NEED_INFANTRY: + Event2.Data.Infantry = InfantryType(itype2list.Current_Index()); + break; + + case NEED_AIRCRAFT: + Event2.Data.Aircraft = AircraftType(atype2list.Current_Index()); + break; + + case NEED_WAYPOINT: + Event2.Data.Value = toupper(way2[0]) - 'A'; + if (way2[1] != '\0') { + Event2.Data.Value = (Event2.Data.Value + 1) * 26; + Event2.Data.Value += toupper(way2[1]) - 'A'; + } + break; + + case NEED_TEAM: + Event2.Team = TeamTypeClass::As_Pointer(ttype2list.Current_Item()); + break; + } + + /* + ** Primary action data retrieval. + */ + ActionControl = MultiStyleType(actionflag); + Action1.Action = *action1list.Current_Item(); + switch (Action_Needs(Action1.Action)) { + case NEED_SPECIAL: + Action1.Data.Special = SpecialWeaponType(spc1.Current_Index()); + break; + + case NEED_HOUSE: + Action1.Data.House = HousesType(htype3list.Current_Index()); + break; + + case NEED_TRIGGER: + Action1.Trigger = TriggerTypeClass::From_Name(trtype1list.Current_Item()); + break; + + case NEED_TEAM: + Action1.Team = TeamTypeClass::From_Name(ttype3list.Current_Item()); + break; + + case NEED_NUMBER: + Action1.Data.Value = atoi(action1data.Get_Text()); + break; + + case NEED_WAYPOINT: + Action1.Data.Value = toupper(way3[0]) - 'A'; + if (way3[1] != '\0') { + Action1.Data.Value = (Action1.Data.Value + 1) * 26; + Action1.Data.Value += toupper(way3[1]) - 'A'; + } + break; + + case NEED_BOOL: + Action1.Data.Bool = booltype1list.Current_Index(); + break; + + case NEED_THEME: + Action1.Data.Theme = ThemeType(themetype1list.Current_Index()); + break; + + case NEED_SOUND: + Action1.Data.Sound = VocType(soundtype1list.Current_Index()); + break; + + case NEED_MOVIE: + Action1.Data.Movie = VQType(movietype1list.Current_Index()); + break; + + case NEED_SPEECH: + Action1.Data.Speech = VoxType(speechtype1list.Current_Index()); + break; + + case NEED_QUARRY: + Action1.Data.Quarry = QuarryType(qlist1.Current_Index()); + break; + } + + /* + ** Secondary action data retrieval. + */ + Action2.Action = *action2list.Current_Item(); + switch (Action_Needs(Action2.Action)) { + case NEED_SPECIAL: + Action2.Data.Special = SpecialWeaponType(spc2.Current_Index()); + break; + + case NEED_HOUSE: + Action2.Data.House = HousesType(htype4list.Current_Index()); + break; + + case NEED_TRIGGER: + Action2.Trigger = TriggerTypeClass::From_Name(trtype2list.Current_Item()); + break; + + case NEED_TEAM: + Action2.Team = TeamTypeClass::From_Name(ttype4list.Current_Item()); + break; + + case NEED_NUMBER: + Action2.Data.Value = atoi(action2data.Get_Text()); + break; + + case NEED_WAYPOINT: + Action2.Data.Value = toupper(way4[0]) - 'A'; + if (way4[1] != '\0') { + Action2.Data.Value = (Action2.Data.Value + 1) * 26; + Action2.Data.Value += toupper(way4[1]) - 'A'; + } + break; + + case NEED_BOOL: + Action2.Data.Bool = booltype2list.Current_Index(); + break; + + case NEED_THEME: + Action2.Data.Theme = ThemeType(themetype2list.Current_Index()); + break; + + case NEED_MOVIE: + Action2.Data.Movie = VQType(movietype2list.Current_Index()); + break; + + case NEED_SOUND: + Action2.Data.Sound = VocType(soundtype2list.Current_Index()); + break; + + case NEED_SPEECH: + Action2.Data.Speech = VoxType(speechtype2list.Current_Index()); + break; + + case NEED_QUARRY: + Action2.Data.Quarry = QuarryType(qlist1.Current_Index()); + break; + } + return(true); + + case KN_ESC: + case BUTTON_CANCEL | KN_BUTTON: + process = false; + + /* + ** Always signal a redraw if any of the buttons were touched. This + ** can be determined by examining the button bit flag in the input + ** return value. + */ + default: + if (input & KN_BUTTON) { + display = true; + } + break; + } + } + return(false); +} +#endif + /*********************************************************************************************** * TriggerTypeClass::TriggerTypeClass -- Constructor for trigger class object. * * * @@ -192,1503 +1724,6 @@ void TriggerTypeClass::Detach(TARGET target, bool) Action2.Detach(target); } - -#ifdef SCENARIO_EDITOR -/*********************************************************************************************** - * TriggerTypeClass::Edit -- Edit the trigger type through the scenario editor. * - * * - * This is the scenario editor interface to a trigger type class object. It brings up a * - * fancy schmancy dialog to allow full edit control of the trigger type. * - * * - * INPUT: none * - * * - * OUTPUT: bool; Was the "OK" button pressed? A false return value indicates that the edits * - * to this trigger type class object should be rejected. * - * * - * WARNINGS: none * - * * - * HISTORY: * - * 07/09/1996 JLB : Created. * - *=============================================================================================*/ -bool TriggerTypeClass::Edit(void) -{ - enum { - /* - ** Dialog position and dimensions. - */ - D_DIALOG_W = 320 + 100, - D_DIALOG_H = 200 + 20, - D_DIALOG_X = 0, - D_DIALOG_Y = 0, - - /* - ** Event entry list box coordinates and dimensions. - */ - E1_X=D_DIALOG_X+45, - E1_Y=D_DIALOG_Y+65, - E2_X=E1_X, - E2_Y=E1_Y+22, - E_WIDTH=160, - E_HEIGHT=8*5, - - /* - ** Event optional data entry coordinates and dimensions. - */ - ED1_X=E1_X+E_WIDTH+20, - ED1_Y=E1_Y, - ED2_X=ED1_X, - ED2_Y=E2_Y, - - ED_WIDTH=95, - ED_HEIGHT=8*5, - - /* - ** Action entry list box coordinates. - */ - A1_X=E1_X, - A1_Y=D_DIALOG_Y+120, - A2_X=E1_X, - A2_Y=A1_Y+22, - - /* - ** Action optional data entry coordinates. - */ - AD1_X=A1_X+E_WIDTH+20, - AD1_Y=A1_Y, - AD2_X=AD1_X, - AD2_Y=A2_Y, - - /* - ** Misc control values. - */ - GENERAL_SIZE=10, // Text length for general data entry fields. - ENTRY_SIZE=35, // Maximum size of event or action description text. - WAYPOINT_SIZE=3, // Text length maximum for waypoint entry. - TEAM_SIZE=10, // Team name text entry field length. - DESC_SIZE=35 // Maximum length of object full name description. - }; - - /* - ** Button enumerations: - */ - enum { - EVENT_LIST=100, // Primary event list. - EVENT_LIST2, // Secondary event list. - ACTION_LIST, // Primary action list. - ACTION_LIST2, // Secondary action list. - NAME_EDIT, // Trigger name edit field. - DATA_SPEECH1, // Primary action speech. - DATA_SPEECH2, // Secondary action speech. - DATA_THEME1, // Primary action theme. - DATA_THEME2, // Secondary action theme. - DATA_MOVIE1, // Primary action movie. - DATA_MOVIE2, // Secondary action movie. - DATA_SOUND1, // Primary action sound effect. - DATA_SOUND2, // Secondary action sound effect. - DATA_SPECIAL1, // Primary action special weapon. - DATA_SPECIAL2, // Secondary action special weapon. - DATA_EDIT, // Primary event waypoint data field. - DATA_EDIT2, // Secondary event waypoint data field. - DATA_EDIT3, // Primary action waypoint data field. - DATA_EDIT4, // Secondary action waypoint data field. - DATA_HTYPE1, // Primary event house choice list. - DATA_HTYPE2, // Secondary event house choice list. - DATA_HTYPE3, // Primary action house choice list. - DATA_HTYPE4, // Secondary action house choice list. - DATA_BOOLTYPE1, // Primary action boolean data list. - DATA_BOOLTYPE2, // Secondary action boolean data list. - DATA_GENERAL1, // Primary event general data field. - DATA_GENERAL2, // Secondary event general data field. - DATA_GENERAL3, // Primary action general data field. - DATA_GENERAL4, // Secondary action general data field. - DATA_BTYPE1, // Primary event building type list. - DATA_BTYPE2, // Secondary event building type list. - DATA_ITYPE1, // Primary event infantry type list. - DATA_ITYPE2, // Secondary event infantry type list. - DATA_ATYPE1, // Primary event aircraft type list. - DATA_ATYPE2, // Secondary event aircraft type list. - DATA_UTYPE1, // Primary event unit type list. - DATA_UTYPE2, // Secondary event unit type list. - DATA_TTYPE1, // Primary event team type entry list. - DATA_TTYPE2, // Secondary event team type entry list. - DATA_TTYPE3, // Primary action team type entry list. - DATA_TTYPE4, // Secondary action team type entry list. - DATA_TRTYPE1, // Primary action trigger list. - DATA_TRTYPE2, // Secondary action trigger list. - BUTTON_HOUSE, // House ownership for this trigger. - BUTTON_PERSISTANCE, // Persistence of this trigger. - BUTTON_OK, // Ok button - save and exit. - BUTTON_CANCEL, // Cancel button - just exit. - BUTTON_ACTION, // Multiple action control button. - BUTTON_EVENT, // Multiple event control button. - }; - - /* - ** Dialog variables: - */ - bool cancel = false; // true = user cancels - int i; // loop counter - RemapControlType * scheme = GadgetClass::Get_Color_Scheme(); - - /* - ** Buttons - */ - ControlClass * commands = NULL; // the button list - - /* - ** List of events allowed. - */ - char eventtext[ENTRY_SIZE] = ""; - TDropListClass event1list(EVENT_LIST, eventtext, sizeof(eventtext), - TPF_EFNT | TPF_NOSHADOW, - E1_X, E1_Y, E_WIDTH, E_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char event2text[ENTRY_SIZE] = ""; - TDropListClass event2list(EVENT_LIST2, event2text, sizeof(event2text), - TPF_EFNT | TPF_NOSHADOW, - E2_X, E2_Y, E_WIDTH, E_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - for (TEventType event = TEVENT_FIRST; event < TEVENT_COUNT; event++) { - event1list.Add_Item(&EventChoices[event]); - event2list.Add_Item(&EventChoices[event]); - } - - PBubble_Sort(&event1list[0], event1list.Count()); - PBubble_Sort(&event2list[0], event2list.Count()); - - if (Event1.Event == TEVENT_NONE) Event1.Event = TEVENT_FIRST; - event1list.Set_Selected_Index(&EventChoices[Event1.Event]); - if (Event2.Event == TEVENT_NONE) Event2.Event = TEVENT_FIRST; - event2list.Set_Selected_Index(&EventChoices[Event2.Event]); - - /* - ** List of actions allowed. - */ - char actiontext[ENTRY_SIZE] = ""; - TDropListClass action1list(ACTION_LIST, actiontext, sizeof(actiontext), - TPF_EFNT | TPF_NOSHADOW, - A1_X, A1_Y, E_WIDTH, E_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char action2text[ENTRY_SIZE] = ""; - TDropListClass action2list(ACTION_LIST2, action2text, sizeof(action2text), - TPF_EFNT | TPF_NOSHADOW, - A2_X, A2_Y, E_WIDTH, E_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - for (TActionType action = TACTION_FIRST; action < TACTION_COUNT; action++) { - action1list.Add_Item(&ActionChoices[action]); - action2list.Add_Item(&ActionChoices[action]); - } - - PBubble_Sort(&action1list[0], action1list.Count()); - PBubble_Sort(&action2list[0], action2list.Count()); - - if (Action1.Action == ACTION_NONE) Action1.Action = TACTION_FIRST; - action1list.Set_Selected_Index(&ActionChoices[Action1.Action]); - if (Action2.Action == ACTION_NONE) Action2.Action = TACTION_FIRST; - action2list.Set_Selected_Index(&ActionChoices[Action2.Action]); - - /* - ** Optional waypoint entry field. - */ - char way1[WAYPOINT_SIZE] = "A"; - EditClass way1data(DATA_EDIT, way1, sizeof(way1), TPF_EFNT | TPF_NOSHADOW, - ED1_X, ED1_Y, ED_WIDTH, 9, EditClass::ALPHA); - if (Event_Needs(Event1.Event) == NEED_WAYPOINT) { - if (Event1.Data.Value < 26) { - sprintf(way1data.Get_Text(), "%c", Event1.Data.Value + 'A'); - } else { - sprintf(way1data.Get_Text(), "%c%c", (Event1.Data.Value / 26) + 'A'-1, (Event1.Data.Value % 26) + 'A'); - } - } - - char way2[WAYPOINT_SIZE] = "A"; - EditClass way2data(DATA_EDIT2, way2, sizeof(way2), TPF_EFNT | TPF_NOSHADOW, - ED2_X, ED2_Y, ED_WIDTH, 9, EditClass::ALPHA); - if (Event_Needs(Event2.Event) == NEED_WAYPOINT) { - if (Event2.Data.Value < 26) { - sprintf(way2data.Get_Text(), "%c", Event2.Data.Value + 'A'); - } else { - sprintf(way2data.Get_Text(), "%c%c", (Event2.Data.Value / 26) + 'A'-1, (Event2.Data.Value % 26) + 'A'); - } - } - - char way3[WAYPOINT_SIZE] = "A"; - EditClass way3data(DATA_EDIT3, way3, sizeof(way3), TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, 9, EditClass::ALPHA); - if (Action_Needs(Action1.Action) == NEED_WAYPOINT) { - if (Action1.Data.Value < 26) { - sprintf(way3data.Get_Text(), "%c", Action1.Data.Value + 'A'); - } else { - sprintf(way3data.Get_Text(), "%c%c", (Action1.Data.Value / 26) + 'A'-1, (Action1.Data.Value % 26) + 'A'); - } - } - - char way4[WAYPOINT_SIZE] = "A"; - EditClass way4data(DATA_EDIT4, way4, sizeof(way4), TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, 9, EditClass::ALPHA); - if (Action_Needs(Action2.Action) == NEED_WAYPOINT) { - if (Action2.Data.Value < 26) { - sprintf(way4data.Get_Text(), "%c", Action2.Data.Value + 'A'); - } else { - sprintf(way4data.Get_Text(), "%c%c", (Action2.Data.Value / 26) + 'A'-1, (Action2.Data.Value % 26) + 'A'); - } - } - - /* - ** Optional event data entry field. - */ - char databuf1[GENERAL_SIZE] = ""; - EditClass event1data(DATA_GENERAL1, databuf1, sizeof(databuf1), - TPF_EFNT | TPF_NOSHADOW, - ED1_X, ED1_Y, ED_WIDTH, 9, EditClass::NUMERIC); - switch (Event_Needs(Event1.Event)) { - case NEED_TIME: - case NEED_NUMBER: - sprintf(event1data.Get_Text(), "%d", Event1.Data.Value); - break; - } - - char databuf2[GENERAL_SIZE] = ""; - EditClass event2data(DATA_GENERAL2, databuf2, sizeof(databuf2), - TPF_EFNT | TPF_NOSHADOW, - ED2_X, ED2_Y, ED_WIDTH, 9, EditClass::NUMERIC); - switch (Event_Needs(Event2.Event)) { - case NEED_TIME: - case NEED_NUMBER: - sprintf(event2data.Get_Text(), "%d", Event2.Data.Value); - break; - } - - char actionbuf1[GENERAL_SIZE] = ""; - EditClass action1data(DATA_GENERAL3, actionbuf1, sizeof(actionbuf1), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, 9, EditClass::NUMERIC); - switch (Action_Needs(Action1.Action)) { - case NEED_NUMBER: - sprintf(action1data.Get_Text(), "%d", Action1.Data.Value); - break; - } - - char actionbuf2[GENERAL_SIZE] = ""; - EditClass action2data(DATA_GENERAL4, actionbuf2, sizeof(actionbuf2), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, 9, EditClass::NUMERIC); - switch (Action_Needs(Action2.Action)) { - case NEED_NUMBER: - sprintf(action2data.Get_Text(), "%d", Action2.Data.Value); - break; - } - - /* - ** Optional team entry list. - */ - char tbuf1[TEAM_SIZE] = ""; - DropListClass ttype1list(DATA_TTYPE1, tbuf1, sizeof(tbuf1), - TPF_EFNT | TPF_NOSHADOW, - ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char tbuf2[TEAM_SIZE] = ""; - DropListClass ttype2list(DATA_TTYPE2, tbuf2, sizeof(tbuf2), - TPF_EFNT | TPF_NOSHADOW, - ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char tbuf3[TEAM_SIZE] = ""; - DropListClass ttype3list(DATA_TTYPE3, tbuf3, sizeof(tbuf3), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char tbuf4[TEAM_SIZE] = ""; - DropListClass ttype4list(DATA_TTYPE4, tbuf4, sizeof(tbuf4), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (int index = 0; index < TeamTypes.Count(); index++) { - ttype1list.Add_Item(TeamTypes.Ptr(index)->IniName); - ttype2list.Add_Item(TeamTypes.Ptr(index)->IniName); - ttype3list.Add_Item(TeamTypes.Ptr(index)->IniName); - ttype4list.Add_Item(TeamTypes.Ptr(index)->IniName); - } - - if (Event1.Team.Is_Valid()) { - ttype1list.Set_Selected_Index(Event1.Team->IniName); - } else { - ttype1list.Set_Selected_Index(0); - } - if (Event2.Team.Is_Valid()) { - ttype2list.Set_Selected_Index(Event2.Team->IniName); - } else { - ttype2list.Set_Selected_Index(0); - } - if (Action1.Team.Is_Valid()) { - ttype3list.Set_Selected_Index(Action1.Team->IniName); - } else { - ttype3list.Set_Selected_Index(0); - } - if (Action2.Team.Is_Valid()) { - ttype4list.Set_Selected_Index(Action2.Team->IniName); - } else { - ttype4list.Set_Selected_Index(0); - } - - /* - ** Optional trigger entry list. - */ - char trbuf1[TEAM_SIZE] = ""; - DropListClass trtype1list(DATA_TRTYPE1, trbuf1, sizeof(trbuf1), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char trbuf2[TEAM_SIZE] = ""; - DropListClass trtype2list(DATA_TRTYPE2, trbuf2, sizeof(trbuf2), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (index = 0; index < TriggerTypes.Count(); index++) { - trtype1list.Add_Item(TriggerTypes.Ptr(index)->IniName); - trtype2list.Add_Item(TriggerTypes.Ptr(index)->IniName); - } - - if (Action1.Trigger.Is_Valid()) { - trtype1list.Set_Selected_Index(Action1.Trigger->IniName); - } else { - trtype1list.Set_Selected_Index(0); - } - if (Action2.Trigger.Is_Valid()) { - trtype2list.Set_Selected_Index(Action2.Trigger->IniName); - } else { - trtype2list.Set_Selected_Index(0); - } - - /* - ** Optional boolean value list. - */ - char boolbuf1[TEAM_SIZE] = ""; - DropListClass booltype1list(DATA_BOOLTYPE1, boolbuf1, sizeof(boolbuf1), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char boolbuf2[TEAM_SIZE] = ""; - DropListClass booltype2list(DATA_BOOLTYPE2, boolbuf2, sizeof(boolbuf2), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - booltype1list.Add_Item("OFF"); - booltype1list.Add_Item("ON"); - booltype2list.Add_Item("OFF"); - booltype2list.Add_Item("ON"); - - booltype1list.Set_Selected_Index(Action1.Data.Bool); - booltype2list.Set_Selected_Index(Action2.Data.Bool); - - /* - ** Optional musical theme choice list. - */ - char themebuf1[DESC_SIZE] = ""; - DropListClass themetype1list(DATA_THEME1, themebuf1, sizeof(themebuf1), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char themebuf2[DESC_SIZE] = ""; - DropListClass themetype2list(DATA_THEME2, themebuf2, sizeof(themebuf2), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (ThemeType theme = THEME_FIRST; theme < THEME_COUNT; theme++) { - themetype1list.Add_Item(Theme.Full_Name(theme)); - themetype2list.Add_Item(Theme.Full_Name(theme)); - } - - if (Action_Needs(Action1.Action) == NEED_THEME) { - themetype1list.Set_Selected_Index(Action1.Data.Theme); - } else { - themetype1list.Set_Selected_Index(0); - } - if (Action_Needs(Action2.Action) == NEED_THEME) { - themetype2list.Set_Selected_Index(Action2.Data.Theme); - } else { - themetype2list.Set_Selected_Index(0); - } - - /* - ** Optional movie list. - */ - char moviebuf1[DESC_SIZE] = ""; - DropListClass movietype1list(DATA_MOVIE1, moviebuf1, sizeof(moviebuf1), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char moviebuf2[DESC_SIZE] = ""; - DropListClass movietype2list(DATA_MOVIE2, moviebuf2, sizeof(moviebuf2), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (VQType movie = VQ_FIRST; movie < VQ_COUNT; movie++) { - movietype1list.Add_Item(VQName[movie]); - movietype2list.Add_Item(VQName[movie]); - } - - if (Action_Needs(Action1.Action) == NEED_MOVIE) { - movietype1list.Set_Selected_Index(Action1.Data.Movie); - } else { - movietype1list.Set_Selected_Index(0); - } - if (Action_Needs(Action2.Action) == NEED_MOVIE) { - movietype2list.Set_Selected_Index(Action2.Data.Movie); - } else { - movietype2list.Set_Selected_Index(0); - } - - /* - ** Optional sound effect list. - */ - char soundbuf1[DESC_SIZE] = ""; - DropListClass soundtype1list(DATA_SOUND1, soundbuf1, sizeof(soundbuf1), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char soundbuf2[DESC_SIZE] = ""; - DropListClass soundtype2list(DATA_SOUND2, soundbuf2, sizeof(soundbuf2), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (VocType sound = VOC_FIRST; sound < VOC_COUNT; sound++) { - soundtype1list.Add_Item(Voc_Name(sound)); - soundtype2list.Add_Item(Voc_Name(sound)); - } - - if (Action_Needs(Action1.Action) == NEED_SOUND) { - soundtype1list.Set_Selected_Index(Action1.Data.Sound); - } else { - soundtype1list.Set_Selected_Index(0); - } - if (Action_Needs(Action2.Action) == NEED_SOUND) { - soundtype2list.Set_Selected_Index(Action2.Data.Sound); - } else { - soundtype2list.Set_Selected_Index(0); - } - - /* - ** Optional speech effect list. - */ - char speechbuf1[DESC_SIZE] = ""; - DropListClass speechtype1list(DATA_SPEECH1, speechbuf1, sizeof(speechbuf1), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char speechbuf2[DESC_SIZE] = ""; - DropListClass speechtype2list(DATA_SPEECH2, speechbuf2, sizeof(speechbuf2), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (VoxType speech = VOX_FIRST; speech < VOX_COUNT; speech++) { - speechtype1list.Add_Item(Speech_Name(speech)); - speechtype2list.Add_Item(Speech_Name(speech)); - } - - if (Action_Needs(Action1.Action) == NEED_SPEECH) { - speechtype1list.Set_Selected_Index(Action1.Data.Speech); - } else { - speechtype1list.Set_Selected_Index(0); - } - if (Action_Needs(Action2.Action) == NEED_SPEECH) { - speechtype2list.Set_Selected_Index(Action2.Data.Speech); - } else { - speechtype2list.Set_Selected_Index(0); - } - - /* - ** Optional building type entry list. - */ - char bbuf1[DESC_SIZE] = ""; - DropListClass btype1list(DATA_BTYPE1, bbuf1, sizeof(bbuf1), - TPF_EFNT | TPF_NOSHADOW, - ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char bbuf2[DESC_SIZE] = ""; - DropListClass btype2list(DATA_BTYPE2, bbuf2, sizeof(bbuf2), - TPF_EFNT | TPF_NOSHADOW, - ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (StructType ss = STRUCT_FIRST; ss < STRUCT_COUNT; ss++) { - btype1list.Add_Item(Text_String(BuildingTypeClass::As_Reference(ss).Full_Name())); - btype2list.Add_Item(Text_String(BuildingTypeClass::As_Reference(ss).Full_Name())); - } - - if (Event_Needs(Event1.Event) == NEED_STRUCTURE) { - btype1list.Set_Selected_Index(Event1.Data.Structure); - } else { - btype1list.Set_Selected_Index(0); - } - if (Event_Needs(Event2.Event) == NEED_STRUCTURE) { - btype2list.Set_Selected_Index(Event2.Data.Structure); - } else { - btype2list.Set_Selected_Index(0); - } - - /* - ** Optional infantry type entry list. - */ - char ibuf1[DESC_SIZE] = ""; - DropListClass itype1list(DATA_ITYPE1, ibuf1, sizeof(ibuf1), - TPF_EFNT | TPF_NOSHADOW, - ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char ibuf2[DESC_SIZE] = ""; - DropListClass itype2list(DATA_ITYPE2, ibuf2, sizeof(ibuf2), - TPF_EFNT | TPF_NOSHADOW, - ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (InfantryType ii = INFANTRY_FIRST; ii < INFANTRY_COUNT; ii++) { - itype1list.Add_Item(Text_String(InfantryTypeClass::As_Reference(ii).Full_Name())); - itype2list.Add_Item(Text_String(InfantryTypeClass::As_Reference(ii).Full_Name())); - } - - if (Event_Needs(Event1.Event) == NEED_INFANTRY) { - itype1list.Set_Selected_Index(Event1.Data.Infantry); - } else { - itype1list.Set_Selected_Index(0); - } - if (Event_Needs(Event2.Event) == NEED_INFANTRY) { - itype2list.Set_Selected_Index(Event2.Data.Infantry); - } else { - itype2list.Set_Selected_Index(0); - } - - /* - ** Optional aircraft type entry list. - */ - char abuf1[DESC_SIZE] = ""; - DropListClass atype1list(DATA_ATYPE1, abuf1, sizeof(abuf1), - TPF_EFNT | TPF_NOSHADOW, - ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char abuf2[DESC_SIZE] = ""; - DropListClass atype2list(DATA_ATYPE2, abuf2, sizeof(abuf2), - TPF_EFNT | TPF_NOSHADOW, - ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (AircraftType aa = AIRCRAFT_FIRST; aa < AIRCRAFT_COUNT; aa++) { - atype1list.Add_Item(Text_String(AircraftTypeClass::As_Reference(aa).Full_Name())); - atype2list.Add_Item(Text_String(AircraftTypeClass::As_Reference(aa).Full_Name())); - } - - if (Event_Needs(Event1.Event) == NEED_AIRCRAFT) { - atype1list.Set_Selected_Index(Event1.Data.Aircraft); - } else { - atype1list.Set_Selected_Index(0); - } - if (Event_Needs(Event2.Event) == NEED_AIRCRAFT) { - atype2list.Set_Selected_Index(Event2.Data.Aircraft); - } else { - atype2list.Set_Selected_Index(0); - } - - /* - ** Optional unit type entry list. - */ - char ubuf1[DESC_SIZE] = ""; - DropListClass utype1list(DATA_UTYPE1, ubuf1, sizeof(ubuf1), - TPF_EFNT | TPF_NOSHADOW, - ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char ubuf2[DESC_SIZE] = ""; - DropListClass utype2list(DATA_UTYPE2, ubuf2, sizeof(ubuf2), - TPF_EFNT | TPF_NOSHADOW, - ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (UnitType uu = UNIT_FIRST; uu < UNIT_COUNT; uu++) { - utype1list.Add_Item(Text_String(UnitTypeClass::As_Reference(uu).Full_Name())); - utype2list.Add_Item(Text_String(UnitTypeClass::As_Reference(uu).Full_Name())); - } - - if (Event_Needs(Event1.Event) == NEED_UNIT) { - utype1list.Set_Selected_Index(Event1.Data.Unit); - } else { - utype1list.Set_Selected_Index(0); - } - if (Event_Needs(Event2.Event) == NEED_UNIT) { - utype2list.Set_Selected_Index(Event2.Data.Unit); - } else { - utype2list.Set_Selected_Index(0); - } - - /* - ** Optional house type entry list. - */ - char housebuf1[DESC_SIZE] = ""; - DropListClass htype1list(DATA_HTYPE1, housebuf1, sizeof(housebuf1), - TPF_EFNT | TPF_NOSHADOW, - ED1_X, ED1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char housebuf2[DESC_SIZE] = ""; - DropListClass htype2list(DATA_HTYPE2, housebuf2, sizeof(housebuf2), - TPF_EFNT | TPF_NOSHADOW, - ED2_X, ED2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char housebuf3[DESC_SIZE] = ""; - DropListClass htype3list(DATA_HTYPE3, housebuf3, sizeof(housebuf3), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char housebuf4[DESC_SIZE] = ""; - DropListClass htype4list(DATA_HTYPE4, housebuf4, sizeof(housebuf4), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - - for (HousesType hh = HOUSE_FIRST; hh < HOUSE_COUNT; hh++) { - htype1list.Add_Item(HouseTypeClass::As_Reference(hh).IniName); - htype2list.Add_Item(HouseTypeClass::As_Reference(hh).IniName); - htype3list.Add_Item(HouseTypeClass::As_Reference(hh).IniName); - htype4list.Add_Item(HouseTypeClass::As_Reference(hh).IniName); - } - - if (Event_Needs(Event1.Event) == NEED_HOUSE) { - htype1list.Set_Selected_Index(Event1.Data.House); - } else { - htype1list.Set_Selected_Index(0); - } - if (Event_Needs(Event2.Event) == NEED_HOUSE) { - htype2list.Set_Selected_Index(Event2.Data.House); - } else { - htype2list.Set_Selected_Index(0); - } - if (Action_Needs(Action1.Action) == NEED_HOUSE) { - htype3list.Set_Selected_Index(Action1.Data.House); - } else { - htype3list.Set_Selected_Index(0); - } - if (Action_Needs(Action2.Action) == NEED_HOUSE) { - htype4list.Set_Selected_Index(Action2.Data.House); - } else { - htype4list.Set_Selected_Index(0); - } - - /* - ** Optional special weapon list. - */ - char special1[DESC_SIZE] = ""; - DropListClass spc1(DATA_SPECIAL1, special1, sizeof(special1), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char special2[DESC_SIZE] = ""; - DropListClass spc2(DATA_SPECIAL2, special2, sizeof(special2), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - for (SpecialWeaponType spec = SPC_FIRST; spec < SPC_COUNT; spec++) { - spc1.Add_Item(SpecialWeaponName[spec]); - spc2.Add_Item(SpecialWeaponName[spec]); - } - if ((unsigned)Action1.Data.Special < SPC_COUNT) { - spc1.Set_Selected_Index(Action1.Data.Special); - } else { - spc1.Set_Selected_Index(0); - } - if ((unsigned)Action2.Data.Special < SPC_COUNT) { - spc2.Set_Selected_Index(Action2.Data.Special); - } else { - spc2.Set_Selected_Index(0); - } - - /* - ** Optional quarry type. - */ - char quarry1[DESC_SIZE] = ""; - DropListClass qlist1(DATA_SPECIAL1, quarry1, sizeof(quarry1), - TPF_EFNT | TPF_NOSHADOW, - AD1_X, AD1_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - char quarry2[DESC_SIZE] = ""; - DropListClass qlist2(DATA_SPECIAL2, quarry2, sizeof(quarry2), - TPF_EFNT | TPF_NOSHADOW, - AD2_X, AD2_Y, ED_WIDTH, ED_HEIGHT, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - for (QuarryType q = QUARRY_FIRST; q < QUARRY_COUNT; q++) { - qlist1.Add_Item(QuarryName[q]); - qlist2.Add_Item(QuarryName[q]); - } - if ((unsigned)Action1.Data.Quarry < QUARRY_COUNT) { - qlist1.Set_Selected_Index(Action1.Data.Quarry); - } else { - qlist1.Set_Selected_Index(0); - } - if ((unsigned)Action2.Data.Quarry < QUARRY_COUNT) { - qlist2.Set_Selected_Index(Action2.Data.Quarry); - } else { - qlist2.Set_Selected_Index(0); - } - - /* - ** Name of this trigger text edit field. - */ - char namebuf[5] = ""; - EditClass name_edt(NAME_EDIT, namebuf, sizeof(namebuf), TPF_EFNT | TPF_NOSHADOW, D_DIALOG_X+40, D_DIALOG_Y+30, 40, 9, EditClass::ALPHANUMERIC); - strcpy(namebuf, IniName); // Name - - /* - ** Create the list of house's allowed for trigger. - */ - char housetext[DESC_SIZE] = ""; - DropListClass housebtn(BUTTON_HOUSE, housetext, sizeof(housetext), - TPF_EFNT | TPF_NOSHADOW, - name_edt.X+name_edt.Width+20, name_edt.Y, 95, 8*5, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - for (HousesType house = HOUSE_FIRST; house < HOUSE_COUNT; house++) { - housebtn.Add_Item(HouseTypeClass::As_Reference(house).IniName); - } - if (House == HOUSE_NONE) House = HOUSE_GOOD; - housebtn.Set_Selected_Index(House); - - /* - ** Must match order and number of PersistantType specified in - ** TriggerTypeClass definition. - */ - char perstext[DESC_SIZE] = ""; - static char * _perstext[3] = { - "Volatile", - "Semi-persistent", - "Persistent" - }; - DropListClass persbtn(BUTTON_PERSISTANCE, perstext, sizeof(perstext), - TPF_EFNT | TPF_NOSHADOW, - housebtn.X+housebtn.Width+20, housebtn.Y, 105, 8*5, - MFCD::Retrieve("EBTN-UP.SHP"), - MFCD::Retrieve("EBTN-DN.SHP")); - for (i = 0; i < sizeof(_perstext)/sizeof(_perstext[0]); i++) { - persbtn.Add_Item(_perstext[i]); - } - persbtn.Set_Selected_Index(IsPersistant); - - /* - ** This button controls the existence and relationship of a second trigger - ** event. - */ - int eventflag = EventControl; - TextButtonClass eventbtn(BUTTON_EVENT, TXT_TRIGGER_JUST_EVENT, TPF_EBUTTON, event1list.X, event1list.Y+11, 100, 9); - - /* - ** This button controls the existence of a secondary action. - */ - bool actionflag = ActionControl; - TextButtonClass actionbtn(BUTTON_ACTION, TXT_TRIGGER_JUST_ACTION, TPF_EBUTTON, action1list.X, action1list.Y+11, 100, 9); - - /* - ** Create the ubiquitous OK and Cancel buttons. - */ - TextButtonClass okbtn(BUTTON_OK, TXT_OK, TPF_EBUTTON, D_DIALOG_X+35, D_DIALOG_Y+D_DIALOG_H-30, 45, 9); - TextButtonClass cancelbtn(BUTTON_CANCEL, TXT_CANCEL, TPF_EBUTTON, D_DIALOG_X+D_DIALOG_W-80, D_DIALOG_Y+D_DIALOG_H-30, 45, 9); - - /* - ** Initialize - */ - Set_Logic_Page(SeenBuff); - - /* - ** Build the button list - */ - commands = &okbtn; - cancelbtn.Add_Tail(*commands); - event1list.Add_Tail(*commands); - action1list.Add_Tail(*commands); - eventbtn.Add_Tail(*commands); - actionbtn.Add_Tail(*commands); - name_edt.Add_Tail(*commands); - persbtn.Add_Tail(*commands); - housebtn.Add_Tail(*commands); - - /* - ** Main Processing Loop - */ - bool display = true; - bool process = true; - while (process) { - - /* - ** Invoke game callback - */ - Call_Back(); - - /* - ** Refresh display if needed - */ - if (display /*&& LogicPage->Lock()*/) { - - /* - ** Display the dialog box - */ - Hide_Mouse(); - Dialog_Box(D_DIALOG_X, D_DIALOG_Y, D_DIALOG_W, D_DIALOG_H); - Draw_Caption(TXT_TRIGGER_EDITOR, D_DIALOG_X, D_DIALOG_Y, D_DIALOG_W); - - /* - ** Draw the captions - */ - Fancy_Text_Print("Trigger Event:", event1list.X, event1list.Y - 7, scheme, TBLACK, TPF_EFNT | TPF_NOSHADOW); - Fancy_Text_Print("Action to Perform:", action1list.X, action1list.Y - 7, scheme, TBLACK, TPF_EFNT | TPF_NOSHADOW); - Fancy_Text_Print("House:", housebtn.X, housebtn.Y - 7, scheme, TBLACK, TPF_EFNT | TPF_NOSHADOW); - Fancy_Text_Print("Name:", name_edt.X, name_edt.Y - 7, scheme, TBLACK, TPF_EFNT | TPF_NOSHADOW); - Fancy_Text_Print("Persistence:", persbtn.X, persbtn.Y - 7, scheme, TBLACK, TPF_EFNT | TPF_NOSHADOW); - - if (eventflag == 3) { - LogicPage->Draw_Line(event1list.X-1, event1list.Y+3, event1list.X-2*RESFACTOR, event1list.Y+3, WHITE); - LogicPage->Draw_Line(event1list.X-2*RESFACTOR, event1list.Y+3, action1list.X-2*RESFACTOR, action1list.Y+3, WHITE); - LogicPage->Draw_Line(action1list.X-1, action1list.Y+3, action1list.X-2*RESFACTOR, action1list.Y+3, WHITE); - - LogicPage->Draw_Line(event2list.X-1, event2list.Y+3, event2list.X-5*RESFACTOR, event2list.Y+3, WHITE); - LogicPage->Draw_Line(event2list.X-5*RESFACTOR, event2list.Y+3, action2list.X-5*RESFACTOR, action2list.Y+3, WHITE); - LogicPage->Draw_Line(action2list.X-1, action2list.Y+3, action2list.X-5*RESFACTOR, action2list.Y+3, WHITE); - } - - /* - ** Adjust the button list to match current control settings. - */ - event2list.Remove(); - switch (eventflag) { - case 0: - eventbtn.Set_Text(TXT_TRIGGER_JUST_EVENT); - break; - - case 1: - eventbtn.Set_Text(TXT_TRIGGER_AND); - event2list.Add(*commands); - break; - - case 2: - eventbtn.Set_Text(TXT_TRIGGER_OR); - event2list.Add(*commands); - break; - - case 3: - eventbtn.Set_Text(TXT_TRIGGER_LINKED); - event2list.Add(*commands); - break; - } - - /* - ** Prepare the primary event data field. - */ - htype1list.Remove(); - way1data.Remove(); - event1data.Remove(); - btype1list.Remove(); - itype1list.Remove(); - atype1list.Remove(); - utype1list.Remove(); - ttype1list.Remove(); - switch (Event_Needs(*event1list.Current_Item())) { - case NEED_HOUSE: - htype1list.Add(*commands); - break; - - case NEED_TEAM: - ttype1list.Add(*commands); - break; - - case NEED_WAYPOINT: - way1data.Add(*commands); - break; - - case NEED_TIME: - case NEED_NUMBER: - event1data.Add(*commands); - break; - - case NEED_STRUCTURE: - btype1list.Add(*commands); - break; - - case NEED_INFANTRY: - itype1list.Add(*commands); - break; - - case NEED_AIRCRAFT: - atype1list.Add(*commands); - break; - - case NEED_UNIT: - utype1list.Add(*commands); - break; - - default: - break; - } - - /* - ** Prepare the secondary event data field. - */ - htype2list.Remove(); - way2data.Remove(); - event2data.Remove(); - btype2list.Remove(); - itype2list.Remove(); - atype2list.Remove(); - utype2list.Remove(); - ttype2list.Remove(); - if (commands->Extract_Gadget(EVENT_LIST2)) { - switch (Event_Needs(*event2list.Current_Item())) { - case NEED_HOUSE: - htype2list.Add(*commands); - break; - - case NEED_TEAM: - ttype2list.Add(*commands); - break; - - case NEED_WAYPOINT: - way2data.Add(*commands); - break; - - case NEED_TIME: - case NEED_NUMBER: - event2data.Add(*commands); - break; - - case NEED_STRUCTURE: - btype2list.Add(*commands); - break; - - case NEED_INFANTRY: - itype2list.Add(*commands); - break; - - case NEED_AIRCRAFT: - atype2list.Add(*commands); - break; - - case NEED_UNIT: - utype2list.Add(*commands); - break; - - default: - break; - } - } - - /* - ** Setup the action buttons and associated data entry fields. - */ - actionbtn.Remove(); - action2list.Remove(); - if (eventflag == 3) { - action2list.Add(*commands); - } else { - actionbtn.Add(*commands); - if (actionflag) { - actionbtn.Set_Text(TXT_TRIGGER_AND); - action2list.Add(*commands); - } else { - actionbtn.Set_Text(TXT_TRIGGER_JUST_ACTION); - } - } - - qlist1.Remove(); - spc1.Remove(); - htype3list.Remove(); - booltype1list.Remove(); - trtype1list.Remove(); - way3data.Remove(); - action1data.Remove(); - ttype3list.Remove(); - themetype1list.Remove(); - soundtype1list.Remove(); - movietype1list.Remove(); - speechtype1list.Remove(); - switch (Action_Needs(*action1list.Current_Item())) { - case NEED_MOVIE: - movietype1list.Add(*commands); - break; - - case NEED_SPECIAL: - spc1.Add(*commands); - break; - - case NEED_HOUSE: - htype3list.Add(*commands); - break; - - case NEED_BOOL: - booltype1list.Add(*commands); - break; - - case NEED_TRIGGER: - trtype1list.Add(*commands); - break; - - case NEED_TEAM: - ttype3list.Add(*commands); - break; - - case NEED_NUMBER: - action1data.Add(*commands); - break; - - case NEED_WAYPOINT: - way3data.Add(*commands); - break; - - case NEED_THEME: - themetype1list.Add(*commands); - break; - - case NEED_SOUND: - soundtype1list.Add(*commands); - break; - - case NEED_SPEECH: - speechtype1list.Add(*commands); - break; - - case NEED_QUARRY: - qlist1.Add(*commands); - break; - } - - qlist2.Remove(); - spc2.Remove(); - htype4list.Remove(); - booltype2list.Remove(); - trtype2list.Remove(); - way4data.Remove(); - action2data.Remove(); - ttype4list.Remove(); - themetype2list.Remove(); - soundtype2list.Remove(); - movietype2list.Remove(); - speechtype2list.Remove(); - if (commands->Extract_Gadget(ACTION_LIST2)) { - switch (Action_Needs(*action2list.Current_Item())) { - case NEED_MOVIE: - movietype2list.Add(*commands); - break; - - case NEED_SPECIAL: - spc2.Add(*commands); - break; - - case NEED_HOUSE: - htype4list.Add(*commands); - break; - - case NEED_BOOL: - booltype2list.Add(*commands); - break; - - case NEED_TRIGGER: - trtype2list.Add(*commands); - break; - - case NEED_TEAM: - ttype4list.Add(*commands); - break; - - case NEED_NUMBER: - action2data.Add(*commands); - break; - - case NEED_WAYPOINT: - way4data.Add(*commands); - break; - - case NEED_THEME: - themetype2list.Add(*commands); - break; - - case NEED_SOUND: - soundtype2list.Add(*commands); - break; - - case NEED_SPEECH: - speechtype2list.Add(*commands); - break; - - case NEED_QUARRY: - qlist2.Add(*commands); - break; - } - } - - /* - ** Collapse any dropped down list boxes. - */ - spc1.Collapse(); - spc2.Collapse(); - qlist1.Collapse(); - qlist2.Collapse(); - htype1list.Collapse(); - htype2list.Collapse(); - htype3list.Collapse(); - htype4list.Collapse(); - ttype1list.Collapse(); - ttype2list.Collapse(); - ttype3list.Collapse(); - ttype4list.Collapse(); - btype1list.Collapse(); - btype2list.Collapse(); - utype1list.Collapse(); - utype2list.Collapse(); - itype1list.Collapse(); - itype2list.Collapse(); - atype1list.Collapse(); - atype2list.Collapse(); - trtype1list.Collapse(); - trtype2list.Collapse(); - action1list.Collapse(); - action2list.Collapse(); - event1list.Collapse(); - event2list.Collapse(); - housebtn.Collapse(); - persbtn.Collapse(); - booltype1list.Collapse(); - booltype2list.Collapse(); - themetype1list.Collapse(); - themetype2list.Collapse(); - soundtype1list.Collapse(); - soundtype2list.Collapse(); - movietype1list.Collapse(); - movietype2list.Collapse(); - speechtype1list.Collapse(); - speechtype2list.Collapse(); - commands->Flag_List_To_Redraw(); - Show_Mouse(); - display = false; -// LogicPage->Unlock(); - } - - /* - ** Get user input - */ - KeyNumType input = commands->Input(); - - /* - ** Process input - */ - switch (input) { - case BUTTON_EVENT | KN_BUTTON: - eventflag = (eventflag+1) % 4; - display = true; - break; - - case BUTTON_ACTION | KN_BUTTON: - actionflag = (actionflag == false); - display = true; - break; - - case DATA_SPEECH1 | KN_BUTTON: - Speak(VoxType(speechtype1list.Current_Index())); - display = true; - break; - - case DATA_SPEECH2 | KN_BUTTON: - Speak(VoxType(speechtype2list.Current_Index())); - display = true; - break; - - case DATA_SOUND1 | KN_BUTTON: - Sound_Effect(VocType(soundtype1list.Current_Index())); - display = true; - break; - - case DATA_SOUND2 | KN_BUTTON: - Sound_Effect(VocType(soundtype2list.Current_Index())); - display = true; - break; - - /* - ** Transfer all the necessary values from the edit fields into their - ** respective positions within the trigger object. - */ - case KN_RETURN: - case BUTTON_OK | KN_BUTTON: - House = HousesType(housebtn.Current_Index()); - IsPersistant = PersistantType(persbtn.Current_Index()); - if (strlen(namebuf)==0) { - Set_Name("____"); - } else { - Set_Name(namebuf); - } - - /* - ** Primary event specific data retrieval. - */ - EventControl = MultiStyleType(eventflag); - Event1.Event = *event1list.Current_Item(); - switch (Event_Needs(Event1.Event)) { - case NEED_HOUSE: - Event1.Data.House = HousesType(htype1list.Current_Index()); - break; - - case NEED_TIME: - Event1.Data.Value = atoi(event1data.Get_Text()); - break; - - case NEED_NUMBER: - Event1.Data.Value = atoi(event1data.Get_Text()); - break; - - case NEED_STRUCTURE: - Event1.Data.Structure = StructType(btype1list.Current_Index()); - break; - - case NEED_UNIT: - Event1.Data.Unit = UnitType(utype1list.Current_Index()); - break; - - case NEED_INFANTRY: - Event1.Data.Infantry = InfantryType(itype1list.Current_Index()); - break; - - case NEED_AIRCRAFT: - Event1.Data.Aircraft = AircraftType(atype1list.Current_Index()); - break; - - case NEED_WAYPOINT: - Event1.Data.Value = toupper(way1[0]) - 'A'; - if (way1[1] != '\0') { - Event1.Data.Value = (Event1.Data.Value+1)*26; - Event1.Data.Value += toupper(way1[1]) - 'A'; - } - break; - - case NEED_TEAM: - Event1.Team = TeamTypeClass::From_Name(ttype1list.Current_Item()); - break; - } - - /* - ** Secondary event specific data retrieval. - */ - Event2.Event = *event2list.Current_Item(); - switch (Event_Needs(Event2.Event)) { - case NEED_HOUSE: - Event2.Data.House = HousesType(htype2list.Current_Index()); - break; - - case NEED_TIME: - Event2.Data.Value = atoi(event2data.Get_Text()); - break; - - case NEED_NUMBER: - Event2.Data.Value = atoi(event2data.Get_Text()); - break; - - case NEED_STRUCTURE: - Event2.Data.Structure = StructType(btype2list.Current_Index()); - break; - - case NEED_UNIT: - Event2.Data.Unit = UnitType(utype2list.Current_Index()); - break; - - case NEED_INFANTRY: - Event2.Data.Infantry = InfantryType(itype2list.Current_Index()); - break; - - case NEED_AIRCRAFT: - Event2.Data.Aircraft = AircraftType(atype2list.Current_Index()); - break; - - case NEED_WAYPOINT: - Event2.Data.Value = toupper(way2[0]) - 'A'; - if (way2[1] != '\0') { - Event2.Data.Value = (Event2.Data.Value+1)*26; - Event2.Data.Value += toupper(way2[1]) - 'A'; - } - break; - - case NEED_TEAM: - Event2.Team = TeamTypeClass::As_Pointer(ttype2list.Current_Item()); - break; - } - - /* - ** Primary action data retrieval. - */ - ActionControl = MultiStyleType(actionflag); - Action1.Action = *action1list.Current_Item(); - switch (Action_Needs(Action1.Action)) { - case NEED_SPECIAL: - Action1.Data.Special = SpecialWeaponType(spc1.Current_Index()); - break; - - case NEED_HOUSE: - Action1.Data.House = HousesType(htype3list.Current_Index()); - break; - - case NEED_TRIGGER: - Action1.Trigger = TriggerTypeClass::From_Name(trtype1list.Current_Item()); - break; - - case NEED_TEAM: - Action1.Team = TeamTypeClass::From_Name(ttype3list.Current_Item()); - break; - - case NEED_NUMBER: - Action1.Data.Value = atoi(action1data.Get_Text()); - break; - - case NEED_WAYPOINT: - Action1.Data.Value = toupper(way3[0]) - 'A'; - if (way3[1] != '\0') { - Action1.Data.Value = (Action1.Data.Value+1)*26; - Action1.Data.Value += toupper(way3[1]) - 'A'; - } - break; - - case NEED_BOOL: - Action1.Data.Bool = booltype1list.Current_Index(); - break; - - case NEED_THEME: - Action1.Data.Theme = ThemeType(themetype1list.Current_Index()); - break; - - case NEED_SOUND: - Action1.Data.Sound = VocType(soundtype1list.Current_Index()); - break; - - case NEED_MOVIE: - Action1.Data.Movie = VQType(movietype1list.Current_Index()); - break; - - case NEED_SPEECH: - Action1.Data.Speech = VoxType(speechtype1list.Current_Index()); - break; - - case NEED_QUARRY: - Action1.Data.Quarry = QuarryType(qlist1.Current_Index()); - break; - } - - /* - ** Secondary action data retrieval. - */ - Action2.Action = *action2list.Current_Item(); - switch (Action_Needs(Action2.Action)) { - case NEED_SPECIAL: - Action2.Data.Special = SpecialWeaponType(spc2.Current_Index()); - break; - - case NEED_HOUSE: - Action2.Data.House = HousesType(htype4list.Current_Index()); - break; - - case NEED_TRIGGER: - Action2.Trigger = TriggerTypeClass::From_Name(trtype2list.Current_Item()); - break; - - case NEED_TEAM: - Action2.Team = TeamTypeClass::From_Name(ttype4list.Current_Item()); - break; - - case NEED_NUMBER: - Action2.Data.Value = atoi(action2data.Get_Text()); - break; - - case NEED_WAYPOINT: - Action2.Data.Value = toupper(way4[0]) - 'A'; - if (way4[1] != '\0') { - Action2.Data.Value = (Action2.Data.Value+1)*26; - Action2.Data.Value += toupper(way4[1]) - 'A'; - } - break; - - case NEED_BOOL: - Action2.Data.Bool = booltype2list.Current_Index(); - break; - - case NEED_THEME: - Action2.Data.Theme = ThemeType(themetype2list.Current_Index()); - break; - - case NEED_MOVIE: - Action2.Data.Movie = VQType(movietype2list.Current_Index()); - break; - - case NEED_SOUND: - Action2.Data.Sound = VocType(soundtype2list.Current_Index()); - break; - - case NEED_SPEECH: - Action2.Data.Speech = VoxType(speechtype2list.Current_Index()); - break; - - case NEED_QUARRY: - Action2.Data.Quarry = QuarryType(qlist1.Current_Index()); - break; - } - return(true); - - case KN_ESC: - case BUTTON_CANCEL | KN_BUTTON: - process = false; - - /* - ** Always signal a redraw if any of the buttons were touched. This - ** can be determined by examining the button bit flag in the input - ** return value. - */ - default: - if (input & KN_BUTTON) { - display = true; - } - break; - } - } - return(false); -} -#endif - - #if defined(CHEAT_KEYS) || defined(SCENARIO_EDITOR) /*********************************************************************************************** * TriggerTypeClass::Description -- Build a text description of the trigger type. * diff --git a/REDALERT/TRIGTYPE.H b/REDALERT/TRIGTYPE.H index cb53849..7b3ca38 100644 --- a/REDALERT/TRIGTYPE.H +++ b/REDALERT/TRIGTYPE.H @@ -33,8 +33,7 @@ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -#ifndef TRIGTYPE_H -#define TRIGTYPE_H +#pragma once #include "tevent.h" #include "taction.h" @@ -145,5 +144,3 @@ class TriggerTypeClass : public AbstractTypeClass void Draw_It(int index, int x, int y, int width, int height, bool selected, TextPrintType flags) const; }; - -#endif diff --git a/REDALERT/VECTOR.H b/REDALERT/VECTOR.H index 2500f86..5b5fe77 100644 --- a/REDALERT/VECTOR.H +++ b/REDALERT/VECTOR.H @@ -47,17 +47,7 @@ * DynamicVectorClass::ID -- Find matching value in the dynamic vector. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -#ifndef VECTOR_H -#define VECTOR_H - -#ifdef NEVER -#ifndef false -#define false 0 -#endif -#ifndef true -#define true 1 -#endif -#endif +#pragma once #include #include @@ -1008,5 +998,3 @@ int VectorClass::Resize(unsigned newsize, T const * array) } return(true); } - -#endif diff --git a/REDALERT/WINSTUB.CPP b/REDALERT/WINSTUB.CPP index 72dcfdc..cf9b687 100644 --- a/REDALERT/WINSTUB.CPP +++ b/REDALERT/WINSTUB.CPP @@ -872,7 +872,7 @@ void Load_Title_Screen(char *name, GraphicViewPortClass *video_page, unsigned ch load_buffer = Read_PCX_File (name, (char*)palette, NULL, 0); if (load_buffer) { - load_buffer->Blit(*video_page); + load_buffer->Scale(*video_page, 0, 0, 0, 0, load_buffer->Get_Width(), load_buffer->Get_Height(), ScreenWidth, ScreenHeight, NULL); delete load_buffer; } }