mirror of
https://github.com/alexbatalov/fallout2-ce.git
synced 2024-09-03 21:39:07 +00:00
Convert to C++
This commit is contained in:
parent
2d5cb4061d
commit
98c6acbf11
212
CMakeLists.txt
212
CMakeLists.txt
@ -2,229 +2,229 @@ cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
||||
|
||||
project(fallout2-ce LANGUAGES C)
|
||||
project(fallout2-ce LANGUAGES CXX)
|
||||
|
||||
add_executable(fallout2-ce WIN32
|
||||
"src/actions.c"
|
||||
"src/actions.cc"
|
||||
"src/actions.h"
|
||||
"src/animation.c"
|
||||
"src/animation.cc"
|
||||
"src/animation.h"
|
||||
"src/args.c"
|
||||
"src/args.cc"
|
||||
"src/args.h"
|
||||
"src/art.c"
|
||||
"src/art.cc"
|
||||
"src/art.h"
|
||||
"src/audio_file.c"
|
||||
"src/audio_file.cc"
|
||||
"src/audio_file.h"
|
||||
"src/audio.c"
|
||||
"src/audio.cc"
|
||||
"src/audio.h"
|
||||
"src/automap.c"
|
||||
"src/automap.cc"
|
||||
"src/automap.h"
|
||||
"src/autorun.c"
|
||||
"src/autorun.cc"
|
||||
"src/autorun.h"
|
||||
"src/cache.c"
|
||||
"src/cache.cc"
|
||||
"src/cache.h"
|
||||
"src/character_editor.c"
|
||||
"src/character_editor.cc"
|
||||
"src/character_editor.h"
|
||||
"src/character_selector.c"
|
||||
"src/character_selector.cc"
|
||||
"src/character_selector.h"
|
||||
"src/color.c"
|
||||
"src/color.cc"
|
||||
"src/color.h"
|
||||
"src/combat_ai_defs.h"
|
||||
"src/combat_ai.c"
|
||||
"src/combat_ai.cc"
|
||||
"src/combat_ai.h"
|
||||
"src/combat_defs.h"
|
||||
"src/combat.c"
|
||||
"src/combat.cc"
|
||||
"src/combat.h"
|
||||
"src/config.c"
|
||||
"src/config.cc"
|
||||
"src/config.h"
|
||||
"src/core.c"
|
||||
"src/core.cc"
|
||||
"src/core.h"
|
||||
"src/credits.c"
|
||||
"src/credits.cc"
|
||||
"src/credits.h"
|
||||
"src/critter.c"
|
||||
"src/critter.cc"
|
||||
"src/critter.h"
|
||||
"src/cycle.c"
|
||||
"src/cycle.cc"
|
||||
"src/cycle.h"
|
||||
"src/datafile.c"
|
||||
"src/datafile.cc"
|
||||
"src/datafile.h"
|
||||
"src/db.c"
|
||||
"src/db.cc"
|
||||
"src/db.h"
|
||||
"src/dbox.c"
|
||||
"src/dbox.cc"
|
||||
"src/dbox.h"
|
||||
"src/debug.c"
|
||||
"src/debug.cc"
|
||||
"src/debug.h"
|
||||
"src/dfile.c"
|
||||
"src/dfile.cc"
|
||||
"src/dfile.h"
|
||||
"src/dialog.c"
|
||||
"src/dialog.cc"
|
||||
"src/dialog.h"
|
||||
"src/dictionary.c"
|
||||
"src/dictionary.cc"
|
||||
"src/dictionary.h"
|
||||
"src/dinput.c"
|
||||
"src/dinput.cc"
|
||||
"src/dinput.h"
|
||||
"src/display_monitor.c"
|
||||
"src/display_monitor.cc"
|
||||
"src/display_monitor.h"
|
||||
"src/draw.c"
|
||||
"src/draw.cc"
|
||||
"src/draw.h"
|
||||
"src/electronic_registration.c"
|
||||
"src/electronic_registration.cc"
|
||||
"src/electronic_registration.h"
|
||||
"src/elevator.c"
|
||||
"src/elevator.cc"
|
||||
"src/elevator.h"
|
||||
"src/endgame.c"
|
||||
"src/endgame.cc"
|
||||
"src/endgame.h"
|
||||
"src/export.c"
|
||||
"src/export.cc"
|
||||
"src/export.h"
|
||||
"src/file_find.c"
|
||||
"src/file_find.cc"
|
||||
"src/file_find.h"
|
||||
"src/file_utils.c"
|
||||
"src/file_utils.cc"
|
||||
"src/file_utils.h"
|
||||
"src/font_manager.c"
|
||||
"src/font_manager.cc"
|
||||
"src/font_manager.h"
|
||||
"src/game_config.c"
|
||||
"src/game_config.cc"
|
||||
"src/game_config.h"
|
||||
"src/game_dialog.c"
|
||||
"src/game_dialog.cc"
|
||||
"src/game_dialog.h"
|
||||
"src/game_memory.c"
|
||||
"src/game_memory.cc"
|
||||
"src/game_memory.h"
|
||||
"src/game_mouse.c"
|
||||
"src/game_mouse.cc"
|
||||
"src/game_mouse.h"
|
||||
"src/game_movie.c"
|
||||
"src/game_movie.cc"
|
||||
"src/game_movie.h"
|
||||
"src/game_palette.c"
|
||||
"src/game_palette.cc"
|
||||
"src/game_palette.h"
|
||||
"src/game_sound.c"
|
||||
"src/game_sound.cc"
|
||||
"src/game_sound.h"
|
||||
"src/game_vars.h"
|
||||
"src/game.c"
|
||||
"src/game.cc"
|
||||
"src/game.h"
|
||||
"src/geometry.c"
|
||||
"src/geometry.cc"
|
||||
"src/geometry.h"
|
||||
"src/graph_lib.c"
|
||||
"src/graph_lib.cc"
|
||||
"src/graph_lib.h"
|
||||
"src/grayscale.c"
|
||||
"src/grayscale.cc"
|
||||
"src/grayscale.h"
|
||||
"src/heap.c"
|
||||
"src/heap.cc"
|
||||
"src/heap.h"
|
||||
"src/interface.c"
|
||||
"src/interface.cc"
|
||||
"src/interface.h"
|
||||
"src/interpreter_extra.c"
|
||||
"src/interpreter_extra.cc"
|
||||
"src/interpreter_extra.h"
|
||||
"src/interpreter_lib.c"
|
||||
"src/interpreter_lib.cc"
|
||||
"src/interpreter_lib.h"
|
||||
"src/interpreter.c"
|
||||
"src/interpreter.cc"
|
||||
"src/interpreter.h"
|
||||
"src/inventory.c"
|
||||
"src/inventory.cc"
|
||||
"src/inventory.h"
|
||||
"src/item.c"
|
||||
"src/item.cc"
|
||||
"src/item.h"
|
||||
"src/light.c"
|
||||
"src/light.cc"
|
||||
"src/light.h"
|
||||
"src/lips.c"
|
||||
"src/lips.cc"
|
||||
"src/lips.h"
|
||||
"src/loadsave.c"
|
||||
"src/loadsave.cc"
|
||||
"src/loadsave.h"
|
||||
"src/main.c"
|
||||
"src/main.cc"
|
||||
"src/main.h"
|
||||
"src/map_defs.h"
|
||||
"src/map.c"
|
||||
"src/map.cc"
|
||||
"src/map.h"
|
||||
"src/memory_defs.h"
|
||||
"src/memory_manager.c"
|
||||
"src/memory_manager.cc"
|
||||
"src/memory_manager.h"
|
||||
"src/memory.c"
|
||||
"src/memory.cc"
|
||||
"src/memory.h"
|
||||
"src/message.c"
|
||||
"src/message.cc"
|
||||
"src/message.h"
|
||||
"src/mmx.c"
|
||||
"src/mmx.cc"
|
||||
"src/mmx.h"
|
||||
"src/mouse_manager.c"
|
||||
"src/mouse_manager.cc"
|
||||
"src/mouse_manager.h"
|
||||
"src/movie_effect.c"
|
||||
"src/movie_effect.cc"
|
||||
"src/movie_effect.h"
|
||||
"src/movie_lib.c"
|
||||
"src/movie_lib.cc"
|
||||
"src/movie_lib.h"
|
||||
"src/movie.c"
|
||||
"src/movie.cc"
|
||||
"src/movie.h"
|
||||
"src/nevs.c"
|
||||
"src/nevs.cc"
|
||||
"src/nevs.h"
|
||||
"src/obj_types.h"
|
||||
"src/object.c"
|
||||
"src/object.cc"
|
||||
"src/object.h"
|
||||
"src/options.c"
|
||||
"src/options.cc"
|
||||
"src/options.h"
|
||||
"src/palette.c"
|
||||
"src/palette.cc"
|
||||
"src/palette.h"
|
||||
"src/party_member.c"
|
||||
"src/party_member.cc"
|
||||
"src/party_member.h"
|
||||
"src/perk_defs.h"
|
||||
"src/perk.c"
|
||||
"src/perk.cc"
|
||||
"src/perk.h"
|
||||
"src/pipboy.c"
|
||||
"src/pipboy.cc"
|
||||
"src/pipboy.h"
|
||||
"src/proto_instance.c"
|
||||
"src/proto_instance.cc"
|
||||
"src/proto_instance.h"
|
||||
"src/proto_types.h"
|
||||
"src/proto.c"
|
||||
"src/proto.cc"
|
||||
"src/proto.h"
|
||||
"src/queue.c"
|
||||
"src/queue.cc"
|
||||
"src/queue.h"
|
||||
"src/random.c"
|
||||
"src/random.cc"
|
||||
"src/random.h"
|
||||
"src/reaction.c"
|
||||
"src/reaction.cc"
|
||||
"src/reaction.h"
|
||||
"src/region.c"
|
||||
"src/region.cc"
|
||||
"src/region.h"
|
||||
"src/scripts.c"
|
||||
"src/scripts.cc"
|
||||
"src/scripts.h"
|
||||
"src/select_file_list.c"
|
||||
"src/select_file_list.cc"
|
||||
"src/select_file_list.h"
|
||||
"src/selfrun.c"
|
||||
"src/selfrun.cc"
|
||||
"src/selfrun.h"
|
||||
"src/skill_defs.h"
|
||||
"src/skill.c"
|
||||
"src/skill.cc"
|
||||
"src/skill.h"
|
||||
"src/skilldex.c"
|
||||
"src/skilldex.cc"
|
||||
"src/skilldex.h"
|
||||
"src/sound_decoder.c"
|
||||
"src/sound_decoder.cc"
|
||||
"src/sound_decoder.h"
|
||||
"src/sound_effects_cache.c"
|
||||
"src/sound_effects_cache.cc"
|
||||
"src/sound_effects_cache.h"
|
||||
"src/sound_effects_list.c"
|
||||
"src/sound_effects_list.cc"
|
||||
"src/sound_effects_list.h"
|
||||
"src/sound.c"
|
||||
"src/sound.cc"
|
||||
"src/sound.h"
|
||||
"src/stat_defs.h"
|
||||
"src/stat.c"
|
||||
"src/stat.cc"
|
||||
"src/stat.h"
|
||||
"src/string_parsers.c"
|
||||
"src/string_parsers.cc"
|
||||
"src/string_parsers.h"
|
||||
"src/text_font.c"
|
||||
"src/text_font.cc"
|
||||
"src/text_font.h"
|
||||
"src/text_object.c"
|
||||
"src/text_object.cc"
|
||||
"src/text_object.h"
|
||||
"src/tile.c"
|
||||
"src/tile.cc"
|
||||
"src/tile.h"
|
||||
"src/trait_defs.h"
|
||||
"src/trait.c"
|
||||
"src/trait.cc"
|
||||
"src/trait.h"
|
||||
"src/trap.c"
|
||||
"src/trap.cc"
|
||||
"src/trap.h"
|
||||
"src/version.c"
|
||||
"src/version.cc"
|
||||
"src/version.h"
|
||||
"src/widget.c"
|
||||
"src/widget.cc"
|
||||
"src/widget.h"
|
||||
"src/win32.c"
|
||||
"src/win32.cc"
|
||||
"src/win32.h"
|
||||
"src/window_manager_private.c"
|
||||
"src/window_manager_private.cc"
|
||||
"src/window_manager_private.h"
|
||||
"src/window_manager.c"
|
||||
"src/window_manager.cc"
|
||||
"src/window_manager.h"
|
||||
"src/window.c"
|
||||
"src/window.cc"
|
||||
"src/window.h"
|
||||
"src/word_wrap.c"
|
||||
"src/word_wrap.cc"
|
||||
"src/word_wrap.h"
|
||||
"src/world_map.c"
|
||||
"src/world_map.cc"
|
||||
"src/world_map.h"
|
||||
"src/xfile.c"
|
||||
"src/xfile.cc"
|
||||
"src/xfile.h"
|
||||
)
|
||||
|
||||
|
@ -1488,7 +1488,7 @@ int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object*
|
||||
return -2;
|
||||
}
|
||||
|
||||
Attack* attack = internal_malloc(sizeof(*attack));
|
||||
Attack* attack = (Attack*)internal_malloc(sizeof(*attack));
|
||||
if (attack == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -1794,7 +1794,7 @@ int _talk_to(Object* a1, Object* a2)
|
||||
// 0x413494
|
||||
void _action_dmg(int tile, int elevation, int minDamage, int maxDamage, int damageType, bool animated, bool bypassArmor)
|
||||
{
|
||||
Attack* attack = internal_malloc(sizeof(*attack));
|
||||
Attack* attack = (Attack*)internal_malloc(sizeof(*attack));
|
||||
if (attack == NULL) {
|
||||
return;
|
||||
}
|
@ -43,7 +43,7 @@ bool argsParse(CommandLineArguments* commandLineArguments, char* commandLine)
|
||||
argc++;
|
||||
|
||||
commandLineArguments->argc = argc;
|
||||
commandLineArguments->argv = malloc(sizeof(*commandLineArguments->argv) * argc);
|
||||
commandLineArguments->argv = (char**)malloc(sizeof(*commandLineArguments->argv) * argc);
|
||||
if (commandLineArguments->argv == NULL) {
|
||||
argsFree(commandLineArguments);
|
||||
return false;
|
@ -124,7 +124,7 @@ int artInit()
|
||||
}
|
||||
}
|
||||
|
||||
_anon_alias = internal_malloc(sizeof(*_anon_alias) * gArtListDescriptions[1].fileNamesLength);
|
||||
_anon_alias = (int*)internal_malloc(sizeof(*_anon_alias) * gArtListDescriptions[1].fileNamesLength);
|
||||
if (_anon_alias == NULL) {
|
||||
gArtListDescriptions[1].fileNamesLength = 0;
|
||||
debugPrint("Out of memory for anon_alias in art_init\n");
|
||||
@ -132,7 +132,7 @@ int artInit()
|
||||
return -1;
|
||||
}
|
||||
|
||||
gArtCritterFidShoudRunData = internal_malloc(sizeof(*gArtCritterFidShoudRunData) * gArtListDescriptions[1].fileNamesLength);
|
||||
gArtCritterFidShoudRunData = (int*)internal_malloc(sizeof(*gArtCritterFidShoudRunData) * gArtListDescriptions[1].fileNamesLength);
|
||||
if (gArtCritterFidShoudRunData == NULL) {
|
||||
gArtListDescriptions[1].fileNamesLength = 0;
|
||||
debugPrint("Out of memory for artCritterFidShouldRunData in art_init\n");
|
||||
@ -207,7 +207,7 @@ int artInit()
|
||||
}
|
||||
}
|
||||
|
||||
gHeadDescriptions = internal_malloc(sizeof(HeadDescription) * gArtListDescriptions[8].fileNamesLength);
|
||||
gHeadDescriptions = (HeadDescription*)internal_malloc(sizeof(HeadDescription) * gArtListDescriptions[8].fileNamesLength);
|
||||
if (gHeadDescriptions == NULL) {
|
||||
gArtListDescriptions[8].fileNamesLength = 0;
|
||||
debugPrint("Out of memory for head_info in art_init\n");
|
||||
@ -632,7 +632,7 @@ int artReadList(const char* path, char** out_arr, int* out_count)
|
||||
|
||||
*out_count = count;
|
||||
|
||||
arr = internal_malloc(13 * count);
|
||||
arr = (char*)internal_malloc(13 * count);
|
||||
*out_arr = arr;
|
||||
if (arr == NULL) {
|
||||
goto err;
|
@ -85,9 +85,9 @@ int audioOpen(const char* fname, int flags, ...)
|
||||
|
||||
if (index == gAudioListLength) {
|
||||
if (gAudioList != NULL) {
|
||||
gAudioList = internal_realloc_safe(gAudioList, sizeof(*gAudioList) * (gAudioListLength + 1), __FILE__, __LINE__); // "..\int\audio.c", 216
|
||||
gAudioList = (AudioFile*)internal_realloc_safe(gAudioList, sizeof(*gAudioList) * (gAudioListLength + 1), __FILE__, __LINE__); // "..\int\audio.c", 216
|
||||
} else {
|
||||
gAudioList = internal_malloc_safe(sizeof(*gAudioList), __FILE__, __LINE__); // "..\int\audio.c", 218
|
||||
gAudioList = (AudioFile*)internal_malloc_safe(sizeof(*gAudioList), __FILE__, __LINE__); // "..\int\audio.c", 218
|
||||
}
|
||||
gAudioListLength++;
|
||||
}
|
||||
@ -142,7 +142,7 @@ int audioRead(int fileHandle, void* buffer, unsigned int size)
|
||||
}
|
||||
|
||||
// 0x41A5E0
|
||||
int audioSeek(int fileHandle, long offset, int origin)
|
||||
long audioSeek(int fileHandle, long offset, int origin)
|
||||
{
|
||||
int pos;
|
||||
unsigned char* buf;
|
||||
@ -173,7 +173,7 @@ int audioSeek(int fileHandle, long offset, int origin)
|
||||
audioFile->fileSize *= 2;
|
||||
|
||||
if (pos != 0) {
|
||||
buf = internal_malloc_safe(4096, __FILE__, __LINE__); // "..\int\audio.c", 361
|
||||
buf = (unsigned char*)internal_malloc_safe(4096, __FILE__, __LINE__); // "..\int\audio.c", 361
|
||||
while (pos > 4096) {
|
||||
pos -= 4096;
|
||||
audioRead(fileHandle, buf, 4096);
|
||||
@ -186,7 +186,7 @@ int audioSeek(int fileHandle, long offset, int origin)
|
||||
internal_free_safe(buf, __FILE__, __LINE__); // // "..\int\audio.c", 367
|
||||
}
|
||||
} else {
|
||||
buf = internal_malloc_safe(1024, __FILE__, __LINE__); // "..\int\audio.c", 321
|
||||
buf = (unsigned char*)internal_malloc_safe(1024, __FILE__, __LINE__); // "..\int\audio.c", 321
|
||||
v10 = audioFile->position - pos;
|
||||
while (v10 > 1024) {
|
||||
v10 -= 1024;
|
@ -13,7 +13,7 @@ int audioSoundDecoderReadHandler(int fileHandle, void* buf, unsigned int size);
|
||||
int audioOpen(const char* fname, int mode, ...);
|
||||
int audioClose(int fileHandle);
|
||||
int audioRead(int fileHandle, void* buffer, unsigned int size);
|
||||
int audioSeek(int fileHandle, long offset, int origin);
|
||||
long audioSeek(int fileHandle, long offset, int origin);
|
||||
long audioGetSize(int fileHandle);
|
||||
long audioTell(int fileHandle);
|
||||
int audioWrite(int handle, const void* buf, unsigned int size);
|
||||
|
@ -88,9 +88,9 @@ int audioFileOpen(const char* fname, int flags, ...)
|
||||
|
||||
if (index == gAudioFileListLength) {
|
||||
if (gAudioFileList != NULL) {
|
||||
gAudioFileList = internal_realloc_safe(gAudioFileList, sizeof(*gAudioFileList) * (gAudioFileListLength + 1), __FILE__, __LINE__); // "..\int\audiof.c", 207
|
||||
gAudioFileList = (AudioFile*)internal_realloc_safe(gAudioFileList, sizeof(*gAudioFileList) * (gAudioFileListLength + 1), __FILE__, __LINE__); // "..\int\audiof.c", 207
|
||||
} else {
|
||||
gAudioFileList = internal_malloc_safe(sizeof(*gAudioFileList), __FILE__, __LINE__); // "..\int\audiof.c", 209
|
||||
gAudioFileList = (AudioFile*)internal_malloc_safe(sizeof(*gAudioFileList), __FILE__, __LINE__); // "..\int\audiof.c", 209
|
||||
}
|
||||
gAudioFileListLength++;
|
||||
}
|
||||
@ -147,7 +147,7 @@ int audioFileRead(int fileHandle, void* buffer, unsigned int size)
|
||||
}
|
||||
|
||||
// 0x41AB74
|
||||
int audioFileSeek(int fileHandle, long offset, int origin)
|
||||
long audioFileSeek(int fileHandle, long offset, int origin)
|
||||
{
|
||||
void* buf;
|
||||
int remaining;
|
@ -32,7 +32,7 @@ int audioFileSoundDecoderReadHandler(int fileHandle, void* buffer, unsigned int
|
||||
int audioFileOpen(const char* fname, int flags, ...);
|
||||
int audioFileClose(int a1);
|
||||
int audioFileRead(int a1, void* buf, unsigned int size);
|
||||
int audioFileSeek(int handle, long offset, int origin);
|
||||
long audioFileSeek(int handle, long offset, int origin);
|
||||
long audioFileGetSize(int a1);
|
||||
long audioFileTell(int a1);
|
||||
int audioFileWrite(int handle, const void* buf, unsigned int size);
|
||||
|
@ -555,7 +555,7 @@ int automapRenderInPipboyWindow(int window, int map, int elevation)
|
||||
unsigned char wallColor = _colorTable[992];
|
||||
unsigned char sceneryColor = _colorTable[480];
|
||||
|
||||
gAutomapEntry.data = internal_malloc(11024);
|
||||
gAutomapEntry.data = (unsigned char*)internal_malloc(11024);
|
||||
if (gAutomapEntry.data == NULL) {
|
||||
debugPrint("\nAUTOMAP: Error allocating data buffer!\n");
|
||||
return -1;
|
||||
@ -623,9 +623,9 @@ int automapSaveCurrent()
|
||||
debugPrint("\nAUTOMAP: Saving AutoMap DB index %d, level %d\n", map, elevation);
|
||||
|
||||
bool dataBuffersAllocated = false;
|
||||
gAutomapEntry.data = internal_malloc(11024);
|
||||
gAutomapEntry.data = (unsigned char*)internal_malloc(11024);
|
||||
if (gAutomapEntry.data != NULL) {
|
||||
gAutomapEntry.compressedData = internal_malloc(11024);
|
||||
gAutomapEntry.compressedData = (unsigned char*)internal_malloc(11024);
|
||||
if (gAutomapEntry.compressedData != NULL) {
|
||||
dataBuffersAllocated = true;
|
||||
}
|
||||
@ -905,7 +905,7 @@ int automapLoadEntry(int map, int elevation)
|
||||
}
|
||||
|
||||
if (gAutomapEntry.isCompressed == 1) {
|
||||
gAutomapEntry.compressedData = internal_malloc(11024);
|
||||
gAutomapEntry.compressedData = (unsigned char*)internal_malloc(11024);
|
||||
if (gAutomapEntry.compressedData == NULL) {
|
||||
debugPrint("\nAUTOMAP: Error allocating decompression buffer!\n");
|
||||
fileClose(stream);
|
@ -27,7 +27,7 @@ bool cacheInit(Cache* cache, CacheSizeProc* sizeProc, CacheReadProc* readProc, C
|
||||
cache->entriesLength = 0;
|
||||
cache->entriesCapacity = CACHE_ENTRIES_INITIAL_CAPACITY;
|
||||
cache->hits = 0;
|
||||
cache->entries = internal_malloc(sizeof(*cache->entries) * cache->entriesCapacity);
|
||||
cache->entries = (CacheEntry**)internal_malloc(sizeof(*cache->entries) * cache->entriesCapacity);
|
||||
cache->sizeProc = sizeProc;
|
||||
cache->readProc = readProc;
|
||||
cache->freeProc = freeProc;
|
||||
@ -191,7 +191,7 @@ bool cachePrintStats(Cache* cache, char* dest)
|
||||
// 0x4203AC
|
||||
bool cacheFetchEntryForKey(Cache* cache, int key, int* indexPtr)
|
||||
{
|
||||
CacheEntry* cacheEntry = internal_malloc(sizeof(*cacheEntry));
|
||||
CacheEntry* cacheEntry = (CacheEntry*)internal_malloc(sizeof(*cacheEntry));
|
||||
if (cacheEntry == NULL) {
|
||||
return false;
|
||||
}
|
||||
@ -405,7 +405,7 @@ bool cacheResetStatistics(Cache* cache)
|
||||
return false;
|
||||
}
|
||||
|
||||
CacheEntry** entries = internal_malloc(sizeof(*entries) * cache->entriesLength);
|
||||
CacheEntry** entries = (CacheEntry**)internal_malloc(sizeof(*entries) * cache->entriesLength);
|
||||
if (entries == NULL) {
|
||||
return false;
|
||||
}
|
||||
@ -442,7 +442,7 @@ bool cacheEnsureSize(Cache* cache, int size)
|
||||
return true;
|
||||
}
|
||||
|
||||
CacheEntry** entries = internal_malloc(sizeof(*entries) * cache->entriesLength);
|
||||
CacheEntry** entries = (CacheEntry**)internal_malloc(sizeof(*entries) * cache->entriesLength);
|
||||
if (entries != NULL) {
|
||||
memcpy(entries, cache->entries, sizeof(*entries) * cache->entriesLength);
|
||||
qsort(entries, cache->entriesLength, sizeof(*entries), cacheEntriesCompareByUsage);
|
||||
@ -542,7 +542,7 @@ bool cacheSetCapacity(Cache* cache, int newCapacity)
|
||||
return false;
|
||||
}
|
||||
|
||||
CacheEntry** entries = internal_realloc(cache->entries, sizeof(*cache->entries) * newCapacity);
|
||||
CacheEntry** entries = (CacheEntry**)internal_realloc(cache->entries, sizeof(*cache->entries) * newCapacity);
|
||||
if (entries == NULL) {
|
||||
return false;
|
||||
}
|
@ -33,7 +33,7 @@ typedef struct CacheEntry {
|
||||
// lifetime.
|
||||
unsigned int hits;
|
||||
|
||||
CacheEntryFlags flags;
|
||||
unsigned int flags;
|
||||
|
||||
// The most recent hit in terms of cache hit counter. Used to track most
|
||||
// recently used entries in eviction strategy.
|
||||
|
@ -1110,7 +1110,7 @@ int characterEditorWindowInit()
|
||||
|
||||
for (i = 0; i < EDITOR_GRAPHIC_COUNT; i++) {
|
||||
if (_copyflag[i]) {
|
||||
_grphcpy[i] = internal_malloc(_GInfo[i].width * _GInfo[i].height);
|
||||
_grphcpy[i] = (unsigned char*)internal_malloc(_GInfo[i].width * _GInfo[i].height);
|
||||
if (_grphcpy[i] == NULL) {
|
||||
break;
|
||||
}
|
||||
@ -3559,13 +3559,13 @@ int _OptionWindow()
|
||||
}
|
||||
|
||||
do {
|
||||
down[index] = internal_malloc(size);
|
||||
down[index] = (unsigned char*)internal_malloc(size);
|
||||
if (down[index] == NULL) {
|
||||
err = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
up[index] = internal_malloc(size);
|
||||
up[index] = (unsigned char*)internal_malloc(size);
|
||||
if (up[index] == NULL) {
|
||||
err = 2;
|
||||
break;
|
||||
@ -6571,7 +6571,7 @@ int karmaInit()
|
||||
|
||||
entry.description = atoi(tok);
|
||||
|
||||
KarmaEntry* entries = internal_realloc(gKarmaEntries, sizeof(*entries) * (gKarmaEntriesLength + 1));
|
||||
KarmaEntry* entries = (KarmaEntry*)internal_realloc(gKarmaEntries, sizeof(*entries) * (gKarmaEntriesLength + 1));
|
||||
if (entries == NULL) {
|
||||
fileClose(stream);
|
||||
|
||||
@ -6656,7 +6656,7 @@ int genericReputationInit()
|
||||
|
||||
entry.name = atoi(tok);
|
||||
|
||||
GenericReputationEntry* entries = internal_realloc(gGenericReputationEntries, sizeof(*entries) * (gGenericReputationEntriesLength + 1));
|
||||
GenericReputationEntry* entries = (GenericReputationEntry*)internal_realloc(gGenericReputationEntries, sizeof(*entries) * (gGenericReputationEntriesLength + 1));
|
||||
if (entries == NULL) {
|
||||
fileClose(stream);
|
||||
|
@ -269,7 +269,7 @@ bool characterSelectorWindowInit()
|
||||
gCharacterSelectorWindowBuffer,
|
||||
CS_WINDOW_WIDTH);
|
||||
|
||||
gCharacterSelectorBackground = internal_malloc(CS_WINDOW_BACKGROUND_WIDTH * CS_WINDOW_BACKGROUND_HEIGHT);
|
||||
gCharacterSelectorBackground = (unsigned char*)internal_malloc(CS_WINDOW_BACKGROUND_WIDTH * CS_WINDOW_BACKGROUND_HEIGHT);
|
||||
if (gCharacterSelectorBackground == NULL)
|
||||
goto err;
|
||||
|
@ -1955,7 +1955,7 @@ int combatLoad(File* stream)
|
||||
int i;
|
||||
int j;
|
||||
|
||||
if (fileReadInt32(stream, &gCombatState) == -1) return -1;
|
||||
if (fileReadUInt32(stream, &gCombatState) == -1) return -1;
|
||||
|
||||
if (!isInCombat()) {
|
||||
obj = objectFindFirst();
|
||||
@ -2030,7 +2030,7 @@ int combatLoad(File* stream)
|
||||
internal_free(_aiInfoList);
|
||||
}
|
||||
|
||||
_aiInfoList = internal_malloc(sizeof(*_aiInfoList) * _list_total);
|
||||
_aiInfoList = (STRUCT_510948*)internal_malloc(sizeof(*_aiInfoList) * _list_total);
|
||||
if (_aiInfoList == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -2405,7 +2405,7 @@ void _combat_begin(Object* a1)
|
||||
_list_total = objectListCreate(-1, _combat_elev, OBJ_TYPE_CRITTER, &_combat_list);
|
||||
_list_noncom = _list_total;
|
||||
_list_com = 0;
|
||||
_aiInfoList = internal_malloc(sizeof(*_aiInfoList) * _list_total);
|
||||
_aiInfoList = (STRUCT_510948*)internal_malloc(sizeof(*_aiInfoList) * _list_total);
|
||||
if (_aiInfoList == NULL) {
|
||||
return;
|
||||
}
|
@ -282,7 +282,7 @@ int aiInit()
|
||||
return -1;
|
||||
}
|
||||
|
||||
gAiPackets = internal_malloc(sizeof(*gAiPackets) * config.entriesLength);
|
||||
gAiPackets = (AiPacket*)internal_malloc(sizeof(*gAiPackets) * config.entriesLength);
|
||||
if (gAiPackets == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -2656,7 +2656,7 @@ void _combat_ai_begin(int a1, void* a2)
|
||||
_curr_crit_num = a1;
|
||||
|
||||
if (a1 != 0) {
|
||||
_curr_crit_list = internal_malloc(sizeof(Object*) * a1);
|
||||
_curr_crit_list = (Object**)internal_malloc(sizeof(Object*) * a1);
|
||||
if (_curr_crit_list) {
|
||||
memcpy(_curr_crit_list, a2, sizeof(Object*) * a1);
|
||||
} else {
|
@ -37,11 +37,11 @@ void configFree(Config* config)
|
||||
for (int sectionIndex = 0; sectionIndex < config->entriesLength; sectionIndex++) {
|
||||
DictionaryEntry* sectionEntry = &(config->entries[sectionIndex]);
|
||||
|
||||
ConfigSection* section = sectionEntry->value;
|
||||
ConfigSection* section = (ConfigSection*)sectionEntry->value;
|
||||
for (int keyValueIndex = 0; keyValueIndex < section->entriesLength; keyValueIndex++) {
|
||||
DictionaryEntry* keyValueEntry = &(section->entries[keyValueIndex]);
|
||||
|
||||
char** value = keyValueEntry->value;
|
||||
char** value = (char**)keyValueEntry->value;
|
||||
internal_free(*value);
|
||||
*value = NULL;
|
||||
}
|
||||
@ -120,7 +120,7 @@ bool configGetString(Config* config, const char* sectionKey, const char* key, ch
|
||||
}
|
||||
|
||||
DictionaryEntry* sectionEntry = &(config->entries[sectionIndex]);
|
||||
ConfigSection* section = sectionEntry->value;
|
||||
ConfigSection* section = (ConfigSection*)sectionEntry->value;
|
||||
|
||||
int index = dictionaryGetIndexByKey(section, key);
|
||||
if (index == -1) {
|
||||
@ -151,13 +151,13 @@ bool configSetString(Config* config, const char* sectionKey, const char* key, co
|
||||
}
|
||||
|
||||
DictionaryEntry* sectionEntry = &(config->entries[sectionIndex]);
|
||||
ConfigSection* section = sectionEntry->value;
|
||||
ConfigSection* section = (ConfigSection*)sectionEntry->value;
|
||||
|
||||
int index = dictionaryGetIndexByKey(section, key);
|
||||
if (index != -1) {
|
||||
DictionaryEntry* keyValueEntry = &(section->entries[index]);
|
||||
|
||||
char** existingValue = keyValueEntry->value;
|
||||
char** existingValue = (char**)keyValueEntry->value;
|
||||
internal_free(*existingValue);
|
||||
*existingValue = NULL;
|
||||
|
||||
@ -303,7 +303,7 @@ bool configWrite(Config* config, const char* filePath, bool isDb)
|
||||
DictionaryEntry* sectionEntry = &(config->entries[sectionIndex]);
|
||||
filePrintFormatted(stream, "[%s]\n", sectionEntry->key);
|
||||
|
||||
ConfigSection* section = sectionEntry->value;
|
||||
ConfigSection* section = (ConfigSection*)sectionEntry->value;
|
||||
for (int index = 0; index < section->entriesLength; index++) {
|
||||
DictionaryEntry* keyValueEntry = &(section->entries[index]);
|
||||
filePrintFormatted(stream, "%s=%s\n", keyValueEntry->key, *(char**)keyValueEntry->value);
|
||||
@ -323,7 +323,7 @@ bool configWrite(Config* config, const char* filePath, bool isDb)
|
||||
DictionaryEntry* sectionEntry = &(config->entries[sectionIndex]);
|
||||
fprintf(stream, "[%s]\n", sectionEntry->key);
|
||||
|
||||
ConfigSection* section = sectionEntry->value;
|
||||
ConfigSection* section = (ConfigSection*)sectionEntry->value;
|
||||
for (int index = 0; index < section->entriesLength; index++) {
|
||||
DictionaryEntry* keyValueEntry = &(section->entries[index]);
|
||||
fprintf(stream, "%s=%s\n", keyValueEntry->key, *(char**)keyValueEntry->value);
|
@ -593,7 +593,7 @@ void tickersAdd(TickerProc* proc)
|
||||
curr = curr->next;
|
||||
}
|
||||
|
||||
curr = internal_malloc(sizeof(*curr));
|
||||
curr = (TickerListNode*)internal_malloc(sizeof(*curr));
|
||||
curr->flags = 0;
|
||||
curr->proc = proc;
|
||||
curr->next = gTickerListHead;
|
||||
@ -692,7 +692,7 @@ void takeScreenshot()
|
||||
{
|
||||
int width = _scr_size.right - _scr_size.left + 1;
|
||||
int height = _scr_size.bottom - _scr_size.top + 1;
|
||||
gScreenshotBuffer = internal_malloc(width * height);
|
||||
gScreenshotBuffer = (unsigned char*)internal_malloc(width * height);
|
||||
if (gScreenshotBuffer == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -1527,7 +1527,7 @@ int mouseSetFrame(unsigned char* a1, int width, int height, int pitch, int a5, i
|
||||
}
|
||||
|
||||
if (width != gMouseCursorWidth || height != gMouseCursorHeight) {
|
||||
unsigned char* buf = internal_malloc(width * height);
|
||||
unsigned char* buf = (unsigned char*)internal_malloc(width * height);
|
||||
if (buf == NULL) {
|
||||
if (!cursorWasHidden) {
|
||||
mouseShowCursor();
|
||||
@ -4449,7 +4449,7 @@ bool _vcr_record(const char* fileName)
|
||||
return false;
|
||||
}
|
||||
|
||||
_vcr_buffer = internal_malloc(sizeof(*_vcr_buffer) * 4096);
|
||||
_vcr_buffer = (STRUCT_51E2F0*)internal_malloc(sizeof(*_vcr_buffer) * 4096);
|
||||
if (_vcr_buffer == NULL) {
|
||||
return false;
|
||||
}
|
||||
@ -4492,15 +4492,13 @@ bool _vcr_record(const char* fileName)
|
||||
}
|
||||
|
||||
// 0x4D28F4
|
||||
int _vcr_stop(void)
|
||||
void _vcr_stop()
|
||||
{
|
||||
if (_vcr_state == 0 || _vcr_state == 1) {
|
||||
_vcr_state |= 0x80000000;
|
||||
}
|
||||
|
||||
keyboardReset();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 0x4D2918
|
@ -626,7 +626,7 @@ void keyboardBuildSpanishConfiguration();
|
||||
void _kb_init_lock_status();
|
||||
int keyboardPeekEvent(int index, KeyboardEvent** keyboardEventPtr);
|
||||
bool _vcr_record(const char* fileName);
|
||||
int _vcr_stop(void);
|
||||
void _vcr_stop();
|
||||
int _vcr_status();
|
||||
int _vcr_update();
|
||||
bool _vcr_clear_buffer();
|
||||
|
@ -73,7 +73,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
|
||||
if (window != -1) {
|
||||
unsigned char* windowBuffer = windowGetBuffer(window);
|
||||
if (windowBuffer != NULL) {
|
||||
unsigned char* backgroundBuffer = internal_malloc(CREDITS_WINDOW_WIDTH * CREDITS_WINDOW_HEIGHT);
|
||||
unsigned char* backgroundBuffer = (unsigned char*)internal_malloc(CREDITS_WINDOW_WIDTH * CREDITS_WINDOW_HEIGHT);
|
||||
if (backgroundBuffer) {
|
||||
soundContinueAll();
|
||||
|
||||
@ -96,7 +96,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char* intermediateBuffer = internal_malloc(CREDITS_WINDOW_WIDTH * CREDITS_WINDOW_HEIGHT);
|
||||
unsigned char* intermediateBuffer = (unsigned char*)internal_malloc(CREDITS_WINDOW_WIDTH * CREDITS_WINDOW_HEIGHT);
|
||||
if (intermediateBuffer != NULL) {
|
||||
memset(intermediateBuffer, 0, CREDITS_WINDOW_WIDTH * CREDITS_WINDOW_HEIGHT);
|
||||
|
||||
@ -108,7 +108,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
|
||||
|
||||
int lineHeight = nameFontLineHeight + (titleFontLineHeight >= nameFontLineHeight ? titleFontLineHeight - nameFontLineHeight : 0);
|
||||
int stringBufferSize = CREDITS_WINDOW_WIDTH * lineHeight;
|
||||
unsigned char* stringBuffer = internal_malloc(stringBufferSize);
|
||||
unsigned char* stringBuffer = (unsigned char*)internal_malloc(stringBufferSize);
|
||||
if (stringBuffer != NULL) {
|
||||
blitBufferToBuffer(backgroundBuffer,
|
||||
CREDITS_WINDOW_WIDTH,
|
@ -472,7 +472,7 @@ int _critter_check_rads(Object* obj)
|
||||
|
||||
if (radiationLevel > _old_rad_level) {
|
||||
// Create timer event for applying radiation damage.
|
||||
RadiationEvent* radiationEvent = internal_malloc(sizeof(*radiationEvent));
|
||||
RadiationEvent* radiationEvent = (RadiationEvent*)internal_malloc(sizeof(*radiationEvent));
|
||||
if (radiationEvent == NULL) {
|
||||
return 0;
|
||||
}
|
||||
@ -490,7 +490,7 @@ int _critter_check_rads(Object* obj)
|
||||
// 0x42D618
|
||||
int _get_rad_damage_level(Object* obj, void* data)
|
||||
{
|
||||
RadiationEvent* radiationEvent = data;
|
||||
RadiationEvent* radiationEvent = (RadiationEvent*)data;
|
||||
|
||||
_old_rad_level = radiationEvent->radiationLevel;
|
||||
|
||||
@ -500,7 +500,7 @@ int _get_rad_damage_level(Object* obj, void* data)
|
||||
// 0x42D624
|
||||
int _clear_rad_damage(Object* obj, void* data)
|
||||
{
|
||||
RadiationEvent* radiationEvent = data;
|
||||
RadiationEvent* radiationEvent = (RadiationEvent*)data;
|
||||
|
||||
if (radiationEvent->isHealing) {
|
||||
_process_rads(obj, radiationEvent->radiationLevel, true);
|
||||
@ -564,10 +564,10 @@ void _process_rads(Object* obj, int radiationLevel, bool isHealing)
|
||||
// 0x42D740
|
||||
int radiationEventProcess(Object* obj, void* data)
|
||||
{
|
||||
RadiationEvent* radiationEvent = data;
|
||||
RadiationEvent* radiationEvent = (RadiationEvent*)data;
|
||||
if (!radiationEvent->isHealing) {
|
||||
// Schedule healing stats event in 7 days.
|
||||
RadiationEvent* newRadiationEvent = internal_malloc(sizeof(*newRadiationEvent));
|
||||
RadiationEvent* newRadiationEvent = (RadiationEvent*)internal_malloc(sizeof(*newRadiationEvent));
|
||||
if (newRadiationEvent != NULL) {
|
||||
_queue_clear_type(EVENT_TYPE_RADIATION, _clear_rad_damage);
|
||||
newRadiationEvent->radiationLevel = radiationEvent->radiationLevel;
|
||||
@ -584,7 +584,7 @@ int radiationEventProcess(Object* obj, void* data)
|
||||
// 0x42D7A0
|
||||
int radiationEventRead(File* stream, void** dataPtr)
|
||||
{
|
||||
RadiationEvent* radiationEvent = internal_malloc(sizeof(*radiationEvent));
|
||||
RadiationEvent* radiationEvent = (RadiationEvent*)internal_malloc(sizeof(*radiationEvent));
|
||||
if (radiationEvent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -604,7 +604,7 @@ err:
|
||||
// 0x42D7FC
|
||||
int radiationEventWrite(File* stream, void* data)
|
||||
{
|
||||
RadiationEvent* radiationEvent = data;
|
||||
RadiationEvent* radiationEvent = (RadiationEvent*)data;
|
||||
|
||||
if (fileWriteInt32(stream, radiationEvent->radiationLevel) == -1) return -1;
|
||||
if (fileWriteInt32(stream, radiationEvent->isHealing) == -1) return -1;
|
@ -601,7 +601,7 @@ int fileWriteUInt32List(File* stream, unsigned int* arr, int count)
|
||||
// 0x4C6628
|
||||
int fileNameListInit(const char* pattern, char*** fileNameListPtr, int a3, int a4)
|
||||
{
|
||||
FileList* fileList = malloc(sizeof(*fileList));
|
||||
FileList* fileList = (FileList*)malloc(sizeof(*fileList));
|
||||
if (fileList == NULL) {
|
||||
return 0;
|
||||
}
|
@ -76,7 +76,7 @@ void _debug_register_env()
|
||||
return;
|
||||
}
|
||||
|
||||
char* copy = internal_malloc(strlen(type) + 1);
|
||||
char* copy = (char*)internal_malloc(strlen(type) + 1);
|
||||
if (copy == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -205,7 +205,7 @@ int _debug_screen(char* string)
|
||||
}
|
||||
|
||||
// 0x4C709C
|
||||
void _debug_putc()
|
||||
void _debug_putc(char ch)
|
||||
{
|
||||
// TODO: Something with segments.
|
||||
}
|
@ -22,7 +22,7 @@ void _debug_clear();
|
||||
int _debug_mono(char* string);
|
||||
int _debug_log(char* string);
|
||||
int _debug_screen(char* string);
|
||||
void _debug_putc();
|
||||
void _debug_putc(char ch);
|
||||
void _debug_exit(void);
|
||||
|
||||
#endif /* DEBUG_H */
|
||||
|
@ -25,7 +25,7 @@ DBase* dbaseOpen(const char* filePath)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DBase* dbase = malloc(sizeof(*dbase));
|
||||
DBase* dbase = (DBase*)malloc(sizeof(*dbase));
|
||||
if (dbase == NULL) {
|
||||
fclose(stream);
|
||||
return NULL;
|
||||
@ -64,7 +64,7 @@ DBase* dbaseOpen(const char* filePath)
|
||||
goto err;
|
||||
}
|
||||
|
||||
dbase->entries = malloc(sizeof(*dbase->entries) * dbase->entriesLength);
|
||||
dbase->entries = (DBaseEntry*)malloc(sizeof(*dbase->entries) * dbase->entriesLength);
|
||||
if (dbase->entries == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -81,7 +81,7 @@ DBase* dbaseOpen(const char* filePath)
|
||||
break;
|
||||
}
|
||||
|
||||
entry->path = malloc(pathLength + 1);
|
||||
entry->path = (char*)malloc(pathLength + 1);
|
||||
if (entry->path == NULL) {
|
||||
break;
|
||||
}
|
||||
@ -415,7 +415,7 @@ size_t dfileRead(void* ptr, size_t size, size_t count, DFile* stream)
|
||||
|
||||
size_t extraBytesRead = 0;
|
||||
if ((stream->flags & DFILE_HAS_UNGETC) != 0) {
|
||||
unsigned char* byteBuffer = ptr;
|
||||
unsigned char* byteBuffer = (unsigned char*)ptr;
|
||||
*byteBuffer++ = stream->ungotten & 0xFF;
|
||||
ptr = byteBuffer;
|
||||
|
||||
@ -602,7 +602,7 @@ int dbaseFindEntryByFilePath(const void* a1, const void* a2)
|
||||
// 0x4E5D9C
|
||||
DFile* dfileOpenInternal(DBase* dbase, const char* filePath, const char* mode, DFile* dfile)
|
||||
{
|
||||
DBaseEntry* entry = bsearch(filePath, dbase->entries, dbase->entriesLength, sizeof(*dbase->entries), dbaseFindEntryByFilePath);
|
||||
DBaseEntry* entry = (DBaseEntry*)bsearch(filePath, dbase->entries, dbase->entriesLength, sizeof(*dbase->entries), dbaseFindEntryByFilePath);
|
||||
if (entry == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -612,7 +612,7 @@ DFile* dfileOpenInternal(DBase* dbase, const char* filePath, const char* mode, D
|
||||
}
|
||||
|
||||
if (dfile == NULL) {
|
||||
dfile = malloc(sizeof(*dfile));
|
||||
dfile = (DFile*)malloc(sizeof(*dfile));
|
||||
if (dfile == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -655,12 +655,12 @@ DFile* dfileOpenInternal(DBase* dbase, const char* filePath, const char* mode, D
|
||||
// passed via parameter, which might already have stream and
|
||||
// buffer allocated.
|
||||
if (dfile->decompressionStream == NULL) {
|
||||
dfile->decompressionStream = malloc(sizeof(*dfile->decompressionStream));
|
||||
dfile->decompressionStream = (z_streamp)malloc(sizeof(*dfile->decompressionStream));
|
||||
if (dfile->decompressionStream == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
dfile->decompressionBuffer = malloc(DFILE_DECOMPRESSION_BUFFER_SIZE);
|
||||
dfile->decompressionBuffer = (unsigned char*)malloc(DFILE_DECOMPRESSION_BUFFER_SIZE);
|
||||
if (dfile->decompressionBuffer == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -765,7 +765,7 @@ int dfileReadCharInternal(DFile* stream)
|
||||
bool dfileReadCompressed(DFile* stream, void* ptr, size_t size)
|
||||
{
|
||||
if ((stream->flags & DFILE_HAS_COMPRESSED_UNGETC) != 0) {
|
||||
unsigned char* byteBuffer = ptr;
|
||||
unsigned char* byteBuffer = (unsigned char*)ptr;
|
||||
*byteBuffer++ = stream->compressedUngotten & 0xFF;
|
||||
ptr = byteBuffer;
|
||||
|
||||
@ -779,7 +779,7 @@ bool dfileReadCompressed(DFile* stream, void* ptr, size_t size)
|
||||
}
|
||||
}
|
||||
|
||||
stream->decompressionStream->next_out = ptr;
|
||||
stream->decompressionStream->next_out = (Bytef*)ptr;
|
||||
stream->decompressionStream->avail_out = size;
|
||||
|
||||
do {
|
@ -170,10 +170,10 @@ STRUCT_56DAE0_FIELD_4* _getReply()
|
||||
v0 = &(_dialog[_tods].field_4[_dialog[_tods].field_C]);
|
||||
if (v0->field_C == NULL) {
|
||||
v0->field_14 = 1;
|
||||
v1 = internal_malloc_safe(sizeof(STRUCT_56DAE0_FIELD_4_FIELD_C), __FILE__, __LINE__); // "..\\int\\DIALOG.C", 789
|
||||
v1 = (STRUCT_56DAE0_FIELD_4_FIELD_C*)internal_malloc_safe(sizeof(STRUCT_56DAE0_FIELD_4_FIELD_C), __FILE__, __LINE__); // "..\\int\\DIALOG.C", 789
|
||||
} else {
|
||||
v0->field_14++;
|
||||
v1 = internal_realloc_safe(v0->field_C, sizeof(STRUCT_56DAE0_FIELD_4_FIELD_C) * v0->field_14, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 793
|
||||
v1 = (STRUCT_56DAE0_FIELD_4_FIELD_C*)internal_realloc_safe(v0->field_C, sizeof(STRUCT_56DAE0_FIELD_4_FIELD_C) * v0->field_14, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 793
|
||||
}
|
||||
v0->field_C = v1;
|
||||
|
||||
@ -193,7 +193,7 @@ void _replyAddOption(const char* a1, const char* a2, int a3)
|
||||
v18->field_C[v17].field_8 = 2;
|
||||
|
||||
if (a1 != NULL) {
|
||||
v14 = internal_malloc_safe(strlen(a1) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 805
|
||||
v14 = (char*)internal_malloc_safe(strlen(a1) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 805
|
||||
strcpy(v14, a1);
|
||||
v18->field_C[v17].field_0 = v14;
|
||||
} else {
|
||||
@ -201,7 +201,7 @@ void _replyAddOption(const char* a1, const char* a2, int a3)
|
||||
}
|
||||
|
||||
if (a2 != NULL) {
|
||||
v15 = internal_malloc_safe(strlen(a2) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 810
|
||||
v15 = (char*)internal_malloc_safe(strlen(a2) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 810
|
||||
strcpy(v15, a2);
|
||||
v18->field_C[v17].field_4 = v15;
|
||||
} else {
|
||||
@ -226,7 +226,7 @@ void _replyAddOptionProc(const char* a1, const char* a2, int a3)
|
||||
v5->field_C[v13].field_8 = 1;
|
||||
|
||||
if (a1 != NULL) {
|
||||
v11 = internal_malloc_safe(strlen(a1) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 830
|
||||
v11 = (char*)internal_malloc_safe(strlen(a1) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 830
|
||||
strcpy(v11, a1);
|
||||
v5->field_C[v13].field_0 = v11;
|
||||
} else {
|
||||
@ -472,7 +472,7 @@ int dialogSetReplyTitle(const char* a1)
|
||||
}
|
||||
|
||||
if (a1 != NULL) {
|
||||
gDialogReplyTitle = internal_malloc_safe(strlen(a1) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2564
|
||||
gDialogReplyTitle = (char*)internal_malloc_safe(strlen(a1) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2564
|
||||
strcpy(gDialogReplyTitle, a1);
|
||||
} else {
|
||||
gDialogReplyTitle = NULL;
|
@ -56,7 +56,7 @@ int dictionaryInit(Dictionary* dictionary, int initialCapacity, size_t valueSize
|
||||
int rc = 0;
|
||||
|
||||
if (initialCapacity != 0) {
|
||||
dictionary->entries = gDictionaryMallocProc(sizeof(*dictionary->entries) * initialCapacity);
|
||||
dictionary->entries = (DictionaryEntry*)gDictionaryMallocProc(sizeof(*dictionary->entries) * initialCapacity);
|
||||
if (dictionary->entries == NULL) {
|
||||
rc = -1;
|
||||
}
|
||||
@ -82,7 +82,7 @@ int dictionarySetCapacity(Dictionary* dictionary, int newCapacity)
|
||||
return -1;
|
||||
}
|
||||
|
||||
DictionaryEntry* entries = gDictionaryReallocProc(dictionary->entries, sizeof(*dictionary->entries) * newCapacity);
|
||||
DictionaryEntry* entries = (DictionaryEntry*)gDictionaryReallocProc(dictionary->entries, sizeof(*dictionary->entries) * newCapacity);
|
||||
if (entries == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -215,7 +215,7 @@ int dictionaryAddValue(Dictionary* dictionary, const char* key, const void* valu
|
||||
}
|
||||
|
||||
// Make a copy of the key.
|
||||
char* keyCopy = gDictionaryMallocProc(strlen(key) + 1);
|
||||
char* keyCopy = (char*)gDictionaryMallocProc(strlen(key) + 1);
|
||||
if (keyCopy == NULL) {
|
||||
return -1;
|
||||
}
|
@ -512,7 +512,7 @@ bool mouseDeviceInit()
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = IDirectInput_CreateDevice(gDirectInput, &GUID_SysMouse, &gMouseDevice, NULL);
|
||||
hr = IDirectInput_CreateDevice(gDirectInput, GUID_SysMouse, &gMouseDevice, NULL);
|
||||
if (hr != DI_OK) {
|
||||
goto err;
|
||||
}
|
||||
@ -552,7 +552,7 @@ bool keyboardDeviceInit()
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = IDirectInput_CreateDevice(gDirectInput, &GUID_SysKeyboard, &gKeyboardDevice, NULL);
|
||||
hr = IDirectInput_CreateDevice(gDirectInput, GUID_SysKeyboard, &gKeyboardDevice, NULL);
|
||||
if (hr != DI_OK) {
|
||||
goto err;
|
||||
}
|
@ -73,7 +73,7 @@ int displayMonitorInit()
|
||||
_disp_curr = 0;
|
||||
fontSetCurrent(oldFont);
|
||||
|
||||
gDisplayMonitorBackgroundFrmData = internal_malloc(DISPLAY_MONITOR_WIDTH * DISPLAY_MONITOR_HEIGHT);
|
||||
gDisplayMonitorBackgroundFrmData = (unsigned char*)internal_malloc(DISPLAY_MONITOR_WIDTH * DISPLAY_MONITOR_HEIGHT);
|
||||
if (gDisplayMonitorBackgroundFrmData == NULL) {
|
||||
return -1;
|
||||
}
|
@ -515,7 +515,7 @@ int endgameEndingSlideshowWindowInit()
|
||||
|
||||
sprintf(gEndgameEndingSubtitlesLocalizedPath, "text\\%s\\cuts\\", language);
|
||||
|
||||
gEndgameEndingSubtitles = internal_malloc(sizeof(*gEndgameEndingSubtitles) * ENDGAME_ENDING_MAX_SUBTITLES);
|
||||
gEndgameEndingSubtitles = (char**)internal_malloc(sizeof(*gEndgameEndingSubtitles) * ENDGAME_ENDING_MAX_SUBTITLES);
|
||||
if (gEndgameEndingSubtitles == NULL) {
|
||||
gEndgameEndingSubtitlesEnabled = false;
|
||||
return 0;
|
||||
@ -525,7 +525,7 @@ int endgameEndingSlideshowWindowInit()
|
||||
gEndgameEndingSubtitles[index] = NULL;
|
||||
}
|
||||
|
||||
gEndgameEndingSubtitlesTimings = internal_malloc(sizeof(*gEndgameEndingSubtitlesTimings) * ENDGAME_ENDING_MAX_SUBTITLES);
|
||||
gEndgameEndingSubtitlesTimings = (unsigned int*)internal_malloc(sizeof(*gEndgameEndingSubtitlesTimings) * ENDGAME_ENDING_MAX_SUBTITLES);
|
||||
if (gEndgameEndingSubtitlesTimings == NULL) {
|
||||
internal_free(gEndgameEndingSubtitles);
|
||||
gEndgameEndingSubtitlesEnabled = false;
|
||||
@ -879,7 +879,7 @@ int endgameEndingInit()
|
||||
entry.direction = 1;
|
||||
}
|
||||
|
||||
entries = internal_realloc(gEndgameEndings, sizeof(*entries) * (gEndgameEndingsLength + 1));
|
||||
entries = (EndgameEnding*)internal_realloc(gEndgameEndings, sizeof(*entries) * (gEndgameEndingsLength + 1));
|
||||
if (entries == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -1001,7 +1001,7 @@ int endgameDeathEndingInit()
|
||||
entry.voiceOverBaseName[narrator_file_len - 1] = '\0';
|
||||
}
|
||||
|
||||
entries = internal_realloc(gEndgameDeathEndings, sizeof(*entries) * (gEndgameDeathEndingsLength + 1));
|
||||
entries = (EndgameDeathEnding*)internal_realloc(gEndgameDeathEndings, sizeof(*entries) * (gEndgameDeathEndingsLength + 1));
|
||||
if (entries == NULL) {
|
||||
goto err;
|
||||
}
|
@ -163,7 +163,7 @@ int externalVariableSetValue(Program* program, const char* name, opcode_t opcode
|
||||
const char* stringValue = programGetString(program, opcode, data);
|
||||
exportedVariable->type = VALUE_TYPE_DYNAMIC_STRING;
|
||||
|
||||
exportedVariable->stringValue = internal_malloc_safe(strlen(stringValue) + 1, __FILE__, __LINE__); // "..\\int\\EXPORT.C", 175
|
||||
exportedVariable->stringValue = (char*)internal_malloc_safe(strlen(stringValue) + 1, __FILE__, __LINE__); // "..\\int\\EXPORT.C", 175
|
||||
strcpy(exportedVariable->stringValue, stringValue);
|
||||
}
|
||||
} else {
|
||||
@ -215,7 +215,7 @@ int externalVariableCreate(Program* program, const char* identifier)
|
||||
|
||||
strncpy(exportedVariable->name, identifier, 31);
|
||||
|
||||
exportedVariable->programName = internal_malloc_safe(strlen(programName) + 1, __FILE__, __LINE__); // // "..\\int\\EXPORT.C", 243
|
||||
exportedVariable->programName = (char*)internal_malloc_safe(strlen(programName) + 1, __FILE__, __LINE__); // // "..\\int\\EXPORT.C", 243
|
||||
strcpy(exportedVariable->programName, programName);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ int interfaceFontLoad(int font_index)
|
||||
|
||||
fileSize -= sizeof(InterfaceFontDescriptor);
|
||||
|
||||
fontDescriptor->data = internal_malloc_safe(fileSize, __FILE__, __LINE__); // FONTMGR.C, 259
|
||||
fontDescriptor->data = (unsigned char*)internal_malloc_safe(fileSize, __FILE__, __LINE__); // FONTMGR.C, 259
|
||||
if (fontDescriptor->data == NULL) goto err;
|
||||
|
||||
if (fileRead(fontDescriptor->data, fileSize, 1, stream) != 1) {
|
@ -933,7 +933,7 @@ int globalVarsRead(const char* path, const char* section, int* out_vars_num, int
|
||||
}
|
||||
|
||||
*out_vars_num = *out_vars_num + 1;
|
||||
*out_vars = internal_realloc(*out_vars, sizeof(int) * *out_vars_num);
|
||||
*out_vars = (int*)internal_realloc(*out_vars, sizeof(int) * *out_vars_num);
|
||||
|
||||
if (*out_vars == NULL) {
|
||||
exit(1);
|
||||
@ -1239,13 +1239,13 @@ void showSplash()
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char* palette = internal_malloc(768);
|
||||
unsigned char* palette = (unsigned char*)internal_malloc(768);
|
||||
if (palette == NULL) {
|
||||
fileClose(stream);
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char* data = internal_malloc(SPLASH_WIDTH * SPLASH_HEIGHT);
|
||||
unsigned char* data = (unsigned char*)internal_malloc(SPLASH_WIDTH * SPLASH_HEIGHT);
|
||||
if (data == NULL) {
|
||||
internal_free(palette);
|
||||
fileClose(stream);
|
@ -1488,7 +1488,7 @@ int gameDialogAddReviewText(const char* string)
|
||||
entry->replyText = NULL;
|
||||
}
|
||||
|
||||
entry->replyText = internal_malloc(strlen(string) + 1);
|
||||
entry->replyText = (char*)internal_malloc(strlen(string) + 1);
|
||||
strcpy(entry->replyText, string);
|
||||
|
||||
entry->optionMessageListId = -3;
|
||||
@ -1528,7 +1528,7 @@ int gameDialogSetReviewOptionText(const char* string)
|
||||
entry->optionMessageListId = -4;
|
||||
entry->optionMessageId = -4;
|
||||
|
||||
entry->optionText = internal_malloc(strlen(string) + 1);
|
||||
entry->optionText = (char*)internal_malloc(strlen(string) + 1);
|
||||
strcpy(entry->optionText, string);
|
||||
|
||||
return 0;
|
||||
@ -2180,7 +2180,7 @@ int _gdCreateHeadWindow()
|
||||
Rect* rect = &(_backgrndRects[index]);
|
||||
int width = rect->right - rect->left;
|
||||
int height = rect->bottom - rect->top;
|
||||
_backgrndBufs[index] = internal_malloc(width * height);
|
||||
_backgrndBufs[index] = (unsigned char*)internal_malloc(width * height);
|
||||
if (_backgrndBufs[index] == NULL) {
|
||||
return -1;
|
||||
}
|
@ -1932,7 +1932,7 @@ int _gsound_get_music_path(char** out_value, const char* key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
v4 = internal_malloc(v3 - 1 + 2);
|
||||
v4 = (char*)internal_malloc(v3 - 1 + 2);
|
||||
if (v4 == NULL) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("Out of memory in gsound_get_music_path.\n");
|
||||
@ -2057,7 +2057,7 @@ int ambientSoundEffectEventProcess(Object* a1, void* data)
|
||||
{
|
||||
_queue_clear_type(EVENT_TYPE_GSOUND_SFX_EVENT, NULL);
|
||||
|
||||
AmbientSoundEffectEvent* soundEffectEvent = data;
|
||||
AmbientSoundEffectEvent* soundEffectEvent = (AmbientSoundEffectEvent*)data;
|
||||
int ambientSoundEffectIndex = -1;
|
||||
if (soundEffectEvent != NULL) {
|
||||
ambientSoundEffectIndex = soundEffectEvent->ambientSoundEffectIndex;
|
||||
@ -2067,7 +2067,7 @@ int ambientSoundEffectEventProcess(Object* a1, void* data)
|
||||
}
|
||||
}
|
||||
|
||||
AmbientSoundEffectEvent* nextSoundEffectEvent = internal_malloc(sizeof(*nextSoundEffectEvent));
|
||||
AmbientSoundEffectEvent* nextSoundEffectEvent = (AmbientSoundEffectEvent*)internal_malloc(sizeof(*nextSoundEffectEvent));
|
||||
if (nextSoundEffectEvent == NULL) {
|
||||
return -1;
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "memory.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdlib.h>
|
||||
|
||||
// 0x51DEF4
|
||||
@ -108,7 +109,7 @@ RectListNode* _rect_malloc()
|
||||
{
|
||||
if (_rectList == NULL) {
|
||||
for (int index = 0; index < 10; index++) {
|
||||
RectListNode* rectListNode = internal_malloc(sizeof(*rectListNode));
|
||||
RectListNode* rectListNode = (RectListNode*)internal_malloc(sizeof(*rectListNode));
|
||||
if (rectListNode == NULL) {
|
||||
break;
|
||||
}
|
||||
@ -141,10 +142,10 @@ void _rect_free(RectListNode* rectListNode)
|
||||
// 0x4C6C18
|
||||
void rectUnion(const Rect* s1, const Rect* s2, Rect* r)
|
||||
{
|
||||
r->left = min(s1->left, s2->left);
|
||||
r->top = min(s1->top, s2->top);
|
||||
r->right = max(s1->right, s2->right);
|
||||
r->bottom = max(s1->bottom, s2->bottom);
|
||||
r->left = std::min(s1->left, s2->left);
|
||||
r->top = std::min(s1->top, s2->top);
|
||||
r->right = std::max(s1->right, s2->right);
|
||||
r->bottom = std::max(s1->bottom, s2->bottom);
|
||||
}
|
||||
|
||||
// Calculates intersection of two source rectangles and places it into third
|
@ -39,10 +39,10 @@ int graphCompress(unsigned char* a1, unsigned char* a2, int a3)
|
||||
|
||||
// NOTE: Original code is slightly different, it uses deep nesting or a
|
||||
// bunch of gotos.
|
||||
_lson = internal_malloc(sizeof(*_lson) * 4104);
|
||||
_rson = internal_malloc(sizeof(*_rson) * 4376);
|
||||
_dad_2 = internal_malloc(sizeof(*_dad_2) * 4104);
|
||||
_text_buf = internal_malloc(sizeof(*_text_buf) * 4122);
|
||||
_lson = (int*)internal_malloc(sizeof(*_lson) * 4104);
|
||||
_rson = (int*)internal_malloc(sizeof(*_rson) * 4376);
|
||||
_dad_2 = (int*)internal_malloc(sizeof(*_dad_2) * 4104);
|
||||
_text_buf = (unsigned char*)internal_malloc(sizeof(*_text_buf) * 4122);
|
||||
|
||||
if (_lson == NULL || _rson == NULL || _dad_2 == NULL || _text_buf == NULL) {
|
||||
debugPrint("\nGRAPHLIB: Error allocating compression buffers!\n");
|
||||
@ -323,7 +323,7 @@ void _DeleteNode(int a1)
|
||||
// 0x44F92C
|
||||
int graphDecompress(unsigned char* src, unsigned char* dest, int length)
|
||||
{
|
||||
_text_buf = internal_malloc(sizeof(*_text_buf) * 4122);
|
||||
_text_buf = (unsigned char*)internal_malloc(sizeof(*_text_buf) * 4122);
|
||||
if (_text_buf == NULL) {
|
||||
debugPrint("\nGRAPHLIB: Error allocating decompression buffer!\n");
|
||||
return -1;
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include "color.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// 0x596D90
|
||||
unsigned char _GreyTable[256];
|
||||
|
||||
@ -13,8 +15,8 @@ void grayscalePaletteUpdate(int a1, int a2)
|
||||
// NOTE: The only way to explain so much calls to [_Color2RGB_] with
|
||||
// the same repeated pattern is by the use of min/max macros.
|
||||
|
||||
int v1 = max((_Color2RGB_(index) & 0x7C00) >> 10, max((_Color2RGB_(index) & 0x3E0) >> 5, _Color2RGB_(index) & 0x1F));
|
||||
int v2 = min((_Color2RGB_(index) & 0x7C00) >> 10, min((_Color2RGB_(index) & 0x3E0) >> 5, _Color2RGB_(index) & 0x1F));
|
||||
int v1 = std::max((_Color2RGB_(index) & 0x7C00) >> 10, std::max((_Color2RGB_(index) & 0x3E0) >> 5, _Color2RGB_(index) & 0x1F));
|
||||
int v2 = std::min((_Color2RGB_(index) & 0x7C00) >> 10, std::min((_Color2RGB_(index) & 0x3E0) >> 5, _Color2RGB_(index) & 0x1F));
|
||||
int v3 = v1 + v2;
|
||||
int v4 = (int)((double)v3 * 240.0 / 510.0);
|
||||
|
@ -69,26 +69,26 @@ bool heapInternalsInit()
|
||||
// bunch of goto's to free alloc'ed buffers one by one starting from where
|
||||
// it has failed.
|
||||
do {
|
||||
gHeapFreeBlocks = internal_malloc(sizeof(*gHeapFreeBlocks) * HEAP_FREE_BLOCKS_INITIAL_LENGTH);
|
||||
gHeapFreeBlocks = (unsigned char**)internal_malloc(sizeof(*gHeapFreeBlocks) * HEAP_FREE_BLOCKS_INITIAL_LENGTH);
|
||||
if (gHeapFreeBlocks == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
gHeapFreeBlocksLength = HEAP_FREE_BLOCKS_INITIAL_LENGTH;
|
||||
|
||||
gHeapMoveableExtents = internal_malloc(sizeof(*gHeapMoveableExtents) * HEAP_MOVEABLE_EXTENTS_INITIAL_LENGTH);
|
||||
gHeapMoveableExtents = (HeapMoveableExtent*)internal_malloc(sizeof(*gHeapMoveableExtents) * HEAP_MOVEABLE_EXTENTS_INITIAL_LENGTH);
|
||||
if (gHeapMoveableExtents == NULL) {
|
||||
break;
|
||||
}
|
||||
gHeapMoveableExtentsLength = HEAP_MOVEABLE_EXTENTS_INITIAL_LENGTH;
|
||||
|
||||
gHeapMoveableBlocks = internal_malloc(sizeof(*gHeapMoveableBlocks) * HEAP_MOVEABLE_BLOCKS_INITIAL_LENGTH);
|
||||
gHeapMoveableBlocks = (unsigned char**)internal_malloc(sizeof(*gHeapMoveableBlocks) * HEAP_MOVEABLE_BLOCKS_INITIAL_LENGTH);
|
||||
if (gHeapMoveableBlocks == NULL) {
|
||||
break;
|
||||
}
|
||||
gHeapMoveableBlocksLength = HEAP_MOVEABLE_BLOCKS_INITIAL_LENGTH;
|
||||
|
||||
gHeapReservedFreeBlockIndexes = internal_malloc(sizeof(*gHeapReservedFreeBlockIndexes) * HEAP_RESERVED_FREE_BLOCK_INDEXES_INITIAL_LENGTH);
|
||||
gHeapReservedFreeBlockIndexes = (int*)internal_malloc(sizeof(*gHeapReservedFreeBlockIndexes) * HEAP_RESERVED_FREE_BLOCK_INDEXES_INITIAL_LENGTH);
|
||||
if (gHeapReservedFreeBlockIndexes == NULL) {
|
||||
break;
|
||||
}
|
||||
@ -148,7 +148,7 @@ bool heapInit(Heap* heap, int a2)
|
||||
|
||||
if (heapHandleListInit(heap)) {
|
||||
int size = (a2 >> 10) + a2;
|
||||
heap->data = internal_malloc(size);
|
||||
heap->data = (unsigned char*)internal_malloc(size);
|
||||
if (heap->data != NULL) {
|
||||
heap->size = size;
|
||||
heap->freeBlocks = 1;
|
||||
@ -213,7 +213,7 @@ bool heapFree(Heap* heap)
|
||||
// 0x453430
|
||||
bool heapHandleListInit(Heap* heap)
|
||||
{
|
||||
heap->handles = internal_malloc(sizeof(*heap->handles) * HEAP_HANDLES_INITIAL_LENGTH);
|
||||
heap->handles = (HeapHandle*)internal_malloc(sizeof(*heap->handles) * HEAP_HANDLES_INITIAL_LENGTH);
|
||||
if (heap->handles == NULL) {
|
||||
debugPrint("Heap Error : Could not initialize handles.\n");
|
||||
return false;
|
||||
@ -241,7 +241,7 @@ bool heapBlockAllocate(Heap* heap, int* handleIndexPtr, int size, int a4)
|
||||
a4 = 0;
|
||||
}
|
||||
|
||||
unsigned char* block;
|
||||
void* block;
|
||||
if (!heapFindFreeBlock(heap, size, &block, a4)) {
|
||||
goto err;
|
||||
}
|
||||
@ -263,7 +263,7 @@ bool heapBlockAllocate(Heap* heap, int* handleIndexPtr, int size, int a4)
|
||||
|
||||
// Bind handle to block and mark it as system
|
||||
handle->state = HEAP_BLOCK_STATE_SYSTEM;
|
||||
handle->data = block;
|
||||
handle->data = (unsigned char*)block;
|
||||
|
||||
// Update heap stats
|
||||
heap->systemBlocks++;
|
||||
@ -283,11 +283,11 @@ bool heapBlockAllocate(Heap* heap, int* handleIndexPtr, int size, int a4)
|
||||
blockSize = size;
|
||||
|
||||
//
|
||||
HeapBlockFooter* blockFooter = (HeapBlockFooter*)(block + blockHeader->size + HEAP_BLOCK_HEADER_SIZE);
|
||||
HeapBlockFooter* blockFooter = (HeapBlockFooter*)((unsigned char*)block + blockHeader->size + HEAP_BLOCK_HEADER_SIZE);
|
||||
blockFooter->guard = HEAP_BLOCK_FOOTER_GUARD;
|
||||
|
||||
// Obtain beginning of the next block.
|
||||
unsigned char* nextBlock = block + blockHeader->size + HEAP_BLOCK_OVERHEAD_SIZE;
|
||||
unsigned char* nextBlock = (unsigned char*)block + blockHeader->size + HEAP_BLOCK_OVERHEAD_SIZE;
|
||||
|
||||
// Setup next block's header...
|
||||
HeapBlockHeader* nextBlockHeader = (HeapBlockHeader*)nextBlock;
|
||||
@ -311,7 +311,7 @@ bool heapBlockAllocate(Heap* heap, int* handleIndexPtr, int size, int a4)
|
||||
|
||||
// Bind handle to block and mark it as moveable
|
||||
handle->state = HEAP_BLOCK_STATE_MOVABLE;
|
||||
handle->data = block;
|
||||
handle->data = (unsigned char*)block;
|
||||
|
||||
// Update heap stats
|
||||
heap->freeBlocks--;
|
||||
@ -572,7 +572,7 @@ bool heapFindFreeHandle(Heap* heap, int* handleIndexPtr)
|
||||
}
|
||||
|
||||
// If we're here the search above failed, we have to allocate more handles.
|
||||
HeapHandle* handles = internal_realloc(heap->handles, sizeof(*handles) * (heap->handlesLength + HEAP_HANDLES_INITIAL_LENGTH));
|
||||
HeapHandle* handles = (HeapHandle*)internal_realloc(heap->handles, sizeof(*handles) * (heap->handlesLength + HEAP_HANDLES_INITIAL_LENGTH));
|
||||
if (handles == NULL) {
|
||||
return false;
|
||||
}
|
||||
@ -640,7 +640,7 @@ bool heapFindFreeBlock(Heap* heap, int size, void** blockPtr, int a4)
|
||||
// Ensure the length of [gHeapReservedFreeBlockIndexes] array is big enough
|
||||
// to index all blocks for longest moveable extent.
|
||||
if (maxBlocksCount > gHeapReservedFreeBlockIndexesLength) {
|
||||
int* indexes = internal_realloc(gHeapReservedFreeBlockIndexes, sizeof(*gHeapReservedFreeBlockIndexes) * maxBlocksCount);
|
||||
int* indexes = (int*)internal_realloc(gHeapReservedFreeBlockIndexes, sizeof(*gHeapReservedFreeBlockIndexes) * maxBlocksCount);
|
||||
if (indexes == NULL) {
|
||||
goto system;
|
||||
}
|
||||
@ -836,7 +836,7 @@ system:
|
||||
|
||||
if (a4 == 0) {
|
||||
debugPrint("Allocating block from system memory...\n");
|
||||
unsigned char* block = internal_malloc(size + HEAP_BLOCK_OVERHEAD_SIZE);
|
||||
unsigned char* block = (unsigned char*)internal_malloc(size + HEAP_BLOCK_OVERHEAD_SIZE);
|
||||
if (block == NULL) {
|
||||
debugPrint("fatal error: internal_malloc() failed in heap_find_free_block()!\n");
|
||||
return false;
|
||||
@ -867,7 +867,7 @@ bool heapBuildMoveableBlocksList(int extentIndex)
|
||||
{
|
||||
HeapMoveableExtent* extent = &(gHeapMoveableExtents[extentIndex]);
|
||||
if (extent->moveableBlocksLength > gHeapMoveableBlocksLength) {
|
||||
unsigned char** moveableBlocks = internal_realloc(gHeapMoveableBlocks, sizeof(*gHeapMoveableBlocks) * extent->moveableBlocksLength);
|
||||
unsigned char** moveableBlocks = (unsigned char**)internal_realloc(gHeapMoveableBlocks, sizeof(*gHeapMoveableBlocks) * extent->moveableBlocksLength);
|
||||
if (moveableBlocks == NULL) {
|
||||
return false;
|
||||
}
|
||||
@ -905,7 +905,7 @@ bool heapBuildFreeBlocksList(Heap* heap)
|
||||
}
|
||||
|
||||
if (heap->freeBlocks > gHeapFreeBlocksLength) {
|
||||
unsigned char** freeBlocks = internal_realloc(gHeapFreeBlocks, sizeof(*freeBlocks) * heap->freeBlocks);
|
||||
unsigned char** freeBlocks = (unsigned char**)internal_realloc(gHeapFreeBlocks, sizeof(*freeBlocks) * heap->freeBlocks);
|
||||
if (freeBlocks == NULL) {
|
||||
return false;
|
||||
}
|
||||
@ -978,7 +978,7 @@ bool heapBuildMoveableExtentsList(Heap* heap, int* moveableExtentsLengthPtr, int
|
||||
}
|
||||
|
||||
if (maxExtentsCount > gHeapMoveableExtentsLength) {
|
||||
HeapMoveableExtent* moveableExtents = internal_realloc(gHeapMoveableExtents, sizeof(*gHeapMoveableExtents) * maxExtentsCount);
|
||||
HeapMoveableExtent* moveableExtents = (HeapMoveableExtent*)internal_realloc(gHeapMoveableExtents, sizeof(*gHeapMoveableExtents) * maxExtentsCount);
|
||||
if (moveableExtents == NULL) {
|
||||
return false;
|
||||
}
|
@ -41,7 +41,7 @@ typedef enum HeapBlockState {
|
||||
typedef struct HeapBlockHeader {
|
||||
int guard;
|
||||
int size;
|
||||
HeapBlockState state;
|
||||
unsigned int state;
|
||||
int handle_index;
|
||||
} HeapBlockHeader;
|
||||
|
||||
@ -50,7 +50,7 @@ typedef struct HeapBlockFooter {
|
||||
} HeapBlockFooter;
|
||||
|
||||
typedef struct HeapHandle {
|
||||
HeapBlockState state;
|
||||
unsigned int state;
|
||||
unsigned char* data;
|
||||
} HeapHandle;
|
||||
|
||||
|
@ -2349,7 +2349,7 @@ int indicatorBarInit()
|
||||
for (int index = 0; index < INDICATOR_COUNT; index++) {
|
||||
IndicatorDescription* indicatorDescription = &(gIndicatorDescriptions[index]);
|
||||
|
||||
indicatorDescription->data = internal_malloc(INDICATOR_BOX_WIDTH * INDICATOR_BOX_HEIGHT);
|
||||
indicatorDescription->data = (unsigned char*)internal_malloc(INDICATOR_BOX_WIDTH * INDICATOR_BOX_HEIGHT);
|
||||
if (indicatorDescription->data == NULL) {
|
||||
debugPrint("\nINTRFACE: Error initializing indicator box graphics! **");
|
||||
|
@ -415,25 +415,25 @@ Program* programCreateByPath(const char* path)
|
||||
}
|
||||
|
||||
int fileSize = fileGetSize(stream);
|
||||
unsigned char* data = internal_malloc_safe(fileSize, __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 458
|
||||
unsigned char* data = (unsigned char*)internal_malloc_safe(fileSize, __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 458
|
||||
|
||||
fileRead(data, 1, fileSize, stream);
|
||||
fileClose(stream);
|
||||
|
||||
Program* program = internal_malloc_safe(sizeof(Program), __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 463
|
||||
Program* program = (Program*)internal_malloc_safe(sizeof(Program), __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 463
|
||||
memset(program, 0, sizeof(Program));
|
||||
|
||||
program->name = internal_malloc_safe(strlen(path) + 1, __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 466
|
||||
program->name = (char*)internal_malloc_safe(strlen(path) + 1, __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 466
|
||||
strcpy(program->name, path);
|
||||
|
||||
program->child = NULL;
|
||||
program->parent = NULL;
|
||||
program->field_78 = -1;
|
||||
program->stack = internal_calloc_safe(1, 4096, __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 472
|
||||
program->stack = (unsigned char*)internal_calloc_safe(1, 4096, __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 472
|
||||
program->exited = false;
|
||||
program->basePointer = -1;
|
||||
program->framePointer = -1;
|
||||
program->returnStack = internal_calloc_safe(1, 4096, __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 473
|
||||
program->returnStack = (unsigned char*)internal_calloc_safe(1, 4096, __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 473
|
||||
program->data = data;
|
||||
program->procedures = data + 42;
|
||||
program->identifiers = 24 * stackReadInt32(program->procedures, 0) + program->procedures + 4;
|
||||
@ -564,13 +564,13 @@ int programPushString(Program* program, char* string)
|
||||
heap += v2 + 4;
|
||||
}
|
||||
} else {
|
||||
program->dynamicStrings = 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;
|
||||
*(short*)(program->dynamicStrings + 4) = 0x8000;
|
||||
*(short*)(program->dynamicStrings + 6) = 1;
|
||||
}
|
||||
|
||||
program->dynamicStrings = internal_realloc_safe(program->dynamicStrings, *(int*)(program->dynamicStrings) + 8 + 4 + v27, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 640
|
||||
program->dynamicStrings = (unsigned char*)internal_realloc_safe(program->dynamicStrings, *(int*)(program->dynamicStrings) + 8 + 4 + v27, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 640
|
||||
|
||||
v20 = program->dynamicStrings + *(int*)(program->dynamicStrings) + 4;
|
||||
if ((*(short*)v20 & 0xFFFF) != 0x8000) {
|
||||
@ -1498,20 +1498,20 @@ void opAdd(Program* program)
|
||||
case VALUE_TYPE_STRING:
|
||||
case VALUE_TYPE_DYNAMIC_STRING:
|
||||
t = programGetString(program, opcodes[0], values[0]);
|
||||
str_ptr[0] = internal_malloc_safe(strlen(t) + 1, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1002
|
||||
str_ptr[0] = (char*)internal_malloc_safe(strlen(t) + 1, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1002
|
||||
strcpy(str_ptr[0], t);
|
||||
break;
|
||||
case VALUE_TYPE_FLOAT:
|
||||
str_ptr[0] = internal_malloc_safe(80, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1011
|
||||
str_ptr[0] = (char*)internal_malloc_safe(80, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1011
|
||||
sprintf(str_ptr[0], "%.5f", floats[0]);
|
||||
break;
|
||||
case VALUE_TYPE_INT:
|
||||
str_ptr[0] = internal_malloc_safe(80, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1007
|
||||
str_ptr[0] = (char*)internal_malloc_safe(80, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1007
|
||||
sprintf(str_ptr[0], "%d", values[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
t = internal_malloc_safe(strlen(str_ptr[1]) + strlen(str_ptr[0]) + 1, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1015
|
||||
t = (char*)internal_malloc_safe(strlen(str_ptr[1]) + strlen(str_ptr[0]) + 1, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1015
|
||||
strcpy(t, str_ptr[1]);
|
||||
strcat(t, str_ptr[0]);
|
||||
|
||||
@ -1526,7 +1526,7 @@ void opAdd(Program* program)
|
||||
case VALUE_TYPE_STRING:
|
||||
case VALUE_TYPE_DYNAMIC_STRING:
|
||||
str_ptr[0] = programGetString(program, opcodes[0], values[0]);
|
||||
t = internal_malloc_safe(strlen(str_ptr[0]) + 80, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1039
|
||||
t = (char*)internal_malloc_safe(strlen(str_ptr[0]) + 80, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1039
|
||||
sprintf(t, "%.5f", floats[1]);
|
||||
strcat(t, str_ptr[0]);
|
||||
|
||||
@ -1552,7 +1552,7 @@ void opAdd(Program* program)
|
||||
case VALUE_TYPE_STRING:
|
||||
case VALUE_TYPE_DYNAMIC_STRING:
|
||||
str_ptr[0] = programGetString(program, opcodes[0], values[0]);
|
||||
t = internal_malloc_safe(strlen(str_ptr[0]) + 80, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1070
|
||||
t = (char*)internal_malloc_safe(strlen(str_ptr[0]) + 80, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 1070
|
||||
sprintf(t, "%d", values[1]);
|
||||
strcat(t, str_ptr[0]);
|
||||
|
||||
@ -3412,7 +3412,7 @@ void programListNodeCreate(Program* program)
|
||||
{
|
||||
program->flags |= PROGRAM_FLAG_0x02;
|
||||
|
||||
ProgramListNode* programListNode = internal_malloc_safe(sizeof(*programListNode), __FILE__, __LINE__); // .\\int\\INTRPRET.C, 2907
|
||||
ProgramListNode* programListNode = (ProgramListNode*)internal_malloc_safe(sizeof(*programListNode), __FILE__, __LINE__); // .\\int\\INTRPRET.C, 2907
|
||||
programListNode->program = program;
|
||||
programListNode->next = gInterpreterProgramListHead;
|
||||
programListNode->prev = NULL;
|
@ -1523,9 +1523,9 @@ void _interpretRegisterProgramDeleteCallback(OFF_59E160 fn)
|
||||
|
||||
if (index == _numCallbacks) {
|
||||
if (_callbacks != NULL) {
|
||||
_callbacks = internal_realloc_safe(_callbacks, sizeof(*_callbacks) * (_numCallbacks + 1), __FILE__, __LINE__); // ..\\int\\INTLIB.C, 2110
|
||||
_callbacks = (OFF_59E160*)internal_realloc_safe(_callbacks, sizeof(*_callbacks) * (_numCallbacks + 1), __FILE__, __LINE__); // ..\\int\\INTLIB.C, 2110
|
||||
} else {
|
||||
_callbacks = internal_malloc_safe(sizeof(*_callbacks), __FILE__, __LINE__); // ..\\int\\INTLIB.C, 2112
|
||||
_callbacks = (OFF_59E160*)internal_malloc_safe(sizeof(*_callbacks), __FILE__, __LINE__); // ..\\int\\INTLIB.C, 2112
|
||||
}
|
||||
_numCallbacks++;
|
||||
}
|
@ -241,7 +241,7 @@ int itemAdd(Object* owner, Object* itemToAdd, int quantity)
|
||||
|
||||
if (index == inventory->length) {
|
||||
if (inventory->length == inventory->capacity || inventory->items == NULL) {
|
||||
InventoryItem* inventoryItems = internal_realloc(inventory->items, sizeof(InventoryItem) * (inventory->capacity + 10));
|
||||
InventoryItem* inventoryItems = (InventoryItem*)internal_realloc(inventory->items, sizeof(InventoryItem) * (inventory->capacity + 10));
|
||||
if (inventoryItems == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -2548,7 +2548,7 @@ int _insert_drug_effect(Object* critter, Object* item, int a3, int* stats, int*
|
||||
return -1;
|
||||
}
|
||||
|
||||
DrugEffectEvent* drugEffectEvent = internal_malloc(sizeof(*drugEffectEvent));
|
||||
DrugEffectEvent* drugEffectEvent = (DrugEffectEvent*)internal_malloc(sizeof(*drugEffectEvent));
|
||||
if (drugEffectEvent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -2701,7 +2701,7 @@ bool _drug_effect_allowed(Object* critter, int pid)
|
||||
|
||||
// TODO: Probably right, but let's check it once.
|
||||
int count = 0;
|
||||
DrugEffectEvent* drugEffectEvent = queueFindFirstEvent(critter, EVENT_TYPE_DRUG);
|
||||
DrugEffectEvent* drugEffectEvent = (DrugEffectEvent*)queueFindFirstEvent(critter, EVENT_TYPE_DRUG);
|
||||
while (drugEffectEvent != NULL) {
|
||||
if (drugEffectEvent->drugPid == pid) {
|
||||
count++;
|
||||
@ -2709,7 +2709,7 @@ bool _drug_effect_allowed(Object* critter, int pid)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
drugEffectEvent = queueFindNextEvent(critter, EVENT_TYPE_DRUG);
|
||||
drugEffectEvent = (DrugEffectEvent*)queueFindNextEvent(critter, EVENT_TYPE_DRUG);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -2805,7 +2805,7 @@ int _item_d_clear(Object* obj, void* data)
|
||||
// 0x47A198
|
||||
int drugEffectEventProcess(Object* obj, void* data)
|
||||
{
|
||||
DrugEffectEvent* drugEffectEvent = data;
|
||||
DrugEffectEvent* drugEffectEvent = (DrugEffectEvent*)data;
|
||||
|
||||
if (obj == NULL) {
|
||||
return 0;
|
||||
@ -2827,7 +2827,7 @@ int drugEffectEventProcess(Object* obj, void* data)
|
||||
// 0x47A1D0
|
||||
int drugEffectEventRead(File* stream, void** dataPtr)
|
||||
{
|
||||
DrugEffectEvent* drugEffectEvent = internal_malloc(sizeof(*drugEffectEvent));
|
||||
DrugEffectEvent* drugEffectEvent = (DrugEffectEvent*)internal_malloc(sizeof(*drugEffectEvent));
|
||||
if (drugEffectEvent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -2847,7 +2847,7 @@ err:
|
||||
// 0x47A254
|
||||
int drugEffectEventWrite(File* stream, void* data)
|
||||
{
|
||||
DrugEffectEvent* drugEffectEvent = data;
|
||||
DrugEffectEvent* drugEffectEvent = (DrugEffectEvent*)data;
|
||||
|
||||
if (fileWriteInt32List(stream, drugEffectEvent->stats, 3) == -1) return -1;
|
||||
if (fileWriteInt32List(stream, drugEffectEvent->modifiers, 3) == -1) return -1;
|
||||
@ -2858,7 +2858,7 @@ int drugEffectEventWrite(File* stream, void* data)
|
||||
// 0x47A290
|
||||
int _insert_withdrawal(Object* obj, int a2, int duration, int perk, int pid)
|
||||
{
|
||||
WithdrawalEvent* withdrawalEvent = internal_malloc(sizeof(*withdrawalEvent));
|
||||
WithdrawalEvent* withdrawalEvent = (WithdrawalEvent*)internal_malloc(sizeof(*withdrawalEvent));
|
||||
if (withdrawalEvent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -2878,7 +2878,7 @@ int _insert_withdrawal(Object* obj, int a2, int duration, int perk, int pid)
|
||||
// 0x47A2FC
|
||||
int _item_wd_clear(Object* obj, void* data)
|
||||
{
|
||||
WithdrawalEvent* withdrawalEvent = data;
|
||||
WithdrawalEvent* withdrawalEvent = (WithdrawalEvent*)data;
|
||||
|
||||
if (objectIsPartyMember(obj)) {
|
||||
return 0;
|
||||
@ -2894,7 +2894,7 @@ int _item_wd_clear(Object* obj, void* data)
|
||||
// 0x47A324
|
||||
int _item_wd_clear_all(Object* a1, void* data)
|
||||
{
|
||||
WithdrawalEvent* withdrawalEvent = data;
|
||||
WithdrawalEvent* withdrawalEvent = (WithdrawalEvent*)data;
|
||||
|
||||
if (a1 != _wd_obj) {
|
||||
return 0;
|
||||
@ -2918,7 +2918,7 @@ int _item_wd_clear_all(Object* a1, void* data)
|
||||
// 0x47A384
|
||||
int withdrawalEventProcess(Object* obj, void* data)
|
||||
{
|
||||
WithdrawalEvent* withdrawalEvent = data;
|
||||
WithdrawalEvent* withdrawalEvent = (WithdrawalEvent*)data;
|
||||
|
||||
if (withdrawalEvent->field_0) {
|
||||
performWithdrawalStart(obj, withdrawalEvent->perk, withdrawalEvent->pid);
|
||||
@ -2946,7 +2946,7 @@ int withdrawalEventProcess(Object* obj, void* data)
|
||||
// 0x47A404
|
||||
int withdrawalEventRead(File* stream, void** dataPtr)
|
||||
{
|
||||
WithdrawalEvent* withdrawalEvent = internal_malloc(sizeof(*withdrawalEvent));
|
||||
WithdrawalEvent* withdrawalEvent = (WithdrawalEvent*)internal_malloc(sizeof(*withdrawalEvent));
|
||||
if (withdrawalEvent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -2967,7 +2967,7 @@ err:
|
||||
// 0x47A484
|
||||
int withdrawalEventWrite(File* stream, void* data)
|
||||
{
|
||||
WithdrawalEvent* withdrawalEvent = data;
|
||||
WithdrawalEvent* withdrawalEvent = (WithdrawalEvent*)data;
|
||||
|
||||
if (fileWriteInt32(stream, withdrawalEvent->field_0) == -1) return -1;
|
||||
if (fileWriteInt32(stream, withdrawalEvent->pid) == -1) return -1;
|
@ -292,7 +292,7 @@ int lipsLoad(const char* audioFileName, const char* headFileName)
|
||||
}
|
||||
}
|
||||
|
||||
gLipsData.phonemes = internal_malloc(gLipsData.field_24);
|
||||
gLipsData.phonemes = (unsigned char*)internal_malloc(gLipsData.field_24);
|
||||
if (gLipsData.phonemes == NULL) {
|
||||
debugPrint("Out of memory in lips_load_file.'\n");
|
||||
return -1;
|
||||
@ -314,7 +314,7 @@ int lipsLoad(const char* audioFileName, const char* headFileName)
|
||||
}
|
||||
}
|
||||
|
||||
gLipsData.markers = internal_malloc(sizeof(*speech_marker) * gLipsData.field_2C);
|
||||
gLipsData.markers = (SpeechMarker*)internal_malloc(sizeof(*speech_marker) * gLipsData.field_2C);
|
||||
if (gLipsData.markers == NULL) {
|
||||
debugPrint("Out of memory in lips_load_file.'\n");
|
||||
return -1;
|
@ -602,7 +602,7 @@ int lsgSaveGame(int mode)
|
||||
// 0x47C5B4
|
||||
int _QuickSnapShot()
|
||||
{
|
||||
_snapshot = internal_malloc(LS_PREVIEW_SIZE);
|
||||
_snapshot = (unsigned char*)internal_malloc(LS_PREVIEW_SIZE);
|
||||
if (_snapshot == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -1052,7 +1052,7 @@ int lsgWindowInit(int windowType)
|
||||
return -1;
|
||||
}
|
||||
|
||||
_snapshot = internal_malloc(61632);
|
||||
_snapshot = (unsigned char*)internal_malloc(61632);
|
||||
if (_snapshot == NULL) {
|
||||
messageListFree(&gLoadSaveMessageList);
|
||||
fontSetCurrent(gLoadSaveWindowOldFont);
|
@ -418,7 +418,7 @@ int _map_malloc_local_var(int a1)
|
||||
int oldMapLocalVarsLength = gMapLocalVarsLength;
|
||||
gMapLocalVarsLength += a1;
|
||||
|
||||
int* vars = internal_realloc(gMapLocalVars, sizeof(*vars) * gMapLocalVarsLength);
|
||||
int* vars = (int*)internal_realloc(gMapLocalVars, sizeof(*vars) * gMapLocalVarsLength);
|
||||
if (vars == NULL) {
|
||||
debugPrint("\nError: Ran out of memory!");
|
||||
}
|
||||
@ -813,7 +813,7 @@ int mapLoad(File* stream)
|
||||
mapGlobalVariablesFree();
|
||||
|
||||
if (gMapHeader.globalVariablesCount != 0) {
|
||||
gMapGlobalVars = internal_malloc(sizeof(*gMapGlobalVars) * gMapHeader.globalVariablesCount);
|
||||
gMapGlobalVars = (int*)internal_malloc(sizeof(*gMapGlobalVars) * gMapHeader.globalVariablesCount);
|
||||
if (gMapGlobalVars == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -829,7 +829,7 @@ int mapLoad(File* stream)
|
||||
mapLocalVariablesFree();
|
||||
|
||||
if (gMapHeader.localVariablesCount != 0) {
|
||||
gMapLocalVars = internal_malloc(sizeof(*gMapLocalVars) * gMapHeader.localVariablesCount);
|
||||
gMapLocalVars = (int*)internal_malloc(sizeof(*gMapLocalVars) * gMapHeader.localVariablesCount);
|
||||
if (gMapLocalVars == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -1076,7 +1076,7 @@ int _map_age_dead_critters()
|
||||
|
||||
int capacity = 100;
|
||||
int count = 0;
|
||||
Object** objects = internal_malloc(sizeof(*objects) * capacity);
|
||||
Object** objects = (Object**)internal_malloc(sizeof(*objects) * capacity);
|
||||
|
||||
obj = objectFindFirst();
|
||||
while (obj != NULL) {
|
||||
@ -1088,7 +1088,7 @@ int _map_age_dead_critters()
|
||||
|
||||
if (count >= capacity) {
|
||||
capacity *= 2;
|
||||
objects = internal_realloc(objects, sizeof(*objects) * capacity);
|
||||
objects = (Object**)internal_realloc(objects, sizeof(*objects) * capacity);
|
||||
if (objects == NULL) {
|
||||
debugPrint("\nError: Out of Memory!");
|
||||
return -1;
|
||||
@ -1100,7 +1100,7 @@ int _map_age_dead_critters()
|
||||
objects[count++] = obj;
|
||||
if (count >= capacity) {
|
||||
capacity *= 2;
|
||||
objects = internal_realloc(objects, sizeof(*objects) * capacity);
|
||||
objects = (Object**)internal_realloc(objects, sizeof(*objects) * capacity);
|
||||
if (objects == NULL) {
|
||||
debugPrint("\nError: Out of Memory!");
|
||||
return -1;
|
@ -32,7 +32,7 @@ char* internal_strdup(const char* string)
|
||||
{
|
||||
char* copy = NULL;
|
||||
if (string != NULL) {
|
||||
copy = gMallocProc(strlen(string) + 1);
|
||||
copy = (char*)gMallocProc(strlen(string) + 1);
|
||||
strcpy(copy, string);
|
||||
}
|
||||
return copy;
|
||||
@ -52,7 +52,7 @@ void* memoryBlockMallocImpl(size_t size)
|
||||
if (size != 0) {
|
||||
size += sizeof(MemoryBlockHeader) + sizeof(MemoryBlockFooter);
|
||||
|
||||
unsigned char* block = malloc(size);
|
||||
unsigned char* block = (unsigned char*)malloc(size);
|
||||
if (block != NULL) {
|
||||
MemoryBlockHeader* header = (MemoryBlockHeader*)block;
|
||||
header->size = size;
|
||||
@ -101,7 +101,7 @@ void* memoryBlockReallocImpl(void* ptr, size_t size)
|
||||
size += sizeof(MemoryBlockHeader) + sizeof(MemoryBlockFooter);
|
||||
}
|
||||
|
||||
unsigned char* newBlock = realloc(block, size);
|
||||
unsigned char* newBlock = (unsigned char*)realloc(block, size);
|
||||
if (newBlock != NULL) {
|
||||
MemoryBlockHeader* newHeader = (MemoryBlockHeader*)newBlock;
|
||||
newHeader->size = size;
|
@ -126,7 +126,7 @@ void* internal_calloc_safe(int count, int size, const char* file, int line)
|
||||
char* strdup_safe(const char* string, const char* file, int line)
|
||||
{
|
||||
size_t size = strlen(string) + 1;
|
||||
char* copy = gMemoryManagerMallocProc(size);
|
||||
char* copy = (char*)gMemoryManagerMallocProc(size);
|
||||
if (copy == NULL) {
|
||||
memoryManagerFatalAllocationError("strdup", size, file, line);
|
||||
}
|
@ -50,13 +50,13 @@ int badwordsInit()
|
||||
gBadwordsCount++;
|
||||
}
|
||||
|
||||
gBadwords = internal_malloc(sizeof(*gBadwords) * gBadwordsCount);
|
||||
gBadwords = (char**)internal_malloc(sizeof(*gBadwords) * gBadwordsCount);
|
||||
if (gBadwords == NULL) {
|
||||
fileClose(stream);
|
||||
return -1;
|
||||
}
|
||||
|
||||
gBadwordsLengths = internal_malloc(sizeof(*gBadwordsLengths) * gBadwordsCount);
|
||||
gBadwordsLengths = (int*)internal_malloc(sizeof(*gBadwordsLengths) * gBadwordsCount);
|
||||
if (gBadwordsLengths == NULL) {
|
||||
internal_free(gBadwords);
|
||||
fileClose(stream);
|
||||
@ -353,7 +353,7 @@ bool _message_add(MessageList* msg, MessageListItem* new_entry)
|
||||
}
|
||||
} else {
|
||||
if (msg->entries != NULL) {
|
||||
entries = internal_realloc(msg->entries, sizeof(MessageListItem) * (msg->entries_num + 1));
|
||||
entries = (MessageListItem*)internal_realloc(msg->entries, sizeof(MessageListItem) * (msg->entries_num + 1));
|
||||
if (entries == NULL) {
|
||||
return false;
|
||||
}
|
||||
@ -365,7 +365,7 @@ bool _message_add(MessageList* msg, MessageListItem* new_entry)
|
||||
memmove(&(msg->entries[index + 1]), &(msg->entries[index]), sizeof(MessageListItem) * (msg->entries_num - index));
|
||||
}
|
||||
} else {
|
||||
msg->entries = internal_malloc(sizeof(MessageListItem));
|
||||
msg->entries = (MessageListItem*)internal_malloc(sizeof(MessageListItem));
|
||||
if (msg->entries == NULL) {
|
||||
return false;
|
||||
}
|
@ -88,7 +88,7 @@ int _lastMovieY;
|
||||
MovieSubtitleListNode* gMovieSubtitleHead;
|
||||
|
||||
// 0x638E78
|
||||
MovieExtendedFlags gMovieFlags;
|
||||
unsigned int gMovieFlags;
|
||||
|
||||
// 0x638E7C
|
||||
int _movieAlphaFlag;
|
||||
@ -361,7 +361,7 @@ void _cleanupMovie(int a1)
|
||||
DDSURFACEDESC ddsd;
|
||||
ddsd.dwSize = sizeof(DDSURFACEDESC);
|
||||
if (IDirectDrawSurface_Lock(gMovieDirectDrawSurface, 0, &ddsd, 1, NULL) == DD_OK) {
|
||||
_lastMovieBuffer = internal_malloc_safe(_lastMovieBH * _lastMovieBW, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 802
|
||||
_lastMovieBuffer = (unsigned char*)internal_malloc_safe(_lastMovieBH * _lastMovieBW, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 802
|
||||
blitBufferToBuffer((unsigned char*)ddsd.lpSurface + ddsd.lPitch * _lastMovieSX + _lastMovieSY, _lastMovieBW, _lastMovieBH, ddsd.lPitch, _lastMovieBuffer, _lastMovieBW);
|
||||
IDirectDrawSurface_Unlock(gMovieDirectDrawSurface, ddsd.lpSurface);
|
||||
} else {
|
||||
@ -543,7 +543,7 @@ void movieLoadSubtitles(char* filePath)
|
||||
break;
|
||||
}
|
||||
|
||||
MovieSubtitleListNode* subtitle = internal_malloc_safe(sizeof(*subtitle), __FILE__, __LINE__); // "..\\int\\MOVIE.C", 1050
|
||||
MovieSubtitleListNode* subtitle = (MovieSubtitleListNode*)internal_malloc_safe(sizeof(*subtitle), __FILE__, __LINE__); // "..\\int\\MOVIE.C", 1050
|
||||
subtitle->next = NULL;
|
||||
|
||||
subtitleCount++;
|
@ -54,7 +54,7 @@ extern int _lastMovieW;
|
||||
extern int _lastMovieX;
|
||||
extern int _lastMovieY;
|
||||
extern MovieSubtitleListNode* gMovieSubtitleHead;
|
||||
extern MovieExtendedFlags gMovieFlags;
|
||||
extern unsigned int gMovieFlags;
|
||||
extern int _movieAlphaFlag;
|
||||
extern bool _movieSubRectFlag;
|
||||
extern int _movieH;
|
||||
|
@ -111,7 +111,7 @@ int movieEffectsLoad(const char* filePath)
|
||||
goto out;
|
||||
}
|
||||
|
||||
int* movieEffectFrameList = internal_malloc(sizeof(*movieEffectFrameList) * movieEffectsLength);
|
||||
int* movieEffectFrameList = (int*)internal_malloc(sizeof(*movieEffectFrameList) * movieEffectsLength);
|
||||
if (movieEffectFrameList == NULL) {
|
||||
goto out;
|
||||
}
|
||||
@ -155,7 +155,7 @@ int movieEffectsLoad(const char* filePath)
|
||||
continue;
|
||||
}
|
||||
|
||||
MovieEffect* movieEffect = internal_malloc(sizeof(*movieEffect));
|
||||
MovieEffect* movieEffect = (MovieEffect*)internal_malloc(sizeof(*movieEffect));
|
||||
if (movieEffect == NULL) {
|
||||
continue;
|
||||
}
|
@ -620,7 +620,7 @@ int _ioReset(int stream)
|
||||
|
||||
_io_handle = stream;
|
||||
|
||||
mve = _ioRead(sizeof(Mve));
|
||||
mve = (Mve*)_ioRead(sizeof(Mve));
|
||||
if (mve == NULL) {
|
||||
return 0;
|
||||
}
|
@ -64,7 +64,7 @@ void _nevs_initonce()
|
||||
// _interpretRegisterProgramDeleteCallback(_nevs_removeprogramreferences);
|
||||
|
||||
if (_nevs == NULL) {
|
||||
_nevs = internal_calloc_safe(sizeof(Nevs), NEVS_COUNT, __FILE__, __LINE__); // "..\\int\\NEVS.C", 131
|
||||
_nevs = (Nevs*)internal_calloc_safe(sizeof(Nevs), NEVS_COUNT, __FILE__, __LINE__); // "..\\int\\NEVS.C", 131
|
||||
if (_nevs == NULL) {
|
||||
debugPrint("nevs_initonce(): out of memory");
|
||||
exit(99);
|
@ -463,7 +463,7 @@ int objectLoadAllInternal(File* stream)
|
||||
}
|
||||
|
||||
if (objectCount != 0) {
|
||||
gObjectFids = internal_malloc(sizeof(*gObjectFids) * objectCount);
|
||||
gObjectFids = (int*)internal_malloc(sizeof(*gObjectFids) * objectCount);
|
||||
memset(gObjectFids, 0, sizeof(*gObjectFids) * objectCount);
|
||||
if (gObjectFids == NULL) {
|
||||
return -1;
|
||||
@ -526,7 +526,7 @@ int objectLoadAllInternal(File* stream)
|
||||
|
||||
Inventory* inventory = &(objectListNode->obj->data.inventory);
|
||||
if (inventory->length != 0) {
|
||||
inventory->items = internal_malloc(sizeof(InventoryItem) * inventory->capacity);
|
||||
inventory->items = (InventoryItem*)internal_malloc(sizeof(InventoryItem) * inventory->capacity);
|
||||
if (inventory->items == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -539,7 +539,7 @@ int objectLoadAllInternal(File* stream)
|
||||
}
|
||||
|
||||
if (fixMapInventory) {
|
||||
inventoryItem->item = internal_malloc(sizeof(Object));
|
||||
inventoryItem->item = (Object*)internal_malloc(sizeof(Object));
|
||||
if (inventoryItem->item == NULL) {
|
||||
debugPrint("Error loading inventory\n");
|
||||
return -1;
|
||||
@ -2686,7 +2686,7 @@ int objectListCreate(int tile, int elevation, int objectType, Object*** objectLi
|
||||
return 0;
|
||||
}
|
||||
|
||||
Object** objects = *objectListPtr = internal_malloc(sizeof(*objects) * count);
|
||||
Object** objects = *objectListPtr = (Object**)internal_malloc(sizeof(*objects) * count);
|
||||
if (objects == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -3018,7 +3018,7 @@ int _obj_create_intersect_list(int x, int y, int elevation, int objectType, Obje
|
||||
&& object != gEgg) {
|
||||
int flags = _obj_intersects_with(object, x, y);
|
||||
if (flags != 0) {
|
||||
ObjectWithFlags* entries = internal_realloc(*entriesPtr, sizeof(*entries) * (count + 1));
|
||||
ObjectWithFlags* entries = (ObjectWithFlags*)internal_realloc(*entriesPtr, sizeof(*entries) * (count + 1));
|
||||
if (entries != NULL) {
|
||||
*entriesPtr = entries;
|
||||
entries[count].object = object;
|
||||
@ -3235,12 +3235,12 @@ int _obj_offset_table_init()
|
||||
return -1;
|
||||
}
|
||||
|
||||
_offsetTable[0] = internal_malloc(sizeof(int) * _updateHexArea);
|
||||
_offsetTable[0] = (int*)internal_malloc(sizeof(int) * _updateHexArea);
|
||||
if (_offsetTable[0] == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
_offsetTable[1] = internal_malloc(sizeof(int) * _updateHexArea);
|
||||
_offsetTable[1] = (int*)internal_malloc(sizeof(int) * _updateHexArea);
|
||||
if (_offsetTable[1] == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -3283,7 +3283,7 @@ int _obj_offset_table_init()
|
||||
}
|
||||
}
|
||||
|
||||
_offsetDivTable = internal_malloc(sizeof(int) * _updateHexArea);
|
||||
_offsetDivTable = (int*)internal_malloc(sizeof(int) * _updateHexArea);
|
||||
if (_offsetDivTable == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -3292,7 +3292,7 @@ int _obj_offset_table_init()
|
||||
_offsetDivTable[i] = i / _updateHexWidth;
|
||||
}
|
||||
|
||||
_offsetModTable = internal_malloc(sizeof(int) * _updateHexArea);
|
||||
_offsetModTable = (int*)internal_malloc(sizeof(int) * _updateHexArea);
|
||||
if (_offsetModTable == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -3340,12 +3340,12 @@ int _obj_order_table_init()
|
||||
return -1;
|
||||
}
|
||||
|
||||
_orderTable[0] = internal_malloc(sizeof(int) * _updateHexArea);
|
||||
_orderTable[0] = (int*)internal_malloc(sizeof(int) * _updateHexArea);
|
||||
if (_orderTable[0] == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
_orderTable[1] = internal_malloc(sizeof(int) * _updateHexArea);
|
||||
_orderTable[1] = (int*)internal_malloc(sizeof(int) * _updateHexArea);
|
||||
if (_orderTable[1] == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -3407,7 +3407,7 @@ int _obj_render_table_init()
|
||||
return -1;
|
||||
}
|
||||
|
||||
_renderTable = internal_malloc(sizeof(*_renderTable) * _updateHexArea);
|
||||
_renderTable = (ObjectListNode**)internal_malloc(sizeof(*_renderTable) * _updateHexArea);
|
||||
if (_renderTable == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -3582,7 +3582,7 @@ int _obj_load_obj(File* stream, Object** objectPtr, int elevation, Object* owner
|
||||
return 0;
|
||||
}
|
||||
|
||||
InventoryItem* inventoryItems = inventory->items = internal_malloc(sizeof(*inventoryItems) * inventory->capacity);
|
||||
InventoryItem* inventoryItems = inventory->items = (InventoryItem*)internal_malloc(sizeof(*inventoryItems) * inventory->capacity);
|
||||
if (inventoryItems == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -3708,7 +3708,7 @@ int objectAllocate(Object** objectPtr)
|
||||
return -1;
|
||||
}
|
||||
|
||||
Object* object = *objectPtr = internal_malloc(sizeof(Object));
|
||||
Object* object = *objectPtr = (Object*)internal_malloc(sizeof(Object));
|
||||
if (object == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -3754,7 +3754,7 @@ int objectListNodeCreate(ObjectListNode** nodePtr)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ObjectListNode* node = *nodePtr = internal_malloc(sizeof(*node));
|
||||
ObjectListNode* node = *nodePtr = (ObjectListNode*)internal_malloc(sizeof(*node));
|
||||
if (node == NULL) {
|
||||
return -1;
|
||||
}
|
@ -476,7 +476,7 @@ int optionsWindowInit()
|
||||
|
||||
int cycle = 0;
|
||||
for (int index = 0; index < OPTIONS_WINDOW_BUTTONS_COUNT; index++) {
|
||||
_opbtns[index] = internal_malloc(gOptionsWindowFrmSizes[OPTIONS_WINDOW_FRM_BUTTON_ON].width * gOptionsWindowFrmSizes[OPTIONS_WINDOW_FRM_BUTTON_ON].height + 1024);
|
||||
_opbtns[index] = (unsigned char*)internal_malloc(gOptionsWindowFrmSizes[OPTIONS_WINDOW_FRM_BUTTON_ON].width * gOptionsWindowFrmSizes[OPTIONS_WINDOW_FRM_BUTTON_ON].height + 1024);
|
||||
if (_opbtns[index] == NULL) {
|
||||
while (--index >= 0) {
|
||||
internal_free(_opbtns[index]);
|
@ -89,28 +89,28 @@ int partyMembersInit()
|
||||
sprintf(section, "Party Member %d", gPartyMemberDescriptionsLength);
|
||||
}
|
||||
|
||||
gPartyMemberPids = internal_malloc(sizeof(*gPartyMemberPids) * gPartyMemberDescriptionsLength);
|
||||
gPartyMemberPids = (int*)internal_malloc(sizeof(*gPartyMemberPids) * gPartyMemberDescriptionsLength);
|
||||
if (gPartyMemberPids == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
memset(gPartyMemberPids, 0, sizeof(*gPartyMemberPids) * gPartyMemberDescriptionsLength);
|
||||
|
||||
gPartyMembers = internal_malloc(sizeof(*gPartyMembers) * (gPartyMemberDescriptionsLength + 20));
|
||||
gPartyMembers = (STRUCT_519DA8*)internal_malloc(sizeof(*gPartyMembers) * (gPartyMemberDescriptionsLength + 20));
|
||||
if (gPartyMembers == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
memset(gPartyMembers, 0, sizeof(*gPartyMembers) * (gPartyMemberDescriptionsLength + 20));
|
||||
|
||||
gPartyMemberDescriptions = internal_malloc(sizeof(*gPartyMemberDescriptions) * gPartyMemberDescriptionsLength);
|
||||
gPartyMemberDescriptions = (PartyMemberDescription*)internal_malloc(sizeof(*gPartyMemberDescriptions) * gPartyMemberDescriptionsLength);
|
||||
if (gPartyMemberDescriptions == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
memset(gPartyMemberDescriptions, 0, sizeof(*gPartyMemberDescriptions) * gPartyMemberDescriptionsLength);
|
||||
|
||||
_partyMemberLevelUpInfoList = internal_malloc(sizeof(*_partyMemberLevelUpInfoList) * gPartyMemberDescriptionsLength);
|
||||
_partyMemberLevelUpInfoList = (STRU_519DBC*)internal_malloc(sizeof(*_partyMemberLevelUpInfoList) * gPartyMemberDescriptionsLength);
|
||||
if (_partyMemberLevelUpInfoList == NULL) goto err;
|
||||
|
||||
memset(_partyMemberLevelUpInfoList, 0, sizeof(*_partyMemberLevelUpInfoList) * gPartyMemberDescriptionsLength);
|
||||
@ -530,7 +530,7 @@ int _partyMemberPrepLoadInstance(STRUCT_519DA8* a1)
|
||||
return 0;
|
||||
}
|
||||
|
||||
a1->script = internal_malloc(sizeof(*script));
|
||||
a1->script = (Script*)internal_malloc(sizeof(*script));
|
||||
if (a1->script == NULL) {
|
||||
showMesageBox("\n Error!: partyMemberPrepLoad: Out of memory!");
|
||||
exit(1);
|
||||
@ -539,7 +539,7 @@ int _partyMemberPrepLoadInstance(STRUCT_519DA8* a1)
|
||||
memcpy(a1->script, script, sizeof(*script));
|
||||
|
||||
if (script->localVarsCount != 0 && script->localVarsOffset != -1) {
|
||||
a1->vars = internal_malloc(sizeof(*a1->vars) * script->localVarsCount);
|
||||
a1->vars = (int*)internal_malloc(sizeof(*a1->vars) * script->localVarsCount);
|
||||
if (a1->vars == NULL) {
|
||||
showMesageBox("\n Error!: partyMemberPrepLoad: Out of memory!");
|
||||
exit(1);
|
||||
@ -658,7 +658,7 @@ int _partyMemberRecoverLoadInstance(STRUCT_519DA8* a1)
|
||||
// 0x494BBC
|
||||
int partyMembersLoad(File* stream)
|
||||
{
|
||||
int* partyMemberObjectIds = internal_malloc(sizeof(*partyMemberObjectIds) * (gPartyMemberDescriptionsLength + 20));
|
||||
int* partyMemberObjectIds = (int*)internal_malloc(sizeof(*partyMemberObjectIds) * (gPartyMemberDescriptionsLength + 20));
|
||||
if (partyMemberObjectIds == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -971,7 +971,7 @@ int _partyMemberItemSave(Object* object)
|
||||
object->id = script->field_1C;
|
||||
}
|
||||
|
||||
STRUCT_519DA8* node = internal_malloc(sizeof(*node));
|
||||
STRUCT_519DA8* node = (STRUCT_519DA8*)internal_malloc(sizeof(*node));
|
||||
if (node == NULL) {
|
||||
showMesageBox("\n Error!: partyMemberItemSave: Out of memory!");
|
||||
exit(1);
|
||||
@ -979,7 +979,7 @@ int _partyMemberItemSave(Object* object)
|
||||
|
||||
node->object = object;
|
||||
|
||||
node->script = internal_malloc(sizeof(*script));
|
||||
node->script = (Script*)internal_malloc(sizeof(*script));
|
||||
if (node->script == NULL) {
|
||||
showMesageBox("\n Error!: partyMemberItemSave: Out of memory!");
|
||||
exit(1);
|
||||
@ -988,7 +988,7 @@ int _partyMemberItemSave(Object* object)
|
||||
memcpy(node->script, script, sizeof(*script));
|
||||
|
||||
if (script->localVarsCount != 0 && script->localVarsOffset != -1) {
|
||||
node->vars = internal_malloc(sizeof(*node->vars) * script->localVarsCount);
|
||||
node->vars = (int*)internal_malloc(sizeof(*node->vars) * script->localVarsCount);
|
||||
if (node->vars == NULL) {
|
||||
showMesageBox("\n Error!: partyMemberItemSave: Out of memory!");
|
||||
exit(1);
|
@ -153,7 +153,7 @@ MessageList gPerksMessageList;
|
||||
// 0x4965A0
|
||||
int perksInit()
|
||||
{
|
||||
gPartyMemberPerkRanks = internal_malloc(sizeof(*gPartyMemberPerkRanks) * gPartyMemberDescriptionsLength);
|
||||
gPartyMemberPerkRanks = (PerkRankData*)internal_malloc(sizeof(*gPartyMemberPerkRanks) * gPartyMemberDescriptionsLength);
|
||||
if (gPartyMemberPerkRanks == NULL) {
|
||||
return -1;
|
||||
}
|
@ -2011,7 +2011,7 @@ int pipboyRenderScreensaver()
|
||||
|
||||
_gmouse_disable(0);
|
||||
|
||||
unsigned char* buf = internal_malloc(412 * 374);
|
||||
unsigned char* buf = (unsigned char*)internal_malloc(412 * 374);
|
||||
if (buf == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -2242,7 +2242,7 @@ int questInit()
|
||||
|
||||
entry.completedThreshold = atoi(tok);
|
||||
|
||||
QuestDescription* entries = internal_realloc(gQuestDescriptions, sizeof(*gQuestDescriptions) * (gQuestsCount + 1));
|
||||
QuestDescription* entries = (QuestDescription*)internal_realloc(gQuestDescriptions, sizeof(*gQuestDescriptions) * (gQuestsCount + 1));
|
||||
if (entries == NULL) {
|
||||
goto err;
|
||||
}
|
||||
@ -2338,7 +2338,7 @@ int holodiskInit()
|
||||
|
||||
entry.description = atoi(tok);
|
||||
|
||||
HolodiskDescription* entries = internal_realloc(gHolodiskDescriptions, sizeof(*gHolodiskDescriptions) * (gHolodisksCount + 1));
|
||||
HolodiskDescription* entries = (HolodiskDescription*)internal_realloc(gHolodiskDescriptions, sizeof(*gHolodiskDescriptions) * (gHolodisksCount + 1));
|
||||
if (entries == NULL) {
|
||||
goto err;
|
||||
}
|
@ -1695,7 +1695,7 @@ int _proto_find_free_subnode(int type, Proto** protoPtr)
|
||||
{
|
||||
size_t size = (type >= 0 && type < 11) ? _proto_sizes[type] : 0;
|
||||
|
||||
Proto* proto = internal_malloc(size);
|
||||
Proto* proto = (Proto*)internal_malloc(size);
|
||||
*protoPtr = proto;
|
||||
if (proto == NULL) {
|
||||
return -1;
|
||||
@ -1706,7 +1706,7 @@ int _proto_find_free_subnode(int type, Proto** protoPtr)
|
||||
|
||||
if (protoList->head != NULL) {
|
||||
if (protoListExtent->length == PROTO_LIST_EXTENT_SIZE) {
|
||||
ProtoListExtent* newExtent = protoListExtent->next = internal_malloc(sizeof(ProtoListExtent));
|
||||
ProtoListExtent* newExtent = protoListExtent->next = (ProtoListExtent*)internal_malloc(sizeof(ProtoListExtent));
|
||||
if (protoListExtent == NULL) {
|
||||
internal_free(proto);
|
||||
*protoPtr = NULL;
|
||||
@ -1722,7 +1722,7 @@ int _proto_find_free_subnode(int type, Proto** protoPtr)
|
||||
protoListExtent = newExtent;
|
||||
}
|
||||
} else {
|
||||
protoListExtent = internal_malloc(sizeof(ProtoListExtent));
|
||||
protoListExtent = (ProtoListExtent*)internal_malloc(sizeof(ProtoListExtent));
|
||||
if (protoListExtent == NULL) {
|
||||
internal_free(proto);
|
||||
*protoPtr = NULL;
|
@ -70,7 +70,7 @@ int queueLoad(File* stream)
|
||||
|
||||
int rc = 0;
|
||||
for (int index = 0; index < count; index += 1) {
|
||||
QueueListNode* queueListNode = internal_malloc(sizeof(*queueListNode));
|
||||
QueueListNode* queueListNode = (QueueListNode*)internal_malloc(sizeof(*queueListNode));
|
||||
if (queueListNode == NULL) {
|
||||
rc = -1;
|
||||
break;
|
||||
@ -219,7 +219,7 @@ int queueSave(File* stream)
|
||||
// 0x4A258C
|
||||
int queueAddEvent(int delay, Object* obj, void* data, int eventType)
|
||||
{
|
||||
QueueListNode* newQueueListNode = internal_malloc(sizeof(QueueListNode));
|
||||
QueueListNode* newQueueListNode = (QueueListNode*)internal_malloc(sizeof(QueueListNode));
|
||||
if (newQueueListNode == NULL) {
|
||||
return -1;
|
||||
}
|
@ -48,11 +48,11 @@ void _regionSetBound(Region* region)
|
||||
// 0x4A2D78
|
||||
Region* regionCreate(int initialCapacity)
|
||||
{
|
||||
Region* region = internal_malloc_safe(sizeof(*region), __FILE__, __LINE__); // "..\int\REGION.C", 142
|
||||
Region* region = (Region*)internal_malloc_safe(sizeof(*region), __FILE__, __LINE__); // "..\int\REGION.C", 142
|
||||
memset(region, 0, sizeof(*region));
|
||||
|
||||
if (initialCapacity != 0) {
|
||||
region->points = internal_malloc_safe(sizeof(*region->points) * (initialCapacity + 1), __FILE__, __LINE__); // "..\int\REGION.C", 147
|
||||
region->points = (Point*)internal_malloc_safe(sizeof(*region->points) * (initialCapacity + 1), __FILE__, __LINE__); // "..\int\REGION.C", 147
|
||||
region->pointsCapacity = initialCapacity + 1;
|
||||
} else {
|
||||
region->points = NULL;
|
||||
@ -96,13 +96,13 @@ void regionAddPoint(Region* region, int x, int y)
|
||||
|
||||
if (region->points != NULL) {
|
||||
if (region->pointsCapacity - 1 == region->pointsLength) {
|
||||
region->points = internal_realloc_safe(region->points, sizeof(*region->points) * (region->pointsCapacity + 1), __FILE__, __LINE__); // "..\int\REGION.C", 190
|
||||
region->points = (Point*)internal_realloc_safe(region->points, sizeof(*region->points) * (region->pointsCapacity + 1), __FILE__, __LINE__); // "..\int\REGION.C", 190
|
||||
region->pointsCapacity++;
|
||||
}
|
||||
} else {
|
||||
region->pointsCapacity = 2;
|
||||
region->pointsLength = 0;
|
||||
region->points = internal_malloc_safe(sizeof(*region->points) * 2, __FILE__, __LINE__); // "..\int\REGION.C", 185
|
||||
region->points = (Point*)internal_malloc_safe(sizeof(*region->points) * 2, __FILE__, __LINE__); // "..\int\REGION.C", 185
|
||||
}
|
||||
|
||||
int pointIndex = region->pointsLength;
|
@ -151,7 +151,7 @@ char* _err_str = _Error_2;
|
||||
char* _blank_str = byte_50D6C0;
|
||||
|
||||
// 0x664954
|
||||
ScriptRequests gScriptsRequests;
|
||||
unsigned int gScriptsRequests;
|
||||
|
||||
// 0x664958
|
||||
STRUCT_664980 stru_664958;
|
||||
@ -730,14 +730,14 @@ void _scrSetQueueTestVals(Object* a1, int a2)
|
||||
// 0x4A3E3C
|
||||
int _scrQueueRemoveFixed(Object* obj, void* data)
|
||||
{
|
||||
ScriptEvent* scriptEvent = data;
|
||||
ScriptEvent* scriptEvent = (ScriptEvent*)data;
|
||||
return obj == _scrQueueTestObj && scriptEvent->field_4 == _scrQueueTestValue;
|
||||
}
|
||||
|
||||
// 0x4A3E60
|
||||
int scriptAddTimerEvent(int sid, int delay, int param)
|
||||
{
|
||||
ScriptEvent* scriptEvent = internal_malloc(sizeof(*scriptEvent));
|
||||
ScriptEvent* scriptEvent = (ScriptEvent*)internal_malloc(sizeof(*scriptEvent));
|
||||
if (scriptEvent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -762,7 +762,7 @@ int scriptAddTimerEvent(int sid, int delay, int param)
|
||||
// 0x4A3EDC
|
||||
int scriptEventWrite(File* stream, void* data)
|
||||
{
|
||||
ScriptEvent* scriptEvent = data;
|
||||
ScriptEvent* scriptEvent = (ScriptEvent*)data;
|
||||
|
||||
if (fileWriteInt32(stream, scriptEvent->sid) == -1) return -1;
|
||||
if (fileWriteInt32(stream, scriptEvent->field_4) == -1) return -1;
|
||||
@ -773,7 +773,7 @@ int scriptEventWrite(File* stream, void* data)
|
||||
// 0x4A3F04
|
||||
int scriptEventRead(File* stream, void** dataPtr)
|
||||
{
|
||||
ScriptEvent* scriptEvent = internal_malloc(sizeof(*scriptEvent));
|
||||
ScriptEvent* scriptEvent = (ScriptEvent*)internal_malloc(sizeof(*scriptEvent));
|
||||
if (scriptEvent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -796,7 +796,7 @@ err:
|
||||
// 0x4A3F4C
|
||||
int scriptEventProcess(Object* obj, void* data)
|
||||
{
|
||||
ScriptEvent* scriptEvent = data;
|
||||
ScriptEvent* scriptEvent = (ScriptEvent*)data;
|
||||
|
||||
Script* script;
|
||||
if (scriptGetScript(scriptEvent->sid, &script) == -1) {
|
||||
@ -1304,7 +1304,7 @@ int scriptsLoadScriptsList()
|
||||
while (fileReadString(string, 260, stream)) {
|
||||
gScriptsListEntriesLength++;
|
||||
|
||||
ScriptsListEntry* entries = internal_realloc(gScriptsListEntries, sizeof(*entries) * gScriptsListEntriesLength);
|
||||
ScriptsListEntry* entries = (ScriptsListEntry*)internal_realloc(gScriptsListEntries, sizeof(*entries) * gScriptsListEntriesLength);
|
||||
if (entries == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -1647,7 +1647,7 @@ int scriptsLoadGameGlobalVars(File* stream)
|
||||
// 0x4A5448
|
||||
int scriptsSkipGameGlobalVars(File* stream)
|
||||
{
|
||||
int* vars = internal_malloc(sizeof(*vars) * gGameGlobalVarsLength);
|
||||
int* vars = (int*)internal_malloc(sizeof(*vars) * gGameGlobalVarsLength);
|
||||
if (vars == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -1945,7 +1945,7 @@ int scriptLoadAll(File* stream)
|
||||
scriptList->length++;
|
||||
}
|
||||
|
||||
ScriptListExtent* extent = internal_malloc(sizeof(*extent));
|
||||
ScriptListExtent* extent = (ScriptListExtent*)internal_malloc(sizeof(*extent));
|
||||
scriptList->head = extent;
|
||||
scriptList->tail = extent;
|
||||
if (extent == NULL) {
|
||||
@ -1969,7 +1969,7 @@ int scriptLoadAll(File* stream)
|
||||
|
||||
ScriptListExtent* prevExtent = extent;
|
||||
for (int extentIndex = 1; extentIndex < scriptList->length; extentIndex++) {
|
||||
ScriptListExtent* extent = internal_malloc(sizeof(*extent));
|
||||
ScriptListExtent* extent = (ScriptListExtent*)internal_malloc(sizeof(*extent));
|
||||
if (extent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -2061,7 +2061,7 @@ int scriptAdd(int* sidPtr, int scriptType)
|
||||
if (scriptList->head != NULL) {
|
||||
// There is at least one extent available, which means tail is also set.
|
||||
if (scriptListExtent->length == SCRIPT_LIST_EXTENT_SIZE) {
|
||||
ScriptListExtent* newExtent = scriptListExtent->next = internal_malloc(sizeof(*newExtent));
|
||||
ScriptListExtent* newExtent = scriptListExtent->next = (ScriptListExtent*)internal_malloc(sizeof(*newExtent));
|
||||
if (newExtent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -2076,7 +2076,7 @@ int scriptAdd(int* sidPtr, int scriptType)
|
||||
}
|
||||
} else {
|
||||
// Script head
|
||||
scriptListExtent = internal_malloc(sizeof(ScriptListExtent));
|
||||
scriptListExtent = (ScriptListExtent*)internal_malloc(sizeof(ScriptListExtent));
|
||||
if (scriptListExtent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -2141,7 +2141,7 @@ int scriptsRemoveLocalVars(Script* script)
|
||||
gMapLocalVars + (script->localVarsOffset + script->localVarsCount),
|
||||
sizeof(*gMapLocalVars) * (oldMapLocalVarsCount - script->localVarsCount - script->localVarsOffset));
|
||||
|
||||
gMapLocalVars = internal_realloc(gMapLocalVars, sizeof(*gMapLocalVars) * gMapLocalVarsLength);
|
||||
gMapLocalVars = (int*)internal_realloc(gMapLocalVars, sizeof(*gMapLocalVars) * gMapLocalVarsLength);
|
||||
if (gMapLocalVars == NULL) {
|
||||
debugPrint("\nError in mem_realloc in scr_remove_local_vars!\n");
|
||||
}
|
||||
@ -2525,7 +2525,7 @@ void scriptsExecMapUpdateScripts(int proc)
|
||||
return;
|
||||
}
|
||||
|
||||
int* sidList = internal_malloc(sizeof(*sidList) * sidListCapacity);
|
||||
int* sidList = (int*)internal_malloc(sizeof(*sidList) * sidListCapacity);
|
||||
if (sidList == NULL) {
|
||||
debugPrint("\nError: scr_exec_map_update_scripts: Out of memory for sidList!");
|
||||
return;
|
||||
@ -2772,7 +2772,7 @@ int _scr_explode_scenery(Object* a1, int tile, int radius, int elevation)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int* scriptIds = internal_malloc(sizeof(*scriptIds) * scriptExtentsCount * SCRIPT_LIST_EXTENT_SIZE);
|
||||
int* scriptIds = (int*)internal_malloc(sizeof(*scriptIds) * scriptExtentsCount * SCRIPT_LIST_EXTENT_SIZE);
|
||||
if (scriptIds == NULL) {
|
||||
return -1;
|
||||
}
|
@ -200,7 +200,7 @@ extern int _scrQueueTestValue;
|
||||
extern char* _err_str;
|
||||
extern char* _blank_str;
|
||||
|
||||
extern ScriptRequests gScriptsRequests;
|
||||
extern unsigned int gScriptsRequests;
|
||||
extern STRUCT_664980 stru_664958;
|
||||
extern STRUCT_664980 stru_664980;
|
||||
extern int gScriptsRequestedElevatorType;
|
||||
|
@ -150,7 +150,7 @@ int skilldexWindowInit()
|
||||
bool cycle = false;
|
||||
int buttonDataIndex;
|
||||
for (buttonDataIndex = 0; buttonDataIndex < SKILLDEX_SKILL_BUTTON_BUFFER_COUNT; buttonDataIndex++) {
|
||||
gSkilldexButtonsData[buttonDataIndex] = internal_malloc(gSkilldexFrmSizes[SKILLDEX_FRM_BUTTON_ON].height * gSkilldexFrmSizes[SKILLDEX_FRM_BUTTON_ON].width + 512);
|
||||
gSkilldexButtonsData[buttonDataIndex] = (unsigned char*)internal_malloc(gSkilldexFrmSizes[SKILLDEX_FRM_BUTTON_ON].height * gSkilldexFrmSizes[SKILLDEX_FRM_BUTTON_ON].width + 512);
|
||||
if (gSkilldexButtonsData[buttonDataIndex] == NULL) {
|
||||
break;
|
||||
}
|
@ -517,12 +517,12 @@ Sound* soundAllocate(int a1, int a2)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Sound* sound = gSoundMallocProc(sizeof(*sound));
|
||||
Sound* sound = (Sound*)gSoundMallocProc(sizeof(*sound));
|
||||
memset(sound, 0, sizeof(*sound));
|
||||
|
||||
memcpy(&(sound->io), &gSoundDefaultFileIO, sizeof(gSoundDefaultFileIO));
|
||||
|
||||
WAVEFORMATEX* wfxFormat = gSoundMallocProc(sizeof(*wfxFormat));
|
||||
WAVEFORMATEX* wfxFormat = (WAVEFORMATEX*)gSoundMallocProc(sizeof(*wfxFormat));
|
||||
memset(wfxFormat, 0, sizeof(*wfxFormat));
|
||||
|
||||
wfxFormat->wFormatTag = 1;
|
@ -52,7 +52,7 @@ typedef int SoundOpenProc(const char* filePath, int flags, ...);
|
||||
typedef int SoundCloseProc(int fileHandle);
|
||||
typedef int SoundReadProc(int fileHandle, void* buf, unsigned int size);
|
||||
typedef int SoundWriteProc(int fileHandle, const void* buf, unsigned int size);
|
||||
typedef int SoundSeekProc(int fileHandle, long offset, int origin);
|
||||
typedef long SoundSeekProc(int fileHandle, long offset, int origin);
|
||||
typedef long SoundTellProc(int fileHandle);
|
||||
typedef long SoundFileLengthProc(int fileHandle);
|
||||
|
||||
|
@ -77,7 +77,7 @@ bool soundDecoderPrepare(SoundDecoder* soundDecoder, SoundDecoderReadProc* readP
|
||||
soundDecoder->readProc = readProc;
|
||||
soundDecoder->fd = fileHandle;
|
||||
|
||||
soundDecoder->bufferIn = malloc(SOUND_DECODER_IN_BUFFER_SIZE);
|
||||
soundDecoder->bufferIn = (unsigned char*)malloc(SOUND_DECODER_IN_BUFFER_SIZE);
|
||||
if (soundDecoder->bufferIn == NULL) {
|
||||
return false;
|
||||
}
|
||||
@ -1100,7 +1100,7 @@ SoundDecoder* soundDecoderInit(SoundDecoderReadProc* readProc, int fileHandle, i
|
||||
int v20;
|
||||
int v73;
|
||||
|
||||
SoundDecoder* soundDecoder = malloc(sizeof(*soundDecoder));
|
||||
SoundDecoder* soundDecoder = (SoundDecoder*)malloc(sizeof(*soundDecoder));
|
||||
if (soundDecoder == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1172,7 +1172,7 @@ SoundDecoder* soundDecoderInit(SoundDecoderReadProc* readProc, int fileHandle, i
|
||||
soundDecoder->field_3C = soundDecoder->field_38 * soundDecoder->field_24;
|
||||
|
||||
if (v73 != 0) {
|
||||
soundDecoder->field_30 = malloc(sizeof(unsigned char*) * v73);
|
||||
soundDecoder->field_30 = (unsigned char*)malloc(sizeof(unsigned char*) * v73);
|
||||
if (soundDecoder->field_30 == NULL) {
|
||||
goto L66;
|
||||
}
|
||||
@ -1180,7 +1180,7 @@ SoundDecoder* soundDecoderInit(SoundDecoderReadProc* readProc, int fileHandle, i
|
||||
memset(soundDecoder->field_30, 0, sizeof(unsigned char*) * v73);
|
||||
}
|
||||
|
||||
soundDecoder->field_34 = malloc(sizeof(unsigned char*) * soundDecoder->field_2C);
|
||||
soundDecoder->field_34 = (unsigned char*)malloc(sizeof(unsigned char*) * soundDecoder->field_2C);
|
||||
if (soundDecoder->field_34 == NULL) {
|
||||
goto L66;
|
||||
}
|
||||
@ -1188,7 +1188,7 @@ SoundDecoder* soundDecoderInit(SoundDecoderReadProc* readProc, int fileHandle, i
|
||||
soundDecoder->field_50 = 0;
|
||||
|
||||
if (gSoundDecodersCount == 1) {
|
||||
_AudioDecoder_scale_tbl = malloc(0x20000);
|
||||
_AudioDecoder_scale_tbl = (unsigned char*)malloc(0x20000);
|
||||
_AudioDecoder_scale0 = _AudioDecoder_scale_tbl + 0x10000;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ int soundEffectsCacheInit(int cacheSize, const char* effectsPath)
|
||||
return -1;
|
||||
}
|
||||
|
||||
gSoundEffectsCache = internal_malloc(sizeof(*gSoundEffectsCache));
|
||||
gSoundEffectsCache = (Cache*)internal_malloc(sizeof(*gSoundEffectsCache));
|
||||
if (gSoundEffectsCache == NULL) {
|
||||
soundEffectsCacheFreeHandles();
|
||||
soundEffectsListExit();
|
||||
@ -235,7 +235,7 @@ int soundEffectsCacheFileWrite(int handle, const void* buf, unsigned int size)
|
||||
}
|
||||
|
||||
// 0x4A9358
|
||||
int soundEffectsCacheFileSeek(int handle, long offset, int origin)
|
||||
long soundEffectsCacheFileSeek(int handle, long offset, int origin)
|
||||
{
|
||||
if (!soundEffectsIsValidHandle(handle)) {
|
||||
return -1;
|
||||
@ -349,7 +349,7 @@ void soundEffectsCacheFreeImpl(void* ptr)
|
||||
// 0x4A94D4
|
||||
int soundEffectsCacheCreateHandles()
|
||||
{
|
||||
gSoundEffects = internal_malloc(sizeof(*gSoundEffects) * SOUND_EFFECTS_MAX_COUNT);
|
||||
gSoundEffects = (SoundEffect*)internal_malloc(sizeof(*gSoundEffects) * SOUND_EFFECTS_MAX_COUNT);
|
||||
if (gSoundEffects == NULL) {
|
||||
return -1;
|
||||
}
|
||||
@ -409,7 +409,7 @@ int soundEffectsCreate(int* handlePtr, int tag, void* data, CacheEntry* cacheHan
|
||||
soundEffect->position = 0;
|
||||
soundEffect->dataPosition = 0;
|
||||
|
||||
soundEffect->data = data;
|
||||
soundEffect->data = (unsigned char*)data;
|
||||
|
||||
*handlePtr = index;
|
||||
|
@ -43,7 +43,7 @@ int soundEffectsCacheFileOpen(const char* fname, int mode, ...);
|
||||
int soundEffectsCacheFileClose(int handle);
|
||||
int soundEffectsCacheFileRead(int handle, void* buf, unsigned int size);
|
||||
int soundEffectsCacheFileWrite(int handle, const void* buf, unsigned int size);
|
||||
int soundEffectsCacheFileSeek(int handle, long offset, int origin);
|
||||
long soundEffectsCacheFileSeek(int handle, long offset, int origin);
|
||||
long soundEffectsCacheFileTell(int handle);
|
||||
long soundEffectsCacheFileLength(int handle);
|
||||
int soundEffectsCacheGetFileSizeImpl(int tag, int* sizePtr);
|
||||
|
@ -76,7 +76,7 @@ int soundEffectsListInit(const char* soundEffectsPath, int a2, int debugLevel)
|
||||
fileReadString(path, 255, stream);
|
||||
gSoundEffectsListEntriesLength = atoi(path);
|
||||
|
||||
gSoundEffectsListEntries = internal_malloc(sizeof(*gSoundEffectsListEntries) * gSoundEffectsListEntriesLength);
|
||||
gSoundEffectsListEntries = (SoundEffectsListEntry*)internal_malloc(sizeof(*gSoundEffectsListEntries) * gSoundEffectsListEntriesLength);
|
||||
for (int index = 0; index < gSoundEffectsListEntriesLength; index++) {
|
||||
SoundEffectsListEntry* entry = &(gSoundEffectsListEntries[index]);
|
||||
|
||||
@ -171,7 +171,7 @@ int soundEffectsListGetTag(char* name, int* tagPtr)
|
||||
SoundEffectsListEntry dummy;
|
||||
dummy.name = name + gSoundEffectsListPathLength;
|
||||
|
||||
SoundEffectsListEntry* entry = bsearch(&dummy, gSoundEffectsListEntries, gSoundEffectsListEntriesLength, sizeof(*gSoundEffectsListEntries), soundEffectsListCompareByName);
|
||||
SoundEffectsListEntry* entry = (SoundEffectsListEntry*)bsearch(&dummy, gSoundEffectsListEntries, gSoundEffectsListEntriesLength, sizeof(*gSoundEffectsListEntries), soundEffectsListCompareByName);
|
||||
if (entry == NULL) {
|
||||
return SFXL_ERR;
|
||||
}
|
||||
@ -198,7 +198,7 @@ int soundEffectsListGetFilePath(int tag, char** pathPtr)
|
||||
|
||||
char* name = gSoundEffectsListEntries[index].name;
|
||||
|
||||
char* path = internal_malloc(strlen(gSoundEffectsListPath) + strlen(name) + 1);
|
||||
char* path = (char*)internal_malloc(strlen(gSoundEffectsListPath) + strlen(name) + 1);
|
||||
if (path == NULL) {
|
||||
return SFXL_ERR;
|
||||
}
|
||||
@ -305,7 +305,7 @@ int soundEffectsListPopulateFileNames()
|
||||
return SFXL_ERR;
|
||||
}
|
||||
|
||||
char* pattern = internal_malloc(strlen(gSoundEffectsListPath) + strlen(extension) + 1);
|
||||
char* pattern = (char*)internal_malloc(strlen(gSoundEffectsListPath) + strlen(extension) + 1);
|
||||
if (pattern == NULL) {
|
||||
return SFXL_ERR;
|
||||
}
|
||||
@ -326,7 +326,7 @@ int soundEffectsListPopulateFileNames()
|
||||
return SFXL_ERR;
|
||||
}
|
||||
|
||||
gSoundEffectsListEntries = internal_malloc(sizeof(*gSoundEffectsListEntries) * gSoundEffectsListEntriesLength);
|
||||
gSoundEffectsListEntries = (SoundEffectsListEntry*)internal_malloc(sizeof(*gSoundEffectsListEntries) * gSoundEffectsListEntriesLength);
|
||||
if (gSoundEffectsListEntries == NULL) {
|
||||
fileNameListFree(&fileNameList, 0);
|
||||
return SFXL_ERR;
|
||||
@ -366,7 +366,7 @@ int soundEffectsListCopyFileNames(char** fileNameList)
|
||||
int soundEffectsListPopulateFileSizes()
|
||||
{
|
||||
|
||||
char* path = internal_malloc(gSoundEffectsListPathLength + 13);
|
||||
char* path = (char*)internal_malloc(gSoundEffectsListPathLength + 13);
|
||||
if (path == NULL) {
|
||||
return SFXL_ERR;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user