Fix some msvc x86 warnings

This commit is contained in:
Alexander Batalov 2022-07-07 10:52:54 +03:00
parent 5dd52de43a
commit 158826ed63
10 changed files with 33 additions and 32 deletions

View File

@ -89,8 +89,8 @@ typedef struct STRUCT_530014 {
Object* obj; Object* obj;
int fid; // fid int fid; // fid
int field_C; int field_C;
int field_10; unsigned int field_10;
int field_14; // animation speed? unsigned int field_14; // animation speed?
int animationSequenceIndex; int animationSequenceIndex;
int field_1C; // length of field_28 int field_1C; // length of field_28
int field_20; // current index in field_28 int field_20; // current index in field_28
@ -2404,7 +2404,7 @@ void _object_animate()
Object* object = p530014->obj; Object* object = p530014->obj;
int time = _get_time(); unsigned int time = _get_time();
if (getTicksBetween(time, p530014->field_10) < p530014->field_14) { if (getTicksBetween(time, p530014->field_10) < p530014->field_14) {
continue; continue;
} }

View File

@ -5060,7 +5060,7 @@ static void characterEditorHandleInfoButtonPressed(int eventCode)
offset = 0; offset = 0;
} }
gCharacterEditorCurrentSkill = offset * 0.092307694; gCharacterEditorCurrentSkill = (int)(offset * 0.092307694);
if (gCharacterEditorCurrentSkill >= 18) { if (gCharacterEditorCurrentSkill >= 18) {
gCharacterEditorCurrentSkill = 17; gCharacterEditorCurrentSkill = 17;
} }

View File

