mirror of https://github.com/OpenRCT2/OpenRCT2.git
Added peep_update_drowning.
This commit is contained in:
parent
bfe45e5996
commit
606d8c5a25
246
src/peep/peep.c
246
src/peep/peep.c
|
@ -106,79 +106,44 @@ void peep_update_all()
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0068FC1E
|
||||
* rct2: 0x690028
|
||||
*/
|
||||
static void peep_update(rct_peep *peep)
|
||||
{
|
||||
// RCT2_CALLPROC_X(0x0068FC1E, 0, 0, 0, 0, (int)peep, 0, 0); return;
|
||||
|
||||
int i, j;
|
||||
|
||||
if (peep->type == PEEP_TYPE_GUEST) {
|
||||
if (peep->var_AD != 255)
|
||||
if (++peep->var_AE < 720)
|
||||
peep->var_AD = 255;
|
||||
|
||||
// Update thoughts
|
||||
i = 0;
|
||||
int ebp = 0;
|
||||
int edi = -1;
|
||||
for (i = 0; i < PEEP_MAX_THOUGHTS; i++) {
|
||||
if (peep->thoughts[i].type == PEEP_THOUGHT_TYPE_NONE)
|
||||
break;
|
||||
|
||||
if (peep->thoughts[i].var_2 == 1) {
|
||||
ebp++;
|
||||
if (++peep->thoughts[i].var_3 >= 220) {
|
||||
peep->thoughts[i].var_3 = 0;
|
||||
peep->thoughts[i].var_2++;
|
||||
ebp--;
|
||||
void peep_update_drowning(rct_peep* peep){
|
||||
if (peep->var_71 == 11){
|
||||
RCT2_CALLPROC_X(0x6939EB, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
if (peep->var_71 == 11) return;
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x80000)){
|
||||
RCT2_GLOBAL(0x13CE952, uint16) = peep->name_string_idx;
|
||||
RCT2_GLOBAL(0x13CE954, uint32) = peep->id;
|
||||
news_item_add_to_queue(NEWS_ITEM_BLANK, 2347, peep->x | (peep->y << 16));
|
||||
}
|
||||
} else if (peep->thoughts[i].var_2 > 1) {
|
||||
if (++peep->thoughts[i].var_3 > 255) {
|
||||
if (++peep->thoughts[i].var_3 >= 28) {
|
||||
peep->var_45 |= 1;
|
||||
|
||||
// Clear top thought, push others up
|
||||
for (j = i; j < PEEP_MAX_THOUGHTS - 1; j++)
|
||||
peep->thoughts[j].type = peep->thoughts[j + 1].type;
|
||||
peep->thoughts[PEEP_MAX_THOUGHTS - 1].type = PEEP_THOUGHT_TYPE_NONE;
|
||||
RCT2_GLOBAL(0x135882E, uint16) += 25;
|
||||
if (RCT2_GLOBAL(0x135882E, uint16) > 1000){
|
||||
RCT2_GLOBAL(0x135882E, uint16) = 1000;
|
||||
}
|
||||
if (peep->type == PEEP_TYPE_STAFF){
|
||||
RCT2_CALLPROC_X(0x69A535, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
edi = i;
|
||||
if (peep->var_2A == 0){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)--;
|
||||
RCT2_GLOBAL(0x9A9804, uint16) |= (1 << 2);
|
||||
}
|
||||
if (peep->state == PEEP_STATE_ENTERING_PARK){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--;
|
||||
}
|
||||
if (ebp == 0 && edi != -1) {
|
||||
peep->thoughts[edi].var_2 = 1;
|
||||
peep->var_45 |= 1;
|
||||
}
|
||||
RCT2_CALLPROC_X(0x69A535, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// Walking speed logic
|
||||
unsigned int stepsToTake = peep->energy;
|
||||
if (stepsToTake < 95 && peep->state == PEEP_STATE_QUEUING)
|
||||
stepsToTake = 95;
|
||||
if ((peep->flags & PEEP_FLAGS_SLOW_WALK) && peep->state != PEEP_STATE_QUEUING)
|
||||
stepsToTake /= 2;
|
||||
if (peep->var_71 == 255 && (RCT2_GLOBAL((int)peep + 0x29, uint8) & 4)) {
|
||||
stepsToTake /= 2;
|
||||
if (peep->state == PEEP_STATE_QUEUING)
|
||||
stepsToTake += stepsToTake / 2;
|
||||
RCT2_CALLPROC_X(0x690028, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
}
|
||||
|
||||
unsigned int carryCheck = peep->var_73 + stepsToTake;
|
||||
peep->var_73 = carryCheck;
|
||||
if (carryCheck <= 255) {
|
||||
// loc_68FD3A
|
||||
RCT2_CALLPROC_X(0x0068FD3A, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
} else {
|
||||
// loc_68FD2F
|
||||
/**
|
||||
* rct2: 0x69185D
|
||||
*/
|
||||
void peep_update_queuing(rct_peep* peep){
|
||||
|
||||
switch (peep->state) {
|
||||
case PEEP_STATE_QUEUING:
|
||||
//69185d
|
||||
if (RCT2_CALLPROC_X(0x68F3AE, 0, 0, 0, 0, (int)peep, 0, 0) & 0x40){
|
||||
RCT2_CALLPROC_X(0x691A23, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
return;
|
||||
|
@ -274,7 +239,153 @@ static void peep_update(rct_peep *peep)
|
|||
peep->state = 1;
|
||||
RCT2_CALLPROC_X(0x69A42F, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0068FC1E
|
||||
*/
|
||||
static void peep_update(rct_peep *peep)
|
||||
{
|
||||
// RCT2_CALLPROC_X(0x0068FC1E, 0, 0, 0, 0, (int)peep, 0, 0); return;
|
||||
|
||||
int i, j;
|
||||
|
||||
if (peep->type == PEEP_TYPE_GUEST) {
|
||||
if (peep->var_AD != 255)
|
||||
if (++peep->var_AE < 720)
|
||||
peep->var_AD = 255;
|
||||
|
||||
// Update thoughts
|
||||
i = 0;
|
||||
int ebp = 0;
|
||||
int edi = -1;
|
||||
for (i = 0; i < PEEP_MAX_THOUGHTS; i++) {
|
||||
if (peep->thoughts[i].type == PEEP_THOUGHT_TYPE_NONE)
|
||||
break;
|
||||
|
||||
if (peep->thoughts[i].var_2 == 1) {
|
||||
ebp++;
|
||||
if (++peep->thoughts[i].var_3 >= 220) {
|
||||
peep->thoughts[i].var_3 = 0;
|
||||
peep->thoughts[i].var_2++;
|
||||
ebp--;
|
||||
}
|
||||
} else if (peep->thoughts[i].var_2 > 1) {
|
||||
if (++peep->thoughts[i].var_3 > 255) {
|
||||
if (++peep->thoughts[i].var_3 >= 28) {
|
||||
peep->var_45 |= 1;
|
||||
|
||||
// Clear top thought, push others up
|
||||
for (j = i; j < PEEP_MAX_THOUGHTS - 1; j++)
|
||||
peep->thoughts[j].type = peep->thoughts[j + 1].type;
|
||||
peep->thoughts[PEEP_MAX_THOUGHTS - 1].type = PEEP_THOUGHT_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
edi = i;
|
||||
}
|
||||
}
|
||||
if (ebp == 0 && edi != -1) {
|
||||
peep->thoughts[edi].var_2 = 1;
|
||||
peep->var_45 |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Walking speed logic
|
||||
unsigned int stepsToTake = peep->energy;
|
||||
if (stepsToTake < 95 && peep->state == PEEP_STATE_QUEUING)
|
||||
stepsToTake = 95;
|
||||
if ((peep->flags & PEEP_FLAGS_SLOW_WALK) && peep->state != PEEP_STATE_QUEUING)
|
||||
stepsToTake /= 2;
|
||||
if (peep->var_71 == 255 && (RCT2_GLOBAL((int)peep + 0x29, uint8) & 4)) {
|
||||
stepsToTake /= 2;
|
||||
if (peep->state == PEEP_STATE_QUEUING)
|
||||
stepsToTake += stepsToTake / 2;
|
||||
}
|
||||
|
||||
unsigned int carryCheck = peep->var_73 + stepsToTake;
|
||||
peep->var_73 = carryCheck;
|
||||
if (carryCheck <= 255) {
|
||||
// loc_68FD3A
|
||||
RCT2_CALLPROC_X(0x0068FD3A, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
} else {
|
||||
// loc_68FD2F
|
||||
|
||||
switch (peep->state) {
|
||||
case PEEP_STATE_DROWNING:
|
||||
peep_update_drowning(peep);
|
||||
break;
|
||||
case PEEP_STATE_1:
|
||||
RCT2_CALLPROC_X(0x006902A2, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_QUEUING_FRONT:
|
||||
RCT2_CALLPROC_X(0x00691A24, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_ON_RIDE:
|
||||
RCT2_CALLPROC_X(0x00691A2F, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_LEAVING_RIDE:
|
||||
RCT2_CALLPROC_X(0x00691A30, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_WALKING:
|
||||
RCT2_CALLPROC_X(0x0069030A, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_QUEUING:
|
||||
peep_update_queuing(peep);
|
||||
break;
|
||||
case PEEP_STATE_ENTERING_RIDE:
|
||||
RCT2_CALLPROC_X(0x00691A24, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_SITTING:
|
||||
RCT2_CALLPROC_X(0x0069152B, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_PICKED:
|
||||
RCT2_CALLPROC_X(0x00690009, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_PATROLLING:
|
||||
RCT2_CALLPROC_X(0x006BF1FD, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_MOWING:
|
||||
RCT2_CALLPROC_X(0x006BF567, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_SWEEPING:
|
||||
RCT2_CALLPROC_X(0x006BF641, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_ENTERING_PARK:
|
||||
RCT2_CALLPROC_X(0x00691451, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_LEAVING_PARK:
|
||||
RCT2_CALLPROC_X(0x006914CD, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_ANSWERING:
|
||||
RCT2_CALLPROC_X(0x006C0CB8, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_FIXING:
|
||||
RCT2_CALLPROC_X(0x006C0E8B, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_BUYING:
|
||||
RCT2_CALLPROC_X(0x006912A3, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_WATCHING:
|
||||
RCT2_CALLPROC_X(0x006916D6, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_EMPTYING_BIN:
|
||||
RCT2_CALLPROC_X(0x006BF6C9, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_20:
|
||||
RCT2_CALLPROC_X(0x006912A3, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_WATERING:
|
||||
RCT2_CALLPROC_X(0x006916D6, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_HEADING_TO_INSPECTION:
|
||||
RCT2_CALLPROC_X(0x006BF6C9, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
case PEEP_STATE_INSPECTING:
|
||||
RCT2_CALLPROC_X(0x00691089, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
//There shouldnt be any more
|
||||
default:
|
||||
RCT2_CALLPROC_X(0x0068FD2F, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
break;
|
||||
|
@ -570,11 +681,11 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
|
|||
rct_ride ride;
|
||||
|
||||
switch (peep->state){
|
||||
case 0:
|
||||
case PEEP_STATE_DROWNING:
|
||||
*argument_1 = peep->var_71 == 0xB ? STR_DROWNING : STR_WALKING;
|
||||
*argument_2 = 0;
|
||||
break;
|
||||
case 1:
|
||||
case PEEP_STATE_1:
|
||||
*argument_1 = STR_WALKING;
|
||||
*argument_2 = 0;
|
||||
break;
|
||||
|
@ -595,7 +706,7 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
|
|||
*argument_2 = ride.name_arguments;
|
||||
break;
|
||||
case PEEP_STATE_WALKING:
|
||||
case 0x14:
|
||||
case PEEP_STATE_20:
|
||||
if (peep->guest_heading_to_ride_id != 0xFF){
|
||||
ride = g_ride_list[peep->guest_heading_to_ride_id];
|
||||
*argument_1 = STR_HEADING_FOR | (ride.name << 16);
|
||||
|
@ -889,15 +1000,18 @@ void peep_insert_new_thought(rct_peep *peep, uint8 thought_type, uint8 thought_a
|
|||
|
||||
for (int i = 0; i < PEEP_MAX_THOUGHTS; ++i){
|
||||
rct_peep_thought* thought = &peep->thoughts[i];
|
||||
// Remove the oldest thought by setting it to NONE.
|
||||
if (thought->type == PEEP_THOUGHT_TYPE_NONE) break;
|
||||
|
||||
if (thought->type == thought_type && thought->item == thought_arguments){
|
||||
// If the thought type has not changed then we need to move
|
||||
// it to the top of the thought list. This is done by first removing the
|
||||
// existing thought and placing it at the top.
|
||||
memmove(thought, thought + 1, sizeof(rct_peep_thought)*(PEEP_MAX_THOUGHTS - i - 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
memmove(&peep->thoughts[1], &peep->thoughts[0], sizeof(rct_peep_thought)*(PEEP_MAX_THOUGHTS - 1));
|
||||
|
||||
peep->thoughts[0].type = thought_type;
|
||||
|
|
|
@ -182,8 +182,8 @@ enum PEEP_THOUGHT_TYPE {
|
|||
};
|
||||
|
||||
enum PEEP_STATE {
|
||||
PEEP_STATE_0 = 0,
|
||||
|
||||
PEEP_STATE_DROWNING = 0,
|
||||
PEEP_STATE_1 = 1,
|
||||
PEEP_STATE_QUEUING_FRONT = 2,
|
||||
PEEP_STATE_ON_RIDE = 3,
|
||||
PEEP_STATE_LEAVING_RIDE = 4,
|
||||
|
@ -202,7 +202,7 @@ enum PEEP_STATE {
|
|||
PEEP_STATE_BUYING = 17,
|
||||
PEEP_STATE_WATCHING = 18,
|
||||
PEEP_STATE_EMPTYING_BIN = 19,
|
||||
|
||||
PEEP_STATE_20 = 20,
|
||||
PEEP_STATE_WATERING = 21,
|
||||
PEEP_STATE_HEADING_TO_INSPECTION = 22,
|
||||
PEEP_STATE_INSPECTING = 23
|
||||
|
|
Loading…
Reference in New Issue