Reconcile worldmap.cc

This commit is contained in:
Alexander Batalov 2022-09-15 11:42:02 +03:00
parent d7bc8e4176
commit e5992779f3
15 changed files with 1825 additions and 1974 deletions

View File

@ -4542,7 +4542,7 @@ static int characterPrintToFile(const char* fileName)
// SFALL // SFALL
for (int index = 0; index < gCustomTownReputationEntries.size(); index++) { for (int index = 0; index < gCustomTownReputationEntries.size(); index++) {
const TownReputationEntry* pair = &(gCustomTownReputationEntries[index]); const TownReputationEntry* pair = &(gCustomTownReputationEntries[index]);
if (_wmAreaIsKnown(pair->city)) { if (wmAreaIsKnown(pair->city)) {
if (!hasTownReputationHeading) { if (!hasTownReputationHeading) {
fileWriteString("\n", stream); fileWriteString("\n", stream);
@ -4552,7 +4552,7 @@ static int characterPrintToFile(const char* fileName)
hasTownReputationHeading = true; hasTownReputationHeading = true;
} }
_wmGetAreaIdxName(pair->city, title2); wmGetAreaIdxName(pair->city, title2);
int townReputation = gGameGlobalVars[pair->gvar]; int townReputation = gGameGlobalVars[pair->gvar];
@ -5531,7 +5531,7 @@ static void characterEditorDrawKarmaFolder()
// SFALL // SFALL
for (int index = 0; index < gCustomTownReputationEntries.size(); index++) { for (int index = 0; index < gCustomTownReputationEntries.size(); index++) {
const TownReputationEntry* pair = &(gCustomTownReputationEntries[index]); const TownReputationEntry* pair = &(gCustomTownReputationEntries[index]);
if (_wmAreaIsKnown(pair->city)) { if (wmAreaIsKnown(pair->city)) {
if (!hasTownReputationHeading) { if (!hasTownReputationHeading) {
msg = getmsg(&gCharacterEditorMessageList, &gCharacterEditorMessageListItem, 4000); msg = getmsg(&gCharacterEditorMessageList, &gCharacterEditorMessageListItem, 4000);
if (characterEditorFolderViewDrawHeading(msg)) { if (characterEditorFolderViewDrawHeading(msg)) {
@ -5544,7 +5544,7 @@ static void characterEditorDrawKarmaFolder()
} }
char cityShortName[40]; char cityShortName[40];
_wmGetAreaIdxName(pair->city, cityShortName); wmGetAreaIdxName(pair->city, cityShortName);
int townReputation = gGameGlobalVars[pair->gvar]; int townReputation = gGameGlobalVars[pair->gvar];

View File

@ -1303,7 +1303,7 @@ int _critter_set_who_hit_me(Object* a1, Object* a2)
bool _critter_can_obj_dude_rest() bool _critter_can_obj_dude_rest()
{ {
bool v1 = false; bool v1 = false;
if (!_wmMapCanRestHere(gElevation)) { if (!wmMapCanRestHere(gElevation)) {
v1 = true; v1 = true;
} }

View File

@ -1158,13 +1158,13 @@ static int endgameDeathEndingValidate(int* percentage)
} }
if (deathEnding->worldAreaKnown != -1) { if (deathEnding->worldAreaKnown != -1) {
if (!_wmAreaIsKnown(deathEnding->worldAreaKnown)) { if (!wmAreaIsKnown(deathEnding->worldAreaKnown)) {
continue; continue;
} }
} }
if (deathEnding->worldAreaNotKnown != -1) { if (deathEnding->worldAreaNotKnown != -1) {
if (_wmAreaIsKnown(deathEnding->worldAreaNotKnown)) { if (wmAreaIsKnown(deathEnding->worldAreaNotKnown)) {
continue; continue;
} }
} }

View File

@ -268,7 +268,7 @@ int gameInitWithOptions(const char* windowTitle, bool isMapper, int font, int a4
debugPrint(">scr_game_init\t"); debugPrint(">scr_game_init\t");
if (worldmapInit() != 0) { if (wmWorldMap_init() != 0) {
debugPrint("Failed on wmWorldMap_init\n"); debugPrint("Failed on wmWorldMap_init\n");
return -1; return -1;
} }
@ -376,7 +376,7 @@ void gameReset()
_scr_reset(); _scr_reset();
gameLoadGlobalVars(); gameLoadGlobalVars();
scriptsReset(); scriptsReset();
worldmapReset(); wmWorldMap_reset();
partyMembersReset(); partyMembersReset();
characterEditorInit(); characterEditorInit();
pipboyReset(); pipboyReset();
@ -425,7 +425,7 @@ void gameExit()
badwordsExit(); badwordsExit();
automapExit(); automapExit();
paletteExit(); paletteExit();
worldmapExit(); wmWorldMap_exit();
partyMembersExit(); partyMembersExit();
endgameDeathEndingExit(); endgameDeathEndingExit();
interfaceFontsExit(); interfaceFontsExit();

View File

@ -2105,8 +2105,8 @@ int ambientSoundEffectEventProcess(Object* a1, void* data)
if (soundEffectEvent != NULL) { if (soundEffectEvent != NULL) {
ambientSoundEffectIndex = soundEffectEvent->ambientSoundEffectIndex; ambientSoundEffectIndex = soundEffectEvent->ambientSoundEffectIndex;
} else { } else {
if (ambientSoundEffectGetLength() > 0) { if (wmSfxMaxCount() > 0) {
ambientSoundEffectIndex = ambientSoundEffectGetRandom(); ambientSoundEffectIndex = wmSfxRollNextIdx();
} }
} }
@ -2120,8 +2120,8 @@ int ambientSoundEffectEventProcess(Object* a1, void* data)
} }
int delay = 10 * randomBetween(15, 20); int delay = 10 * randomBetween(15, 20);
if (ambientSoundEffectGetLength() > 0) { if (wmSfxMaxCount() > 0) {
nextSoundEffectEvent->ambientSoundEffectIndex = ambientSoundEffectGetRandom(); nextSoundEffectEvent->ambientSoundEffectIndex = wmSfxRollNextIdx();
if (queueAddEvent(delay, NULL, nextSoundEffectEvent, EVENT_TYPE_GSOUND_SFX_EVENT) == -1) { if (queueAddEvent(delay, NULL, nextSoundEffectEvent, EVENT_TYPE_GSOUND_SFX_EVENT) == -1) {
return -1; return -1;
} }
@ -2133,7 +2133,7 @@ int ambientSoundEffectEventProcess(Object* a1, void* data)
if (ambientSoundEffectIndex != -1) { if (ambientSoundEffectIndex != -1) {
char* fileName; char* fileName;
if (ambientSoundEffectGetName(ambientSoundEffectIndex, &fileName) == 0) { if (wmSfxIdxName(ambientSoundEffectIndex, &fileName) == 0) {
int v7 = _get_bk_time(); int v7 = _get_bk_time();
if (getTicksBetween(v7, _lastTime_1) >= 5000) { if (getTicksBetween(v7, _lastTime_1) >= 5000) {
if (soundPlayFile(fileName) == -1) { if (soundPlayFile(fileName) == -1) {

View File

@ -799,13 +799,13 @@ static void opMarkAreaKnown(Program* program)
// TODO: Provide meaningful names. // TODO: Provide meaningful names.
if (data[2] == 0) { if (data[2] == 0) {
if (data[0] == CITY_STATE_INVISIBLE) { if (data[0] == CITY_STATE_INVISIBLE) {
_wmAreaSetVisibleState(data[1], 0, 1); wmAreaSetVisibleState(data[1], 0, 1);
} else { } else {
_wmAreaSetVisibleState(data[1], 1, 1); wmAreaSetVisibleState(data[1], 1, 1);
_wmAreaMarkVisitedState(data[1], data[0]); wmAreaMarkVisitedState(data[1], data[0]);
} }
} else if (data[2] == 1) { } else if (data[2] == 1) {
_wmMapMarkVisited(data[1]); wmMapMarkVisited(data[1]);
} }
} }
@ -2031,12 +2031,12 @@ static void opMetarule3(Program* program)
result.integerValue = killsGetByType(param1.integerValue); result.integerValue = killsGetByType(param1.integerValue);
break; break;
case METARULE3_MARK_MAP_ENTRANCE: case METARULE3_MARK_MAP_ENTRANCE:
result.integerValue = _wmMapMarkMapEntranceState(param1.integerValue, param2.integerValue, param3.integerValue); result.integerValue = wmMapMarkMapEntranceState(param1.integerValue, param2.integerValue, param3.integerValue);
break; break;
case METARULE3_WM_SUBTILE_STATE: case METARULE3_WM_SUBTILE_STATE:
if (1) { if (1) {
int state; int state;
if (_wmSubTileGetVisitedState(param1.integerValue, param2.integerValue, &state) == 0) { if (wmSubTileGetVisitedState(param1.integerValue, param2.integerValue, &state) == 0) {
result.integerValue = state; result.integerValue = state;
} }
} }
@ -2090,7 +2090,7 @@ static void opMetarule3(Program* program)
result.integerValue = aiGetChemUse(static_cast<Object*>(param1.pointerValue)); result.integerValue = aiGetChemUse(static_cast<Object*>(param1.pointerValue));
break; break;
case METARULE3_110: case METARULE3_110:
result.integerValue = carIsEmpty() ? 1 : 0; result.integerValue = wmCarIsOutOfGas() ? 1 : 0;
break; break;
case METARULE3_111: case METARULE3_111:
result.integerValue = _map_target_load_area(); result.integerValue = _map_target_load_area();
@ -2108,7 +2108,7 @@ static void opSetMapMusic(Program* program)
int mapIndex = programStackPopInteger(program); int mapIndex = programStackPopInteger(program);
debugPrint("\nset_map_music: %d, %s", mapIndex, string); debugPrint("\nset_map_music: %d, %s", mapIndex, string);
worldmapSetMapMusic(mapIndex, string); wmSetMapMusic(mapIndex, string);
} }
// NOTE: Function name is a bit misleading. Last parameter is a boolean value // NOTE: Function name is a bit misleading. Last parameter is a boolean value
@ -2184,7 +2184,7 @@ static void opLoadMap(Program* program)
if (mapName != NULL) { if (mapName != NULL) {
gGameGlobalVars[GVAR_LOAD_MAP_INDEX] = param; gGameGlobalVars[GVAR_LOAD_MAP_INDEX] = param;
mapIndex = mapGetIndexByFileName(mapName); mapIndex = wmMapMatchNameToIdx(mapName);
} else { } else {
if (mapIndexOrName.integerValue >= 0) { if (mapIndexOrName.integerValue >= 0) {
gGameGlobalVars[GVAR_LOAD_MAP_INDEX] = param; gGameGlobalVars[GVAR_LOAD_MAP_INDEX] = param;
@ -2210,7 +2210,7 @@ static void opWorldmapCitySetPos(Program* program)
int x = programStackPopInteger(program); int x = programStackPopInteger(program);
int city = programStackPopInteger(program); int city = programStackPopInteger(program);
if (worldmapCitySetPos(city, x, y) == -1) { if (wmAreaSetWorldPos(city, x, y) == -1) {
scriptPredefinedError(program, "wm_area_set_pos", SCRIPT_ERROR_FOLLOWS); scriptPredefinedError(program, "wm_area_set_pos", SCRIPT_ERROR_FOLLOWS);
debugPrint("Invalid Parameter!"); debugPrint("Invalid Parameter!");
} }
@ -3210,25 +3210,25 @@ static void opMetarule(Program* program)
result = _getPartyMemberCount(); result = _getPartyMemberCount();
break; break;
case METARULE_AREA_KNOWN: case METARULE_AREA_KNOWN:
result = _wmAreaVisitedState(param.integerValue); result = wmAreaVisitedState(param.integerValue);
break; break;
case METARULE_WHO_ON_DRUGS: case METARULE_WHO_ON_DRUGS:
result = queueHasEvent(static_cast<Object*>(param.pointerValue), EVENT_TYPE_DRUG); result = queueHasEvent(static_cast<Object*>(param.pointerValue), EVENT_TYPE_DRUG);
break; break;
case METARULE_MAP_KNOWN: case METARULE_MAP_KNOWN:
result = _wmMapIsKnown(param.integerValue); result = wmMapIsKnown(param.integerValue);
break; break;
case METARULE_IS_LOADGAME: case METARULE_IS_LOADGAME:
result = _isLoadingGame(); result = _isLoadingGame();
break; break;
case METARULE_CAR_CURRENT_TOWN: case METARULE_CAR_CURRENT_TOWN:
result = carGetCity(); result = wmCarCurrentArea();
break; break;
case METARULE_GIVE_CAR_TO_PARTY: case METARULE_GIVE_CAR_TO_PARTY:
result = _wmCarGiveToParty(); result = wmCarGiveToParty();
break; break;
case METARULE_GIVE_CAR_GAS: case METARULE_GIVE_CAR_GAS:
result = carAddFuel(param.integerValue); result = wmCarFillGas(param.integerValue);
break; break;
case METARULE_SKILL_CHECK_TAG: case METARULE_SKILL_CHECK_TAG:
result = skillIsTagged(param.integerValue); result = skillIsTagged(param.integerValue);
@ -3268,13 +3268,13 @@ static void opMetarule(Program* program)
} }
break; break;
case METARULE_GET_WORLDMAP_XPOS: case METARULE_GET_WORLDMAP_XPOS:
_wmGetPartyWorldPos(&result, NULL); wmGetPartyWorldPos(&result, NULL);
break; break;
case METARULE_GET_WORLDMAP_YPOS: case METARULE_GET_WORLDMAP_YPOS:
_wmGetPartyWorldPos(NULL, &result); wmGetPartyWorldPos(NULL, &result);
break; break;
case METARULE_CURRENT_TOWN: case METARULE_CURRENT_TOWN:
if (_wmGetPartyCurArea(&result) == -1) { if (wmGetPartyCurArea(&result) == -1) {
debugPrint("\nIntextra: Error: metarule: current_town"); debugPrint("\nIntextra: Error: metarule: current_town");
} }
break; break;

View File

@ -216,7 +216,7 @@ static SaveGameHandler* _master_save_list[LOAD_SAVE_HANDLER_COUNT] = {
automapSave, automapSave,
preferencesSave, preferencesSave,
characterEditorSave, characterEditorSave,
worldmapSave, wmWorldMap_save,
pipboySave, pipboySave,
gameMoviesSave, gameMoviesSave,
skillsUsageSave, skillsUsageSave,
@ -247,7 +247,7 @@ static LoadGameHandler* _master_load_list[LOAD_SAVE_HANDLER_COUNT] = {
automapLoad, automapLoad,
preferencesLoad, preferencesLoad,
characterEditorLoad, characterEditorLoad,
worldmapLoad, wmWorldMap_load,
pipboyLoad, pipboyLoad,
gameMoviesLoad, gameMoviesLoad,
skillsUsageLoad, skillsUsageLoad,
@ -2217,7 +2217,7 @@ static int _PrepLoad(File* stream)
// 0x47F4C8 // 0x47F4C8
static int _EndLoad(File* stream) static int _EndLoad(File* stream)
{ {
worldmapStartMapMusic(); wmMapMusicStart();
dudeSetName(_LSData[_slot_cursor].character_name); dudeSetName(_LSData[_slot_cursor].character_name);
interfaceBarRefresh(); interfaceBarRefresh();
indicatorBarRefresh(); indicatorBarRefresh();

View File

@ -401,7 +401,7 @@ static int _main_load_new(char* mapFileName)
gameMouseSetCursor(MOUSE_CURSOR_NONE); gameMouseSetCursor(MOUSE_CURSOR_NONE);
mouseShowCursor(); mouseShowCursor();
mapLoadByName(mapFileName); mapLoadByName(mapFileName);
worldmapStartMapMusic(); wmMapMusicStart();
paletteFadeTo(gPaletteWhite); paletteFadeTo(gPaletteWhite);
windowDestroy(win); windowDestroy(win);
colorPaletteLoad("color.pal"); colorPaletteLoad("color.pal");

View File

@ -367,7 +367,7 @@ int mapSetElevation(int elevation)
} }
if (elevation != gElevation) { if (elevation != gElevation) {
_wmMapMarkMapEntranceState(gMapHeader.field_34, elevation, 1); wmMapMarkMapEntranceState(gMapHeader.field_34, elevation, 1);
} }
gElevation = elevation; gElevation = elevation;
@ -465,7 +465,7 @@ void mapSetStart(int tile, int elevation, int rotation)
// 0x4824CC // 0x4824CC
char* mapGetName(int map, int elevation) char* mapGetName(int map, int elevation)
{ {
if (map < 0 || map >= mapGetCount()) { if (map < 0 || map >= wmMapMaxCount()) {
return NULL; return NULL;
} }
@ -482,29 +482,29 @@ char* mapGetName(int map, int elevation)
// 0x482528 // 0x482528
bool _is_map_idx_same(int map1, int map2) bool _is_map_idx_same(int map1, int map2)
{ {
if (map1 < 0 || map1 >= mapGetCount()) { if (map1 < 0 || map1 >= wmMapMaxCount()) {
return 0; return 0;
} }
if (map2 < 0 || map2 >= mapGetCount()) { if (map2 < 0 || map2 >= wmMapMaxCount()) {
return 0; return 0;
} }
if (!_wmMapIdxIsSaveable(map1)) { if (!wmMapIdxIsSaveable(map1)) {
return 0; return 0;
} }
if (!_wmMapIdxIsSaveable(map2)) { if (!wmMapIdxIsSaveable(map2)) {
return 0; return 0;
} }
int city1; int city1;
if (_wmMatchAreaContainingMapIdx(map1, &city1) == -1) { if (wmMatchAreaContainingMapIdx(map1, &city1) == -1) {
return 0; return 0;
} }
int city2; int city2;
if (_wmMatchAreaContainingMapIdx(map2, &city2) == -1) { if (wmMatchAreaContainingMapIdx(map2, &city2) == -1) {
return 0; return 0;
} }
@ -515,12 +515,12 @@ bool _is_map_idx_same(int map1, int map2)
int _get_map_idx_same(int map1, int map2) int _get_map_idx_same(int map1, int map2)
{ {
int city1 = -1; int city1 = -1;
if (_wmMatchAreaContainingMapIdx(map1, &city1) == -1) { if (wmMatchAreaContainingMapIdx(map1, &city1) == -1) {
return -1; return -1;
} }
int city2 = -2; int city2 = -2;
if (_wmMatchAreaContainingMapIdx(map2, &city2) == -1) { if (wmMatchAreaContainingMapIdx(map2, &city2) == -1) {
return -1; return -1;
} }
@ -535,7 +535,7 @@ int _get_map_idx_same(int map1, int map2)
char* mapGetCityName(int map) char* mapGetCityName(int map)
{ {
int city; int city;
if (_wmMatchAreaContainingMapIdx(map, &city) == -1) { if (wmMatchAreaContainingMapIdx(map, &city) == -1) {
return _aErrorF2; return _aErrorF2;
} }
@ -548,8 +548,8 @@ char* mapGetCityName(int map)
char* _map_get_description_idx_(int map) char* _map_get_description_idx_(int map)
{ {
int city; int city;
if (_wmMatchAreaContainingMapIdx(map, &city) == 0) { if (wmMatchAreaContainingMapIdx(map, &city) == 0) {
_wmGetAreaIdxName(city, _scratchStr); wmGetAreaIdxName(city, _scratchStr);
} else { } else {
strcpy(_scratchStr, _errMapName); strcpy(_scratchStr, _errMapName);
} }
@ -739,7 +739,7 @@ int mapLoadByName(char* fileName)
if (stream != NULL) { if (stream != NULL) {
fileClose(stream); fileClose(stream);
rc = mapLoadSaved(fileName); rc = mapLoadSaved(fileName);
worldmapStartMapMusic(); wmMapMusicStart();
} }
} }
@ -766,7 +766,7 @@ int mapLoadById(int map)
scriptSetFixedParam(gMapSid, map); scriptSetFixedParam(gMapSid, map);
char name[16]; char name[16];
if (mapGetFileName(map, name) == -1) { if (wmMapIdxToName(map, name) == -1) {
return -1; return -1;
} }
@ -774,7 +774,7 @@ int mapLoadById(int map)
int rc = mapLoadByName(name); int rc = mapLoadByName(name);
worldmapStartMapMusic(); wmMapMusicStart();
return rc; return rc;
} }
@ -898,7 +898,7 @@ static int mapLoad(File* stream)
lightSetLightLevel(LIGHT_LEVEL_MAX, false); lightSetLightLevel(LIGHT_LEVEL_MAX, false);
objectSetLocation(gDude, gCenterTile, gElevation, NULL); objectSetLocation(gDude, gCenterTile, gElevation, NULL);
objectSetRotation(gDude, gEnteringRotation, NULL); objectSetRotation(gDude, gEnteringRotation, NULL);
gMapHeader.field_34 = mapGetIndexByFileName(gMapHeader.name); gMapHeader.field_34 = wmMapMatchNameToIdx(gMapHeader.name);
if ((gMapHeader.flags & 1) == 0) { if ((gMapHeader.flags & 1) == 0) {
char path[COMPAT_MAX_PATH]; char path[COMPAT_MAX_PATH];
@ -946,7 +946,7 @@ static int mapLoad(File* stream)
_scr_spatials_enable(); _scr_spatials_enable();
error = "Error Setting up random encounter"; error = "Error Setting up random encounter";
if (worldmapSetupRandomEncounter() == -1) { if (wmSetupRandomEncounter() == -1) {
goto err; goto err;
} }
} }
@ -996,10 +996,10 @@ err:
rc = -1; rc = -1;
} }
_wmMapMarkVisited(gMapHeader.field_34); wmMapMarkVisited(gMapHeader.field_34);
_wmMapMarkMapEntranceState(gMapHeader.field_34, gElevation, 1); wmMapMarkMapEntranceState(gMapHeader.field_34, gElevation, 1);
if (_wmCheckGameAreaEvents() != 0) { if (wmCheckGameAreaEvents() != 0) {
rc = -1; rc = -1;
} }
@ -1043,7 +1043,7 @@ int mapLoadSaved(char* fileName)
} }
} }
if (!_wmMapIsSaveable()) { if (!wmMapIsSaveable()) {
debugPrint("\nDestroying RANDOM encounter map."); debugPrint("\nDestroying RANDOM encounter map.");
char v15[16]; char v15[16];
@ -1062,7 +1062,7 @@ int mapLoadSaved(char* fileName)
// 0x48328C // 0x48328C
static int _map_age_dead_critters() static int _map_age_dead_critters()
{ {
if (!_wmMapDeadBodiesAge()) { if (!wmMapDeadBodiesAge()) {
return 0; return 0;
} }
@ -1175,7 +1175,7 @@ static int _map_age_dead_critters()
int _map_target_load_area() int _map_target_load_area()
{ {
int city = -1; int city = -1;
if (_wmMatchAreaContainingMapIdx(gMapHeader.field_34, &city) == -1) { if (wmMatchAreaContainingMapIdx(gMapHeader.field_34, &city) == -1) {
city = -1; city = -1;
} }
return city; return city;
@ -1215,13 +1215,13 @@ int mapHandleTransition()
if (gMapTransition.map == -1) { if (gMapTransition.map == -1) {
if (!isInCombat()) { if (!isInCombat()) {
animationStop(); animationStop();
_wmTownMap(); wmTownMap();
memset(&gMapTransition, 0, sizeof(gMapTransition)); memset(&gMapTransition, 0, sizeof(gMapTransition));
} }
} else if (gMapTransition.map == -2) { } else if (gMapTransition.map == -2) {
if (!isInCombat()) { if (!isInCombat()) {
animationStop(); animationStop();
_wmWorldMap(); wmWorldMap();
memset(&gMapTransition, 0, sizeof(gMapTransition)); memset(&gMapTransition, 0, sizeof(gMapTransition));
} }
} else { } else {
@ -1245,8 +1245,8 @@ int mapHandleTransition()
memset(&gMapTransition, 0, sizeof(gMapTransition)); memset(&gMapTransition, 0, sizeof(gMapTransition));
int city; int city;
_wmMatchAreaContainingMapIdx(gMapHeader.field_34, &city); wmMatchAreaContainingMapIdx(gMapHeader.field_34, &city);
if (_wmTeleportToArea(city) == -1) { if (wmTeleportToArea(city) == -1) {
debugPrint("\nError: couldn't make jump on worldmap for map jump!"); debugPrint("\nError: couldn't make jump on worldmap for map jump!");
} }
} }
@ -1425,7 +1425,7 @@ int _map_save_in_game(bool a1)
char name[16]; char name[16];
if (a1 && !_wmMapIsSaveable()) { if (a1 && !wmMapIsSaveable()) {
debugPrint("\nNot saving RANDOM encounter map."); debugPrint("\nNot saving RANDOM encounter map.");
strcpy(name, gMapHeader.name); strcpy(name, gMapHeader.name);

View File

@ -1484,7 +1484,7 @@ int objectSetLocation(Object* obj, int tile, int elevation, Rect* rect)
transition.rotation = data->misc.rotation; transition.rotation = data->misc.rotation;
mapSetTransition(&transition); mapSetTransition(&transition);
_wmMapMarkMapEntranceState(transition.map, transition.elevation, 1); wmMapMarkMapEntranceState(transition.map, transition.elevation, 1);
} }
} }
} }

View File

@ -401,7 +401,7 @@ static int gPipboyPrevTab;
// 0x497004 // 0x497004
int pipboyOpen(int intent) int pipboyOpen(int intent)
{ {
if (!_wmMapPipboyActive()) { if (!wmMapPipboyActive()) {
// You aren't wearing the pipboy! // You aren't wearing the pipboy!
const char* text = getmsg(&gMiscMessageList, &gPipboyMessageListItem, 7000); const char* text = getmsg(&gMiscMessageList, &gPipboyMessageListItem, 7000);
showDialogBox(text, NULL, 0, 192, 135, _colorTable[32328], NULL, _colorTable[32328], 1); showDialogBox(text, NULL, 0, 192, 135, _colorTable[32328], NULL, _colorTable[32328], 1);
@ -1504,7 +1504,7 @@ static int _PrintAMelevList(int a1)
} }
} }
int mapCount = mapGetCount(); int mapCount = wmMapMaxCount();
for (int map = 0; map < mapCount; map++) { for (int map = 0; map < mapCount; map++) {
if (map == _amcty_indx) { if (map == _amcty_indx) {
continue; continue;
@ -1579,7 +1579,7 @@ static int _PrintAMList(int a1)
int count = 0; int count = 0;
int index = 0; int index = 0;
int mapCount = mapGetCount(); int mapCount = wmMapMaxCount();
for (int map = 0; map < mapCount; map++) { for (int map = 0; map < mapCount; map++) {
int elevation; int elevation;
for (elevation = 0; elevation < ELEVATION_COUNT; elevation++) { for (elevation = 0; elevation < ELEVATION_COUNT; elevation++) {

View File

@ -473,7 +473,7 @@ int _obj_examine_func(Object* critter, Object* target, void (*fn)(char* string))
} }
if (car != 0) { if (car != 0) {
sprintf(formattedText, carMessageListItem.text, 100 * carGetFuel() / 80000); sprintf(formattedText, carMessageListItem.text, 100 * wmCarGasAmount() / 80000);
} else { } else {
strcpy(formattedText, carMessageListItem.text); strcpy(formattedText, carMessageListItem.text);
} }
@ -954,12 +954,12 @@ static int _obj_use_power_on_car(Object* item)
// SFALL: Fix for cells getting consumed even when the car is already fully // SFALL: Fix for cells getting consumed even when the car is already fully
// charged. // charged.
int rc; int rc;
if (carGetFuel() < CAR_FUEL_MAX) { if (wmCarGasAmount() < CAR_FUEL_MAX) {
int energy = ammoGetQuantity(item) * energyDensity; int energy = ammoGetQuantity(item) * energyDensity;
int capacity = ammoGetCapacity(item); int capacity = ammoGetCapacity(item);
// NOTE: that function will never return -1 // NOTE: that function will never return -1
if (carAddFuel(energy / capacity) == -1) { if (wmCarFillGas(energy / capacity) == -1) {
return -1; return -1;
} }
@ -1520,7 +1520,7 @@ static int useLadderDown(Object* a1, Object* ladder, int a3)
mapSetTransition(&transition); mapSetTransition(&transition);
_wmMapMarkMapEntranceState(transition.map, elevation, 1); wmMapMarkMapEntranceState(transition.map, elevation, 1);
} else { } else {
Rect updatedRect; Rect updatedRect;
if (objectSetLocation(a1, tile, elevation, &updatedRect) == -1) { if (objectSetLocation(a1, tile, elevation, &updatedRect) == -1) {
@ -1554,7 +1554,7 @@ static int useLadderUp(Object* a1, Object* ladder, int a3)
mapSetTransition(&transition); mapSetTransition(&transition);
_wmMapMarkMapEntranceState(transition.map, elevation, 1); wmMapMarkMapEntranceState(transition.map, elevation, 1);
} else { } else {
Rect updatedRect; Rect updatedRect;
if (objectSetLocation(a1, tile, elevation, &updatedRect) == -1) { if (objectSetLocation(a1, tile, elevation, &updatedRect) == -1) {
@ -1588,7 +1588,7 @@ static int useStairs(Object* a1, Object* stairs, int a3)
mapSetTransition(&transition); mapSetTransition(&transition);
_wmMapMarkMapEntranceState(transition.map, elevation, 1); wmMapMarkMapEntranceState(transition.map, elevation, 1);
} else { } else {
Rect updatedRect; Rect updatedRect;
if (objectSetLocation(a1, tile, elevation, &updatedRect) == -1) { if (objectSetLocation(a1, tile, elevation, &updatedRect) == -1) {
@ -2241,13 +2241,13 @@ int _objPMAttemptPlacement(Object* obj, int tile, int elevation)
int v9 = tile; int v9 = tile;
int v7 = 0; int v7 = 0;
if (!_wmEvalTileNumForPlacement(tile)) { if (!wmEvalTileNumForPlacement(tile)) {
v9 = gDude->tile; v9 = gDude->tile;
for (int v4 = 1; v4 <= 100; v4++) { for (int v4 = 1; v4 <= 100; v4++) {
// TODO: Check. // TODO: Check.
v7++; v7++;
v9 = tileGetTileInDirection(v9, v7 % ROTATION_COUNT, 1); v9 = tileGetTileInDirection(v9, v7 % ROTATION_COUNT, 1);
if (_wmEvalTileNumForPlacement(v9) != 0) { if (wmEvalTileNumForPlacement(v9) != 0) {
break; break;
} }

View File

@ -443,9 +443,9 @@ int _scriptsCheckGameEvents(int* moviePtr, int window)
movie = MOVIE_ARTIMER4; movie = MOVIE_ARTIMER4;
if (!gameMovieIsSeen(MOVIE_ARTIMER4)) { if (!gameMovieIsSeen(MOVIE_ARTIMER4)) {
adjustRep = true; adjustRep = true;
_wmAreaSetVisibleState(CITY_ARROYO, 0, 1); wmAreaSetVisibleState(CITY_ARROYO, 0, 1);
_wmAreaSetVisibleState(CITY_DESTROYED_ARROYO, 1, 1); wmAreaSetVisibleState(CITY_DESTROYED_ARROYO, 1, 1);
_wmAreaMarkVisitedState(CITY_DESTROYED_ARROYO, 2); wmAreaMarkVisitedState(CITY_DESTROYED_ARROYO, 2);
} }
} else if (day >= 270 && gameGetGlobalVar(GVAR_FALLOUT_2) != 3) { } else if (day >= 270 && gameGetGlobalVar(GVAR_FALLOUT_2) != 3) {
adjustRep = true; adjustRep = true;
@ -907,12 +907,12 @@ int scriptsHandleRequests()
if ((gScriptsRequests & SCRIPT_REQUEST_0x02) != 0) { if ((gScriptsRequests & SCRIPT_REQUEST_0x02) != 0) {
gScriptsRequests &= ~SCRIPT_REQUEST_0x02; gScriptsRequests &= ~SCRIPT_REQUEST_0x02;
_wmTownMap(); wmTownMap();
} }
if ((gScriptsRequests & SCRIPT_REQUEST_WORLD_MAP) != 0) { if ((gScriptsRequests & SCRIPT_REQUEST_WORLD_MAP) != 0) {
gScriptsRequests &= ~SCRIPT_REQUEST_WORLD_MAP; gScriptsRequests &= ~SCRIPT_REQUEST_WORLD_MAP;
_wmWorldMap(); wmWorldMap();
} }
if ((gScriptsRequests & SCRIPT_REQUEST_ELEVATOR) != 0) { if ((gScriptsRequests & SCRIPT_REQUEST_ELEVATOR) != 0) {

File diff suppressed because it is too large Load Diff

View File

@ -227,48 +227,52 @@ typedef enum Map {
MAP_IN_GAME_MOVIE1 = 149, MAP_IN_GAME_MOVIE1 = 149,
} Map; } Map;
int worldmapInit(); extern unsigned char* circleBlendTable;
void worldmapExit();
int worldmapReset(); int wmWorldMap_init();
int worldmapSave(File* stream); void wmWorldMap_exit();
int worldmapLoad(File* stream); int wmWorldMap_reset();
int mapGetCount(); int wmWorldMap_save(File* stream);
int mapGetFileName(int map_index, char* dest); int wmWorldMap_load(File* stream);
int mapGetIndexByFileName(char* name); int wmMapMaxCount();
bool _wmMapIdxIsSaveable(int map_index); int wmMapIdxToName(int mapIdx, char* dest);
bool _wmMapIsSaveable(); int wmMapMatchNameToIdx(char* name);
bool _wmMapDeadBodiesAge(); bool wmMapIdxIsSaveable(int mapIdx);
bool _wmMapCanRestHere(int elevation); bool wmMapIsSaveable();
bool _wmMapPipboyActive(); bool wmMapDeadBodiesAge();
int _wmMapMarkVisited(int map_index); bool wmMapCanRestHere(int elevation);
int _wmMapMarkMapEntranceState(int a1, int a2, int a3); bool wmMapPipboyActive();
void _wmWorldMap(); int wmMapMarkVisited(int mapIdx);
int _wmCheckGameAreaEvents(); int wmMapMarkMapEntranceState(int mapIdx, int elevation, int state);
int worldmapSetupRandomEncounter(); void wmWorldMap();
bool _wmEvalTileNumForPlacement(int tile); int wmCheckGameAreaEvents();
int wmSetupRandomEncounter();
bool wmEvalTileNumForPlacement(int tile);
int wmSubTileMarkRadiusVisited(int x, int y, int radius); int wmSubTileMarkRadiusVisited(int x, int y, int radius);
int _wmSubTileGetVisitedState(int a1, int a2, int* a3); int wmSubTileGetVisitedState(int x, int y, int* statePtr);
int _wmGetAreaIdxName(int index, char* name); int wmGetAreaIdxName(int areaIdx, char* name);
bool _wmAreaIsKnown(int city_index); bool wmAreaIsKnown(int areaIdx);
int _wmAreaVisitedState(int a1); int wmAreaVisitedState(int areaIdx);
bool _wmMapIsKnown(int map_index); bool wmMapIsKnown(int mapIdx);
bool _wmAreaMarkVisitedState(int a1, int a2); int wmAreaMarkVisited(int areaIdx);
bool _wmAreaSetVisibleState(int a1, int a2, int a3); bool wmAreaMarkVisitedState(int areaIdx, int state);
int worldmapCitySetPos(int index, int x, int y); bool wmAreaSetVisibleState(int areaIdx, int state, bool force);
int _wmGetPartyWorldPos(int* out_x, int* out_y); int wmAreaSetWorldPos(int areaIdx, int x, int y);
int _wmGetPartyCurArea(int* a1); int wmGetPartyWorldPos(int* xPtr, int* yPtr);
void _wmTownMap(); int wmGetPartyCurArea(int* areaIdxPtr);
int carAddFuel(int a1); void wmTownMap();
int carGetFuel(); int wmCarUseGas(int amount);
bool carIsEmpty(); int wmCarFillGas(int amount);
int carGetCity(); int wmCarGasAmount();
int _wmCarGiveToParty(); bool wmCarIsOutOfGas();
int ambientSoundEffectGetLength(); int wmCarCurrentArea();
int ambientSoundEffectGetRandom(); int wmCarGiveToParty();
int ambientSoundEffectGetName(int ambientSoundEffectIndex, char** namePtr); int wmSfxMaxCount();
int worldmapStartMapMusic(); int wmSfxRollNextIdx();
int worldmapSetMapMusic(int a1, const char* name); int wmSfxIdxName(int sfxIdx, char** namePtr);
int _wmMatchAreaContainingMapIdx(int map_index, int* out_city_index); int wmMapMusicStart();
int _wmTeleportToArea(int a1); int wmSetMapMusic(int mapIdx, const char* name);
int wmMatchAreaContainingMapIdx(int mapIdx, int* areaIdxPtr);
int wmTeleportToArea(int areaIdx);
#endif /* WORLD_MAP_H */ #endif /* WORLD_MAP_H */