Added displaying party member's current level & AC & addict flag info to the combat control panel (from Mr.Stalin)

Changed highlighting containers/corpses to be default on in sfall-mods.ini.
This commit is contained in:
NovaRain
2018-10-16 10:05:25 +08:00
parent 005684fa3b
commit bceb505024
6 changed files with 51 additions and 2 deletions
+3
View File
@@ -7,6 +7,9 @@ HighlightFail2=Your motion sensor is out of charge.
SuperStimExploitMsg=You cannot use a super stim on someone who is not injured!
BlockedCombat=You cannot enter combat at this time.
SaveSfallDataFail=ERROR saving extended savegame information! Check if other programs interfere with savegame files/folders and try again.
PartyLvlMsg=Lvl:
PartyACMsg=AC:
PartyAddictMsg=Addict
[AppearanceMod]
RaceText=Race
+2 -2
View File
@@ -5,10 +5,10 @@
Key=42
; Set to 1 to also highlight containers
Containers=0
Containers=1
; Set to 1 to also highlight lootable corpses
Corpses=0
Corpses=1
; Set to 1 to only highlight objects in the player's line-of-sight
CheckLOS=0
+1
View File
@@ -74,6 +74,7 @@ WRAP_WATCOM_FUNC2(long, obj_pid_new, fo::GameObject*, object, long, pid)
WRAP_WATCOM_FUNC1(long, obj_lock_is_jammed, GameObject*, object)
WRAP_WATCOM_FUNC1(void, obj_unjam_lock, GameObject*, object)
WRAP_WATCOM_FUNC6(long, pick_death, GameObject*, attacker, GameObject*, target, GameObject*, weapon, long, amount, long, anim, long, hitFromBack)
WRAP_WATCOM_FUNC2(long, queue_find_first, GameObject*, object, long, qType)
WRAP_WATCOM_FUNC3(long, register_object_animate, GameObject*, object, long, anim, long, delay)
WRAP_WATCOM_FUNC3(long, register_object_animate_and_hide, GameObject*, object, long, anim, long, delay)
// WRAP_WATCOM_FUNC3(long, register_object_animate_and_move_straight_, GameObject*, object;
+1
View File
@@ -42,6 +42,7 @@
#define FO_VAR_curr_pc_stat 0x6681AC
#define FO_VAR_curr_stack 0x59E96C
#define FO_VAR_cursor_line 0x664514
#define FO_VAR_DarkGreenColor 0x6A3A90
#define FO_VAR_dialogue_state 0x518714
#define FO_VAR_dialogue_switch_mode 0x518718
#define FO_VAR_dialog_target 0x518848
+1
View File
@@ -33,6 +33,7 @@ VAR_(curr_font_num, DWORD)
VARA(curr_pc_stat, long, PCSTAT_max_pc_stat)
VAR_(curr_stack, DWORD)
VAR_(cursor_line, DWORD)
VAR_(DarkGreenColor, BYTE)
VAR_(dialogue_state, DWORD)
VAR_(dialogue_switch_mode, DWORD)
VAR_(dialog_target, DWORD)
+43
View File
@@ -230,11 +230,54 @@ fo::GameObject* PartyControl::RealDudeObject() {
: fo::var::obj_dude;
}
static char levelMsg[12], armorClassMsg[12], addictMsg[16];
static void __fastcall PartyMemberPrintStat(BYTE* surface, DWORD toWidth) {
const char* fmt = "%s %d";
char lvlMsg[16], acMsg[16];
fo::GameObject* partyMember = (fo::GameObject*)fo::var::dialog_target;
int xPos = 350;
int level = fo::func::partyMemberGetCurLevel(partyMember);
sprintf_s(lvlMsg, fmt, levelMsg, level);
BYTE color = fo::var::GreenColor;
int widthText = fo::GetTextWidth(lvlMsg);
fo::PrintText(lvlMsg, color, xPos - widthText, 96, widthText, toWidth, surface);
int ac = fo::func::stat_level(partyMember, fo::STAT_ac);
sprintf_s(acMsg, fmt, armorClassMsg, ac);
xPos -= fo::GetTextWidth(armorClassMsg) + 20;
fo::PrintText(acMsg, color, xPos, 167, fo::GetTextWidth(acMsg), toWidth, surface);
color = (fo::func::queue_find_first(partyMember, 2)) ? fo::var::RedColor : fo::var::DarkGreenColor;
widthText = fo::GetTextWidth(addictMsg);
fo::PrintText(addictMsg, color, 350 - widthText, 148, widthText, toWidth, surface);
}
static void __declspec(naked) gdControlUpdateInfo_hook() {
__asm {
mov edi, eax; // keep fontnum
mov ecx, ebp;
mov edx, esi;
call PartyMemberPrintStat;
mov eax, edi;
jmp fo::funcoffs::text_font_;
}
}
void PartyControl::init() {
LoadGameHook::OnGameReset() += PartyControlReset;
HookCall(0x454218, stat_pc_add_experience_hook); // call inside op_give_exp_points_hook
HookCalls(pc_flag_toggle_hook, { 0x4124F1, 0x41279A });
// display party member's current level & AC & addict flag
HookCall(0x44926F, gdControlUpdateInfo_hook);
Translate("sfall", "PartyLvlMsg", "Lvl:", levelMsg, 12);
Translate("sfall", "PartyACMsg", "AC:", armorClassMsg, 12);
Translate("sfall", "PartyAddictMsg", "Addict", addictMsg, 16);
}
}