mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Changed "obj_under_cursor" for the movement cursor
* the function is not designed for use with it. Code correction in Stats.cpp.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
[Main]
|
||||
;Set to 1 to take the bonus values of SPECIAL stats into account when calculating maximum hit points
|
||||
;Set to 0 for the original behavior (bonus stats do not affect maximum hit points)
|
||||
;Set to 0 for the Fallout original behavior (bonus stats do not affect maximum hit points)
|
||||
HPDependOnBonusStats=0
|
||||
|
||||
;max hp
|
||||
|
||||
@@ -578,6 +578,7 @@ Some utility/math functions are available:
|
||||
- onlyCritter: True - only checks critters and ignores their cover (roof tiles, walls, scenery, etc.)
|
||||
False - checks all objects (can't check critters under objects)
|
||||
- passing False to the includeDude argument will ignore dude_obj
|
||||
- NOTE: the function will always return 0 if the cursor is in movement mode (hexagon cursor)
|
||||
|
||||
> object sfall_func0("loot_obj")
|
||||
- returns a pointer to the target object (container or critter) of the loot screen
|
||||
|
||||
@@ -1455,7 +1455,7 @@ FUNC(gmouse_3d_disable_modes_, 0x44CA04)
|
||||
FUNC(gmouse_3d_enable_modes_, 0x44C9F8)
|
||||
FUNC(gmouse_3d_exit_, 0x44DB34)
|
||||
FUNC(gmouse_3d_get_fid_, 0x44CCF4)
|
||||
FUNC(gmouse_3d_get_mode_, 0x44CB6C)
|
||||
//FUNC(gmouse_3d_get_mode_, 0x44CB6C)
|
||||
FUNC(gmouse_3d_highlight_menu_frame_, 0x44D630)
|
||||
FUNC(gmouse_3d_init_, 0x44D984)
|
||||
FUNC(gmouse_3d_is_on_, 0x44CEB0)
|
||||
|
||||
@@ -120,7 +120,6 @@ WRAP_WATCOM_FUNC0(long, get_input)
|
||||
// Searches for message ID in given message file and places result in result argument
|
||||
WRAP_WATCOM_FUNC3(const char*, getmsg, const MessageList*, fileAddr, MessageNode*, result, long, messageId)
|
||||
WRAP_WATCOM_FUNC1(void, gdialogDisplayMsg, const char*, message)
|
||||
WRAP_WATCOM_FUNC0(long, gmouse_3d_get_mode)
|
||||
WRAP_WATCOM_FUNC1(void, gmouse_3d_set_mode, long, mode)
|
||||
WRAP_WATCOM_FUNC1(long, gmouse_set_cursor, long, picNum)
|
||||
WRAP_WATCOM_FUNC1(long, gsound_background_volume_get_set, long, setVolume)
|
||||
|
||||
@@ -69,6 +69,7 @@ VAR_(gdBarterMod, DWORD)
|
||||
VAR_(gdNumOptions, DWORD)
|
||||
VAR_(gIsSteal, DWORD)
|
||||
VAR_(glblmode, DWORD)
|
||||
VAR_(gmouse_3d_current_mode, long)
|
||||
VAR_(gmouse_current_cursor, long)
|
||||
VARA(gmovie_played_list, BYTE, 17)
|
||||
VAR_(GoodColor, BYTE)
|
||||
|
||||
@@ -94,7 +94,7 @@ pickNewID: // skip PM range (18000 - 83535)
|
||||
}
|
||||
}
|
||||
|
||||
// Reassigns object IDs to all critters upon first loading a map and updates HP stats
|
||||
// Reassigns object IDs to all critters upon first loading a map and updates their max HP stat
|
||||
static void map_fix_critter_id() {
|
||||
long npcStartID = 4096;
|
||||
fo::GameObject* obj = fo::func::obj_find_first();
|
||||
|
||||
@@ -299,7 +299,7 @@ void mf_tile_refresh_display(OpcodeContext& ctx) {
|
||||
}
|
||||
|
||||
void mf_get_cursor_mode(OpcodeContext& ctx) {
|
||||
ctx.setReturn(fo::func::gmouse_3d_get_mode());
|
||||
ctx.setReturn(fo::var::gmouse_3d_current_mode);
|
||||
}
|
||||
|
||||
void mf_set_cursor_mode(OpcodeContext& ctx) {
|
||||
|
||||
@@ -373,7 +373,9 @@ void mf_get_dialog_object(OpcodeContext& ctx) {
|
||||
}
|
||||
|
||||
void mf_obj_under_cursor(OpcodeContext& ctx) {
|
||||
ctx.setReturn(fo::func::object_under_mouse(ctx.arg(0).asBool() ? 1 : -1, ctx.arg(1).rawValue(), fo::var::map_elevation));
|
||||
ctx.setReturn((fo::var::gmouse_3d_current_mode != 0)
|
||||
? fo::func::object_under_mouse(ctx.arg(0).asBool() ? 1 : -1, ctx.arg(1).rawValue(), fo::var::map_elevation)
|
||||
: 0);
|
||||
}
|
||||
|
||||
void mf_get_loot_object(OpcodeContext& ctx) {
|
||||
|
||||
+13
-11
@@ -26,8 +26,8 @@
|
||||
namespace sfall
|
||||
{
|
||||
|
||||
bool engineDerivedStats = true;
|
||||
bool derivedHPwBonus = false; // recalculate the hit points with bonus stat values
|
||||
static bool engineDerivedStats = true;
|
||||
static bool derivedHPwBonus = false; // recalculate the hit points with bonus stat values
|
||||
|
||||
static DWORD statMaximumsPC[fo::STAT_max_stat];
|
||||
static DWORD statMinimumsPC[fo::STAT_max_stat];
|
||||
@@ -203,11 +203,12 @@ void Stats::UpdateHPStat(fo::GameObject* critter) {
|
||||
if (calcStatValue < statFormulas[fo::Stat::STAT_max_hit_points].min) calcStatValue = statFormulas[fo::Stat::STAT_max_hit_points].min;
|
||||
|
||||
if (proto->critter.base.health != calcStatValue) {
|
||||
fo::func::debug_printf("\nWarning: critter PID: %d, ID: %d, has an incorrect base value %d (must be %d) of the max HP stat.",
|
||||
fo::func::debug_printf("\nWarning: critter PID: %d, ID: %d, has an incorrect base value of the max HP stat: %d (must be %d)",
|
||||
critter->protoId, critter->id, proto->critter.base.health, calcStatValue);
|
||||
}
|
||||
|
||||
proto->critter.base.health = calcStatValue;
|
||||
critter->critter.health = calcStatValue + proto->critter.bonus.health;
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) stat_set_base_hack_allow() {
|
||||
@@ -297,8 +298,10 @@ void Stats::init() {
|
||||
|
||||
auto statsFile = GetConfigString("Misc", "DerivedStats", "", MAX_PATH);
|
||||
if (!statsFile.empty()) {
|
||||
const char* statFile = statsFile.insert(0, ".\\").c_str();
|
||||
if (GetFileAttributes(statFile) != INVALID_FILE_ATTRIBUTES) { // check if file exists
|
||||
derivedHPwBonus = (iniGetInt("Main", "HPDependOnBonusStats", 0, statFile) != 0);
|
||||
engineDerivedStats = false;
|
||||
MakeJump(0x4AF6FC, stat_recalc_derived_hack); // overrides function
|
||||
|
||||
// STAT_st + STAT_en * 2 + 15
|
||||
statFormulas[STAT_max_hit_points].base = 15; // max hp
|
||||
@@ -328,11 +331,6 @@ void Stats::init() {
|
||||
// STAT_en * 5
|
||||
statFormulas[STAT_poison_resist].multi[STAT_en] = 5; // poison resist
|
||||
|
||||
const char* statFile = statsFile.insert(0, ".\\").c_str();
|
||||
if (GetFileAttributes(statFile) == INVALID_FILE_ATTRIBUTES) return;
|
||||
|
||||
derivedHPwBonus = (iniGetInt("Main", "HPDependOnBonusStats", 0, statFile) != 0);
|
||||
|
||||
char key[6], buf2[256], buf3[256];
|
||||
|
||||
for (int i = fo::Stat::STAT_max_hit_points; i <= fo::Stat::STAT_poison_resist; i++) {
|
||||
@@ -350,8 +348,12 @@ void Stats::init() {
|
||||
statFormulas[i].multi[j] = atof(buf2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
if (engineDerivedStats) {
|
||||
CritterStats::RecalcDerivedHook();
|
||||
} else {
|
||||
MakeJump(0x4AF6FC, stat_recalc_derived_hack); // overrides function
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user