Merge branch 'master' into path-window

This commit is contained in:
IntelOrca 2014-05-01 17:02:37 +01:00
commit 90d38bf744
10 changed files with 60 additions and 38 deletions

View File

@ -129,7 +129,7 @@
#define RCT2_ADDRESS_G1_ELEMENTS 0x009EBD28
#define RCT2_ADDRESS_CURRENT_MONTH_YEAR 0x00F663A8
#define RCT2_ADDRESS_CURRENT_DAY 0x00F663AA
#define RCT2_ADDRESS_CURRENT_MONTH_TICKS 0x00F663AA
#define RCT2_ADDRESS_MAP_ELEMENTS 0x00F663B8

View File

@ -44,6 +44,6 @@ int date_get_total_months(int month, int year)
void date_reset()
{
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) = MONTH_MARCH;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_DAY, sint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, sint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, sint32) = 0;
}

View File

@ -174,7 +174,8 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
{
int i;
rct_ride *ride;
rct_sprite *sprite, *sprite_2;
rct_peep *peep;
rct_car *car;
switch (type) {
case NEWS_ITEM_RIDE:
@ -195,37 +196,41 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
*z = edx;
}
break;
case NEWS_ITEM_PEEP_1:
sprite = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]);
*x = sprite->unknown.x;
*y = sprite->unknown.y;
*z = sprite->unknown.z;
if (*x != SPRITE_LOCATION_NULL)
case NEWS_ITEM_PEEP_ON_RIDE:
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]);
*x = peep->x;
*y = peep->y;
*z = peep->z;
if (*((uint16*)x) != SPRITE_LOCATION_NULL)
break;
if (sprite->peep.state != 3 && sprite->peep.state != 7) {
if (peep->state != 3 && peep->state != 7) {
*x = SPRITE_LOCATION_NULL;
break;
}
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[sprite->peep.current_ride]);
if (ride->var_1D0 & 1) {
// Find which ride peep is on
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[peep->current_ride]);
// Check if there are trains on the track (first bit of var_1D0)
if (!(ride->var_1D0 & 1)) {
*x = SPRITE_LOCATION_NULL;
break;
}
sprite_2 = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[ride->var_086[sprite->peep.var_6A]]);
for (i = 0; i < sprite->peep.var_6B; i++)
sprite_2 = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[*((uint16*)&sprite_2->pad_00[0x3E])]);
*x = sprite_2->unknown.x;
*y = sprite_2->unknown.y;
*z = sprite_2->unknown.z;
// Find the first car of the train peep is on
car = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[ride->train_car_map[peep->current_train]]);
// Find the actual car peep is on
for (i = 0; i < peep->current_car; i++)
car = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[car->next_car]);
*x = car->x;
*y = car->y;
*z = car->z;
break;
case NEWS_ITEM_PEEP_2:
sprite = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]);
*x = sprite->unknown.x;
*y = sprite->unknown.y;
*z = sprite->unknown.z;
case NEWS_ITEM_PEEP:
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]);
*x = peep->x;
*y = peep->y;
*z = peep->z;
break;
case NEWS_ITEM_BLANK:
{

View File

@ -26,8 +26,8 @@
enum {
NEWS_ITEM_NULL,
NEWS_ITEM_RIDE,
NEWS_ITEM_PEEP_1,
NEWS_ITEM_PEEP_2,
NEWS_ITEM_PEEP_ON_RIDE,
NEWS_ITEM_PEEP,
NEWS_ITEM_MONEY,
NEWS_ITEM_BLANK,
NEWS_ITEM_SCENERY,

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* Copyright (c) 2014 Ted John, Peter Hill
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
@ -55,7 +55,10 @@ typedef struct {
uint8 pad_09;
sint16 var_0A;
uint16 var_0C;
uint8 var_0E[0x14];
sint16 x; // 0x0E
sint16 y; // 0x10
sint16 z; // 0x12
uint8 pad_14[0x0E];
uint16 name_string_idx; // 0x22
uint16 next_x; // 0x24
uint16 next_y; // 0x26
@ -72,9 +75,11 @@ typedef struct {
uint8 happiness; // 0x3A
uint8 pad_03B[0x2D];
uint8 current_ride; // 0x68
uint8 var_6A;
uint8 var_6B;
uint8 pad_6C[0x30];
uint8 pad_6a; // 0x6A Part of current_ride?
uint8 current_train; // 0x6B
uint8 current_car; // 0x6C
uint8 current_seat; // 0x6d
uint8 pad_6C[0x2e];
uint32 id; // 0x9C
uint8 pad_A0[0x10];
rct_peep_thought thoughts[PEEP_MAX_THOUGHTS]; // 0xB0

View File

@ -122,6 +122,7 @@ enum {
enum {
GAME_FLAGS_PARK_OPEN = (1 << 0),
GAME_FLAGS_BELOW_TREE_HEIGHT_ONLY = (1 << 5),
GAME_FLAGS_NO_MONEY = (1 << 11),
GAME_FLAGS_PARK_FREE_ENTRY = (1 << 13)
};

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* Copyright (c) 2014 Ted John, Peter Hill
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
@ -38,7 +38,7 @@ typedef struct {
uint8 pad_052[0x18];
uint16 var_06A[4]; // probably entrance map coordinates
uint8 pad_072[0x14];
uint16 var_086[1];
uint16 train_car_map[1]; // 0x86 Points to the first car in the train
uint8 pad_088[0x68];
sint16 excitement; // 0x0F0
sint16 intensity; // 0x0F2

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* Copyright (c) 2014 Ted John, Peter Hill
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
@ -46,6 +46,16 @@ typedef struct {
sint32 var_24;
} rct_litter;
typedef struct {
uint8 sprite_idetifier; // 0x00
uint8 pad_01[0x0D];
sint16 x; // 0x0E
sint16 y; // 0x10
sint16 z; // 0x12
uint8 pad_14[0x2a];
uint16 next_car; // 0x3E
} rct_car;
/**
* Sprite structure.
* size: 0x0100
@ -55,6 +65,7 @@ typedef union {
rct_unk_sprite unknown;
rct_peep peep;
rct_litter litter;
rct_car car;
} rct_sprite;
#endif

View File

@ -185,7 +185,7 @@ static void window_game_bottom_toolbar_mouseup()
news_item_get_subject_location(newsItem->type, subject, &x, &y, &z);
if (x == SPRITE_LOCATION_NULL)
if ((uint16)x == SPRITE_LOCATION_NULL)
break;
if ((mainWindow = window_get_main()) != NULL)
@ -221,7 +221,7 @@ static void window_game_bottom_toolbar_tooltip()
break;
case WIDX_DATE:
month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7;
day = ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_DAY, sint16) * ((short*)0x00993988)[month]) >> 16) & 0xFF;
day = ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, sint16) * ((short*)0x00993988)[month]) >> 16) & 0xFF;
*((short*)0x013CE952) = STR_DATE_DAY_1 + day;
*((short*)0x013CE954) = STR_MONTH_MARCH + month;
widgetIndex = 0;
@ -533,8 +533,8 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
case NEWS_ITEM_RIDE:
gfx_draw_sprite(dpi, SPR_RIDE, x, y);
break;
case NEWS_ITEM_PEEP_1:
case NEWS_ITEM_PEEP_2:
case NEWS_ITEM_PEEP_ON_RIDE:
case NEWS_ITEM_PEEP:
if (newsItem->flags & 1)
break;

View File

@ -2029,7 +2029,7 @@ static void window_park_graph_draw_months(rct_drawpixelinfo *dpi, uint8 *history
int i, x, y, yearOver32, currentMonth, currentDay;
currentMonth = date_get_month(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16));
currentDay = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_DAY, uint16);
currentDay = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16);
yearOver32 = (currentMonth * 4) + (currentDay >> 14) - 31;
x = baseX;
y = baseY;