parent
17dc61b782
commit
14ce3994ce
|
@ -22,6 +22,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// 0x41ADE0
|
// 0x41ADE0
|
||||||
const int _defam[AUTOMAP_MAP_COUNT][ELEVATION_COUNT] = {
|
const int _defam[AUTOMAP_MAP_COUNT][ELEVATION_COUNT] = {
|
||||||
{ -1, -1, -1 },
|
{ -1, -1, -1 },
|
||||||
|
@ -1070,7 +1072,7 @@ int _copy_file_data(File* stream1, File* stream2, int length)
|
||||||
|
|
||||||
// NOTE: Original code is slightly different, but does the same thing.
|
// NOTE: Original code is slightly different, but does the same thing.
|
||||||
while (length != 0) {
|
while (length != 0) {
|
||||||
int chunkLength = min(length, 0xFFFF);
|
int chunkLength = std::min(length, 0xFFFF);
|
||||||
|
|
||||||
if (fileRead(buffer, chunkLength, 1, stream1) != 1) {
|
if (fileRead(buffer, chunkLength, 1, stream1) != 1) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define AUTORUN_H
|
#define AUTORUN_H
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
extern HANDLE gInterplayGenericAutorunMutex;
|
extern HANDLE gInterplayGenericAutorunMutex;
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// 0x50F930
|
// 0x50F930
|
||||||
char _aColor_cNoError[] = "color.c: No errors\n";
|
char _aColor_cNoError[] = "color.c: No errors\n";
|
||||||
|
|
||||||
|
@ -552,7 +554,7 @@ void colorSetBrightness(double value)
|
||||||
|
|
||||||
for (int i = 0; i < 64; i++) {
|
for (int i = 0; i < 64; i++) {
|
||||||
double value = pow(i, gBrightness);
|
double value = pow(i, gBrightness);
|
||||||
_currentGammaTable[i] = (unsigned char)min(max(value, 0.0), 63.0);
|
_currentGammaTable[i] = (unsigned char)std::clamp(value, 0.0, 63.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_setSystemPalette(_systemCmap);
|
_setSystemPalette(_systemCmap);
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// 0x5108C8
|
// 0x5108C8
|
||||||
const int gDialogBoxBackgroundFrmIds[DIALOG_TYPE_COUNT] = {
|
const int gDialogBoxBackgroundFrmIds[DIALOG_TYPE_COUNT] = {
|
||||||
218, // MEDIALOG.FRM - Medium generic dialog box
|
218, // MEDIALOG.FRM - Medium generic dialog box
|
||||||
|
@ -107,7 +109,7 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
||||||
int linesCount = 0;
|
int linesCount = 0;
|
||||||
for (int index = 0; index < bodyLength; index++) {
|
for (int index = 0; index < bodyLength; index++) {
|
||||||
// NOTE: Calls [fontGetStringWidth] twice because of [max] macro.
|
// NOTE: Calls [fontGetStringWidth] twice because of [max] macro.
|
||||||
maximumLineWidth = max(fontGetStringWidth(body[index]), maximumLineWidth);
|
maximumLineWidth = std::max(fontGetStringWidth(body[index]), maximumLineWidth);
|
||||||
linesCount++;
|
linesCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
typedef enum WeaponSoundEffect {
|
typedef enum WeaponSoundEffect {
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#define INVENTORY_LARGE_SLOT_WIDTH 90
|
#define INVENTORY_LARGE_SLOT_WIDTH 90
|
||||||
#define INVENTORY_LARGE_SLOT_HEIGHT 61
|
#define INVENTORY_LARGE_SLOT_HEIGHT 61
|
||||||
|
|
||||||
|
@ -1381,7 +1383,7 @@ void _display_body(int fid, int inventoryWindowType)
|
||||||
unsigned char* frameData = artGetFrameData(art, frame, rotation);
|
unsigned char* frameData = artGetFrameData(art, frame, rotation);
|
||||||
|
|
||||||
int framePitch = artGetWidth(art, frame, rotation);
|
int framePitch = artGetWidth(art, frame, rotation);
|
||||||
int frameWidth = min(framePitch, INVENTORY_BODY_VIEW_WIDTH);
|
int frameWidth = std::min(framePitch, INVENTORY_BODY_VIEW_WIDTH);
|
||||||
|
|
||||||
int frameHeight = artGetHeight(art, frame, rotation);
|
int frameHeight = artGetHeight(art, frame, rotation);
|
||||||
if (frameHeight > INVENTORY_BODY_VIEW_HEIGHT) {
|
if (frameHeight > INVENTORY_BODY_VIEW_HEIGHT) {
|
||||||
|
@ -3633,7 +3635,7 @@ int inventoryOpenLooting(Object* a1, Object* a2)
|
||||||
if (!isCaughtStealing) {
|
if (!isCaughtStealing) {
|
||||||
if (stealingXp > 0) {
|
if (stealingXp > 0) {
|
||||||
if (!objectIsPartyMember(a2)) {
|
if (!objectIsPartyMember(a2)) {
|
||||||
stealingXp = min(300 - skillGetValue(a1, SKILL_STEAL), stealingXp);
|
stealingXp = std::min(300 - skillGetValue(a1, SKILL_STEAL), stealingXp);
|
||||||
debugPrint("\n[[[%d]]]", 300 - skillGetValue(a1, SKILL_STEAL));
|
debugPrint("\n[[[%d]]]", 300 - skillGetValue(a1, SKILL_STEAL));
|
||||||
|
|
||||||
// You gain %d experience points for successfully using your Steal skill.
|
// You gain %d experience points for successfully using your Steal skill.
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#define LS_WINDOW_WIDTH 640
|
#define LS_WINDOW_WIDTH 640
|
||||||
#define LS_WINDOW_HEIGHT 480
|
#define LS_WINDOW_HEIGHT 480
|
||||||
|
|
||||||
|
@ -2389,7 +2391,7 @@ int _copy_file(const char* a1, const char* a2)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (length != 0) {
|
while (length != 0) {
|
||||||
chunk_length = min(length, 0xFFFF);
|
chunk_length = std::min(length, 0xFFFF);
|
||||||
|
|
||||||
if (fileRead(buf, chunk_length, 1, stream1) != 1) {
|
if (fileRead(buf, chunk_length, 1, stream1) != 1) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#define PREFERENCES_WINDOW_WIDTH 640
|
#define PREFERENCES_WINDOW_WIDTH 640
|
||||||
#define PREFERENCES_WINDOW_HEIGHT 480
|
#define PREFERENCES_WINDOW_HEIGHT 480
|
||||||
|
|
||||||
|
@ -919,32 +921,32 @@ void preferencesSetDefaults(bool a1)
|
||||||
// 0x4931F8
|
// 0x4931F8
|
||||||
void _JustUpdate_()
|
void _JustUpdate_()
|
||||||
{
|
{
|
||||||
gPreferencesGameDifficulty1 = min(max(gPreferencesGameDifficulty1, 0), 2);
|
gPreferencesGameDifficulty1 = std::clamp(gPreferencesGameDifficulty1, 0, 2);
|
||||||
gPreferencesCombatDifficulty1 = min(max(gPreferencesCombatDifficulty1, 0), 2);
|
gPreferencesCombatDifficulty1 = std::clamp(gPreferencesCombatDifficulty1, 0, 2);
|
||||||
gPreferencesViolenceLevel1 = min(max(gPreferencesViolenceLevel1, 0), 3);
|
gPreferencesViolenceLevel1 = std::clamp(gPreferencesViolenceLevel1, 0, 3);
|
||||||
gPreferencesTargetHighlight1 = min(max(gPreferencesTargetHighlight1, 0), 2);
|
gPreferencesTargetHighlight1 = std::clamp(gPreferencesTargetHighlight1, 0, 2);
|
||||||
gPreferencesCombatMessages1 = min(max(gPreferencesCombatMessages1, 0), 1);
|
gPreferencesCombatMessages1 = std::clamp(gPreferencesCombatMessages1, 0, 1);
|
||||||
gPreferencesCombatLooks1 = min(max(gPreferencesCombatLooks1, 0), 1);
|
gPreferencesCombatLooks1 = std::clamp(gPreferencesCombatLooks1, 0, 1);
|
||||||
gPreferencesCombatTaunts1 = min(max(gPreferencesCombatTaunts1, 0), 1);
|
gPreferencesCombatTaunts1 = std::clamp(gPreferencesCombatTaunts1, 0, 1);
|
||||||
gPreferencesLanguageFilter1 = min(max(gPreferencesLanguageFilter1, 0), 1);
|
gPreferencesLanguageFilter1 = std::clamp(gPreferencesLanguageFilter1, 0, 1);
|
||||||
gPreferencesRunning1 = min(max(gPreferencesRunning1, 0), 1);
|
gPreferencesRunning1 = std::clamp(gPreferencesRunning1, 0, 1);
|
||||||
gPreferencesSubtitles1 = min(max(gPreferencesSubtitles1, 0), 1);
|
gPreferencesSubtitles1 = std::clamp(gPreferencesSubtitles1, 0, 1);
|
||||||
gPreferencesItemHighlight1 = min(max(gPreferencesItemHighlight1, 0), 1);
|
gPreferencesItemHighlight1 = std::clamp(gPreferencesItemHighlight1, 0, 1);
|
||||||
gPreferencesCombatSpeed1 = min(max(gPreferencesCombatSpeed1, 0), 50);
|
gPreferencesCombatSpeed1 = std::clamp(gPreferencesCombatSpeed1, 0, 50);
|
||||||
gPreferencesPlayerSpeedup1 = min(max(gPreferencesPlayerSpeedup1, 0), 1);
|
gPreferencesPlayerSpeedup1 = std::clamp(gPreferencesPlayerSpeedup1, 0, 1);
|
||||||
gPreferencesTextBaseDelay1 = min(max(gPreferencesTextBaseDelay1, 1.0), 6.0);
|
gPreferencesTextBaseDelay1 = std::clamp(gPreferencesTextBaseDelay1, 6.0, 10.0);
|
||||||
gPreferencesMasterVolume1 = min(max(gPreferencesMasterVolume1, 0), VOLUME_MAX);
|
gPreferencesMasterVolume1 = std::clamp(gPreferencesMasterVolume1, 0, VOLUME_MAX);
|
||||||
gPreferencesMusicVolume1 = min(max(gPreferencesMusicVolume1, 0), VOLUME_MAX);
|
gPreferencesMusicVolume1 = std::clamp(gPreferencesMusicVolume1, 0, VOLUME_MAX);
|
||||||
gPreferencesSoundEffectsVolume1 = min(max(gPreferencesSoundEffectsVolume1, 0), VOLUME_MAX);
|
gPreferencesSoundEffectsVolume1 = std::clamp(gPreferencesSoundEffectsVolume1, 0, VOLUME_MAX);
|
||||||
gPreferencesSpeechVolume1 = min(max(gPreferencesSpeechVolume1, 0), VOLUME_MAX);
|
gPreferencesSpeechVolume1 = std::clamp(gPreferencesSpeechVolume1, 0, VOLUME_MAX);
|
||||||
gPreferencesBrightness1 = min(max(gPreferencesBrightness1, 1.0), 1.17999267578125);
|
gPreferencesBrightness1 = std::clamp(gPreferencesBrightness1, 1.0, 1.17999267578125);
|
||||||
gPreferencesMouseSensitivity1 = min(max(gPreferencesMouseSensitivity1, 1.0), 2.5);
|
gPreferencesMouseSensitivity1 = std::clamp(gPreferencesMouseSensitivity1, 1.0, 2.5);
|
||||||
|
|
||||||
textObjectsSetBaseDelay(gPreferencesTextBaseDelay1);
|
textObjectsSetBaseDelay(gPreferencesTextBaseDelay1);
|
||||||
gameMouseLoadItemHighlight();
|
gameMouseLoadItemHighlight();
|
||||||
|
|
||||||
double textLineDelay = (gPreferencesTextBaseDelay1 + (-1.0)) * 0.2 * 2.0;
|
double textLineDelay = (gPreferencesTextBaseDelay1 + (-1.0)) * 0.2 * 2.0;
|
||||||
textLineDelay = min(max(textLineDelay, 0.0), 2.0);
|
textLineDelay = std::clamp(textLineDelay, 0.0, 2.0);
|
||||||
|
|
||||||
textObjectsSetLineDelay(textLineDelay);
|
textObjectsSetLineDelay(textLineDelay);
|
||||||
aiMessageListReloadIfNeeded();
|
aiMessageListReloadIfNeeded();
|
||||||
|
@ -1065,7 +1067,7 @@ void _UpdateThing(int index)
|
||||||
case PREF_COMBAT_SPEED:
|
case PREF_COMBAT_SPEED:
|
||||||
if (1) {
|
if (1) {
|
||||||
double value = *meta->valuePtr;
|
double value = *meta->valuePtr;
|
||||||
value = min(max(value, 0.0), 50.0);
|
value = std::clamp(value, 0.0, 50.0);
|
||||||
|
|
||||||
int x = (int)((value - meta->minValue) * 219.0 / (meta->maxValue - meta->minValue) + 384.0);
|
int x = (int)((value - meta->minValue) * 219.0 / (meta->maxValue - meta->minValue) + 384.0);
|
||||||
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
||||||
|
@ -1073,13 +1075,13 @@ void _UpdateThing(int index)
|
||||||
break;
|
break;
|
||||||
case PREF_TEXT_BASE_DELAY:
|
case PREF_TEXT_BASE_DELAY:
|
||||||
if (1) {
|
if (1) {
|
||||||
gPreferencesTextBaseDelay1 = min(max(gPreferencesTextBaseDelay1, 1.0), 6.0);
|
gPreferencesTextBaseDelay1 = std::clamp(gPreferencesTextBaseDelay1, 1.0, 6.0);
|
||||||
|
|
||||||
int x = (int)((6.0 - gPreferencesTextBaseDelay1) * 43.8 + 384.0);
|
int x = (int)((6.0 - gPreferencesTextBaseDelay1) * 43.8 + 384.0);
|
||||||
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
||||||
|
|
||||||
double value = (gPreferencesTextBaseDelay1 - 1.0) * 0.2 * 2.0;
|
double value = (gPreferencesTextBaseDelay1 - 1.0) * 0.2 * 2.0;
|
||||||
value = min(max(value, 0.0), 2.0);
|
value = std::clamp(value, 0.0, 2.0);
|
||||||
|
|
||||||
textObjectsSetBaseDelay(gPreferencesTextBaseDelay1);
|
textObjectsSetBaseDelay(gPreferencesTextBaseDelay1);
|
||||||
textObjectsSetLineDelay(value);
|
textObjectsSetLineDelay(value);
|
||||||
|
@ -1091,7 +1093,7 @@ void _UpdateThing(int index)
|
||||||
case PREF_SPEECH_VOLUME:
|
case PREF_SPEECH_VOLUME:
|
||||||
if (1) {
|
if (1) {
|
||||||
double value = *meta->valuePtr;
|
double value = *meta->valuePtr;
|
||||||
value = min(max(value, meta->minValue), meta->maxValue);
|
value = std::clamp(value, meta->minValue, meta->maxValue);
|
||||||
|
|
||||||
int x = (int)((value - meta->minValue) * 219.0 / (meta->maxValue - meta->minValue) + 384.0);
|
int x = (int)((value - meta->minValue) * 219.0 / (meta->maxValue - meta->minValue) + 384.0);
|
||||||
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
||||||
|
@ -1114,7 +1116,7 @@ void _UpdateThing(int index)
|
||||||
break;
|
break;
|
||||||
case PREF_BRIGHTNESS:
|
case PREF_BRIGHTNESS:
|
||||||
if (1) {
|
if (1) {
|
||||||
gPreferencesBrightness1 = min(max(gPreferencesBrightness1, 1.0), 1.17999267578125);
|
gPreferencesBrightness1 = std::clamp(gPreferencesBrightness1, 1.0, 1.17999267578125);
|
||||||
|
|
||||||
int x = (int)((gPreferencesBrightness1 - meta->minValue) * (219.0 / (meta->maxValue - meta->minValue)) + 384.0);
|
int x = (int)((gPreferencesBrightness1 - meta->minValue) * (219.0 / (meta->maxValue - meta->minValue)) + 384.0);
|
||||||
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
||||||
|
@ -1124,7 +1126,7 @@ void _UpdateThing(int index)
|
||||||
break;
|
break;
|
||||||
case PREF_MOUSE_SENSITIVIY:
|
case PREF_MOUSE_SENSITIVIY:
|
||||||
if (1) {
|
if (1) {
|
||||||
gPreferencesMouseSensitivity1 = min(max(gPreferencesMouseSensitivity1, 1.0), 2.5);
|
gPreferencesMouseSensitivity1 = std::clamp(gPreferencesMouseSensitivity1, 1.0, 2.5);
|
||||||
|
|
||||||
int x = (int)((gPreferencesMouseSensitivity1 - meta->minValue) * (219.0 / (meta->maxValue - meta->minValue)) + 384.0);
|
int x = (int)((gPreferencesMouseSensitivity1 - meta->minValue) * (219.0 / (meta->maxValue - meta->minValue)) + 384.0);
|
||||||
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
blitBufferToBufferTrans(gPreferencesWindowFrmData[PREFERENCES_WINDOW_FRM_KNOB_OFF], 21, 12, 21, gPreferencesWindowBuffer + 640 * meta->knobY + x, 640);
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// 0x51D478
|
// 0x51D478
|
||||||
STRUCT_51D478* _fadeHead = NULL;
|
STRUCT_51D478* _fadeHead = NULL;
|
||||||
|
|
||||||
|
@ -1069,7 +1071,7 @@ int _soundVolumeHMItoDirectSound(int volume)
|
||||||
|
|
||||||
if (volume != 0) {
|
if (volume != 0) {
|
||||||
normalizedVolume = -1000.0 * log2(32767.0 / volume);
|
normalizedVolume = -1000.0 * log2(32767.0 / volume);
|
||||||
normalizedVolume = max(min(normalizedVolume, 0.0), -10000.0);
|
normalizedVolume = std::clamp(normalizedVolume, -10000.0, 0.0);
|
||||||
} else {
|
} else {
|
||||||
normalizedVolume = -10000.0;
|
normalizedVolume = -10000.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// 0x51D53C
|
// 0x51D53C
|
||||||
StatDescription gStatDescriptions[STAT_COUNT] = {
|
StatDescription gStatDescriptions[STAT_COUNT] = {
|
||||||
{ NULL, NULL, 0, PRIMARY_STAT_MIN, PRIMARY_STAT_MAX, 5 },
|
{ NULL, NULL, 0, PRIMARY_STAT_MIN, PRIMARY_STAT_MAX, 5 },
|
||||||
|
@ -345,7 +347,7 @@ int critterGetStat(Object* critter, int stat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value = min(max(value, gStatDescriptions[stat].minimumValue), gStatDescriptions[stat].maximumValue);
|
value = std::clamp(value, gStatDescriptions[stat].minimumValue, gStatDescriptions[stat].maximumValue);
|
||||||
} else {
|
} else {
|
||||||
switch (stat) {
|
switch (stat) {
|
||||||
case STAT_CURRENT_HIT_POINTS:
|
case STAT_CURRENT_HIT_POINTS:
|
||||||
|
@ -546,10 +548,10 @@ void critterUpdateDerivedStats(Object* critter)
|
||||||
data->baseStats[STAT_MAXIMUM_HIT_POINTS] = critterGetBaseStatWithTraitModifier(critter, STAT_STRENGTH) + critterGetBaseStatWithTraitModifier(critter, STAT_ENDURANCE) * 2 + 15;
|
data->baseStats[STAT_MAXIMUM_HIT_POINTS] = critterGetBaseStatWithTraitModifier(critter, STAT_STRENGTH) + critterGetBaseStatWithTraitModifier(critter, STAT_ENDURANCE) * 2 + 15;
|
||||||
data->baseStats[STAT_MAXIMUM_ACTION_POINTS] = agility / 2 + 5;
|
data->baseStats[STAT_MAXIMUM_ACTION_POINTS] = agility / 2 + 5;
|
||||||
data->baseStats[STAT_ARMOR_CLASS] = agility;
|
data->baseStats[STAT_ARMOR_CLASS] = agility;
|
||||||
data->baseStats[STAT_MELEE_DAMAGE] = max(strength - 5, 1);
|
data->baseStats[STAT_MELEE_DAMAGE] = std::max(strength - 5, 1);
|
||||||
data->baseStats[STAT_CARRY_WEIGHT] = 25 * strength + 25;
|
data->baseStats[STAT_CARRY_WEIGHT] = 25 * strength + 25;
|
||||||
data->baseStats[STAT_SEQUENCE] = 2 * perception;
|
data->baseStats[STAT_SEQUENCE] = 2 * perception;
|
||||||
data->baseStats[STAT_HEALING_RATE] = max(endurance / 3, 1);
|
data->baseStats[STAT_HEALING_RATE] = std::max(endurance / 3, 1);
|
||||||
data->baseStats[STAT_CRITICAL_CHANCE] = luck;
|
data->baseStats[STAT_CRITICAL_CHANCE] = luck;
|
||||||
data->baseStats[STAT_BETTER_CRITICALS] = 0;
|
data->baseStats[STAT_BETTER_CRITICALS] = 0;
|
||||||
data->baseStats[STAT_RADIATION_RESISTANCE] = 2 * endurance;
|
data->baseStats[STAT_RADIATION_RESISTANCE] = 2 * endurance;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define WIN32_H
|
#define WIN32_H
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include <mmreg.h>
|
#include <mmreg.h>
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// 0x50FA30
|
// 0x50FA30
|
||||||
char _path_patches[] = "";
|
char _path_patches[] = "";
|
||||||
|
|
||||||
|
@ -781,10 +783,10 @@ void _GNW_win_refresh(Window* window, Rect* rect, unsigned char* a3)
|
||||||
|
|
||||||
v26->next = NULL;
|
v26->next = NULL;
|
||||||
|
|
||||||
v26->rect.left = max(window->rect.left, rect->left);
|
v26->rect.left = std::max(window->rect.left, rect->left);
|
||||||
v26->rect.top = max(window->rect.top, rect->top);
|
v26->rect.top = std::max(window->rect.top, rect->top);
|
||||||
v26->rect.right = min(window->rect.right, rect->right);
|
v26->rect.right = std::min(window->rect.right, rect->right);
|
||||||
v26->rect.bottom = min(window->rect.bottom, rect->bottom);
|
v26->rect.bottom = std::min(window->rect.bottom, rect->bottom);
|
||||||
|
|
||||||
if (v26->rect.right >= v26->rect.left && v26->rect.bottom >= v26->rect.top) {
|
if (v26->rect.right >= v26->rect.left && v26->rect.bottom >= v26->rect.top) {
|
||||||
if (a3) {
|
if (a3) {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#define NOMINMAX
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#define MAX_WINDOW_COUNT (50)
|
#define MAX_WINDOW_COUNT (50)
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// 0x51E414
|
// 0x51E414
|
||||||
int _wd = -1;
|
int _wd = -1;
|
||||||
|
|
||||||
|
@ -210,7 +212,7 @@ int _calc_max_field_chars_wcursor(int a1, int a2)
|
||||||
|
|
||||||
internal_free(str);
|
internal_free(str);
|
||||||
|
|
||||||
return max(len1, len2) + 1;
|
return std::max(len1, len2) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0x4DD3EC
|
// 0x4DD3EC
|
||||||
|
|
Loading…
Reference in New Issue