9
9
#include "define.h"
10
10
#include "command.h"
11
11
#include "sfall/sfall.h"
12
- #include "sfall/sfall.rotators.h"
13
12
14
13
/* Standard Script Procedures */
15
14
procedure start;
@@ -22,15 +21,18 @@ procedure check_invasions;
22
21
23
22
procedure KeyPressHandler;
24
23
procedure show_note;
25
- procedure show_days;
24
+ procedure show_days(variable gameTime) ;
26
25
procedure delete_all;
27
26
28
- variable Scr_Width;
29
- variable Scr_Height;
30
- variable opennote;
27
+ #define PIP_FRM (0x0600007F) // "PIP.frm" in intrface.lst
28
+ #define PIP2_FRM (0x06000080) // "PIP2.frm" in intrface.lst
29
+ #define NotePosX (32)
30
+ #define NotePosY (83)
31
31
32
32
#define timer_active (not(waterchip_returned) and (global_var(GVAR_VAULT13_WATER_DAYS) > 0))
33
33
34
+ variable opennote, lastFrame;
35
+
34
36
procedure start begin
35
37
if (game_loaded) then begin
36
38
set_global_script_type(1);
@@ -57,8 +59,8 @@ procedure GameModeChange_handler begin
57
59
end
58
60
return;
59
61
end
60
- else if (opennote) then begin
61
- call delete_all ;
62
+ else begin
63
+ opennote := false ;
62
64
end
63
65
64
66
if (mode bwand WORLDMAP) then begin
78
80
procedure RestTimer_handler begin
79
81
//if (get_game_mode bwand PIPBOY) then begin
80
82
if (opennote and timer_active) then begin
81
- call show_days;
83
+ call show_days(get_sfall_arg) ;
82
84
call check_watertimer;
83
85
end
84
86
else if (opennote) then begin
@@ -147,37 +149,33 @@ end
147
149
148
150
procedure show_note begin
149
151
opennote := true;
150
- Scr_Width := (get_screen_width / 2);
151
- Scr_Height := (get_screen_height / 2);
152
-
153
- // If using original resolution for whatever weird reason
154
- if ((get_ini_setting("f2_res.ini|IFACE|IFACE_BAR_MODE") == 1) or Scr_Height == 240) then begin
155
- Scr_Height += 50;
156
- end
152
+ lastFrame := -1;
157
153
158
- create_win("win_note", (Scr_Width - 288), (Scr_Height - 207), 148, 227);
159
- SelectWin("win_note");
160
- sfall_func("draw_image_scaled", "art\\intrface\\PIP2.frm");
161
- ShowWin;
154
+ interface_art_draw(0x1000000 + WINTYPE_PIPBOY, PIP2_FRM, NotePosX, NotePosY);
162
155
163
- call show_days;
156
+ call show_days(0) ;
164
157
end
165
158
166
159
// Initial "days left" when opening the PipBoy:
167
- procedure show_days begin
160
+ procedure show_days(variable gameTime) begin
168
161
// We only have 250 images, so bigger than that can't be shown:
169
162
// YES I KNOW THESE ARE 250 IMAGES, BUT IF YOU WANT IT TO LOOK EXACTLY
170
163
// THE SAME AS IN FALLOUT 1, IT IS A NECESSARY THING TO DO. Sue me.
171
164
// We will rework this shit some day in the future. Promise.
172
- SelectWin("win_note");
173
- if (get_water_days_left <= 250) then
174
- draw_image("art\\INTRFACE\\days.frm", (get_water_days_left - 1), 35, 97, 0);
175
- else
176
- draw_image("art\\INTRFACE\\days.frm", 250, 35, 97, 0);
177
- ShowWin;
165
+ if (gameTime == 0) then gameTime := game_time;
166
+
167
+ variable days_left = get_water_days_left_x(gameTime);
168
+ variable frame = days_left - 1;
169
+
170
+ if (days_left > 250) then frame := 250;
171
+ if (frame == lastFrame) then return;
172
+
173
+ interface_art_draw_frame(0x1000000 + WINTYPE_PIPBOY, "art\\intrface\\days.frm", NotePosX + 35, NotePosY + 97, frame);
174
+ lastFrame = frame;
178
175
end
179
176
180
177
procedure delete_all begin
181
178
opennote := false;
182
- DeleteWin("win_note");
179
+ // Overwrite the pipboy note with a cropped pipboy window image
180
+ interface_art_draw(WINTYPE_PIPBOY, "art\\intrface\\pip2a.frm", NotePosX, NotePosY);
183
181
end
0 commit comments