Code refactoring in Arrays.cpp & ScriptArrays.hpp.

Added new example mods gl_ammomod & gl_highlighting_lite to modderspack.
Renamed Bugs.cpp to BugFixes.cpp.
This commit is contained in:
NovaRain
2019-05-05 10:11:36 +08:00
parent 40ed445956
commit 64e4daeb02
23 changed files with 781 additions and 64 deletions
@@ -0,0 +1,201 @@
;Glovz's Damage Fix
; PID_EXPLOSIVE_ROCKET
[1]
pid=14
ac_adjust=-10
dr_adjust=0
dam_mult=1
dam_div=1
; PID_10MM_JHP
[2]
pid=29
ac_adjust=0
dr_adjust=0
dam_mult=2
dam_div=1
; PID_10MM_AP
[3]
pid=30
ac_adjust=-5
dr_adjust=0
dam_mult=1
dam_div=2
; PID_44_MAGNUM_JHP
[4]
pid=31
ac_adjust=0
dr_adjust=-10
dam_mult=2
dam_div=1
; PID_FLAMETHROWER_FUEL
[5]
pid=32
ac_adjust=-20
dr_adjust=0
dam_mult=1
dam_div=1
; PID_14MM_AP
[6]
pid=33
ac_adjust=-5
dr_adjust=-30
dam_mult=1
dam_div=2
; PID_223_FMJ
[7]
pid=34
ac_adjust=-15
dr_adjust=-15
dam_mult=2
dam_div=2
; PID_5MM_JHP
[8]
pid=35
ac_adjust=0
dr_adjust=-15
dam_mult=2
dam_div=1
; PID_5MM_AP
[9]
pid=36
ac_adjust=-5
dr_adjust=-15
dam_mult=1
dam_div=2
; PID_ROCKET_AP
[10]
pid=37
ac_adjust=-10
dr_adjust=0
dam_mult=1
dam_div=2
; PID_SMALL_ENERGY_CELL
[11]
pid=38
ac_adjust=-20
dr_adjust=0
dam_mult=2
dam_div=1
; PID_MICRO_FUSION_CELL
[12]
pid=39
ac_adjust=-20
dr_adjust=0
dam_mult=2
dam_div=1
; PID_SHOTGUN_SHELLS
[13]
pid=95
ac_adjust=-15
dr_adjust=0
dam_mult=3
dam_div=1
; PID_44_FMJ_MAGNUM
[14]
pid=111
ac_adjust=-5
dr_adjust=-10
dam_mult=2
dam_div=2
; PID_9MM_BALL
[15]
pid=121
ac_adjust=0
dr_adjust=0
dam_mult=1
dam_div=1
; PID_BBS
[16]
pid=163
ac_adjust=0
dr_adjust=0
dam_mult=1
dam_div=1
; PID_ROBO_ROCKET_AMMO
[17]
pid=274
ac_adjust=-10
dr_adjust=-10
dam_mult=1
dam_div=1
; PID_45_CALIBER_AMMO
[18]
pid=357
ac_adjust=0
dr_adjust=-5
dam_mult=2
dam_div=1
; PID_2MM_EC_AMMO
[19]
pid=358
ac_adjust=-25
dr_adjust=-20
dam_mult=1
dam_div=3
; PID_4_7MM_CASELESS
[20]
pid=359
ac_adjust=-5
dr_adjust=-25
dam_mult=1
dam_div=2
; PID_9MM_AMMO
[21]
pid=360
ac_adjust=0
dr_adjust=0
dam_mult=2
dam_div=1
; PID_HN_NEEDLER_CARTRIDGE
[22]
pid=361
ac_adjust=-20
dr_adjust=-5
dam_mult=1
dam_div=1
; PID_HN_AP_NEEDLER_CARTRIDGE
[23]
pid=362
ac_adjust=-20
dr_adjust=-5
dam_mult=1
dam_div=2
; PID_7_62MM_AMMO
[24]
pid=363
ac_adjust=-10
dr_adjust=-20
dam_mult=2
dam_div=2
; PID_FLAMETHROWER_FUEL_MK_II
[25]
pid=382
ac_adjust=-20
dr_adjust=-15
dam_mult=1
dam_div=1
+201
View File
@@ -0,0 +1,201 @@
;YAAM
; PID_EXPLOSIVE_ROCKET
[1]
pid=14
ac_adjust=0
dr_adjust=0
dam_mult=3
dam_div=2
; PID_10MM_JHP
[2]
pid=29
ac_adjust=0
dr_adjust=0
dam_mult=3
dam_div=2
; PID_10MM_AP
[3]
pid=30
ac_adjust=0
dr_adjust=4
dam_mult=1
dam_div=1
; PID_44_MAGNUM_JHP
[4]
pid=31
ac_adjust=0
dr_adjust=0
dam_mult=3
dam_div=2
; PID_FLAMETHROWER_FUEL
[5]
pid=32
ac_adjust=-20
dr_adjust=0
dam_mult=3
dam_div=4
; PID_14MM_AP
[6]
pid=33
ac_adjust=0
dr_adjust=8
dam_mult=1
dam_div=1
; PID_223_FMJ
[7]
pid=34
ac_adjust=-20
dr_adjust=5
dam_mult=1
dam_div=1
; PID_5MM_JHP
[8]
pid=35
ac_adjust=0
dr_adjust=0
dam_mult=3
dam_div=2
; PID_5MM_AP
[9]
pid=36
ac_adjust=0
dr_adjust=4
dam_mult=1
dam_div=1
; PID_ROCKET_AP
[10]
pid=37
ac_adjust=0
dr_adjust=20
dam_mult=1
dam_div=1
; PID_SMALL_ENERGY_CELL
[11]
pid=38
ac_adjust=0
dr_adjust=0
dam_mult=1
dam_div=1
; PID_MICRO_FUSION_CELL
[12]
pid=39
ac_adjust=0
dr_adjust=0
dam_mult=1
dam_div=1
; PID_SHOTGUN_SHELLS
[13]
pid=95
ac_adjust=-10
dr_adjust=0
dam_mult=1
dam_div=1
; PID_44_FMJ_MAGNUM
[14]
pid=111
ac_adjust=0
dr_adjust=5
dam_mult=1
dam_div=1
; PID_9MM_BALL
[15]
pid=121
ac_adjust=0
dr_adjust=2
dam_mult=3
dam_div=2
; PID_BBS
[16]
pid=163
ac_adjust=0
dr_adjust=0
dam_mult=1
dam_div=1
; PID_ROBO_ROCKET_AMMO
[17]
pid=274
ac_adjust=0
dr_adjust=10
dam_mult=1
dam_div=1
; PID_45_CALIBER_AMMO
[18]
pid=357
ac_adjust=0
dr_adjust=0
dam_mult=1
dam_div=1
; PID_2MM_EC_AMMO
[19]
pid=358
ac_adjust=-30
dr_adjust=9
dam_mult=3
dam_div=2
; PID_4_7MM_CASELESS
[20]
pid=359
ac_adjust=-5
dr_adjust=7
dam_mult=3
dam_div=2
; PID_9MM_AMMO
[21]
pid=360
ac_adjust=0
dr_adjust=2
dam_mult=1
dam_div=1
; PID_HN_NEEDLER_CARTRIDGE
[22]
pid=361
ac_adjust=-10
dr_adjust=2
dam_mult=1
dam_div=1
; PID_HN_AP_NEEDLER_CARTRIDGE
[23]
pid=362
ac_adjust=-10
dr_adjust=5
dam_mult=2
dam_div=1
; PID_7_62MM_AMMO
[24]
pid=363
ac_adjust=-5
dr_adjust=2
dam_mult=1
dam_div=1
; PID_FLAMETHROWER_FUEL_MK_II
[25]
pid=382
ac_adjust=-20
dr_adjust=0
dam_mult=1
dam_div=1
Binary file not shown.
@@ -0,0 +1,63 @@
/*
Ammo INI Loader mod for Fallout 2 by NovaRain
---------------------------------------------
- modifies ammo protos with data from an INI file:
* AmmoGlovz.ini if DamageFormula=1 or 2 in ddraw.ini
* AmmoYAAM.ini if DamageFormula=5 in ddraw.ini
* AmmoMod.ini if not using any bulit-in damage formula
Requires sfall 3.5 or higher
*/
#include "..\headers\define_extra.h"
procedure set_ammo_mod;
procedure start;
procedure map_enter_p_proc;
variable ammoIni;
variable enabled;
procedure set_ammo_mod begin
variable pid, dmg_mod, i := 1;
while (i > 0) do begin
pid := get_ini_setting(ammoIni + "|" + i + "|pid");
if (pid < 1) then break;
set_proto_data(pid, PROTO_AM_AC_MOD, get_ini_setting(ammoIni + "|" + i + "|ac_adjust"));
set_proto_data(pid, PROTO_AM_DR_MOD, get_ini_setting(ammoIni + "|" + i + "|dr_adjust"));
// dam_mult and dam_div must be positive integers
dmg_mod := get_ini_setting(ammoIni + "|" + i + "|dam_mult");
if (dmg_mod < 1) then dmg_mod := 1;
set_proto_data(pid, PROTO_AM_DMG_MULT, dmg_mod);
dmg_mod := get_ini_setting(ammoIni + "|" + i + "|dam_div");
if (dmg_mod < 1) then dmg_mod := 1;
set_proto_data(pid, PROTO_AM_DMG_DIV, dmg_mod);
i++;
end
//debug_msg("AmmoMod: " + ammoIni + " - set " + (i - 1) + " ammo protos.");
end
procedure start begin
if game_loaded then begin
ammoIni := get_ini_setting("ddraw.ini|Misc|DamageFormula");
switch (ammoIni) begin
case 1: ammoIni := "AmmoGlovz.ini";
case 2: ammoIni := "AmmoGlovz.ini";
case 5: ammoIni := "AmmoYAAM.ini";
default: ammoIni := "AmmoMod.ini";
end
enabled := get_ini_setting(ammoIni + "|1|pid");
if (enabled > 0) then call set_ammo_mod;
end
end
procedure map_enter_p_proc begin
if (enabled > 0) then call set_ammo_mod;
end
+12
View File
@@ -0,0 +1,12 @@
Ammo INI Loader mod for Fallout 2 by NovaRain
---------------------------------------------
- modifies ammo protos with data from an INI file:
* AmmoGlovz.ini if DamageFormula=1 or 2 in ddraw.ini
* AmmoYAAM.ini if DamageFormula=5 in ddraw.ini
* AmmoMod.ini if not using any bulit-in damage formula
Requires sfall 3.5 or higher.
To use, copy gl_ammomod.int to your scripts folder, and copy the INI files to the same directory as sfall.
@@ -0,0 +1,120 @@
/**
Item Highlight mod (Lite version)
A cut-down version of the mod included in sfall 4.x, offers a bit more features than the built-in function.
Features:
- highlighting items, containers (optional) and lootable corpses (optional) on the ground
- configurable hotkey is used to trigger highlight
- only objects in direct line-of-sight of player are highlighted (optional)
- motion scanner is required to enable highlight (optional)
- motion scanner charges are decreased on each use (optional)
Requires sfall 3.8.12 or higher
NOTE: this script requires compiler from sfall modderspack with -s option
(short circuit evaluation)
version 1.1
**/
#include "main.h"
//#include "..\..\..\!SRC\headers\define.h"
#define CRITTER_IS_DEAD (1)
#define PID_MOTION_SENSOR (59)
#define NO_HIGHLIGHT(obj) (get_flags(obj) bwand FLAG_NOHIGHLIGHT)
#define NO_STEAL(obj) (get_proto_data(obj_pid(obj), PROTO_CR_FLAGS) bwand CFLG_NOSTEAL)
variable configSection := "Highlighting";
variable highlightKey;
variable isHighlight;
variable alsoContainer;
variable alsoCorpse;
variable checkLOS;
variable outlineColor;
variable motionScanner;
variable highlightFailMsg1;
variable highlightFailMsg2;
procedure ToggleHighlightObject(variable obj, variable enable) begin
if obj and (not enable or not checkLOS or not obj_blocking_line(dude_obj, tile_num(obj), BLOCKING_TYPE_SHOOT)) then begin
if (alsoContainer and obj_item_subtype(obj) == item_type_container) or (not NO_HIGHLIGHT(obj)) then begin
if (enable) then set_outline(obj, outlineColor);
else set_outline(obj, 0);
end
end
end
procedure ToggleHighlight(variable enable) begin
variable obj;
foreach obj in list_as_array(LIST_GROUNDITEMS) begin
if obj != outlined_object then begin
call ToggleHighlightObject(obj, enable);
end
end
if (alsoCorpse) then begin
foreach obj in list_as_array(LIST_CRITTERS) begin
if critter_state(obj) == CRITTER_IS_DEAD and not NO_STEAL(obj) then begin
call ToggleHighlightObject(obj, enable);
end
end
end
tile_refresh_display;
end
procedure KeyPressHandler begin
variable pressed := get_sfall_arg,
scanCode := get_sfall_arg,
scanner, charges;
if scanCode == highlightKey and not(get_game_mode bwand (INTFACELOOT bwor BARTER)) then begin
if pressed then begin
isHighlight := true;
if motionScanner then begin
scanner := obj_carrying_pid_obj(dude_obj, PID_MOTION_SENSOR);
if scanner then begin
if motionScanner >= 2 then begin
charges := get_weapon_ammo_count(scanner);
if charges > 0 then begin
set_weapon_ammo_count(scanner, charges - 1);
intface_redraw;
call ToggleHighlight(true);
end else begin
display_msg(highlightFailMsg2);
end
end else begin
call ToggleHighlight(true);
end
end else begin
display_msg(highlightFailMsg1);
end
end else begin
call ToggleHighlight(true);
end
end else begin
isHighlight := false;
call ToggleHighlight(false);
end
end
end
procedure start begin
if game_loaded and (sfall_ver_major < 4) then begin
call InitConfigs;
highlightKey := GetConfig(configSection, "Key", 0);
alsoContainer := GetConfig(configSection, "Containers", 0);
alsoCorpse := GetConfig(configSection, "Corpses", 0);
checkLOS := GetConfig(configSection, "CheckLOS", 0);
outlineColor := GetConfig(configSection, "OutlineColor", 16);
if (outlineColor < 1) then outlineColor := 64;
motionScanner := GetConfig(configSection, "MotionScanner", 0);
highlightFailMsg1 := Translate("HighlightFail1", "You aren't carrying a motion sensor.");
highlightFailMsg2 := Translate("HighlightFail2", "Your motion sensor is out of charge.");
register_hook_proc(HOOK_KEYPRESS, KeyPressHandler);
end
end
@@ -0,0 +1,57 @@
#include "..\scripting\headers\sfall.h"
#include "..\scripting\headers\define_lite.h"
#include "..\scripting\headers\define_extra.h"
#include "..\scripting\headers\lib.arrays.h"
#include "..\scripting\headers\lib.strings.h"
// #include "..\scripting\headers\lib.inven.h"
variable ini := "sfall-mods.ini";
variable translationIni;
// Gets the integer value from ini
procedure GetConfig(variable section, variable key, variable def) begin
variable val := get_ini_setting(ini + "|" + section + "|" + key);
if val == -1 then val := def;
return val;
end
// Gets the string value from ini
procedure GetConfigStr(variable section, variable key, variable def) begin
variable val := get_ini_string(ini + "|" + section + "|" + key);
if val == -1 or val == "" then val := def;
return val;
end
// Gets the value from ini as a temp array of strings
procedure GetConfigList(variable section, variable key) begin
variable val := get_ini_string(ini + "|" + section + "|" + key);
if val == -1 or val == "" then return [];
return string_split(val, ",");
end
// Gets the value from ini as a temp array of ints
procedure GetConfigListInt(variable section, variable key) begin
variable arr, i, item;
arr := GetConfigList(section, key);
for (i := 0; i < len_array(arr); i++) begin
arr[i] := atoi(arr[i]);
end
return arr;
end
// Translates given string using Translations.ini
procedure Translate(variable id, variable def) begin
variable str := get_ini_string(translationIni + "|Sfall|" + id);
if not str or (strlen(str) == 0) then begin
str := def;
end
return str;
end
procedure InitConfigs begin
translationIni := GetConfigStr("Main", "TranslationsINI", "./Translations.ini");
end
@@ -0,0 +1,21 @@
Item Highlight mod (Lite version) for sfall 3.8.x
-------------------------------------------------
A cut-down version of the mod included in sfall 4.x, offers a bit more features than the built-in function.
Features:
- highlighting items, containers (optional) and lootable corpses (optional) on the ground
- configurable hotkey is used to trigger highlight
- only objects in direct line-of-sight of player are highlighted (optional)
- motion scanner is required to enable highlight (optional)
- motion scanner charges are decreased on each use (optional)
Requires sfall 3.8.12 or higher.
To use, copy gl_highlighting_lite.int to your scripts folder, and copy sfall-mods.ini to the same directory as sfall.
Also, you should disable the built-in function in ddraw.ini (ToggleItemHighlightsKey=0).
Note that due to the lack of newer game hooks in sfall 3.8.x, there are some minor visual glitches with the lite version:
- items will be kept highlighted when entering combat while holding the highlight key.
- when you pick up items while holding the highlight key, they will be kept highlighted if you drop them on the ground.
Both glitches can bo solved by pressing and releasing the highlight key again.
@@ -0,0 +1,30 @@
[Highlighting]
; DX scancode of a key to press to highlight items on the ground
; 42 - SHIFT key
Key=42
; Set to 1 to also highlight containers
Containers=1
; Set to 1 to also highlight lootable corpses
Corpses=1
; Set to 1 to only highlight objects in the player's line-of-sight
CheckLOS=0
; Set the color of outlines, available colors:
; 1 - glowing red
; 2 - red
; 4 - grey
; 8 - glowing green
; 16 - bright yellow
; 32 - dark yellow
; 64 - purple
OutlineColor=16
; Motion Scanner mode:
; 0 - ignored
; 1 - requires Motion Scanner present in player inventory to activate highlighting
; 2 - requires Motion Scanner and also requires 1 charge on every use (depleted scanner will not work anymore)
MotionScanner=0
+9
View File
@@ -440,6 +440,15 @@ void _stdcall FreeArray(DWORD id) {
}
}
void DeleteAllTempArrays() {
if (!tempArrays.empty()) {
for (std::set<DWORD>::iterator it = tempArrays.begin(); it != tempArrays.end(); ++it) {
FreeArray(*it);
}
tempArrays.clear();
}
}
DWORD _stdcall GetArrayKey(DWORD id, int index, DWORD* resultType) {
*resultType = VAR_TYPE_INT;
if (arrays.find(id) == arrays.end() || index < -1 || index > arrays[id].size()) return 0;
+3 -4
View File
@@ -2,7 +2,6 @@
#include "main.h"
#include <functional>
#include <unordered_map>
#include <set>
#define ARRAY_MAX_STRING (255) // maximum length of string to be stored as array key or value
#define ARRAY_MAX_SIZE (100000) // maximum number of array elements,
@@ -140,9 +139,6 @@ extern DWORD nextArrayID;
extern DWORD arraysBehavior;
// temp arrays: set of arrayId
extern std::set<DWORD> tempArrays;
// saved arrays: arrayKey => arrayId
extern ArrayKeysMap savedArrays;
@@ -166,6 +162,9 @@ DWORD _stdcall TempArray(DWORD len, DWORD flags);
// destroys array
void _stdcall FreeArray(DWORD id);
// destroy all temp arrays
void DeleteAllTempArrays();
/*
op_get_array_key can be used to iterate over all keys in associative array
*/
+2 -2
View File
@@ -1,6 +1,6 @@
#include "main.h"
#include "Bugs.h"
#include "BugFixes.h"
#include "Define.h"
#include "FalloutEngine.h"
#include "LoadGameHook.h"
@@ -2051,7 +2051,7 @@ bad:
}
}
void BugsInit()
void BugFixesInit()
{
// fix vanilla negate operator on float values
MakeCall(0x46AB68, NegateFixHack);
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
void BugsInit();
void BugFixesInit();
void DrugsSaveFix(HANDLE file);
bool DrugsLoadFix(HANDLE file);
+6 -8
View File
@@ -947,8 +947,8 @@ void __stdcall DialogOut(const char* text) {
long __fastcall WordWrap(const char* text, int maxWidth, DWORD* buf, BYTE* count) {
__asm {
mov eax, ecx;
mov ecx, count;
mov ebx, buf;
mov ecx, count;
call _word_wrap_;
}
}
@@ -960,21 +960,19 @@ void __stdcall RedrawWin(DWORD winRef) {
}
}
void __stdcall DisplayInventory(long inventoryOffset, long visibleOffset, long mode) {
void __fastcall DisplayInventory(long inventoryOffset, long visibleOffset, long mode) {
__asm {
mov ebx, mode;
mov edx, visibleOffset;
mov eax, inventoryOffset;
mov eax, ecx;
call display_inventory_;
}
}
void __stdcall DisplayTargetInventory(long inventoryOffset, long visibleOffset, DWORD* targetInventory, long mode) {
void __fastcall DisplayTargetInventory(long inventoryOffset, long visibleOffset, DWORD* targetInventory, long mode) {
__asm {
mov ecx, mode;
mov eax, ecx;
mov ebx, targetInventory;
mov edx, visibleOffset;
mov eax, inventoryOffset;
mov ecx, mode;
call display_target_inventory_;
}
}
+2 -2
View File
@@ -1015,9 +1015,9 @@ long __fastcall WordWrap(const char* text, int maxWidth, DWORD* buf, BYTE* count
void __stdcall RedrawWin(DWORD winRef);
void __stdcall DisplayInventory(long inventoryOffset, long visibleOffset, long mode);
void __fastcall DisplayInventory(long inventoryOffset, long visibleOffset, long mode);
void __stdcall DisplayTargetInventory(long inventoryOffset, long visibleOffset, DWORD* targetInventory, long mode);
void __fastcall DisplayTargetInventory(long inventoryOffset, long visibleOffset, DWORD* targetInventory, long mode);
long __stdcall StatLevel(TGameObj* critter, long statId);
+1 -1
View File
@@ -20,7 +20,7 @@
#include "AI.h"
#include "Arrays.h"
#include "Bugs.h"
#include "BugFixes.h"
#include "Console.h"
#include "Criticals.h"
#include "Define.h"
+2 -6
View File
@@ -20,7 +20,7 @@
#include <cassert>
#include <hash_map>
#include <set>
//#include <set>
#include <string>
#include "Arrays.h"
@@ -1853,11 +1853,7 @@ static void RunScript(sGlobalScript* script) {
- reset reg_anim_* combatstate checks
*/
static void ResetStateAfterFrame() {
if (!tempArrays.empty()) {
for (std::set<DWORD>::iterator it = tempArrays.begin(); it != tempArrays.end(); ++it)
FreeArray(*it);
tempArrays.clear();
}
DeleteAllTempArrays();
RegAnimCombatCheck(1);
}
+1 -1
View File
@@ -411,7 +411,7 @@ static void sf_display_stats() {
}
static void sf_inventory_redraw() {
int mode = -1;
int mode;
DWORD loopFlag = GetCurrentLoops();
if (loopFlag & INVENTORY) {
mode = 0;
+41 -31
View File
@@ -468,33 +468,36 @@ static void __declspec(naked) op_stack_array() {
}
// object LISTS
struct sList {
DWORD* obj;
TGameObj** obj;
DWORD len;
DWORD pos;
sList(const std::vector<DWORD>* vec) {
len=vec->size();
obj=new DWORD[len];
for(DWORD i=0;i<len;i++) obj[i]=(*vec)[i];
pos=0;
sList(const std::vector<TGameObj*>* vec) : pos(0) {
len = vec->size();
obj = new TGameObj*[len];
for (size_t i = 0; i < len; i++) {
obj[i] = (*vec)[i];
}
}
};
static void FillListVector(DWORD type, std::vector<DWORD>& vec) {
static void FillListVector(DWORD type, std::vector<TGameObj*>& vec) {
vec.reserve(100);
if (type == 6) {
DWORD scriptPtr, self_obj, programPtr;
for (int elev=0; elev<=2; elev++) {
TScript* scriptPtr;
TGameObj* self_obj;
TProgram* programPtr;
for (int elev = 0; elev <= 2; elev++) {
__asm {
mov eax, elev;
call scr_find_first_at_;
mov scriptPtr, eax;
}
while (scriptPtr != 0) {
self_obj = *(DWORD*)(scriptPtr + 0x34);
if (self_obj == 0) {
programPtr = *(DWORD*)(scriptPtr + 0x18);
while (scriptPtr != nullptr) {
self_obj = scriptPtr->self_obj;
if (self_obj == nullptr) {
programPtr = scriptPtr->program_ptr;
__asm {
mov eax, programPtr;
call scr_find_obj_from_program_;
@@ -508,28 +511,29 @@ static void FillListVector(DWORD type, std::vector<DWORD>& vec) {
}
}
}
} else if (type == 4) {
/*} else if (type == 4) {
DWORD** squares=(DWORD**)_squares;
for(int elv=0;elv<2;elv++) {
DWORD* esquares=squares[elv];
for(int tile=0;tile<10000;tile++) {
esquares[tile]=0x8f000002;
}
}
} else {
for(int elv=0;elv<3;elv++) {
for(int tile=0;tile<40000;tile++) {
DWORD obj;
}*/
} else if (type != 4) {
for (int elv = 0; elv < 3; elv++) {
for (int tile = 0; tile < 40000; tile++) {
TGameObj* obj;
__asm {
mov edx, tile;
mov eax, elv;
call obj_find_first_at_tile_;
mov obj, eax;
}
while(obj) {
DWORD otype = ((DWORD*)obj)[25];
otype = (otype&0xff000000) >> 24;
if(type==9 || (type==0&&otype==1) || (type==1&&otype==0) || (type>=2&&type<=5&&type==otype)) vec.push_back(obj);
while (obj) {
DWORD otype = obj->pid >> 24;
if (type == 9 || (type == 0 && otype == 1) || (type == 1 && otype == 0) || (type >= 2 && type <= 5 && type == otype)) {
vec.push_back(obj);
}
__asm {
call obj_find_next_at_tile_;
mov obj, eax;
@@ -539,29 +543,35 @@ static void FillListVector(DWORD type, std::vector<DWORD>& vec) {
}
}
}
static void* _stdcall list_begin2(DWORD type) {
std::vector<DWORD> vec = std::vector<DWORD>();
std::vector<TGameObj*> vec = std::vector<TGameObj*>();
FillListVector(type, vec);
sList* list=new sList(&vec);
sList* list = new sList(&vec);
return list;
}
static DWORD _stdcall list_as_array2(DWORD type) {
std::vector<DWORD> vec = std::vector<DWORD>();
std::vector<TGameObj*> vec = std::vector<TGameObj*>();
FillListVector(type, vec);
DWORD id=TempArray(vec.size(), 4);
for(DWORD i=0;i<vec.size();i++) {
size_t sz = vec.size();
DWORD id = TempArray(sz, 0);
for (size_t i = 0; i < sz; i++) {
arrays[id].val[i].set((long)vec[i]);
}
return id;
}
static DWORD _stdcall list_next2(sList* list) {
if(list->pos==list->len) return 0;
static TGameObj* _stdcall list_next2(sList* list) {
if (!list || list->pos == list->len) return 0;
else return list->obj[list->pos++];
}
static void _stdcall list_end2(sList* list) {
delete[] list->obj;
delete list;
}
static void __declspec(naked) list_begin() {
__asm {
pushad;

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