fp: Disable collision on mobs when they have experienced the building

This commit is contained in:
doyle 2023-10-06 21:01:54 +11:00
parent 1bbae2a191
commit cfb4106948
2 changed files with 17 additions and 1 deletions

View File

@ -175,8 +175,15 @@ static void FP_Game_MoveEntity(FP_Game *game, FP_GameEntityHandle entity_handle,
case FP_EntityType_Catfish: /*FALLTHRU*/
case FP_EntityType_Smoochie: /*FALLTHRU*/
case FP_EntityType_Clinger: {
if (collider->type == FP_EntityType_Smoochie || collider->type == FP_EntityType_Clinger || collider->type == FP_EntityType_Catfish)
if (collider->type == FP_EntityType_Smoochie || collider->type == FP_EntityType_Clinger || collider->type == FP_EntityType_Catfish) {
entity_collides_with_collider = false;
} else if (FP_Entity_IsBuildingForMobs(collider)) {
// NOTE: We disable collision on buildings we have visited to avoid some
// problems ...
if (FP_SentinelList_Find(&entity->buildings_visited, collider->handle)) {
entity_collides_with_collider = false;
}
}
} break;
case FP_EntityType_Terry: {

View File

@ -3,6 +3,15 @@
#include "feely_pona_unity.h"
#endif
static bool FP_Entity_IsBuildingForMobs(FP_GameEntity *entity)
{
bool result = entity->type == FP_EntityType_AirportTerry ||
entity->type == FP_EntityType_ClubTerry ||
entity->type == FP_EntityType_ChurchTerry ||
entity->type == FP_EntityType_KennelTerry;
return result;
}
static Dqn_f32 FP_Entity_CalcSpriteScaleForDesiredHeight(FP_Game *game, FP_Meters height, Dqn_Rect sprite_rect)
{
Dqn_f32 sprite_in_meters = FP_Game_PixelsToMetersNx1(game, sprite_rect.size.y);