1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 14:54:30 +01:00
Conflicts:
	projects/openrct2.vcxproj.filters
This commit is contained in:
zsilencer
2014-09-05 19:36:38 -06:00
27 changed files with 1602 additions and 98 deletions

View File

@@ -45,6 +45,7 @@
<ClInclude Include="..\src\ride_ratings.h" />
<ClInclude Include="..\src\sawyercoding.h" />
<ClInclude Include="..\src\scenario.h" />
<ClInclude Include="..\src\scenery.h" />
<ClInclude Include="..\src\screenshot.h" />
<ClInclude Include="..\src\sprite.h" />
<ClInclude Include="..\src\sprites.h" />
@@ -140,6 +141,7 @@
<ClCompile Include="..\src\window_tooltip.c" />
<ClCompile Include="..\src\window_water.c" />
<ClCompile Include="..\src\staff.c" />
<ClCompile Include="..\src\window_scenery.c" />
</ItemGroup>
<ItemGroup>
<None Include="..\openrct2.exe" />

View File

@@ -184,6 +184,13 @@
#define RCT2_ADDRESS_G1_ELEMENTS 0x009EBD28
#define RCT2_ADDRESS_PATH_TYPES 0x009ADA14
#define RCT2_ADDRESS_SMALL_SCENERY_ENTRIES 0x009AD1A4
#define RCT2_ADDRESS_LARGE_SCENERY_ENTRIES 0x009AD594
#define RCT2_ADDRESS_WALL_SCENERY_ENTRIES 0x009AD794
#define RCT2_ADDRESS_BANNER_SCENERY_ENTRIES 0x009AD994
#define RCT2_ADDRESS_PATH_BIT_SCENERY_ENTRIES 0x009ADA54
#define RCT2_ADDRESS_SCENERY_SET_ENTRIES 0x009ADA90
//Every pixel changed by rain is stored.
//32bit (pixel_offset 24 bit)(pixel_colour 8 bit)

View File

@@ -25,7 +25,7 @@ enum GAME_COMMAND {
GAME_COMMAND_0,
GAME_COMMAND_1,
GAME_COMMAND_TOGGLE_PAUSE, // 2
GAME_COMMAND_3,
GAME_COMMAND_3, //Has something to do with ride construction
GAME_COMMAND_4,
GAME_COMMAND_LOAD_OR_QUIT, // 5
GAME_COMMAND_6,

View File

@@ -2265,14 +2265,13 @@ rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int widt
newDrawPixelInfo->height = dpi->height;
newDrawPixelInfo->pitch = dpi->pitch;
newDrawPixelInfo->zoom_level = 0;
newDrawPixelInfo->var_0F = dpi->var_0F;
if (left > newDrawPixelInfo->x) {
uint16 newWidth = left - newDrawPixelInfo->x;
newDrawPixelInfo->width -= newWidth;
uint16 clippedFromLeft = left - newDrawPixelInfo->x;
newDrawPixelInfo->width -= clippedFromLeft;
newDrawPixelInfo->x = left;
newDrawPixelInfo->pitch += newWidth;
newDrawPixelInfo->bits += newWidth;
newDrawPixelInfo->pitch += clippedFromLeft;
newDrawPixelInfo->bits += clippedFromLeft;
}
int stickOutWidth = newDrawPixelInfo->x + newDrawPixelInfo->width - right;
@@ -2282,10 +2281,10 @@ rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int widt
}
if (top > newDrawPixelInfo->y) {
uint16 newHeight = top - newDrawPixelInfo->y;
newDrawPixelInfo->height = newHeight;
uint16 clippedFromTop = top - newDrawPixelInfo->y;
newDrawPixelInfo->height -= clippedFromTop;
newDrawPixelInfo->y = top;
int bitsPlus = (newDrawPixelInfo->pitch + newDrawPixelInfo->width) * newHeight;
uint32 bitsPlus = (newDrawPixelInfo->pitch + newDrawPixelInfo->width) * clippedFromTop;
newDrawPixelInfo->bits += bitsPlus;
}

View File

@@ -138,7 +138,9 @@ void map_update_tile_pointers()
/**
* Return the absolute height of an element, given its (x,y) coordinates
*
* ax: x
* cx: y
* dx: return
* rct2: 0x00662783
*/
int map_element_height(int x, int y)

View File

