Compare commits

..
Author SHA1 Message Date
Mike Klaas 46376960d9 WIP Et tu working-ish 2026-05-04 21:43:45 -07:00
153 changed files with 4142 additions and 10249 deletions
+4 -81
View File
@@ -38,9 +38,7 @@ endif()
# Git Info
include("cmake/gitver.cmake")
# Shared engine sources — used by both game and mapper targets.
# Excludes main.cc/main.h (game-only entry logic).
set(FALLOUT_ENGINE_SOURCES
target_sources(${EXECUTABLE_NAME} PUBLIC
"src/actions.cc"
"src/actions.h"
"src/animation.cc"
@@ -156,6 +154,8 @@ set(FALLOUT_ENGINE_SOURCES
"src/lips.h"
"src/loadsave.cc"
"src/loadsave.h"
"src/main.cc"
"src/main.h"
"src/mainmenu.cc"
"src/mainmenu.h"
"src/map_defs.h"
@@ -205,8 +205,6 @@ set(FALLOUT_ENGINE_SOURCES
"src/proto_types.h"
"src/proto.cc"
"src/proto.h"
"src/prototype_options.cc"
"src/prototype_options.h"
"src/queue.cc"
"src/queue.h"
"src/random.cc"
@@ -270,7 +268,7 @@ set(FALLOUT_ENGINE_SOURCES
"src/xfile.h"
)
set(FALLOUT_PLATFORM_SOURCES
target_sources(${EXECUTABLE_NAME} PUBLIC
"src/audio_engine.cc"
"src/audio_engine.h"
"src/delay.cc"
@@ -318,14 +316,6 @@ set(FALLOUT_PLATFORM_SOURCES
"third_party/lodepng/lodepng.cpp"
)
target_sources(${EXECUTABLE_NAME} PUBLIC
${FALLOUT_ENGINE_SOURCES}
"src/main.cc"
"src/main.h"
)
target_sources(${EXECUTABLE_NAME} PUBLIC ${FALLOUT_PLATFORM_SOURCES})
target_include_directories(${EXECUTABLE_NAME} PUBLIC "third_party/lodepng")
set(FALLOUT_HAVE_STB_VORBIS OFF)
@@ -571,73 +561,6 @@ if((NOT ANDROID) AND (NOT IOS) AND (NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten"))
endif()
endif()
if((NOT ANDROID) AND (NOT IOS) AND (NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten"))
if(WIN32)
add_executable(mapper-ce WIN32)
else()
add_executable(mapper-ce)
endif()
target_sources(mapper-ce PUBLIC
${FALLOUT_ENGINE_SOURCES}
${FALLOUT_PLATFORM_SOURCES}
"src/mapper/map_func.cc"
"src/mapper/map_func.h"
"src/mapper/mapper.cc"
"src/mapper/mapper.h"
"src/mapper/mp_instance.cc"
"src/mapper/mp_instance.h"
"src/mapper/mp_proto.cc"
"src/mapper/mp_proto.h"
"src/mapper/mp_scrpt.cc"
"src/mapper/mp_scrpt.h"
"src/mapper/mp_targt.cc"
"src/mapper/mp_targt.h"
"src/mapper/mp_text.cc"
"src/mapper/mp_text.h"
)
target_compile_definitions(mapper-ce PUBLIC FALLOUT_MAPPER)
if(WIN32)
target_compile_definitions(mapper-ce PUBLIC
_CRT_SECURE_NO_WARNINGS
_CRT_NONSTDC_NO_WARNINGS
NOMINMAX
WIN32_LEAN_AND_MEAN
_STATIC_CPPLIB
)
target_link_libraries(mapper-ce
winmm
debug libcpmtd
optimized libcpmt
)
target_sources(mapper-ce PUBLIC
"os/windows/fallout2-ce.rc"
)
endif()
if(APPLE)
target_link_libraries(mapper-ce "-framework CoreFoundation")
set_target_properties(mapper-ce PROPERTIES
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO"
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
)
endif()
target_include_directories(mapper-ce PUBLIC "third_party/lodepng")
target_include_directories(mapper-ce PRIVATE "src")
target_include_directories(mapper-ce PRIVATE ${ZLIB_INCLUDE_DIRS})
target_include_directories(mapper-ce PRIVATE ${SDL2_INCLUDE_DIRS})
target_link_libraries(mapper-ce
fpattern::fpattern
fpattern_windows::fpattern_windows
${ZLIB_LIBRARIES}
${SDL2_LIBRARIES}
)
endif()
if(APPLE)
if(IOS)
install(TARGETS ${EXECUTABLE_NAME} DESTINATION "Payload")
+5 -5
View File
@@ -72,7 +72,7 @@ See [`https://sfall-team.github.io/sfall/`](https://sfall-team.github.io/sfall/)
| INI settings | get_ini_setting<br>get_ini_string<br>get_ini_section<br>get_ini_sections<br>get_ini_config<br>get_ini_config_db<br>set_ini_setting | âś… except get_ini_config, get_ini_config_db | `modified_ini` is intentionally omitted as deprecated. |
| Objects and scripts | set_self<br>set_dude_obj<br>real_dude_obj<br>remove_script<br>get/set_script<br>obj_is_carrying_obj<br>loot_obj<br>dialog_obj<br>obj_under_cursor<br>get/set_object_data<br>get/set_flags<br>set_unique_id<br>set_scr_name<br>obj_is_openable<br>get/set_proto_data<br>get_object_ai_data | implemented: set_self, get/set/remove_script, obj_is_carrying_obj, loot_obj, dialog_obj, obj_under_cursor, get_object_data, get_flags, set_flags, obj_is_openable, get_proto_data, set_proto_data | - |
| Other / Game management | set_movie_path<br>stop/resume_game<br>mark_movie_played<br>game_loaded<br>get_game_mode<br>get_uptime<br>signal_close_game | implemented: game_loaded, get_game_mode, get_uptime, signal_close_game | - |
| Gameplay tweaks | set_pickpocket_max<br>set_hit_chance_max<br>set_xp_mod<br>set_critter_hit_chance_mod<br>set_base_hit_chance_mod<br>set_hp_per_level_mod<br>gdialog_get_barter_mod<br>get/set_unspent_ap_bonus<br>get/set_unspent_ap_perk_bonus<br>set_base_pickpocket_mod<br>set_critter_pickpocket_mod<br>get/set_inven_ap_cost<br>set_drugs_data<br>get_kill_counter<br>mod_kill_counter<br>set_pipboy_available | implemented: gdialog_get_barter_mod, get/set_unspent_ap{_perk}_bonus, get/set_inven_ap_cost | - |
| Gameplay tweaks | set_pickpocket_max<br>set_hit_chance_max<br>set_xp_mod<br>set_critter_hit_chance_mod<br>set_base_hit_chance_mod<br>set_hp_per_level_mod<br>gdialog_get_barter_mod<br>get/set_unspent_ap_bonus<br>get/<br>set_base_pickpocket_mod<br>set_critter_pickpocket_mod<br>get/set_inven_ap_cost<br>set_drugs_data<br>get_kill_counter<br>mod_kill_counter<br>set_pipboy_available | implemented: gdialog_get_barter_mod | - |
| NPCs | inc_npc_level<br>get_npc_level<br>npc_engine_level_up | not implemented | - |
| Other | get_year<br>set_dm/df_model<br>active_hand<br>toggle_active_hand<br>get/set_viewport_x/y<br>hero_select_win<br>get_light_level<br>message_str_game<br>sneak_success<br>create_spatial<br>unwield_slot<br>add_g_timer_event<br>add_extra_msg_file<br>get_metarule_table<br>metarule_exist<br>remove_timer_event<br>spatial_radius | implemented: get_year, active_hand, toggle_active_hand, get_light_level, message_str_game, add_extra_msg_file, metarule_exist | `input_funcs_available`, `nb_create_char` are deprecated in sfall and intentionally absent in CE. `add_extra_msg_file` does not support the explicit `fileNumber` form in CE. |
@@ -98,11 +98,11 @@ See [`https://sfall-team.github.io/sfall/`](https://sfall-team.github.io/sfall/)
| KeyPress | `HOOK_KEYPRESS` | âś… | Third hook arg is currently `0`; CE doesn't use VK codes. |
| MouseClick | `HOOK_MOUSECLICK` | âś… | - |
| UseSkill | `HOOK_USESKILL` | đźš« | - |
| Steal | `HOOK_STEAL` | âś… | - |
| Steal | `HOOK_STEAL` | đźš« | Et tu |
| WithinPerception | `HOOK_WITHINPERCEPTION` | âś… | - |
| InventoryMove | `HOOK_INVENTORYMOVE` | âś… | - |
| InvenWield | `HOOK_INVENWIELD` | âś… | - |
| AdjustFID | `HOOK_ADJUSTFID` | âś… | Second hook arg currently matches the first because CE has no internal FID modifiers like Hero Appearance. |
| InvenWield | `HOOK_INVENWIELD` | đźš« | - |
| AdjustFID | `HOOK_ADJUSTFID` | đźš« | - |
| CombatTurn | `HOOK_COMBATTURN` | âś… | - |
| StdProcedure | `HOOK_STDPROCEDURE` | âś… | - |
| StdProcedureEnd | `HOOK_STDPROCEDURE_END` | âś… | - |
@@ -124,5 +124,5 @@ See [`https://sfall-team.github.io/sfall/`](https://sfall-team.github.io/sfall/)
| AdjustRads | `HOOK_ADJUSTRADS` | đźš« | (maybe) |
| RollCheck | `HOOK_ROLLCHECK` | đźš« | - |
| BestWeapon | `HOOK_BESTWEAPON` | đźš« | - |
| CanUseWeapon | `HOOK_CANUSEWEAPON` | âś… | - |
| CanUseWeapon | `HOOK_CANUSEWEAPON` | đźš« | - |
| BuildSfxWeapon | `HOOK_BUILDSFXWEAPON` | đźš« | - |
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

-6
View File
@@ -22,10 +22,6 @@ save_text_maps=0
show_pid_numbers=0
sort_script_list=0
use_art_not_protos=0
; Allows to load a certain map right away after loading the mapper.
map=denbus2
; Allows to disable grid item picker and use a simpler list-based picker.
use_grid_item_picker=1
[preferences]
brightness=1.000000
@@ -98,8 +94,6 @@ auto_quick_save=3
display_bonus_damage=1
;Set to 1 to get notification of karma changes in the notification window
display_karma_changes=0
;Set to 1 to use the hi-res dialog border/background at resolutions above 640x480. Requires art\intrface\HR_ALLTLK.FRM (for example from f2_res.dat)
dialog_border=1
;Set to one to hide areas outside map bounds when using higher than 640x480 resolution, and to zero to disable
enable_high_resolution_stencil=1
;Set to 1 to extend the action points bar to show up to 16 AP instead of 10 (requires iface_apbar_e.frm)
-83
View File
@@ -1,83 +0,0 @@
#include "sfall.h"
#include "dik.h"
#include "lib.arrays.h"
variable steal_mode := 0;
procedure steal_mode_name(variable mode) begin
if (mode == 1) then return "force_success";
if (mode == 2) then return "caught_fail";
if (mode == 3) then return "silent_fail";
if (mode == 4) then return "xp_override";
return "vanilla";
end
procedure steal_handler begin
variable
args := get_sfall_args,
thief := args[0],
target := args[1],
item := args[2],
is_planting := args[3],
quantity := args[4],
thief_name := "<null>",
target_name := "<null>",
item_name := "<null>";
if (thief) then thief_name := obj_name(thief);
if (target) then target_name := obj_name(target);
if (item) then item_name := obj_name(item);
display_msg(string_format6("steal mode=%s thief=%s target=%s item=%s planting=%d qty=%d",
steal_mode_name(steal_mode),
thief_name,
target_name,
item_name,
is_planting,
quantity));
display_msg(string_format1("steal args=%s", debug_array_str(args)));
if (thief != dude_obj) then return;
if (steal_mode == 1) then begin
display_msg("steal forcing success");
display_msg(sprintf(mstr_skill(571 + is_planting * 2), item_name));
set_sfall_return(1);
end else if (steal_mode == 2) then begin
display_msg("steal forcing caught failure");
display_msg(sprintf(mstr_skill(570 + is_planting * 2), item_name));
set_sfall_return(0);
end else if (steal_mode == 3) then begin
display_msg("steal forcing silent failure");
set_sfall_return(2);
end else if (steal_mode == 4) then begin
display_msg("steal forcing success with xp override 77");
display_msg(sprintf(mstr_skill(571 + is_planting * 2), item_name));
set_sfall_return(1);
set_sfall_return(77);
end
end
procedure keypress_handler begin
variable
pressed := get_sfall_arg_at(0),
key := get_sfall_arg_at(1);
if (not pressed) then return;
if (key != DIK_X) then return;
steal_mode += 1;
if (steal_mode > 4) then steal_mode := 0;
display_msg(string_format1("steal mode -> %s", steal_mode_name(steal_mode)));
end
procedure start begin
if (not game_loaded) then return;
display_msg("steal manual test ready: press X to cycle vanilla / force_success / caught_fail / silent_fail / xp_override");
display_msg("open a steal screen and move an item in either direction; mode 4 should award 77 XP for a successful action");
register_hook_proc(HOOK_KEYPRESS, keypress_handler);
register_hook_proc(HOOK_STEAL, steal_handler);
end
+5 -5
View File
@@ -46,13 +46,13 @@ typedef enum ScienceRepairTargetType {
SCIENCE_REPAIR_TARGET_TYPE_ANYONE,
} ScienceRepairTargetType;
// 0x5106D0 action_in_explode
// 0x5106D0
static bool _action_in_explode = false;
// 0x5106D4 rotation
// 0x5106D4
int rotation;
// 0x5106E0 death_2
// 0x5106E0
static const int gNormalDeathAnimations[DAMAGE_TYPE_COUNT] = {
ANIM_DANCING_AUTOFIRE,
ANIM_SLICED_IN_HALF,
@@ -63,7 +63,7 @@ static const int gNormalDeathAnimations[DAMAGE_TYPE_COUNT] = {
ANIM_BIG_HOLE,
};
// 0x5106FC death_3
// 0x5106FC
static const int gMaximumBloodDeathAnimations[DAMAGE_TYPE_COUNT] = {
ANIM_CHUNKS_OF_FLESH,
ANIM_SLICED_IN_HALF,
@@ -519,7 +519,7 @@ int _show_death(Object* obj, int anim)
// Animates damage to extras in a given attack (secondary targets).
//
// 0x410FEC show_damage_extras
// 0x410FEC _show_damage_extras
int showDamageToExtras(Attack* attack)
{
for (int index = 0; index < attack->extrasLength; index++) {
+11 -11
View File
@@ -309,39 +309,39 @@ static unsigned int animationComputeTicksPerFrame(Object* object, int fid);
static void reportOverloaded(Object* critter);
// 0x510718 curr_sad
// 0x510718
static int gAnimationCurrentSad = 0;
// 0x51071C curr_anim_set
// 0x51071C
static int gAnimationSequenceCurrentIndex = -1;
// 0x510720 anim_in_init
// 0x510720
static bool gAnimationInInit = false;
// 0x510724 anim_in_anim_stop
// 0x510724
static bool gAnimationInStop = false;
// 0x510728 anim_in_bk
// 0x510728
static bool _anim_in_bk = false;
// 0x530014 sad
// 0x530014
static AnimationSad gAnimationSads[ANIMATION_SAD_LIST_CAPACITY];
#define PATH_NODE_CAPACITY 10000
// 0x542FD4 dad
// 0x542FD4
static PathNode gClosedPathNodeList[PATH_NODE_CAPACITY];
// 0x54CC14 anim_set
// 0x54CC14
static AnimationSequence gAnimationSequences[32];
// 0x561814 seen_tile
// 0x561814
static unsigned char gPathfinderProcessedTiles[5000];
// 0x562B9C child_path
// 0x562B9C
static PathNode gOpenPathNodeList[PATH_NODE_CAPACITY];
// 0x56C7DC curr_anim_counter
// 0x56C7DC
static int gAnimationDescriptionCurrentIndex;
// anim_init
+47 -224
View File
@@ -1,9 +1,6 @@
#include "art.h"
#include <lodepng.h>
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -16,6 +13,7 @@
#include "memory.h"
#include "proto.h"
#include "settings.h"
#include "sfall_config.h"
#include <algorithm>
#include <memory>
@@ -47,19 +45,19 @@ static int artReadHeader(Art* art, File* stream);
static int artGetDataSize(const Art* art);
static int paddingForSize(int size);
// 0x5002D8 str2
// 0x5002D8
static char gDefaultJumpsuitMaleFileName[] = "hmjmps";
// 0x05002E0 aHfjmps
// 0x05002E0
static char gDefaultJumpsuitFemaleFileName[] = "hfjmps";
// 0x5002E8 aHmwarr
// 0x5002E8
static char gDefaultTribalMaleFileName[] = "hmwarr";
// 0x5002F0 aHfprim
// 0x5002F0
static char gDefaultTribalFemaleFileName[] = "hfprim";
// 0x510738 art
// 0x510738
static ArtListDescription gArtListDescriptions[OBJ_TYPE_COUNT] = {
{ 0, "items", nullptr, nullptr, 0 },
{ 0, "critters", nullptr, nullptr, 0 },
@@ -77,18 +75,18 @@ static ArtListDescription gArtListDescriptions[OBJ_TYPE_COUNT] = {
// This flag denotes that localized arts should be looked up first. Used
// together with [gArtLanguage].
//
// 0x510898 darn_foreigners
// 0x510898
static bool gArtLanguageInitialized = false;
// 0x51089C head1
// 0x51089C
static const char* _head1 = "gggnnnbbbgnb";
// 0x5108A0 head2
// 0x5108A0
static const char* _head2 = "vfngfbnfvppp";
// Current native look base fid.
//
// 0x5108A4 art_vault_guy_num
// 0x5108A4
int _art_vault_guy_num = 0;
// Base fids for unarmored dude.
@@ -102,42 +100,41 @@ int _art_vault_guy_num = 0;
// been accessed differently in 0x49F984, which clearly uses look type as an
// index, not gender.
//
// 0x5108A8 art_vault_person_nums
// 0x5108A8
int _art_vault_person_nums[DUDE_NATIVE_LOOK_COUNT][GENDER_COUNT];
// Index of "grid001.frm" in tiles.lst.
//
// 0x5108B8 art_mapper_blank_tile
// 0x5108B8
static int _art_mapper_blank_tile = 1;
// Non-english language name.
//
// This value is used as a directory name to display localized arts.
//
// 0x56C970 darn_foreign_sub_path
// 0x56C970
static char gArtLanguage[32];
// 0x56C990 art_cache
// 0x56C990
Cache gArtCache;
// 0x56C9E4 art_name
// 0x56C9E4
static char _art_name[COMPAT_MAX_PATH];
// head_info
// 0x56CAE8 head_info
// 0x56CAE8
static HeadDescription* gHeadDescriptions;
// anon_alias
// 0x56CAEC anon_alias
// 0x56CAEC
static int* _anon_alias;
// artCritterFidShouldRunData
// 0x56CAF0 artCritterFidShouldRunData
// 0x56CAF0
static int* gArtCritterFidShoudRunData;
static std::unordered_map<std::string, std::shared_ptr<NamedCacheEntry>> gNamedArtCache;
constexpr int kNamedCacheMaxBytes = 32 * 1024 * 1024; // 32MB soft limit
constexpr size_t kMaxNamedPngPixels = 16 * 1024 * 1024;
static unsigned int gNamedArtCacheMruCounter = 0;
static int gNamedArtCacheCurrentBytes = 0;
@@ -203,16 +200,32 @@ int artInit()
// SFALL: Modify player model settings.
char* jumpsuitMaleFileName = nullptr;
configGetString(&gContentConfig, CONTENT_CONFIG_START_SECTION, "model_male_default", &jumpsuitMaleFileName, gDefaultJumpsuitMaleFileName);
if (!configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, "MaleDefaultModel", &jumpsuitMaleFileName, nullptr)
|| jumpsuitMaleFileName == nullptr
|| jumpsuitMaleFileName[0] == '\0') {
configGetString(&gContentConfig, CONTENT_CONFIG_START_SECTION, "model_male_default", &jumpsuitMaleFileName, gDefaultJumpsuitMaleFileName);
}
char* jumpsuitFemaleFileName = nullptr;
configGetString(&gContentConfig, CONTENT_CONFIG_START_SECTION, "model_female_default", &jumpsuitFemaleFileName, gDefaultJumpsuitFemaleFileName);
if (!configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, "FemaleDefaultModel", &jumpsuitFemaleFileName, nullptr)
|| jumpsuitFemaleFileName == nullptr
|| jumpsuitFemaleFileName[0] == '\0') {
configGetString(&gContentConfig, CONTENT_CONFIG_START_SECTION, "model_female_default", &jumpsuitFemaleFileName, gDefaultJumpsuitFemaleFileName);
}
char* tribalMaleFileName = nullptr;
configGetString(&gContentConfig, CONTENT_CONFIG_START_SECTION, "model_male", &tribalMaleFileName, gDefaultTribalMaleFileName);
if (!configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, "MaleStartModel", &tribalMaleFileName, nullptr)
|| tribalMaleFileName == nullptr
|| tribalMaleFileName[0] == '\0') {
configGetString(&gContentConfig, CONTENT_CONFIG_START_SECTION, "model_male", &tribalMaleFileName, gDefaultTribalMaleFileName);
}
char* tribalFemaleFileName = nullptr;
configGetString(&gContentConfig, CONTENT_CONFIG_START_SECTION, "model_female", &tribalFemaleFileName, gDefaultTribalFemaleFileName);
if (!configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, "FemaleStartModel", &tribalFemaleFileName, nullptr)
|| tribalFemaleFileName == nullptr
|| tribalFemaleFileName[0] == '\0') {
configGetString(&gContentConfig, CONTENT_CONFIG_START_SECTION, "model_female", &tribalFemaleFileName, gDefaultTribalFemaleFileName);
}
char* critterFileNames = gArtListDescriptions[OBJ_TYPE_CRITTER].fileNames;
for (int critterIndex = 0; critterIndex < gArtListDescriptions[OBJ_TYPE_CRITTER].fileNamesLength; critterIndex++) {
@@ -359,14 +372,6 @@ int artIsObjectTypeHidden(int objectType)
return objectType >= OBJ_TYPE_ITEM && objectType < OBJ_TYPE_COUNT ? gArtListDescriptions[objectType].flags & 1 : 0;
}
// 0x409DF0
void artToggleObjectTypeHidden(int objectType)
{
if (objectType >= 0 && objectType < OBJ_TYPE_COUNT) {
gArtListDescriptions[objectType].flags ^= 1;
}
}
// 0x418F7C
int artGetFidgetCount(int headFid)
{
@@ -456,40 +461,6 @@ int art_list_str(int fid, char* name)
return -1;
}
int artListIndex(int objectType, const char* name)
{
if (objectType < 0 || objectType >= OBJ_TYPE_COUNT) return -1;
if (gArtListDescriptions[objectType].fileNames == nullptr) return -1;
char upperName[13] = { 0 };
strncpy(upperName, name, 12);
upperName[12] = '\0';
compat_strupr(upperName);
int length = gArtListDescriptions[objectType].fileNamesLength;
const char* fileNames = gArtListDescriptions[objectType].fileNames;
for (int index = 0; index < length; index++) {
const char* entry = fileNames + index * 13;
char upperEntry[13];
strncpy(upperEntry, entry, 12);
upperEntry[12] = '\0';
compat_strupr(upperEntry);
char* p = upperEntry;
while (*p && ((*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9') || *p == '_'))
p++;
*p = '\0';
if (strcmp(upperEntry, upperName) == 0) {
return index;
}
}
return -1;
}
// 0x419160
Art* artLock(int fid, CacheEntry** handlePtr)
{
@@ -1120,7 +1091,7 @@ static int artReadFrameData(unsigned char* data, File* stream, int count, int* p
// 0x419E1C
static int artReadHeader(Art* art, File* stream)
{
if (fileReadInt32(stream, &(art->version)) == -1) return -1;
if (fileReadInt32(stream, &(art->field_0)) == -1) return -1;
if (fileReadInt16(stream, &(art->framesPerSecond)) == -1) return -1;
if (fileReadInt16(stream, &(art->actionFrame)) == -1) return -1;
if (fileReadInt16(stream, &(art->frameCount)) == -1) return -1;
@@ -1137,137 +1108,13 @@ static int artReadHeader(Art* art, File* stream)
return 0;
}
static bool artPathHasExtension(const char* path, const char* extension)
{
size_t pathLength = strlen(path);
size_t extensionLength = strlen(extension);
if (pathLength < extensionLength) {
return false;
}
return compat_stricmp(path + pathLength - extensionLength, extension) == 0;
}
static bool artReadFile(const char* path, std::vector<unsigned char>& data)
{
int size = 0;
if (dbGetFileSize(path, &size) != 0 || size <= 0) {
return false;
}
data.resize(size);
return dbGetFileContents(path, data.data()) == 0;
}
static bool artUnpackIndexedPngPixels(const std::vector<unsigned char>& indexedData, unsigned width, unsigned height, unsigned bitdepth, unsigned char* output)
{
size_t pixelCount = static_cast<size_t>(width) * static_cast<size_t>(height);
if (bitdepth == 8) {
if (indexedData.size() < pixelCount) {
return false;
}
memcpy(output, indexedData.data(), pixelCount);
return true;
}
unsigned char mask = static_cast<unsigned char>((1 << bitdepth) - 1);
size_t neededBytes = (pixelCount * bitdepth + 7) / 8;
if (indexedData.size() < neededBytes) {
return false;
}
for (size_t index = 0; index < pixelCount; index++) {
size_t bitOffset = index * bitdepth;
unsigned char byte = indexedData[bitOffset / 8];
unsigned shift = 8 - bitdepth - static_cast<unsigned>(bitOffset % 8);
output[index] = (byte >> shift) & mask;
}
return true;
}
static Art* artLoadIndexedPng(const char* path)
{
std::vector<unsigned char> encoded;
if (!artReadFile(path, encoded)) {
return nullptr;
}
lodepng::State state;
state.decoder.color_convert = 0;
std::vector<unsigned char> indexedData;
unsigned width = 0;
unsigned height = 0;
unsigned error = lodepng::decode(indexedData, width, height, state, encoded);
if (error != 0) {
debugPrint("ART: failed to decode indexed PNG %s: %s\n", path, lodepng_error_text(error));
return nullptr;
}
if (state.info_png.color.colortype != LCT_PALETTE) {
debugPrint("ART: PNG is not palette-indexed: %s\n", path);
return nullptr;
}
if (lodepng_has_palette_alpha(&state.info_png.color)) {
debugPrint("ART: indexed PNG transparency is unsupported, reserve palette index 0 instead: %s\n", path);
return nullptr;
}
size_t pixelCount = static_cast<size_t>(width) * static_cast<size_t>(height);
if (width == 0 || height == 0 || width > SHRT_MAX || height > SHRT_MAX) {
debugPrint("ART: invalid indexed PNG dimensions for %s: %ux%u\n", path, width, height);
return nullptr;
}
if (pixelCount > kMaxNamedPngPixels || pixelCount > INT_MAX) {
debugPrint("ART: indexed PNG is too large: %s\n", path);
return nullptr;
}
Art header = {};
header.version = 4;
header.framesPerSecond = 10;
header.actionFrame = 0;
header.frameCount = 1;
header.dataSize = sizeof(ArtFrame) + static_cast<int>(pixelCount);
int currentPadding = paddingForSize(sizeof(Art));
for (int rotation = 0; rotation < ROTATION_COUNT; rotation++) {
header.dataOffsets[rotation] = 0;
header.padding[rotation] = currentPadding;
}
int dataSize = artGetDataSize(&header);
unsigned char* data = reinterpret_cast<unsigned char*>(internal_malloc(dataSize));
if (data == nullptr) {
return nullptr;
}
memset(data, 0, dataSize);
Art* art = reinterpret_cast<Art*>(data);
*art = header;
ArtFrame* frame = reinterpret_cast<ArtFrame*>(data + sizeof(Art) + art->padding[0]);
frame->width = static_cast<short>(width);
frame->height = static_cast<short>(height);
frame->size = static_cast<int>(pixelCount);
frame->x = 0;
frame->y = 0;
if (!artUnpackIndexedPngPixels(indexedData, width, height, state.info_png.color.bitdepth, reinterpret_cast<unsigned char*>(frame) + sizeof(ArtFrame))) {
debugPrint("ART: failed to read indexed PNG pixels: %s\n", path);
internal_free(data);
return nullptr;
}
return art;
}
static Art* artLoadFrm(const char* path)
// NOTE: Original function was slightly different, but never used. Basically
// it's a memory allocating variant of `artRead` (which reads data into given
// buffer). This function is useful to load custom `frm` files since `Art` now
// needs more memory then it's on-disk size (due to memory padding).
//
// 0x419EC0
Art* artLoad(const char* path)
{
File* stream = fileOpen(path, "rb");
if (stream == nullptr) {
@@ -1295,30 +1142,6 @@ static Art* artLoadFrm(const char* path)
return reinterpret_cast<Art*>(data);
}
// NOTE: Original function was slightly different, but never used. Basically
// it's a memory allocating variant of `artRead` (which reads data into given
// buffer). This function is useful to load custom `frm` files since `Art` now
// needs more memory then it's on-disk size (due to memory padding).
//
// 0x419EC0
Art* artLoad(const char* path)
{
if (path == nullptr) {
return nullptr;
}
if (artPathHasExtension(path, ".png")) {
return artLoadIndexedPng(path);
}
Art* art = artLoadFrm(path);
if (art != nullptr) {
return art;
}
return nullptr;
}
static Art* artLoadLocalized(const char* path)
{
const char* localizedPath;
@@ -1391,7 +1214,7 @@ int artWriteFrameData(unsigned char* data, File* stream, int count)
// 0x41A138
int artWriteHeader(Art* art, File* stream)
{
if (fileWriteInt32(stream, art->version) == -1) return -1;
if (fileWriteInt32(stream, art->field_0) == -1) return -1;
if (fileWriteInt16(stream, art->framesPerSecond) == -1) return -1;
if (fileWriteInt16(stream, art->actionFrame) == -1) return -1;
if (fileWriteInt16(stream, art->frameCount) == -1) return -1;
+1 -3
View File
@@ -69,7 +69,7 @@ typedef enum Background {
} Background;
typedef struct Art {
int version;
int field_0;
short framesPerSecond;
short actionFrame;
short frameCount;
@@ -122,7 +122,6 @@ void artReset();
void artExit();
char* artGetObjectTypeName(int objectType);
int artIsObjectTypeHidden(int objectType);
void artToggleObjectTypeHidden(int objectType);
int artGetFidgetCount(int headFid);
void artRender(int fid, unsigned char* dest, int width, int height, int pitch);
int art_list_str(int fid, char* name);
@@ -151,7 +150,6 @@ int _art_alias_num(int index);
int artCritterFidShouldRun(int fid);
int artAliasFid(int fid);
int buildFid(int objectType, int frmId, int animType, int weaponCode, int rotation);
int artListIndex(int objectType, const char* name);
Art* artLoad(const char* path);
int artRead(const char* path, unsigned char* data);
int artWrite(const char* path, unsigned char* data);
+4 -3
View File
@@ -47,13 +47,13 @@ static int audioSoundDecoderReadHandler(void* data, void* buf, unsigned int size
static bool audioIsWavePath(const char* filePath);
static bool audioDecodeWave(File* stream, AudioFileInfo* info, unsigned char** dataPtr, int* sizePtr);
// 0x5108BC queryCompressedFunc
// 0x5108BC
static AudioQueryCompressedFunc* queryCompressedFunc = defaultCompressionFunc;
// 0x56CB00 numAudio
// 0x56CB00
static int gAudioListLength;
// 0x56CB04 audio
// 0x56CB04
static Audio* gAudioList;
// 0x41A2B0
@@ -264,6 +264,7 @@ int audioOpen(const char* fname, AudioFileInfo* info, bool* isMemoryBackedPtr)
if (info != nullptr) {
info->sampleRate = audioFile->sampleRate;
info->channels = audioFile->channels;
info->bitsPerSample = audioFile->bitsPerSample;
}
if (isMemoryBackedPtr != nullptr) {
+4 -3
View File
@@ -30,13 +30,13 @@ typedef struct AudioFile {
static bool defaultCompressionFunc(char* filePath);
static int audioFileSoundDecoderReadHandler(void* data, void* buffer, unsigned int size);
// 0x5108C0 queryCompressedFunc_2
// 0x5108C0
static AudioFileQueryCompressedFunc* queryCompressedFunc = defaultCompressionFunc;
// 0x56CB10 audiof
// 0x56CB10
static AudioFile* gAudioFileList;
// 0x56CB14 numAudiof
// 0x56CB14
static int gAudioFileListLength;
// 0x41A850
@@ -100,6 +100,7 @@ int audioFileOpen(const char* fname, AudioFileInfo* info, bool* isMemoryBackedPt
audioFile->fileSize *= 2;
if (info != nullptr) {
info->sampleRate = audioFile->sampleRate;
info->channels = audioFile->channels;
info->bitsPerSample = 16;
}
if (isMemoryBackedPtr != nullptr) {
+23 -23
View File
@@ -62,14 +62,14 @@ typedef struct AutomapEntry {
unsigned char* data;
} AutomapEntry;
// 0x41ADE0 defam
// 0x41ADE0
static const int _defam[AUTOMAP_MAP_COUNT][ELEVATION_COUNT] = {
{ -1, -1, -1 },
{ -1, -1, -1 },
{ -1, -1, -1 },
};
// 0x41B560 displayMapList
// 0x41B560
static int _displayMapList[AUTOMAP_MAP_COUNT] = {
-1,
-1,
@@ -242,17 +242,17 @@ static const int gAutomapFrmIds[AUTOMAP_FRM_COUNT] = {
173, // autodwn.frm - switch down
};
// 0x5108C4 autoflags
// 0x5108C4
static int gAutomapFlags = 0;
// 0x56CB18 amdbhead
// 0x56CB18
static AutomapHeader gAutomapHeader;
// 0x56D2A0 amdbsubhead
// 0x56D2A0
static AutomapEntry gAutomapEntry;
// automap_init
// 0x41B7F4 automap_init
// 0x41B7F4
int automapInit()
{
gAutomapFlags = 0;
@@ -260,7 +260,7 @@ int automapInit()
return 0;
}
// 0x41B808 automap_reset
// 0x41B808
int automapReset()
{
gAutomapFlags = 0;
@@ -268,7 +268,7 @@ int automapReset()
return 0;
}
// 0x41B81C automap_exit
// 0x41B81C
void automapExit()
{
char path[COMPAT_MAX_PATH];
@@ -276,25 +276,25 @@ void automapExit()
compat_remove(path);
}
// 0x41B87C automap_load
// 0x41B87C
int automapLoad(File* stream)
{
return fileReadInt32(stream, &gAutomapFlags);
}
// 0x41B898 automap_save
// 0x41B898
int automapSave(File* stream)
{
return fileWriteInt32(stream, gAutomapFlags);
}
// 0x41B8B4 automapDisplayMap
// 0x41B8B4
int _automapDisplayMap(int map)
{
return _displayMapList[map];
}
// 0x41B8BC automap
// 0x41B8BC
void automapShow(bool isInGame, bool isUsingScanner)
{
ScopedGameMode gm(GameMode::kAutomap);
@@ -499,7 +499,7 @@ void automapShow(bool isInGame, bool isUsingScanner)
// Renders automap in Map window.
//
// 0x41BD1C draw_top_down_map
// 0x41BD1C
static void automapRenderInMapWindow(int window, int elevation, unsigned char* backgroundData, int flags)
{
int color;
@@ -620,7 +620,7 @@ static void automapRenderInMapWindow(int window, int elevation, unsigned char* b
// Renders automap in Pipboy window.
//
// 0x41C004 draw_top_down_map_pipboy
// 0x41C004
int automapRenderInPipboyWindow(int window, int map, int elevation)
{
unsigned char* windowBuffer = windowGetBuffer(window) + 640 * AUTOMAP_PIPBOY_VIEW_Y + AUTOMAP_PIPBOY_VIEW_X;
@@ -682,7 +682,7 @@ int automapRenderInPipboyWindow(int window, int map, int elevation)
}
// automap_pip_save
// 0x41C0F0 automap_pip_save
// 0x41C0F0
int automapSaveCurrent()
{
int map = mapGetCurrentMap();
@@ -896,7 +896,7 @@ int automapSaveCurrent()
// Saves automap entry into stream.
//
// 0x41C844 WriteAM_Entry
// 0x41C844
static int automapSaveEntry(File* stream)
{
unsigned char* buffer;
@@ -928,7 +928,7 @@ err:
return -1;
}
// 0x41C8CC AM_ReadEntry
// 0x41C8CC
static int automapLoadEntry(int map, int elevation)
{
gAutomapEntry.compressedData = nullptr;
@@ -1015,7 +1015,7 @@ out:
// Saves automap.db header.
//
// 0x41CAD8 WriteAM_Header
// 0x41CAD8
static int automapSaveHeader(File* stream)
{
fileRewind(stream);
@@ -1045,7 +1045,7 @@ err:
// Loads automap.db header.
//
// 0x41CB50 AM_ReadMainHeader
// 0x41CB50
static int automapLoadHeader(File* stream)
{
@@ -1068,7 +1068,7 @@ static int automapLoadHeader(File* stream)
return 0;
}
// 0x41CBA4 decode_map_data
// 0x41CBA4
static void _decode_map_data(int elevation)
{
memset(gAutomapEntry.data, 0, SQUARE_GRID_SIZE);
@@ -1101,7 +1101,7 @@ static void _decode_map_data(int elevation)
}
}
// 0x41CC98 am_pip_init
// 0x41CC98
static int automapCreate()
{
gAutomapHeader.version = 1;
@@ -1128,7 +1128,7 @@ static int automapCreate()
// Copy data from stream1 to stream2.
//
// 0x41CD6C copy_file_data
// 0x41CD6C
static int _copy_file_data(File* stream1, File* stream2, int length)
{
void* buffer = internal_malloc(0xFFFF);
@@ -1160,7 +1160,7 @@ static int _copy_file_data(File* stream1, File* stream2, int length)
return 0;
}
// 0x41CE74 ReadAMList
// 0x41CE74
int automapGetHeader(AutomapHeader** automapHeaderPtr)
{
char path[COMPAT_MAX_PATH];
+3 -3
View File
@@ -5,13 +5,13 @@
#endif
#ifdef _WIN32
// 0x530010 autorun_mutex
// 0x530010
static HANDLE gInterplayGenericAutorunMutex;
#endif
namespace fallout {
// 0x4139C0 autorun_mutex_create
// 0x4139C0
bool autorunMutexCreate()
{
#ifdef _WIN32
@@ -25,7 +25,7 @@ bool autorunMutexCreate()
return true;
}
// 0x413A00 autorun_mutex_destroy
// 0x413A00
void autorunMutexClose()
{
#ifdef _WIN32
+19 -19
View File
@@ -30,11 +30,11 @@ static bool cacheSetCapacity(Cache* cache, int newCapacity);
static int cacheEntriesCompareByUsage(const void* a1, const void* a2);
static int cacheEntriesCompareByMostRecentHit(const void* a1, const void* a2);
// 0x510938 lock_sound_ticker
// 0x510938
static int _lock_sound_ticker = 0;
// cache_init
// 0x41FCC0 cache_init
// 0x41FCC0
bool cacheInit(Cache* cache, CacheSizeProc* sizeProc, CacheReadProc* readProc, CacheFreeProc* freeProc, int maxSize)
{
if (!heapInit(&(cache->heap), maxSize)) {
@@ -61,7 +61,7 @@ bool cacheInit(Cache* cache, CacheSizeProc* sizeProc, CacheReadProc* readProc, C
}
// cache_exit
// 0x41FD50 cache_exit
// 0x41FD50
bool cacheFree(Cache* cache)
{
if (cache == nullptr) {
@@ -90,7 +90,7 @@ bool cacheFree(Cache* cache)
return true;
}
// 0x41FDE8 cache_lock
// 0x41FDE8
bool cacheLock(Cache* cache, int key, void** data, CacheEntry** cacheEntryPtr)
{
if (cache == nullptr || data == nullptr || cacheEntryPtr == nullptr) {
@@ -145,7 +145,7 @@ bool cacheLock(Cache* cache, int key, void** data, CacheEntry** cacheEntryPtr)
return true;
}
// 0x4200B8 cache_unlock
// 0x4200B8
bool cacheUnlock(Cache* cache, CacheEntry* cacheEntry)
{
if (cache == nullptr || cacheEntry == nullptr) {
@@ -166,7 +166,7 @@ bool cacheUnlock(Cache* cache, CacheEntry* cacheEntry)
}
// cache_flush
// 0x42012C cache_flush
// 0x42012C
bool cacheFlush(Cache* cache)
{
if (cache == nullptr) {
@@ -193,7 +193,7 @@ bool cacheFlush(Cache* cache)
return true;
}
// 0x42019C cache_stats
// 0x42019C
bool cachePrintStats(Cache* cache, char* dest, size_t size)
{
if (cache == nullptr || dest == nullptr) {
@@ -207,7 +207,7 @@ bool cachePrintStats(Cache* cache, char* dest, size_t size)
// Fetches entry for the specified key into the cache.
//
// 0x4203AC cache_add
// 0x4203AC
static bool cacheFetchEntryForKey(Cache* cache, int key, int* indexPtr)
{
CacheEntry* cacheEntry = (CacheEntry*)internal_malloc(sizeof(*cacheEntry));
@@ -307,7 +307,7 @@ static bool cacheFetchEntryForKey(Cache* cache, int key, int* indexPtr)
return false;
}
// 0x4205E8 cache_insert
// 0x4205E8
static bool cacheInsertEntryAtIndex(Cache* cache, CacheEntry* cacheEntry, int index)
{
// Ensure cache have enough space for new entry.
@@ -332,7 +332,7 @@ static bool cacheInsertEntryAtIndex(Cache* cache, CacheEntry* cacheEntry, int in
// Returns 2 if entry already exists in cache, or 3 if entry does not exist. In
// this case indexPtr represents insertion point.
//
// 0x420654 cache_find
// 0x420654
static int cacheFindIndexForKey(Cache* cache, int key, int* indexPtr)
{
int length = cache->entriesLength;
@@ -371,7 +371,7 @@ static int cacheFindIndexForKey(Cache* cache, int key, int* indexPtr)
return 3;
}
// 0x420708 cache_init_item
// 0x420708
static bool cacheEntryInit(CacheEntry* cacheEntry)
{
cacheEntry->key = 0;
@@ -386,7 +386,7 @@ static bool cacheEntryInit(CacheEntry* cacheEntry)
// NOTE: Inlined.
//
// 0x420740 cache_destroy_item
// 0x420740
static bool cacheEntryFree(Cache* cache, CacheEntry* cacheEntry)
{
if (cacheEntry->data != nullptr) {
@@ -398,7 +398,7 @@ static bool cacheEntryFree(Cache* cache, CacheEntry* cacheEntry)
return true;
}
// 0x420764 cache_unlock_all
// 0x420764
static bool cacheClean(Cache* cache)
{
Heap* heap = &(cache->heap);
@@ -417,7 +417,7 @@ static bool cacheClean(Cache* cache)
return true;
}
// 0x4207D4 cache_reset_counter
// 0x4207D4
static bool cacheResetStatistics(Cache* cache)
{
if (cache == nullptr) {
@@ -447,7 +447,7 @@ static bool cacheResetStatistics(Cache* cache)
// Prepare cache for storing new entry with the specified size.
//
// 0x42084C cache_make_room
// 0x42084C
static bool cacheEnsureSize(Cache* cache, int size)
{
if (size > cache->maxSize) {
@@ -523,7 +523,7 @@ static bool cacheEnsureSize(Cache* cache, int size)
return false;
}
// 0x42099C cache_purge
// 0x42099C
static bool cacheSweep(Cache* cache)
{
for (int index = 0; index < cache->entriesLength; index++) {
@@ -554,7 +554,7 @@ static bool cacheSweep(Cache* cache)
return true;
}
// 0x420A40 cache_resize_array
// 0x420A40
static bool cacheSetCapacity(Cache* cache, int newCapacity)
{
if (newCapacity < cache->entriesLength) {
@@ -572,7 +572,7 @@ static bool cacheSetCapacity(Cache* cache, int newCapacity)
return true;
}
// 0x420A74 cache_compare_make_room
// 0x420A74
static int cacheEntriesCompareByUsage(const void* a1, const void* a2)
{
CacheEntry* lhs = *(CacheEntry**)a1;
@@ -601,7 +601,7 @@ static int cacheEntriesCompareByUsage(const void* a1, const void* a2)
return 0;
}
// 0x420AE8 cache_compare_reset_counter
// 0x420AE8
static int cacheEntriesCompareByMostRecentHit(const void* a1, const void* a2)
{
CacheEntry* lhs = *(CacheEntry**)a1;
+152 -152
View File
File diff suppressed because it is too large Load Diff
+20 -20
View File
@@ -90,44 +90,44 @@ static bool characterSelectorWindowFatalError(bool result);
static void premadeCharactersLocalizePath(char* path);
// 0x51C84C premade_index
// 0x51C84C
static int gCurrentPremadeCharacter = PREMADE_CHARACTER_NARG;
// 0x51C850 premade_characters
// 0x51C850
static PremadeCharacterDescription gPremadeCharacterDescriptions[PREMADE_CHARACTER_COUNT] = {
{ "premade\\combat", 201, "VID 208-197-88-125" },
{ "premade\\stealth", 202, "VID 208-206-49-229" },
{ "premade\\diplomat", 203, "VID 208-206-49-227" },
};
// 0x51C8D4 premade_total
// 0x51C8D4
static int gPremadeCharacterCount = PREMADE_CHARACTER_COUNT;
// 0x51C7F8 select_window_id
// 0x51C7F8
static int gCharacterSelectorWindow = -1;
// 0x51C7FC select_window_buffer
// 0x51C7FC
static unsigned char* gCharacterSelectorWindowBuffer = nullptr;
// 0x51C800 monitor
// 0x51C800
static unsigned char* gCharacterSelectorBackground = nullptr;
// 0x51C804 previous_button
// 0x51C804
static int gCharacterSelectorWindowPreviousButton = -1;
// 0x51C810 next_button
// 0x51C810
static int gCharacterSelectorWindowNextButton = -1;
// 0x51C81C take_button
// 0x51C81C
static int gCharacterSelectorWindowTakeButton = -1;
// 0x51C828 modify_button
// 0x51C828
static int gCharacterSelectorWindowModifyButton = -1;
// 0x51C834 create_button
// 0x51C834
static int gCharacterSelectorWindowCreateButton = -1;
// 0x51C840 back_button
// 0x51C840
static int gCharacterSelectorWindowBackButton = -1;
static FrmImage _takeButtonNormalFrmImage;
@@ -145,7 +145,7 @@ static FrmImage _previousButtonPressedFrmImage;
static std::vector<PremadeCharacterDescription> gCustomPremadeCharacterDescriptions;
// 0x4A71D0 select_character
// 0x4A71D0
int characterSelectorOpen()
{
#if __APPLE__ && TARGET_OS_IOS
@@ -260,7 +260,7 @@ int characterSelectorOpen()
return rc;
}
// 0x4A7468 select_init
// 0x4A7468
static bool characterSelectorWindowInit()
{
if (gCharacterSelectorWindow != -1) {
@@ -497,7 +497,7 @@ static bool characterSelectorWindowInit()
return true;
}
// 0x4A7AD4 select_exit
// 0x4A7AD4
static void characterSelectorWindowFree()
{
if (gCharacterSelectorWindow == -1) {
@@ -561,7 +561,7 @@ static void characterSelectorWindowFree()
gCharacterSelectorWindow = -1;
}
// 0x4A7D58 select_update_display
// 0x4A7D58
static bool characterSelectorWindowRefresh()
{
char path[COMPAT_MAX_PATH];
@@ -592,7 +592,7 @@ static bool characterSelectorWindowRefresh()
return success;
}
// 0x4A7E08 select_display_portrait
// 0x4A7E08
static bool characterSelectorWindowRenderFace()
{
bool success = false;
@@ -613,7 +613,7 @@ static bool characterSelectorWindowRenderFace()
return success;
}
// 0x4A7EA8 select_display_stats
// 0x4A7EA8
static bool characterSelectorWindowRenderStats()
{
char* str;
@@ -865,7 +865,7 @@ static bool characterSelectorWindowRenderStats()
return true;
}
// 0x4A8AE4 select_display_bio
// 0x4A8AE4
static bool characterSelectorWindowRenderBio()
{
int oldFont = fontGetCurrent();
@@ -896,7 +896,7 @@ static bool characterSelectorWindowRenderBio()
// NOTE: Inlined.
//
// 0x4A8BD0 select_fatal_error
// 0x4A8BD0
static bool characterSelectorWindowFatalError(bool result)
{
characterSelectorWindowFree();
+36 -36
View File
@@ -17,63 +17,63 @@ static void _setMixTableColor(int color);
static void _buildBlendTable(unsigned char* ptr, unsigned char ch);
static void _rebuildColorBlendTables();
// 0x50F930 aColor_cNoError
// 0x50F930
static char _aColor_cNoError[] = "color.c: No errors\n";
// 0x50F95C aColor_cColorTa
// 0x50F95C
static char _aColor_cColorTa[] = "color.c: color table not found\n";
// 0x50F984 aColor_cColorpa
// 0x50F984
static char _aColor_cColorpa[] = "color.c: colorpalettestack overflow";
// 0x50F9AC aColor_cColor_0
// 0x50F9AC
static char aColor_cColor_0[] = "color.c: colorpalettestack underflow";
// 0x51DF10 errorStr
// 0x51DF10
static char* _errorStr = _aColor_cNoError;
// 0x51DF14 colorsInited
// 0x51DF14
static bool _colorsInited = false;
// 0x51DF18 currentGamma
// 0x51DF18
static double gBrightness = 1.0;
// 0x51DF20 colorFadeBkFuncP
// 0x51DF20
static ColorTransitionCallback* gColorPaletteTransitionCallback = nullptr;
// 0x51DF30 colorNameMangler
// 0x51DF30
static ColorFileNameManger* gColorFileNameMangler = nullptr;
// 0x51DF34 cmap
// 0x51DF34
unsigned char _cmap[768] = {
0x3F, 0x3F, 0x3F
};
// 0x673090 systemCmap1
// 0x673090
unsigned char _systemCmap[256 * 3];
// 0x673390 currentGammaTable
// 0x673390
unsigned char _currentGammaTable[64];
// 0x6733D0 blendTable
// 0x6733D0
unsigned char* _blendTable[256];
// 0x6737D0 mappedColor
// 0x6737D0
unsigned char _mappedColor[256];
// 0x6738D0 colorMixAddTable
// 0x6738D0
Color colorMixAddTable[256][256];
// 0x6838D0 intensityColorTable
// 0x6838D0
Color intensityColorTable[256][256];
// 0x6938D0 colorMixMulTable
// 0x6938D0
Color colorMixMulTable[256][256];
// 0x6A38D0 colorTable
// 0x6A38D0
unsigned char _colorTable[32768];
// 0x4C72B4 calculateColor
// 0x4C72B4
int _calculateColor(int intensity, Color color)
{
return intensityColorTable[color][intensity / 512];
@@ -91,7 +91,7 @@ int Color2RGB(Color c)
// Performs animated palette transition.
//
// 0x4C7320 fadeSystemPalette
// 0x4C7320
void colorPaletteFadeBetween(unsigned char* oldPalette, unsigned char* newPalette, int steps)
{
for (int step = 0; step < steps; step++) {
@@ -120,13 +120,13 @@ void colorPaletteFadeBetween(unsigned char* oldPalette, unsigned char* newPalett
sharedFpsLimiter.throttle();
}
// 0x4C73D4 colorSetFadeBkFunc
// 0x4C73D4
void colorPaletteSetTransitionCallback(ColorTransitionCallback* callback)
{
gColorPaletteTransitionCallback = callback;
}
// 0x4C73E4 setSystemPalette
// 0x4C73E4
void _setSystemPalette(unsigned char* palette)
{
unsigned char newPalette[768];
@@ -139,13 +139,13 @@ void _setSystemPalette(unsigned char* palette)
directDrawSetPalette(newPalette);
}
// 0x4C7420 getSystemPalette
// 0x4C7420
unsigned char* _getSystemPalette()
{
return _systemCmap;
}
// 0x4C7428 setSystemPaletteEntries
// 0x4C7428
void _setSystemPaletteEntries(unsigned char* palette, int start, int end)
{
unsigned char newPalette[768];
@@ -164,7 +164,7 @@ void _setSystemPaletteEntries(unsigned char* palette, int start, int end)
directDrawSetPaletteInRange(newPalette, start, end - start + 1);
}
// 0x4C7550 setIntensityTableColor
// 0x4C7550
static void _setIntensityTableColor(int cc)
{
int shift = 0;
@@ -190,7 +190,7 @@ static void _setIntensityTableColor(int cc)
}
}
// 0x4C7658 setIntensityTables
// 0x4C7658
static void _setIntensityTables()
{
for (int index = 0; index < 256; index++) {
@@ -202,7 +202,7 @@ static void _setIntensityTables()
}
}
// 0x4C769C setMixTableColor
// 0x4C769C
static void _setMixTableColor(int color)
{
for (int otherColor = 0; otherColor < 256; otherColor++) {
@@ -278,7 +278,7 @@ static void _setMixTableColor(int color)
}
}
// 0x4C78E4 loadColorTable
// 0x4C78E4
bool colorPaletteLoad(const char* path)
{
if (gColorFileNameMangler != nullptr) {
@@ -353,13 +353,13 @@ bool colorPaletteLoad(const char* path)
return true;
}
// 0x4C7AB4 colorError
// 0x4C7AB4
char* _colorError()
{
return _errorStr;
}
// 0x4C7B44 buildBlendTable
// 0x4C7B44
static void _buildBlendTable(unsigned char* ptr, unsigned char ch)
{
int r, g, b;
@@ -419,7 +419,7 @@ static void _buildBlendTable(unsigned char* ptr, unsigned char ch)
}
}
// 0x4C7D90 rebuildColorBlendTables
// 0x4C7D90
static void _rebuildColorBlendTables()
{
int i;
@@ -431,7 +431,7 @@ static void _rebuildColorBlendTables()
}
}
// 0x4C7DC0 getColorBlendTable
// 0x4C7DC0
unsigned char* _getColorBlendTable(int ch)
{
unsigned char* ptr;
@@ -449,7 +449,7 @@ unsigned char* _getColorBlendTable(int ch)
return ptr;
}
// 0x4C7E20 freeColorBlendTable
// 0x4C7E20
void _freeColorBlendTable(int color)
{
unsigned char* blendTable = _blendTable[color];
@@ -463,7 +463,7 @@ void _freeColorBlendTable(int color)
}
}
// 0x4C7E6C colorGamma
// 0x4C7E6C
void colorSetBrightness(double value)
{
gBrightness = value;
@@ -476,7 +476,7 @@ void colorSetBrightness(double value)
_setSystemPalette(_systemCmap);
}
// 0x4C89CC initColors
// 0x4C89CC
bool _initColors()
{
if (_colorsInited) {
@@ -496,7 +496,7 @@ bool _initColors()
return true;
}
// 0x4C8A18 colorsClose
// 0x4C8A18
void _colorsClose()
{
for (int index = 0; index < 256; index++) {

Some files were not shown because too many files have changed in this diff Show More