Skip to content

Commit 25678c0

Browse files
committed
Added caps shuffling to Duppo and San Fran merchants
(bartering with them will always have caps from tables.) Changed merchant inventory wipe to not run on first map enter. Set ProcessorIdle=1 in ddraw.ini to prevent potential issues on Win11.
1 parent 70f1b75 commit 25678c0

File tree

10 files changed

+77
-22
lines changed

10 files changed

+77
-22
lines changed

extra/package/ddraw.ini

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ OverrideArtCacheSize=1
1313
UseFileSystemOverride=1
1414
WorldMapSlots=21
1515
BoostScriptDialogLimit=1
16+
ProcessorIdle=1
1617

1718
[Scripts]
1819
IniConfigFolder=mods

scripts_src/headers/upu.h

+1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ end
155155
// call before restock
156156
procedure move_quest_items begin
157157
if wipe_inventory != 1 then return 0;
158+
if map_first_run then return 0;
158159
variable tmp_box := create_object(PID_FOOTLOCKER_CLEAN_LEFT, 5, 0);
159160
variable pid;
160161
variable pids := [

scripts_src/maps/ncr1.ssl

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
export variable cyber_dog_obj := 0;
4040
export variable i_duppo_table := 0;
41+
export variable i_duppo_tbl_1 := 0;
42+
export variable i_duppo_tbl_2 := 0;
4143
export variable i_duppo_talk := 0;
4244
export variable i_duppo_obj := 0;
4345

scripts_src/maps/sfchina.ssl

+4
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ procedure map_update_p_proc;
4343
procedure Initial_Inven;
4444

4545
export variable i_table_swap := 0;
46+
export variable i_gun_table_1 := 0;
47+
export variable i_gun_table_2 := 0;
4648
export variable i_gun_merchant := 0;
4749

4850
export variable i_lao_table_swap := 0;
51+
export variable i_lao_table_1 := 0;
52+
export variable i_lao_table_2 := 0;
4953
export variable i_lao_merchant := 0;
5054

5155
export variable i_dragon_obj := 0;

scripts_src/ncr/scduppo.ssl

+13-3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ procedure combat_p_proc;
102102
pointers and variables that need not be saved. If a variable
103103
Needs to be saved, make it a map variable (MVAR_) */
104104
import variable i_duppo_table;
105+
import variable i_duppo_tbl_1;
106+
import variable i_duppo_tbl_2;
105107
import variable i_duppo_talk;
106108
import variable i_duppo_obj;
107109

@@ -195,7 +197,7 @@ end
195197
written by designers are placed in here. Additionally, Reactions are generated and
196198
stored which affects player interactions. */
197199
procedure talk_p_proc begin
198-
variable obj;
200+
variable obj, caps;
199201

200202
Evil_Critter:=0;
201203
Slavery_Tolerant:=SLAVE_TOLERANT;
@@ -205,6 +207,14 @@ procedure talk_p_proc begin
205207

206208
GetReaction;
207209

210+
if (i_duppo_table == i_duppo_tbl_1) then begin
211+
obj := i_duppo_tbl_2;
212+
end else begin
213+
obj := i_duppo_tbl_1;
214+
end
215+
caps := item_caps_total(obj);
216+
self_caps_adjust(caps);
217+
item_caps_adjust(obj, -caps);
208218
move_obj_inven_to_obj(i_duppo_table, self_obj);
209219

210220
start_gdialog(NAME,self_obj,4,-1,-1);
@@ -215,8 +225,8 @@ procedure talk_p_proc begin
215225
set_local_var(LVAR_Herebefore, 1);
216226

217227
move_obj_inven_to_obj(self_obj, i_duppo_table);
218-
//self_caps_adjust(item_caps_total(i_duppo_table)); -comment out by NovaRain (expansion)
219-
//item_caps_adjust(i_duppo_table, -self_caps); -comment out by NovaRain (expansion)
228+
//self_caps_adjust(item_caps_total(i_duppo_table)); -comment out by NovaRain
229+
//item_caps_adjust(i_duppo_table, -self_caps); -comment out by NovaRain
220230
end
221231

222232
/* This procedure gets called only on the death of this NPC. Special things like

scripts_src/ncr/sidtbl.ssl

+7-3
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,19 @@
4040
#define LVAR_Restock_Time (7)
4141
#define LVAR_Restock_Time_Fix (8) //added by killap
4242

43+
#define DUPPO_TBL_1 17327
44+
#define DUPPO_TBL_2 17724
45+
4346
import variable i_duppo_table;
47+
import variable i_duppo_tbl_1;
48+
import variable i_duppo_tbl_2;
4449
import variable i_duppo_talk;
4550
import variable i_duppo_obj;
4651

4752
procedure start begin
4853
i_duppo_table := self_obj;
54+
if (self_tile == DUPPO_TBL_1) then i_duppo_tbl_1 := self_obj;
55+
if (self_tile == DUPPO_TBL_2) then i_duppo_tbl_2 := self_obj;
4956
end
5057

5158
/********************************************************************
@@ -148,9 +155,6 @@ procedure map_enter_p_proc begin
148155
restock_fix
149156
if (local_var(LVAR_Restock_Time) < game_time) then begin
150157

151-
#define DUPPO_TBL_1 17327
152-
#define DUPPO_TBL_2 17724
153-
154158
//Tools & ammo
155159
if (self_tile == DUPPO_TBL_1) then begin
156160
tmp_box := move_quest_items();

scripts_src/sanfran/fcgunmer.ssl

+24-12
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ procedure Node014;
9494
Needs to be saved, make it a map variable (MVAR_) */
9595

9696
import variable i_table_swap;
97+
import variable i_gun_table_1;
98+
import variable i_gun_table_2;
9799
import variable i_gun_merchant;
98100

99101

@@ -126,16 +128,15 @@ procedure map_enter_p_proc begin
126128
if (not is_loading_game) then begin
127129
if (game_time > local_var(LVAR_Restock_Money)) then begin
128130
if (self_caps < 5000) then
129-
item_caps_adjust(i_table_swap, Random(2000, 5000)); //edit by killap (expansion) - was self_obj
131+
item_caps_adjust(i_table_swap, Random(2000, 5000)); //edit by killap - was self_obj
130132
set_local_var(LVAR_Restock_Money, game_time + (ONE_GAME_WEEK * Random(1, 3)));
131133
end
132134
end
133135

134-
i_gun_merchant := self_obj; //added by killap (expansion)
135-
136+
i_gun_merchant := self_obj; //added by killap
136137
end
137138

138-
//added by killap (expansion)
139+
//added by killap
139140
procedure map_update_p_proc begin
140141
if (i_gun_merchant <= 0) then
141142
i_gun_merchant := self_obj;
@@ -184,6 +185,8 @@ end
184185
written by designers are placed in here. Additionally, Reactions are generated and
185186
stored which affects player interactions. */
186187
procedure talk_p_proc begin
188+
variable obj, caps;
189+
187190
Evil_Critter:=0;
188191
Slavery_Tolerant:=SLAVE_TOLERANT;
189192
Karma_Perception:=KARMA_PERCEPTION1;
@@ -192,14 +195,23 @@ procedure talk_p_proc begin
192195

193196
GetReaction;
194197

195-
//set_local_var(LVAR_Money, self_caps); -comment out by killap (expansion)
196-
//self_caps_adjust(-local_var(LVAR_Money)); -comment out by killap (expansion)
198+
//set_local_var(LVAR_Money, self_caps); -comment out by killap
199+
//self_caps_adjust(-local_var(LVAR_Money)); -comment out by killap
197200

198201
move_obj_inven_to_obj(self_obj, swap_obj);
199202
move_obj_inven_to_obj(i_table_swap, self_obj);
200203

201-
//self_caps_adjust(local_var(LVAR_Money)); -comment out by killap (expansion)
202-
//set_local_var(LVAR_Money, 0); -comment out by killap (expansion)
204+
if (i_table_swap == i_gun_table_1) then begin
205+
obj := i_gun_table_2;
206+
end else begin
207+
obj := i_gun_table_1;
208+
end
209+
caps := item_caps_total(obj);
210+
self_caps_adjust(caps);
211+
item_caps_adjust(obj, -caps);
212+
213+
//self_caps_adjust(local_var(LVAR_Money)); -comment out by killap
214+
//set_local_var(LVAR_Money, 0); -comment out by killap
203215

204216
if (san_fran_flag(SF_SHI_ENEMY)) then begin
205217
start_gdialog(NAME,self_obj,4,-1,-1);
@@ -229,8 +241,8 @@ procedure talk_p_proc begin
229241
end_dialogue;
230242
end
231243

232-
//set_local_var(LVAR_Money, self_caps); -comment out by killap (expansion)
233-
//self_caps_adjust(-local_var(LVAR_Money)); -comment out by killap (expansion)
244+
//set_local_var(LVAR_Money, self_caps); -comment out by killap
245+
//self_caps_adjust(-local_var(LVAR_Money)); -comment out by killap
234246

235247
move_obj_inven_to_obj(self_obj, i_table_swap);
236248
move_obj_inven_to_obj(swap_obj, self_obj);
@@ -241,8 +253,8 @@ procedure talk_p_proc begin
241253
gSay_End;
242254
end_dialogue;
243255
end*/
244-
//item_caps_adjust(self_obj, local_var(LVAR_Money)); -comment out by killap (expansion)
245-
//set_local_var(LVAR_Money, 0); -comment out by killap (expansion)
256+
//self_caps_adjust(local_var(LVAR_Money)); -comment out by killap
257+
//set_local_var(LVAR_Money, 0); -comment out by killap
246258
end
247259

248260
/* This procedure gets called only on the death of this NPC. Special things like

scripts_src/sanfran/fclaocho.ssl

+17-4
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ procedure Node052;
144144
Needs to be saved, make it a map variable (MVAR_) */
145145

146146
import variable i_lao_table_swap;
147+
import variable i_lao_table_1;
148+
import variable i_lao_table_2;
147149
import variable i_lao_merchant;
148150

149151
/* Local variables which do not need to be saved between map changes. */
@@ -239,6 +241,8 @@ end
239241
written by designers are placed in here. Additionally, Reactions are generated and
240242
stored which affects player interactions. */
241243
procedure talk_p_proc begin
244+
variable obj, caps;
245+
242246
Evil_Critter:=0;
243247
Slavery_Tolerant:=SLAVE_INTOLERANT;
244248
Karma_Perception:=KARMA_PERCEPTION0;
@@ -248,12 +252,21 @@ procedure talk_p_proc begin
248252
GetReaction;
249253

250254
//set_local_var(LVAR_Money, self_caps); -comment out by killap
251-
//item_caps_adjust(self_obj, -local_var(LVAR_Money)); -comment out by killap
255+
//self_caps_adjust(-local_var(LVAR_Money)); -comment out by killap
252256

253257
move_obj_inven_to_obj(self_obj, swap_obj);
254258
move_obj_inven_to_obj(i_lao_table_swap, self_obj);
255259

256-
//item_caps_adjust(self_obj, local_var(LVAR_Money)); -comment out by killap
260+
if (i_lao_table_swap == i_lao_table_1) then begin
261+
obj := i_lao_table_2;
262+
end else begin
263+
obj := i_lao_table_1;
264+
end
265+
caps := item_caps_total(obj);
266+
self_caps_adjust(caps);
267+
item_caps_adjust(obj, -caps);
268+
269+
//self_caps_adjust(local_var(LVAR_Money)); -comment out by killap
257270
//set_local_var(LVAR_Money, 0); -comment out by killap
258271

259272
if (san_fran_flag(SF_SHI_ENEMY)) then begin
@@ -273,12 +286,12 @@ procedure talk_p_proc begin
273286
end
274287

275288
//set_local_var(LVAR_Money, self_caps); -comment out by killap
276-
//item_caps_adjust(self_obj, -local_var(LVAR_Money)); -comment out by killap
289+
//self_caps_adjust(-local_var(LVAR_Money)); -comment out by killap
277290

278291
move_obj_inven_to_obj(self_obj, i_lao_table_swap);
279292
move_obj_inven_to_obj(swap_obj, self_obj);
280293

281-
//item_caps_adjust(self_obj, local_var(LVAR_Money)); -comment out by killap
294+
//self_caps_adjust(local_var(LVAR_Money)); -comment out by killap
282295
//set_local_var(LVAR_Money, 0); -comment out by killap
283296
end
284297

scripts_src/sanfran/figuntbl.ssl

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ procedure validHandle(variable handle);
5353
Needs to be saved, make it a map variable (MVAR_)
5454
*******************************************************************/
5555
import variable i_table_swap;
56+
import variable i_gun_table_1;
57+
import variable i_gun_table_2;
5658
import variable i_gun_merchant;
5759

5860
/*******************************************************************
@@ -74,6 +76,8 @@ import variable i_gun_merchant;
7476

7577
procedure start begin
7678
i_table_swap := self_obj;
79+
if (self_tile == TABLE_1) then i_gun_table_1 := self_obj;
80+
if (self_tile == TABLE_2) then i_gun_table_2 := self_obj;
7781
end
7882

7983
procedure timed_event_p_proc begin

scripts_src/sanfran/filaotbl.ssl

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ procedure validHandle(variable handle);
5353
Needs to be saved, make it a map variable (MVAR_)
5454
*******************************************************************/
5555
import variable i_lao_table_swap;
56+
import variable i_lao_table_1;
57+
import variable i_lao_table_2;
5658
import variable i_lao_merchant;
5759

5860
/*******************************************************************
@@ -74,6 +76,8 @@ import variable i_lao_merchant;
7476

7577
procedure start begin
7678
i_lao_table_swap := self_obj;
79+
if (self_tile == TABLE_1) then i_lao_table_1 := self_obj;
80+
if (self_tile == TABLE_2) then i_lao_table_2 := self_obj;
7781
end
7882

7983
procedure timed_event_p_proc begin

0 commit comments

Comments
 (0)