September 16th patch update

DLL version incremented
Beacon functionality added
Support for loading screen match preview display
Placeholder handling of new key-bindable mod commands
This commit is contained in:
PG-SteveT 2020-09-16 10:03:04 -07:00
parent e37e174be1
commit fd05be35c1
68 changed files with 1313 additions and 267 deletions

View file

@ -141,6 +141,7 @@ extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Sidebar_Request(Sidebar
extern "C" __declspec(dllexport) void __cdecl CNC_Handle_SuperWeapon_Request(SuperWeaponRequestEnum request_type, uint64 player_id, int buildable_type, int buildable_id, int x1, int y1);
extern "C" __declspec(dllexport) void __cdecl CNC_Handle_ControlGroup_Request(ControlGroupRequestEnum request_type, uint64 player_id, unsigned char control_group_index);
extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Debug_Request(DebugRequestEnum debug_request_type, uint64 player_id, const char *object_name, int x, int y, bool unshroud, bool enemy);
extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Beacon_Request(BeaconRequestEnum beacon_request_type, uint64 player_id, int pixel_x, int pixel_y);
extern "C" __declspec(dllexport) bool __cdecl CNC_Set_Multiplayer_Data(int scenario_index, CNCMultiplayerOptionsStruct &game_options, int num_players, CNCPlayerInfoStruct *player_list, int max_players);
extern "C" __declspec(dllexport) bool __cdecl CNC_Clear_Object_Selection(uint64 player_id);
extern "C" __declspec(dllexport) bool __cdecl CNC_Select_Object(uint64 player_id, int object_type_id, int object_to_select_id);
@ -150,6 +151,7 @@ extern "C" __declspec(dllexport) void __cdecl CNC_Restore_Carryover_Objects(cons
extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Player_Switch_To_AI(uint64 player_id);
extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Human_Team_Wins(uint64 player_id);
extern "C" __declspec(dllexport) void __cdecl CNC_Start_Mission_Timer(int time);
extern "C" __declspec(dllexport) bool __cdecl CNC_Get_Start_Game_Info(uint64 player_id, int &start_location_waypoint_index);
@ -418,14 +420,13 @@ void Display_Briefing_Text_GlyphX()
void On_Sound_Effect(int sound_index, int variation, COORDINATE coord, int house)
{
// MBL 06.17.2019
int voc = sound_index;
if (voc == VOC_NONE)
{
return;
}
// MBL 06.17.2019 - Borrowed from RedAlert\AUDIO.CPP Sound_Effect()
// Borrowed from RedAlert\AUDIO.CPP Sound_Effect()
//
#if 1
/*
@ -487,14 +488,13 @@ void On_Sound_Effect(int sound_index, int variation, COORDINATE coord, int house
#if 0
// MBL 02.26.2019
int voc = sound_index;
if (voc == VOC_NONE)
{
return;
}
// MBL 02.26.2019 - Borrowed from AUDIO.CPP Sound_Effect()
// Borrowed from AUDIO.CPP Sound_Effect()
//
char const * ext = ""; // ".AUD";
#ifdef TIBERIAN_DAWN
@ -531,10 +531,8 @@ void On_Sound_Effect(int sound_index, int variation, COORDINATE coord, int house
}
// void On_Speech(int speech_index) // MBL 02.06.2020
void On_Speech(int speech_index, HouseClass *house)
{
// DLLExportClass::On_Speech(PlayerPtr, speech_index); // MBL 02.06.2020
if (house == NULL) {
DLLExportClass::On_Speech(PlayerPtr, speech_index);
}
@ -622,7 +620,6 @@ extern "C" __declspec(dllexport) void __cdecl CNC_Init(const char *command_line,
DLL_Startup(command_line);
// MBL
DLLExportClass::Set_Event_Callback( event_callback );
DLLExportClass::Init();
@ -1034,7 +1031,7 @@ void GlyphX_Assign_Houses(void)
UseGlyphXStartLocations = true;
}
}
if (!preassigned) {
if (!preassigned && i < MAX_PLAYERS) {
random_start_locations[num_random_start_locations] = num_start_locations;
num_random_start_locations++;
}
@ -1943,13 +1940,13 @@ extern "C" __declspec(dllexport) bool __cdecl CNC_Save_Load(bool save, const cha
result = Load_Game(file_path_and_name);
// MBL 07.21.2020
if (result == false)
{
return false;
}
DLLExportClass::Set_Player_Context(DLLExportClass::GlyphxPlayerIDs[0], true);
DLLExportClass::Cancel_Placement(DLLExportClass::GlyphxPlayerIDs[0], -1, -1);
Set_Logic_Page(SeenBuff);
VisiblePage.Clear();
Map.Flag_To_Redraw(true);
@ -2148,6 +2145,40 @@ extern "C" __declspec(dllexport) void __cdecl CNC_Start_Mission_Timer(int time)
}
/**************************************************************************************************
* CNC_Get_Start_Game_Info
*
* History: 8/31/2020 11:37AM - ST
**************************************************************************************************/
extern "C" __declspec(dllexport) bool __cdecl CNC_Get_Start_Game_Info(uint64 player_id, int &start_location_waypoint_index)
{
start_location_waypoint_index = 0;
if (!DLLExportClass::Set_Player_Context(player_id)) {
return false;
}
start_location_waypoint_index = PlayerPtr->StartLocationOverride;
return true;
}
/**************************************************************************************************
* Is_Legacy_Render_Enabled -- Is the legacy rendering enabled?
*
* In:
*
* Out: True if only one human player
*
*
*
* History: 8/25/2020 5:55PM - ST
**************************************************************************************************/
bool Is_Legacy_Render_Enabled(void)
{
return DLLExportClass::Legacy_Render_Enabled();
}
/**************************************************************************************************
* DLLExportClass::Init -- Init the class
*
@ -4096,6 +4127,31 @@ extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Input(InputRequestEnum
break;
}
// MBL 09.08.2020 - Mod Support
case INPUT_REQUEST_MOD_GAME_COMMAND_1_AT_POSITION:
case INPUT_REQUEST_MOD_GAME_COMMAND_2_AT_POSITION:
case INPUT_REQUEST_MOD_GAME_COMMAND_3_AT_POSITION:
case INPUT_REQUEST_MOD_GAME_COMMAND_4_AT_POSITION:
{
DLLExportClass::Adjust_Internal_View();
DLLForceMouseX = x1;
DLLForceMouseY = y1;
Keyboard->MouseQX = x1;
Keyboard->MouseQY = y1;
COORDINATE coord = Map.Pixel_To_Coord(x1, y1);
CELL cell = Coord_Cell(coord);
if (Map.Pixel_To_Coord(x1, y1))
{
// TBD: For our ever-awesome Community Modders!
//
// PlayerPtr->Handle_Mod_Game_Command(cell, input_event - INPUT_REQUEST_MOD_GAME_COMMAND_1_AT_POSITION);
}
break;
}
default:
break;
}
@ -4220,7 +4276,7 @@ extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Sidebar_Request(Sidebar
switch (request_type) {
// MBL 06.02.2020 - Changing right-click support for first put building on hold, and then subsequenct right-clicks to decrement that queue count for 1x or 5x; Then, 1x or 5x Left click will resume from hold
// Changing right-click support for first put building on hold, and then subsequenct right-clicks to decrement that queue count for 1x or 5x; Then, 1x or 5x Left click will resume from hold
// Handle and fall through to start construction (from hold state) below
case SIDEBAR_REQUEST_START_CONSTRUCTION_MULTI:
@ -4461,7 +4517,7 @@ bool DLLExportClass::Get_Sidebar_State(uint64 player_id, unsigned char *buffer_i
sidebar_entry.SuperWeaponType = SW_NONE;
if (tech) {
sidebar_entry.Cost = tech->Cost * PlayerPtr->CostBias; // MBL: If this gets modified, also modify below for skirmish and multiplayer
sidebar_entry.Cost = tech->Cost * PlayerPtr->CostBias; // If this gets modified, also modify below for skirmish and multiplayer
sidebar_entry.PowerProvided = 0;
sidebar_entry.BuildTime = tech->Time_To_Build(PlayerPtr->Class->House); // sidebar_entry.BuildTime = tech->Time_To_Build() / 60;
strncpy(sidebar_entry.AssetName, tech->IniName, CNC_OBJECT_ASSET_NAME_LENGTH);
@ -4619,7 +4675,7 @@ bool DLLExportClass::Get_Sidebar_State(uint64 player_id, unsigned char *buffer_i
if (tech) {
// MBL 06.22.2020 - Updated to apply and difficulty abd/or faction price modifier; See https://jaas.ea.com/browse/TDRA-6864
// Updated to apply and difficulty abd/or faction price modifier; See https://jaas.ea.com/browse/TDRA-6864
// If this gets modified, also modify above for non-skirmish / non-multiplayer
//
// sidebar_entry.Cost = tech->Cost;
@ -6014,6 +6070,22 @@ bool DLLExportClass::Get_Shroud_State(uint64 player_id, unsigned char *buffer_in
return false;
}
/*
** Apply mobile gap generators
*/
static unsigned int _shroud_bits[UNIT_MAX];
if (GAME_TO_PLAY == GAME_GLYPHX_MULTIPLAYER) {
for (int index = 0; index < Units.Count(); index++) {
UnitClass * obj = Units.Ptr(index);
if (obj->Class->IsGapper && obj->IsActive && obj->Strength) {
if (!obj->House->Is_Ally(PlayerPtr)) {
_shroud_bits[index] = obj->Apply_Temporary_Jamming_Shroud(PlayerPtr);
}
}
}
}
CNCShroudStruct *shroud = (CNCShroudStruct*) buffer_in;
unsigned int memory_needed = sizeof(*shroud) + 256; // Base amount needed. Will need more depending on how many entries there are
@ -6087,6 +6159,17 @@ bool DLLExportClass::Get_Shroud_State(uint64 player_id, unsigned char *buffer_in
shroud->Count = entry_index;
if (GAME_TO_PLAY == GAME_GLYPHX_MULTIPLAYER) {
for (int index = 0; index < Units.Count(); index++) {
UnitClass * obj = Units.Ptr(index);
if (obj->Class->IsGapper && obj->IsActive && obj->Strength) {
if (!obj->House->Is_Ally(PlayerPtr)) {
obj->Unapply_Temporary_Jamming_Shroud(PlayerPtr, _shroud_bits[index]);
}
}
}
}
return true;
}
@ -7551,7 +7634,7 @@ void DLLExportClass::Team_Units_Formation_Toggle_On(uint64 player_id)
}
//
// MBL 03.23.2020: Code here copied and modified from Toggle_Formation(), since obj->IsSelected is not supported
// Code here copied and modified from Toggle_Formation(), since obj->IsSelected is not supported
// Replacing with ObjectClass::Is_Selected_By_Player(HouseClass *player);
//
@ -7847,7 +7930,37 @@ extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Debug_Request(DebugRequ
}
extern "C" __declspec(dllexport) void __cdecl CNC_Handle_Beacon_Request(BeaconRequestEnum beacon_request_type, uint64 player_id, int pixel_x, int pixel_y)
{
if (!DLLExportClass::Set_Player_Context(player_id)) {
return;
}
// Beacons are only available if legacy rendering is disabled
if (DLLExportClass::Legacy_Render_Enabled()) {
return;
}
// Only allow one beacon per player
for (int index = 0; index < Anims.Count(); ++index) {
AnimClass* anim = Anims.Ptr(index);
if (anim != NULL &&
(*anim == ANIM_BEACON || *anim == ANIM_BEACON_VIRTUAL) &&
anim->OwnerHouse == PlayerPtr->Class->House) {
delete anim;
}
}
OutList.Add(EventClass(ANIM_BEACON, PlayerPtr->Class->House, Map.Pixel_To_Coord(pixel_x, pixel_y), PlayerPtr->Get_Allies()));
// Send sound effect to allies
for (int index = 0; index < Houses.Count(); ++index) {
HouseClass* hptr = Houses.Ptr(index);
if (hptr != NULL && hptr->IsActive && hptr->IsHuman && PlayerPtr->Is_Ally(hptr)) {
DLLExportClass::On_Sound_Effect(hptr, VOC_BEACON, "", 0, 0);
}
}
}