Start implementing main path find function.

This commit is contained in:
Duncan Frost 2015-07-28 18:30:45 +01:00
parent 3a07af140b
commit bf59c164f8
4 changed files with 116 additions and 6 deletions

View File

@ -5375,7 +5375,10 @@ rct_peep *peep_generate(int x, int y, int z)
peep->cash_in_pocket = cash;
peep->cash_spent = 0;
peep->time_in_park = -1;
peep->var_CC = 0xFFFF;
peep->var_CC.x = 0xFF;
peep->var_CC.y = 0xFF;
peep->var_CC.z = 0xFF;
peep->var_CC.direction = 0xFF;
peep->item_standard_flags = 0;
peep->item_extra_flags = 0;
peep->guest_heading_to_ride_id = 0xFF;
@ -6832,8 +6835,104 @@ static int guest_path_find_aimless(rct_peep* peep, uint8 edges){
}
}
/* rct2: 0x0069A60A */
uint8 sub_69A60A(rct_peep* peep){
RCT2_GLOBAL(0x00F1AED8, uint32) = 0xC350;
RCT2_GLOBAL(0x00F1AEDD, uint8) = 0x80;
if (peep->type == PEEP_TYPE_STAFF)
return 16;
RCT2_GLOBAL(0x00F1AED8, uint32) = 0x3A98;
RCT2_GLOBAL(0x00F1AEDD, uint8) = 0;
if ((peep->flags & PEEP_FLAGS_2)){
if ((scenario_rand() & 0xFFFF) <= 7281)
peep->flags &= ~PEEP_FLAGS_2;
return 16;
}
if (peep->flags & PEEP_FLAGS_LEAVING_PARK &&
peep->var_C6 < 90){
return 16;
}
if (peep->item_standard_flags & PEEP_ITEM_MAP)
return 14;
if (peep->flags & PEEP_FLAGS_LEAVING_PARK)
return 14;
return 10;
}
/* rct2: 0x0069A5F0 */
static int sub_69A5F0(sint16 x, sint16 y, sint16 z, rct_peep *peep, rct_map_element *map_element){
//RCT2_GLOBAL(0x00F1AEDC, uint8) = sub_69A60A(peep);
//// Redundant check to make sure peep is not null??
//sint16 start_x = RCT2_GLOBAL(0x00F1AECE, sint16);
//sint16 start_y = RCT2_GLOBAL(0x00F1AED0, sint16);
//uint8 start_z = RCT2_GLOBAL(0x00F1AED2, uint8);
//
//uint8 edges = 0xF;
//if (peep->var_CC.x == (start_x / 32) &&
// peep->var_CC.y == (start_y / 32) &&
// peep->var_CC.z == start_z){
// uint8 index = 0;
// for (; index < 4; ++index){
// if (peep->var_D0[index].x == x &&
// peep->var_D0[index].y == y &&
// peep->var_D0[index].z == z){
// edges = peep->var_D0[index].direction & 0xF;
// break;
// }
// }
//}
//bool found = false;
//rct_map_element *destMapElement = map_get_first_element_at(x / 32, y / 32);
//do{
// if (destMapElement->base_height != z)
// continue;
// if (map_element_get_type(destMapElement) != MAP_ELEMENT_TYPE_PATH)
// continue;
// found = true;
// break;
//} while (!map_element_is_last_for_tile(destMapElement++));
//sint8 chosenDirection = 0xF;
//if (!found){
// chosenDirection = 0xF;
// //goto 69A89C
//}
//edges &= destMapElement->properties.path.edges & 0xF;
//rct_map_element *bannerElement = get_banner_on_path(destMapElement);
//if (bannerElement != NULL) {
// do {
// edges &= bannerElement->properties.banner.flags;
// } while ((bannerElement = get_banner_on_path(bannerElement)) != NULL);
//}
//if (edges == 0){
// chosenDirection = 0xF;
// // goto 69A89C
//}
//chosenDirection = bitscanforward(edges);
//if (edges & ~(1 << chosenDirection) == 0){
// // goto 69A8A1 chosenDirection
//}
//for (; chosenDirection != -1; chosenDirection = bitscanforward(edges)){
// edges &= ~(1 << chosenDirection);
// //69a814
//}
////69a895
int eax = x, ebx, ecx = y, edx = z, esi = (int)peep, ebp, edi = (int)map_element;
RCT2_CALLFUNC_X(0x0069A5F0, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
return ebp;
@ -7718,7 +7817,10 @@ static bool peep_should_use_cash_machine(rct_peep *peep, int rideIndex)
*/
static void sub_69A98C(rct_peep *peep)
{
peep->var_CC = 0xFFFFFFFF;
peep->var_CC.x = 0xFF;
peep->var_CC.y = 0xFF;
peep->var_CC.z = 0xFF;
peep->var_CC.direction = 0xFF;
}
/**

View File

@ -22,6 +22,7 @@
#define _PEEP_H_
#include "../common.h"
#include "../world/map.h"
#define PEEP_MAX_THOUGHTS 5
@ -249,7 +250,7 @@ enum PEEP_ACTION_EVENTS {
enum PEEP_FLAGS {
PEEP_FLAGS_LEAVING_PARK = (1 << 0),
PEEP_FLAGS_SLOW_WALK = (1 << 1),
PEEP_FLAGS_2 = (1 << 2),
PEEP_FLAGS_TRACKING = (1 << 3),
PEEP_FLAGS_WAVING = (1 << 4), // Makes the peep wave
PEEP_FLAGS_5 = (1 << 5), // Set on paying to enter park?
@ -478,8 +479,8 @@ typedef struct {
};
uint8 photo1_ride_ref; // 0xC7
uint32 flags; // 0xC8
uint32 var_CC;
uint8 pad_D0[0x10];
rct_xyzd8 var_CC;
rct_xyzd8 var_D0[4];
uint8 no_action_frame_no; // 0xE0
// 0x3F Litter Count split into lots of 3 with time, 0xC0 Time since last recalc
uint8 litter_count; // 0xE1

View File

@ -248,7 +248,10 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx,
}
newPeep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
newPeep->var_CC = 0xFFFFFFFF;
newPeep->var_CC.x = 0xFF;
newPeep->var_CC.y = 0xFF;
newPeep->var_CC.z = 0xFF;
newPeep->var_CC.direction = 0xFF;
uint8 colour = RCT2_ADDRESS(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8)[staff_type > 2 ? 2 : staff_type];
newPeep->tshirt_colour = colour;

View File

@ -227,6 +227,10 @@ typedef struct {
uint8 x, y;
} rct_xy8;
typedef struct{
uint8 x, y, z, direction;
} rct_xyzd8;
typedef struct {
sint16 x, y;
} rct_xy16;