Partially refactored most of the source code to use proper engine function/variable names.

This commit is contained in:
NovaRain
2015-11-16 10:40:26 +08:00
parent 971be61d95
commit 879315b4d0
41 changed files with 1363 additions and 1822 deletions
+4 -6
View File
@@ -18,8 +18,8 @@
#include "main.h"
#include "AI.h"
#include "SafeWrite.h"
#include "FalloutEngine.h"
#include "SafeWrite.h"
#include <hash_map>
@@ -45,8 +45,6 @@ static void _stdcall CombatAttackHook(DWORD source, DWORD target) {
targets[source]=target;
}
//static const DWORD _ai_attack=0x42A748;
static const DWORD _combat_attack=0x422F3C;
static void __declspec(naked) combat_attack_hook() {
_asm {
pushad;
@@ -54,7 +52,7 @@ static void __declspec(naked) combat_attack_hook() {
push eax;
call CombatAttackHook;
popad;
jmp _combat_attack;
jmp combat_attack_;
}
}
@@ -82,7 +80,7 @@ end:
static void __declspec(naked) BlockCombatHook2() {
__asm {
mov eax, dword ptr ds:[0x518F10];
mov eax, dword ptr ds:[_intfaceEnabled];
test eax, eax;
jz end;
mov eax, CombatDisabled;
@@ -123,4 +121,4 @@ void _stdcall AICombatStart() {
void _stdcall AICombatEnd() {
targets.clear();
sources.clear();
}
}
+6 -7
View File
@@ -663,7 +663,6 @@ static void __declspec(naked) DisplayBonusHtHDmg2() {
}
}
static const DWORD roll_random=0x4A30C0;
static const DWORD UnarmedAttacksFixEnd=0x423A0D;
static void __declspec(naked) UnarmedAttacksFix() {
__asm {
@@ -674,7 +673,7 @@ static void __declspec(naked) UnarmedAttacksFix() {
PowKickHPunch:
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0x5; // 5% chance of critical hit
jle CriticalHit;
jmp end;
@@ -687,7 +686,7 @@ HKickJabCheck:
HKickJab:
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0xa; // 10% chance of critical hit
jle CriticalHit;
jmp end;
@@ -696,7 +695,7 @@ Haymaker:
jnz PalmStrike;
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0xf; // 15% chance of critical hit
jle CriticalHit;
jmp end;
@@ -705,7 +704,7 @@ PalmStrike:
jnz PiercingStrike;
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0x14; // 20% chance of critical hit
jle CriticalHit;
jmp end;
@@ -714,7 +713,7 @@ PiercingStrike:
jnz PiercingKick;
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0x28; // 40% chance of critical hit
jle CriticalHit;
jmp end;
@@ -723,7 +722,7 @@ PiercingKick:
jnz end;
mov edx,0x64;
mov eax,0x1;
call roll_random;
call roll_random_;
cmp eax,0x32; // 50% chance of critical hit
jg end;
CriticalHit:
+2 -2
View File
@@ -19,10 +19,10 @@
#include "main.h"
#include "BarBoxes.h"
#include "FalloutEngine.h"
static const DWORD DisplayBoxesRet1=0x4615A8;
static const DWORD DisplayBoxesRet2=0x4615BE;
static const DWORD _add_bar_box=0x4616F0;
struct sBox {
DWORD msg;
DWORD colour;
@@ -39,7 +39,7 @@ start:
test eax, eax;
jz next;
lea eax, [ebx+5];
call _add_bar_box;
call add_bar_box_;
add esi, eax;
next:
inc ebx;
+4 -5
View File
@@ -60,10 +60,9 @@ void ConsoleExit() {
/* An attempt to make popup display function.. failed to make it work, though all arguments are there.
/* An attempt to make popup display function.. failed to make it work, though all arguments are there.
I missed something...
static const DWORD dialog_out_Addr = 0x41CF20;
void DisplayAlertPopup(const char* msg, const char* line2) {
__asm {
push 1
@@ -78,6 +77,6 @@ void DisplayAlertPopup(const char* msg, const char* line2) {
mov eax, line2
mov esi, 0FFFFFFFFh
mov edi, 2
call dialog_out_Addr
}
}*/
call dialog_out_
}
}*/
+8 -7
View File
@@ -18,9 +18,10 @@
#include "main.h"
#include "Criticals.h"
#include "Logging.h"
#include <stdio.h>
#include "Criticals.h"
#include "FalloutEngine.h"
#include "Logging.h"
static const DWORD CritTableCount=2*19+1; //Number of species in new critical table
//static const DWORD origCritTableSize = 6*9*20; //Number of entries in original table
@@ -72,13 +73,13 @@ void _stdcall ResetCriticalTable(DWORD critter, DWORD bodypart, DWORD slot, DWOR
//It's been a long time since we worried about win9x compatibility, so just sprintf it for goodness sake...
char section[16];
sprintf_s(section, "c_%02d_%d_%d", critter, bodypart, slot);
CritStruct* defaultTable=(CritStruct*)0x510978;
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
critTable[slot].values[element]=critTable[slot].DamageMultiplier=GetPrivateProfileIntA(section, CritNames[element], defaultTable[slot].values[element], ".\\CriticalOverrides.ini");
}
void CritLoad() {
if (!Inited) return;
CritStruct* defaultTable=(CritStruct*)0x510978;
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
if (mode==1) {
char section[16];
dlogr("Setting up critical hit table using CriticalOverrides.ini", DL_CRITICALS);
@@ -106,7 +107,7 @@ void CritLoad() {
dlogr("Setting up critical hit table using RP fixes", DL_CRITICALS);
memcpy(critTable, defaultTable, 6*9*19*sizeof(CritStruct));
memset(&critTable[6*9*19], 0, 6*9*19*sizeof(CritStruct));
memcpy(playerCrit, (void*)0x5179B0, 6*9*sizeof(CritStruct));
memcpy(playerCrit, (void*)_pc_crit_succ_eff, 6*9*sizeof(CritStruct));
if (mode==3) {
char buf[32], buf2[32], buf3[32];
@@ -150,7 +151,7 @@ void CritInit() {
dlog(". ", DL_INIT);
if(mode==2 || mode==3) {
CritStruct* defaultTable=(CritStruct*)0x510978;
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
SetEntry(2,4,1,4,0);
SetEntry(2,4,1,5,5216);
@@ -250,4 +251,4 @@ void CritInit() {
Inited=true;
dlogr(" Done", DL_INIT);
}
}
+12 -13
View File
@@ -18,10 +18,11 @@
#include "main.h"
#include "DebugEditor.h"
#include "ScriptExtender.h"
#include "Arrays.h"
#include <vector>
#include "Arrays.h"
#include "DebugEditor.h"
#include "FalloutEngine.h"
#include "ScriptExtender.h"
#define CODE_EXIT (254)
#define CODE_SET_GLOBAL (0)
@@ -70,8 +71,6 @@ static bool InternalRecv(SOCKET s, void* _data, int size) {
}
return false;
}
static const DWORD obj_find_first_at_tile=0x48B5A8;
static const DWORD obj_find_next_at_tile=0x48B608;
static void RunEditorInternal(SOCKET &s) {
std::vector<DWORD*> vec = std::vector<DWORD*>();
for(int elv=0;elv<3;elv++) {
@@ -80,7 +79,7 @@ static void RunEditorInternal(SOCKET &s) {
__asm {
mov edx, tile;
mov eax, elv;
call obj_find_first_at_tile;
call obj_find_first_at_tile_;
mov obj, eax;
}
while(obj) {
@@ -88,7 +87,7 @@ static void RunEditorInternal(SOCKET &s) {
otype = (otype&0xff000000) >> 24;
if(otype==1) vec.push_back(obj);
__asm {
call obj_find_next_at_tile;
call obj_find_next_at_tile_;
mov obj, eax;
}
}
@@ -97,8 +96,8 @@ static void RunEditorInternal(SOCKET &s) {
int numCritters=vec.size();
int numGlobals=*(int*)0x5186C4;
int numMapVars=*(int*)0x519574;
int numGlobals=*(int*)_num_game_global_vars;
int numMapVars=*(int*)_num_map_global_vars;
int numSGlobals=GetNumGlobals();
int numArrays=GetNumArrays();
InternalSend(s, &numGlobals, 4);
@@ -112,8 +111,8 @@ static void RunEditorInternal(SOCKET &s) {
int* arrays=new int[numArrays*3];
GetArrays(arrays);
InternalSend(s, *(void**)0x5186C0, 4*numGlobals);
InternalSend(s, *(void**)0x51956C, 4*numMapVars);
InternalSend(s, *(void**)_game_global_vars, 4*numGlobals);
InternalSend(s, *(void**)_map_global_vars, 4*numMapVars);
InternalSend(s, sglobals, sizeof(sGlobalVar)*numSGlobals);
InternalSend(s, arrays, numArrays*3*4);
for(int i=0;i<numCritters;i++) InternalSend(s, &vec[i][25], 4);
@@ -127,12 +126,12 @@ static void RunEditorInternal(SOCKET &s) {
case 0:
InternalRecv(s, &id, 4);
InternalRecv(s, &val, 4);
(*(DWORD**)0x5186C0)[id]=val;
(*(DWORD**)_game_global_vars)[id]=val;
break;
case 1:
InternalRecv(s, &id, 4);
InternalRecv(s, &val, 4);
(*(DWORD**)0x51956C)[id]=val;
(*(DWORD**)_map_global_vars)[id]=val;
break;
case 2:
InternalRecv(s, &id, 4);
+10 -12
View File
@@ -19,8 +19,9 @@
#include "main.h"
#include "Elevators.h"
#include "FalloutEngine.h"
static const int ElevatorCount=50;
static const int ElevatorCount = 50;
static char File[MAX_PATH];
struct sElevator {
@@ -46,39 +47,36 @@ void SetElevator(DWORD id, DWORD index, DWORD value) {
*(DWORD*)(((DWORD)&Elevators[id])+index*4)=value;
}
static const DWORD GetMenuAddress=0x43F324;
static void __declspec(naked) GetMenuHook() {
__asm {
push ebx;
lea ebx, Menus;
shl eax, 2;
mov eax, [ebx+eax];
call GetMenuAddress;
call elevator_start_;
pop ebx;
ret;
}
}
static const DWORD UnknownAddress=0x43F73C;
static void __declspec(naked) UnknownHook() {
__asm {
push ebx;
lea ebx, Menus;
shl eax, 2;
mov eax, [ebx+eax];
call UnknownAddress;
call Check4Keys_;
pop ebx;
ret;
}
}
static const DWORD UnknownAddress2=0x43F6D0;
static void __declspec(naked) UnknownHook2() {
__asm {
push ebx;
lea ebx, Menus;
shl eax, 2;
mov eax, [ebx+eax];
call UnknownAddress2;
call elevator_end_;
pop ebx;
ret;
}
@@ -88,7 +86,7 @@ static void __declspec(naked) GetNumButtonsHook1() {
__asm {
lea esi, Menus;
mov eax, [esi+edi*4];
mov eax, [0x43EA1C+eax*4];
mov eax, [_btncnt+eax*4];
mov esi, 0x43F064;
jmp esi;
}
@@ -97,7 +95,7 @@ static void __declspec(naked) GetNumButtonsHook2() {
__asm {
lea edx, Menus;
mov eax, [edx+edi*4];
mov eax, [0x43EA1C+eax*4];
mov eax, [_btncnt+eax*4];
mov edx, 0x43F18B;
jmp edx;
}
@@ -106,14 +104,14 @@ static void __declspec(naked) GetNumButtonsHook3() {
__asm {
lea eax, Menus;
mov eax, [eax+edi*4];
mov eax, [0x43EA1C+eax*4];
mov eax, [_btncnt+eax*4];
mov ebx, 0x43F1EB;
jmp ebx;
}
}
void ResetElevators() {
memcpy(Elevators, (void*)0x43EA7C, sizeof(sElevator)*24);
memcpy(Elevators, (void*)_retvals, sizeof(sElevator)*24);
memset(&Elevators[24], 0, sizeof(sElevator)*(ElevatorCount-24));
for(int i=0;i<24;i++) Menus[i]=i;
for(int i=24;i<ElevatorCount;i++) Menus[i]=0;
@@ -159,4 +157,4 @@ void ElevatorsInit(char* file) {
SafeWrite8(0x43F1E4, 0xe9);
HookCall(0x43F1E4, GetNumButtonsHook3);
ResetElevators();
}
}
+7 -6
View File
@@ -156,10 +156,10 @@ const DWORD handle_inventory_ = 0x46E7B0;
const DWORD inc_game_time_ = 0x4A34CC;
const DWORD insert_withdrawal_ = 0x47A290;
const DWORD interpret_ = 0x46CCA4;
const DWORD interpretAddString_ = 0x467A80;
const DWORD interpretAddString_ = 0x467A80; // edx = ptr to string, eax = script
const DWORD interpretFindProcedure_ = 0x46DCD0;
const DWORD interpretFreeProgram_ = 0x467614;
const DWORD interpretGetString_ = 0x4678E0;
const DWORD interpretGetString_ = 0x4678E0; // eax = script ptr, edx = var type, ebx = var
const DWORD interpretPopLong_ = 0x467500;
const DWORD interpretPopShort_ = 0x4674F0;
const DWORD interpretPushLong_ = 0x4674DC;
@@ -245,7 +245,7 @@ const DWORD mouse_show_ = 0x4CA34C;
const DWORD move_inventory_ = 0x474708;
const DWORD NixHotLines_ = 0x4999C0;
const DWORD obj_ai_blocking_at_ = 0x48BA20;
const DWORD obj_blocking_at_ = 0x48B848;
const DWORD obj_blocking_at_ = 0x48B848; // (EAX *obj, EDX hexNum, EBX level)
const DWORD obj_bound_ = 0x48B66C;
const DWORD obj_change_fid_ = 0x48AA3C;
const DWORD obj_connect_ = 0x489EC4;
@@ -263,7 +263,7 @@ const DWORD obj_remove_outline_ = 0x48C2F0;
const DWORD obj_save_dude_ = 0x48D59C;
const DWORD obj_scroll_blocking_at_ = 0x48BB44;
const DWORD obj_set_light_ = 0x48AC90; // <eax>(int aObj<eax>, signed int aDist<edx>, int a3<ecx>, int aIntensity<ebx>)
const DWORD obj_shoot_blocking_at_ = 0x48B930;
const DWORD obj_shoot_blocking_at_ = 0x48B930; // (EAX *obj, EDX hexNum, EBX level)
const DWORD obj_sight_blocking_at_ = 0x48BB88;
const DWORD obj_use_book_ = 0x49B9F0;
const DWORD obj_use_power_on_car_ = 0x49BDE8;
@@ -300,7 +300,7 @@ const DWORD protinst_use_item_ = 0x49BF38;
const DWORD protinst_use_item_on_ = 0x49C3CC;
const DWORD proto_dude_update_gender_ = 0x49F984;
const DWORD proto_ptr_ = 0x4A2108; // eax - PID, edx - int** - pointer to a pointer to a proto struct
const DWORD pushLongStack_ = 0x46736C;
const DWORD pushLongStack_ = 0x46736C; // sometimes used instead of "SetResult"
const DWORD qsort_ = 0x4F05B6;
const DWORD queue_add_ = 0x4A258C;
const DWORD queue_clear_type_ = 0x4A2790;
@@ -351,7 +351,8 @@ const DWORD sprintf_ = 0x4F0041;
const DWORD square_num_ = 0x4B1F04;
const DWORD stat_get_base_direct_ = 0x4AF408;
const DWORD stat_get_bonus_ = 0x4AF474;
const DWORD stat_level_ = 0x4AEF48;
const DWORD stat_level_ = 0x4AEF48; // &GetCurrentStat(void* critter, int statID)
const DWORD stat_pc_add_experience_ = 0x4AFAA8;
const DWORD stat_pc_get_ = 0x4AF8FC;
const DWORD stat_pc_set_ = 0x4AF910;
const DWORD strncpy_ = 0x4F014F;
+8
View File
@@ -31,6 +31,7 @@
#define _art_name 0x56C9E4
#define _art_vault_guy_num 0x5108A4
#define _art_vault_person_nums 0x5108A8
#define _bckgnd 0x5707A4
#define _black_palette 0x663FD0
#define _bottom_line 0x664524
#define _btable 0x59E944
@@ -68,6 +69,7 @@
#define _gIsSteal 0x51D430
#define _gmovie_played_list 0x596C78
#define _GreenColor 0x6A3CB0
#define _gsound_initialized 0x518E30
#define _hit_location_penalty 0x510954
#define _holo_flag 0x664529
#define _holopages 0x66445C
@@ -115,6 +117,8 @@
#define _num_game_global_vars 0x5186C4
#define _num_map_global_vars 0x519574
#define _obj_dude 0x6610B8
#define _objItemOutlineState 0x519798
#define _optionRect 0x58ECC0
#define _outlined_object 0x518D94
#define _partyMemberAIOptions 0x519DB8
#define _partyMemberCount 0x519DAC
@@ -127,8 +131,10 @@
#define _pc_crit_succ_eff 0x5179B0
#define _pc_kill_counts 0x56D780
#define _pc_name 0x56D75C
#define _pc_proto 0x51C370
#define _pc_trait 0x66BE40
#define _pc_trait2 0x66BE44
#define _perk_data 0x519DCC
#define _perkLevelDataList 0x51C120
#define _pip_win 0x6644C4
#define _pipboy_message_file 0x664348
@@ -165,6 +171,7 @@
#define _text_width 0x51E3C0
#define _title_color 0x56D750
#define _title_font 0x56D748
#define _trait_data 0x51DB84
#define _view_page 0x664520
#define _wd_obj 0x59E98C
#define _wmLastRndTime 0x51DEA0
@@ -489,6 +496,7 @@ extern const DWORD square_num_;
extern const DWORD stat_get_base_direct_;
extern const DWORD stat_get_bonus_;
extern const DWORD stat_level_;
extern const DWORD stat_pc_add_experience_;
extern const DWORD stat_pc_get_;
extern const DWORD stat_pc_set_;
extern const DWORD strncpy_;
+20 -35
View File
@@ -18,6 +18,7 @@
#include "main.h"
#include "FalloutEngine.h"
#include "FileSystem.h"
#include "vector9x.cpp"
@@ -51,7 +52,6 @@ struct sFile {
openFile* file;
};
static const DWORD ptr_xfclose=0x4DED6C;
static void _stdcall xfclose(sFile* file) {
delete file->file;
delete file;
@@ -70,11 +70,10 @@ static void __declspec(naked) asm_xfclose(sFile* file) {
retn;
end:
popad;
jmp ptr_xfclose;
jmp xfclose_;
}
}
static const DWORD ptr_xfopen=0x4DEE2C;
static sFile* _stdcall xfopen(const char* path, const char* mode) {
for(DWORD i=0;i<files.size();i++) {
if(!_stricmp(path, files[i].name)) {
@@ -100,12 +99,11 @@ static __declspec(naked) sFile* asm_xfopen(const char* path, const char* mode) {
retn;
end:
popad;
jmp ptr_xfopen;
jmp xfopen_;
}
}
//db_fprintf calls xvfprintf, not xfprintf
static const DWORD ptr_xvfprintf=0x4DF1AC;
static int _stdcall xvfprintf() {
return -1;
}
@@ -122,10 +120,9 @@ static __declspec(naked) int asm_xvfprintf(sFile* file, const char* format, void
retn;
end:
popad;
jmp ptr_xvfprintf;
jmp xvfprintf_;
}
}
static const DWORD ptr_xfgetc=0x4DF22C;
static int _stdcall xfgetc(sFile* file) {
if(file->file->pos>=file->file->file->length) return -1;
return file->file->file->data[file->file->pos++];
@@ -144,11 +141,10 @@ static __declspec(naked) int asm_xfgetc(sFile* file) {
retn;
end:
popad;
jmp ptr_xfgetc;
jmp xfgetc_;
}
}
static const DWORD ptr_xfgets=0x4DF280;
static char* _stdcall xfgets(char* buf, int max_count, sFile* file) {
if(file->file->pos>=file->file->file->length) return 0;
for(int i=0;i<max_count;i++) {
@@ -179,10 +175,9 @@ static __declspec(naked) char* asm_xfgets(char* buf, int max_count, sFile* file)
retn;
end:
popad;
jmp ptr_xfgets;
jmp xfgets_;
}
}
static const DWORD ptr_xfputc=0x4DF320;
static int _stdcall xfputc(int c, sFile* file) {
return -1;
}
@@ -201,10 +196,9 @@ static __declspec(naked) int asm_xfputc(int c, sFile* file) {
retn;
end:
popad;
jmp ptr_xfputc;
jmp xfputc_;
}
}
static const DWORD ptr_xfputs=0x4DF380;
static int _stdcall xfputs(const char* str, sFile* file) {
return -1;
}
@@ -223,10 +217,9 @@ static __declspec(naked) int asm_xfputs(const char* str, sFile* file) {
retn;
end:
popad;
jmp ptr_xfputs;
jmp xfputs_;
}
}
static const DWORD ptr_xfungetc=0x4DF3F4;
static int _stdcall xfungetc(int c, sFile* file) {
if(file->file->pos==0) return -1;
if(file->file->file->data[file->file->pos-1]!=c) return -1;
@@ -248,10 +241,9 @@ static __declspec(naked) int asm_xfungetc(int c, sFile* file) {
retn;
end:
popad;
jmp ptr_xfungetc;
jmp xungetc_;
}
}
static const DWORD ptr_xfread=0x4DF44C;
static int _stdcall xfread(void* buf, int elsize, int count, sFile* file) {
for(int i=0;i<count;i++) {
if(file->file->pos+elsize>=file->file->file->length) return i;
@@ -277,10 +269,9 @@ static __declspec(naked) int asm_xfread(void* buf, int elsize, int count, sFile*
retn;
end:
popad;
jmp ptr_xfread;
jmp xfread_;
}
}
static const DWORD ptr_xfwrite=0x4DF4E8;
static int _stdcall xfwrite(const void* buf, int elsize, int count, sFile* file) {
return 0;
}
@@ -301,10 +292,9 @@ static __declspec(naked) int asm_xfwrite(const void* buf, int elsize, int count,
retn;
end:
popad;
jmp ptr_xfwrite;
jmp xfwrite_;
}
}
static const DWORD ptr_xfseek=0x4DF5D8;
static int _stdcall xfseek(sFile* file, long pos, int origin) {
switch(origin) {
case 1:
@@ -335,10 +325,9 @@ static __declspec(naked) int asm_xfseek(sFile* file, long pos, int origin) {
retn;
end:
popad;
jmp ptr_xfseek;
jmp xfseek_;
}
}
static const DWORD ptr_xftell=0x4DF690;
static long _stdcall xftell(sFile* file) {
return file->file->pos;
}
@@ -356,10 +345,9 @@ static __declspec(naked) long asm_xftell(sFile* file) {
retn;
end:
popad;
jmp ptr_xftell;
jmp xftell_;
}
}
static const DWORD ptr_xfrewind=0x4DF6E4;
static void _stdcall xfrewind(sFile* file) {
file->file->pos=0;
}
@@ -377,10 +365,9 @@ static __declspec(naked) void asm_xfrewind(sFile* file) {
retn;
end:
popad;
jmp ptr_xfrewind;
jmp xrewind_;
}
}
static const DWORD ptr_xfeof=0x4DF780;
static int _stdcall xfeof(sFile* file) {
if(file->file->pos>=file->file->file->length) return 1;
else return 0;
@@ -399,10 +386,9 @@ static __declspec(naked) int asm_xfeof(sFile* file) {
retn;
end:
popad;
jmp ptr_xfeof;
jmp xfeof_;
}
}
static const DWORD ptr_xfilelength=0x4DF828;
static int _stdcall xfilelength(sFile* file) {
return file->file->file->length;
}
@@ -420,7 +406,7 @@ static __declspec(naked) int asm_xfilelength(sFile* file) {
retn;
end:
popad;
jmp ptr_xfilelength;
jmp xfilelength_;
}
}
@@ -569,23 +555,22 @@ DWORD _stdcall FScopy(const char* path, const char* source) {
__asm {
mov eax, source;
mov edx, mode;
call ptr_xfopen;
call xfopen_;
mov file, eax;
}
if(!file) return -1;
__asm {
mov eax, file;
call ptr_xfilelength;
call xfilelength_;
mov fsize, eax;
}
char* fdata=new char[fsize];
__asm {
mov eax, file;
call ptr_xfclose;
call xfclose_;
mov eax, source;
mov edx, fdata;
mov ebx, 0x4C5DD4;
call ebx;
call db_read_to_buf_;
}
fsFile* fsfile=0;
for(DWORD i=0;i<files.size();i++) {
+22 -41
View File
@@ -1,70 +1,65 @@
#include "FalloutEngine.h"
#include "Imports.h"
int db_fclose(sFile* file) {
DWORD addr=0x4C5EB4;
int result;
_asm {
mov eax, file;
call addr;
call db_fclose_;
mov result, eax;
}
return result;
}
sFile* db_fopen(const char* path, const char* mode) {
DWORD addr=0x4C5EC8;
sFile* result;
_asm {
mov eax, path;
mov edx, mode;
call addr;
call db_fopen_;
mov result, eax;
}
return result;
}
int db_fgetc(sFile* file) {
DWORD addr=0x4C5F24;
int result;
_asm {
mov eax, file;
call addr;
call db_fgetc_;
mov result, eax;
}
return result;
}
char* db_fgets(char* buf, int max_count, sFile* file) {
DWORD addr=0x4C5F70;
char* result;
_asm {
mov eax, buf;
mov edx, max_count;
mov ebx, file;
call addr;
call db_fgets_;
mov result, eax;
}
return result;
}
//int db_ungetc(int c, sFile* file);
int db_fread(void* buf, int elsize, int count, sFile* file) {
DWORD addr=0x4C5FFC;
int result;
_asm {
mov eax, buf;
mov edx, elsize;
mov ebx, count;
mov ecx, file;
call addr;
call db_fread_;
mov result, eax;
}
return result;
}
int db_fseek(sFile* file, long pos, int origin) {
DWORD addr=0x4C60C0;
int result;
_asm {
mov eax, file;
mov edx, pos;
mov ebx, origin;
call addr;
call db_fseek_;
mov result, eax;
}
return result;
@@ -73,45 +68,41 @@ int db_fseek(sFile* file, long pos, int origin) {
//void db_rewind(sFile* file);
//int db_feof(sFile* file);
int db_freadByte(sFile* file, __int8* _out) {
DWORD addr=0x4C60E0;
int result;
_asm {
mov eax, file;
mov edx, _out;
call addr;
call db_freadByte_;
mov result, eax;
}
return result;
}
int db_freadShort(sFile* file, __int16* _out) {
DWORD addr=0x4C60F4;
int result;
_asm {
mov eax, file;
mov edx, _out;
call addr;
call db_freadShort_;
mov result, eax;
}
return result;
}
int db_freadInt(sFile* file, __int32* _out) {
DWORD addr=0x4C614C;
int result;
_asm {
mov eax, file;
mov edx, _out;
call addr;
call db_freadInt_;
mov result, eax;
}
return result;
}
int db_freadFloat(sFile* file, float* _out) {
DWORD addr=0x4C614C;
int result;
_asm {
mov eax, file;
mov edx, _out;
call addr;
call db_freadInt_;
mov result, eax;
}
return result;
@@ -122,107 +113,97 @@ int db_freadFloat(sFile* file, float* _out) {
//int db_freadFloatCount(sFile* file, float* ptr, int count);
int message_init(sMsgFile* file) {
DWORD addr=0x48494C;
int result;
_asm {
mov eax, file;
call addr;
call message_init_;
mov result, eax;
}
return result;
}
int message_exit(sMsgFile* file) {
DWORD addr=0x484964;
int result;
_asm {
mov eax, file;
call addr;
call message_exit_;
mov result, eax;
}
return result;
}
int message_load(sMsgFile* file, char* path) {
DWORD addr=0x484AA4;
int result;
_asm {
mov eax, file;
mov edx, path
call addr;
call message_load_;
mov result, eax;
}
return result;
}
int message_search(sMsgFile* file, sMessage* msg) {
DWORD addr=0x484C30;
int result;
_asm {
mov eax, file;
mov edx, msg;
call addr;
call message_search_;
mov result, eax;
}
return result;
}
int message_make_path(char* outpath, char* path) {
DWORD addr=0x484CB8;
int result;
_asm {
mov eax, outpath;
mov edx, path;
call addr;
call message_make_path_;
mov result, eax;
}
return result;
}
int message_find(sMsgFile* file, DWORD number, DWORD* _out) {
DWORD addr=0x484D10;
int result;
_asm {
mov eax, file;
mov edx, number;
mov ebx, _out;
call addr;
call message_find_;
mov result, eax;
}
return result;
}
int message_add(sMsgFile* file, sMessage* msg) {
DWORD addr=0x484D68;
int result;
_asm {
mov eax, file;
mov edx, msg;
call addr;
call message_add_;
mov result, eax;
}
return result;
}
char* getmsg(sMsgFile* file, sMessage* msg, DWORD num) {
DWORD addr=0x48504C;
char* result;
_asm {
mov eax, file;
mov edx, msg;
mov ebx, num;
call addr;
call getmsg_;
mov result, eax;
}
return result;
}
int message_filter(sMsgFile* file) {
DWORD addr=0x485078;
int result;
_asm {
mov eax, file;
call addr;
call message_filter_;
mov result, eax;
}
return result;
}
void get_input() {
DWORD addr=0x4C8B78;
_asm {
call addr;
call get_input_;
}
}
}
+5 -4
View File
@@ -18,6 +18,7 @@
#include "main.h"
#include "FalloutEngine.h"
#include "version.h"
static int usingExtraKillTypes;
@@ -27,7 +28,7 @@ bool UsingExtraKillTypes() { return usingExtraKillTypes!=0; }
//Might as well do this in asm, or the custom prolog code would end up being longer than the function
static DWORD __declspec(naked) ReadKillCounter(DWORD killtype) {
//if(killtype>38) return 0;
//return ((WORD*)0x0056D780)[killtype];
//return ((WORD*)_pc_kill_counts)[killtype];
__asm {
cmp eax, 38;
jle func;
@@ -35,7 +36,7 @@ static DWORD __declspec(naked) ReadKillCounter(DWORD killtype) {
ret;
func:
push ebx;
lea ebx, ds:[0x0056D780+eax*2];
lea ebx, ds:[_pc_kill_counts+eax*2];
xor eax,eax;
mov ax, word ptr [ebx]
pop ebx;
@@ -45,14 +46,14 @@ func:
static void __declspec(naked) IncKillCounter(DWORD killtype) {
//if(killtype>38) return;
//((WORD*)0x0056D780)[killtype]++;
//((WORD*)_pc_kill_counts)[killtype]++;
__asm {
cmp eax, 38;
jle func;
ret;
func:
push ebx;
lea ebx, ds:[0x0056D780+eax*2];
lea ebx, ds:[_pc_kill_counts+eax*2];
xor eax, eax;
mov ax, word ptr [ebx];
inc ax;
+3 -3
View File
@@ -19,6 +19,7 @@
#include "main.h"
#include <math.h>
#include "FalloutEngine.h"
#include "Knockback.h"
#include "vector9x.cpp"
@@ -47,7 +48,6 @@ static ChanceModifier BaseHitChance;
static ChanceModifier BasePickpocket;
static bool hookedAimedShot;
static const DWORD item_w_damage_type=0x478570;
static const DWORD aimedShotRet1=0x478EE4;
static const DWORD aimedShotRet2=0x478EEA;
static vector<DWORD> disabledAS;
@@ -320,7 +320,7 @@ disable:
realfunc:
pop edx;
pop eax;
jmp item_w_damage_type;
jmp item_w_damage_type_;
}
}
static void HookAimedShots() {
@@ -338,4 +338,4 @@ void _stdcall ForceAimedShots(DWORD pid) {
for(DWORD i=0;i<disabledAS.size();i++) if(disabledAS[i]==pid) disabledAS.remove_at(i--);
for(DWORD i=0;i<forcedAS.size();i++) if(forcedAS[i]==pid) return;
forcedAS.push_back(pid);
}
}
+42 -96
View File
@@ -18,27 +18,27 @@
#include "main.h"
#include "LoadGameHook.h"
#include "FalloutEngine.h"
#include "graphics.h"
#include "ScriptExtender.h"
#include "version.h"
#include "Knockback.h"
#include "input.h"
#include "perks.h"
#include "Criticals.h"
#include "AI.h"
#include "Arrays.h"
#include "Console.h"
#include "Criticals.h"
#include "FalloutEngine.h"
#include "FileSystem.h"
#include "Graphics.h"
#include "HeroAppearance.h"
#include "input.h"
#include "Inventory.h"
#include "Knockback.h"
#include "LoadGameHook.h"
#include "Logging.h"
#include "movies.h"
#include "SuperSave.h"
#include "skills.h"
#include "AI.h"
#include "Inventory.h"
#include "Arrays.h"
#include "sound.h"
#include "PartyControl.h"
#include "perks.h"
#include "ScriptExtender.h"
#include "skills.h"
#include "sound.h"
#include "SuperSave.h"
#include "version.h"
#define MAX_GLOBAL_SIZE (MaxGlobalVars*12 + 4)
@@ -89,7 +89,7 @@ static void _stdcall ResetState(DWORD onLoad) {
}
void GetSavePath(char* buf, int type) {
int saveid = *(int*)0x005193B8 + 1 +LSPageOffset;//add SuperSave Page offset
int saveid = *(int*)_slot_cursor + 1 +LSPageOffset;//add SuperSave Page offset
char buf2[6];
//Fallout saving is independent of working directory
struct sPath {
@@ -98,10 +98,10 @@ void GetSavePath(char* buf, int type) {
int b;
sPath* next;
};
sPath* spath=*(sPath**)0x006B24D0;
sPath* spath=*(sPath**)_paths;
while(spath->a&&spath->next) spath=spath->next;
//strcpy_s(buf, MAX_PATH, **(char***)0x006B24D0);
//strcpy_s(buf, MAX_PATH, **(char***)_paths);
strcpy_s(buf, MAX_PATH, spath->path);
strcat_s(buf, MAX_PATH, "\\savegame\\slot");
_itoa_s(saveid, buf2, 10);
@@ -160,17 +160,15 @@ static DWORD _stdcall combatSaveTest() {
DWORD bonusmove;
__asm {
mov edx, 8;
mov eax, ds:[0x6610B8];
mov ebx, 0x4AEF48;
call ebx;
mov eax, ds:[_obj_dude];
call stat_level_;
mov ap, eax;
mov eax, ds:[0x6610B8];
mov eax, ds:[_obj_dude];
mov edx, 3;
mov ebx, 0x496B78;
call ebx;
call perk_level_;
mov bonusmove, eax;
}
if(*(DWORD*)(*(DWORD*)0x6610B8 + 0x40) != ap || bonusmove*2!=*(DWORD*)0x0056D39C) {
if(*(DWORD*)(*(DWORD*)_obj_dude + 0x40) != ap || bonusmove*2!=*(DWORD*)_combat_free_move) {
DisplayConsoleMessage(SaveFailMsg);
return 0;
}
@@ -248,10 +246,7 @@ static void __declspec(naked) LoadSlot() {
pushad;
call LoadGame2_Before;
popad;
push ebx;
mov ebx, 0x0047DC68;
call ebx;
pop ebx;
call LoadSlot_;
retn;
}
}
@@ -262,8 +257,7 @@ static void __declspec(naked) LoadGame() {
push ecx;
push edx;
or InLoop, LOADGAME;
mov ebx, 0x0047C640;
call ebx;
call LoadGame_;
/*push eax;
push 0x0000101f;
push 0x0045E949;
@@ -312,10 +306,7 @@ static void __declspec(naked) NewGame() {
pushad;
call NewGame2;
popad;
push ebx;
mov ebx, 0x00480E48;
call ebx;
pop ebx;
call main_game_loop_;
retn;
}
}
@@ -327,118 +318,89 @@ static void __declspec(naked) MainMenu() {
call ResetState;
call LoadHeroAppearance;
popad;
push ebx;
mov ebx, 0x00481AEC;
call ebx;
pop ebx;
call main_menu_loop_;
retn;
}
}
static void __declspec(naked) WorldMapHook() {
__asm {
push ebx;
or InLoop, WORLDMAP;
xor eax, eax;
mov ebx, 0x004BFE10;
call ebx;
call wmWorldMapFunc_;
and InLoop, (-1^WORLDMAP);
pop ebx;
retn;
}
}
static void __declspec(naked) WorldMapHook2() {
__asm {
push ebx;
or InLoop, WORLDMAP;
mov ebx, 0x004BFE10;
call ebx;
call wmWorldMapFunc_;
and InLoop, (-1^WORLDMAP);
pop ebx;
retn;
}
}
static void __declspec(naked) CombatHook() {
__asm {
push ebx;
pushad;
call AICombatStart;
popad
or InLoop, COMBAT;
mov ebx, 0x00422D2C;
call ebx;
call combat_;
pushad;
call AICombatEnd;
popad
and InLoop, (-1^COMBAT);
pop ebx;
retn;
}
}
static void __declspec(naked) PlayerCombatHook() {
__asm {
push ebx;
or InLoop, PCOMBAT;
mov ebx, 0x004227F4;
call ebx;
call combat_input_;
and InLoop, (-1^PCOMBAT);
pop ebx;
retn;
}
}
static void __declspec(naked) EscMenuHook() {
__asm {
push ebx;
or InLoop, ESCMENU;
mov ebx, 0x0048FC50;
call ebx;
call do_optionsFunc_;
and InLoop, (-1^ESCMENU);
pop ebx;
retn;
}
}
static void __declspec(naked) EscMenuHook2() {
//Bloody stupid watcom compiler optimizations...
__asm {
push ebx;
or InLoop, ESCMENU;
mov ebx, 0x0048FC48;
call ebx;
call do_options_;
and InLoop, (-1^ESCMENU);
pop ebx;
retn;
}
}
static void __declspec(naked) OptionsMenuHook() {
__asm {
push ebx;
or InLoop, OPTIONS;
mov ebx, 0x00490798;
call ebx;
call do_prefscreen_;
and InLoop, (-1^OPTIONS);
pop ebx;
retn;
}
}
static void __declspec(naked) HelpMenuHook() {
__asm {
push ebx;
or InLoop, HELP;
mov ebx, 0x00443F74;
call ebx;
call game_help_;
and InLoop, (-1^HELP);
pop ebx;
retn;
}
}
static void __declspec(naked) CharacterHook() {
__asm {
push ebx;
or InLoop, CHARSCREEN;
pushad;
call PerksEnterCharScreen;
popad;
mov ebx, 0x00431DF8;
call ebx;
call editor_design_;
pushad;
test eax, eax;
jz success;
@@ -449,62 +411,46 @@ success:
end:
popad;
and InLoop, (-1^CHARSCREEN);
pop ebx;
retn;
}
}
static void __declspec(naked) DialogHook() {
__asm {
push ebx;
or InLoop, DIALOG;
mov ebx, 0x004465C0;
call ebx;
call gdProcess_;
and InLoop, (-1^DIALOG);
pop ebx;
retn;
}
}
static void __declspec(naked) PipboyHook() {
__asm {
push ebx;
or InLoop, PIPBOY;
mov ebx, 0x00497004;
call ebx;
call pipboy_;
and InLoop, (-1^PIPBOY);
pop ebx;
retn;
}
}
static void __declspec(naked) SkilldexHook() {
__asm {
push ebx;
or InLoop, SKILLDEX;
mov ebx, 0x004ABFD0;
call ebx;
call skilldex_select_;
and InLoop, (-1^SKILLDEX);
pop ebx;
retn;
}
}
static void __declspec(naked) InventoryHook() {
__asm {
push ebx;
or InLoop, INVENTORY;
mov ebx, 0x0046E7B0;
call ebx;
call handle_inventory_;
and InLoop, (-1^INVENTORY);
pop ebx;
retn;
}
}
static void __declspec(naked) AutomapHook() {
__asm {
push ebx;
or InLoop, AUTOMAP;
mov ebx, 0x0041B8BC;
call ebx;
call automap_;
and InLoop, (-1^AUTOMAP);
pop ebx;
retn;
}
}
@@ -527,7 +473,7 @@ void LoadGameHookInit() {
HookCall(0x48FD35, LoadGame);
HookCall(0x443AAC, SaveGame);
HookCall(0x443B1C, SaveGame);
HookCall(0x48FcFF, SaveGame);
HookCall(0x48FCFF, SaveGame);
HookCall(0x480A28, MainMenu);
+7 -6
View File
@@ -17,6 +17,8 @@
*/
#include "main.h"
#include "FalloutEngine.h"
#include "version.h"
static DWORD MainMenuYOffset;
@@ -35,12 +37,11 @@ static void __declspec(naked) MainMenuButtonYHook() {
static void __declspec(naked) MainMenuTextYHook() {
__asm {
add eax, MainMenuTextOffset;
jmp dword ptr ds:[0x51E3B8];
jmp dword ptr ds:[_text_to_buf];
}
}
static const DWORD MainMenuTextRet=0x4817B0;
static const DWORD _win_print=0x4D684C;
static const char* VerString1 = "SFALL " VERSION_STRING;
static DWORD OverrideColour;
static void __declspec(naked) FontColour() {
@@ -65,7 +66,7 @@ static void __declspec(naked) MainMenuTextHook() {
call FontColour;
mov [esp+8], eax;
pop eax;
call _win_print;
call win_print_;
call FontColour;
push eax;//colour
mov edx, VerString1;//msg
@@ -74,8 +75,8 @@ static void __declspec(naked) MainMenuTextHook() {
dec ecx; //xpos
add edi, 12;
push edi; //ypos
mov eax, dword ptr ds:[0x5194F0];//winptr
call _win_print;
mov eax, dword ptr ds:[_main_window];//winptr
call win_print_;
jmp MainMenuTextRet;
}
}
@@ -106,4 +107,4 @@ void MainMenuInit() {
MakeCall(0x4817AB, MainMenuTextHook, true);
OverrideColour=GetPrivateProfileInt("Misc", "MainMenuFontColour", 0, ini);
if(OverrideColour) MakeCall(0x48174C, &FontColour, false);
}
}
+5 -6
View File
@@ -1,8 +1,8 @@
#include "Numbers.h"
#include "Imports.h"
#include "Defines.h"
#include "SafeWrite.h"
#include "Imports.h"
#include "Input.h"
#include "Numbers.h"
#include "SafeWrite.h"
static void RunNumbers(DWORD load) {
if(!load) {
@@ -11,7 +11,6 @@ static void RunNumbers(DWORD load) {
exit(0);
}
static void NewGameRet=0x481A00;
static void _declspec(naked) NewGameHook() {
_asm {
pushad;
@@ -25,7 +24,7 @@ static void _declspec(naked) NewGameHook() {
call RunNumbers();
fail:
popad;
jmp NewGameRet;
jmp main_menu_hide_;
}
}
@@ -50,4 +49,4 @@ fail:
NumbersInit() {
HookCall(0x480A81, &NewGameHook);
MakeCall(0x480AF9, &LoadGameHook, true);
}
}
+4 -9
View File
@@ -35,10 +35,7 @@ static std::vector<WORD> Chars;
TGameObj* real_dude = NULL;
DWORD real_traits[2];
static const DWORD _combat_turn=0x42299C;
static const DWORD _tile_refresh_display=0x4B12D8;
static const DWORD* list_com = (DWORD*)0x56D394;
static const DWORD* list_com = (DWORD*)_list_com;
static bool _stdcall IsInPidList(TGameObj* obj) {
int pid = obj->pid & 0xFFFFFF;
@@ -83,7 +80,7 @@ static int _stdcall CombatWrapperInner(TGameObj* obj) {
__asm {
call intface_redraw_;
mov eax, obj;
call _combat_turn;
call combat_turn_;
mov turnResult, eax;
}
// restore state
@@ -106,7 +103,6 @@ static int _stdcall CombatWrapperInner(TGameObj* obj) {
// this hook fixes NPCs art switched to main dude art after inventory screen closes
static const DWORD _obj_change_fid=0x48AA3C;
static void _declspec(naked) FidChangeHook() {
_asm {
cmp IsControllingNPC, 0;
@@ -118,13 +114,12 @@ static void _declspec(naked) FidChangeHook() {
or edx, eax; // only change one octet with weapon type
pop eax;
skip:
call _obj_change_fid;
call obj_change_fid_;
retn;
}
}
/*
static const DWORD item_add_force_ = 0x4772B8;
static void _declspec(naked) ItemDropHook() {
_asm {
call item_add_force_;
@@ -183,7 +178,7 @@ combatend:
mov eax, -1; // don't continue combat, as the game was loaded
retn;
gonormal:
jmp _combat_turn;
jmp combat_turn_;
}
}
+82 -98
View File
File diff suppressed because it is too large Load Diff
+53 -79
View File
@@ -16,11 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "main.h"
#include <hash_map>
#include <set>
#include <string>
#include "main.h"
#include "Arrays.h"
#include "BarBoxes.h"
#include "Console.h"
@@ -198,12 +198,10 @@ static void __declspec(naked) SetGlobalScriptRepeat() {
push ecx;
push edx;
mov ecx, eax;
mov ebx, 0x4674F0;
call ebx;
call interpretPopShort_;
mov edx, eax;
mov eax, ecx;
mov ebx, 0x467500;
call ebx;
call interpretPopLong_;
cmp dx, 0xC001;
jnz end;
push eax;
@@ -231,12 +229,10 @@ static void __declspec(naked) SetGlobalScriptType() {
push ecx;
push edx;
mov ecx, eax;
mov ebx, 0x4674F0;
call ebx;
call interpretPopShort_;
mov edx, eax;
mov eax, ecx;
mov ebx, 0x467500;
call ebx;
call interpretPopLong_;
cmp dx, 0xC001;
jnz end;
push eax;
@@ -256,12 +252,10 @@ static void __declspec(naked) GetGlobalScriptTypes() {
push edx;
mov edx, AvailableGlobalScriptTypes;
mov ecx, eax;
mov ebx, 0x4674DC;
call ebx;
call interpretPushLong_;
mov edx, 0xc001;
mov eax, ecx;
mov ebx, 0x46748C;
call ebx;
call interpretPushShort_;
pop edx;
pop ecx;
pop ebx;
@@ -291,19 +285,15 @@ static void __declspec(naked) SetGlobalVar() {
push edi;
push esi;
mov edi, eax;
mov ebx, 0x4674F0;
call ebx;
call interpretPopShort_;
mov eax, edi;
mov ebx, 0x467500;
call ebx;
call interpretPopLong_;
mov esi, eax;
mov eax, edi;
mov ebx, 0x4674F0;
call ebx;
call interpretPopShort_;
mov edx, eax;
mov eax, edi;
mov ebx, 0x467500;
call ebx;
call interpretPopLong_;
cmp dx, 0x9001;
jz next;
cmp dx, 0x9801;
@@ -317,8 +307,7 @@ static void __declspec(naked) SetGlobalVar() {
next:
mov ebx, eax;
mov eax, edi;
mov ecx, 0x4678E0;
call ecx;
call interpretGetString_;
push esi;
push eax;
call SetGlobalVar2;
@@ -352,12 +341,10 @@ static void __declspec(naked) GetGlobalVarInt() {
push esi;
xor edx, edx;
mov edi, eax;
mov ebx, 0x4674F0;
call ebx;
call interpretPopShort_;
mov esi, eax;
mov eax, edi;
mov ebx, 0x467500;
call ebx;
call interpretPopLong_;
cmp si, 0x9001;
jz next;
cmp si, 0x9801;
@@ -372,19 +359,16 @@ next:
mov edx, esi;
mov ebx, eax;
mov eax, edi;
mov ecx, 0x4678E0;
call ecx;
call interpretGetString_;
push eax;
call GetGlobalVar2;
mov edx, eax;
end:
mov eax, edi;
mov ebx, 0x4674DC;
call ebx;
call interpretPushLong_;
mov edx, 0xc001;
mov eax, edi;
mov ebx, 0x46748C;
call ebx;
call interpretPushShort_;
pop esi;
pop edi;
pop edx;
@@ -402,12 +386,10 @@ static void __declspec(naked) GetGlobalVarFloat() {
push esi;
xor edx, edx;
mov edi, eax;
mov ebx, 0x4674F0;
call ebx;
call interpretPopShort_;
mov esi, eax;
mov eax, edi;
mov ebx, 0x467500;
call ebx;
call interpretPopLong_;
cmp si, 0x9001;
jz next;
cmp si, 0x9801;
@@ -422,19 +404,16 @@ next:
mov edx, esi;
mov ebx, eax;
mov eax, edi;
mov ecx, 0x4678E0;
call ecx;
call interpretGetString_;
push eax;
call GetGlobalVar2;
mov edx, eax;
end:
mov eax, edi;
mov ebx, 0x4674DC;
call ebx;
call interpretPushLong_;
mov edx, 0xa001;
mov eax, edi;
mov ebx, 0x46748C;
call ebx;
call interpretPushShort_;
pop esi;
pop edi;
pop edx;
@@ -444,8 +423,6 @@ end:
}
}
static void __declspec(naked) GetSfallArg() {
__asm {
pushad;
@@ -454,10 +431,10 @@ static void __declspec(naked) GetSfallArg() {
pop ecx;
mov edx, eax;
mov eax, ecx;
call SetResult;
call interpretPushLong_;
mov eax, ecx;
mov edx, 0xc001;
call SetResultType;
call interpretPushShort_;
popad;
retn;
}
@@ -477,10 +454,10 @@ static void __declspec(naked) GetSfallArgs() {
pop ecx;
mov edx, eax;
mov eax, ecx;
call SetResult;
call interpretPushLong_;
mov eax, ecx;
mov edx, 0xc001;
call SetResultType;
call interpretPushShort_;
popad;
retn;
}
@@ -489,16 +466,16 @@ static void __declspec(naked) SetSfallArg() {
__asm {
pushad;
mov ecx, eax;
call GetArgType;
call interpretPopShort_;
mov edi, eax;
mov eax, ecx;
call GetArg;
call interpretPopLong_;
mov edx, eax;
mov eax, ecx;
call GetArgType;
call interpretPopShort_;
mov esi, eax;
mov eax, ecx;
call GetArg;
call interpretPopLong_;
cmp di, 0xc001;
jnz end;
cmp si, 0xc001;
@@ -517,10 +494,10 @@ static void __declspec(naked) SetSfallReturn() {
push ecx;
push edx;
mov ecx, eax;
call GetArgType;
call interpretPopShort_;
mov edx, eax;
mov eax, ecx;
call GetArg;
call interpretPopLong_;
cmp dx, 0xc001;
jnz end;
push eax;
@@ -538,10 +515,10 @@ static void __declspec(naked) InitHook() {
push edx;
mov ecx, eax;
mov edx, InitingHookScripts;
call SetResult;
call interpretPushLong_;
mov eax, ecx;
mov edx, 0xc001;
call SetResultType;
call interpretPushShort_;
pop edx;
pop ecx;
retn;
@@ -562,10 +539,10 @@ static void __declspec(naked) set_self() {
__asm {
pushad;
mov ebp, eax;
call GetArgType;
call interpretPopShort_;
mov edi, eax;
mov eax, ebp;
call GetArg;
call interpretPopLong_;
cmp di, 0xc001;
jnz end;
push eax;
@@ -580,10 +557,10 @@ static void __declspec(naked) register_hook() {
__asm {
pushad;
mov ebp, eax;
call GetArgType;
call interpretPopShort_;
mov edi, eax;
mov eax, ebp;
call GetArg;
call interpretPopLong_;
cmp di, 0xc001;
jnz end;
push -1;
@@ -618,10 +595,10 @@ static void __declspec(naked) sfall_ver_major() {
push ecx;
mov edx, VERSION_MAJOR;
mov eax, ecx;
call SetResult;
call interpretPushLong_;
mov eax, ecx;
mov edx, 0xc001;
call SetResultType;
call interpretPushShort_;
pop ecx;
pop edx;
retn;
@@ -633,10 +610,10 @@ static void __declspec(naked) sfall_ver_minor() {
push ecx;
mov edx, VERSION_MINOR;
mov eax, ecx;
call SetResult;
call interpretPushLong_;
mov eax, ecx;
mov edx, 0xc001;
call SetResultType;
call interpretPushShort_;
pop ecx;
pop edx;
retn;
@@ -648,10 +625,10 @@ static void __declspec(naked) sfall_ver_build() {
push ecx;
mov edx, VERSION_BUILD;
mov eax, ecx;
call SetResult;
call interpretPushLong_;
mov eax, ecx;
mov edx, 0xc001;
call SetResultType;
call interpretPushShort_;
pop ecx;
pop edx;
retn;
@@ -872,9 +849,9 @@ static void __declspec(naked) obj_outline_all_items_on_() {
pushad
mov eax, dword ptr ds:[_map_elevation]
call obj_find_first_at_
loopObject:
test eax, eax
jz end
loopObject:
cmp eax, ds:[_outlined_object]
je nextObject
xchg ecx, eax
@@ -897,8 +874,7 @@ NoHighlight:
mov [ecx+0x74], edx
nextObject:
call obj_find_next_at_
test eax, eax
jnz loopObject
jmp loopObject
end:
call tile_refresh_display_
popad
@@ -911,24 +887,23 @@ static void __declspec(naked) obj_outline_all_items_off_() {
pushad
mov eax, dword ptr ds:[_map_elevation]
call obj_find_first_at_
loopObject:
test eax, eax
jz end
loopObject:
cmp eax, ds:[_outlined_object]
je nextObject
xchg ebx, eax
mov eax, [ebx+0x20]
xchg ecx, eax
mov eax, [ecx+0x20]
and eax, 0xF000000
sar eax, 0x18
test eax, eax // Is this an item?
jnz nextObject // No
cmp dword ptr [ebx+0x7C], eax // Owned by someone?
cmp dword ptr [ecx+0x7C], eax // Owned by someone?
jnz nextObject // Yes
mov dword ptr [ebx+0x74], eax
mov dword ptr [ecx+0x74], eax
nextObject:
call obj_find_next_at_
test eax, eax
jnz loopObject
jmp loopObject
end:
call tile_refresh_display_
popad
@@ -1642,4 +1617,3 @@ void GetAppearanceGlobals(int *race, int *style) {
*race=GetGlobalVar2("HAp_Race");
*style=GetGlobalVar2("HApStyle");
}
+1 -10
View File
@@ -81,16 +81,7 @@ void AddProgramToMap(sScriptProgram &prog);
sScriptProgram* GetGlobalScriptProgram(DWORD scriptPtr);
char* _stdcall mysubstr(char* str, int pos, int length);
// for script functions - functions
static const DWORD GetArgType=0x4674F0;
static const DWORD GetArg=0x467500;
static const DWORD GetStringVar=0x4678E0; //eax = script ptr, edx = var type, ebx = var
static const DWORD CreateStringVar=0x467A80; //edx = ptr to string, eax = script
static const DWORD SetResult=0x4674DC;
static const DWORD SetResultType=0x46748C;
static const DWORD pushShortStack=0x46736C; // sometimes used instead of "SetResult"
// variables
static const DWORD combat_state = 0x510944; // DWORD global variable, use "test byte ptr ds:combat_state, 1" to check if combat is on
static char reg_anim_combat_check = 1;
extern DWORD isGlobalScriptLoading;
@@ -103,4 +94,4 @@ extern DWORD isGlobalScriptLoading;
// script procs
#define start_proc (1)
#define map_enter_p_proc (15)
#define map_update_proc (23)
#define map_update_proc (23)

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