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
|
||||
|
||||
@@ -540,6 +540,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
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
#include "FalloutEngine.h"
|
||||
#include "Logging.h"
|
||||
|
||||
// global variables
|
||||
long* ptr_pc_traits = reinterpret_cast<long*>(FO_VAR_pc_trait); // 2 of them
|
||||
|
||||
// Pointers to engine global variables
|
||||
DWORD* ptr_aiInfoList = reinterpret_cast<DWORD*>(FO_VAR_aiInfoList);
|
||||
DWORD* ptr_ambient_light = reinterpret_cast<DWORD*>(FO_VAR_ambient_light);
|
||||
sArt* ptr_art = reinterpret_cast<sArt*>(FO_VAR_art); // array of 11 sArt
|
||||
@@ -84,6 +82,7 @@ DWORD* ptr_gdBarterMod = reinterpret_cast<DWORD*>(FO_VAR_gdBart
|
||||
DWORD* ptr_gdNumOptions = reinterpret_cast<DWORD*>(FO_VAR_gdNumOptions);
|
||||
DWORD* ptr_gIsSteal = reinterpret_cast<DWORD*>(FO_VAR_gIsSteal);
|
||||
DWORD* ptr_glblmode = reinterpret_cast<DWORD*>(FO_VAR_glblmode);
|
||||
long* ptr_gmouse_3d_current_mode = reinterpret_cast<long*>(FO_VAR_gmouse_3d_current_mode);
|
||||
long* ptr_gmouse_current_cursor = reinterpret_cast<long*>(FO_VAR_gmouse_current_cursor);
|
||||
DWORD* ptr_gmovie_played_list = reinterpret_cast<DWORD*>(FO_VAR_gmovie_played_list);
|
||||
BYTE* ptr_GoodColor = reinterpret_cast<BYTE*>(FO_VAR_GoodColor);
|
||||
@@ -173,7 +172,8 @@ PathNode** ptr_paths = reinterpret_cast<PathNode**>(FO_VAR_pa
|
||||
CritInfo* ptr_pc_crit_succ_eff = reinterpret_cast<CritInfo*>(FO_VAR_pc_crit_succ_eff); // array: 9 body parts, 6 effects
|
||||
DWORD* ptr_pc_kill_counts = reinterpret_cast<DWORD*>(FO_VAR_pc_kill_counts);
|
||||
char* ptr_pc_name = reinterpret_cast<char*>(FO_VAR_pc_name);
|
||||
DWORD* ptr_pc_proto = reinterpret_cast<DWORD*>(FO_VAR_pc_proto);
|
||||
sProto* ptr_pc_proto = reinterpret_cast<sProto*>(FO_VAR_pc_proto);
|
||||
long* ptr_pc_traits = reinterpret_cast<long*>(FO_VAR_pc_trait); // 2 of them
|
||||
BYTE* ptr_PeanutButter = reinterpret_cast<BYTE*>(FO_VAR_PeanutButter);
|
||||
DWORD* ptr_perk_data = reinterpret_cast<DWORD*>(FO_VAR_perk_data);
|
||||
long** ptr_perkLevelDataList = reinterpret_cast<long**>(FO_VAR_perkLevelDataList); // dynamic array, limited to PERK_Count
|
||||
@@ -449,7 +449,7 @@ const DWORD get_input_ = 0x4C8B78;
|
||||
const DWORD get_input_str2_ = 0x47F084;
|
||||
const DWORD get_time_ = 0x4C9370;
|
||||
const DWORD getmsg_ = 0x48504C; // eax - msg file addr, ebx - message ID, edx - int[4] - loads string from MSG file preloaded in memory
|
||||
const DWORD gmouse_3d_get_mode_ = 0x44CB6C;
|
||||
//const DWORD gmouse_3d_get_mode_ = 0x44CB6C;
|
||||
const DWORD gmouse_3d_set_mode_ = 0x44CA18;
|
||||
const DWORD gmouse_is_scrolling_ = 0x44B54C;
|
||||
const DWORD gmouse_set_cursor_ = 0x44C840;
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
#define FO_VAR_gdNumOptions 0x5186D8
|
||||
#define FO_VAR_gIsSteal 0x51D430
|
||||
#define FO_VAR_glblmode 0x5709D0
|
||||
#define FO_VAR_gmouse_3d_current_mode 0x518D38
|
||||
#define FO_VAR_gmouse_current_cursor 0x518C0C
|
||||
#define FO_VAR_gmovie_played_list 0x596C78
|
||||
#define FO_VAR_GNW_win_init_flag 0x51E3E0
|
||||
@@ -329,8 +330,6 @@
|
||||
// variables
|
||||
// TODO: move to separate namespace
|
||||
|
||||
extern long* ptr_pc_traits; // 2 of them
|
||||
|
||||
extern DWORD* ptr_aiInfoList;
|
||||
extern DWORD* ptr_ambient_light;
|
||||
extern sArt* ptr_art;
|
||||
@@ -391,6 +390,7 @@ extern DWORD* ptr_gdBarterMod;
|
||||
extern DWORD* ptr_gdNumOptions;
|
||||
extern DWORD* ptr_gIsSteal;
|
||||
extern DWORD* ptr_glblmode;
|
||||
extern long* ptr_gmouse_3d_current_mode;
|
||||
extern long* ptr_gmouse_current_cursor;
|
||||
extern DWORD* ptr_gmovie_played_list;
|
||||
extern BYTE* ptr_GoodColor;
|
||||
@@ -480,7 +480,8 @@ extern PathNode** ptr_paths;
|
||||
extern CritInfo* ptr_pc_crit_succ_eff; // array: 9 body parts, 6 effects
|
||||
extern DWORD* ptr_pc_kill_counts;
|
||||
extern char* ptr_pc_name;
|
||||
extern DWORD* ptr_pc_proto;
|
||||
extern sProto* ptr_pc_proto;
|
||||
extern long* ptr_pc_traits; // 2 of them
|
||||
extern BYTE* ptr_PeanutButter;
|
||||
extern DWORD* ptr_perk_data;
|
||||
extern long** ptr_perkLevelDataList; // dynamic array, limited to PERK_Count
|
||||
@@ -739,7 +740,7 @@ extern const DWORD get_input_;
|
||||
extern const DWORD get_input_str2_;
|
||||
extern const DWORD get_time_;
|
||||
extern const DWORD getmsg_; // eax - msg file addr, ebx - message ID, edx - int[4] - loads string from MSG file preloaded in memory
|
||||
extern const DWORD gmouse_3d_get_mode_;
|
||||
//extern const DWORD gmouse_3d_get_mode_;
|
||||
extern const DWORD gmouse_3d_set_mode_;
|
||||
extern const DWORD gmouse_is_scrolling_;
|
||||
extern const DWORD gmouse_set_cursor_;
|
||||
|
||||
@@ -108,7 +108,6 @@ WRAP_WATCOM_FUNC1(long, FMtextWidth, FMtext_width_, const char*, text)
|
||||
WRAP_WATCOM_FUNC0(long, GetInputBtn, get_input_)
|
||||
// Searches for message ID in given message file and places result in result argument
|
||||
WRAP_WATCOM_FUNC3(const char*, Getmsg, getmsg_, const MSGList*, fileAddr, MSGNode*, result, long, messageId)
|
||||
WRAP_WATCOM_FUNC0(long, Gmouse3dGetMode, gmouse_3d_get_mode_)
|
||||
WRAP_WATCOM_FUNC1(void, Gmouse3dSetMode, gmouse_3d_set_mode_, long, mode)
|
||||
WRAP_WATCOM_FUNC1(long, GmouseSetCursor, gmouse_set_cursor_, long, picNum)
|
||||
WRAP_WATCOM_FUNC1(long, GsoundBackgroundVolumeGetSet, gsound_background_volume_get_set_, long, setVolume)
|
||||
|
||||
@@ -372,7 +372,7 @@ static void mf_tile_refresh_display() {
|
||||
}
|
||||
|
||||
static void mf_get_cursor_mode() {
|
||||
opHandler.setReturn(Gmouse3dGetMode());
|
||||
opHandler.setReturn(*ptr_gmouse_3d_current_mode);
|
||||
}
|
||||
|
||||
static void mf_set_cursor_mode() {
|
||||
|
||||
@@ -541,7 +541,9 @@ static void mf_obj_under_cursor() {
|
||||
&inclDudeArg = opHandler.arg(1);
|
||||
|
||||
if (crSwitchArg.isInt() && inclDudeArg.isInt()) {
|
||||
opHandler.setReturn(ObjectUnderMouse(crSwitchArg.asBool() ? 1 : -1, inclDudeArg.rawValue(), *ptr_map_elevation));
|
||||
opHandler.setReturn((*ptr_gmouse_3d_current_mode != 0)
|
||||
? ObjectUnderMouse(crSwitchArg.asBool() ? 1 : -1, inclDudeArg.rawValue(), *ptr_map_elevation)
|
||||
: 0);
|
||||
} else {
|
||||
OpcodeInvalidArgs("obj_under_cursor");
|
||||
opHandler.setReturn(0);
|
||||
|
||||
+49
-49
@@ -198,11 +198,12 @@ void Stats_UpdateHPStat(TGameObj* critter) {
|
||||
if (calcStatValue < statFormulas[STAT_max_hit_points].min) calcStatValue = statFormulas[STAT_max_hit_points].min;
|
||||
|
||||
if (proto->critter.base.health != calcStatValue) {
|
||||
DebugPrintf("\nWarning: critter PID: %d, ID: %d, has an incorrect base value %d (must be %d) of the max HP stat.",
|
||||
DebugPrintf("\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;
|
||||
}
|
||||
proto->critter.base.health = calcStatValue;
|
||||
critter->critter.health = calcStatValue + proto->critter.bonus.health;
|
||||
}
|
||||
|
||||
static void __declspec(naked) stat_set_base_hack_allow() {
|
||||
@@ -359,57 +360,56 @@ void Stats_Init() {
|
||||
|
||||
std::string statsFile = GetConfigString("Misc", "DerivedStats", "", MAX_PATH);
|
||||
if (!statsFile.empty()) {
|
||||
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
|
||||
statFormulas[STAT_max_hit_points].multi[STAT_st] = 1;
|
||||
statFormulas[STAT_max_hit_points].multi[STAT_en] = 2;
|
||||
// STAT_ag / 2 + 5
|
||||
statFormulas[STAT_max_move_points].base = 5; // max ap
|
||||
statFormulas[STAT_max_move_points].multi[STAT_ag] = 0.5;
|
||||
|
||||
statFormulas[STAT_ac].multi[STAT_ag] = 1; // ac
|
||||
// STAT_st - 5
|
||||
statFormulas[STAT_melee_dmg].min = 1; // melee damage
|
||||
statFormulas[STAT_melee_dmg].shift[STAT_st] = -5;
|
||||
statFormulas[STAT_melee_dmg].multi[STAT_st] = 1;
|
||||
// STAT_st * 25 + 25
|
||||
statFormulas[STAT_carry_amt].base = 25; // carry weight
|
||||
statFormulas[STAT_carry_amt].multi[STAT_st] = 25;
|
||||
// STAT_pe * 2
|
||||
statFormulas[STAT_sequence].multi[STAT_pe] = 2; // sequence
|
||||
// STAT_en / 3
|
||||
statFormulas[STAT_heal_rate].min = 1; // heal rate
|
||||
statFormulas[STAT_heal_rate].multi[STAT_en] = 1.0 / 3.0;
|
||||
|
||||
statFormulas[STAT_crit_chance].multi[STAT_lu] = 1; // critical chance
|
||||
// STAT_en * 2
|
||||
statFormulas[STAT_rad_resist].multi[STAT_en] = 2; // rad resist
|
||||
// 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;
|
||||
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
|
||||
|
||||
derivedHPwBonus = (iniGetInt("Main", "HPDependOnBonusStats", 0, statFile) != 0);
|
||||
// STAT_st + STAT_en * 2 + 15
|
||||
statFormulas[STAT_max_hit_points].base = 15; // max hp
|
||||
statFormulas[STAT_max_hit_points].multi[STAT_st] = 1;
|
||||
statFormulas[STAT_max_hit_points].multi[STAT_en] = 2;
|
||||
// STAT_ag / 2 + 5
|
||||
statFormulas[STAT_max_move_points].base = 5; // max ap
|
||||
statFormulas[STAT_max_move_points].multi[STAT_ag] = 0.5;
|
||||
|
||||
char key[6], buf2[256], buf3[256];
|
||||
statFormulas[STAT_ac].multi[STAT_ag] = 1; // ac
|
||||
// STAT_st - 5
|
||||
statFormulas[STAT_melee_dmg].min = 1; // melee damage
|
||||
statFormulas[STAT_melee_dmg].shift[STAT_st] = -5;
|
||||
statFormulas[STAT_melee_dmg].multi[STAT_st] = 1;
|
||||
// STAT_st * 25 + 25
|
||||
statFormulas[STAT_carry_amt].base = 25; // carry weight
|
||||
statFormulas[STAT_carry_amt].multi[STAT_st] = 25;
|
||||
// STAT_pe * 2
|
||||
statFormulas[STAT_sequence].multi[STAT_pe] = 2; // sequence
|
||||
// STAT_en / 3
|
||||
statFormulas[STAT_heal_rate].min = 1; // heal rate
|
||||
statFormulas[STAT_heal_rate].multi[STAT_en] = 1.0 / 3.0;
|
||||
|
||||
for (int i = STAT_max_hit_points; i <= STAT_poison_resist; i++) {
|
||||
if (i >= STAT_dmg_thresh && i <= STAT_dmg_resist_explosion) continue;
|
||||
statFormulas[STAT_crit_chance].multi[STAT_lu] = 1; // critical chance
|
||||
// STAT_en * 2
|
||||
statFormulas[STAT_rad_resist].multi[STAT_en] = 2; // rad resist
|
||||
// STAT_en * 5
|
||||
statFormulas[STAT_poison_resist].multi[STAT_en] = 5; // poison resist
|
||||
|
||||
_itoa(i, key, 10);
|
||||
statFormulas[i].base = iniGetInt(key, "base", statFormulas[i].base, statFile);
|
||||
statFormulas[i].min = iniGetInt(key, "min", statFormulas[i].min, statFile);
|
||||
for (int j = 0; j < STAT_max_hit_points; j++) {
|
||||
sprintf(buf2, "shift%d", j);
|
||||
statFormulas[i].shift[j] = iniGetInt(key, buf2, statFormulas[i].shift[j], statFile);
|
||||
sprintf(buf2, "multi%d", j);
|
||||
_gcvt(statFormulas[i].multi[j], 16, buf3);
|
||||
iniGetString(key, buf2, buf3, buf2, 256, statFile);
|
||||
statFormulas[i].multi[j] = atof(buf2);
|
||||
char key[6], buf2[256], buf3[256];
|
||||
|
||||
for (int i = STAT_max_hit_points; i <= STAT_poison_resist; i++) {
|
||||
if (i >= STAT_dmg_thresh && i <= STAT_dmg_resist_explosion) continue;
|
||||
|
||||
_itoa(i, key, 10);
|
||||
statFormulas[i].base = iniGetInt(key, "base", statFormulas[i].base, statFile);
|
||||
statFormulas[i].min = iniGetInt(key, "min", statFormulas[i].min, statFile);
|
||||
for (int j = 0; j < STAT_max_hit_points; j++) {
|
||||
sprintf(buf2, "shift%d", j);
|
||||
statFormulas[i].shift[j] = iniGetInt(key, buf2, statFormulas[i].shift[j], statFile);
|
||||
sprintf(buf2, "multi%d", j);
|
||||
_gcvt(statFormulas[i].multi[j], 16, buf3);
|
||||
iniGetString(key, buf2, buf3, buf2, 256, statFile);
|
||||
statFormulas[i].multi[j] = atof(buf2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user