Define named constant for null sprite locations

This commit is contained in:
Peter Hill 2014-04-29 18:40:06 +02:00
parent 073057dbbe
commit 2d69f50444
4 changed files with 13 additions and 11 deletions

View File

@ -166,7 +166,7 @@ static int news_item_get_new_history_slot()
/**
* Get the (x,y,z) coordinates of the subject of a news item.
* If the new item is no longer valid, return 0x8000 in the x-coordinate
* If the new item is no longer valid, return SPRITE_LOCATION_NULL in the x-coordinate
*
* rct2: 0x0066BA74
*/
@ -180,7 +180,7 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
case NEWS_ITEM_RIDE:
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[subject]);
if (ride->var_050 == 0xFFFF) {
*x = 0x8000;
*x = SPRITE_LOCATION_NULL;
break;
}
{
@ -200,17 +200,17 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
*x = sprite->unknown.x;
*y = sprite->unknown.y;
*z = sprite->unknown.z;
if (*x != 0x8000)
if (*x != SPRITE_LOCATION_NULL)
break;
if (sprite->peep.state != 3 && sprite->peep.state != 7) {
*x = 0x8000;
*x = SPRITE_LOCATION_NULL;
break;
}
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[sprite->peep.current_ride]);
if (ride->var_1D0 & 1) {
*x = 0x8000;
*x = SPRITE_LOCATION_NULL;
break;
}
@ -239,7 +239,7 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
}
break;
default:
*x = 0x8000;
*x = SPRITE_LOCATION_NULL;
break;
}
}

View File

@ -23,7 +23,8 @@
#include "rct2.h"
#define SPRITE_INDEX_NULL 0xFFFF
#define SPRITE_INDEX_NULL 0xFFFF
#define SPRITE_LOCATION_NULL 0x8000
#include "peep.h"

View File

@ -23,6 +23,7 @@
#include "news_item.h"
#include "park.h"
#include "peep.h"
#include "sprite.h"
#include "sprites.h"
#include "strings.h"
#include "widget.h"
@ -184,7 +185,7 @@ static void window_game_bottom_toolbar_mouseup()
news_item_get_subject_location(newsItem->type, subject, &x, &y, &z);
if (x == 0x8000)
if (x == SPRITE_LOCATION_NULL)
break;
if ((mainWindow = window_get_main()) != NULL)
@ -284,7 +285,7 @@ static void window_game_bottom_toolbar_invalidate()
int subject = newsItem->assoc;
news_item_get_subject_location(newsItem->type, subject, &x, &y, &z);
if (x == 0x8000)
if (x == SPRITE_LOCATION_NULL)
w->disabled_widgets |= (1 << WIDX_NEWS_LOCATE);
if (!(((char*)0x0097BE7C)[newsItem->type] & 2)) {

View File

@ -801,7 +801,7 @@ static void window_park_entrance_toolupdate()
RCT2_CALLPROC_X(0x0068AAE1, x, y, 0, 0, w, 0, 0);
RCT2_GLOBAL(0x009DE58A, uint16) &= 0xFFFE;
screen_pos_to_map_pos(&x, &y);
if (x != 0x8000) {
if (x != SPRITE_LOCATION_NULL) {
RCT2_GLOBAL(0x009DE58A, uint16) |= 1;
RCT2_GLOBAL(0x009DE594, uint16) = 4;
RCT2_GLOBAL(0x009DE58C, uint16) = x;
@ -998,7 +998,7 @@ static void window_park_init_viewport(rct_window *w)
return;
for (i = 0; i < 4; i++) {
if (RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, uint16)[i] != 0x8000) {
if (RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, uint16)[i] != SPRITE_LOCATION_NULL) {
x = RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, uint16)[i] + 16;
y = RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_Y, uint16)[i] + 16;
z = RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_Z, uint16)[i] + 32;