Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch gadgetoid #3

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

Gadgetoid
Copy link
Contributor

Adds PicoSystem support in the least invasive way I could muster. PicoAudio is on standby for when PicoSystem can do something vaguely audio-like for bleeps and bloops.

  • Basic setup for PicoSystem build and 120x120 screen resolution
  • Stub out Audio for Pico using PicoAudio.cpp/hpp
  • Exit some collision detection early for a significant speedup
  • Remove remaining references to backgound_image and clear() to the background colour only once
  • Crude speedhack for Pico - only update onscreen enemies - makes busier levels playable at the cost of consistency with other ports
  • Remove "Colour" and use aligned "Pen" instead

This is a sometimes-different, sometimes-the-same take on @Daft-Freak's diff here - main...Daft-Freak:pico-maybe

I also have a patch to change all iterators to the form for(auto &item : items) if you want it.

Gadgetoid and others added 7 commits August 17, 2021 23:19
* Stub out Audio with PicoAudio.hpp/cpp
* Set up CMakeLists.txt for Pico build
* Support 120x120 PicoSystem screen resolution
Co-authored-by: Charlie Birks <charlie@daft.games>
This crude hack prevents offscreen enemies from being updated, making some of the more intense levels playable on PicoSystem.

Needs a better solution.
Used 32Blit's "Pen" type instead of the custom "Colour" since it's aligned and may be faster.
if(PICO_SDK_PATH)
include(${32BLIT_DIR}/32blit-pico/pico_sdk_import.cmake)
include(${32BLIT_DIR}/32blit-pico/pico_extras_import.cmake)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a wrapper now for this: include(${32BLIT_DIR}/32blit-pico/sdk_import.cmake). Also handles all the other methods of importing the SDK (environment, clone from git... (if that wasn't broken in -extras))

@@ -13,9 +20,16 @@ else()
endif()
find_package (32BLIT CONFIG REQUIRED PATHS ../32blit-sdk)

if(PICO_SDK_PATH)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... which makes this not a great way to check for a pico build. The blit SDK uses 32BLIT_PICO for this.

@@ -558,7 +562,6 @@ float dt;
uint32_t lastTime = 0;

Surface* sg_icon_image = Surface::load(asset_scorpion_games);
Surface* background_image = Surface::load(asset_background);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, RAM savings. Hmm, deleting the splash icon after using it would save... 2k, maybe not super important then.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I could move the splash icon to the spritesheet, since I know I've got space in there

@@ -1782,6 +1763,7 @@ class Entity {
x = foreground[i].x + SPRITE_SIZE - 1;
}
xVel = 0;
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went a step further and skipped the entire loop if xVel was 0. 967e332#diff-ab6f4f9204ca41ac0f2c5132e6d8507701d0eba631f4db894a75bf99b6c65ad7R1755

@Daft-Freak
Copy link
Contributor

Another speed patch: a923738 (fixed-point to the rescue again). Got to the start of level 7 with that (on my branch, so no speedhack), testing further would require me to not die.

@ThePythonator
Copy link
Owner

ThePythonator commented Aug 18, 2021

With all the changes I've made, it's got a bit out of sync. The Colour -> Pen and support for PicoSystem are the main commits which I still need, is it possible for you to rebase and just PR those? I'm regretting everything being in one file because of all these merge conflicts 🤦‍♂️ (edit: just need Colour->Pen now)

@ThePythonator
Copy link
Owner

Most of the PicoSystem stuff is done, but audio stuff messes everything up a bit. Using one shared Audio.hpp header is probably the best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants