2014-05-21 16:27:31 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* Copyright (c) 2014 Ted John
|
|
|
|
* 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/>.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2014-10-06 18:36:58 +02:00
|
|
|
#include "../addresses.h"
|
2014-10-11 04:28:09 +02:00
|
|
|
#include "../interface/window.h"
|
2014-10-11 03:43:39 +02:00
|
|
|
#include "../world/map.h"
|
2014-05-21 16:27:31 +02:00
|
|
|
#include "ride.h"
|
2014-05-23 11:26:49 +02:00
|
|
|
#include "ride_data.h"
|
2014-05-24 15:31:42 +02:00
|
|
|
#include "ride_ratings.h"
|
2014-05-21 16:27:31 +02:00
|
|
|
|
2014-10-11 03:43:39 +02:00
|
|
|
enum {
|
|
|
|
RIDE_RATINGS_STATE_FIND_NEXT_RIDE,
|
2014-10-11 14:25:09 +02:00
|
|
|
RIDE_RATINGS_STATE_INITIALISE,
|
|
|
|
RIDE_RATINGS_STATE_2,
|
|
|
|
RIDE_RATINGS_STATE_CALCULATE,
|
|
|
|
RIDE_RATINGS_STATE_4,
|
|
|
|
RIDE_RATINGS_STATE_5
|
2014-10-11 03:43:39 +02:00
|
|
|
};
|
|
|
|
|
2014-10-11 04:28:09 +02:00
|
|
|
typedef void (*ride_ratings_calculation)(rct_ride *ride);
|
|
|
|
|
2014-10-11 03:43:39 +02:00
|
|
|
#define _rideRatingsState RCT2_GLOBAL(0x0138B591, uint8)
|
2014-10-11 14:25:09 +02:00
|
|
|
#define _rideRatingsCurrentRide RCT2_GLOBAL(0x0138B590, uint8)
|
|
|
|
|
|
|
|
static const ride_ratings_calculation ride_ratings_calculate_func_table[91];
|
2014-10-11 03:43:39 +02:00
|
|
|
|
|
|
|
static void ride_ratings_update_state_0();
|
|
|
|
static void ride_ratings_update_state_1();
|
|
|
|
static void ride_ratings_update_state_2();
|
|
|
|
static void ride_ratings_update_state_3();
|
|
|
|
static void ride_ratings_update_state_4();
|
|
|
|
static void ride_ratings_update_state_5();
|
|
|
|
static void loc_6B5BB2();
|
2014-10-11 04:28:09 +02:00
|
|
|
static void ride_ratings_calculate(rct_ride *ride);
|
|
|
|
static void ride_ratings_reliability_calculate(rct_ride *ride);
|
2014-10-11 03:43:39 +02:00
|
|
|
|
2014-10-11 19:55:56 +02:00
|
|
|
static int sub_6C6402(rct_map_element *mapElement, int *x, int *y, int *z)
|
2014-10-11 03:43:39 +02:00
|
|
|
{
|
|
|
|
int eax, ebx, ecx, edx, esi, edi, ebp;
|
|
|
|
|
|
|
|
eax = *x;
|
|
|
|
ecx = *y;
|
|
|
|
esi = (int)mapElement;
|
|
|
|
RCT2_CALLFUNC_X(0x006C6402, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
|
|
|
*x = *((uint16*)&eax);
|
|
|
|
*y = *((uint16*)&ecx);
|
|
|
|
*z = *((uint8*)&edx);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-10-11 19:55:56 +02:00
|
|
|
static int sub_6C60C2(rct_map_element *mapElement, int *x, int *y, int *z)
|
2014-10-11 14:25:09 +02:00
|
|
|
{
|
|
|
|
int eax, ebx, ecx, edx, esi, edi, ebp;
|
|
|
|
|
|
|
|
eax = *x;
|
|
|
|
ecx = *y;
|
|
|
|
esi = (int)mapElement;
|
|
|
|
RCT2_CALLFUNC_X(0x006C6402, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
|
|
|
*x = *((uint16*)&eax);
|
|
|
|
*y = *((uint16*)&ecx);
|
|
|
|
*z = *((uint8*)&edx);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-10-09 21:31:58 +02:00
|
|
|
/**
|
2014-10-11 03:43:39 +02:00
|
|
|
*
|
2014-10-09 21:31:58 +02:00
|
|
|
* rct2: 0x006B5A2A
|
|
|
|
*/
|
|
|
|
void ride_ratings_update_all()
|
|
|
|
{
|
2014-10-11 03:43:39 +02:00
|
|
|
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (_rideRatingsState) {
|
|
|
|
case RIDE_RATINGS_STATE_FIND_NEXT_RIDE:
|
|
|
|
ride_ratings_update_state_0();
|
|
|
|
break;
|
|
|
|
case RIDE_RATINGS_STATE_INITIALISE:
|
|
|
|
ride_ratings_update_state_1();
|
|
|
|
break;
|
2014-10-11 14:25:09 +02:00
|
|
|
case RIDE_RATINGS_STATE_2:
|
2014-10-11 03:43:39 +02:00
|
|
|
ride_ratings_update_state_2();
|
|
|
|
break;
|
2014-10-11 14:25:09 +02:00
|
|
|
case RIDE_RATINGS_STATE_CALCULATE:
|
2014-10-11 03:43:39 +02:00
|
|
|
ride_ratings_update_state_3();
|
|
|
|
break;
|
2014-10-11 14:25:09 +02:00
|
|
|
case RIDE_RATINGS_STATE_4:
|
2014-10-11 03:43:39 +02:00
|
|
|
ride_ratings_update_state_4();
|
|
|
|
break;
|
2014-10-11 14:25:09 +02:00
|
|
|
case RIDE_RATINGS_STATE_5:
|
2014-10-11 03:43:39 +02:00
|
|
|
ride_ratings_update_state_5();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006B5A5C
|
|
|
|
*/
|
|
|
|
static void ride_ratings_update_state_0()
|
|
|
|
{
|
|
|
|
rct_ride *ride;
|
|
|
|
|
|
|
|
_rideRatingsCurrentRide += 1;
|
|
|
|
if (_rideRatingsCurrentRide == 255)
|
|
|
|
_rideRatingsCurrentRide = 0;
|
|
|
|
|
|
|
|
ride = GET_RIDE(_rideRatingsCurrentRide);
|
|
|
|
if (ride->type != RIDE_TYPE_NULL && ride->status != RIDE_STATUS_CLOSED)
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_INITIALISE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006B5A94
|
|
|
|
*/
|
|
|
|
static void ride_ratings_update_state_1()
|
|
|
|
{
|
|
|
|
RCT2_GLOBAL(0x0138B594, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B596, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B598, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B59A, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B59C, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B59E, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5A0, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5A2, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5A4, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5A6, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5A8, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5AA, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5AC, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5AE, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5B0, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5B2, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5B4, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5B6, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5B8, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5BA, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5BC, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5BE, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5C0, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5C2, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5C4, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5C6, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5C8, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5CA, uint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x0138B5CC, uint16) = 0;
|
2014-10-11 14:25:09 +02:00
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_2;
|
2014-10-11 03:43:39 +02:00
|
|
|
RCT2_GLOBAL(0x0138B5CE, uint16) = 0;
|
|
|
|
loc_6B5BB2();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006B5BB2
|
|
|
|
*/
|
|
|
|
static void loc_6B5BB2()
|
|
|
|
{
|
|
|
|
rct_ride *ride;
|
|
|
|
int i, x, y, z;
|
|
|
|
|
|
|
|
ride = GET_RIDE(_rideRatingsCurrentRide);
|
|
|
|
if (ride->type == RIDE_TYPE_NULL || ride->status == RIDE_STATUS_CLOSED) {
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ride->type == RIDE_TYPE_MAZE) {
|
2014-10-11 14:25:09 +02:00
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_CALCULATE;
|
2014-10-11 03:43:39 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
if (ride->station_starts[i] != 0xFFFF) {
|
|
|
|
RCT2_GLOBAL(0x0138B5CE, uint16) &= ~1;
|
|
|
|
if (ride->entrances[i] == 0xFFFF)
|
|
|
|
RCT2_GLOBAL(0x0138B5CE, uint16) |= 1;
|
|
|
|
|
|
|
|
x = (ride->station_starts[i] & 0xFF) * 32;
|
|
|
|
y = (ride->station_starts[i] >> 8) * 32;
|
|
|
|
z = ride->station_heights[i] * 8;
|
|
|
|
|
|
|
|
RCT2_GLOBAL(0x0138B584, uint16) = x;
|
|
|
|
RCT2_GLOBAL(0x0138B586, uint16) = y;
|
|
|
|
RCT2_GLOBAL(0x0138B588, uint16) = z;
|
|
|
|
RCT2_GLOBAL(0x0138B592, uint8) = 255;
|
|
|
|
RCT2_GLOBAL(0x0138B58A, uint16) = x;
|
|
|
|
RCT2_GLOBAL(0x0138B58C, uint16) = y;
|
|
|
|
RCT2_GLOBAL(0x0138B58E, uint16) = z;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006B5C66
|
|
|
|
*/
|
|
|
|
static void ride_ratings_update_state_2()
|
|
|
|
{
|
2014-10-11 14:25:09 +02:00
|
|
|
// sub_6C6402 returns a carry, CALLFUNC doesn't support this
|
|
|
|
// so have to wait for sub_6C60C2 to be decompiled
|
2014-10-11 03:43:39 +02:00
|
|
|
RCT2_CALLPROC_EBPSAFE(0x006B5C66);
|
2014-10-11 14:25:09 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
rct_ride *ride;
|
|
|
|
rct_map_element *mapElement;
|
|
|
|
int x, y, z, trackType, entranceIndex;
|
|
|
|
|
|
|
|
ride = GET_RIDE(_rideRatingsCurrentRide);
|
|
|
|
if (ride->type == RIDE_TYPE_NULL || ride->status == RIDE_STATUS_CLOSED) {
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = RCT2_GLOBAL(0x0138B584, uint16) / 32;
|
|
|
|
y = RCT2_GLOBAL(0x0138B586, uint16) / 32;
|
|
|
|
z = RCT2_GLOBAL(0x0138B588, uint16) / 8;
|
|
|
|
|
|
|
|
mapElement = TILE_MAP_ELEMENT_POINTER(y * 256 + x);
|
|
|
|
trackType = RCT2_GLOBAL(0x0138B592, uint8);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if ((mapElement->type & MAP_ELEMENT_TYPE_MASK) != MAP_ELEMENT_TYPE_TRACK)
|
|
|
|
continue;
|
|
|
|
if (mapElement->base_height != z)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (trackType == 255 || (!(mapElement->properties.track.sequence & 0x0F) && trackType == mapElement->properties.track.type)) {
|
|
|
|
if (trackType == 1) {
|
|
|
|
entranceIndex = (mapElement->properties.track.sequence >> 4) & 7;
|
|
|
|
RCT2_GLOBAL(0x0138B5CE, uint16) &= ~1;
|
|
|
|
if (ride->entrances[entranceIndex] == 0xFFFF)
|
|
|
|
RCT2_GLOBAL(0x0138B5CE, uint16) |= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
RCT2_CALLPROC_X(0x006B5F9D, 0, 0, 0, 0, (int)mapElement, 0, 0);
|
|
|
|
|
|
|
|
x = RCT2_GLOBAL(0x0138B584, uint16);
|
|
|
|
y = RCT2_GLOBAL(0x0138B586, uint16);
|
|
|
|
if (!sub_6C60C2(mapElement, &x, &y, &z)) {
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_4;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x == RCT2_GLOBAL(0x0138B58A, uint16) && y == RCT2_GLOBAL(0x0138B58C, uint16) && z == RCT2_GLOBAL(0x0138B58E, uint16)) {
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_CALCULATE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
RCT2_GLOBAL(0x0138B584, uint16) = x;
|
|
|
|
RCT2_GLOBAL(0x0138B586, uint16) = y;
|
|
|
|
RCT2_GLOBAL(0x0138B588, uint16) = z;
|
|
|
|
RCT2_GLOBAL(0x0138B592, uint8) = mapElement->properties.track.type;
|
|
|
|
}
|
|
|
|
} while (!((mapElement++)->flags & MAP_ELEMENT_FLAG_LAST_TILE));
|
|
|
|
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
2014-10-11 03:43:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006B5E4D
|
|
|
|
*/
|
|
|
|
static void ride_ratings_update_state_3()
|
|
|
|
{
|
2014-10-11 04:28:09 +02:00
|
|
|
rct_ride *ride;
|
|
|
|
|
|
|
|
ride = GET_RIDE(_rideRatingsCurrentRide);
|
|
|
|
if (ride->type == RIDE_TYPE_NULL || ride->status == RIDE_STATUS_CLOSED) {
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ride_ratings_calculate(ride);
|
|
|
|
RCT2_CALLPROC_X(0x00655F64, 0, 0, 0, 0, 0, (int)ride, 0);
|
|
|
|
ride_ratings_reliability_calculate(ride);
|
|
|
|
|
|
|
|
window_invalidate_by_id(WC_RIDE, _rideRatingsCurrentRide);
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
2014-10-11 03:43:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006B5BAB
|
|
|
|
*/
|
|
|
|
static void ride_ratings_update_state_4()
|
|
|
|
{
|
2014-10-11 14:25:09 +02:00
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_5;
|
2014-10-11 03:43:39 +02:00
|
|
|
loc_6B5BB2();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006B5D72
|
|
|
|
*/
|
|
|
|
static void ride_ratings_update_state_5()
|
|
|
|
{
|
|
|
|
// sub_6C6402 returns a carry, CALLFUNC doesn't support this
|
|
|
|
// so have to wait for sub_6C6402 to be decompiled
|
|
|
|
RCT2_CALLPROC_EBPSAFE(0x006B5D72);
|
|
|
|
return;
|
|
|
|
|
|
|
|
rct_ride *ride;
|
|
|
|
rct_map_element *mapElement;
|
|
|
|
int x, y, z, trackType;
|
|
|
|
|
|
|
|
ride = GET_RIDE(_rideRatingsCurrentRide);
|
|
|
|
if (ride->type == RIDE_TYPE_NULL || ride->status == RIDE_STATUS_CLOSED) {
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = RCT2_GLOBAL(0x0138B584, uint16) / 32;
|
|
|
|
y = RCT2_GLOBAL(0x0138B586, uint16) / 32;
|
|
|
|
z = RCT2_GLOBAL(0x0138B588, uint16) / 8;
|
|
|
|
|
|
|
|
mapElement = TILE_MAP_ELEMENT_POINTER(y * 256 + x);
|
|
|
|
trackType = RCT2_GLOBAL(0x0138B592, uint8);
|
|
|
|
|
|
|
|
do {
|
|
|
|
if ((mapElement->type & MAP_ELEMENT_TYPE_MASK) != MAP_ELEMENT_TYPE_TRACK)
|
|
|
|
continue;
|
|
|
|
if (mapElement->base_height != z)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (trackType == 255 || trackType == mapElement->properties.track.type) {
|
|
|
|
RCT2_CALLPROC_X(0x006B5F9D, 0, 0, 0, 0, (int)mapElement, 0, 0);
|
|
|
|
|
|
|
|
x = RCT2_GLOBAL(0x0138B584, uint16);
|
|
|
|
y = RCT2_GLOBAL(0x0138B586, uint16);
|
|
|
|
if (!sub_6C6402(mapElement, &x, &y, &z)) {
|
2014-10-11 14:25:09 +02:00
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_CALCULATE;
|
2014-10-11 03:43:39 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
x >>= 16;
|
|
|
|
y >>= 16;
|
|
|
|
if (x == RCT2_GLOBAL(0x0138B58A, uint16) && y == RCT2_GLOBAL(0x0138B58C, uint16) && z == RCT2_GLOBAL(0x0138B58E, uint16)) {
|
2014-10-11 14:25:09 +02:00
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_CALCULATE;
|
2014-10-11 03:43:39 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
RCT2_GLOBAL(0x0138B584, uint16) = x;
|
|
|
|
RCT2_GLOBAL(0x0138B586, uint16) = y;
|
|
|
|
RCT2_GLOBAL(0x0138B588, uint16) = z;
|
|
|
|
RCT2_GLOBAL(0x0138B592, uint8) = mapElement->properties.track.type;
|
|
|
|
}
|
|
|
|
} while (!((mapElement++)->flags & MAP_ELEMENT_FLAG_LAST_TILE));
|
|
|
|
|
|
|
|
_rideRatingsState = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
|
2014-10-09 21:31:58 +02:00
|
|
|
}
|
|
|
|
|
2014-10-11 04:28:09 +02:00
|
|
|
static void ride_ratings_calculate(rct_ride *ride)
|
|
|
|
{
|
2014-10-11 14:25:09 +02:00
|
|
|
ride_ratings_calculation calcFunc;
|
|
|
|
|
|
|
|
calcFunc = ride_ratings_calculate_func_table[ride->type];
|
|
|
|
if (calcFunc == NULL) {
|
|
|
|
calcFunc = RCT2_ADDRESS(0x0097E050, ride_ratings_calculation)[ride->type];
|
|
|
|
RCT2_CALLPROC_X((int)calcFunc, 0, 0, 0, 0, 0, (int)ride, 0);
|
|
|
|
} else {
|
|
|
|
calcFunc(ride);
|
|
|
|
}
|
2014-10-11 04:28:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void ride_ratings_reliability_calculate(rct_ride *ride)
|
|
|
|
{
|
|
|
|
rct_ride *ride2;
|
|
|
|
int i, otherRidesOfSameType;
|
|
|
|
|
|
|
|
if (ride->excitement == (ride_rating)0xFFFF)
|
|
|
|
return;
|
|
|
|
|
|
|
|
int reliability =
|
|
|
|
(((ride->excitement * RCT2_GLOBAL(0x0097CD1E + (ride->type * 6), sint16)) * 32) >> 15) +
|
|
|
|
(((ride->intensity * RCT2_GLOBAL(0x0097CD20 + (ride->type * 6), sint16)) * 32) >> 15) +
|
|
|
|
(((ride->nausea * RCT2_GLOBAL(0x0097CD22 + (ride->type * 6), sint16)) * 32) >> 15);
|
|
|
|
|
|
|
|
int monthsOld = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) - ride->build_date;
|
|
|
|
|
|
|
|
// New ride reward
|
|
|
|
if (monthsOld <= 12) {
|
|
|
|
reliability += 10;
|
|
|
|
if (monthsOld <= 4)
|
|
|
|
reliability += 20;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Old ride penalty
|
|
|
|
if (monthsOld >= 40) reliability -= reliability / 4;
|
|
|
|
if (monthsOld >= 64) reliability -= reliability / 4;
|
|
|
|
if (monthsOld < 200) {
|
|
|
|
if (monthsOld >= 88) reliability -= reliability / 4;
|
|
|
|
if (monthsOld >= 104) reliability -= reliability / 4;
|
|
|
|
if (monthsOld >= 120) reliability -= reliability / 2;
|
|
|
|
if (monthsOld >= 128) reliability -= reliability / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Other ride of same type penalty
|
|
|
|
otherRidesOfSameType = 0;
|
|
|
|
FOR_ALL_RIDES(i, ride2) {
|
|
|
|
if (ride2->type == ride->type)
|
|
|
|
otherRidesOfSameType++;
|
|
|
|
}
|
|
|
|
if (otherRidesOfSameType > 1)
|
|
|
|
reliability -= reliability / 4;
|
|
|
|
|
|
|
|
ride->reliability = max(0, reliability);
|
|
|
|
}
|
|
|
|
|
2014-05-21 18:00:58 +02:00
|
|
|
/**
|
|
|
|
* rct2: sub_65E621
|
|
|
|
*
|
|
|
|
* I think this function computes ride upkeep? Though it is weird that the
|
|
|
|
*
|
|
|
|
* inputs
|
|
|
|
* - edi: ride ptr
|
|
|
|
*/
|
2014-10-11 15:14:10 +02:00
|
|
|
static uint16 ride_compute_upkeep(rct_ride *ride)
|
2014-05-21 18:00:58 +02:00
|
|
|
{
|
2014-05-23 12:09:16 +02:00
|
|
|
// data stored at 0x0057E3A8, incrementing 18 bytes at a time
|
|
|
|
uint16 upkeep = initialUpkeepCosts[ride->type];
|
2014-05-21 18:00:58 +02:00
|
|
|
|
2014-05-23 12:09:16 +02:00
|
|
|
uint16 trackCost = costPerTrackPiece[ride->type];
|
2014-09-05 19:10:30 +02:00
|
|
|
uint8 dl = ride->drops;
|
2014-05-23 12:09:16 +02:00
|
|
|
|
2014-05-21 18:00:58 +02:00
|
|
|
dl = dl >> 6;
|
|
|
|
dl = dl & 3;
|
2014-05-23 12:09:16 +02:00
|
|
|
upkeep += trackCost * dl;
|
2014-05-21 18:00:58 +02:00
|
|
|
|
2014-09-05 19:10:30 +02:00
|
|
|
uint32 totalLength = (ride->length[0] + ride->length[1] + ride->length[2] + ride->length[3]) >> 16;
|
2014-05-21 18:00:58 +02:00
|
|
|
|
2014-05-23 11:26:49 +02:00
|
|
|
// The data originally here was 20's and 0's. The 20's all represented
|
|
|
|
// rides that had tracks. The 0's were fixed rides like crooked house or
|
|
|
|
// bumper cars.
|
|
|
|
// Data source is 0x0097E3AC
|
|
|
|
if (hasRunningTrack[ride->type]) {
|
2014-09-05 19:10:30 +02:00
|
|
|
totalLength *= 20;
|
2014-05-23 11:26:49 +02:00
|
|
|
}
|
2014-09-05 19:10:30 +02:00
|
|
|
upkeep += (uint16)(totalLength >> 10);
|
2014-05-21 18:00:58 +02:00
|
|
|
|
|
|
|
if (ride->lifecycle_flags & RIDE_LIFECYCLE_ON_RIDE_PHOTO) {
|
2014-05-23 10:49:42 +02:00
|
|
|
// The original code read from a table starting at 0x0097E3AE and
|
|
|
|
// incrementing by 0x12 bytes between values. However, all of these
|
|
|
|
// values were 40. I have replaced the table lookup with the constant
|
|
|
|
// 40 in this case.
|
|
|
|
upkeep += 40;
|
2014-05-21 18:00:58 +02:00
|
|
|
}
|
|
|
|
|
2014-05-23 12:09:16 +02:00
|
|
|
// Originally this data was at 0x0097E3B0 and incrementing in 18 byte
|
|
|
|
// offsets. The value here for every ride is 80, except for the reverser,
|
|
|
|
// which is 10
|
|
|
|
uint16 eax;
|
|
|
|
if (ride->type == RIDE_TYPE_REVERSER_ROLLER_COASTER) {
|
|
|
|
eax = 10;
|
|
|
|
} else {
|
|
|
|
eax = 80;
|
|
|
|
}
|
2014-05-21 18:00:58 +02:00
|
|
|
|
|
|
|
// not sure what this value is; it's only written to in one place, where
|
|
|
|
// it's incremented.
|
|
|
|
sint16 dx = RCT2_GLOBAL(0x0138B5CC, sint16);
|
2014-05-22 02:13:53 +02:00
|
|
|
upkeep += eax * dx;
|
2014-05-21 18:00:58 +02:00
|
|
|
|
|
|
|
dx = RCT2_GLOBAL(0x0138B5CA, sint16);
|
2014-05-23 12:09:16 +02:00
|
|
|
// Originally there was a lookup into a table at 0x0097E3B0 and
|
|
|
|
// incrementing in 18 byte offsets. The value here for every ride was 20,
|
|
|
|
// so it's been replaced here by the constant.
|
|
|
|
upkeep += 20 * dx;
|
2014-05-21 18:00:58 +02:00
|
|
|
|
2014-05-22 02:13:53 +02:00
|
|
|
// these seem to be adhoc adjustments to a ride's upkeep/cost, times
|
2014-05-21 18:00:58 +02:00
|
|
|
// various variables set on the ride itself.
|
|
|
|
|
|
|
|
// https://gist.github.com/kevinburke/e19b803cd2769d96c540
|
2014-09-03 20:13:37 +02:00
|
|
|
upkeep += rideUnknownData1[ride->type] * ride->num_vehicles;
|
2014-05-21 18:00:58 +02:00
|
|
|
|
|
|
|
// either set to 3 or 0, extra boosts for some rides including mini golf
|
2014-05-23 13:57:50 +02:00
|
|
|
if (rideUnknownData2[ride->type]) {
|
2014-09-18 03:48:51 +02:00
|
|
|
upkeep += 3 * ride->num_cars_per_train;
|
2014-05-23 13:57:50 +02:00
|
|
|
}
|
2014-05-21 18:00:58 +02:00
|
|
|
|
2014-05-22 02:13:53 +02:00
|
|
|
// slight upkeep boosts for some rides - 5 for mini railroad, 10 for log
|
2014-05-21 18:00:58 +02:00
|
|
|
// flume/rapids, 10 for roller coaster, 28 for giga coaster
|
2014-09-03 20:13:37 +02:00
|
|
|
upkeep += rideUnknownData3[ride->type] * ride->num_stations;
|
2014-05-21 18:00:58 +02:00
|
|
|
|
2014-09-09 15:16:09 +02:00
|
|
|
if (ride->mode == RIDE_MODE_REVERSE_INCLINE_LAUNCHED_SHUTTLE) {
|
2014-05-22 02:13:53 +02:00
|
|
|
upkeep += 30;
|
2014-05-21 18:00:58 +02:00
|
|
|
} else if (ride->mode == RIDE_MODE_POWERED_LAUNCH) {
|
2014-05-22 02:13:53 +02:00
|
|
|
upkeep += 160;
|
2014-05-21 18:00:58 +02:00
|
|
|
} else if (ride->mode == RIDE_MODE_LIM_POWERED_LAUNCH) {
|
2014-05-22 02:13:53 +02:00
|
|
|
upkeep += 320;
|
2014-09-09 15:16:09 +02:00
|
|
|
} else if (ride->mode == RIDE_MODE_POWERED_LAUNCH_35 ||
|
2014-05-21 18:00:58 +02:00
|
|
|
ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED) {
|
2014-05-22 02:13:53 +02:00
|
|
|
upkeep += 220;
|
2014-05-21 18:00:58 +02:00
|
|
|
}
|
|
|
|
|
2014-05-22 14:16:22 +02:00
|
|
|
// multiply by 5/8
|
2014-05-22 02:13:53 +02:00
|
|
|
upkeep = upkeep * 10;
|
|
|
|
upkeep = upkeep >> 4;
|
|
|
|
return upkeep;
|
2014-05-21 16:27:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* rct2: 0x0065E7FB
|
|
|
|
*
|
|
|
|
* inputs
|
|
|
|
* - bx: excitement
|
|
|
|
* - cx: intensity
|
|
|
|
* - bp: nausea
|
|
|
|
* - edi: ride ptr
|
|
|
|
*/
|
2014-10-11 15:14:10 +02:00
|
|
|
static void ride_ratings_apply_adjustments(rct_ride *ride, rating_tuple *ratings)
|
2014-05-21 16:27:31 +02:00
|
|
|
{
|
2014-10-11 15:14:10 +02:00
|
|
|
rct_ride_type *rideEntry;
|
|
|
|
|
|
|
|
rideEntry = gRideTypeList[ride->subtype];
|
2014-05-21 16:27:31 +02:00
|
|
|
|
2014-10-11 15:14:10 +02:00
|
|
|
// Apply ride entry multipliers
|
|
|
|
ratings->excitement += ((ratings->excitement * rideEntry->excitement_multipler) >> 7);
|
|
|
|
ratings->intensity += ((ratings->intensity * rideEntry->intensity_multipler ) >> 7);
|
|
|
|
ratings->nausea += ((ratings->nausea * rideEntry->nausea_multipler ) >> 7);
|
2014-05-21 16:27:31 +02:00
|
|
|
|
|
|
|
// As far as I can tell, this flag detects whether the ride is a roller
|
|
|
|
// coaster, or a log flume or rapids. Everything else it's not set.
|
|
|
|
// more detail: https://gist.github.com/kevinburke/d951e74e678b235eef3e
|
2014-10-11 15:14:10 +02:00
|
|
|
uint16 flags = RCT2_GLOBAL(0x0097D4F2 + ride->type * 8, uint16);
|
|
|
|
if (flags & 0x80) {
|
|
|
|
uint16 totalAirTime = ride->total_air_time;
|
|
|
|
if (rideEntry->var_008 & 0x800) {
|
|
|
|
totalAirTime -= 96;
|
|
|
|
if (totalAirTime >= 0) {
|
|
|
|
ratings->excitement -= totalAirTime / 8;
|
|
|
|
ratings->nausea -= totalAirTime / 16;
|
2014-05-21 16:27:31 +02:00
|
|
|
}
|
|
|
|
} else {
|
2014-10-11 15:14:10 +02:00
|
|
|
ratings->excitement += totalAirTime / 8;
|
|
|
|
ratings->nausea += totalAirTime / 16;
|
2014-05-21 16:27:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-10-11 15:14:10 +02:00
|
|
|
* Lowers excitment, the higher the intensity.
|
|
|
|
* rct2: 0x0065E7A3
|
2014-05-21 16:27:31 +02:00
|
|
|
*/
|
2014-10-11 15:14:10 +02:00
|
|
|
static void ride_ratings_apply_intensity_penalty(rating_tuple *ratings)
|
2014-05-21 16:27:31 +02:00
|
|
|
{
|
2014-10-11 15:14:10 +02:00
|
|
|
static const ride_rating intensityBounds[] = { 1000, 1100, 1200, 1320, 1450 };
|
|
|
|
int i;
|
|
|
|
|
|
|
|
ride_rating excitement = ratings->excitement;
|
|
|
|
for (i = 0; i < countof(intensityBounds); i++)
|
|
|
|
if (ratings->intensity >= intensityBounds[i])
|
|
|
|
excitement -= excitement / 4;
|
|
|
|
ratings->excitement = excitement;
|
2014-05-21 16:27:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2014-10-11 14:25:09 +02:00
|
|
|
* rct2: 0x00655FD6
|
2014-05-21 16:27:31 +02:00
|
|
|
*/
|
2014-10-11 15:14:10 +02:00
|
|
|
static void sub_655FD6(rct_ride *ride)
|
2014-05-21 16:27:31 +02:00
|
|
|
{
|
2014-10-11 14:25:09 +02:00
|
|
|
ride->var_198 += (ride->lift_hill_speed - RCT2_ADDRESS(0x0097D7C9, uint8)[ride->type * 4]) * 2;
|
2014-05-21 16:27:31 +02:00
|
|
|
}
|
2014-10-11 14:25:09 +02:00
|
|
|
|
2014-10-11 19:55:56 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0065E277
|
|
|
|
*/
|
|
|
|
static int sub_65E277()
|
|
|
|
{
|
|
|
|
int eax, ebx, ecx, edx, esi, edi, ebp;
|
|
|
|
RCT2_CALLFUNC_X(0x0065E277, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
|
|
|
return ebx;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0065E72D
|
|
|
|
*/
|
|
|
|
static int sub_65E72D(rct_ride *ride)
|
|
|
|
{
|
|
|
|
int eax, ebx, ecx, edx, esi, edi, ebp;
|
|
|
|
edi = (int)ride;
|
|
|
|
RCT2_CALLFUNC_X(0x0065E277, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
|
|
|
return edx & 0xFFFF;
|
|
|
|
}
|
|
|
|
|
2014-10-12 00:07:20 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0065DDD1
|
|
|
|
*/
|
2014-10-11 23:05:52 +02:00
|
|
|
static rating_tuple sub_65DDD1(rct_ride *ride)
|
|
|
|
{
|
|
|
|
int eax, ebx, ecx, edx, esi, edi, ebp;
|
|
|
|
edi = (int)ride;
|
|
|
|
RCT2_CALLFUNC_X(0x0065DDD1, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
|
|
|
|
|
|
|
rating_tuple rating = { ebx, ecx, ebp };
|
|
|
|
return rating;
|
|
|
|
}
|
|
|
|
|
2014-10-12 00:07:20 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0065E1C2
|
|
|
|
*/
|
2014-10-11 23:05:52 +02:00
|
|
|
static rating_tuple sub_65E1C2(rct_ride *ride)
|
|
|
|
{
|
|
|
|
int eax, ebx, ecx, edx, esi, edi, ebp;
|
|
|
|
edi = (int)ride;
|
|
|
|
RCT2_CALLFUNC_X(0x0065E1C2, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
|
|
|
|
|
|
|
rating_tuple rating = { ebx, ecx, ebp };
|
|
|
|
return rating;
|
|
|
|
}
|
|
|
|
|
2014-10-12 00:07:20 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0065DCDC
|
|
|
|
*/
|
|
|
|
static rating_tuple ride_ratings_get_gforce_ratings(rct_ride *ride)
|
|
|
|
{
|
|
|
|
int eax, ebx, ecx, edx, esi, edi, ebp;
|
|
|
|
edi = (int)ride;
|
|
|
|
RCT2_CALLFUNC_X(0x0065DCDC, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
|
|
|
|
|
|
|
rating_tuple rating = { ebx, ecx, ebp };
|
|
|
|
return rating;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0065E139
|
|
|
|
*/
|
|
|
|
static rating_tuple ride_ratings_get_drop_ratings(rct_ride *ride)
|
|
|
|
{
|
|
|
|
int eax, ebx, ecx, edx, esi, edi, ebp;
|
|
|
|
edi = (int)ride;
|
|
|
|
RCT2_CALLFUNC_X(0x0065E139, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
|
|
|
|
|
|
|
rating_tuple rating = { ebx, ecx, ebp };
|
|
|
|
return rating;
|
|
|
|
}
|
|
|
|
|
2014-10-11 19:18:20 +02:00
|
|
|
/**
|
|
|
|
* Calculates a score based on the surrounding scenery.
|
|
|
|
* rct2: 0x0065E557
|
|
|
|
*/
|
|
|
|
static int ride_ratings_get_scenery_score(rct_ride *ride)
|
|
|
|
{
|
|
|
|
int i, x, y, z, xx, yy, type, numSceneryItems;
|
|
|
|
uint16 stationXY;
|
|
|
|
rct_map_element *mapElement;
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
stationXY = ride->station_starts[i];
|
|
|
|
if (stationXY != 0xFFFF)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i == 4)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (ride->type == RIDE_TYPE_MAZE)
|
|
|
|
stationXY = ride->entrances[0];
|
|
|
|
|
|
|
|
x = stationXY & 0xFF;
|
|
|
|
y = stationXY >> 8;
|
|
|
|
z = map_element_height(x * 32, y * 32);
|
|
|
|
|
|
|
|
// Check if station is underground, returns a fixed mediocre score since you can't have scenery underground
|
|
|
|
if (z > ride->station_heights[i] * 8)
|
|
|
|
return 40;
|
|
|
|
|
|
|
|
// Count surrounding scenery items
|
|
|
|
numSceneryItems = 0;
|
|
|
|
for (yy = y - 5; yy <= y + 5; yy++) {
|
|
|
|
for (xx = x - 5; xx <= x + 5; xx++) {
|
|
|
|
// Count scenery items on this tile
|
|
|
|
mapElement = TILE_MAP_ELEMENT_POINTER(yy * 256 + xx);
|
|
|
|
do {
|
|
|
|
if (mapElement->flags & 0x10)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
type = mapElement->type & MAP_ELEMENT_TYPE_MASK;
|
|
|
|
if (type == MAP_ELEMENT_TYPE_SCENERY || type == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE)
|
|
|
|
numSceneryItems++;
|
|
|
|
} while (!((mapElement++)->flags & MAP_ELEMENT_FLAG_LAST_TILE));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return min(numSceneryItems, 47) * 5;
|
|
|
|
}
|
|
|
|
|
2014-10-11 14:25:09 +02:00
|
|
|
#pragma region Ride rating calculation functions
|
|
|
|
|
2014-10-12 00:07:20 +02:00
|
|
|
static void ride_ratings_calculate_mine_train_coaster(rct_ride *ride)
|
|
|
|
{
|
|
|
|
rating_tuple ratings, unkRating;
|
|
|
|
int totalLength, time;
|
|
|
|
|
|
|
|
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ride->var_198 = 16;
|
|
|
|
sub_655FD6(ride);
|
|
|
|
|
|
|
|
// Base ratings
|
|
|
|
ratings.excitement = RIDE_RATING(2,90);
|
|
|
|
ratings.intensity = RIDE_RATING(2,30);
|
|
|
|
ratings.nausea = RIDE_RATING(2,10);
|
|
|
|
|
|
|
|
// Apply length of ride factor
|
|
|
|
totalLength = (ride->length[0] + ride->length[1] + ride->length[2] + ride->length[3]) >> 16;
|
|
|
|
ratings.excitement += (min(6000, totalLength) * 764) >> 16;
|
|
|
|
|
|
|
|
// Apply racing coaster factor
|
|
|
|
if (ride->depart_flags & RIDE_DEPART_SYNCHRONISE_WITH_ADJACENT_STATIONS) {
|
|
|
|
ratings.excitement += RIDE_RATING(0,40);
|
|
|
|
ratings.intensity += RIDE_RATING(0,05);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Apply length of train factor
|
|
|
|
ratings.excitement += ((ride->num_cars_per_train - 1) * 187245) >> 16;
|
|
|
|
|
|
|
|
// Apply maximum speed factor
|
|
|
|
ratings.excitement += ((ride->max_speed >> 16) * 44281) >> 16;
|
|
|
|
ratings.intensity += ((ride->max_speed >> 16) * 88562) >> 16;
|
|
|
|
ratings.nausea += ((ride->max_speed >> 16) * 35424) >> 16;
|
|
|
|
|
|
|
|
// Apply average speed factor
|
|
|
|
ratings.excitement += ((ride->average_speed >> 16) * 291271) >> 16;
|
|
|
|
ratings.intensity += ((ride->average_speed >> 16) * 436906) >> 16;
|
|
|
|
|
|
|
|
// Apply ride duration factor
|
|
|
|
time = ride->time[0] + ride->time[1] + ride->time[2] + ride->time[3];
|
|
|
|
ratings.excitement += (min(150, time) * 26214) >> 16;
|
|
|
|
|
|
|
|
// Apply G forces factor
|
|
|
|
unkRating = ride_ratings_get_gforce_ratings(ride);
|
|
|
|
ratings.excitement += (unkRating.excitement * 40960) >> 16;
|
|
|
|
ratings.intensity += (unkRating.intensity * 35746) >> 16;
|
|
|
|
ratings.nausea += (unkRating.nausea * 49648) >> 16;
|
|
|
|
|
|
|
|
// Apply ?
|
|
|
|
unkRating = sub_65DDD1(ride);
|
|
|
|
ratings.excitement += (unkRating.excitement * 29721) >> 16;
|
|
|
|
ratings.intensity += (unkRating.intensity * 34767) >> 16;
|
|
|
|
ratings.nausea += (unkRating.nausea * 45749) >> 16;
|
|
|
|
|
|
|
|
// Apply drops factor
|
|
|
|
unkRating = ride_ratings_get_drop_ratings(ride);
|
|
|
|
ratings.excitement += (unkRating.excitement * 29127) >> 16;
|
|
|
|
ratings.intensity += (unkRating.intensity * 46811) >> 16;
|
|
|
|
ratings.nausea += (unkRating.nausea * 49152) >> 16;
|
|
|
|
|
|
|
|
// Apply ?
|
|
|
|
unkRating = sub_65E1C2(ride);
|
|
|
|
ratings.excitement += (unkRating.excitement * 19275) >> 16;
|
|
|
|
ratings.intensity += (unkRating.intensity * 32768) >> 16;
|
|
|
|
ratings.nausea += (unkRating.nausea * 35108) >> 16;
|
|
|
|
|
|
|
|
// Apply ?
|
|
|
|
ratings.excitement += (sub_65E277() * 21472) >> 16;
|
|
|
|
|
|
|
|
ratings.excitement += (ride_ratings_get_scenery_score(ride) * 16732) >> 16;
|
|
|
|
|
|
|
|
// Apply low highest drop penalty
|
|
|
|
if (ride->highest_drop_height < 8) {
|
|
|
|
ride->excitement /= 2;
|
|
|
|
ride->intensity /= 2;
|
|
|
|
ride->nausea /= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Apply low max speed penalty
|
|
|
|
if (ride->max_speed < 0xA0000) {
|
|
|
|
ride->excitement /= 2;
|
|
|
|
ride->intensity /= 2;
|
|
|
|
ride->nausea /= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Apply low maximum negative vertical G force penalty
|
|
|
|
if (ride->max_negative_vertical_g > FIXED_2DP(0,10)) {
|
|
|
|
ride->excitement /= 2;
|
|
|
|
ride->intensity /= 2;
|
|
|
|
ride->nausea /= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Apply short ride penalty
|
|
|
|
if (ride->length[0] < 0x1720000) {
|
|
|
|
ride->excitement /= 2;
|
|
|
|
ride->intensity /= 2;
|
|
|
|
ride->nausea /= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Apply low number of drops penalty
|
|
|
|
if ((ride->drops & 0x3F) < 2) {
|
|
|
|
ride->excitement /= 2;
|
|
|
|
ride->intensity /= 2;
|
|
|
|
ride->nausea /= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ride_ratings_apply_intensity_penalty(&ratings);
|
|
|
|
ride_ratings_apply_adjustments(ride, &ratings);
|
|
|
|
|
|
|
|
ride->ratings = ratings;
|
|
|
|
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
|
|
|
|
ride->inversions &= 0x1F;
|
|
|
|
ride->inversions |= sub_65E72D(ride) << 5;
|
|
|
|
}
|
|
|
|
|
2014-10-11 23:05:52 +02:00
|
|
|
static void ride_ratings_calculate_maze(rct_ride *ride)
|
2014-10-11 14:25:09 +02:00
|
|
|
{
|
|
|
|
rating_tuple ratings;
|
|
|
|
|
|
|
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_TESTED;
|
|
|
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_NO_RAW_STATS;
|
2014-10-11 23:05:52 +02:00
|
|
|
ride->var_198 = 8;
|
2014-10-11 14:25:09 +02:00
|
|
|
sub_655FD6(ride);
|
|
|
|
|
2014-10-11 23:05:52 +02:00
|
|
|
// Base ratings
|
|
|
|
ratings.excitement = RIDE_RATING(1,30);
|
|
|
|
ratings.intensity = RIDE_RATING(0,50);
|
|
|
|
ratings.nausea = RIDE_RATING(0,00);
|
|
|
|
|
|
|
|
// Apply size factor
|
|
|
|
int unk = min(ride->maze_tiles, 100);
|
|
|
|
ratings.excitement += unk;
|
|
|
|
ratings.intensity += unk / 2;
|
|
|
|
|
|
|
|
ratings.excitement += (ride_ratings_get_scenery_score(ride) * 22310) >> 16;
|
2014-10-11 14:25:09 +02:00
|
|
|
|
2014-10-11 15:14:10 +02:00
|
|
|
ride_ratings_apply_intensity_penalty(&ratings);
|
|
|
|
ride_ratings_apply_adjustments(ride, &ratings);
|
2014-10-11 14:25:09 +02:00
|
|
|
|
2014-10-11 19:18:20 +02:00
|
|
|
ride->ratings = ratings;
|
2014-10-11 14:25:09 +02:00
|
|
|
|
2014-10-11 15:14:10 +02:00
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
2014-10-11 14:25:09 +02:00
|
|
|
ride->var_14D |= 2;
|
|
|
|
|
|
|
|
ride->inversions &= 0x1F;
|
2014-10-11 23:05:52 +02:00
|
|
|
ride->inversions |= 0 << 5;
|
2014-10-11 14:25:09 +02:00
|
|
|
}
|
|
|
|
|
2014-10-11 15:14:10 +02:00
|
|
|
static void ride_ratings_calculate_food_stall(rct_ride *ride)
|
|
|
|
{
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ride_ratings_calculate_drink_stall(rct_ride *ride)
|
|
|
|
{
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ride_ratings_calculate_shop(rct_ride *ride)
|
|
|
|
{
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
}
|
|
|
|
|
2014-10-11 19:18:20 +02:00
|
|
|
static void ride_ratings_calculate_merry_go_round(rct_ride *ride)
|
|
|
|
{
|
|
|
|
rating_tuple ratings;
|
|
|
|
|
|
|
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_TESTED;
|
|
|
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_NO_RAW_STATS;
|
|
|
|
ride->var_198 = 16;
|
|
|
|
sub_655FD6(ride);
|
|
|
|
|
|
|
|
int unk = ride->var_0D0 * 5;
|
|
|
|
ratings.excitement = unk + RIDE_RATING(0,60) + ((ride_ratings_get_scenery_score(ride) * 19521) >> 16);
|
|
|
|
ratings.intensity = unk + RIDE_RATING(0,15);
|
|
|
|
ratings.nausea = unk + RIDE_RATING(0,30);
|
|
|
|
|
|
|
|
ride_ratings_apply_intensity_penalty(&ratings);
|
|
|
|
ride_ratings_apply_adjustments(ride, &ratings);
|
|
|
|
|
|
|
|
ride->ratings = ratings;
|
|
|
|
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
|
|
|
|
ride->inversions &= 0x1F;
|
|
|
|
ride->inversions |= 7 << 5;
|
|
|
|
}
|
|
|
|
|
2014-10-11 15:14:10 +02:00
|
|
|
static void ride_ratings_calculate_information_kiosk(rct_ride *ride)
|
|
|
|
{
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ride_ratings_calculate_bathroom(rct_ride *ride)
|
|
|
|
{
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
}
|
|
|
|
|
2014-10-11 23:05:52 +02:00
|
|
|
static void ride_ratings_calculate_ferris_wheel(rct_ride *ride)
|
|
|
|
{
|
|
|
|
rating_tuple ratings;
|
|
|
|
|
|
|
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_TESTED;
|
|
|
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_NO_RAW_STATS;
|
|
|
|
ride->var_198 = 16;
|
|
|
|
sub_655FD6(ride);
|
|
|
|
|
|
|
|
int unk = ride->var_0D0 * 25;
|
|
|
|
ratings.excitement = unk + RIDE_RATING(0,60) + ((ride_ratings_get_scenery_score(ride) * 41831) >> 16);
|
|
|
|
ratings.intensity = unk + RIDE_RATING(0,25);
|
|
|
|
ratings.nausea = unk + RIDE_RATING(0,30);
|
|
|
|
|
|
|
|
ride_ratings_apply_intensity_penalty(&ratings);
|
|
|
|
ride_ratings_apply_adjustments(ride, &ratings);
|
|
|
|
|
|
|
|
ride->ratings = ratings;
|
|
|
|
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
|
|
|
|
ride->inversions &= 0x1F;
|
|
|
|
ride->inversions |= 0 << 5;
|
|
|
|
}
|
|
|
|
|
2014-10-11 19:55:56 +02:00
|
|
|
static void ride_ratings_calculate_elevator(rct_ride *ride)
|
|
|
|
{
|
|
|
|
rating_tuple ratings;
|
|
|
|
int totalLength;
|
|
|
|
|
|
|
|
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ride->var_198 = 15;
|
|
|
|
sub_655FD6(ride);
|
|
|
|
|
|
|
|
// Base ratings
|
|
|
|
ratings.excitement = RIDE_RATING(1,11);
|
|
|
|
ratings.intensity = RIDE_RATING(0,35);
|
|
|
|
ratings.nausea = RIDE_RATING(0,30);
|
|
|
|
|
|
|
|
// Apply length factor
|
|
|
|
totalLength = ride->length[0] + ride->length[1] + ride->length[2] + ride->length[3];
|
|
|
|
ratings.excitement += ((totalLength >> 16) * 45875) >> 16;
|
|
|
|
ratings.excitement += (sub_65E277() * 11183) >> 16;
|
|
|
|
ratings.excitement += (ride_ratings_get_scenery_score(ride) * 83662) >> 16;
|
|
|
|
ratings.nausea += ((totalLength >> 16) * 26214) >> 16;
|
|
|
|
|
|
|
|
ride_ratings_apply_intensity_penalty(&ratings);
|
|
|
|
ride_ratings_apply_adjustments(ride, &ratings);
|
|
|
|
|
|
|
|
ride->ratings = ratings;
|
|
|
|
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
|
|
|
|
ride->inversions &= 0x1F;
|
|
|
|
ride->inversions |= 7 << 5;
|
|
|
|
|
|
|
|
if ((sub_65E72D(ride) >> 8) >= 5)
|
|
|
|
ride->excitement /= 4;
|
|
|
|
}
|
|
|
|
|
2014-10-11 23:05:52 +02:00
|
|
|
static void ride_ratings_calculate_haunted_house(rct_ride *ride)
|
|
|
|
{
|
|
|
|
rating_tuple ratings;
|
|
|
|
|
|
|
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_TESTED;
|
|
|
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_NO_RAW_STATS;
|
|
|
|
ride->var_198 = 8;
|
|
|
|
sub_655FD6(ride);
|
|
|
|
|
|
|
|
ratings.excitement = RIDE_RATING(3,41);
|
|
|
|
ratings.intensity = RIDE_RATING(1,53);
|
|
|
|
ratings.nausea = RIDE_RATING(0,10);
|
|
|
|
|
|
|
|
ride_ratings_apply_intensity_penalty(&ratings);
|
|
|
|
ride_ratings_apply_adjustments(ride, &ratings);
|
|
|
|
|
|
|
|
ride->ratings = ratings;
|
|
|
|
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
|
|
|
|
ride->inversions &= 0x1F;
|
|
|
|
ride->inversions |= 0xE0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ride_ratings_calculate_mini_golf(rct_ride *ride)
|
|
|
|
{
|
|
|
|
rating_tuple ratings, unkRating;
|
|
|
|
|
|
|
|
// RCT2_CALLPROC_X(0x0065BF97, 0, 0, 0, 0, 0, (int)ride, 0); return;
|
|
|
|
|
|
|
|
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ride->var_198 = 0;
|
|
|
|
sub_655FD6(ride);
|
|
|
|
|
|
|
|
// Base ratings
|
|
|
|
ratings.excitement = RIDE_RATING(1,50);
|
|
|
|
ratings.intensity = RIDE_RATING(0,90);
|
|
|
|
ratings.nausea = RIDE_RATING(0,00);
|
|
|
|
|
|
|
|
// Apply length factor
|
|
|
|
int length = (ride->length[0] + ride->length[1] + ride->length[2] + ride->length[3]) >> 16;
|
|
|
|
ratings.excitement += (min(6000, length) * 873) >> 16;
|
|
|
|
|
|
|
|
// Apply ?
|
|
|
|
unkRating = sub_65DDD1(ride);
|
|
|
|
ratings.excitement += (unkRating.excitement * 14860) >> 16;
|
|
|
|
|
|
|
|
// Apply ?
|
|
|
|
unkRating = sub_65E1C2(ride);
|
|
|
|
ratings.excitement += (unkRating.excitement * 5140) >> 16;
|
|
|
|
ratings.intensity += (unkRating.intensity * 6553) >> 16;
|
|
|
|
ratings.nausea += (unkRating.nausea * 4681) >> 16;
|
|
|
|
|
|
|
|
// Apply ?
|
|
|
|
ratings.excitement += (sub_65E277() * 15657) >> 16;
|
|
|
|
|
|
|
|
ratings.excitement += (ride_ratings_get_scenery_score(ride) * 27887) >> 16;
|
|
|
|
|
|
|
|
// Apply golf holes factor
|
2014-10-12 00:07:20 +02:00
|
|
|
ratings.excitement += (ride->holes & 0x1F) * 5;
|
2014-10-11 23:05:52 +02:00
|
|
|
|
|
|
|
// Apply no golf holes penalty
|
|
|
|
if ((ride->inversions & 0x1F) == 0) {
|
|
|
|
ratings.excitement /= 8;
|
|
|
|
ratings.intensity /= 2;
|
|
|
|
ratings.nausea /= 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ride_ratings_apply_intensity_penalty(&ratings);
|
|
|
|
ride_ratings_apply_adjustments(ride, &ratings);
|
|
|
|
|
|
|
|
ride->ratings = ratings;
|
|
|
|
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
|
|
|
|
ride->inversions &= 0x1F;
|
|
|
|
ride->inversions |= sub_65E72D(ride) << 5;
|
|
|
|
}
|
|
|
|
|
2014-10-11 15:14:10 +02:00
|
|
|
static void ride_ratings_calculate_first_aid(rct_ride *ride)
|
2014-10-11 14:25:09 +02:00
|
|
|
{
|
2014-10-11 15:14:10 +02:00
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
2014-10-11 14:25:09 +02:00
|
|
|
ride->var_14D |= 2;
|
|
|
|
}
|
|
|
|
|
2014-10-11 23:05:52 +02:00
|
|
|
static void ride_ratings_calculate_crooked_house(rct_ride *ride)
|
|
|
|
{
|
|
|
|
rating_tuple ratings;
|
|
|
|
|
|
|
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_TESTED;
|
|
|
|
ride->lifecycle_flags |= RIDE_LIFECYCLE_NO_RAW_STATS;
|
|
|
|
ride->var_198 = 5;
|
|
|
|
sub_655FD6(ride);
|
|
|
|
|
|
|
|
ratings.excitement = RIDE_RATING(2,15);
|
|
|
|
ratings.intensity = RIDE_RATING(0,62);
|
|
|
|
ratings.nausea = RIDE_RATING(0,34);
|
|
|
|
|
|
|
|
ride_ratings_apply_intensity_penalty(&ratings);
|
|
|
|
ride_ratings_apply_adjustments(ride, &ratings);
|
|
|
|
|
|
|
|
ride->ratings = ratings;
|
|
|
|
|
|
|
|
ride->upkeep_cost = ride_compute_upkeep(ride);
|
|
|
|
ride->var_14D |= 2;
|
|
|
|
|
|
|
|
ride->inversions &= 0x1F;
|
|
|
|
ride->inversions |= 0xE0;
|
|
|
|
}
|
|
|
|
|
2014-10-11 14:25:09 +02:00
|
|
|
#pragma endregion
|
|
|
|
|
|
|
|
#pragma region Ride rating calculation function table
|
|
|
|
|
|
|
|
// rct2: 0x0097E050
|
|
|
|
static const ride_ratings_calculation ride_ratings_calculate_func_table[91] = {
|
2014-10-11 15:14:10 +02:00
|
|
|
NULL, // SPIRAL_ROLLER_COASTER
|
|
|
|
NULL, // STAND_UP_ROLLER_COASTER
|
|
|
|
NULL, // SUSPENDED_SWINGING_COASTER
|
|
|
|
NULL, // INVERTED_ROLLER_COASTER
|
|
|
|
NULL, // JUNIOR_ROLLER_COASTER
|
|
|
|
NULL, // MINIATURE_RAILWAY
|
|
|
|
NULL, // MONORAIL
|
|
|
|
NULL, // MINI_SUSPENDED_COASTER
|
|
|
|
NULL, // BUMPER_BOATS
|
|
|
|
NULL, // WOODEN_WILD_MOUSE
|
|
|
|
NULL, // STEEPLECHASE
|
|
|
|
NULL, // CAR_RIDE
|
|
|
|
NULL, // LAUNCHED_FREEFALL
|
|
|
|
NULL, // BOBSLEIGH_COASTER
|
|
|
|
NULL, // OBSERVATION_TOWER
|
|
|
|
NULL, // LOOPING_ROLLER_COASTER
|
|
|
|
NULL, // DINGHY_SLIDE
|
2014-10-12 00:07:20 +02:00
|
|
|
ride_ratings_calculate_mine_train_coaster, // MINE_TRAIN_COASTER
|
2014-10-11 15:14:10 +02:00
|
|
|
NULL, // CHAIRLIFT
|
|
|
|
NULL, // CORKSCREW_ROLLER_COASTER
|
2014-10-11 23:05:52 +02:00
|
|
|
ride_ratings_calculate_maze, // MAZE
|
2014-10-11 15:14:10 +02:00
|
|
|
NULL, // SPIRAL_SLIDE
|
|
|
|
NULL, // GO_KARTS
|
|
|
|
NULL, // LOG_FLUME
|
|
|
|
NULL, // RIVER_RAPIDS
|
|
|
|
NULL, // BUMPER_CARS
|
|
|
|
NULL, // PIRATE_SHIP
|
|
|
|
NULL, // SWINGING_INVERTER_SHIP
|
|
|
|
ride_ratings_calculate_food_stall, // FOOD_STALL
|
|
|
|
NULL, // 1D
|
|
|
|
ride_ratings_calculate_drink_stall, // DRINK_STALL
|
|
|
|
NULL, // 1F
|
|
|
|
ride_ratings_calculate_shop, // SHOP
|
2014-10-11 19:18:20 +02:00
|
|
|
ride_ratings_calculate_merry_go_round, // MERRY_GO_ROUND
|
2014-10-11 15:14:10 +02:00
|
|
|
NULL, // 22
|
|
|
|
ride_ratings_calculate_information_kiosk, // INFORMATION_KIOSK
|
|
|
|
ride_ratings_calculate_bathroom, // BATHROOM
|
2014-10-11 23:05:52 +02:00
|
|
|
ride_ratings_calculate_ferris_wheel, // FERRIS_WHEEL
|
2014-10-11 15:14:10 +02:00
|
|
|
NULL, // MOTION_SIMULATOR
|
|
|
|
NULL, // 3D_CINEMA
|
|
|
|
NULL, // TOP_SPIN
|
|
|
|
NULL, // SPACE_RINGS
|
|
|
|
NULL, // REVERSE_FREEFALL_COASTER
|
2014-10-11 19:55:56 +02:00
|
|
|
ride_ratings_calculate_elevator, // ELEVATOR
|
2014-10-11 15:14:10 +02:00
|
|
|
NULL, // VERTICAL_DROP_ROLLER_COASTER
|
|
|
|
NULL, // ATM
|
|
|
|
NULL, // TWIST
|
2014-10-11 23:05:52 +02:00
|
|
|
ride_ratings_calculate_haunted_house, // HAUNTED_HOUSE
|
2014-10-11 15:14:10 +02:00
|
|
|
ride_ratings_calculate_first_aid, // FIRST_AID
|
|
|
|
NULL, // CIRCUS_SHOW
|
|
|
|
NULL, // GHOST_TRAIN
|
|
|
|
NULL, // TWISTER_ROLLER_COASTER
|
|
|
|
NULL, // WOODEN_ROLLER_COASTER
|
|
|
|
NULL, // SIDE_FRICTION_ROLLER_COASTER
|
|
|
|
NULL, // WILD_MOUSE
|
|
|
|
NULL, // MULTI_DIMENSION_ROLLER_COASTER
|
|
|
|
NULL, // 38
|
|
|
|
NULL, // FLYING_ROLLER_COASTER
|
|
|
|
NULL, // 3A
|
|
|
|
NULL, // VIRGINIA_REEL
|
|
|
|
NULL, // SPLASH_BOATS
|
|
|
|
NULL, // MINI_HELICOPTERS
|
|
|
|
NULL, // LAY_DOWN_ROLLER_COASTER
|
|
|
|
NULL, // SUSPENDED_MONORAIL
|
|
|
|
NULL, // 40
|
|
|
|
NULL, // REVERSER_ROLLER_COASTER
|
|
|
|
NULL, // HEARTLINE_TWISTER_COASTER
|
2014-10-11 23:05:52 +02:00
|
|
|
ride_ratings_calculate_mini_golf, // MINI_GOLF
|
2014-10-11 15:14:10 +02:00
|
|
|
NULL, // GIGA_COASTER
|
|
|
|
NULL, // ROTO_DROP
|
|
|
|
NULL, // FLYING_SAUCERS
|
|
|
|
ride_ratings_calculate_crooked_house, // CROOKED_HOUSE
|
|
|
|
NULL, // MONORAIL_CYCLES
|
|
|
|
NULL, // COMPACT_INVERTED_COASTER
|
|
|
|
NULL, // WATER_COASTER
|
|
|
|
NULL, // AIR_POWERED_VERTICAL_COASTER
|
|
|
|
NULL, // INVERTED_HAIRPIN_COASTER
|
|
|
|
NULL, // MAGIC_CARPET
|
|
|
|
NULL, // SUBMARINE_RIDE
|
|
|
|
NULL, // RIVER_RAFTS
|
|
|
|
NULL, // 50
|
|
|
|
NULL, // ENTERPRISE
|
|
|
|
NULL, // 52
|
|
|
|
NULL, // 53
|
|
|
|
NULL, // 54
|
|
|
|
NULL, // 55
|
|
|
|
NULL, // INVERTED_IMPULSE_COASTER
|
|
|
|
NULL, // MINI_ROLLER_COASTER
|
|
|
|
NULL, // MINE_RIDE
|
|
|
|
NULL, // LIM_LAUNCHED_ROLLER_COASTER
|
|
|
|
NULL, // 90
|
2014-10-11 14:25:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#pragma endregion
|