Skip to content

Commit

Permalink
Final batch of fixes. This is 2.81f.
Browse files Browse the repository at this point in the history
  • Loading branch information
adelva1984 committed Aug 18, 2008
1 parent 39fa580 commit facd625
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 62 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.txt
Expand Up @@ -9,6 +9,11 @@ USERS
renderer. This means that the hardware scalers will not affect the quality
of the screenshot. It also fixes a bug when using opengl2, which would dump
only a white screen.
+ Temporarily reverted a bugfix that broke Zeux IV - Forest of Ruin. I'm not
dropping the bugfix, I just can't immediately see what's wrong.
+ Fixed a bug that permitted the mouse y coordinate to be warped to row 25,
which does not exist. This bug caused some of the renderers to crash, and
the software renderer to draw in memory it did not possess.

DEVELOPERS

Expand Down
Binary file modified macosx.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions src/counter.cpp
Expand Up @@ -1567,8 +1567,8 @@ void mousex_write(World *mzx_world, function_counter *counter,
void mousey_write(World *mzx_world, function_counter *counter,
char *name, int value, int id)
{
if(value > 25)
value = 25;
if(value > 24)
value = 24;

if(value < 0)
value = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/game.cpp
Expand Up @@ -1216,7 +1216,7 @@ void play_game(World *mzx_world, int fadein)
if(key_char)
{
keylbl[3] = key_char;
send_robot_all(mzx_world, keylbl, NULL);
send_robot_all(mzx_world, keylbl);
}

switch(key)
Expand Down Expand Up @@ -1251,7 +1251,7 @@ void play_game(World *mzx_world, int fadein)
{
int enter_menu_status =
get_counter(mzx_world, "ENTER_MENU", 0);
send_robot_all(mzx_world, "KeyEnter", NULL);
send_robot_all(mzx_world, "KeyEnter");
// Menu
// 19x9
if(enter_menu_status)
Expand Down Expand Up @@ -1665,7 +1665,7 @@ int move_player(World *mzx_world, int dir)
char d_param = src_board->level_param[d_offset];
send_robot(mzx_world,
(src_board->sensor_list[d_param])->robot_to_mesg,
"SENSORON", 0, NULL);
"SENSORON", 0);
place_player(mzx_world, new_x, new_y, dir);
}
else
Expand Down
72 changes: 19 additions & 53 deletions src/robot.cpp
Expand Up @@ -723,7 +723,7 @@ void send_robot_def(World *mzx_world, int robot_id, int mesg_id)
break;

case 2:
send_robot_all(mzx_world, "INVINCO", NULL);
send_robot_all(mzx_world, "INVINCO");
break;

case 3:
Expand Down Expand Up @@ -752,7 +752,7 @@ void send_robot_def(World *mzx_world, int robot_id, int mesg_id)
break;

case 7:
send_robot_all(mzx_world, "PLAYERHIT", NULL);
send_robot_all(mzx_world, "PLAYERHIT");
break;

case 8:
Expand All @@ -764,66 +764,49 @@ void send_robot_def(World *mzx_world, int robot_id, int mesg_id)
break;

case 10:
send_robot_all(mzx_world, "JUSTLOADED", NULL);
send_robot_all(mzx_world, "JUSTLOADED");
break;

case 11:
send_robot_all(mzx_world, "JUSTENTERED", NULL);
send_robot_all(mzx_world, "JUSTENTERED");
break;

case 12:
send_robot_all(mzx_world, "GOOPTOUCHED", NULL);
send_robot_all(mzx_world, "GOOPTOUCHED");
break;

case 13:
send_robot_all(mzx_world, "PLAYERHURT", NULL);
send_robot_all(mzx_world, "PLAYERHURT");
break;
}
}

void send_robot(World *mzx_world, char *name, char *mesg,
int ignore_lock, Robot *src_robot)
int ignore_lock)
{
Board *src_board = mzx_world->current_board;
Robot *cur_robot;
int first, last;

if(!strcasecmp(name, "all"))
{
send_robot_all(mzx_world, mesg, src_robot);
send_robot_all(mzx_world, mesg);
}
else
{
// See if it's the global robot
if(!strcasecmp(name, mzx_world->global_robot.robot_name) &&
mzx_world->global_robot.used)
{
cur_robot = &mzx_world->global_robot;

if(cur_robot == src_robot)
{
send_robot_direct(cur_robot, mesg, ignore_lock, 1);
}
else
{
send_robot_direct(cur_robot, mesg, ignore_lock, 0);
}
send_robot_direct(&mzx_world->global_robot, mesg,
ignore_lock, 0);
}

if(find_robot(src_board, name, &first, &last))
{
while(first <= last)
{
cur_robot = src_board->robot_list_name_sorted[first];

if(cur_robot == src_robot)
{
send_robot_direct(cur_robot, mesg, ignore_lock, 1);
}
else
{
send_robot_direct(cur_robot, mesg, ignore_lock, 0);
}
send_robot_direct(src_board->robot_list_name_sorted[first],
mesg, ignore_lock, 0);
first++;
}
}
Expand Down Expand Up @@ -1010,8 +993,7 @@ void send_sensor_command(World *mzx_world, int id, int command)
}
else
{
send_robot(mzx_world, cur_sensor->robot_to_mesg, "SENSORTHUD",
0, NULL);
send_robot(mzx_world, cur_sensor->robot_to_mesg, "SENSORTHUD", 0);
}
move_status = 2;
}
Expand Down Expand Up @@ -1042,8 +1024,7 @@ void send_sensor_command(World *mzx_world, int id, int command)
if(move_status != 0)
{
// Sensorthud!
send_robot(mzx_world, cur_sensor->robot_to_mesg, "SENSORTHUD",
0, NULL);
send_robot(mzx_world, cur_sensor->robot_to_mesg, "SENSORTHUD", 0);
}
break;
}
Expand Down Expand Up @@ -1097,34 +1078,19 @@ int send_robot_self(World *mzx_world, Robot *src_robot, char *mesg)
return send_robot_direct(src_robot, mesg, 1, 1);
}

