Skip to content

Commit e9de49a

Browse files
author
stefan.vogt@byteproject.net
committed
DrawStatusLine Infocom Amiga fix, thx @fredrikr!
1 parent f3a8072 commit e9de49a

1 file changed

Lines changed: 75 additions & 13 deletions

File tree

Build/shell.inf

100644100755
Lines changed: 75 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Array UUID_ARRAY string "UUID://xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx//";
1515
#Ifdef UUID_ARRAY; #Endif;
1616

1717
Switches e; ! Use Economize mode
18-
Include ">abbrvs_generic.h";
18+
!Include ">abbrvs_generic.h";
1919

2020
Constant Story "A SHELL AT THE SEASIDE";
2121
Constant Headline "^An interactive Skeleton by Your Name^\
@@ -31,8 +31,8 @@ Constant OPTIONAL_FULL_SCORE;
3131
Constant OBJECT_SCORE = 3;
3232
Constant ROOM_SCORE = 3;
3333
Constant MAX_SCORE 10;
34-
Constant OPTIONAL_MANUAL_REACTIVE;
35-
Constant OPTIONAL_MANUAL_SCOPE;
34+
!Constant OPTIONAL_MANUAL_REACTIVE;
35+
!Constant OPTIONAL_MANUAL_SCOPE;
3636
Constant INITIAL_LOCATION_VALUE = Seashore;
3737
#ifV5;
3838
Constant OPTIONAL_PROVIDE_UNDO; ! undo opcode is only supported in Z-machine v5 spec
@@ -43,7 +43,9 @@ Constant RUNTIME_ERRORS = 0;
4343

4444
! routine overrides
4545
Replace PronounNotice;
46-
!Replace SmellSub;
46+
#ifV5;
47+
Replace DrawStatusLine; ! replace Puny's routine for Infocom interpreter compatibility
48+
#endif;
4749

4850
Include "globals.h";
4951

@@ -67,7 +69,7 @@ Constant MESS_LANDMARK "You don't need to refer to doors and exits here.";
6769
Constant MESS_GO_LANDMARK "You decide to take a closer look and ";
6870

