Compare commits

..
Author SHA1 Message Date
Mike Klaas 0b649c416c Implement HOOK_STEAL 2026-05-07 21:31:03 -07:00
Mike Klaas 1a50bebff1 [HRP] Enable HR dialog screen
(It's not really "hi resolution", just adds a border so it looks less funny.)

Also, picked up @NovaRain's suggestion of centering dialog on the play area if it is large enough, which matches Sfall.
2026-05-07 07:56:16 -07:00
137 changed files with 3417 additions and 6174 deletions
-2
View File
@@ -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"
+1 -1
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. |
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

+1 -1
View File
@@ -99,7 +99,7 @@ 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
enable_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)
+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
+26 -178
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>
@@ -47,19 +44,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 +74,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 +99,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;
@@ -1120,7 +1116,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 +1133,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 +1167,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 +1239,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 -1
View File
@@ -69,7 +69,7 @@ typedef enum Background {
} Background;
typedef struct Art {
int version;
int field_0;
short framesPerSecond;
short actionFrame;
short frameCount;
+3 -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
+3 -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
+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++) {
+32 -32
View File
@@ -149,32 +149,32 @@ static void damageModCalculateGlovz(DamageCalculationContext* context);
static int damageModGlovzDivRound(int dividend, int divisor);
static void damageModCalculateYaam(DamageCalculationContext* context);
// 0x500B50 a_1
// 0x500B50
static char _a_1[] = ".";
// 0x51093C combat_turn_running
// 0x51093C
static int _combat_turn_running = 0;
// 0x510940 combatNumTurns
// 0x510940
int _combatNumTurns = 0;
static int combatTurnHookResult = 0;
// 0x510944 combat_state
// 0x510944
unsigned int gCombatState = COMBAT_STATE_0x02;
// 0x510948 aiInfoList
// 0x510948
static CombatAiInfo* _aiInfoList = nullptr;
// 0x51094C gcsd
// 0x51094C
static CombatStartData* _gcsd = nullptr;
// 0x510950 combat_call_display
// 0x510950
static bool _combat_call_display = false;
// Accuracy modifiers for hit locations.
//
// 0x510954 hit_location_penalty
// 0x510954
static int hit_location_penalty_default[HIT_LOCATION_COUNT] = {
-40,
-30,
@@ -191,7 +191,7 @@ static int hit_location_penalty[HIT_LOCATION_COUNT];
// Critical hit tables for every kill type.
//
// 0x510978 crit_succ_eff
// 0x510978
static CriticalHitDescription gCriticalHitTables[SFALL_KILL_TYPE_COUNT][HIT_LOCATION_COUNT][CRTICIAL_EFFECT_COUNT] = {
// KILL_TYPE_MAN
{
@@ -1793,7 +1793,7 @@ static CriticalHitDescription gCriticalHitTables[SFALL_KILL_TYPE_COUNT][HIT_LOCA
// Player's criticals effects.
//
// 0x5179B0 pc_crit_succ_eff
// 0x5179B0
static CriticalHitDescription gPlayerCriticalHitTable[HIT_LOCATION_COUNT][CRTICIAL_EFFECT_COUNT] = {
{
{ 3, 0, -1, 0, 0, 6500, 5000 },
@@ -1869,15 +1869,15 @@ static CriticalHitDescription gPlayerCriticalHitTable[HIT_LOCATION_COUNT][CRTICI
},
};
// 0x517F98 combat_end_due_to_load
// 0x517F98
static int _combat_end_due_to_load = 0;
// 0x517F9C combat_cleanup_enabled
// 0x517F9C
static bool _combat_cleanup_enabled = false;
// Provides effects caused by failing weapons.
//
// 0x517FA0 cf_table
// 0x517FA0
static const int _cf_table[WEAPON_CRITICAL_FAILURE_TYPE_COUNT][WEAPON_CRITICAL_FAILURE_EFFECT_COUNT] = {
{ 0, DAM_LOSE_TURN, DAM_LOSE_TURN, DAM_HURT_SELF | DAM_KNOCKED_DOWN, DAM_CRIP_RANDOM },
{ 0, DAM_LOSE_TURN, DAM_DROP, DAM_RANDOM_HIT, DAM_HIT_SELF },
@@ -1888,7 +1888,7 @@ static const int _cf_table[WEAPON_CRITICAL_FAILURE_TYPE_COUNT][WEAPON_CRITICAL_F
{ 0, DAM_LOSE_TURN, DAM_RANDOM_HIT, DAM_DESTROY, DAM_EXPLODE | DAM_LOSE_TURN | DAM_ON_FIRE },
};
// 0x51802C call_ty
// 0x51802C
static const int _call_ty[4] = {
122,
188,
@@ -1896,7 +1896,7 @@ static const int _call_ty[4] = {
316,
};
// 0x51803C hit_loc_left
// 0x51803C
static const int _hit_loc_left[4] = {
HIT_LOCATION_HEAD,
HIT_LOCATION_EYES,
@@ -1904,7 +1904,7 @@ static const int _hit_loc_left[4] = {
HIT_LOCATION_RIGHT_LEG,
};
// 0x51804C hit_loc_right
// 0x51804C
static const int _hit_loc_right[4] = {
HIT_LOCATION_TORSO,
HIT_LOCATION_GROIN,
@@ -1912,62 +1912,62 @@ static const int _hit_loc_right[4] = {
HIT_LOCATION_LEFT_LEG,
};
// 0x56D2B0 main_ctd
// 0x56D2B0
static Attack _main_ctd;
// combat.msg
//
// 0x56D368 combat_message_file
// 0x56D368
static MessageList gCombatMessageList;
// 0x56D370 call_target
// 0x56D370
static Object* gCalledShotCritter;
// 0x56D374 call_win
// 0x56D374
static int gCalledShotWindow;
// 0x56D378 combat_elev
// 0x56D378
static int _combat_elev;
// 0x56D37C list_total
// 0x56D37C
static int _list_total;
// Probably last who_hit_me of obj_dude
//
// 0x56D380 combat_ending_guy
// 0x56D380
static Object* _combat_ending_guy;
// 0x56D384 list_noncom
// 0x56D384
static int _list_noncom;
// 0x56D388 combat_turn_obj
// 0x56D388
static Object* _combat_turn_obj;
// target_highlight
//
// 0x56D38C combat_highlight
// 0x56D38C
static int _combat_highlight;
// 0x56D390 combat_list
// 0x56D390
static Object** _combat_list;
// 0x56D394 list_com
// 0x56D394
static int _list_com;
// Experience received for killing critters during current combat.
//
// 0x56D398 combat_exps
// 0x56D398
static int _combat_exps;
// bonus action points from BONUS_MOVE perk.
//
// 0x56D39C combat_free_move
// 0x56D39C
int _combat_free_move;
// 0x56D3A0 shoot_ctd
// 0x56D3A0
static Attack _shoot_ctd;
// 0x56D458 explosion_ctd
// 0x56D458
static Attack _explosion_ctd;
static CriticalHitDescription gBaseCriticalHitTables[SFALL_KILL_TYPE_COUNT][HIT_LOCATION_COUNT][CRTICIAL_EFFECT_COUNT];

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