mirror of https://github.com/OpenRCT2/OpenRCT2.git
commit
e4c4a16d2a
|
@ -32,6 +32,7 @@
|
|||
#include "viewport.h"
|
||||
#include "finance.h"
|
||||
#include "audio.h"
|
||||
#include "sprite.h"
|
||||
#include "string_ids.h"
|
||||
|
||||
static void set_all_land_owned();
|
||||
|
@ -53,7 +54,7 @@ void editor_load()
|
|||
RCT2_CALLPROC_EBPSAFE(0x006B9CB0);
|
||||
reset_park_entrances();
|
||||
reset_saved_strings();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069EB13); // sprites_init
|
||||
reset_sprite_list();
|
||||
ride_init_all();
|
||||
window_guest_list_init_vars_a();
|
||||
sub_6BD3A4();
|
||||
|
@ -102,7 +103,7 @@ void trackdesigner_load()
|
|||
RCT2_CALLPROC_EBPSAFE(0x006B9CB0);
|
||||
reset_park_entrances();
|
||||
reset_saved_strings();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069EB13); // reset_sprites
|
||||
reset_sprite_list();
|
||||
ride_init_all();
|
||||
window_guest_list_init_vars_a();
|
||||
sub_6BD3A4();
|
||||
|
@ -140,7 +141,7 @@ void trackmanager_load()
|
|||
RCT2_CALLPROC_EBPSAFE(0x006B9CB0);
|
||||
reset_park_entrances();
|
||||
reset_saved_strings();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069EB13); // reset_sprites
|
||||
reset_sprite_list();
|
||||
ride_init_all();
|
||||
window_guest_list_init_vars_a();
|
||||
sub_6BD3A4();
|
||||
|
|
19
src/game.c
19
src/game.c
|
@ -32,6 +32,7 @@
|
|||
#include "sawyercoding.h"
|
||||
#include "scenario.h"
|
||||
#include "screenshot.h"
|
||||
#include "sprite.h"
|
||||
#include "string_ids.h"
|
||||
#include "title.h"
|
||||
#include "tutorial.h"
|
||||
|
@ -1581,7 +1582,7 @@ int game_load_save()
|
|||
// The rest is the same as in scenario load and play
|
||||
RCT2_CALLPROC_EBPSAFE(0x006A9FC0);
|
||||
map_update_tile_pointers();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
reset_0x69EBE4();// RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING;
|
||||
viewport_init_all();
|
||||
game_create_windows();
|
||||
|
@ -1607,7 +1608,7 @@ int game_load_save()
|
|||
mainWindow->saved_view_y -= mainWindow->viewport->view_height >> 1;
|
||||
window_invalidate(mainWindow);
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
|
||||
sub_0x0069E9A7();
|
||||
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
|
||||
window_new_ride_init_vars();
|
||||
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
|
||||
|
@ -1619,6 +1620,20 @@ int game_load_save()
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* rct2: 0x0069E9A7
|
||||
*/
|
||||
void sub_0x0069E9A7(){
|
||||
//RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
|
||||
//return;
|
||||
for (rct_sprite* spr = RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite); spr < (rct_sprite*)RCT2_ADDRESS_SPRITES_NEXT_INDEX; ++spr){
|
||||
if (spr->unknown.sprite_identifier != 0xFF){
|
||||
RCT2_CALLPROC_X(0x0069E9D3, spr->unknown.x, 0, spr->unknown.y, spr->unknown.z, (int)spr, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0066DBB7
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
void game_create_windows();
|
||||
void game_update();
|
||||
void game_logic_update();
|
||||
void sub_0x0069E9A7();
|
||||
|
||||
int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ void gfx_draw_line(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int c
|
|||
void gfx_fill_rect(rct_drawpixelinfo *dpi, int left, int top, int right, int bottom, int colour);
|
||||
void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, short left, short top, short right, short bottom, int colour, short _si);
|
||||
void gfx_draw_sprite(rct_drawpixelinfo *dpi, int image_id, int x, int y);
|
||||
void gfx_draw_sprite_palette_set(rct_drawpixelinfo *dpi, int image_id, int x, int y, uint8* palette_pointer, uint8* unknown_pointer);
|
||||
void gfx_draw_string(rct_drawpixelinfo *dpi, char *format, int colour, int x, int y);
|
||||
void gfx_transpose_palette(int pal, unsigned char product);
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "climate.h"
|
||||
#include "config.h"
|
||||
#include "date.h"
|
||||
#include "editor.h"
|
||||
#include "game.h"
|
||||
#include "gfx.h"
|
||||
#include "intro.h"
|
||||
|
@ -169,10 +170,9 @@ void rct2_init()
|
|||
reset_park_entrances();
|
||||
reset_saved_strings();
|
||||
reset_sprite_list();
|
||||
//RCT2_CALLPROC_EBPSAFE(0x0069EB13); //Sprite list reset/load
|
||||
ride_init_all();
|
||||
window_guest_list_init_vars_a();
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BD3A4); //Peep?
|
||||
sub_6BD3A4();// RCT2_CALLPROC_EBPSAFE(0x006BD3A4); //Peep?
|
||||
map_init();
|
||||
park_init();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0066B5C0); // 0x0066B5C0 (part of 0x0066B3E8) screen_game_create_windows()
|
||||
|
|
|
@ -154,7 +154,7 @@ void scenario_load(const char *path)
|
|||
|
||||
RCT2_CALLPROC_EBPSAFE(0x006A9FC0);
|
||||
map_update_tile_pointers();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
reset_0x69EBE4();// RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ void scenario_load_and_play(const rct_scenario_basic *scenario)
|
|||
mainWindow->saved_view_y -= mainWindow->viewport->view_height >> 1;
|
||||
window_invalidate(mainWindow);
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
|
||||
sub_0x0069E9A7();// RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
|
||||
window_new_ride_init_vars();
|
||||
|
||||
// Set the scenario pseduo-random seeds
|
||||
|
|
38
src/sprite.c
38
src/sprite.c
|
@ -37,7 +37,7 @@ void create_balloon(int x, int y, int z, int colour)
|
|||
*/
|
||||
void reset_sprite_list(){
|
||||
RCT2_GLOBAL(0x1388698, uint16) = 0;
|
||||
memset((uint32*)RCT2_ADDRESS_SPRITE_LIST, 0, 0x9C400);
|
||||
memset((rct_sprite*)RCT2_ADDRESS_SPRITE_LIST, 0, sizeof(rct_sprite)* 0x2710);
|
||||
|
||||
for (int i = 0; i < 6; ++i){
|
||||
RCT2_ADDRESS(RCT2_ADDRESS_SPRITES_NEXT_INDEX, uint16)[i] = -1;
|
||||
|
@ -67,5 +67,39 @@ void reset_sprite_list(){
|
|||
|
||||
RCT2_GLOBAL(0x13573C8, uint16) = 0x2710;
|
||||
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
//RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
reset_0x69EBE4();
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* rct: 0x0069EBE4
|
||||
* This function looks as though it sets some sort of order for sprites.
|
||||
* Sprites can share thier position if this is the case.
|
||||
*/
|
||||
void reset_0x69EBE4(){
|
||||
//RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
//return;
|
||||
memset((uint16*)0xF1EF60, -1, 0x10001*2);
|
||||
|
||||
rct_sprite* spr = RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite);
|
||||
for (; spr < (rct_sprite*)RCT2_ADDRESS_SPRITES_NEXT_INDEX; spr++){
|
||||
|
||||
if (spr->unknown.sprite_identifier != 0xFF){
|
||||
uint32 edi = spr->unknown.x;
|
||||
if ((uint16)(spr->unknown.x) == SPRITE_LOCATION_NULL){
|
||||
edi = 0x10000;
|
||||
}
|
||||
else{
|
||||
int ecx = spr->unknown.y;
|
||||
ecx >>= 5;
|
||||
edi &= 0x1FE0;
|
||||
edi <<= 3;
|
||||
edi |= ecx;
|
||||
}
|
||||
uint16 ax = RCT2_ADDRESS(0xF1EF60,uint16)[edi];
|
||||
RCT2_ADDRESS(0xF1EF60,uint16)[edi] = spr->unknown.sprite_index;
|
||||
spr->unknown.var_02 = ax;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@
|
|||
typedef struct {
|
||||
uint8 sprite_identifier; // 0x00
|
||||
uint8 pad_01;
|
||||
uint16 pad_02;
|
||||
uint16 var_02;
|
||||
uint16 next; // 0x04
|
||||
uint16 previous; // 0x06
|
||||
uint8 var_08;
|
||||
|
@ -69,5 +69,6 @@ typedef union {
|
|||
|
||||
void create_balloon(int x, int y, int z, int colour);
|
||||
void reset_sprite_list();
|
||||
void reset_0x69EBE4();
|
||||
|
||||
#endif
|
||||
|
|
14
src/title.c
14
src/title.c
|
@ -23,6 +23,7 @@
|
|||
#include <time.h>
|
||||
#include "addresses.h"
|
||||
#include "config.h"
|
||||
#include "climate.h"
|
||||
#include "date.h"
|
||||
#include "game.h"
|
||||
#include "gfx.h"
|
||||
|
@ -33,6 +34,7 @@
|
|||
#include "rct2.h"
|
||||
#include "ride.h"
|
||||
#include "scenario.h"
|
||||
#include "sprite.h"
|
||||
#include "string_ids.h"
|
||||
#include "viewport.h"
|
||||
#include "editor.h"
|
||||
|
@ -95,20 +97,20 @@ void title_load()
|
|||
|
||||
reset_park_entrances();
|
||||
reset_saved_strings();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069EB13);
|
||||
reset_sprite_list();
|
||||
ride_init_all();
|
||||
window_guest_list_init_vars_a();
|
||||
RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
|
||||
sub_6BD3A4(); // RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
|
||||
map_init();
|
||||
park_init();
|
||||
date_reset();
|
||||
RCT2_CALLPROC_X(0x006C45ED, 0, 0, 0, 0, 0, 0, 0);
|
||||
climate_reset(CLIMATE_COOL_AND_WET);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
|
||||
window_new_ride_init_vars();
|
||||
window_guest_list_init_vars_b();
|
||||
window_staff_init_vars();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068AFFD);
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
map_update_tile_pointers(); //RCT2_CALLPROC_EBPSAFE(0x0068AFFD);
|
||||
reset_0x69EBE4();// RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
|
||||
viewport_init_all();
|
||||
news_item_init_queue();
|
||||
title_create_windows();
|
||||
|
@ -191,7 +193,7 @@ static void title_update_showcase()
|
|||
}
|
||||
|
||||
window_invalidate(w);
|
||||
RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
|
||||
sub_0x0069E9A7();// RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
|
||||
window_new_ride_init_vars();
|
||||
RCT2_CALLPROC_EBPSAFE(0x00684AC3);
|
||||
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
|
||||
|
|
19
src/widget.c
19
src/widget.c
|
@ -22,6 +22,7 @@
|
|||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#include "addresses.h"
|
||||
#include "gfx.h"
|
||||
#include "sprites.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
|
@ -914,21 +915,23 @@ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetI
|
|||
// Draw greyed out (light border bottom right shadow)
|
||||
colour = w->colours[widget->colour];
|
||||
colour = RCT2_ADDRESS(0x00141FC4A, uint8)[(colour & 0x7F) * 8] & 0xFF;
|
||||
RCT2_GLOBAL(0x009ABDA4, uint32) = 0x009DED74;
|
||||
memset((void*)0x009DED74, colour, 256);
|
||||
RCT2_GLOBAL(0x009DED74, uint8) = 0;
|
||||
|
||||
uint8 palette[256];
|
||||
memset(palette, colour, 256);
|
||||
palette[0] = 0;
|
||||
|
||||
RCT2_GLOBAL(0x00EDF81C, uint32) = 0x20000000;
|
||||
image &= 0x7FFFF;
|
||||
RCT2_CALLPROC_X(0x0067A46E, 0, image, l + 1, t + 1, 0, (int)dpi, 0);
|
||||
gfx_draw_sprite_palette_set(dpi, image | 0x20000000, l + 1, t + 1, palette, NULL);
|
||||
|
||||
// Draw greyed out (dark)
|
||||
colour = w->colours[widget->colour];
|
||||
colour = RCT2_ADDRESS(0x00141FC48, uint8)[(colour & 0x7F) * 8] & 0xFF;
|
||||
RCT2_GLOBAL(0x009ABDA4, uint32) = 0x009DED74;
|
||||
memset((void*)0x009DED74, colour, 256);
|
||||
RCT2_GLOBAL(0x009DED74, uint8) = 0;
|
||||
memset(palette, colour, 256);
|
||||
palette[0] = 0;
|
||||
|
||||
RCT2_GLOBAL(0x00EDF81C, uint32) = 0x20000000;
|
||||
RCT2_CALLPROC_X(0x0067A46E, 0, image, l, t, 0, (int)dpi, 0);
|
||||
gfx_draw_sprite_palette_set(dpi, image | 0x20000000, l, t, palette, NULL);
|
||||
} else {
|
||||
if (image & 0x80000000) {
|
||||
// ?
|
||||
|
|
|
@ -336,9 +336,8 @@ static void window_all_wheel_input()
|
|||
rct_window *window_create(int x, int y, int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags)
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
// Check if there are any window slots left
|
||||
if (RCT2_NEW_WINDOW == &(RCT2_FIRST_WINDOW[12])) {
|
||||
if (RCT2_NEW_WINDOW >= &(RCT2_FIRST_WINDOW[11])) {
|
||||
// Close least recently used window
|
||||
for (w = RCT2_FIRST_WINDOW; w < RCT2_NEW_WINDOW; w++)
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_9)))
|
||||
|
|
|
@ -777,7 +777,7 @@ static void window_guest_list_scrollpaint()
|
|||
// Draw guest faces
|
||||
numGuests = _window_guest_list_groups_num_guests[i];
|
||||
for (j = 0; j < 56 && j < numGuests; j++)
|
||||
gfx_draw_sprite(dpi, _window_guest_list_groups_guest_faces[numGuests * 56 + j] + 5486, j * 8, y + 9);
|
||||
gfx_draw_sprite(dpi, _window_guest_list_groups_guest_faces[i * 56 + j] + 5486, j * 8, y + 9);
|
||||
|
||||
// Draw action
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = _window_guest_list_groups_argument_1[i] & 0xFFFF;
|
||||
|
@ -807,7 +807,7 @@ static int window_guest_list_is_peep_in_filter(rct_peep* peep)
|
|||
|
||||
temp = _window_guest_list_selected_view;
|
||||
_window_guest_list_selected_view = _window_guest_list_selected_filter;
|
||||
|
||||
|
||||
esi = (int)peep;
|
||||
RCT2_CALLFUNC_X(0x0069B7EA, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
ebx &= 0xFFFF;
|
||||
|
@ -823,6 +823,7 @@ static int window_guest_list_is_peep_in_filter(rct_peep* peep)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Calculates a hash value for comparing peep actions/thoughts*/
|
||||
static int sub_69B7EA(rct_peep *peep, int *outEAX)
|
||||
{
|
||||
int eax, ebx, ecx, edx, esi, edi, ebp;
|
||||
|
@ -914,9 +915,8 @@ static void window_guest_list_find_groups()
|
|||
continue;
|
||||
|
||||
// Get and check if in same group
|
||||
// BUG this doesn't work!
|
||||
bx = sub_69B7EA(peep2, &eax);
|
||||
if (bx != RCT2_GLOBAL(0x00F1EDF6, uint32) || (eax & 0xFFFF) != RCT2_GLOBAL(0x013CE952, uint16) || eax != RCT2_GLOBAL(0x013CE952 + 2, uint32))
|
||||
if ((bx != (0xFFFF&_window_guest_list_groups_argument_1[groupIndex]) || (RCT2_GLOBAL(0x00F1EDF8, uint16) != RCT2_GLOBAL(0x013CE952, uint16)) || _window_guest_list_groups_argument_2[groupIndex] != RCT2_GLOBAL(0x013CE952 + 2, uint32)))
|
||||
continue;
|
||||
|
||||
// Assign guest
|
||||
|
@ -924,7 +924,7 @@ static void window_guest_list_find_groups()
|
|||
peep2->var_0C &= ~(1 << 8);
|
||||
|
||||
// Add face sprite, cap at 56 though
|
||||
if (_window_guest_list_groups_num_guests[groupIndex] < 56)
|
||||
if (_window_guest_list_groups_num_guests[groupIndex] >= 56)
|
||||
continue;
|
||||
_window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite_small(peep2) - 5486;
|
||||
}
|
||||
|
@ -934,38 +934,44 @@ static void window_guest_list_find_groups()
|
|||
continue;
|
||||
}
|
||||
|
||||
ax = _window_guest_list_groups_num_guests[groupIndex];
|
||||
int edi = 0;
|
||||
|
||||
int curr_num_guests = _window_guest_list_groups_num_guests[groupIndex];
|
||||
int swap_position = 0;
|
||||
//This section places the groups in size order.
|
||||
while (1) {
|
||||
if (edi >= groupIndex)
|
||||
if (swap_position >= groupIndex)
|
||||
goto nextPeep;
|
||||
if (ax > _window_guest_list_groups_num_guests[edi])
|
||||
if (curr_num_guests > _window_guest_list_groups_num_guests[swap_position])
|
||||
break;
|
||||
edi++;
|
||||
swap_position++;
|
||||
}
|
||||
|
||||
int ecx = _window_guest_list_groups_argument_1[groupIndex];
|
||||
int edx = _window_guest_list_groups_argument_2[groupIndex];
|
||||
int argument_1 = _window_guest_list_groups_argument_1[groupIndex];
|
||||
int argument_2 = _window_guest_list_groups_argument_2[groupIndex];
|
||||
int bl = RCT2_ADDRESS(0x00F1AF26, uint8)[groupIndex];
|
||||
int temp;
|
||||
|
||||
do {
|
||||
temp = ax;
|
||||
ax = _window_guest_list_groups_num_guests[edi];
|
||||
_window_guest_list_groups_num_guests[edi] = temp;
|
||||
temp = curr_num_guests;
|
||||
curr_num_guests = _window_guest_list_groups_num_guests[swap_position];
|
||||
_window_guest_list_groups_num_guests[swap_position] = temp;
|
||||
|
||||
temp = ecx;
|
||||
ecx = _window_guest_list_groups_argument_1[edi];
|
||||
_window_guest_list_groups_argument_1[edi] = temp;
|
||||
temp = argument_1;
|
||||
argument_1 = _window_guest_list_groups_argument_1[swap_position];
|
||||
_window_guest_list_groups_argument_1[swap_position] = temp;
|
||||
|
||||
temp = edx;
|
||||
edx = _window_guest_list_groups_argument_2[edi];
|
||||
_window_guest_list_groups_argument_2[edi] = temp;
|
||||
temp = argument_2;
|
||||
argument_2 = _window_guest_list_groups_argument_2[swap_position];
|
||||
_window_guest_list_groups_argument_2[swap_position] = temp;
|
||||
|
||||
RCT2_ADDRESS(0x00F1AF26, uint8)[edi] = bl;
|
||||
bl = RCT2_ADDRESS(0x00F1AF26, uint8)[edi];
|
||||
} while (++edi <= groupIndex);
|
||||
uint8 temp_faces[56];
|
||||
memcpy(temp_faces, &(_window_guest_list_groups_guest_faces[groupIndex*56]), 56);
|
||||
memcpy(&(_window_guest_list_groups_guest_faces[groupIndex * 56]), &(_window_guest_list_groups_guest_faces[swap_position * 56]), 56);
|
||||
memcpy(&(_window_guest_list_groups_guest_faces[swap_position * 56]), temp_faces, 56);
|
||||
|
||||
temp = RCT2_ADDRESS(0x00F1AF26, uint8)[swap_position];
|
||||
RCT2_ADDRESS(0x00F1AF26, uint8)[swap_position] = bl;
|
||||
bl = temp;
|
||||
} while (++swap_position <= groupIndex);
|
||||
|
||||
nextPeep:
|
||||
;
|
||||
|
@ -980,10 +986,10 @@ static int get_guest_face_sprite_small(rct_peep *peep)
|
|||
{
|
||||
int sprite;
|
||||
sprite = SPR_PEEP_SMALL_FACE_ANGRY;
|
||||
|
||||
|
||||
if (peep->var_F3) return sprite;
|
||||
sprite = SPR_PEEP_SMALL_FACE_VERY_VERY_SICK;
|
||||
|
||||
|
||||
if (peep->nausea > 200) return sprite;
|
||||
sprite--; //VERY_SICK
|
||||
|
||||
|
|
Loading…
Reference in New Issue