mirror of https://github.com/OpenRCT2/OpenRCT2.git
Create new OpenRCT2 award struct
This commit is contained in:
parent
aca7b12fbe
commit
5efd23dbe5
|
@ -67,7 +67,7 @@ static const rct_string_id AwardNewsStrings[] = {
|
||||||
STR_NEWS_ITEM_BEST_GENTLE_RIDES,
|
STR_NEWS_ITEM_BEST_GENTLE_RIDES,
|
||||||
};
|
};
|
||||||
|
|
||||||
rct_award gCurrentAwards[MAX_AWARDS];
|
Award gCurrentAwards[MAX_AWARDS];
|
||||||
|
|
||||||
bool award_is_positive(sint32 type)
|
bool award_is_positive(sint32 type)
|
||||||
{
|
{
|
||||||
|
@ -614,9 +614,10 @@ static sint32 award_is_deserved(sint32 awardType, sint32 activeAwardTypes)
|
||||||
|
|
||||||
void award_reset()
|
void award_reset()
|
||||||
{
|
{
|
||||||
sint32 i;
|
for (sint32 i = 0; i < MAX_AWARDS; i++) {
|
||||||
for (i = 0; i < MAX_AWARDS; i++)
|
gCurrentAwards[i].Time = 0;
|
||||||
gCurrentAwards[i].time = 0;
|
gCurrentAwards[i].Type = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -631,8 +632,8 @@ void award_update_all()
|
||||||
sint32 activeAwardTypes = 0;
|
sint32 activeAwardTypes = 0;
|
||||||
sint32 freeAwardEntryIndex = -1;
|
sint32 freeAwardEntryIndex = -1;
|
||||||
for (sint32 i = 0; i < MAX_AWARDS; i++) {
|
for (sint32 i = 0; i < MAX_AWARDS; i++) {
|
||||||
if (gCurrentAwards[i].time != 0)
|
if (gCurrentAwards[i].Time != 0)
|
||||||
activeAwardTypes |= (1 << gCurrentAwards[i].type);
|
activeAwardTypes |= (1 << gCurrentAwards[i].Type);
|
||||||
else if (freeAwardEntryIndex == -1)
|
else if (freeAwardEntryIndex == -1)
|
||||||
freeAwardEntryIndex = i;
|
freeAwardEntryIndex = i;
|
||||||
}
|
}
|
||||||
|
@ -648,8 +649,8 @@ void award_update_all()
|
||||||
// Check if award is deserved
|
// Check if award is deserved
|
||||||
if (award_is_deserved(awardType, activeAwardTypes)) {
|
if (award_is_deserved(awardType, activeAwardTypes)) {
|
||||||
// Add award
|
// Add award
|
||||||
gCurrentAwards[freeAwardEntryIndex].type = awardType;
|
gCurrentAwards[freeAwardEntryIndex].Type = awardType;
|
||||||
gCurrentAwards[freeAwardEntryIndex].time = 5;
|
gCurrentAwards[freeAwardEntryIndex].Time = 5;
|
||||||
if (gConfigNotifications.park_award) {
|
if (gConfigNotifications.park_award) {
|
||||||
news_item_add_to_queue(NEWS_ITEM_AWARD, AwardNewsStrings[awardType], 0);
|
news_item_add_to_queue(NEWS_ITEM_AWARD, AwardNewsStrings[awardType], 0);
|
||||||
}
|
}
|
||||||
|
@ -660,7 +661,7 @@ void award_update_all()
|
||||||
|
|
||||||
// Decrease award times
|
// Decrease award times
|
||||||
for (sint32 i = 0; i < MAX_AWARDS; i++)
|
for (sint32 i = 0; i < MAX_AWARDS; i++)
|
||||||
if (gCurrentAwards[i].time != 0)
|
if (gCurrentAwards[i].Time != 0)
|
||||||
if (--gCurrentAwards[i].time == 0)
|
if (--gCurrentAwards[i].Time == 0)
|
||||||
window_invalidate_by_class(WC_PARK_INFORMATION);
|
window_invalidate_by_class(WC_PARK_INFORMATION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,14 @@
|
||||||
|
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
typedef struct Award
|
||||||
typedef struct rct_award {
|
{
|
||||||
uint16 time;
|
uint16 Time;
|
||||||
uint16 type;
|
uint16 Type;
|
||||||
} rct_award;
|
} Award;
|
||||||
assert_struct_size(rct_award, 4);
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
enum {
|
enum PARK_AWARD
|
||||||
|
{
|
||||||
PARK_AWARD_MOST_UNTIDY,
|
PARK_AWARD_MOST_UNTIDY,
|
||||||
PARK_AWARD_MOST_TIDY,
|
PARK_AWARD_MOST_TIDY,
|
||||||
PARK_AWARD_BEST_ROLLERCOASTERS,
|
PARK_AWARD_BEST_ROLLERCOASTERS,
|
||||||
|
@ -50,10 +49,17 @@ enum {
|
||||||
|
|
||||||
#define MAX_AWARDS 4
|
#define MAX_AWARDS 4
|
||||||
|
|
||||||
extern rct_award gCurrentAwards[MAX_AWARDS];
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
extern Award gCurrentAwards[MAX_AWARDS];
|
||||||
|
|
||||||
bool award_is_positive(sint32 type);
|
bool award_is_positive(sint32 type);
|
||||||
void award_reset();
|
void award_reset();
|
||||||
void award_update_all();
|
void award_update_all();
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#define RCT1_MAX_MAP_ELEMENTS 0xC000
|
#define RCT1_MAX_MAP_ELEMENTS 0xC000
|
||||||
#define RCT1_MAX_SPRITES 5000
|
#define RCT1_MAX_SPRITES 5000
|
||||||
|
#define RCT1_MAX_AWARDS 4
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
typedef struct rct1_entrance {
|
typedef struct rct1_entrance {
|
||||||
|
@ -425,6 +426,14 @@ typedef struct rct1_research_item {
|
||||||
} rct1_research_item;
|
} rct1_research_item;
|
||||||
assert_struct_size(rct1_research_item, 5);
|
assert_struct_size(rct1_research_item, 5);
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
typedef struct rct1_award {
|
||||||
|
uint16 time;
|
||||||
|
uint16 type;
|
||||||
|
} rct1_award;
|
||||||
|
assert_struct_size(rct1_award, 4);
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RCT1,AA,LL scenario / saved game structure.
|
* RCT1,AA,LL scenario / saved game structure.
|
||||||
* size: 0x1F850C
|
* size: 0x1F850C
|
||||||
|
@ -520,7 +529,7 @@ typedef struct rct1_s4 {
|
||||||
money32 admission_total_income;
|
money32 admission_total_income;
|
||||||
money32 company_value;
|
money32 company_value;
|
||||||
uint8 thought_timer[16];
|
uint8 thought_timer[16];
|
||||||
rct_award awards[4];
|
rct1_award awards[RCT1_MAX_AWARDS];
|
||||||
money16 land_price;
|
money16 land_price;
|
||||||
money16 construction_rights_price;
|
money16 construction_rights_price;
|
||||||
uint16 unk_199BCC;
|
uint16 unk_199BCC;
|
||||||
|
|
|
@ -1438,9 +1438,13 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Awards
|
// Awards
|
||||||
for (size_t i = 0; i < MAX_AWARDS; i++)
|
award_reset();
|
||||||
|
for (sint32 i = 0; i < RCT1_MAX_AWARDS; i++)
|
||||||
{
|
{
|
||||||
gCurrentAwards[i] = _s4.awards[i];
|
rct1_award * src = &_s4.awards[i];
|
||||||
|
Award * dst = &gCurrentAwards[i];
|
||||||
|
dst->Time = src->time;
|
||||||
|
dst->Type = src->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of guests history
|
// Number of guests history
|
||||||
|
|
|
@ -29,6 +29,14 @@ typedef struct rct2_install_info {
|
||||||
uint32 activeExpansionPacks; //0xB10
|
uint32 activeExpansionPacks; //0xB10
|
||||||
} rct2_install_info;
|
} rct2_install_info;
|
||||||
|
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
typedef struct rct2_award {
|
||||||
|
uint16 time;
|
||||||
|
uint16 type;
|
||||||
|
} rct2_award;
|
||||||
|
assert_struct_size(rct2_award, 4);
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
// Although this is labeled a flag it actually means when
|
// Although this is labeled a flag it actually means when
|
||||||
// zero the screen is in playing mode.
|
// zero the screen is in playing mode.
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
#include "../core/Exception.hpp"
|
#include "../core/Exception.hpp"
|
||||||
#include "../core/IStream.hpp"
|
#include "../core/IStream.hpp"
|
||||||
#include "../core/String.hpp"
|
#include "../core/String.hpp"
|
||||||
#include "../object/ObjectRepository.h"
|
#include "../management/award.h"
|
||||||
#include "../object/Object.h"
|
#include "../object/Object.h"
|
||||||
|
#include "../object/ObjectRepository.h"
|
||||||
#include "S6Exporter.h"
|
#include "S6Exporter.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -348,7 +349,16 @@ void S6Exporter::Export()
|
||||||
_s6.income_from_admissions = gTotalIncomeFromAdmissions;
|
_s6.income_from_admissions = gTotalIncomeFromAdmissions;
|
||||||
_s6.company_value = gCompanyValue;
|
_s6.company_value = gCompanyValue;
|
||||||
memcpy(_s6.peep_warning_throttle, gPeepWarningThrottle, sizeof(_s6.peep_warning_throttle));
|
memcpy(_s6.peep_warning_throttle, gPeepWarningThrottle, sizeof(_s6.peep_warning_throttle));
|
||||||
memcpy(_s6.awards, gCurrentAwards, sizeof(_s6.awards));
|
|
||||||
|
// Awards
|
||||||
|
for (int i = 0; i < RCT2_MAX_AWARDS; i++)
|
||||||
|
{
|
||||||
|
Award * src = &gCurrentAwards[i];
|
||||||
|
rct2_award * dst = &_s6.awards[i];
|
||||||
|
dst->time = src->Time;
|
||||||
|
dst->type = src->Type;
|
||||||
|
}
|
||||||
|
|
||||||
_s6.land_price = gLandPrice;
|
_s6.land_price = gLandPrice;
|
||||||
_s6.construction_rights_price = gConstructionRightsPrice;
|
_s6.construction_rights_price = gConstructionRightsPrice;
|
||||||
// unk_01358774
|
// unk_01358774
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "../core/Exception.hpp"
|
#include "../core/Exception.hpp"
|
||||||
#include "../core/IStream.hpp"
|
#include "../core/IStream.hpp"
|
||||||
|
#include "../management/award.h"
|
||||||
#include "../network/network.h"
|
#include "../network/network.h"
|
||||||
#include "S6Importer.h"
|
#include "S6Importer.h"
|
||||||
|
|
||||||
|
@ -264,7 +265,17 @@ void S6Importer::Import()
|
||||||
gTotalIncomeFromAdmissions = _s6.income_from_admissions;
|
gTotalIncomeFromAdmissions = _s6.income_from_admissions;
|
||||||
gCompanyValue = _s6.company_value;
|
gCompanyValue = _s6.company_value;
|
||||||
memcpy(gPeepWarningThrottle, _s6.peep_warning_throttle, sizeof(_s6.peep_warning_throttle));
|
memcpy(gPeepWarningThrottle, _s6.peep_warning_throttle, sizeof(_s6.peep_warning_throttle));
|
||||||
memcpy(gCurrentAwards, _s6.awards, sizeof(_s6.awards));
|
|
||||||
|
// Awards
|
||||||
|
award_reset();
|
||||||
|
for (int i = 0; i < RCT2_MAX_AWARDS; i++)
|
||||||
|
{
|
||||||
|
rct2_award * src = &_s6.awards[i];
|
||||||
|
Award * dst = &gCurrentAwards[i];
|
||||||
|
dst->Time = src->time;
|
||||||
|
dst->Type = src->type;
|
||||||
|
}
|
||||||
|
|
||||||
gLandPrice = _s6.land_price;
|
gLandPrice = _s6.land_price;
|
||||||
gConstructionRightsPrice = _s6.construction_rights_price;
|
gConstructionRightsPrice = _s6.construction_rights_price;
|
||||||
// unk_01358774
|
// unk_01358774
|
||||||
|
|
|
@ -17,21 +17,23 @@
|
||||||
#ifndef _SCENARIO_H_
|
#ifndef _SCENARIO_H_
|
||||||
#define _SCENARIO_H_
|
#define _SCENARIO_H_
|
||||||
|
|
||||||
#include "../rct2/addresses.h"
|
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
#include "../management/award.h"
|
|
||||||
#include "../management/finance.h"
|
#include "../management/finance.h"
|
||||||
#include "../management/news_item.h"
|
#include "../management/news_item.h"
|
||||||
#include "../management/research.h"
|
#include "../management/research.h"
|
||||||
#include "../ride/ride.h"
|
|
||||||
#include "../ride/ride_ratings.h"
|
|
||||||
#include "../object.h"
|
#include "../object.h"
|
||||||
#include "../platform/platform.h"
|
#include "../platform/platform.h"
|
||||||
|
#include "../rct2.h"
|
||||||
|
#include "../rct2/addresses.h"
|
||||||
|
#include "../ride/ride.h"
|
||||||
|
#include "../ride/ride_ratings.h"
|
||||||
#include "../world/banner.h"
|
#include "../world/banner.h"
|
||||||
#include "../world/map.h"
|
#include "../world/map.h"
|
||||||
#include "../world/map_animation.h"
|
#include "../world/map_animation.h"
|
||||||
#include "../world/sprite.h"
|
#include "../world/sprite.h"
|
||||||
|
|
||||||
|
#define RCT2_MAX_AWARDS 4
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
/**
|
/**
|
||||||
* SV6/SC6 header chunk
|
* SV6/SC6 header chunk
|
||||||
|
@ -245,7 +247,7 @@ typedef struct rct_s6_data {
|
||||||
money32 income_from_admissions;
|
money32 income_from_admissions;
|
||||||
money32 company_value;
|
money32 company_value;
|
||||||
uint8 peep_warning_throttle[16];
|
uint8 peep_warning_throttle[16];
|
||||||
rct_award awards[MAX_AWARDS];
|
rct2_award awards[RCT2_MAX_AWARDS];
|
||||||
money16 land_price;
|
money16 land_price;
|
||||||
money16 construction_rights_price;
|
money16 construction_rights_price;
|
||||||
uint16 word_01358774;
|
uint16 word_01358774;
|
||||||
|
|
|
@ -1909,12 +1909,12 @@ static void window_park_awards_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||||
sint32 y = w->y + window_park_awards_widgets[WIDX_PAGE_BACKGROUND].top + 4;
|
sint32 y = w->y + window_park_awards_widgets[WIDX_PAGE_BACKGROUND].top + 4;
|
||||||
sint32 count = 0;
|
sint32 count = 0;
|
||||||
for (sint32 i = 0; i < MAX_AWARDS; i++) {
|
for (sint32 i = 0; i < MAX_AWARDS; i++) {
|
||||||
rct_award *award = &gCurrentAwards[i];
|
Award *award = &gCurrentAwards[i];
|
||||||
if (award->time == 0)
|
if (award->Time == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gfx_draw_sprite(dpi, ParkAwards[award->type].sprite, x, y, 0);
|
gfx_draw_sprite(dpi, ParkAwards[award->Type].sprite, x, y, 0);
|
||||||
gfx_draw_string_left_wrapped(dpi, NULL, x + 34, y + 6, 180, ParkAwards[award->type].text, COLOUR_BLACK);
|
gfx_draw_string_left_wrapped(dpi, NULL, x + 34, y + 6, 180, ParkAwards[award->Type].text, COLOUR_BLACK);
|
||||||
|
|
||||||
y += 32;
|
y += 32;
|
||||||
count++;
|
count++;
|
||||||
|
|
|
@ -463,12 +463,12 @@ static sint32 park_calculate_guest_generation_probability()
|
||||||
|
|
||||||
// Reward or penalties for park awards
|
// Reward or penalties for park awards
|
||||||
for (i = 0; i < MAX_AWARDS; i++) {
|
for (i = 0; i < MAX_AWARDS; i++) {
|
||||||
rct_award *award = &gCurrentAwards[i];
|
Award *award = &gCurrentAwards[i];
|
||||||
if (award->time == 0)
|
if (award->Time == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// +/- 0.25% of the probability
|
// +/- 0.25% of the probability
|
||||||
if (award_is_positive(award->type))
|
if (award_is_positive(award->Type))
|
||||||
probability += probability / 4;
|
probability += probability / 4;
|
||||||
else
|
else
|
||||||
probability -= probability / 4;
|
probability -= probability / 4;
|
||||||
|
|
Loading…
Reference in New Issue