mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Implemented CodeType enums in some SafeWrite8
Replaced some SafeWriteX with SafeWriteBatch. Misc code edits to DebugEditor.cpp and ScriptExtender.cpp. Minor edits to documents.
This commit is contained in:
+1
-1
@@ -323,7 +323,7 @@ DialogueFix=1
|
||||
;Prevents you from using number keys to enter unvisited areas on a town map
|
||||
TownMapHotkeysFix=1
|
||||
|
||||
;Set to 1 to disable the horrigan encounter
|
||||
;Set to 1 to disable the Horrigan encounter
|
||||
DisableHorrigan=0
|
||||
|
||||
;Set to 1 to disable the random element in NPC levelling.
|
||||
|
||||
@@ -340,6 +340,9 @@ There are several changes in this version of sslc which may result in problems f
|
||||
=== Changelog ===
|
||||
=================
|
||||
|
||||
> sfall 4.2.7
|
||||
- added ability to declare local variables anywhere in the procedure body
|
||||
|
||||
> sfall 4.2.3
|
||||
- fixed compiler giving "assignment operator expected" error when a variable-like macro is not being defined properly
|
||||
- added new logical operators "AndAlso", "OrElse" for short-circuit evaluation of logical expressions
|
||||
|
||||
+13
-13
@@ -2732,7 +2732,7 @@ void BugFixesInit()
|
||||
// // removes this line by making unconditional jump:
|
||||
// if ( who == obj_dude )
|
||||
// dist -= 2 * perk_level_(obj_dude, PERK_sharpshooter);
|
||||
SafeWrite8(0x424527, 0xEB); // in detemine_to_hit_func_()
|
||||
SafeWrite8(0x424527, CODETYPE_JumpShort); // in detemine_to_hit_func_()
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
@@ -2786,7 +2786,7 @@ void BugFixesInit()
|
||||
// Fix for move_obj_inven_to_obj function
|
||||
HookCall(0x45C49A, op_move_obj_inven_to_obj_hook);
|
||||
SafeWrite16(0x45C496, 0x9090);
|
||||
SafeWrite8(0x45C4A3, 0x75); // jmp > jnz
|
||||
SafeWrite8(0x45C4A3, CODETYPE_JumpNZ); // jmp > jnz
|
||||
// Fix for drop_obj function
|
||||
HookCall(0x49B965, obj_drop_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
@@ -2897,7 +2897,7 @@ void BugFixesInit()
|
||||
|
||||
//if (GetConfigInt("Misc", "ShivPatch", 1)) {
|
||||
dlog("Applying shiv patch.", DL_INIT);
|
||||
SafeWrite8(0x477B2B, 0xEB);
|
||||
SafeWrite8(0x477B2B, CODETYPE_JumpShort);
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
@@ -2906,8 +2906,8 @@ void BugFixesInit()
|
||||
// http://teamx.ru/site_arc/smf/index.php-topic=398.0.htm
|
||||
SafeWrite16(0x46B35B, 0x1C60); // Fix problems with the temporary stack
|
||||
SafeWrite32(0x46B35D, 0x90909090);
|
||||
SafeWrite8(0x46DBF1, 0xEB); // Disable warnings
|
||||
SafeWrite8(0x46DDC4, 0xEB); // Disable warnings
|
||||
const DWORD execProcWarnAddr[] = {0x46DBF1, 0x46DDC4};
|
||||
SafeWriteBatch<BYTE>(CODETYPE_JumpShort, execProcWarnAddr); // Disable warnings
|
||||
SafeWrite8(0x4415CC, 0x00); // Prevent crashes when re-exporting
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
@@ -2930,7 +2930,7 @@ void BugFixesInit()
|
||||
MakeCall(0x42A14F, MultiHexCombatRunFix, 1);
|
||||
MakeCall(0x42A178, MultiHexCombatMoveFix, 1);
|
||||
// Check neighboring tiles to prevent critters from overlapping other object tiles when moving to the retargeted tile
|
||||
//SafeWrite16(0x42A3A6, 0xE889); // xor eax, eax > mov eax, ebp (fix retargeting tile for multihex critters)
|
||||
SafeWrite16(0x42A3A6, 0xE889); // xor eax, eax > mov eax, ebp (fix retargeting tile for multihex critters)
|
||||
HookCall(0x42A3A8, MultiHexRetargetTileFix); // cai_retargetTileFromFriendlyFire_
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
@@ -2969,8 +2969,8 @@ void BugFixesInit()
|
||||
// Fix for being unable to sell used geiger counters or stealth boys
|
||||
if (GetConfigInt("Misc", "CanSellUsedGeiger", 1)) {
|
||||
dlog("Applying fix for being unable to sell used geiger counters or stealth boys.", DL_INIT);
|
||||
SafeWrite8(0x478115, 0xBA);
|
||||
SafeWrite8(0x478138, 0xBA);
|
||||
const DWORD itemQueuedAddr[] = {0x478115, 0x478138};
|
||||
SafeWriteBatch<BYTE>(0xBA, itemQueuedAddr); // mov eax, 1 > mov edx, 1
|
||||
MakeJump(0x474D22, barter_attempt_transaction_hack);
|
||||
HookCall(0x4798B1, item_m_turn_off_hook);
|
||||
dlogr(" Done", DL_INIT);
|
||||
@@ -3113,8 +3113,8 @@ void BugFixesInit()
|
||||
// Fix broken op_obj_can_hear_obj_ function
|
||||
if (GetConfigInt("Misc", "ObjCanHearObjFix", 0)) {
|
||||
dlog("Applying obj_can_hear_obj fix.", DL_INIT);
|
||||
SafeWrite8(0x4583D8, 0x3B); // jz loc_458414
|
||||
SafeWrite8(0x4583DE, 0x74); // jz loc_458414
|
||||
SafeWrite8(0x4583D8, 0x3B); // jz loc_458414
|
||||
SafeWrite8(0x4583DE, CODETYPE_JumpZ); // jz loc_458414
|
||||
MakeCall(0x4583E0, op_obj_can_hear_obj_hack, 1);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
@@ -3180,7 +3180,7 @@ void BugFixesInit()
|
||||
if (GetConfigInt("Misc", "ActiveGeigerMsgs", 1)) {
|
||||
dlog("Applying active geiger counter messages patch.", DL_INIT);
|
||||
const DWORD activeGeigerAddr[] = {0x42D424, 0x42D444};
|
||||
SafeWriteBatch<BYTE>(0x74, activeGeigerAddr); // jnz > jz
|
||||
SafeWriteBatch<BYTE>(CODETYPE_JumpZ, activeGeigerAddr); // jnz > jz
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
// Display a pop-up message box about death from radiation
|
||||
@@ -3191,8 +3191,8 @@ void BugFixesInit()
|
||||
dlog("Applying AI drug use preference fix.", DL_INIT);
|
||||
MakeCall(0x42869D, ai_check_drugs_hack_break);
|
||||
MakeCall(0x4286AB, ai_check_drugs_hack_check);
|
||||
SafeWrite16(0x4286B0, 0x7490); // jnz > jz
|
||||
SafeWrite8(0x4286C5, 0x75); // jz > jnz
|
||||
SafeWrite16(0x4286B0, 0x7490); // jnz > jz
|
||||
SafeWrite8(0x4286C5, CODETYPE_JumpNZ); // jz > jnz
|
||||
MakeCall(0x4286C7, ai_check_drugs_hack_use);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
+1
-1
@@ -560,7 +560,7 @@ void CombatInit() {
|
||||
BodypartHitReadConfig();
|
||||
|
||||
// Remove the dependency of Body_Torso from Body_Uncalled
|
||||
SafeWrite8(0x423830, 0xEB); // compute_attack_
|
||||
SafeWrite8(0x423830, CODETYPE_JumpShort); // compute_attack_
|
||||
BlockCall(0x42303F); // block Body_Torso check (combat_attack_)
|
||||
SafeWrite8(0x42A713, 7); // Body_Uncalled > Body_Groin (ai_called_shot_)
|
||||
SafeWriteBatch<BYTE>(8, bodypartAddr); // replace Body_Torso with Body_Uncalled
|
||||
|
||||
+3
-3
@@ -256,9 +256,9 @@ static void CriticalTableOverride() {
|
||||
static void RemoveCriticalTimeLimitsPatch() {
|
||||
if (GetConfigInt("Misc", "RemoveCriticalTimelimits", 0)) {
|
||||
dlog("Removing critical time limits.", DL_INIT);
|
||||
SafeWrite8(0x424118, 0xEB); // jump to 0x424131
|
||||
SafeWrite16(0x4A3052, 0x9090);
|
||||
SafeWrite16(0x4A3093, 0x9090);
|
||||
SafeWrite8(0x424118, CODETYPE_JumpShort); // jump to 0x424131
|
||||
const DWORD rollChkCritAddr[] = {0x4A3052, 0x4A3093};
|
||||
SafeWriteBatch<WORD>(0x9090, rollChkCritAddr);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ static void RunEditorInternal(SOCKET &s) {
|
||||
}
|
||||
}
|
||||
int numCritters = vec.size();
|
||||
int numGlobals = *(int*)_num_game_global_vars;
|
||||
int numMapVars = *(int*)_num_map_global_vars;
|
||||
int numGlobals = *ptr_num_game_global_vars;
|
||||
int numMapVars = *ptr_num_map_global_vars;
|
||||
int numSGlobals = GetNumGlobals();
|
||||
int numArrays = GetNumArrays();
|
||||
|
||||
@@ -124,8 +124,8 @@ static void RunEditorInternal(SOCKET &s) {
|
||||
sArray* arrays = new sArray[numArrays];
|
||||
GetArrays((int*)arrays);
|
||||
|
||||
InternalSend(s, *(void**)_game_global_vars, 4 * numGlobals);
|
||||
InternalSend(s, *(void**)_map_global_vars, 4 * numMapVars);
|
||||
InternalSend(s, reinterpret_cast<void*>(*ptr_game_global_vars), 4 * numGlobals);
|
||||
InternalSend(s, reinterpret_cast<void*>(*ptr_map_global_vars), 4 * numMapVars);
|
||||
InternalSend(s, sglobals, sizeof(sGlobalVar) * numSGlobals);
|
||||
InternalSend(s, arrays, numArrays * sizeof(sArray));
|
||||
for (int i = 0; i < numCritters; i++) {
|
||||
@@ -142,12 +142,12 @@ static void RunEditorInternal(SOCKET &s) {
|
||||
case CODE_SET_GLOBAL:
|
||||
InternalRecv(s, &id, 4);
|
||||
InternalRecv(s, &val, 4);
|
||||
(*(DWORD**)_game_global_vars)[id] = val;
|
||||
*ptr_game_global_vars[id] = val;
|
||||
break;
|
||||
case CODE_SET_MAPVAR:
|
||||
InternalRecv(s, &id, 4);
|
||||
InternalRecv(s, &val, 4);
|
||||
(*(DWORD**)_map_global_vars)[id] = val;
|
||||
*ptr_map_global_vars[id] = val;
|
||||
break;
|
||||
case CODE_GET_CRITTER:
|
||||
InternalRecv(s, &id, 4);
|
||||
@@ -365,7 +365,7 @@ static void DebugModePatch() {
|
||||
SafeWrite32(0x4C6D9C, (DWORD)debugLog);
|
||||
if (dbgMode & 1) {
|
||||
SafeWrite16(0x4C6E75, 0x66EB); // jmps 0x4C6EDD
|
||||
SafeWrite8(0x4C6EF2, 0xEB);
|
||||
SafeWrite8(0x4C6EF2, CODETYPE_JumpShort);
|
||||
SafeWrite8(0x4C7034, 0x0);
|
||||
MakeCall(0x4DC319, win_debug_hook, 2);
|
||||
}
|
||||
@@ -394,7 +394,7 @@ static void DebugModePatch() {
|
||||
static void DontDeleteProtosPatch() {
|
||||
if (iniGetInt("Debugging", "DontDeleteProtos", 0, ddrawIniDef)) {
|
||||
dlog("Applying permanent protos patch.", DL_INIT);
|
||||
SafeWrite8(0x48007E, 0xEB);
|
||||
SafeWrite8(0x48007E, CODETYPE_JumpShort);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ DWORD* ptr_folder_card_title = reinterpret_cast<DWORD*>(_folder_card_ti
|
||||
DWORD* ptr_folder_card_title2 = reinterpret_cast<DWORD*>(_folder_card_title2);
|
||||
DWORD* ptr_frame_time = reinterpret_cast<DWORD*>(_frame_time);
|
||||
char* ptr_free_perk = reinterpret_cast<char*>(_free_perk);
|
||||
DWORD* ptr_game_global_vars = reinterpret_cast<DWORD*>(_game_global_vars);
|
||||
long** ptr_game_global_vars = reinterpret_cast<long**>(_game_global_vars); // dynamic array of size == num_game_global_vars
|
||||
DWORD* ptr_game_user_wants_to_quit = reinterpret_cast<DWORD*>(_game_user_wants_to_quit);
|
||||
DWORD* ptr_gcsd = reinterpret_cast<DWORD*>(_gcsd);
|
||||
DWORD* ptr_gdBarterMod = reinterpret_cast<DWORD*>(_gdBarterMod);
|
||||
@@ -123,7 +123,7 @@ DWORD* ptr_lsgwin = reinterpret_cast<DWORD*>(_lsgwin);
|
||||
DWORD* ptr_main_ctd = reinterpret_cast<DWORD*>(_main_ctd);
|
||||
DWORD* ptr_main_window = reinterpret_cast<DWORD*>(_main_window);
|
||||
DWORD* ptr_map_elevation = reinterpret_cast<DWORD*>(_map_elevation);
|
||||
DWORD* ptr_map_global_vars = reinterpret_cast<DWORD*>(_map_global_vars);
|
||||
long** ptr_map_global_vars = reinterpret_cast<long**>(_map_global_vars); // array
|
||||
PathNode** ptr_master_db_handle = reinterpret_cast<PathNode**>(_master_db_handle);
|
||||
DWORD* ptr_master_volume = reinterpret_cast<DWORD*>(_master_volume);
|
||||
DWORD* ptr_max = reinterpret_cast<DWORD*>(_max);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
@@ -355,7 +356,7 @@ extern DWORD* ptr_folder_card_title;
|
||||
extern DWORD* ptr_folder_card_title2;
|
||||
extern DWORD* ptr_frame_time;
|
||||
extern char* ptr_free_perk;
|
||||
extern DWORD* ptr_game_global_vars;
|
||||
extern long** ptr_game_global_vars; // dynamic array of size == num_game_global_vars
|
||||
extern DWORD* ptr_game_user_wants_to_quit;
|
||||
extern DWORD* ptr_gcsd;
|
||||
extern DWORD* ptr_gdBarterMod;
|
||||
@@ -405,7 +406,7 @@ extern DWORD* ptr_lsgwin;
|
||||
extern DWORD* ptr_main_ctd;
|
||||
extern DWORD* ptr_main_window;
|
||||
extern DWORD* ptr_map_elevation;
|
||||
extern DWORD* ptr_map_global_vars;
|
||||
extern long** ptr_map_global_vars; // array
|
||||
extern PathNode** ptr_master_db_handle;
|
||||
extern DWORD* ptr_master_volume;
|
||||
extern DWORD* ptr_max;
|
||||
|
||||
@@ -1442,7 +1442,7 @@ static void EnableHeroAppearanceMod() {
|
||||
MakeCall(0x4DEEE5, LoadNewHeroArt, 1);
|
||||
|
||||
// Divert critter frm file name function exit for file checking (art_get_name_)
|
||||
SafeWrite8(0x419520, 0xEB); // divert func exit
|
||||
SafeWrite8(0x419520, CODETYPE_JumpShort); // divert func exit
|
||||
SafeWrite32(0x419521, 0x9090903E);
|
||||
|
||||
// Check if new hero art exists otherwise use regular art (art_get_name_)
|
||||
@@ -1528,8 +1528,7 @@ static void EnableHeroAppearanceMod() {
|
||||
HookCall(0x42613A, FixPcCriticalHitMsg);
|
||||
|
||||
// Force Criticals For Testing
|
||||
//SafeWrite32(0x423A8F, 0x90909090);
|
||||
//SafeWrite32(0x423A93, 0x90909090);
|
||||
//SafeMemSet(0x423A8F, 0x90, 8);
|
||||
}
|
||||
|
||||
void HeroAppearanceModExit() {
|
||||
|
||||
+3
-4
@@ -641,10 +641,9 @@ void InventoryInit() {
|
||||
if (sizeLimitMode >= 4) {
|
||||
sizeLimitMode -= 4;
|
||||
// item_total_weight_ patch
|
||||
SafeWrite8(0x477EB3, 0xEB);
|
||||
SafeWrite8(0x477EF5, 0);
|
||||
SafeWrite8(0x477F11, 0);
|
||||
SafeWrite8(0x477F29, 0);
|
||||
SafeWrite8(0x477EB3, CODETYPE_JumpShort);
|
||||
const DWORD itemTotalWtAddr[] = {0x477EF5, 0x477F11, 0x477F29};
|
||||
SafeWriteBatch<BYTE>(0, itemTotalWtAddr);
|
||||
}
|
||||
invSizeMaxLimit = GetConfigInt("Misc", "CritterInvSizeLimit", 100);
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ static char karmaGainMsg[128];
|
||||
static char karmaLossMsg[128];
|
||||
|
||||
static DWORD __stdcall DrawCard() {
|
||||
int reputation = **(int**)_game_global_vars;
|
||||
int reputation = *ptr_game_global_vars[GVAR_PLAYER_REPUTATION];
|
||||
for (std::vector<KarmaFrmSetting>::const_iterator it = karmaFrms.begin(); it != karmaFrms.end(); ++it) {
|
||||
if (reputation < it->points) {
|
||||
return it->frm;
|
||||
|
||||
@@ -104,11 +104,12 @@ static void __stdcall ResetState(DWORD onLoad) { // OnGameReset & OnBeforeGameSt
|
||||
ResetExplosionRadius();
|
||||
BarBoxes_OnGameLoad();
|
||||
ScriptExtender_OnGameLoad();
|
||||
inLoop = 0;
|
||||
if (isDebug) {
|
||||
char* str = (onLoad) ? "on Load" : "on Exit";
|
||||
DebugPrintf("\n[SFALL: State reset %s]", str);
|
||||
}
|
||||
inLoop = 0;
|
||||
gameLoaded = false;
|
||||
}
|
||||
|
||||
void GetSavePath(char* buf, char* ftype) {
|
||||
|
||||
@@ -236,7 +236,7 @@ static void ScienceOnCrittersPatch() {
|
||||
HookCall(0x41276E, action_use_skill_on_hook_science);
|
||||
break;
|
||||
case 2:
|
||||
SafeWrite8(0x41276A, 0xEB);
|
||||
SafeWrite8(0x41276A, CODETYPE_JumpShort);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -285,7 +285,7 @@ static void InstantWeaponEquipPatch() {
|
||||
if (GetConfigInt("Misc", "InstantWeaponEquip", 0)) {
|
||||
//Skip weapon equip/unequip animations
|
||||
dlog("Applying instant weapon equip patch.", DL_INIT);
|
||||
SafeWriteBatch<BYTE>(0xEB, PutAwayWeapon); // jmps
|
||||
SafeWriteBatch<BYTE>(CODETYPE_JumpShort, PutAwayWeapon); // jmps
|
||||
BlockCall(0x472AD5); //
|
||||
BlockCall(0x472AE0); // invenUnwieldFunc_
|
||||
BlockCall(0x472AF0); //
|
||||
@@ -297,7 +297,7 @@ static void InstantWeaponEquipPatch() {
|
||||
static void DontTurnOffSneakIfYouRunPatch() {
|
||||
if (GetConfigInt("Misc", "DontTurnOffSneakIfYouRun", 0)) {
|
||||
dlog("Applying DontTurnOffSneakIfYouRun patch.", DL_INIT);
|
||||
SafeWrite8(0x418135, 0xEB);
|
||||
SafeWrite8(0x418135, CODETYPE_JumpShort);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
@@ -389,7 +389,7 @@ static void AlwaysReloadMsgs() {
|
||||
static void RemoveWindowRoundingPatch() {
|
||||
if (GetConfigInt("Misc", "RemoveWindowRounding", 1)) {
|
||||
const DWORD windowRoundingAddr[] = {0x4D6EDD, 0x4D6F12};
|
||||
SafeWriteBatch<BYTE>(0xEB, windowRoundingAddr);
|
||||
SafeWriteBatch<BYTE>(CODETYPE_JumpShort, windowRoundingAddr);
|
||||
//SafeWrite16(0x4B8090, 0x04EB); // jmps 0x4B8096 (old)
|
||||
}
|
||||
}
|
||||
@@ -476,7 +476,7 @@ static void F1EngineBehaviorPatch() {
|
||||
if (GetConfigInt("Misc", "Fallout1Behavior", 0)) {
|
||||
dlog("Applying Fallout 1 engine behavior patch.", DL_INIT);
|
||||
BlockCall(0x4A4343); // disable playing the final movie/credits after the endgame slideshow
|
||||
SafeWrite8(0x477C71, 0xEB); // disable halving the weight for power armor items
|
||||
SafeWrite8(0x477C71, CODETYPE_JumpShort); // disable halving the weight for power armor items
|
||||
HookCall(0x43F872, endgame_movie_hook); // play movie 10 or 11 based on the player's gender before the credits
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ void SetAutoUnjamLockTime(DWORD time) {
|
||||
}
|
||||
unjamTimeState = 1;
|
||||
} else {
|
||||
SafeWrite8(0x4831DA, 0xEB); // disable auto unjam
|
||||
SafeWrite8(0x4831DA, CODETYPE_JumpShort); // disable auto unjam
|
||||
unjamTimeState = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ static void NpcAutoLevelPatch() {
|
||||
npcAutoLevelEnabled = GetConfigInt("Misc", "NPCAutoLevel", 0) != 0;
|
||||
if (npcAutoLevelEnabled) {
|
||||
dlog("Applying NPC autolevel patch.", DL_INIT);
|
||||
SafeWrite8(0x495CFB, 0xEB); // jmps 0x495D28 (skip random check)
|
||||
SafeWrite8(0x495CFB, CODETYPE_JumpShort); // jmps 0x495D28 (skip random check)
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -673,7 +673,7 @@ static void PerkEngineInit() {
|
||||
|
||||
// perk_owed hooks
|
||||
MakeCall(0x4AFB2F, LevelUpHack, 1); // replaces 'mov edx, ds:[PlayerLevel]'
|
||||
SafeWrite8(0x43C2EC, 0xEB); // skip the block of code which checks if the player has gained a perk (now handled in level up code)
|
||||
SafeWrite8(0x43C2EC, CODETYPE_JumpShort); // skip the block of code which checks if the player has gained a perk (now handled in level up code)
|
||||
}
|
||||
|
||||
static void PerkSetup() {
|
||||
|
||||
+14
-12
@@ -1141,6 +1141,7 @@ static void __declspec(naked) CombatOverHook() {
|
||||
}
|
||||
|
||||
static void __declspec(naked) obj_outline_all_items_on() {
|
||||
using namespace Fields;
|
||||
__asm {
|
||||
pushadc;
|
||||
mov eax, ds:[_map_elevation];
|
||||
@@ -1151,7 +1152,7 @@ loopObject:
|
||||
cmp eax, ds:[_outlined_object];
|
||||
je nextObject;
|
||||
xchg ecx, eax;
|
||||
mov eax, [ecx + 0x20];
|
||||
mov eax, [ecx + artFid];
|
||||
and eax, 0xF000000;
|
||||
sar eax, 0x18;
|
||||
test eax, eax; // Is this an item?
|
||||
@@ -1160,25 +1161,25 @@ loopObject:
|
||||
jnz nextObject; // No
|
||||
cmp highlightCorpses, eax; // Highlight corpses?
|
||||
je nextObject; // No
|
||||
test byte ptr [ecx + 0x44], DAM_DEAD; // source.results & DAM_DEAD?
|
||||
test byte ptr [ecx + damageFlags], DAM_DEAD; // source.results & DAM_DEAD?
|
||||
jz nextObject; // No
|
||||
mov edx, 0x20; // _Steal flag
|
||||
mov eax, [ecx + 0x64]; // eax = source.pid
|
||||
mov edx, CFLG_NoSteal; // _Steal flag
|
||||
mov eax, [ecx + protoId]; // eax = source.pid
|
||||
call critter_flag_check_;
|
||||
test eax, eax; // Can't be stolen from?
|
||||
jnz nextObject; // Yes
|
||||
skip:
|
||||
cmp [ecx + 0x7C], eax; // Owned by someone?
|
||||
cmp [ecx + owner], eax; // Owned by someone?
|
||||
jnz nextObject; // Yes
|
||||
test [ecx + 0x74], eax; // Already outlined?
|
||||
test [ecx + outline], eax; // Already outlined?
|
||||
jnz nextObject; // Yes
|
||||
test byte ptr [ecx + 0x25], 0x10; // Is NoHighlight_ flag set (is this a container)?
|
||||
test byte ptr [ecx + flags + 1], 0x10; // Is NoHighlight_ flag set (is this a container)?
|
||||
jz NoHighlight; // No
|
||||
cmp highlightContainers, eax; // Highlight containers?
|
||||
je nextObject; // No
|
||||
NoHighlight:
|
||||
mov edx, outlineColor;
|
||||
mov [ecx + 0x74], edx;
|
||||
mov [ecx + outline], edx;
|
||||
nextObject:
|
||||
call obj_find_next_at_;
|
||||
jmp loopObject;
|
||||
@@ -1190,6 +1191,7 @@ end:
|
||||
}
|
||||
|
||||
static void __declspec(naked) obj_outline_all_items_off() {
|
||||
using namespace Fields;
|
||||
__asm {
|
||||
pushadc;
|
||||
mov eax, ds:[_map_elevation];
|
||||
@@ -1200,19 +1202,19 @@ loopObject:
|
||||
cmp eax, ds:[_outlined_object];
|
||||
je nextObject;
|
||||
xchg ecx, eax;
|
||||
mov eax, [ecx + 0x20];
|
||||
mov eax, [ecx + artFid];
|
||||
and eax, 0xF000000;
|
||||
sar eax, 0x18;
|
||||
test eax, eax; // Is this an item?
|
||||
jz skip; // Yes
|
||||
dec eax; // Is this a critter?
|
||||
jnz nextObject; // No
|
||||
test byte ptr [ecx + 0x44], DAM_DEAD; // source.results & DAM_DEAD?
|
||||
test byte ptr [ecx + damageFlags], DAM_DEAD; // source.results & DAM_DEAD?
|
||||
jz nextObject; // No
|
||||
skip:
|
||||
cmp [ecx + 0x7C], eax; // Owned by someone?
|
||||
cmp [ecx + owner], eax; // Owned by someone?
|
||||
jnz nextObject; // Yes
|
||||
mov [ecx + 0x74], eax;
|
||||
mov [ecx + outline], eax;
|
||||
nextObject:
|
||||
call obj_find_next_at_;
|
||||
jmp loopObject;
|
||||
|
||||
@@ -362,7 +362,7 @@ static void __cdecl IncNPCLevel(const char* fmt, const char* name) {
|
||||
//SafeMemSet(0x495C8C, 0x90, 6); // Check that the npc isn't already at its maximum level
|
||||
SafeMemSet(0x495CEC, 0x90, 6); // Check that the npc hasn't already levelled up recently
|
||||
if (!npcAutoLevelEnabled) {
|
||||
SafeWrite8(0x495CFB, 0xEB); // Disable random element
|
||||
SafeWrite8(0x495CFB, CODETYPE_JumpShort); // Disable random element
|
||||
}
|
||||
__asm mov [ebp + 0x150 - 0x28 + 16], 255; // set counter for exit loop
|
||||
} else {
|
||||
@@ -392,7 +392,7 @@ static void __stdcall op_inc_npc_level2() {
|
||||
data = 0x0130850F;
|
||||
SafeWriteBytes(0x495CEC, (BYTE*)&data, 6);
|
||||
if (!npcAutoLevelEnabled) {
|
||||
SafeWrite8(0x495CFB, 0x74);
|
||||
SafeWrite8(0x495CFB, CODETYPE_JumpZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -596,7 +596,7 @@ void SoundInit() {
|
||||
|
||||
//Yes, I did leave this in on purpose. Will be of use to anyone trying to add in the sound effects
|
||||
if (isDebug && iniGetInt("Debugging", "Test_ForceFloats", 0, ddrawIniDef)) {
|
||||
SafeWrite8(0x42B6F5, 0xEB); // bypass chance
|
||||
SafeWrite8(0x42B6F5, CODETYPE_JumpShort); // bypass chance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -307,8 +307,8 @@ static void WorldLimitsPatches() {
|
||||
|
||||
//if (GetConfigInt("Misc", "CitiesLimitFix", 0)) {
|
||||
dlog("Applying cities limit patch.", DL_INIT);
|
||||
if (*((BYTE*)0x4BF3BB) != 0xEB) {
|
||||
SafeWrite8(0x4BF3BB, 0xEB);
|
||||
if (*((BYTE*)0x4BF3BB) != CODETYPE_JumpShort) {
|
||||
SafeWrite8(0x4BF3BB, CODETYPE_JumpShort);
|
||||
}
|
||||
dlogr(" Done", DL_INIT);
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user