Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/OpenSHC/Synchrony/GameSynchronyState/queueCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ namespace Synchrony {
this->DAT_GameCommandArray[this->DAT_CurrentGameCommandID].stateUnk = Commands::GCS_UNPROCESSED;
this->DAT_GameCommandArray[this->DAT_CurrentGameCommandID].playerUnk = this->DPLAYX_PlayerHandle;
this->DAT_GameCommandArray[this->DAT_CurrentGameCommandID].commandType = commandType;
if (DAT_GameCore::instance.mapTimeInTicks > this->mapTimeInTicksSinglePlayer) {
// a signed compare, though mapTimeInTicks is a uint
if ((int)DAT_GameCore::instance.mapTimeInTicks > this->mapTimeInTicksSinglePlayer) {
this->DAT_GameCommandArray[this->DAT_CurrentGameCommandID].time
= this->commandDelay + DAT_GameCore::instance.mapTimeInTicks;
} else {
Expand All @@ -39,7 +40,7 @@ namespace Synchrony {
// Calls the callback function for a specific command. See "GameCommandType" for possible
// commands: placing buildings, walls, moving units, ...
DAT_ProtocolDefinedData::instance
.commandFunctions[this->DAT_GameCommandArray[this->DAT_CurrentGameCommandID].commandType]();
.commandFunctions[this->DAT_GameCommandArray[this->DAT_CurrentGameCommandID].commandType]();
this->DAT_CommandParameterOffset = 0;
dword _time = this->DAT_GameCommandArray[this->DAT_CurrentGameCommandID].time;
if (0 < (int)_time) {
Expand All @@ -65,7 +66,7 @@ namespace Synchrony {
this->DPLAYX_ReceivedPlayerID = this->DPLAYX_PlayerHandle;
this->protocolInvokerPlayerID = this->currentPlayerSlotID;
DAT_ProtocolDefinedData::instance
.commandFunctions[this->DAT_GameCommandArray[this->DAT_CurrentGameCommandID].commandType]();
.commandFunctions[this->DAT_GameCommandArray[this->DAT_CurrentGameCommandID].commandType]();
}
MACRO_CALL_MEMBER(Synchrony::GameSynchronyState_Func::clearGameCommandEntry, this)(
this->DAT_CurrentGameCommandID);
Expand Down
6 changes: 4 additions & 2 deletions src/OpenSHC/UI/HoveredState/clearInvalidatedHoverStates.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "OpenSHC/UI/HoveredState.func.hpp"
#include "../HoveredState.func.hpp"

#include "OpenSHC/Commands/MappersEnum.hpp"
#include "OpenSHC/Game/GameMode.hpp"
#include "OpenSHC/UI/HoveredStateElement.hpp"
Expand All @@ -20,8 +21,9 @@ namespace UI {
return;
}
for (int i = 0; i < 20; ++i) {
// a signed compare, though mapTimeInTicks is a uint
if (this->elements[i].type != OpenSHC::Commands::M_MAPPER_NULL
&& DAT_GameCore::instance.mapTimeInTicks >= this->elements[i].time) {
&& (int)DAT_GameCore::instance.mapTimeInTicks >= this->elements[i].time) {
this->elements[i].type = OpenSHC::Commands::M_MAPPER_NULL;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "OpenSHC/UI/MenuItems/BuildMenu.func.hpp"
#include "OpenSHC/Map/Units/Selection/UnitSelectionEnumInt.hpp"
#include "../BuildMenu.func.hpp"

#include "OpenSHC/Globals/DAT_ButtonUnknownZero.hpp"
#include "OpenSHC/Globals/DAT_UnitsState.hpp"
Expand All @@ -9,19 +8,17 @@ namespace UI {
namespace MenuItems {
namespace BuildMenu {

using Map::Units::Selection::UnitSelectionEnumInt;

// FUNCTION: STRONGHOLDCRUSADER 0x00439390
void MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper(
UnitSelectionEnumInt selectionIndex, ...)
void MenuItemRenderFunction_BuildMenu_CurrentlySelectedTroopsDeselectHelper(int slotID, ...)
{
if (DAT_UnitsState::instance.nHasOwnedUnitInSelection == 0) {
DAT_ButtonUnknownZero::instance = 1;
DAT_ButtonUnknownZero::instance = TRUE;
return;
}
DAT_ButtonUnknownZero::instance = 0;
if (DAT_UnitsState::instance.selectionUnitType[selectionIndex] == -1) {
DAT_ButtonUnknownZero::instance = 1;
DAT_ButtonUnknownZero::instance = FALSE;
// the deselect buttons are slot IDs 20 to 27
if (DAT_UnitsState::instance.selectionSlots[slotID - 20] == -1) {
DAT_ButtonUnknownZero::instance = TRUE;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ namespace UI {
// FUNCTION: STRONGHOLDCRUSADER 0x004410D0
void Rendering::DisplayMapDescriptionAndAllocatePlayersToSlots()
{
if (DAT_GameSynchronyState::instance.DAT_MapSelectionScrollOffset
+ DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected
>= 0
// both read up front, the scroll offset first: the plain sum loads them the other way round
int const scrollOffset = DAT_GameSynchronyState::instance.DAT_MapSelectionScrollOffset;
int const relativeSelected = DAT_GameSynchronyState::instance.DAT_MapSelectionRelativeSelected;
if (relativeSelected + scrollOffset >= 0
|| (!DAT_GameSynchronyState::instance.isHost && strlen(DAT_GameSynchronyState::instance.mapName) != 0)) {
char mapFileName[1008];
strcpy(mapFileName, DAT_GameSynchronyState::instance.mapName);
Expand Down
Loading