From a7de66b2f8568102503003b86540e448dac0bc95 Mon Sep 17 00:00:00 2001 From: doyle Date: Fri, 13 Oct 2023 00:05:41 +1100 Subject: [PATCH] fp: Add new map and intro screen --- Data/Textures/atlas.png | 4 +- Data/Textures/atlas.txt | 4 +- Data/Textures/atlas/end_screen.png | 3 + Data/Textures/atlas/intro_screen_arrows.png | 3 + Data/Textures/atlas/intro_screen_subtitle.png | 3 + Data/Textures/atlas/intro_screen_terry.png | 3 + Data/Textures/atlas/intro_screen_title.png | 3 + Data/Textures/atlas/map.png | 4 +- Data/Textures/atlas/map_billboard_attack.png | 3 + Data/Textures/atlas/map_billboard_dash.png | 3 + Data/Textures/atlas/map_billboard_monkey.png | 3 + .../atlas/map_billboard_range_attack.png | 3 + Data/Textures/atlas/map_billboard_strafe.png | 3 + Data/Textures/atlas/map_police_1.png | 3 + Data/Textures/atlas/map_police_2.png | 3 + Data/Textures/sprite_spec.txt | 4 +- External/tely | 2 +- build_assets.bat | 10 +- feely_pona.cpp | 103 ++++++++++++++++-- feely_pona.h | 15 ++- project.rdbg | Bin 2092 -> 1832 bytes 21 files changed, 153 insertions(+), 29 deletions(-) create mode 100644 Data/Textures/atlas/end_screen.png create mode 100644 Data/Textures/atlas/intro_screen_arrows.png create mode 100644 Data/Textures/atlas/intro_screen_subtitle.png create mode 100644 Data/Textures/atlas/intro_screen_terry.png create mode 100644 Data/Textures/atlas/intro_screen_title.png create mode 100644 Data/Textures/atlas/map_billboard_attack.png create mode 100644 Data/Textures/atlas/map_billboard_dash.png create mode 100644 Data/Textures/atlas/map_billboard_monkey.png create mode 100644 Data/Textures/atlas/map_billboard_range_attack.png create mode 100644 Data/Textures/atlas/map_billboard_strafe.png create mode 100644 Data/Textures/atlas/map_police_1.png create mode 100644 Data/Textures/atlas/map_police_2.png diff --git a/Data/Textures/atlas.png b/Data/Textures/atlas.png index 00dc4dd..dfbe039 100644 --- a/Data/Textures/atlas.png +++ b/Data/Textures/atlas.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee13563e7a48cb1d8688709ecfcc8677e5a80c139351fd47bad3277a6714937d -size 8366517 +oid sha256:98e2f1d2b9f433270c5dcaeace69cfba358d09abadb5c1d401403d3163b2a7c6 +size 13761750 diff --git a/Data/Textures/atlas.txt b/Data/Textures/atlas.txt index 32870bd..a17263c 100644 --- a/Data/Textures/atlas.txt +++ b/Data/Textures/atlas.txt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:842eaba01f0bf9d25bca4cf4c501877373fa9eaecbfecc30f0bc52a9b2e93b93 -size 10672 +oid sha256:12e87642f9a6f1e5e0c6096a0280b64f99b0460841a05ffebe7593c21dd39f1e +size 11512 diff --git a/Data/Textures/atlas/end_screen.png b/Data/Textures/atlas/end_screen.png new file mode 100644 index 0000000..827b169 --- /dev/null +++ b/Data/Textures/atlas/end_screen.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68909215c9c7faf68710ec8e8aa580a1cddb650b8df4a898a08379e8b919f26b +size 70490 diff --git a/Data/Textures/atlas/intro_screen_arrows.png b/Data/Textures/atlas/intro_screen_arrows.png new file mode 100644 index 0000000..a30acf8 --- /dev/null +++ b/Data/Textures/atlas/intro_screen_arrows.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a10a7e24cd205c2061cb3ed34c15664da61a5c307270c56d2172f8cd2a9abc3 +size 140401 diff --git a/Data/Textures/atlas/intro_screen_subtitle.png b/Data/Textures/atlas/intro_screen_subtitle.png new file mode 100644 index 0000000..071a8a6 --- /dev/null +++ b/Data/Textures/atlas/intro_screen_subtitle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f854a1d2d5af3ae8f7109f3223d7ae0c76b28d9b3d554bb9bf3c0ad80cb948ea +size 325912 diff --git a/Data/Textures/atlas/intro_screen_terry.png b/Data/Textures/atlas/intro_screen_terry.png new file mode 100644 index 0000000..e803a11 --- /dev/null +++ b/Data/Textures/atlas/intro_screen_terry.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:437332b4fdecfa498cb191fd2ba16b575273a56b0bc4a5b7797dc2573b27c818 +size 276903 diff --git a/Data/Textures/atlas/intro_screen_title.png b/Data/Textures/atlas/intro_screen_title.png new file mode 100644 index 0000000..c25183f --- /dev/null +++ b/Data/Textures/atlas/intro_screen_title.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:293ce0ea5d3a90e58caa3df2834728e113bedcb14b2fb740123a6d10275647a8 +size 91162 diff --git a/Data/Textures/atlas/map.png b/Data/Textures/atlas/map.png index fc85298..e0fdf8e 100644 --- a/Data/Textures/atlas/map.png +++ b/Data/Textures/atlas/map.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a3b5dd9ab1b64e66d25083dbd4c0b6abdd70dd545c38a5e4f3f3dd702f6a8f6a -size 615029 +oid sha256:38e2514c51ae5bed3a76ed1f32fffb9cc28a927ac059bb3b3579572ae0ea8dba +size 1738418 diff --git a/Data/Textures/atlas/map_billboard_attack.png b/Data/Textures/atlas/map_billboard_attack.png new file mode 100644 index 0000000..a9d24bb --- /dev/null +++ b/Data/Textures/atlas/map_billboard_attack.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21306f51532693b9a554bf70c02292f5ecc1835a58bbd7ae9303095af61fe699 +size 330166 diff --git a/Data/Textures/atlas/map_billboard_dash.png b/Data/Textures/atlas/map_billboard_dash.png new file mode 100644 index 0000000..852547d --- /dev/null +++ b/Data/Textures/atlas/map_billboard_dash.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3789fc129c56831daf7b0c7030d0a8d8474e331e99012cce002ebbf6bbba0af +size 289253 diff --git a/Data/Textures/atlas/map_billboard_monkey.png b/Data/Textures/atlas/map_billboard_monkey.png new file mode 100644 index 0000000..c9c0155 --- /dev/null +++ b/Data/Textures/atlas/map_billboard_monkey.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c045b9f622c71a78fb5f6e9edb720337b29359cbdda491e896bcb2cf6c265c4a +size 344992 diff --git a/Data/Textures/atlas/map_billboard_range_attack.png b/Data/Textures/atlas/map_billboard_range_attack.png new file mode 100644 index 0000000..8a0f501 --- /dev/null +++ b/Data/Textures/atlas/map_billboard_range_attack.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c9f50f1ce6b099f1634774b859acabc7979281388fabf6c7e144cb467ab631c +size 351864 diff --git a/Data/Textures/atlas/map_billboard_strafe.png b/Data/Textures/atlas/map_billboard_strafe.png new file mode 100644 index 0000000..0e47538 --- /dev/null +++ b/Data/Textures/atlas/map_billboard_strafe.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb30e563be7f389c750ed289ef7fb9b7131564b64e67b99bc6406ea32d2d6755 +size 327803 diff --git a/Data/Textures/atlas/map_police_1.png b/Data/Textures/atlas/map_police_1.png new file mode 100644 index 0000000..313ff6c --- /dev/null +++ b/Data/Textures/atlas/map_police_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:776a600313ffa4a51a06942df622f441727eb982c267bcfb9bb8fccfb2780491 +size 41184 diff --git a/Data/Textures/atlas/map_police_2.png b/Data/Textures/atlas/map_police_2.png new file mode 100644 index 0000000..031364c --- /dev/null +++ b/Data/Textures/atlas/map_police_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5de215736598e70b0f78021b0953b39c38d0780fa65a5064bdda4ed3f94c217 +size 40501 diff --git a/Data/Textures/sprite_spec.txt b/Data/Textures/sprite_spec.txt index dcc2b0f..a1ea82a 100644 --- a/Data/Textures/sprite_spec.txt +++ b/Data/Textures/sprite_spec.txt @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b98df29cf4142477a772668565e5d588d45daef17342d3793b236eabf2280ec5 -size 1707 +oid sha256:7c82ca78c184de30241c54e22d366abcc6305fa55e6875322452d5bcf5a99b3d +size 1955 diff --git a/External/tely b/External/tely index b21c345..b4b45f8 160000 --- a/External/tely +++ b/External/tely @@ -1 +1 @@ -Subproject commit b21c34597fb1ec7db2f4d240a4bf23bd0a4d96fa +Subproject commit b4b45f8d7cf37a4fced06d8afe4a693ee0604823 diff --git a/build_assets.bat b/build_assets.bat index e5c52eb..c8d2974 100644 --- a/build_assets.bat +++ b/build_assets.bat @@ -10,12 +10,4 @@ if not exist "%sprite_packer%" ( exit /B 1 ) -REM %sprite_packer% 4096x4096 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\terry_resized_25%% || exit /b 1 -REM %sprite_packer% 4096x2048 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\terry_merchant_resized_25%% || exit /b 1 -REM %sprite_packer% 4096x2048 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\smoochie_resized_25%% || exit /b 1 -REM %sprite_packer% 4096x2048 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\clinger_resized_25%% || exit /b 1 -REM %sprite_packer% 4096x2048 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\club_terry_resized_25%% || exit /b 1 -REM %sprite_packer% 4096x2048 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\map_resized_25%% || exit /b 1 -REM %sprite_packer% 8192x8192 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\heart_resized_25%% || exit /b 1 - -%sprite_packer% 4096x4096 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\atlas || exit /b 1 +%sprite_packer% 6144x6144 %script_dir%\Data\Textures\sprite_spec.txt %script_dir%\Data\Textures\atlas || exit /b 1 diff --git a/feely_pona.cpp b/feely_pona.cpp index c7b82f3..e555ee5 100644 --- a/feely_pona.cpp +++ b/feely_pona.cpp @@ -3227,13 +3227,9 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer, // NOTE: Render the other game state modes ===================================================== if (game->play.state == FP_GameState_IntroScreen || game->play.state == FP_GameState_WinGame || game->play.state == FP_GameState_LoseGame || game->play.state == FP_GameState_Pause) { + TELY_Render_PushTransform(renderer, Dqn_M2x3_Identity()); DQN_DEFER { TELY_Render_PopTransform(renderer); }; - TELY_Render_RectColourV4( - renderer, - Dqn_Rect_InitNx4(0, 0, DQN_CAST(Dqn_f32)platform->core.window_size.x, DQN_CAST(Dqn_f32)platform->core.window_size.y), - TELY_RenderShapeMode_Fill, - TELY_Colour_V4Alpha(TELY_COLOUR_BLACK_V4, 0.8f)); Dqn_V2I inset = platform->core.window_size * .05f; Dqn_f32 min_inset = DQN_CAST(Dqn_f32)DQN_MIN(inset.x, inset.y); @@ -3241,18 +3237,105 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer, Dqn_V2 draw_p = Dqn_V2_InitNx2(min_inset, min_inset); TELY_Render_PushColourV4(renderer, TELY_COLOUR_WHITE_V4); + Dqn_V4 bg_colour = TELY_Colour_V4Alpha(TELY_COLOUR_BLACK_V4, 0.8f); + if (game->play.state == FP_GameState_IntroScreen) + bg_colour = TELY_Colour_V4InitRGBAU32(0x301010FF); + + TELY_Render_RectColourV4( + renderer, + Dqn_Rect_InitNx4(0, 0, DQN_CAST(Dqn_f32)platform->core.window_size.x, DQN_CAST(Dqn_f32)platform->core.window_size.y), + TELY_RenderShapeMode_Fill, + bg_colour); + if (game->play.state == FP_GameState_IntroScreen) { - TELY_Render_PushFont(renderer, game->inter_regular_font_large); - TELY_Render_TextF(renderer, draw_p, Dqn_V2_Zero, "Feely Pona"); draw_p.y += TELY_Render_FontHeight(renderer, assets); - TELY_Render_PopFont(renderer); + Dqn_Rect window_rect = Dqn_Rect_InitNx4(0, 0, DQN_CAST(Dqn_f32)platform->core.window_size.w, DQN_CAST(Dqn_f32)platform->core.window_size.h); + Dqn_f32 tex_scalar = 0.f; + { + TELY_AssetSpriteAnimation *anim = TELY_Asset_GetSpriteAnimation(&game->atlas_sprite_sheet, g_anim_names.intro_screen_terry); + Dqn_Rect tex_rect = game->atlas_sprite_sheet.rects.data[anim->index]; + Dqn_f32 desired_width = window_rect.size.x; + tex_scalar = desired_width / tex_rect.size.w; + } + + { + TELY_AssetSpriteAnimation *anim = TELY_Asset_GetSpriteAnimation(&game->atlas_sprite_sheet, g_anim_names.intro_screen_terry); + Dqn_Rect tex_rect = game->atlas_sprite_sheet.rects.data[anim->index]; + Dqn_Rect dest_rect = {}; + dest_rect.size = tex_rect.size * tex_scalar; + dest_rect.pos = Dqn_Rect_InterpolatedPoint(window_rect, Dqn_V2_InitNx2(0.5f, 0.5f)) - (dest_rect.size * .5f); + + TELY_Render_TextureColourV4(renderer, + game->atlas_sprite_sheet.tex_handle, + tex_rect, + dest_rect, + Dqn_V2_Zero /*rotate origin*/, + 0.f /*rotation*/, + TELY_COLOUR_WHITE_V4); + } + + { + TELY_AssetSpriteAnimation *anim = TELY_Asset_GetSpriteAnimation(&game->atlas_sprite_sheet, g_anim_names.intro_screen_arrows); + Dqn_Rect tex_rect = game->atlas_sprite_sheet.rects.data[anim->index]; + Dqn_Rect dest_rect = {}; + dest_rect.size = tex_rect.size * tex_scalar; + dest_rect.pos = Dqn_Rect_InterpolatedPoint(window_rect, Dqn_V2_InitNx2(0.5f, 0.5f)) - (dest_rect.size * .5f); + + TELY_Render_TextureColourV4(renderer, + game->atlas_sprite_sheet.tex_handle, + tex_rect, + dest_rect, + Dqn_V2_Zero /*rotate origin*/, + 0.f /*rotation*/, + TELY_COLOUR_WHITE_V4); + } + + { + TELY_AssetSpriteAnimation *anim = TELY_Asset_GetSpriteAnimation(&game->atlas_sprite_sheet, g_anim_names.intro_screen_title); + Dqn_Rect tex_rect = game->atlas_sprite_sheet.rects.data[anim->index]; + Dqn_Rect dest_rect = {}; + dest_rect.size = tex_rect.size * tex_scalar; + dest_rect.pos = Dqn_Rect_InterpolatedPoint(window_rect, Dqn_V2_InitNx2(0.5f, 0.5f)) - (dest_rect.size * .5f); + + TELY_Render_TextureColourV4(renderer, + game->atlas_sprite_sheet.tex_handle, + tex_rect, + dest_rect, + Dqn_V2_Zero /*rotate origin*/, + 0.f /*rotation*/, + TELY_COLOUR_WHITE_V4); + } + + { + TELY_AssetSpriteAnimation *anim = TELY_Asset_GetSpriteAnimation(&game->atlas_sprite_sheet, g_anim_names.intro_screen_subtitle); + Dqn_Rect tex_rect = game->atlas_sprite_sheet.rects.data[anim->index]; + Dqn_Rect dest_rect = {}; + dest_rect.size = tex_rect.size * tex_scalar; + dest_rect.pos = Dqn_Rect_InterpolatedPoint(window_rect, Dqn_V2_InitNx2(0.5f, 0.5f)) - (dest_rect.size * .5f); + + TELY_Render_TextureColourV4(renderer, + game->atlas_sprite_sheet.tex_handle, + tex_rect, + dest_rect, + Dqn_V2_Zero /*rotate origin*/, + 0.f /*rotation*/, + TELY_COLOUR_WHITE_V4); + } TELY_Render_PushFont(renderer, game->inter_regular_font); - TELY_Render_TextF(renderer, draw_p, Dqn_V2_Zero, "Press enter to start"); draw_p.y += TELY_Render_FontHeight(renderer, assets); - TELY_Render_PopFont(renderer); + Dqn_f32 t = (DQN_SINF(DQN_CAST(Dqn_f32)input->timer_s * 5.f) + 1.f) / 2.f; + TELY_Render_PushColourV4(renderer, TELY_Colour_V4Alpha(TELY_COLOUR_WHITE_V4, t)); + TELY_Render_TextF(renderer, Dqn_Rect_InterpolatedPoint(window_rect, Dqn_V2_InitNx2(0.5f, 0.925f)), Dqn_V2_InitNx1(0.5f), "Press enter to start"); TELY_Render_PopColourV4(renderer); + TELY_Render_PopFont(renderer); + + 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, Dqn_V2_Zero, scanline_gap, scanline_thickness); if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_Return)) game->play.state = FP_GameState_Play; + } else if (game->play.state == FP_GameState_LoseGame) { TELY_Render_PushFont(renderer, game->inter_regular_font_large); TELY_Render_TextF(renderer, draw_p, Dqn_V2_Zero, "Terry's heart has been crushed"); draw_p.y += TELY_Render_FontHeight(renderer, assets); diff --git a/feely_pona.h b/feely_pona.h index a6ac0d8..f28aac4 100644 --- a/feely_pona.h +++ b/feely_pona.h @@ -47,6 +47,8 @@ struct FP_GlobalAnimations Dqn_String8 club_terry_alive = DQN_STRING8("club_terry_alive"); Dqn_String8 club_terry_dark = DQN_STRING8("club_terry_dark"); + Dqn_String8 end_screen = DQN_STRING8("end_screen"); + Dqn_String8 heart = DQN_STRING8("heart"); Dqn_String8 heart_bleed = DQN_STRING8("heart_bleed"); @@ -55,9 +57,20 @@ struct FP_GlobalAnimations Dqn_String8 icon_phone = DQN_STRING8("icon_phone"); Dqn_String8 icon_stamina = DQN_STRING8("icon_stamina"); + Dqn_String8 intro_screen_arrows = DQN_STRING8("intro_screen_arrows"); + Dqn_String8 intro_screen_subtitle = DQN_STRING8("intro_screen_subtitle"); + Dqn_String8 intro_screen_terry = DQN_STRING8("intro_screen_terry"); + Dqn_String8 intro_screen_title = DQN_STRING8("intro_screen_title"); + Dqn_String8 kennel_terry = DQN_STRING8("kennel_terry"); - Dqn_String8 map = DQN_STRING8("map"); + Dqn_String8 map = DQN_STRING8("map"); + Dqn_String8 map_billboard_attack = DQN_STRING8("map_billboard_attack"); + Dqn_String8 map_billboard_dash = DQN_STRING8("map_billboard_dash"); + Dqn_String8 map_billboard_monkey = DQN_STRING8("map_billboard_monkey"); + Dqn_String8 map_billboard_range_attack = DQN_STRING8("map_billboard_range_attack"); + Dqn_String8 map_billboard_strafe = DQN_STRING8("map_billboard_strafe"); + Dqn_String8 map_police = DQN_STRING8("map_police"); Dqn_String8 merchant_button_a = DQN_STRING8("merchant_button_a"); Dqn_String8 merchant_button_b = DQN_STRING8("merchant_button_b"); diff --git a/project.rdbg b/project.rdbg index 86bc1479fe1d4354667d17b63f7a9b42cd8e60e3..95cd6f372c0762af79f628880f504c3ed87bfe2e 100644 GIT binary patch delta 197 zcmZ1@u!3)bBa09N1H;|ohuOH+A( zGGInLM4lbUPb^9=i#CV_Sp{S!3jyhRu&(%mqWtut#N7CT#F7kgpm0fQZb3Yz6f;mN zIX8tHNEM|*q=8(J(Ww=w@hO=_AfG~+2uFgvR9ujgSpw3o@O7UM3