Skip to content

Commit 1a1f677

Browse files
committed
Allow Rebecca to watch her basement door too, ref #381
1 parent 359008f commit 1a1f677

File tree

6 files changed

+54
-30
lines changed

6 files changed

+54
-30
lines changed

data/text/english/dialog/dcrebdor.msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@
4848
{357}{}{Nice talking to you too... I'll just be heading back over there then.}
4949

5050
# door open
51-
{375}{}{Oh, shit...}
51+
{375}{}{Oh, shit...}

data/text/english/dialog/dcrebecc.msg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,11 @@
253253
# 29. Still 3(From 28)
254254
{580}{}{So, you're a coward too? Figures.}
255255
{581}{}{...}
256+
257+
# 30. Self Initiated: Door tampered with
258+
# Same as dcrebdor: 230-234
259+
{1230}{}{Get away from that right now.}
260+
{1231}{}{Don't touch that again.}
261+
{1232}{}{Back off!}
262+
{1233}{}{Leave that alone.}
263+
{1234}{}{What do you think you're doing?}

scripts_src/den/dcrebdor.ssl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,19 @@ procedure Node005;
8484
/** North West */
8585
#define DIRECTION_NW 5
8686

87-
/**
88-
* Tile near basement entry door
89-
*/
90-
#define TILE_NEAR_DOOR tile_num_in_direction(tile_num(becky_door_obj), DIRECTION_SE, 1)
87+
9188
/**
9289
* Door tile
9390
*/
9491
#define TILE_DOOR tile_num(becky_door_obj)
92+
/**
93+
* Tile near basement entry door
94+
*/
95+
#define TILE_NEAR_DOOR tile_num_in_direction(TILE_DOOR, DIRECTION_SE, 1)
9596
/**
9697
* Tile in basement entry room
9798
*/
98-
#define TILE_NEAR_BASEMENT_ENTRY tile_num_in_direction(tile_num(becky_door_obj), DIRECTION_NW, 1)
99+
#define TILE_NEAR_BASEMENT_ENTRY tile_num_in_direction(TILE_DOOR, DIRECTION_NW, 1)
99100

100101
import variable becky_guard_obj;
101102
import variable becky_door_guard_obj;

scripts_src/den/dcrebecc.ssl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ procedure Node029;
117117
/* Local variables which do not need to be saved between map changes. */
118118
variable prev_node;
119119
import variable becky_guard_obj;
120+
import variable becky_obj;
120121

121122
procedure start begin
122123
end
123124

124125
procedure timed_event_p_proc begin
125-
if (fixed_param == timed_event_float) then begin
126-
if (combat_is_initialized == false) then begin
127-
end
126+
if (fixed_param == timed_event_door_tamper) then begin
127+
floater_rand(1230, 1234);
128128
end
129129
end
130130

@@ -137,6 +137,7 @@ procedure map_enter_p_proc begin
137137
set_local_var(LVAR_Home_Rotation, self_cur_rot);
138138
end
139139
end
140+
becky_obj = self_obj;
140141
end
141142

142143
procedure map_exit_p_proc begin

scripts_src/den/didoor.ssl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
*/
44

55
#include "../headers/den.h"
6-
#include "../generic/ziwoddor.ssl"
6+
#include "../generic/ziwoddor.ssl"

scripts_src/den/direbdor.ssl

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Copyright 1998-2003 Interplay Entertainment Corp. All rights reserved.
33
*/
44

5+
#define SCRIPT_REALNAME "direbdor"
6+
57
import variable becky_guard_obj;
68
import variable becky_door_guard_obj;
79
import variable becky_obj;
@@ -11,23 +13,6 @@ variable user_of_door;
1113

1214
#define LOCKED_STATUS ((STATE_ACTIVE * (becky_dead == false)) + (STATE_INACTIVE * becky_dead))
1315

14-
#define send_tamper_to_guard_who_sees \
15-
check_guard := 0; \
16-
if (becky_guard_obj != 0) then begin \
17-
if (obj_can_see_obj(becky_guard_obj, user_of_door)) then begin \
18-
check_guard := becky_guard_obj; \
19-
end \
20-
end else if (becky_obj != 0) then begin \
21-
if (obj_can_see_obj(becky_obj, user_of_door)) then begin \
22-
check_guard := becky_obj; \
23-
end \
24-
end \
25-
if (becky_door_guard_obj != 0) then begin \
26-
if ((obj_can_see_obj(becky_door_guard_obj, user_of_door)) or (check_guard != 0)) then begin \
27-
check_guard := becky_door_guard_obj; \
28-
end \
29-
end
30-
3116
procedure def_use_p_proc;
3217
procedure def_use_skill_on_p_proc;
3318
procedure def_map_update_p_proc;
@@ -62,9 +47,38 @@ end
6247

6348
#include "../den/didoor.ssl"
6449

50+
/**
51+
* Set `check_guard` to one of the guards or Becky herself.
52+
* Almost never Becky, though.
53+
* @param {ObjectPtr} door_user Critter using the door
54+
* @ret {ObjectPtr} who Guard critter or 0.
55+
*/
56+
procedure get_guard_object(variable door_user) begin
57+
if (becky_door_guard_obj != 0) then begin
58+
if (obj_can_see_obj(becky_door_guard_obj, door_user)) then begin
59+
ndebug("guard = door guard");
60+
return becky_door_guard_obj;
61+
end
62+
end
63+
if (becky_guard_obj != 0) then begin
64+
if (obj_can_see_obj(becky_guard_obj, door_user)) then begin
65+
ndebug("guard = normal guard");
66+
return becky_guard_obj;
67+
end
68+
end
69+
if (becky_obj != 0) then begin
70+
if (obj_can_see_obj(becky_obj, door_user)) then begin
71+
ndebug("guard = Becky");
72+
return becky_obj;
73+
end
74+
end
75+
return 0;
76+
end
77+
6578
procedure test_use_tamper begin
6679
ndebug("test_use_tamper");
67-
send_tamper_to_guard_who_sees
80+
check_guard = get_guard_object(user_of_door);
81+
ndebug("check_guard = " + check_guard);
6882
if (check_guard != 0) then begin
6983
if (user_of_door == dude_obj) then begin
7084
ndebug(" user_of_door == dude_obj");
@@ -82,7 +96,7 @@ end
8296

8397
procedure test_door_open begin
8498
if ((obj_is_open(self_obj) == false) and (obj_is_locked(self_obj) == false)) then begin
85-
send_tamper_to_guard_who_sees
99+
check_guard = get_guard_object(user_of_door);
86100
if (check_guard != 0) then begin
87101
if (user_of_door == dude_obj) then begin
88102
flush_add_timer_event(check_guard, 0, timed_event_attack);
@@ -97,7 +111,7 @@ procedure test_door_open begin
97111
end
98112

99113
procedure test_use_skill_tamper begin
100-
send_tamper_to_guard_who_sees
114+
check_guard = get_guard_object(user_of_door);
101115
ndebug("test_use_skill_tamper");
102116
if (check_guard != 0) then begin
103117
if ((action_being_used == SKILL_LOCKPICK) or (action_being_used == SKILL_TRAPS)) then begin

0 commit comments

Comments
 (0)