add news item location finding

This commit is contained in:
IntelOrca 2014-04-11 20:02:20 +01:00
parent 8cbe0e7aa1
commit 71ea2cc072
3 changed files with 57 additions and 4 deletions

View File

@ -22,6 +22,8 @@
#include "audio.h"
#include "news_item.h"
#include "rct2.h"
#include "ride.h"
#include "sprite.h"
#include "window.h"
void window_game_bottom_toolbar_invalidate_news_item();
@ -160,4 +162,53 @@ static int news_item_get_new_history_slot()
for (i = 11; i < 60; i++)
newsItems[i] = newsItems[i + 1];
return 60;
}
void news_item_get_subject_location(int type, int subject, int *x, int *y, int *z)
{
rct_ride *ride;
rct_sprite *sprite;
switch (type) {
case NEWS_ITEM_RIDE:
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[subject]);
if (ride->var_050 == 0xFFFF) {
*x = 0x8000;
break;
}
{
uint32 eax, ebx, ecx, edx, esi, edi, ebp;
eax = (ride->var_050 & 0xFF) * 32 + 16;
ecx = (ride->var_050 >> 8) * 32 + 16;
RCT2_CALLFUNC_X(0x00662783, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
if (edx & 0xFFFF0000)
edx >>= 16;
*x = eax;
*y = ecx;
*z = edx;
}
break;
case NEWS_ITEM_PEEP_1:
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;
break;
case NEWS_ITEM_BLANK:
{
uint32 eax, ebx, ecx, edx, esi, edi, ebp;
eax = subject;
ecx = subject >> 16;
RCT2_CALLFUNC_X(0x00662783, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
*x = eax;
*y = ecx;
*z = edx;
}
break;
default:
*x = 0x8000;
break;
}
}

View File

@ -29,7 +29,9 @@
*/
typedef struct {
uint8 type; // 0x000
uint8 pad_001[0xEF];
uint8 pad_001[0x4F];
uint16 var_050; // 0x050
uint8 pad_052[0x9E];
sint16 excitement; // 0x0F0
sint16 intensity; // 0x0F2
sint16 nausea; // 0x0F4

View File

@ -33,9 +33,9 @@ typedef struct {
uint16 pad_02;
uint16 next; // 0x04
uint8 pad_06[0x08];
sint16 var_0E;
sint16 var_10;
sint16 var_12;
sint16 x; // 0x0E
sint16 y; // 0x10
sint16 z; // 0x12
} rct_unk_sprite;
typedef struct {