6971
! messages (lib-overrides)
70-
Constant MSG_PROMPT 1000;
72+
Constant MSG_PROMPT 1000;
7173
Constant MSG_TAKE_ANIMATE 1001;
7274
Constant MSG_EAT_ANIMATE 1002;
7375
Constant MSG_PARSER_NO_INPUT 1003;
@@ -76,11 +78,11 @@ Constant MSG_PARSER_CANT_SEE_SUCH_THING 1005;
7678
Constant MSG_PARSER_DONT_UNDERSTAND_WORD 1006;
7779
Constant MSG_LOOK_BEFORE_ROOMNAME 1007;
7880
Constant MSG_FILL_NO_WATER 1008;
79-
Constant MSG_INSERT_NOT_CONTAINER 1009;
81+
Constant MSG_INSERT_NOT_CONTAINER 1009;
8082
Constant MSG_EMPTY_CANT_CONTAIN 1010;
8183
Constant MSG_OPEN_YOU_CANT 1011;
8284
[LibraryMessages p_msg p_arg_1 p_arg_2;
83-
switch(p_msg) {
85+
switch(p_msg) {
8486
MSG_PROMPT:
8587
print ">";
8688
p_arg_1 = p_arg_2;
@@ -101,7 +103,7 @@ Constant MSG_OPEN_YOU_CANT 1011;
101103
@new_line; ! mimics Inform style location texts, disable for Infocom style
102104
MSG_FILL_NO_WATER:
103105
"That doesn't seem to work. Are you referring to an object that can be filled with liquid? Please refer to the usage of the fill command by typing [fill object].";
104-
MSG_INSERT_NOT_CONTAINER,
106+
MSG_INSERT_NOT_CONTAINER,
105107
MSG_EMPTY_CANT_CONTAIN:
106108
print_ret "Either this object can't contain any things or doing it won't help you progress in this game.";
107109
MSG_OPEN_YOU_CANT:
@@ -150,7 +152,7 @@ Object walls "walls"
150152
"You check the walls without gaining any new insights.";
151153
],
152154
before [;
153-
Attack:
155+
Attack:
154156
"There is surely a better way to deal with frustration.";
155157
Turn:
156158
"The walls? Are you serious?";
@@ -211,7 +213,7 @@ Object -> ocean,
211213
player.before = PlayerBefore; ! player.before override, see routine implementation
212214
player.parse_name = PlayerParseName; ! own routine that parses the player's name
213215
player.description = "There you are, a ghost in a shell, surrounded by a sea of shells.";
214-
216+
215217
print "^^\
216218
And when he hath the kernel eat,^\
217219
who doth not fling away the shell?^\
@@ -249,6 +251,66 @@ Object -> ocean,
249251
else himobj = p_object;
250252
];
251253

254+
#ifV5;
255+
! we use our own routine as Puny's might cause Infocom z5 terps to misbehave
256+
[ DrawStatusLine width posa s1 s2; !
257+
@split_window 1; @set_window 1; @set_cursor 1 1; style reverse;
258+
width = 0->33;
259+
SpeedSpaces (width);
260+
@set_cursor 1 2; _PrintObjName(location);
261+
if (width > 76)
262+
{
263+
s1 = NumWidth(status_field_1);
264+
s2 = NumWidth(status_field_2);
265+
posa = width-26;
266+
@set_cursor 1 posa;
267+
print " Score: ", status_field_1;
268+
SpeedSpaces(6-s1);
269+
print "Moves: ", status_field_2;
270+
SpeedSpaces(6-s2);
271+
}
272+
else if (width > 39)
273+
{
274+
s1 = NumWidth(status_field_1);
275+
s2 = NumWidth(status_field_2);
276+
posa = width - 9 - s1 - s2;
277+
@set_cursor 1 posa;
278+
print " Score: ", status_field_1, "/", status_field_2;
279+
@print_char ' ';
280+
}
281+
@set_cursor 1 1; style roman; @set_window 0;
282+
];
283+
284+
[NumWidth num width;
285+
width = 1;
286+
if(num < 0) {
287+
width++;
288+
num = -num;
289+
}
290+
if(num >= 10)
291+
{
292+
width++;
293+
if(num >= 100)
294+
{
295+
width++;
296+
if(num >= 1000)
297+
{
298+
width++;
299+
}
300+
}
301+
}
302+
return width;
303+
];
304+
305+
[ SpeedSpaces p_spaces; ! stolen from Puny's ext_menu.h
306+
while(p_spaces > 10) {
307+
@print_table TenSpaces 10 1;
308+
p_spaces = p_spaces - 10;
309+
}
310+
@print_table TenSpaces p_spaces 1;
311+
];
312+
#endif;
313+
252314
[ AboutSub;
253315
print_ret (string)Story, " is copyright (c) 2021 by Your Name.^^You may freely distribute the game, but you have to link to <youramazingurl.com>. This work may not be sold or included in any for-profit collection without written permission from the author.^^Please send bug reports to ", "<me@@64","mymail.com>.^^For acknowledgements and credits, please type ~credits~.";
254316
];
@@ -294,12 +356,12 @@ Object -> ocean,
294356
noun = false;
295357
];
296358

297-
! if not overridden by a before routine, TURN NOUN LEFT/RIGHT will invoke a regular TURN NOUN
359+
! if not overridden by a before routine, TURN NOUN LEFT/RIGHT will invoke a regular TURN NOUN
298360
[ TurnLeftSub;
299-
<<Turn noun>>;
361+
<<Turn noun>>;
300362
];
301363

302-
[ TurnRightSub;
364+
[ TurnRightSub;
303365
<<Turn noun>>;
304366
];
305367

0 commit comments

Comments
 (0)