@ -3380,13 +3380,13 @@ static int aiMessageListFree()
// 0x42BBF0 // 0x42BBF0
void aiMessageListReloadIfNeeded() void aiMessageListReloadIfNeeded()
{ {
bool languageFilter = false; int languageFilter = 0;
configGetBool(&gGameConfig, GAME_CONFIG_PREFERENCES_KEY, GAME_CONFIG_LANGUAGE_FILTER_KEY, &languageFilter); configGetInt(&gGameConfig, GAME_CONFIG_PREFERENCES_KEY, GAME_CONFIG_LANGUAGE_FILTER_KEY, &languageFilter);
if (languageFilter != gLanguageFilter) { if (languageFilter != gLanguageFilter) {
gLanguageFilter = languageFilter; gLanguageFilter = languageFilter;
if (languageFilter) { if (languageFilter == 1) {
messageListFilterBadwords(&gCombatAiMessageList); messageListFilterBadwords(&gCombatAiMessageList);
} else { } else {
// NOTE: Uninline. // NOTE: Uninline.

View File

@ -2376,7 +2376,7 @@ void _GNW95_zero_vid_mem()
SDL_LockSurface(gSdlSurface); SDL_LockSurface(gSdlSurface);
unsigned char* surface = (unsigned char*)gSdlSurface->pixels; unsigned char* surface = (unsigned char*)gSdlSurface->pixels;
for (unsigned int y = 0; y < gSdlSurface->h; y++) { for (int y = 0; y < gSdlSurface->h; y++) {
memset(surface, 0, gSdlSurface->w); memset(surface, 0, gSdlSurface->w);
surface += gSdlSurface->pitch; surface += gSdlSurface->pitch;
} }

View File

@ -917,8 +917,8 @@ int interfaceLoad(File* stream)
int interfaceCurrentHand; int interfaceCurrentHand;
if (fileReadInt32(stream, &interfaceCurrentHand) == -1) return -1; if (fileReadInt32(stream, &interfaceCurrentHand) == -1) return -1;
int interfaceBarEndButtonsIsVisible; bool interfaceBarEndButtonsIsVisible;
if (fileReadInt32(stream, &interfaceBarEndButtonsIsVisible) == -1) return -1; if (fileReadBool(stream, &interfaceBarEndButtonsIsVisible) == -1) return -1;
if (!gInterfaceBarEnabled) { if (!gInterfaceBarEnabled) {
interfaceBarEnable(); interfaceBarEnable();

View File

@ -607,7 +607,7 @@ int programPushString(Program* program, char* string)
} else { } else {
program->dynamicStrings = (unsigned char*)internal_malloc_safe(8, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 631 program->dynamicStrings = (unsigned char*)internal_malloc_safe(8, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 631
*(int*)(program->dynamicStrings) = 0; *(int*)(program->dynamicStrings) = 0;
*(short*)(program->dynamicStrings + 4) = 0x8000; *(unsigned short*)(program->dynamicStrings + 4) = 0x8000;
*(short*)(program->dynamicStrings + 6) = 1; *(short*)(program->dynamicStrings + 6) = 1;
} }
@ -627,7 +627,7 @@ int programPushString(Program* program, char* string)
v23 = v20 + v27; v23 = v20 + v27;
*(v23 + 3) = '\0'; *(v23 + 3) = '\0';
*(short*)(v23 + 4) = 0x8000; *(unsigned short*)(v23 + 4) = 0x8000;
*(short*)(v23 + 6) = 1; *(short*)(v23 + 6) = 1;
return v20 + 4 - (program->dynamicStrings + 4); return v20 + 4 - (program->dynamicStrings + 4);
@ -2857,9 +2857,10 @@ void _updatePrograms()
ProgramListNode* next = curr->next; ProgramListNode* next = curr->next;
if (curr->program != NULL) { if (curr->program != NULL) {
_interpret(curr->program, _cpuBurstSize); _interpret(curr->program, _cpuBurstSize);
}
if (curr->program->exited) { if (curr->program->exited) {
programListNodeFree(curr); programListNodeFree(curr);
}
} }
curr = next; curr = next;
} }

View File

@ -12,7 +12,7 @@
typedef struct STRUCT_6B3690 { typedef struct STRUCT_6B3690 {
void* field_0; void* field_0;
int field_4; unsigned int field_4;
int field_8; int field_8;
} STRUCT_6B3690; } STRUCT_6B3690;
@ -375,7 +375,7 @@ static int _io_next_hdr;
static int dword_6B36A0; static int dword_6B36A0;
// 0x6B36A4 // 0x6B36A4
static int dword_6B36A4; static unsigned int dword_6B36A4;
// 0x6B36A8 // 0x6B36A8
static int _rm_FrameCount; static int _rm_FrameCount;
@ -739,7 +739,11 @@ static void* _ioRead(int size)
return NULL; return NULL;
} }
return gMovieLibReadProc(_io_handle, buf, size) < 1 ? NULL : buf; if (!gMovieLibReadProc(_io_handle, buf, size)) {
return NULL;
}
return buf;
} }
// 0x4F4D40 // 0x4F4D40
@ -851,7 +855,6 @@ int _MVE_rmStepMovie()
int v13; int v13;
unsigned short* v3; unsigned short* v3;
unsigned short* v21; unsigned short* v21;
unsigned short v22;
int v18; int v18;
int v19; int v19;
int v20; int v20;
@ -1228,16 +1231,16 @@ static void _MVE_sndSync()
DWORD dwCurrentWriteCursor; DWORD dwCurrentWriteCursor;
bool v10; bool v10;
DWORD dwStatus; DWORD dwStatus;
int v1; unsigned int v1;
bool v2; bool v2;
int v3; int v3;
int v4; unsigned int v4;
bool v5; bool v5;
bool v0; bool v0;
int v6; unsigned int v6;
int v7; int v7;
int v8; int v8;
int v9; unsigned int v9;
v0 = false; v0 = false;
@ -1323,7 +1326,8 @@ static void _MVE_sndSync()
} }
v8 = stru_6B3668.dwBufferBytes - v7 - 1; v8 = stru_6B3668.dwBufferBytes - v7 - 1;
if (stru_6B3668.dwBufferBytes / 2 < v8) { // NOTE: Original code uses signed comparison.
if ((int)stru_6B3668.dwBufferBytes / 2 < v8) {
v8 = stru_6B3668.dwBufferBytes >> 1; v8 = stru_6B3668.dwBufferBytes >> 1;
} }
@ -1458,8 +1462,6 @@ static void _CallsSndBuff_Loc(unsigned char* a1, int a2)
// 0x4F5B70 // 0x4F5B70
static int _MVE_sndAdd(unsigned char* dest, unsigned char** src_ptr, int a3, int a4, int a5) static int _MVE_sndAdd(unsigned char* dest, unsigned char** src_ptr, int a3, int a4, int a5)
{ {
int v5;
int v7;
unsigned char* src; unsigned char* src;
int v9; int v9;
unsigned short* v10; unsigned short* v10;

View File

@ -230,7 +230,8 @@ int soundEffectsCacheFileRead(int handle, void* buf, unsigned int size)
} }
size_t bytesToRead; size_t bytesToRead;
if (size < (soundEffect->dataSize - soundEffect->position)) { // NOTE: Original code uses signed comparison.
if ((int)size < (soundEffect->dataSize - soundEffect->position)) {
bytesToRead = size; bytesToRead = size;
} else { } else {
bytesToRead = soundEffect->dataSize - soundEffect->position; bytesToRead = soundEffect->dataSize - soundEffect->position;
@ -512,7 +513,7 @@ static int _sfxc_ad_reader(int handle, void* buf, unsigned int size)
SoundEffect* soundEffect = &(gSoundEffects[handle]); SoundEffect* soundEffect = &(gSoundEffects[handle]);
int bytesToRead = soundEffect->fileSize - soundEffect->dataPosition; unsigned int bytesToRead = soundEffect->fileSize - soundEffect->dataPosition;
if (size <= bytesToRead) { if (size <= bytesToRead) {
bytesToRead = size; bytesToRead = size;
} }

View File

@ -16,9 +16,6 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
typedef struct STRUCT_51D99C { typedef struct STRUCT_51D99C {
int field_0; int field_0;
int field_4; int field_4;

View File

@ -55,7 +55,7 @@ static int _tm_h;
static STRUCT_6B2370 _tm_queue[5]; static STRUCT_6B2370 _tm_queue[5];
// 0x6B23AC // 0x6B23AC
static int _tm_persistence; static unsigned int _tm_persistence;
// 0x6B23B0 // 0x6B23B0
static int _scr_center_x; static int _scr_center_x;