Files

179 lines
5.0 KiB
C++

#pragma once
#include "Common.h"
#define PLAYER_SYSTEM *((PUINT) 0x673354)
#define CHECK_FOR_SYNC_CALL_ADDR 0x541602
#define PUSH_SHIP_POS_SYNC_CHECK_ADDR 0x5415FF
#define POST_INIT_DEALLOC_CALL_ADDR 0x54B8B9
#define OBJ_UPDATE_CALL_ADDR 0x54167C
#define WAYPOINT_CHECK_CALL_ADDR 0x4F4141
#define INIT_NN_ELEMENTS_CALL_ADDR 0x5D4A80
#define TEST_RESOLUTIONS_ADDR 0x4B2440
// The buffer length is denoted in WORDs.
#define FL_BUFFER_1 ((LPWSTR) 0x66DC60)
#define FL_BUFFER_2 ((LPWSTR) 0x66FC60)
#define FL_BUFFER_LEN *((PUINT) 0x6119F8)
#define FL_RESOURCES_HANDLE *((PDWORD) 0x67ECA8)
#define UNKNOWN_OBJECT_IDS 1191
#define WAYPOINT_IDS 1090
#define MISSION_WAYPOINT_IDS 1091
#define KNOW_VISIT_FLAG (1)
#define LAND_VISIT_FLAG (1 << 1)
#define COMMODITY_DEALER_VISIT_FLAG (1 << 2)
#define EQUIPMENT_DEALER_VISIT_FLAG (1 << 3)
#define SHIP_DEALER_VISIT_FLAG (1 << 4)
// Time elapsed since startup in miliseconds
#define FL_TIME_ELAPSED_MS (*(double*) 0x667D38)
// System time in miliseconds
#define TIMING_DELTA_TICK_COUNT (*(PDWORD) 0x667D14)
#define TIME_GET_TIME_VAL (*(PDWORD) 0x667D20)
struct Waypoint
{
Vector pos;
UINT system;
UINT target;
int waypointNumber;
};
struct NavMapObj
{
UINT type;
};
struct NeuroNetNavMap
{
NavMapObj* GetHighlightedObject_Hook(DWORD unk1, DWORD unk2);
NavMapObj* GetHighlightedObject(DWORD unk1, DWORD unk2);
};
struct AudioOption
{
UINT idsName;
UINT idsTooltip;
UINT defaultVolume;
DWORD x0C, x10, x14;
};
#define NN_PREFERENCES_NEW_DATA 0x98C
// 0x330 = current selected width
// 0x8b8 = current active width (int)
// 0x8cc = start of resolution array (10 * 4 * 3 bytes)
// 0x8d4 = start of resolution array + 0x8 (points to the bpp of the first element)
// 0x944 = array of 10 bytes that contains flags of whether the resolution index is supported (1 = supported, 0 = unsupported)
// 0x94e = unallocated word (2 bytes)
// 0x950 = amount of supported resolutions (integer)
// 0x954 = array of 4 * 10 bytes that contains the indices of the resolutions in the selection menu (-1 is unsupported resolution)
struct NN_Preferences
{
BYTE x00[0x528];
AudioOption* audioOptions; // pointer to array of audio info from up to 14 UI scroll elements
BYTE x52C[0x128];
PVOID scrollElements[14]; // 0x654, array of pointers to 14 volume scroll elements (there's more but we only need up to 14)
BYTE x68C[0x2C4];
UINT supportedResAmount;
BYTE x954[0x28];
bool unk_x97C;
BYTE x97D[0x3];
UINT selectedHeight;
UINT activeHeight;
bool* resSupportedArr; // Points to new version of 0x944
BYTE newData;
bool InitElements_Hook(DWORD unk1, DWORD unk2);
bool SetResolution_Active_Hook(UINT width, DWORD unk);
bool SetResolution_Selected_Hook(UINT width, DWORD unk);
void TestResolutions_Hook(DWORD unk);
void VolumeSliderAdjustEnd_Hook(PVOID scrollElement);
bool SetResolution(UINT width, DWORD unk, UINT height);
};
void StopSound(BYTE soundId);
void StartSound(BYTE soundId);
Waypoint* GetWaypoint(int index);
struct WaypointWatcher
{
bool GetCurrentWaypointInfo(bool& isPlayerWaypoint, int& waypointIndex);
};
#define WAYPOINT_WATCHER (*((WaypointWatcher**) 0x674BC8))
IObjRW* GetPlayerIObjRW();
CShip* GetPlayerShip();
CShip* GetPlayerShipSafe();
bool AreIObjRWsInSameGroup(const IObjRW& o1, const IObjRW& o2);
bool AreShipsInSameGroup(const CShip* ship1, const CShip* ship2);
bool IsSimpleUnvisited(const CSimple& simple);
BYTE GetSimpleVisitedValue(const CSimple& simple);
UINT GetIdsForUnvisitedSimple(const CSimple& simple);
UINT GetCShipOrCEqObjName(const CEqObj &eqObj);
UINT GetFlStringFromResources(DWORD resourcesHandle, UINT ids, LPWSTR buffer, UINT bufferLen);
inline UINT GetFlString(UINT ids, LPWSTR buffer, UINT bufferLen)
{
return GetFlStringFromResources(FL_RESOURCES_HANDLE, ids, buffer, bufferLen);
}
class RenderDisplayList
{};
void AppendXmlWsToRdlEx(LPCWSTR ws, UINT wsLen, RenderDisplayList& rdl, DWORD flags);
inline void AppendXmlWsToRdl(LPCWSTR ws, RenderDisplayList& rdl)
{
AppendXmlWsToRdlEx(ws, wcslen(ws), rdl, 0);
}
#define SHIP_TRADER_SHIP_AMOUNT 3
#define SHIP_TRADER_PLAYER_SHIP_INDEX -2
#define SHIP_TRADER_NONE_SELECTED_INDEX -1
// 0x370 = ShipTrader3DShip*
struct NN_ShipTrader
{
BYTE x00[0x3CC];
int shipCount; // 0x3CC
int selectedShipIndex; // 0x3D0
BYTE x3D4[0x24];
float playerReputationWithBaseOwners; // 0x3F8
int shipStatuses[SHIP_TRADER_SHIP_AMOUNT]; // 0x3FC, basically enums for available, rep too low, or level too low
BYTE x408[0x40];
int shipRepPercentages[SHIP_TRADER_SHIP_AMOUNT]; // 0x448
void StoreShipRepRequirement(int shipIndex, float repRequirement);
LPWSTR PrintFmtShipRepRequirement();
PBYTE SwapShipRepPercentages(PBYTE rhsShipStatusAddr);
};
void ExpandNNShipTraderObjMemory();
struct FLCursor
{
float xPos, yPos, distFromZero;
};
struct ServerFilterDialog
{
bool OnFrameUpdate_Hook();
};
double GetDeltaTime();
void UpdateDeltaTime();
void UpdateDeltaTimeAndUpTime();
UINT GetNumOfActiveMissionObjectives();