@@ -437,20 +437,20 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride.type * 8, uint32) & 0x400000){
*argument_1 = STR_IN_RIDE;
}
*argument_1 |= (ride.var_04A << 16);
*argument_2 = ride.var_04C;
*argument_1 |= (ride.name << 16);
*argument_2 = ride.name_arguments;
break;
case PEEP_STATE_BUYING:
ride = g_ride_list[peep->current_ride];
*argument_1 = STR_AT_RIDE | (ride.var_04A << 16);
*argument_2 = ride.var_04C;
*argument_1 = STR_AT_RIDE | (ride.name << 16);
*argument_2 = ride.name_arguments;
break;
case PEEP_STATE_WALKING:
case 0x14:
if (peep->var_C5 != 0xFF){
ride = g_ride_list[peep->var_C5];
*argument_1 = STR_HEADING_FOR | (ride.var_04A << 16);
*argument_2 = ride.var_04C;
*argument_1 = STR_HEADING_FOR | (ride.name << 16);
*argument_2 = ride.name_arguments;
}
else{
*argument_1 = peep->flags & PEEP_FLAGS_LEAVING_PARK ? STR_LEAVING_PARK : STR_WALKING;
@@ -460,8 +460,8 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
case PEEP_STATE_QUEUING_FRONT:
case PEEP_STATE_QUEUING:
ride = g_ride_list[peep->current_ride];
*argument_1 = STR_QUEUING_FOR | (ride.var_04A << 16);
*argument_2 = ride.var_04C;
*argument_1 = STR_QUEUING_FOR | (ride.name << 16);
*argument_2 = ride.name_arguments;
break;
case PEEP_STATE_SITTING:
*argument_1 = STR_SITTING;
@@ -470,12 +470,12 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
case PEEP_STATE_WATCHING:
if (peep->current_ride != 0xFF){
ride = g_ride_list[peep->current_ride];
*argument_1 = STR_WATCHING_RIDE | (ride.var_04A << 16);
*argument_2 = ride.var_04C;
*argument_1 = STR_WATCHING_RIDE | (ride.name << 16);
*argument_2 = ride.name_arguments;
if (peep->current_seat & 0x1)
*argument_1 = STR_WATCHING_CONSTRUCTION_OF | (ride.var_04A << 16);
*argument_1 = STR_WATCHING_CONSTRUCTION_OF | (ride.name << 16);
else
*argument_1 = STR_WATCHING_RIDE | (ride.var_04A << 16);
*argument_1 = STR_WATCHING_RIDE | (ride.name << 16);
}
else{
*argument_1 = peep->current_seat & 0x1 ? STR_WATCHING_NEW_RIDE_BEING_CONSTRUCTED : STR_LOOKING_AT_SCENERY;
@@ -519,24 +519,24 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
}
else{
ride = g_ride_list[peep->current_ride];
*argument_1 = STR_RESPONDING_TO_RIDE_BREAKDOWN_CALL | (ride.var_04A << 16);
*argument_2 = ride.var_04C;
*argument_1 = STR_RESPONDING_TO_RIDE_BREAKDOWN_CALL | (ride.name << 16);
*argument_2 = ride.name_arguments;
}
break;
case PEEP_STATE_FIXING:
ride = g_ride_list[peep->current_ride];
*argument_1 = STR_FIXING_RIDE | (ride.var_04A << 16);
*argument_2 = ride.var_04C;
*argument_1 = STR_FIXING_RIDE | (ride.name << 16);
*argument_2 = ride.name_arguments;
break;
case PEEP_STATE_HEADING_TO_INSPECTION:
ride = g_ride_list[peep->current_ride];
*argument_1 = STR_HEADING_TO_RIDE_FOR_INSPECTION | (ride.var_04A << 16);
*argument_2 = ride.var_04C;
*argument_1 = STR_HEADING_TO_RIDE_FOR_INSPECTION | (ride.name << 16);
*argument_2 = ride.name_arguments;
break;
case PEEP_STATE_INSPECTING:
ride = g_ride_list[peep->current_ride];
*argument_1 = STR_INSPECTING_RIDE | (ride.var_04A << 16);
*argument_2 = ride.var_04C;
*argument_1 = STR_INSPECTING_RIDE | (ride.name << 16);
*argument_2 = ride.name_arguments;
break;
}
@@ -554,7 +554,7 @@ void get_arguments_from_thought(rct_peep_thought thought, uint32* argument_1, ui
if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 1){
rct_ride* ride = &g_ride_list[thought.item];
esi = (int)(&(ride->var_04A));
esi = (int)(&(ride->name));
}
else if ((RCT2_ADDRESS(0x981DB1, uint16)[thought.type] & 0xFF) & 2){
if (thought.item < 0x20){

View File

@@ -20,6 +20,7 @@
#include <windows.h>
#include "addresses.h"
#include "game.h"
#include "map.h"
#include "news_item.h"
#include "sprite.h"
@@ -241,16 +242,16 @@ void ride_entrance_exit_connected(rct_ride* ride, int ride_idx)
continue;
if (entrance != -1 && !ride_entrance_exit_is_reachable(entrance, ride, i)) {
// name of ride is parameter of the format string
RCT2_GLOBAL(0x013CE952, uint16) = ride->var_04A;
RCT2_GLOBAL(0x013CE954, uint32) = ride->var_04C;
RCT2_GLOBAL(0x013CE952, uint16) = ride->name;
RCT2_GLOBAL(0x013CE954, uint32) = ride->name_arguments;
news_item_add_to_queue(1, STR_ENTRANCE_NOT_CONNECTED, ride_idx);
ride->connected_message_throttle = 3;
}
if (exit != -1 && !ride_entrance_exit_is_reachable(exit, ride, i)) {
// name of ride is parameter of the format string
RCT2_GLOBAL(0x013CE952, uint16) = ride->var_04A;
RCT2_GLOBAL(0x013CE954, uint32) = ride->var_04C;
RCT2_GLOBAL(0x013CE952, uint16) = ride->name;
RCT2_GLOBAL(0x013CE954, uint32) = ride->name_arguments;
news_item_add_to_queue(1, STR_EXIT_NOT_CONNECTED, ride_idx);
ride->connected_message_throttle = 3;
}
@@ -314,8 +315,8 @@ void ride_shop_connected(rct_ride* ride, int ride_idx)
}
// name of ride is parameter of the format string
RCT2_GLOBAL(0x013CE952, uint16) = ride->var_04A;
RCT2_GLOBAL(0x013CE954, uint32) = ride->var_04C;
RCT2_GLOBAL(0x013CE952, uint16) = ride->name;
RCT2_GLOBAL(0x013CE954, uint32) = ride->name_arguments;
news_item_add_to_queue(1, STR_ENTRANCE_NOT_CONNECTED, ride_idx);
ride->connected_message_throttle = 3;
@@ -422,6 +423,47 @@ rct_map_element *ride_find_track_gap(rct_map_element *startTrackElement, int *ou
return (rct_map_element*)esi;
}
/**
*
* rct2: 0x006B4800
*/
void ride_construct_new(int list_item)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
edx = list_item;
eax = 0;
ecx = 0;
ebx = 1;
edi = 0;
esi = 0;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 0x3DC;
esi = GAME_COMMAND_6;
game_do_command_p(esi, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
if (ebx == 0x80000000) {
return;
}
//Looks like edi became the ride index after the command.
eax = edi;
rct_window *w;
//TODO: replace with window_ride_main_open(eax)
// window_ride_main_open(eax);
RCT2_CALLFUNC_X(0x006ACC28, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
window_get_register(w);
ecx = w->classification;
edx = 0x13;
ebp = (int)w;
//TODO: replace with window_ride_main_mouseup() after ride-window_merge
// window_ride_main_mouseup();
RCT2_CALLFUNC_X(0x006AF17E, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
rct_window *ride_window = window_find_by_id(w->classification, w->number); //class here
window_close(ride_window);
}
/**
*
* rct2: 0x006CC056
@@ -431,4 +473,4 @@ int ride_try_construct(rct_map_element *trackMapElement)
// Success stored in carry flag which can't be accessed after call using is macro
RCT2_CALLPROC_X(0x006CC056, 0, 0, 0, (int)trackMapElement, 0, 0, 0);
return 1;
}
}

View File

@@ -49,7 +49,9 @@ typedef struct {
uint32 var_008;
uint8 var_00C;
uint8 var_00D;
uint8 pad_00E[0x1A4];
uint8 pad_00E[0x5];
uint8 var_013;
uint8 pad_014[0x19E];
sint8 excitement_multipler; // 0x1B2
sint8 intensity_multipler; // 0x1B3
sint8 nausea_multipler; // 0x1B4
@@ -74,8 +76,8 @@ typedef struct {
uint8 pad_046[0x03];
// 0 = closed, 1 = open, 2 = test
uint8 status; // 0x049
uint16 var_04A;
uint32 var_04C;
rct_string_id name; // 0x04A
uint32 name_arguments; // 0x04C probably just for when a ride hasn't been named (e.g. Crooked House 1)
uint16 overall_view; // 0x050 00XX = X, XX00 = Y (* 32 + 16)
uint16 station_starts[4]; // 0x052
uint8 station_heights[4]; // 0x05A
@@ -149,7 +151,8 @@ typedef struct {
uint8 var_1CD;
uint16 guests_favourite; // 0x1CE
uint32 lifecycle_flags; // 0x1D0
uint8 pad_1D4[0x20];
uint8 var_1D4;
uint8 pad_1D5[0x1F];
// Example value for wild mouse ride is d5 (before it's been constructed)
// I tried searching the IDA file for "1F4" but couldn't find places where
// this is written to.
@@ -384,6 +387,7 @@ void ride_update_favourited_stat();
void ride_check_all_reachable();
rct_map_element *sub_6CAF80(int rideIndex, int *outX, int *outY);
rct_map_element *ride_find_track_gap(rct_map_element *startTrackElement, int *outX, int *outY);
void ride_construct_new(int list_item);
int ride_try_construct(rct_map_element *trackMapElement);
#endif

130
src/scenery.h Normal file
View File

@@ -0,0 +1,130 @@
/*****************************************************************************
* Copyright (c) 2014 Dániel Tar
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef _SCENERY_H_
#define _SCENERY_H_
#include "rct2.h"
#include "string_ids.h"
typedef struct {
uint32 flags; // 0x06
uint8 height; // 0x0A
uint8 tool_id; // 0x0B
uint16 price; // 0x0C
uint8 pad_0E[12];
uint8 scenery_tab_id; // 0x1A
} rct_small_scenery_entry;
typedef enum {
SMALL_SCENERY_FLAG1 = (1 << 0), // 0x1
SMALL_SCENERY_FLAG2 = (1 << 1), // 0x2
SMALL_SCENERY_FLAG3 = (1 << 2), // 0x4
SMALL_SCENERY_FLAG4 = (1 << 3), // 0x8
SMALL_SCENERY_FLAG5 = (1 << 4), // 0x10
SMALL_SCENERY_FLAG6 = (1 << 5), // 0x20
SMALL_SCENERY_FLAG7 = (1 << 6), // 0x40
SMALL_SCENERY_FLAG8 = (1 << 7), // 0x80
SMALL_SCENERY_FLAG9 = (1 << 8), // 0x100
SMALL_SCENERY_FLAG10 = (1 << 9), // 0x200
SMALL_SCENERY_HAS_PRIMARY_COLOUR = (1 << 10), // 0x400
SMALL_SCENERY_FLAG12 = (1 << 11), // 0x800
SMALL_SCENERY_FLAG13 = (1 << 12), // 0x1000
SMALL_SCENERY_FLAG14 = (1 << 13), // 0x2000
SMALL_SCENERY_FLAG15 = (1 << 14), // 0x4000
SMALL_SCENERY_FLAG16 = (1 << 15), // 0x8000
SMALL_SCENERY_FLAG17 = (1 << 16), // 0x10000
SMALL_SCENERY_FLAG18 = (1 << 17), // 0x20000
SMALL_SCENERY_FLAG19 = (1 << 18), // 0x40000
SMALL_SCENERY_HAS_SECONDARY_COLOUR = (1 << 19), // 0x80000
} SMALL_SCENERY_FLAGS;
typedef struct {
uint8 tool_id; // 0x06
uint8 flags; // 0x07
uint16 price; // 0x08
uint8 pad_0A[6];
uint8 scenery_tab_id; // 0x10
} rct_large_scenery_entry;
typedef struct {
uint8 tool_id; // 0x06
uint8 flags; // 0x07
uint8 height; // 0x08
uint8 flags2; // 0x09
uint16 price; // 0x0A
uint8 scenery_tab_id; // 0x0C
} rct_wall_scenery_entry;
typedef enum {
WALL_SCENERY_FLAG1 = (1 << 0), // 0x1
WALL_SCENERY_FLAG2 = (1 << 1), // 0x2
WALL_SCENERY_FLAG3 = (1 << 2), // 0x4
WALL_SCENERY_FLAG4 = (1 << 3), // 0x8
WALL_SCENERY_FLAG5 = (1 << 4), // 0x10
WALL_SCENERY_FLAG6 = (1 << 5), // 0x20
WALL_SCENERY_HAS_SECONDARY_COLOUR = (1 << 6), // 0x40
WALL_SCENERY_HAS_TERNARY_COLOUR = (1 << 7), // 0x80
} WALL_SCENERY_FLAGS;
typedef struct {
uint8 pad_02[3];
uint8 tool_id; // 0x09
uint16 price; // 0x0A
uint8 scenery_tab_id; // 0x0C
} rct_path_bit_scenery_entry;
typedef struct {
uint8 var_06;
uint8 flags; // 0x07
uint16 price; // 0x08
uint8 scenery_tab_id; // 0x0A
} rct_banner_scenery_entry;
typedef struct {
rct_string_id name; // 0x00
uint32 image; // 0x02
union {
rct_small_scenery_entry small_scenery;
rct_large_scenery_entry large_scenery;
rct_wall_scenery_entry wall;
rct_path_bit_scenery_entry path_bit;
rct_banner_scenery_entry banner;
};
} rct_scenery_entry;
typedef struct {
rct_string_id name; // 0x00
uint32 image; // 0x02
uint16 scenery_entries[0x80]; // 0x06
uint8 entry_count; // 0x106
uint8 pad_107;
uint8 var_108; // 0x108, order?
} rct_scenery_set_entry;
#define g_smallSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_SMALL_SCENERY_ENTRIES, rct_scenery_entry*)
#define g_largeSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_LARGE_SCENERY_ENTRIES, rct_scenery_entry*)
#define g_wallSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_WALL_SCENERY_ENTRIES, rct_scenery_entry*)
#define g_bannerSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_BANNER_SCENERY_ENTRIES, rct_scenery_entry*)
#define g_pathBitSceneryEntries RCT2_ADDRESS(RCT2_ADDRESS_PATH_BIT_SCENERY_ENTRIES, rct_scenery_entry*)
#define g_scenerySetEntries RCT2_ADDRESS(RCT2_ADDRESS_SCENERY_SET_ENTRIES, rct_scenery_set_entry*)
#endif

View File

@@ -104,4 +104,48 @@ void reset_0x69EBE4(){
spr->unknown.var_02 = ax;
}
}
}
/*
* rct2: 0x0069EC6B
* bl: unclear what this does
*/
rct_sprite *create_sprite(uint8 bl)
{
int ecx = 0xA;
if ((bl & 2) != 0)
{
// 69EC96;
uint16 cx = 0x12C - RCT2_GLOBAL(0x13573CE, uint16);
if (cx >= RCT2_GLOBAL(0x13573C8, uint16))
{
return NULL;
}
ecx = 6;
}
else if (RCT2_GLOBAL(0x13573C8, uint16) <= 0)
{
return NULL;
}
rct_unk_sprite *sprite = &(g_sprite_list[RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_NEXT_INDEX, uint16)]).unknown;
RCT2_CALLPROC_X(0x0069ED0B, 0, 0, ecx, 0, (int)sprite, 0, 0);
sprite->x = SPRITE_LOCATION_NULL;
sprite->y = SPRITE_LOCATION_NULL;
sprite->z = 0;
sprite->name_string_idx = 0;
sprite->var_14 = 0x10;
sprite->pad_09 = 0x14;
sprite->var_15 = 0x8;
sprite->pad_0C[0] = 0x0;
sprite->var_16 = SPRITE_LOCATION_NULL;
sprite->var_02 = RCT2_GLOBAL(0xF3EF60, uint16);
RCT2_GLOBAL(0xF3EF60, uint16) = sprite->sprite_index;
return (rct_sprite*)sprite;
}

View File

@@ -49,12 +49,15 @@ typedef struct {
sint16 x; // 0x0E
sint16 y; // 0x10
sint16 z; // 0x12
uint16 pad_14;
uint8 var_14; // 0x14
uint8 var_15; // 0x15
sint16 var_16; //x related
sint16 var_18; //y related
sint16 var_1A; //x related
sint16 var_1C; //y related
uint8 sprite_direction; //direction of sprite?
uint8 sprite_direction; //direction of sprite? 0x1e
uint8 pad_1F[3]; // 0x1f
uint16 name_string_idx; // 0x22
} rct_unk_sprite;
typedef struct {
@@ -86,6 +89,7 @@ typedef union {
extern rct_sprite* g_sprite_list;
void create_balloon(int x, int y, int z, int colour);
rct_sprite *create_sprite(uint8 bl);
void reset_sprite_list();
void reset_0x69EBE4();

View File

@@ -111,14 +111,12 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx,
int newStaffId = i;
int _eax, _ebx, _ecx = _cx, _edx, _esi, _edi, _ebp;
_esi = 0;
int _eax, _ebx, _ecx = _cx, _edx;
_ebx = _bl;
RCT2_CALLFUNC_X(0x0069EC6B, &_eax, &_ebx, &_ecx, &_edx, &_esi, &_edi, &_ebp);
rct_peep* newPeep = (rct_peep*)_esi;
//if ((newPeep = create_peep_sprite(_bl)) == NULL)
if (_esi == 0)
rct_peep* newPeep = &(create_sprite(_bl)->peep);
if (newPeep == NULL)
{
*ebx = 0x80000000;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TOO_MANY_PEOPLE_IN_GAME;

View File

@@ -820,6 +820,10 @@ enum {
STR_REAL_PARKS = STR_BEGINNER_PARKS + 3,
STR_OTHER_PARKS = STR_BEGINNER_PARKS + 4,
STR_SELECT_COLOUR = 3099,
STR_SELECT_SECONDARY_COLOUR = 3100,
STR_SELECT_TERNARY_COLOUR = 3101,
STR_LIST_RIDES_TIP = 3104,
STR_LIST_SHOPS_AND_STALLS_TIP = 3105,
STR_LIST_KIOSKS_AND_FACILITIES_TIP = 3106,

View File

@@ -113,19 +113,19 @@ void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_view
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)){
case 0:
x = y - x;
y = y / 2 + start_x / 2 - z;
y = (y + start_x) / 2 - z;
break;
case 1:
x = -y - x;
y = y / 2 - start_x / 2 - z;
y = (y - start_x) / 2 - z;
break;
case 2:
x = -y + x;
y = -y / 2 - start_x / 2 - z;
y = (-y - start_x) / 2 - z;
break;
case 3:
x = y + x;
y = -y / 2 + start_x / 2 - z;
y = (-y + start_x) / 2 - z;
break;
}
@@ -221,8 +221,8 @@ void viewport_update_pointers()
*vp = NULL;
}
void sub_689174(sint16* x, sint16* y, uint8 curr_rotation){
//RCT2_CALLFUNC_X(0x00689174, (int*)&x, (int*)&y, &ecx, &curr_rotation, (int*)&window, (int*)&viewport, &ebp);
void sub_689174(sint16* x, sint16* y, sint16 *z, uint8 curr_rotation){
//RCT2_CALLFUNC_X(0x00689174, (int*)&x, (int*)&y, (int*)&z, &curr_rotation, (int*)&window, (int*)&viewport, &ebp);
sint16 start_x = *x;
sint16 start_y = *y;
@@ -262,6 +262,7 @@ void sub_689174(sint16* x, sint16* y, uint8 curr_rotation){
}
break;
}
*z = height;
}
/**
@@ -296,11 +297,12 @@ void viewport_update_position(rct_window *window)
sint16 x = viewport->view_width / 2 + window->saved_view_x;
sint16 y = viewport->view_height / 2 + window->saved_view_y;
sint16 z;
int curr_rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
sub_689174(&x, &y, curr_rotation);
sub_689174(&x, &y, &z, curr_rotation);
RCT2_CALLPROC_X(0x006E7A15, x, y, 0, 0, (int)window, (int)viewport, 0);
RCT2_CALLPROC_X(0x006E7A15, x, y, z, 0, (int)window, (int)viewport, 0);
//Clamp to the map minimum value
int at_map_edge = 0;
@@ -1039,3 +1041,50 @@ void hide_construction_rights()
}
}
}
/**
*
* rct2: 0x006CB70A
*/
void viewport_set_visibility(uint8 mode)
{
rct_window* window = window_get_main();
if(window != NULL) {
rct_viewport* edi = window->viewport;
uint32 invalidate = 0;
switch(mode) {
case 0: { //Set all these flags to 0, and invalidate if any were active
uint16 mask = VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_SEETHROUGH_RIDES |
VIEWPORT_FLAG_SEETHROUGH_SCENERY | VIEWPORT_FLAG_INVISIBLE_SUPPORTS |
VIEWPORT_FLAG_LAND_HEIGHTS | VIEWPORT_FLAG_TRACK_HEIGHTS |
VIEWPORT_FLAG_PATH_HEIGHTS | VIEWPORT_FLAG_INVISIBLE_PEEPS |
VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_HIDE_VERTICAL;
invalidate += edi->flags & mask;
edi->flags &= ~mask;
break;
}
case 1: //6CB79D
case 4: //6CB7C4
//Set underground on, invalidate if it was off
invalidate += !(edi->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE);
edi->flags |= VIEWPORT_FLAG_UNDERGROUND_INSIDE;
break;
case 2: //6CB7EB
//Set track heights on, invalidate if off
invalidate += !(edi->flags & VIEWPORT_FLAG_TRACK_HEIGHTS);
edi->flags |= VIEWPORT_FLAG_TRACK_HEIGHTS;
break;
case 3: //6CB7B1
case 5: //6CB7D8
//Set underground off, invalidate if it was on
invalidate += edi->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE;
edi->flags &= ~((uint16)VIEWPORT_FLAG_UNDERGROUND_INSIDE);
break;
}
if (invalidate != 0)
window_invalidate(window);
}
}

View File

@@ -47,11 +47,14 @@ enum {
extern rct_viewport* g_viewport_list;
void viewport_init_all();
void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_viewport* viewport);
void viewport_create(rct_window *w, int x, int y, int width, int height, int zoom, int center_x, int center_y, int center_z, char flags, sint16 sprite);
void viewport_update_pointers();
void viewport_update_position(rct_window *window);
void viewport_render(rct_drawpixelinfo *dpi, rct_viewport *viewport, int left, int top, int right, int bottom);
void sub_689174(sint16* x, sint16* y, sint16 *z, uint8 curr_rotation);
void screen_pos_to_map_pos(short *x, short *y);
void show_gridlines();
@@ -60,5 +63,6 @@ void show_land_rights();
void hide_land_rights();
void show_construction_rights();
void hide_construction_rights();
void viewport_set_visibility(uint8 mode);
#endif

View File

@@ -736,13 +736,15 @@ static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
// Get the colour
colour = w->colours[widget->colour];
// checkbox
gfx_fill_rect_inset(dpi, l, t, l + 9, b - 1, colour, 0x60);
if (widget->type != WWT_24) {
// checkbox
gfx_fill_rect_inset(dpi, l, t, l + 9, b - 1, colour, 0x60);
// fill it when checkbox is pressed
if (widget_is_pressed(w, widgetIndex)) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gfx_draw_string(dpi, (char*)0x009DED72, colour & 0x7F, l, t);
// fill it when checkbox is pressed
if (widget_is_pressed(w, widgetIndex)) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gfx_draw_string(dpi, (char*)0x009DED72, colour & 0x7F, l, t);
}
}
// draw the text

View File

@@ -21,7 +21,9 @@
#include <string.h>
#include "addresses.h"
#include "audio.h"
#include "game.h"
#include "gfx.h"
#include "map.h"
#include "osinterface.h"
#include "rct2.h"
#include "widget.h"
@@ -963,7 +965,49 @@ void window_scroll_to_location(rct_window *w, int x, int y, int z)
*/
void window_rotate_camera(rct_window *w)
{
RCT2_CALLPROC_X(0x0068881A, 0, 0, 0, 0, (int)w, 0, 0);
//RCT2_CALLPROC_X(0x0068881A, 0, 0, 0, 0, (int)w, 0, 0);
rct_viewport *viewport = w->viewport;
if (viewport == NULL)
return;
sint16 x = (viewport->width >> 1) + viewport->x;
sint16 y = (viewport->height >> 1) + viewport->y;
sint16 z;
uint8 rot = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
int ecx, edx, esi, edi = (int)viewport, ebp;
//has something to do with checking if middle of the viewport is obstructed
RCT2_CALLFUNC_X(0x00688972, (int*)&x, (int*)&y, &ecx, &edx, &esi, &edi, &ebp);
rct_viewport *other = (rct_viewport*)edi;
// other != viewport probably triggers on viewports in ride or guest window?
// x is 0x8000 if middle of viewport is obstructed by another window?
if (x == (sint16)SPRITE_LOCATION_NULL || other != viewport){
x = (viewport->view_width >> 1) + viewport->view_x;
y = (viewport->view_height >> 1) + viewport->view_y;
sub_689174(&x, &y, &z, rot);
} else {
z = map_element_height(x, y);
}
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = (rot + 1) % 4;
int new_x, new_y;
center_2d_coordinates(x, y, z, &new_x, &new_y, viewport);
w->saved_view_x = new_x;
w->saved_view_y = new_y;
viewport->view_x = new_x;
viewport->view_y = new_y;
window_invalidate(w);
RCT2_CALLPROC_EBPSAFE(0x00688956);
sub_0x0069E9A7();
}
/**

View File

@@ -162,6 +162,11 @@ typedef struct {
sint32 var_482;
} ride_variables;
typedef struct {
sint16 selected_scenery_id;
sint16 hover_counter;
} scenery_variables;
/**
* Window structure
* size: 0x4C0
@@ -199,6 +204,7 @@ typedef struct rct_window {
news_variables news;
map_variables map;
ride_variables ride;
scenery_variables scenery;
};
sint16 page; // 0x48A
sint16 var_48C;
@@ -457,6 +463,7 @@ void window_new_ride_open();
void window_banner_open();
void window_cheats_open();
void window_research_open();
void window_scenery_open();
void window_guest_list_init_vars_a();
void window_guest_list_init_vars_b();

View File

@@ -1250,8 +1250,8 @@ static void window_finances_marketing_paint()
case ADVERTISING_CAMPAIGN_RIDE_FREE:
case ADVERTISING_CAMPAIGN_RIDE:
ride = GET_RIDE(campaignRideIndex[i]);
RCT2_GLOBAL(0x013CE952, uint16) = ride->var_04A;
RCT2_GLOBAL(0x013CE952 + 2, uint32) = ride->var_04C;
RCT2_GLOBAL(0x013CE952, uint16) = ride->name;
RCT2_GLOBAL(0x013CE952 + 2, uint32) = ride->name_arguments;
break;
case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE:
shopString = campaignRideIndex[i] + 2016; // STR_BALLOONS+

View File

@@ -226,7 +226,7 @@ static void window_footpath_close()
window_get_register(w);
RCT2_CALLPROC_EBPSAFE(0x006A7831);
RCT2_CALLPROC_X(0x006CB70A, 0, 0, 0, 0, 0, 0, 0);
viewport_set_visibility(0);
RCT2_CALLPROC_EBPSAFE(0x0068AB1B);
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2;
window_invalidate_by_id(WC_TOP_TOOLBAR, 0);
@@ -677,7 +677,7 @@ static int window_footpath_set_provisional_path(int type, int x, int y, int z, i
eax = 3;
if (RCT2_GLOBAL(0x00F3EFA4, uint8) & 2)
eax = 1;
RCT2_CALLPROC_X(0x006CB70A, eax, 0, 0, 0, 0, 0, 0);
viewport_set_visibility((uint8)eax);
}
return cost;

View File

@@ -259,7 +259,8 @@ static void window_game_top_toolbar_mouseup()
case WIDX_SCENERY:
if (!tool_set(w, WIDX_SCENERY, 0)) {
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_CALLPROC_EBPSAFE(0x006E0FEF);
window_scenery_open();
//RCT2_CALLPROC_EBPSAFE(0x006E0FEF);
}
break;
case WIDX_PATH:

View File

@@ -118,8 +118,8 @@ int ride_name_compare(const void *a, const void *b)
rideA = GET_RIDE(*((uint8*)a));
rideB = GET_RIDE(*((uint8*)b));
format_string(rideAName, rideA->var_04A, &rideA->var_04C);
format_string(rideBName, rideB->var_04A, &rideB->var_04C);
format_string(rideAName, rideA->name, &rideA->name_arguments);
format_string(rideBName, rideB->name, &rideB->name_arguments);
return _strcmpi(rideAName, rideBName);
}
@@ -288,7 +288,7 @@ static void window_new_campaign_mousedown(int widgetIndex, rct_window *w, rct_wi
rct_ride *ride = GET_RIDE(window_new_campaign_rides[i]);
gDropdownItemsFormat[i] = 1142;
gDropdownItemsArgs[i] = (ride->var_04C << 16) | ride->var_04A;
gDropdownItemsArgs[i] = (ride->name_arguments << 16) | ride->name;
numItems++;
}
@@ -364,8 +364,8 @@ static void window_new_campaign_invalidate()
window_new_campaign_widgets[WIDX_RIDE_LABEL].image = STR_MARKETING_RIDE;
if (w->campaign.ride_id != SELECTED_RIDE_UNDEFINED) {
rct_ride *ride = GET_RIDE(w->campaign.ride_id);
window_new_campaign_widgets[WIDX_RIDE_DROPDOWN].image = ride->var_04A;
RCT2_GLOBAL(0x013CE952, uint32) = ride->var_04C;
window_new_campaign_widgets[WIDX_RIDE_DROPDOWN].image = ride->name;
RCT2_GLOBAL(0x013CE952, uint32) = ride->name_arguments;
}
break;
case ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE:

View File

@@ -25,6 +25,7 @@
#include "news_item.h"
#include "ride.h"
#include "string_ids.h"
#include "scenery.h"
#include "track.h"
#include "widget.h"
#include "window.h"
@@ -761,8 +762,7 @@ static void window_new_ride_paint()
rideEntry->name :
(typeId & 0xFF00) + 2;
} else {
uint8 *sceneryEntry = RCT2_GLOBAL(0x009ADA90 + (typeId & 0xFFFF) * 4, uint8*);
stringId = RCT2_GLOBAL(sceneryEntry, uint16);
stringId = g_scenerySetEntries[typeId]->name;
}
}
}
@@ -798,8 +798,7 @@ static void window_new_ride_paint()
rideEntry->name :
(typeId & 0xFF00) + 2;
} else {
uint8 *sceneryEntry = RCT2_GLOBAL(0x009ADA90 + (typeId & 0xFFFF) * 4, uint8*);
stringId = RCT2_GLOBAL(sceneryEntry, uint16);
stringId = g_scenerySetEntries[typeId]->name;
}
gfx_draw_string_left_wrapped(dpi, &stringId, x, y, 266, STR_RESEARCH_RIDE_LABEL, 0);
}
@@ -989,5 +988,6 @@ static void window_new_ride_select(rct_window *w)
}
// Show ride construction window
RCT2_CALLPROC_X(0x006B4800, *((sint16*)&item), 0, 0, 0, 0, 0, 0);
}
//RCT2_CALLPROC_X(0x006B4800, *((sint16*)&item), 0, 0, 0, 0, 0, 0);
ride_construct_new(*((sint16*)&item));
}

View File

@@ -23,6 +23,7 @@
#include "game.h"
#include "news_item.h"
#include "ride.h"
#include "scenery.h"
#include "string_ids.h"
#include "sprites.h"
#include "widget.h"
@@ -348,8 +349,7 @@ static void window_research_development_paint()
rideEntry->name :
((typeId >> 8) & 0xFF) + 2;
} else {
uint8 *sceneryEntry = RCT2_GLOBAL(0x009ADA90 + (typeId & 0xFFFF) * 4, uint8*);
stringId = RCT2_GLOBAL(sceneryEntry, uint16);
stringId = g_scenerySetEntries[typeId]->name;
}
}
}
@@ -388,8 +388,7 @@ static void window_research_development_paint()
lastDevelopmentFormat = STR_RESEARCH_RIDE_LABEL;
} else {
uint8 *sceneryEntry = RCT2_GLOBAL(0x009ADA90 + (typeId & 0xFFFF) * 4, uint8*);
stringId = RCT2_GLOBAL(sceneryEntry, uint16);
stringId = g_scenerySetEntries[typeId]->name;
lastDevelopmentFormat = STR_RESEARCH_SCENERY_LABEL;
}
gfx_draw_string_left_wrapped(dpi, &stringId, x, y, 266, lastDevelopmentFormat, 0);

View File

@@ -507,7 +507,7 @@ static void window_ride_list_scrollpaint()
ride = &g_ride_list[w->list_item_positions[i]];
// Ride name
gfx_draw_string_left_clipped(dpi, format, &ride->var_04A, 0, 0, y - 1, 159);
gfx_draw_string_left_clipped(dpi, format, &ride->name, 0, 0, y - 1, 159);
// Ride information
formatSecondary = 0;
@@ -648,12 +648,12 @@ static void window_ride_list_refresh_list(rct_window *w)
int current_list_position = list_index;
switch (w->list_information_type) {
case INFORMATION_TYPE_STATUS:
RCT2_GLOBAL(0x013CE952, uint32) = ride->var_04C;
RCT2_CALLPROC_X(0x006C2538, ride->var_04A, 0, 0x013CE952, 0, 0, RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, 0);
RCT2_GLOBAL(0x013CE952, uint32) = ride->name_arguments;
RCT2_CALLPROC_X(0x006C2538, ride->name, 0, 0x013CE952, 0, 0, RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, 0);
while (--current_list_position >= 0) {
otherRide = &g_ride_list[w->list_item_positions[current_list_position]];
RCT2_GLOBAL(0x013CE952, uint32) = otherRide->var_04C;
RCT2_CALLPROC_X(0x006C2538, otherRide->var_04A, 0, 0x013CE952, 0, 0, 0x0141EF68, 0);
RCT2_GLOBAL(0x013CE952, uint32) = otherRide->name_arguments;
RCT2_CALLPROC_X(0x006C2538, otherRide->name, 0, 0x013CE952, 0, 0, 0x0141EF68, 0);
if (strcmp((char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, (char*)0x0141EF68) >= 0)
break;

1166
src/window_scenery.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014 Maciek Baron, Daniel Tar
/*****************************************************************************
* Copyright (c) 2014 Maciek Baron, Dániel Tar
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
@@ -171,11 +171,7 @@ void window_staff_open()
window->colours[2] = 4;
}
void window_staff_cancel_tools() {
rct_window *w;
window_get_register(w);
void window_staff_cancel_tools(rct_window *w) {
int toolWindowClassification = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass);
int toolWindowNumber = RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber);
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
@@ -264,7 +260,7 @@ static void window_staff_resize()
*
* rct2: 0x006BD971
*/
static void window_staff_mousedown(int widgetIndex, rct_window*w, rct_widget* widget)
static void window_staff_mousedown(int widgetIndex, rct_window* w, rct_widget* widget)
{
short newSelectedTab;
int eax;