Skip to content

Commit

Permalink
Tidy up the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcCote committed Dec 16, 2021
1 parent 3fef4a6 commit e44f7a7
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 654 deletions.
4 changes: 2 additions & 2 deletions frotz/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ RANLIB = /usr/bin/ranlib
CC = gcc

# Enable compiler warnings. This is an absolute minimum.
#CFLAGS += -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration
CFLAGS += -w
CFLAGS += -Wall -Wextra -std=gnu99 -fPIC -Werror=implicit-function-declaration
CFLAGS = -w

# Define your optimization flags.
#
Expand Down
30 changes: 2 additions & 28 deletions frotz/src/common/frotz.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,32 +550,6 @@ extern char *option_zcode_path; /* dg */

extern long reserve_mem;


#define MOVE_DIFF_CNT 16
#define ATTR_SET_CNT 16
#define ATTR_CLR_CNT 16
#define PROP_PUT_CNT 64

// Keep track of the last n=16 changes to object tree
extern int move_diff_cnt;
extern zword move_diff_objs[MOVE_DIFF_CNT];
extern zword move_diff_dest[MOVE_DIFF_CNT];

// Keep track of the last n=16 changes to obj attributes
extern int attr_diff_cnt;
extern zword attr_diff_objs[ATTR_SET_CNT];
extern zword attr_diff_nb[ATTR_SET_CNT];

// Keep track of the last n=16 clears of obj attributes
extern int attr_clr_cnt;
extern zword attr_clr_objs[ATTR_CLR_CNT];
extern zword attr_clr_nb[ATTR_CLR_CNT];

// Keep track of the last n=32 changes to obj properties
extern int prop_put_cnt;
extern zword prop_put_objs[PROP_PUT_CNT];
extern zword prop_put_nb[PROP_PUT_CNT];

// Keep track of up to n=16 changes to special ram locations defined by the game
extern int ram_diff_cnt;
extern zword ram_diff_addr[16];
Expand Down Expand Up @@ -703,7 +677,7 @@ void z_window_style (void);

void init_err (void);
void runtime_error (int);

/* Error codes */
#define ERR_TEXT_BUF_OVF 1 /* Text buffer overflow */
#define ERR_STORE_RANGE 2 /* Store out of dynamic memory */
Expand Down Expand Up @@ -741,7 +715,7 @@ void runtime_error (int);
#define ERR_REMOVE_OBJECT_0 31 /* @remove_object called with object 0 */
#define ERR_GET_NEXT_PROP_0 32 /* @get_next_prop called with object 0 */
#define ERR_NUM_ERRORS (32)

/* There are four error reporting modes: never report errors;
report only the first time a given error type occurs; report
every time an error occurs; or treat all errors as fatal
Expand Down
50 changes: 0 additions & 50 deletions frotz/src/common/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@
#define O4_PROPERTY_OFFSET 12
#define O4_SIZE 14

int move_diff_cnt;
zword move_diff_objs[MOVE_DIFF_CNT];
zword move_diff_dest[MOVE_DIFF_CNT];
int attr_diff_cnt;
zword attr_diff_objs[ATTR_SET_CNT];
zword attr_diff_nb[ATTR_SET_CNT];
int attr_clr_cnt;
zword attr_clr_objs[ATTR_CLR_CNT];
zword attr_clr_nb[ATTR_CLR_CNT];
int prop_put_cnt;
zword prop_put_objs[PROP_PUT_CNT];
zword prop_put_nb[PROP_PUT_CNT];

/*
* object_address
*
Expand Down Expand Up @@ -454,14 +441,6 @@ void z_clear_attr (void)
if (zargs[1] > ((h_version <= V3) ? 31 : 47))
runtime_error (ERR_ILL_ATTR);

/* If we are monitoring attribute assignment display a short note */

if (attr_clr_cnt < ATTR_CLR_CNT) {
attr_clr_objs[attr_clr_cnt] = zargs[0];
attr_clr_nb[attr_clr_cnt] = zargs[1];
attr_clr_cnt++;
}

if (f_setup.attribute_assignment) {
stream_mssg_on ();
print_string ("@clear_attr ");
Expand Down Expand Up @@ -1066,14 +1045,6 @@ void z_insert_obj (void)
zword obj1_addr;
zword obj2_addr;

/* If we are monitoring object movements display a short note */

if (move_diff_cnt < MOVE_DIFF_CNT) {
move_diff_objs[move_diff_cnt] = obj1;
move_diff_dest[move_diff_cnt] = obj2;
move_diff_cnt++;
}

if (f_setup.object_movement) {
stream_mssg_on ();
print_string ("@move_obj ");
Expand Down Expand Up @@ -1186,12 +1157,6 @@ void z_put_prop (void)
SET_WORD (prop_addr, v)
}

if (prop_put_cnt < PROP_PUT_CNT) {
prop_put_objs[prop_put_cnt] = zargs[0];
prop_put_nb[prop_put_cnt] = zargs[1];
prop_put_cnt++;
}

}/* z_put_prop */


Expand All @@ -1204,13 +1169,6 @@ void z_put_prop (void)
void z_remove_obj (void)
{

/* If we are monitoring object movements display a short note */
if (move_diff_cnt < 16) {
move_diff_objs[move_diff_cnt] = zargs[0];
move_diff_dest[move_diff_cnt] = (zword) 0;
move_diff_cnt++;
}

if (f_setup.object_movement) {
stream_mssg_on ();
print_string ("@remove_obj ");
Expand Down Expand Up @@ -1244,14 +1202,6 @@ void z_set_attr (void)
if (zargs[1] > ((h_version <= V3) ? 31 : 47))
runtime_error (ERR_ILL_ATTR);

/* If we are monitoring attribute assignment display a short note */

if (attr_diff_cnt < ATTR_SET_CNT) {
attr_diff_objs[attr_diff_cnt] = zargs[0];
attr_diff_nb[attr_diff_cnt] = zargs[1];
attr_diff_cnt++;
}

if (f_setup.attribute_assignment) {
stream_mssg_on ();
print_string ("@set_attr ");
Expand Down
Loading

0 comments on commit e44f7a7

Please sign in to comment.