Rebase changes
This commit is contained in:
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
+29
-9
@@ -453,10 +453,12 @@ static void FP_PlayReset(FP_Game *game, TELY_Platform *platform)
|
||||
play->merchant_phone_company = FP_Entity_CreateMerchantPhoneCompany(game, base_top_right, "PhoneCompany");
|
||||
}
|
||||
|
||||
#if 0
|
||||
FP_Entity_CreateClubTerry(game, Dqn_V2_InitNx2(+500, -191), "Club Terry");
|
||||
FP_Entity_CreateKennelTerry(game, Dqn_V2_InitNx2(-300, -191), "Kennel Terry");
|
||||
FP_Entity_CreateChurchTerry(game, Dqn_V2_InitNx2(-800, -191), "Church Terry");
|
||||
FP_Entity_CreateAirportTerry(game, Dqn_V2_InitNx2(-1200, -191), "Airport Terry");
|
||||
#endif
|
||||
|
||||
play->tile_size = 37;
|
||||
Dqn_V2I max_tile = platform->core.window_size / play->tile_size;
|
||||
@@ -501,6 +503,13 @@ void TELY_DLL_Init(void *user_data)
|
||||
game->audio[FP_GameAudio_Woosh] = platform->func_load_audio(assets, DQN_STRING8("Woosh"), DQN_STRING8("Data/Audio/woosh.ogg"));
|
||||
game->audio[FP_GameAudio_Ching] = platform->func_load_audio(assets, DQN_STRING8("Ching"), DQN_STRING8("Data/Audio/ching.ogg"));
|
||||
game->audio[FP_GameAudio_Church] = platform->func_load_audio(assets, DQN_STRING8("Church"), DQN_STRING8("Data/Audio/church.ogg"));
|
||||
game->audio[FP_GameAudio_Plane] = platform->func_load_audio(assets, DQN_STRING8("Plane"), DQN_STRING8("Data/Audio/airport.ogg"));
|
||||
game->audio[FP_GameAudio_Club] = platform->func_load_audio(assets, DQN_STRING8("Club"), DQN_STRING8("Data/Audio/club_terry.ogg"));
|
||||
game->audio[FP_GameAudio_Dog] = platform->func_load_audio(assets, DQN_STRING8("Dog"), DQN_STRING8("Data/Audio/dog.ogg"));
|
||||
game->audio[FP_GameAudio_MerchantTerry] = platform->func_load_audio(assets, DQN_STRING8("Door"), DQN_STRING8("Data/Audio/merchant_terry.ogg"));
|
||||
game->audio[FP_GameAudio_MerchantGhost] = platform->func_load_audio(assets, DQN_STRING8("Ghost"), DQN_STRING8("Data/Audio/merchant_ghost.ogg"));
|
||||
game->audio[FP_GameAudio_MerchantGym] = platform->func_load_audio(assets, DQN_STRING8("Gym"), DQN_STRING8("Data/Audio/merchant_gym.ogg"));
|
||||
game->audio[FP_GameAudio_MerchantPhone] = platform->func_load_audio(assets, DQN_STRING8("Phone"), DQN_STRING8("Data/Audio/merchant_tech.ogg"));
|
||||
|
||||
platform->user_data = game;
|
||||
{
|
||||
@@ -1873,14 +1882,17 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input
|
||||
TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_J)) {
|
||||
if (placeable_building.type == FP_EntityType_ClubTerry) {
|
||||
FP_Entity_CreateClubTerry(game, placement_pos, "Club Terry");
|
||||
TELY_Audio_Play(audio, game->audio[FP_GameAudio_Club], 1.f);
|
||||
} else if (placeable_building.type == FP_EntityType_ChurchTerry) {
|
||||
FP_Entity_CreateChurchTerry(game, placement_pos, "Church Terry");
|
||||
TELY_Audio_Play(audio, game->audio[FP_GameAudio_Church], 1.f);
|
||||
} else if (placeable_building.type == FP_EntityType_AirportTerry) {
|
||||
FP_Entity_CreateAirportTerry(game, placement_pos, "Airport Terry");
|
||||
TELY_Audio_Play(audio, game->audio[FP_GameAudio_Plane], 1.f);
|
||||
} else {
|
||||
DQN_ASSERT(placeable_building.type == FP_EntityType_KennelTerry);
|
||||
FP_Entity_CreateKennelTerry(game, placement_pos, "Kennel Terry");
|
||||
TELY_Audio_Play(audio, game->audio[FP_GameAudio_Dog], 1.f);
|
||||
}
|
||||
|
||||
(*inventory_count)--;
|
||||
@@ -1943,12 +1955,10 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input
|
||||
entity->terry_mobile_data_plan_cap);
|
||||
|
||||
// NOTE: Recover hp & stamina
|
||||
entity->stamina = DQN_MIN(entity->stamina + 1, entity->stamina_cap);
|
||||
entity->stamina = DQN_MIN(entity->stamina + 0.25f, entity->stamina_cap);
|
||||
|
||||
if (entity->flags & FP_GameEntityFlag_RecoversHP) {
|
||||
if (game->play.update_counter % 12 == 0) {
|
||||
entity->hp = DQN_MIN(entity->hp + 1, entity->hp_cap);
|
||||
}
|
||||
entity->hp = DQN_MIN(entity->hp + 0.75f, entity->hp_cap);
|
||||
}
|
||||
|
||||
// NOTE: Derive dynmamic bounding boxes ====================================================
|
||||
@@ -2470,6 +2480,7 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer,
|
||||
FP_GameEntity *player = FP_Game_GetEntity(game, game->play.player);
|
||||
Dqn_V2 player_pos = FP_Game_CalcEntityWorldPos(game, game->play.player);
|
||||
{
|
||||
static bool sound_played_flags[4] = {false, false, false, false};
|
||||
FP_GameInventory *invent = &player->inventory;
|
||||
struct FP_MerchantToMenuMapping {
|
||||
FP_GameEntityHandle merchant;
|
||||
@@ -2479,11 +2490,13 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer,
|
||||
uint8_t *inventory_count;
|
||||
uint32_t *building_base_price;
|
||||
uint32_t *upgrade_base_price;
|
||||
FP_GameAudio audio_type;
|
||||
bool *sound_played;
|
||||
} merchants[] = {
|
||||
{game->play.merchant_terry, g_anim_names.merchant_terry_menu, g_anim_names.club_terry_dark, Dqn_V2_InitNx2(0.015f, +0.04f), &invent->clubs, &invent->clubs_base_price, &invent->health_base_price},
|
||||
{game->play.merchant_graveyard, g_anim_names.merchant_graveyard_menu, g_anim_names.church_terry_dark, Dqn_V2_InitNx2(0.04f, -0.15f), &invent->churchs, &invent->churchs_base_price, &invent->stamina_base_price},
|
||||
{game->play.merchant_gym, g_anim_names.merchant_gym_menu, g_anim_names.kennel_terry, Dqn_V2_InitNx2(0, +0), &invent->kennels, &invent->kennels_base_price, &invent->attack_base_price},
|
||||
{game->play.merchant_phone_company, g_anim_names.merchant_phone_company_menu, g_anim_names.airport_terry, Dqn_V2_InitNx2(0, -0.1f), &invent->airports, &invent->airports_base_price, &invent->mobile_plan_base_price},
|
||||
{game->play.merchant_terry, g_anim_names.merchant_terry_menu, g_anim_names.club_terry_dark, Dqn_V2_InitNx2(0.015f, +0.04f), &invent->clubs, &invent->clubs_base_price, &invent->health_base_price, FP_GameAudio_MerchantTerry, &sound_played_flags[0]},
|
||||
{game->play.merchant_graveyard, g_anim_names.merchant_graveyard_menu, g_anim_names.church_terry_dark, Dqn_V2_InitNx2(0.04f, -0.15f), &invent->churchs, &invent->churchs_base_price, &invent->stamina_base_price, FP_GameAudio_MerchantGhost, &sound_played_flags[1]},
|
||||
{game->play.merchant_gym, g_anim_names.merchant_gym_menu, g_anim_names.kennel_terry, Dqn_V2_InitNx2(0, +0), &invent->kennels, &invent->kennels_base_price, &invent->attack_base_price, FP_GameAudio_MerchantGym, &sound_played_flags[2]},
|
||||
{game->play.merchant_phone_company, g_anim_names.merchant_phone_company_menu, g_anim_names.airport_terry, Dqn_V2_InitNx2(0, -0.1f), &invent->airports, &invent->airports_base_price, &invent->mobile_plan_base_price, FP_GameAudio_MerchantPhone, &sound_played_flags[3]},
|
||||
};
|
||||
|
||||
bool activated_merchant = false;
|
||||
@@ -2492,8 +2505,10 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer,
|
||||
Dqn_V2 world_pos = FP_Game_CalcEntityWorldPos(game, merchant_handle);
|
||||
Dqn_f32 dist_squared = Dqn_V2_LengthSq_V2x2(world_pos, player_pos);
|
||||
|
||||
if (dist_squared > DQN_SQUARED(FP_Game_MetersToPixelsNx1(game->play, 4)))
|
||||
if (dist_squared > DQN_SQUARED(FP_Game_MetersToPixelsNx1(game->play, 4))) {
|
||||
*mapping.sound_played = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
// NOTE: Render animated merchant menu =============================
|
||||
activated_merchant = true;
|
||||
@@ -2524,6 +2539,11 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer,
|
||||
Dqn_V2_Zero /*rotate origin*/,
|
||||
0.f /*rotation*/,
|
||||
TELY_COLOUR_WHITE_V4);
|
||||
|
||||
if (activated_merchant && !*mapping.sound_played) {
|
||||
TELY_Audio_Play(audio, game->audio[mapping.audio_type], 1.f);
|
||||
*mapping.sound_played = true;
|
||||
}
|
||||
}
|
||||
|
||||
TELY_Render_PushColourV4(renderer, TELY_COLOUR_WHITE_V4);
|
||||
|
||||
@@ -265,6 +265,13 @@ enum FP_GameAudio
|
||||
FP_GameAudio_Woosh,
|
||||
FP_GameAudio_Ching,
|
||||
FP_GameAudio_Church,
|
||||
FP_GameAudio_Plane,
|
||||
FP_GameAudio_Club,
|
||||
FP_GameAudio_Dog,
|
||||
FP_GameAudio_MerchantTerry,
|
||||
FP_GameAudio_MerchantGhost,
|
||||
FP_GameAudio_MerchantGym,
|
||||
FP_GameAudio_MerchantPhone,
|
||||
FP_GameAudio_Count,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user