mirror of https://github.com/OpenRCT2/OpenRCT2.git
Refactor peep action getter
This commit is contained in:
parent
19833b9110
commit
7e6d826c09
|
@ -1375,19 +1375,24 @@ static sint32 checkForPath(rct_peep *peep){
|
|||
return 0;
|
||||
}
|
||||
|
||||
void sub_693B58(rct_peep* peep){
|
||||
uint8 action_sprite_type;
|
||||
if (peep->sprite_type >= countof(g_peep_animation_entries)) {
|
||||
return;
|
||||
}
|
||||
static uint8 peep_get_action_sprite_type(rct_peep* peep)
|
||||
{
|
||||
if (peep->action >= PEEP_ACTION_NONE_1){ // PEEP_ACTION_NONE_1 or PEEP_ACTION_NONE_2
|
||||
action_sprite_type = PeepSpecialSpriteToSpriteTypeMap[peep->special_sprite];
|
||||
return PeepSpecialSpriteToSpriteTypeMap[peep->special_sprite];
|
||||
} else if (peep->action < countof(PeepActionToSpriteTypeMap)) {
|
||||
action_sprite_type = PeepActionToSpriteTypeMap[peep->action];
|
||||
return PeepActionToSpriteTypeMap[peep->action];
|
||||
} else {
|
||||
openrct2_assert(peep->action >= countof(PeepActionToSpriteTypeMap) && peep->action < PEEP_ACTION_NONE_1,
|
||||
"Invalid peep action %u", peep->action);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_693B58(rct_peep* peep){
|
||||
if (peep->sprite_type >= countof(g_peep_animation_entries)) {
|
||||
return;
|
||||
}
|
||||
uint8 action_sprite_type = peep_get_action_sprite_type(peep);
|
||||
if (action_sprite_type == peep->action_sprite_type)return;
|
||||
|
||||
invalidate_sprite_2((rct_sprite*)peep);
|
||||
|
|
Loading…
Reference in New Issue