void send_robot_all(World *mzx_world, char *mesg, Robot *src_robot)
void send_robot_all(World *mzx_world, char *mesg)
{
Board *src_board = mzx_world->current_board;
Robot *cur_robot;
int i;

if(mzx_world->global_robot.used)
{
cur_robot = &(mzx_world->global_robot);

if(src_robot == cur_robot)
send_robot_direct(cur_robot, mesg, 1, 1);
else
send_robot_direct(cur_robot, mesg, 0, 0);
send_robot_direct(&(mzx_world->global_robot), mesg, 0, 0);
}

for(i = 0; i < src_board->num_robots_active; i++)
{
cur_robot = src_board->robot_list_name_sorted[i];

if(cur_robot == src_robot)
{
send_robot_direct(cur_robot, mesg, 1, 1);
}
else
{
send_robot_direct(cur_robot, mesg, 0, 0);
}
send_robot_direct(src_board->robot_list_name_sorted[i], mesg, 0, 0);
}
}

Expand Down Expand Up @@ -2170,14 +2136,14 @@ void push_sensor(World *mzx_world, int id)
{
Board *src_board = mzx_world->current_board;
send_robot(mzx_world, (src_board->sensor_list[id])->robot_to_mesg,
"SENSORPUSHED", 0, NULL);
"SENSORPUSHED", 0);
}

void step_sensor(World *mzx_world, int id)
{
Board *src_board = mzx_world->current_board;
send_robot(mzx_world, (src_board->sensor_list[id])->robot_to_mesg,
"SENSORON", 0, NULL);
"SENSORON", 0);
}

// Translates message at target to the given buffer, returning location
Expand Down
4 changes: 2 additions & 2 deletions src/robot.h
Expand Up @@ -138,7 +138,7 @@ void clear_label_cache(Label **label_list, int num_labels);
int find_robot(Board *src_board, char *name, int *first, int *last);
void send_sensor_command(World *mzx_world, int id, int command);
void send_robot(World *mzx_world, char *name, char *mesg,
int ignore_lock, Robot *src_robot);
int ignore_lock);
int send_robot_id(World *mzx_world, int id, char *mesg, int ignore_lock);
void send_robot_def(World *mzx_world, int robot_id, int mesg_id);
void set_robot_position(Robot *cur_robot, int position);
Expand All @@ -148,7 +148,7 @@ Label *find_label(Robot *cur_robot, char *name);
Label *find_zapped_label(Robot *cur_robot, char *name);
int send_robot_direct(Robot *cur_robot, char *mesg, int ignore_lock,
int send_self);
void send_robot_all(World *mzx_world, char *mesg, Robot *src_robot);
void send_robot_all(World *mzx_world, char *mesg);
int send_robot_self(World *mzx_world, Robot *src_robot, char *mesg);
void send_sensors(World *mzx_world, char *name, char *mesg);
int move_dir(Board *src_board, int *x, int *y, int dir);
Expand Down
6 changes: 4 additions & 2 deletions src/runrobo2.cpp
Expand Up @@ -2095,8 +2095,8 @@ void run_robot(World *mzx_world, int id, int x, int y)
tr_msg(mzx_world, cmd_ptr + 2, id, robot_name_buffer);
tr_msg(mzx_world, p2 + 1, id, label_buffer);

send_robot(mzx_world, robot_name_buffer, label_buffer,
0, cur_robot);
send_robot(mzx_world, robot_name_buffer, label_buffer, 0);

// Did the position get changed? (send to self)
if(old_pos != cur_robot->cur_prog_line)
gotoed = 1;
Expand Down Expand Up @@ -3190,12 +3190,14 @@ void run_robot(World *mzx_world, int id, int x, int y)
if(put_id < SENSOR)
{
int player_bl[4];

calculate_blocked(mzx_world, mzx_world->player_x,
mzx_world->player_y, 1, player_bl);

place_dir_xy(mzx_world, put_id, put_color, put_param,
mzx_world->player_x, mzx_world->player_y, direction,
cur_robot, player_bl);

if(!is_robot(level_id[x + (y * board_width)]))
goto next_cmd;
}
Expand Down

0 comments on commit facd625

Please sign in to comment.