diff --git a/feely_pona.cpp b/feely_pona.cpp index 6eeb716..a3b1d2d 100644 --- a/feely_pona.cpp +++ b/feely_pona.cpp @@ -1713,6 +1713,7 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input } } else if (entity->spawn_list.size < entity->spawn_cap) { // NOTE: Spawn new entities if (input->timer_s >= entity->next_spawn_timestamp_s) { + uint64_t hp_adjustment = entity->current_wave - 1; entity->next_spawn_timestamp_s = DQN_CAST(uint64_t)(input->timer_s + 5.f); Dqn_V2 entity_world_pos = FP_Game_CalcEntityWorldPos(game, entity->handle); @@ -1720,11 +1721,11 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input Dqn_f32 mob_choice = Dqn_PCG32_NextF32(&game->rng); if (mob_choice <= 0.33f) - link->data = FP_Entity_CreateClinger(game, entity_world_pos, "Clinger"); + link->data = FP_Entity_CreateClinger(game, entity_world_pos, hp_adjustment, "Clinger"); else if (mob_choice <= 0.66f) - link->data = FP_Entity_CreateSmoochie(game, entity_world_pos, "Smoochie"); + link->data = FP_Entity_CreateSmoochie(game, entity_world_pos, hp_adjustment, "Smoochie"); else - link->data = FP_Entity_CreateCatfish(game, entity_world_pos, "Catfish"); + link->data = FP_Entity_CreateCatfish(game, entity_world_pos, hp_adjustment, "Catfish"); // NOTE: Setup the mob with waypoints FP_GameEntity *mob = FP_Game_GetEntity(game, link->data); @@ -2116,6 +2117,10 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer) FP_EntityRenderData club_terry_render_data = FP_Entity_GetRenderData(game, placeable_building.type, placeable_building.state, entity->direction); Dqn_Rect dest_rect = FP_Game_GetBuildingPlacementRectForEntity(game, placeable_building, entity->handle); + Dqn_V4 colour = game->build_mode_can_place_building ? + TELY_Colour_V4Alpha(TELY_COLOUR_WHITE_V4, 0.5f) : + TELY_Colour_V4Alpha(TELY_COLOUR_RED_V4, 0.5f); + Dqn_V4 colour = game->build_mode_can_place_building ? TELY_Colour_V4Alpha(TELY_COLOUR_WHITE_V4, 0.5f) : TELY_Colour_V4Alpha(TELY_COLOUR_RED_V4, 0.5f); @@ -2171,6 +2176,12 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer) } } } + + // NOTE: Add scanlines into the game for A E S T H E T I C S + Dqn_V2 screen_size = Dqn_V2_InitNx2(platform->core.window_size.w, platform->core.window_size.h); + Dqn_f32 scanline_gap = 4.0f; + Dqn_f32 scanline_thickness = 3.0f; + FP_GameRenderCameraFollowScanlines(renderer, screen_size, game->camera.world_pos, scanline_gap, scanline_thickness); } extern "C" __declspec(dllexport) diff --git a/feely_pona_entity_create.cpp b/feely_pona_entity_create.cpp index 9295868..a6c5d26 100644 --- a/feely_pona_entity_create.cpp +++ b/feely_pona_entity_create.cpp @@ -273,7 +273,7 @@ static FP_GameEntityHandle FP_Entity_CreateWaypointF(FP_Game *game, Dqn_V2 pos, return result; } -static FP_GameEntityHandle FP_Entity_CreateClinger(FP_Game *game, Dqn_V2 pos, DQN_FMT_STRING_ANNOTATE char const *fmt, ...) +static FP_GameEntityHandle FP_Entity_CreateClinger(FP_Game *game, Dqn_V2 pos, uint64_t hp_adjustment, DQN_FMT_STRING_ANNOTATE char const *fmt, ...) { va_list args; va_start(args, fmt); @@ -282,7 +282,7 @@ static FP_GameEntityHandle FP_Entity_CreateClinger(FP_Game *game, Dqn_V2 pos, DQ va_end(args); entity->type = FP_EntityType_Clinger; - entity->hp = 1; + entity->hp = 1 + hp_adjustment; entity->is_dying = false; entity->base_acceleration_per_s.meters = 8.f; entity->local_pos = pos; @@ -296,7 +296,7 @@ static FP_GameEntityHandle FP_Entity_CreateClinger(FP_Game *game, Dqn_V2 pos, DQ return result; } -static FP_GameEntityHandle FP_Entity_CreateSmoochie(FP_Game *game, Dqn_V2 pos, DQN_FMT_STRING_ANNOTATE char const *fmt, ...) +static FP_GameEntityHandle FP_Entity_CreateSmoochie(FP_Game *game, Dqn_V2 pos, uint64_t hp_adjustment, DQN_FMT_STRING_ANNOTATE char const *fmt, ...) { va_list args; va_start(args, fmt); @@ -306,7 +306,29 @@ static FP_GameEntityHandle FP_Entity_CreateSmoochie(FP_Game *game, Dqn_V2 pos, D entity->type = FP_EntityType_Smoochie; entity->base_acceleration_per_s.meters = 8.f; - entity->hp = 1; + entity->hp = 1 + hp_adjustment; + entity->is_dying = false; + entity->local_pos = pos; + entity->sprite_height = FP_Entity_GetRenderData(game, entity->type, 0 /*state*/, FP_GameDirection_Down).height; + entity->attack_cooldown_ms = 1000; + entity->local_hit_box_size = FP_Game_MetersToPixelsNx2(game, 0.4f, entity->sprite_height.meters * .6f); + FP_Entity_AddDebugEditorFlags(game, entity->handle); + entity->flags |= FP_GameEntityFlag_NonTraversable; + entity->flags |= FP_GameEntityFlag_Attackable; + return result; +} + +static FP_GameEntityHandle FP_Entity_CreateCatfish(FP_Game *game, Dqn_V2 pos, uint64_t hp_adjustment, DQN_FMT_STRING_ANNOTATE char const *fmt, ...) +{ + va_list args; + va_start(args, fmt); + FP_GameEntity *entity = FP_Game_MakeEntityPointerFV(game, fmt, args); + FP_GameEntityHandle result = entity->handle; + va_end(args); + + entity->type = FP_EntityType_Catfish; + entity->base_acceleration_per_s.meters = 8.f; + entity->hp = 1 + hp_adjustment; entity->is_dying = false; entity->local_pos = pos; entity->sprite_height = FP_Entity_GetRenderData(game, entity->type, 0 /*state*/, FP_GameDirection_Down).height; diff --git a/feely_pona_game.cpp b/feely_pona_game.cpp index 8a3f15d..ba38edf 100644 --- a/feely_pona_game.cpp +++ b/feely_pona_game.cpp @@ -767,3 +767,33 @@ static void FP_Game_EntityTransitionState(FP_Game *game, FP_GameEntity *entity, // NOTE: If no returns are hit above we proceed with the state change entity->action.next_state = desired_state; } + +static void FP_GameRenderScanlines(TELY_Renderer *renderer, Dqn_f32 scanline_gap, Dqn_f32 scanline_thickness, + Dqn_V2 screen_size, Dqn_V2 camera_offset) +{ + Dqn_f32 scanline_interval = scanline_gap + scanline_thickness; + Dqn_f32 y_offset = fmodf(camera_offset.y, scanline_interval); + + for (Dqn_f32 y = -y_offset; y < screen_size.h; y += scanline_interval) + { + Dqn_V2 start = Dqn_V2_InitNx2(0, y); + Dqn_V2 end = Dqn_V2_InitNx2(screen_size.w, y); + TELY_Render_LineColourV4(renderer, start, end, TELY_Colour_V4Alpha(TELY_COLOUR_WHITE_V4, 0.5f), scanline_thickness); + } +} + +static void FP_GameRenderCameraFollowScanlines(TELY_Renderer *renderer, Dqn_V2 screen_size, Dqn_V2 camera_offset, Dqn_f32 scanline_gap, Dqn_f32 scanline_thickness) +{ + Dqn_f32 y_offset = camera_offset.y; + + // Adjust starting y to be more negative + Dqn_f32 starting_y = -screen_size.h - 150 - y_offset; + + for (Dqn_f32 y = starting_y; y < screen_size.h; y += scanline_gap + scanline_thickness) + { + Dqn_V2 start = Dqn_V2_InitNx2(camera_offset.x, y + camera_offset.y); + Dqn_V2 end = Dqn_V2_InitNx2(screen_size.w + camera_offset.x, y + camera_offset.y); + + TELY_Render_LineColourV4(renderer, start, end, TELY_Colour_V4Alpha(TELY_COLOUR_BLACK_V4, 0.5f), scanline_thickness); + } +}